From 9165e438fa726e73368950ae557b0854a9090b4d Mon Sep 17 00:00:00 2001 From: Simon Bin Date: Tue, 7 Feb 2023 13:57:50 +0100 Subject: [PATCH] Revert "Move from webpack to Vite" This reverts commit b1fc7bfb19e8fd4f9be4142aa0eee7c33b8593e7. Workaround for https://github.com/vitejs/vite/issues/11804 --- jena-fuseki2/jena-fuseki-ui/.eslintrc.js | 4 +- jena-fuseki2/jena-fuseki-ui/.nycrc | 23 + jena-fuseki2/jena-fuseki-ui/README.md | 34 - jena-fuseki2/jena-fuseki-ui/babel.config.js | 26 + jena-fuseki2/jena-fuseki-ui/cypress.config.js | 22 +- jena-fuseki2/jena-fuseki-ui/package.json | 45 +- .../jena-fuseki-ui/{ => public}/index.html | 7 +- jena-fuseki2/jena-fuseki-ui/src/App.vue | 2 +- .../jena-fuseki-ui/src/components/Menu.vue | 2 +- .../src/components/dataset/TableListing.vue | 2 +- .../jena-fuseki-ui/src/plugins/toast.js | 2 +- .../jena-fuseki-ui/src/router/index.js | 22 +- .../src/services/mock/json-server.js | 12 +- .../jena-fuseki-ui/src/views/Home.vue | 2 +- .../jena-fuseki-ui/src/views/dataset/Edit.vue | 4 +- .../jena-fuseki-ui/src/views/dataset/Info.vue | 4 +- .../src/views/dataset/Query.vue | 6 +- .../src/views/dataset/Upload.vue | 4 +- .../src/views/manage/ExistingDatasets.vue | 4 +- .../src/views/manage/NewDataset.vue | 2 +- .../jena-fuseki-ui/src/views/manage/Tasks.vue | 4 +- .../jena-fuseki-ui/tests/e2e/.eslintrc.js | 2 + .../jena-fuseki-ui/tests/e2e/plugins/index.js | 26 +- .../tests/e2e/specs/datasets.cy.js | 12 +- .../tests/e2e/specs/query.cy.js | 6 +- .../jena-fuseki-ui/tests/e2e/support/index.js | 1 + .../dataset/tablelisting.vue.spec.js | 2 +- .../unit/components/serverstatus.vue.spec.js | 2 +- .../unit/services/fuseki.service.spec.js | 2 +- jena-fuseki2/jena-fuseki-ui/vite.config.js | 90 - jena-fuseki2/jena-fuseki-ui/vue.config.js | 100 + jena-fuseki2/jena-fuseki-ui/yarn.lock | 5158 +++++++++++++++-- 32 files changed, 4888 insertions(+), 746 deletions(-) create mode 100644 jena-fuseki2/jena-fuseki-ui/.nycrc delete mode 100644 jena-fuseki2/jena-fuseki-ui/README.md create mode 100644 jena-fuseki2/jena-fuseki-ui/babel.config.js rename jena-fuseki2/jena-fuseki-ui/{ => public}/index.html (80%) delete mode 100644 jena-fuseki2/jena-fuseki-ui/vite.config.js create mode 100644 jena-fuseki2/jena-fuseki-ui/vue.config.js diff --git a/jena-fuseki2/jena-fuseki-ui/.eslintrc.js b/jena-fuseki2/jena-fuseki-ui/.eslintrc.js index a40740b35e9..5a7ad1b6790 100644 --- a/jena-fuseki2/jena-fuseki-ui/.eslintrc.js +++ b/jena-fuseki2/jena-fuseki-ui/.eslintrc.js @@ -18,13 +18,13 @@ module.exports = { root: true, env: { - node: true, - es2021: true, + node: true }, extends: [ 'plugin:vue/vue3-recommended' ], parserOptions: { + parser: '@babel/eslint-parser', requireConfigFile: false }, rules: { diff --git a/jena-fuseki2/jena-fuseki-ui/.nycrc b/jena-fuseki2/jena-fuseki-ui/.nycrc new file mode 100644 index 00000000000..28629983436 --- /dev/null +++ b/jena-fuseki2/jena-fuseki-ui/.nycrc @@ -0,0 +1,23 @@ +{ + "all": true, + "cache": false, + "check-coverage": false, + "include": ["src/**/*.js", "src/**/*.vue"], + "exclude": [ + "**/node_modules/**", + "**/dist/**", + "**/tests/**", + "**/*.spec.js", + "**/*.mock.*.js", + "src/assets/**/*.*", + "src/events/**/*.*", + "src/router/**/*.*", + "src/styles/**/*.*", + "src/main.js" + ], + "excludeNodeModules": true, + "extension": [".js", ".ts", ".vue"], + "instrument": true, + "reporter": ["html", "lcov", "text-summary"], + "sourceMap": false +} diff --git a/jena-fuseki2/jena-fuseki-ui/README.md b/jena-fuseki2/jena-fuseki-ui/README.md deleted file mode 100644 index 2da90c4f884..00000000000 --- a/jena-fuseki2/jena-fuseki-ui/README.md +++ /dev/null @@ -1,34 +0,0 @@ -# Jena Fuseki UI - -Jena Fuseki UI is a Vue 3 application built with Vue Router, Vite, Bootstrap 5 (and Popper), -Vue components (Vue Upload component and custom components for Jena), FontAwesome (icons), -Axios (HTTP client), and YASGUI (YASQE and YASR) for SPARQL query editor with code syntax -highlighting and auto-complete. - -It interfaces with the backend application, Jena Fuseki servlets, via HTTP requests with -YASGUI and Axios. - -## Build - -`package.json` contains the following scripts: - -- `dev` - - Serves the application with Vite using Hot Module Reload (ideal for rapid development in an IDE). -- `serve` - - Runs Vite to preview the application from the build directory (useful to preview a production build, for example). -- `build` - - Builds the application (you can choose the mode, for production, development, etc.). -- `test:unit` - - Runs unit tests with Vitest. -- `test:e2e` - - Runs e2e tests with Cypress. -- `lint` - - Lints the code (`eslint`) -- `coverage:unit` - - Runs unit tests with Vitest and tracks coverage. -- `coverage:e2e` - - Runs e2e tests with Cypress and tracks coverage. -- `serve:fuseki` - - Starts a fake Fuseki backend with responses saves from a real instance. Used to test the UI without the backend, and for e2e tests. -- `serve:offline` - - Runs both the serve:offline and the serve scripts to serve the UI offline. diff --git a/jena-fuseki2/jena-fuseki-ui/babel.config.js b/jena-fuseki2/jena-fuseki-ui/babel.config.js new file mode 100644 index 00000000000..caca713e48b --- /dev/null +++ b/jena-fuseki2/jena-fuseki-ui/babel.config.js @@ -0,0 +1,26 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +module.exports = { + presets: [ + '@vue/cli-plugin-babel/preset' + ], + plugins: [ + '@babel/plugin-transform-runtime', + 'istanbul' + ] +} diff --git a/jena-fuseki2/jena-fuseki-ui/cypress.config.js b/jena-fuseki2/jena-fuseki-ui/cypress.config.js index 473f3958006..ee04e0010c4 100644 --- a/jena-fuseki2/jena-fuseki-ui/cypress.config.js +++ b/jena-fuseki2/jena-fuseki-ui/cypress.config.js @@ -16,7 +16,6 @@ */ const { defineConfig } = require('cypress') -const vitePreprocessor = require('cypress-vite') module.exports = defineConfig({ video: false, @@ -26,23 +25,22 @@ module.exports = defineConfig({ pageLoadTimeout: 15000, requestTimeout: 7500, responseTimeout: 7500, + fixturesFolder: 'tests/e2e/fixtures', + screenshotsFolder: 'tests/e2e/screenshots', + videosFolder: 'tests/e2e/videos', e2e: { - baseUrl: 'http://localhost:8080/', setupNodeEvents (on, config) { - on('file:preprocessor', vitePreprocessor()) return require('./tests/e2e/plugins/index.js')(on, config) }, specPattern: 'tests/e2e/specs/**/*.cy.{js,jsx,ts,tsx}', - fixturesFolder: 'tests/e2e/fixtures', - screenshotsFolder: 'tests/e2e/screenshots', - videosFolder: 'tests/e2e/videos', - supportFile: 'tests/e2e/support/index.js', + supportFile: 'tests/e2e/support/index.js' }, - env: { - codeCoverage: { - exclude: 'cypress/**/*.*', - }, - }, + component: { + devServer: { + framework: 'vue-cli', + bundler: 'webpack' + } + } }) diff --git a/jena-fuseki2/jena-fuseki-ui/package.json b/jena-fuseki2/jena-fuseki-ui/package.json index d14abb42e0a..87bee8dd37c 100644 --- a/jena-fuseki2/jena-fuseki-ui/package.json +++ b/jena-fuseki2/jena-fuseki-ui/package.json @@ -6,17 +6,16 @@ "author": "Apache Jena Team", "license": "Apache-2.0", "scripts": { - "dev": "vite", - "serve": "vite preview --port 8080", + "serve": "vue-cli-service serve", "prebuild": "patch -F0 -ff -p1 < yasqe.lateral.patch", - "build": "vite build", - "test:unit": "vitest run --environment jsdom", - "test:e2e": "bash -c 'concurrently --names \"SERVER,TESTS\" --prefix-colors \"yellow,blue\" --success \"first\" --kill-others \"yarn run serve:offline\" \"cross-env CYPRESS_COVERAGE=false cypress run ${0}\"'", - "lint": "eslint --ext .js,.vue --ignore-path .gitignore --fix src", - "coverage:unit": "vitest run --environment jsdom --coverage", - "coverage:e2e": "bash -c 'concurrently --names \"SERVER,TESTS\" --prefix-colors \"yellow,blue\" --success \"first\" --kill-others \"yarn run serve:offline\" \"cross-env CYPRESS_COVERAGE=true cypress run ${0}\"'", + "build": "vue-cli-service build", + "test:unit": "vue-cli-service test:unit", + "test:e2e": "bash -c 'concurrently --names \"SERVER,TESTS\" --prefix-colors \"yellow,blue\" --success \"first\" --kill-others \"yarn run serve:fuseki\" \"vue-cli-service test:e2e ${0}\"'", + "lint": "vue-cli-service lint", + "coverage:e2e": "bash -c 'concurrently --names \"SERVER,TESTS\" --prefix-colors \"yellow,blue\" --success \"first\" --kill-others \"yarn run serve:fuseki\" \"nyc vue-cli-service test:e2e ${0}\"'", + "coverage:unit": "nyc vue-cli-service test:unit", "serve:fuseki": "nodemon src/services/mock/json-server.js", - "serve:offline": "concurrently --names 'SERVER,CLIENT' --prefix-colors 'yellow,blue' --success \"first\" --kill-others 'yarn run serve:fuseki' 'yarn run dev'" + "serve:offline": "concurrently --names 'SERVER,CLIENT' --prefix-colors 'yellow,blue' --success \"first\" --kill-others 'yarn run serve:fuseki' 'yarn run serve'" }, "dependencies": { "@fortawesome/fontawesome-svg-core": "^6.2.0", @@ -28,6 +27,7 @@ "@vue/compat": "^3.2.39", "axios": "^0.27.2", "bootstrap": "^5.2.1", + "core-js": "^3.25.2", "follow-redirects": "^1.15.2", "mitt": "^3.0.0", "nanoid": "^4.0.0", @@ -36,33 +36,40 @@ "vue-upload-component": "^3.1.2" }, "devDependencies": { + "@babel/eslint-parser": "^7.19.1", + "@babel/register": "^7.18.9", "@cypress/code-coverage": "^3.10.0", "@cypress/vue": "^4.2.0", - "@vitejs/plugin-vue": "^4.0.0", - "@vitest/coverage-c8": "^0.27.1", + "@cypress/webpack-preprocessor": "^5.12.2", + "@istanbuljs/nyc-config-babel": "^3.0.0", + "@vue/cli-plugin-babel": "~5.0.8", + "@vue/cli-plugin-e2e-cypress": "^5.0.8", + "@vue/cli-plugin-eslint": "~5.0.8", + "@vue/cli-plugin-unit-mocha": "~5.0.8", + "@vue/cli-service": "~5.0.8", "@vue/compiler-sfc": "^3.2.39", "@vue/eslint-config-standard": "^8.0.1", "@vue/test-utils": "^2.0.2", + "babel-plugin-istanbul": "^6.1.1", + "chai": "^4.3.6", "concurrently": "^7.4.0", - "cross-env": "^7.0.3", - "cypress": "^12.1.0", - "cypress-vite": "^1.3.0", + "cypress": "^10.8.0", "eslint": "^8.23.1", - "eslint-plugin-cypress": "^2.12.1", "eslint-plugin-import": "^2.26.0", "eslint-plugin-node": "^11.1.0", "eslint-plugin-promise": "^6.0.1", "eslint-plugin-standard": "^5.0.0", "eslint-plugin-vue": "^9.5.1", "express": "^4.18.1", - "jsdom": "^21.0.0", + "istanbul-instrumenter-loader": "^3.0.1", + "istanbul-lib-coverage": "^3.2.0", "json-server": "^0.17.0", "nodemon": "^2.0.20", + "nyc": "^15.1.0", "sass": "^1.54.9", + "sass-loader": "^13.0.2", "sinon": "^14.0.0", - "vite": "^4.0.4", - "vite-plugin-istanbul": "^4.0.0", - "vitest": "^0.27.1" + "webpack": "^5.74.0" }, "overrides": { "terser": "^5.14.2", diff --git a/jena-fuseki2/jena-fuseki-ui/index.html b/jena-fuseki2/jena-fuseki-ui/public/index.html similarity index 80% rename from jena-fuseki2/jena-fuseki-ui/index.html rename to jena-fuseki2/jena-fuseki-ui/public/index.html index 188eeac2b59..b5496a71bab 100644 --- a/jena-fuseki2/jena-fuseki-ui/index.html +++ b/jena-fuseki2/jena-fuseki-ui/public/index.html @@ -20,15 +20,14 @@ - - Apache Jena Fuseki UI + + <%= htmlWebpackPlugin.options.title %>
- diff --git a/jena-fuseki2/jena-fuseki-ui/src/App.vue b/jena-fuseki2/jena-fuseki-ui/src/App.vue index 25195ba7f88..8e87d182a48 100644 --- a/jena-fuseki2/jena-fuseki-ui/src/App.vue +++ b/jena-fuseki2/jena-fuseki-ui/src/App.vue @@ -28,7 +28,7 @@