Skip to content

Commit c93343b

Browse files
committed
[apacheGH-2456]: Change the project type to module, and update files to match the import type (import, from ES6)
1 parent 7286411 commit c93343b

File tree

15 files changed

+215
-184
lines changed

15 files changed

+215
-184
lines changed

jena-fuseki2/jena-fuseki-ui/.eslintrc.js

Lines changed: 0 additions & 61 deletions
This file was deleted.

jena-fuseki2/jena-fuseki-ui/cypress.config.js renamed to jena-fuseki2/jena-fuseki-ui/cypress.config.mjs

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,14 @@
1515
* limitations under the License.
1616
*/
1717

18-
const { defineConfig } = require('cypress')
19-
const vitePreprocessor = require('./tests/e2e/support/vite-preprocessor')
20-
const path = require('path')
18+
import {defineConfig} from 'cypress'
19+
import codeCoverageTask from '@cypress/code-coverage/task.js'
20+
import vitePreprocessor from 'cypress-vite'
21+
import {resolve} from 'path'
2122

22-
module.exports = defineConfig({
23+
const __dirname = resolve()
24+
25+
export default defineConfig({
2326
video: false,
2427
defaultCommandTimeout: 20000,
2528
execTimeout: 30000,
@@ -31,14 +34,18 @@ module.exports = defineConfig({
3134
e2e: {
3235
baseUrl: 'http://localhost:' + (process.env.PORT || 8080),
3336
setupNodeEvents (on, config) {
34-
// For test coverage
35-
require('@cypress/code-coverage/task')(on, config)
36-
37-
on(
38-
'file:preprocessor',
39-
vitePreprocessor(path.resolve(__dirname, 'vite.config.js'))
40-
)
41-
return require('./tests/e2e/plugins/index.js')(on, config)
37+
codeCoverageTask(on, config)
38+
on('before:browser:launch', (browser, launchOptions) => {
39+
if (browser.name === 'chrome' && browser.isHeadless) {
40+
launchOptions.args.push('--window-size=1440,1024', '--force-device-scale-factor=1')
41+
}
42+
return launchOptions
43+
})
44+
on('file:preprocessor', vitePreprocessor({
45+
configFile: resolve(__dirname, './vite.config.js'),
46+
mode: 'development',
47+
}))
48+
return config
4249
},
4350
specPattern: 'tests/e2e/specs/**/*.cy.{js,jsx,ts,tsx}',
4451
fixturesFolder: 'tests/e2e/fixtures',
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
/**
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the 'License'); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an 'AS IS' BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
import js from '@eslint/js'
19+
import pluginVue from 'eslint-plugin-vue'
20+
21+
export default [
22+
js.configs.recommended,
23+
...pluginVue.configs['flat/recommended'],
24+
{
25+
'files': [
26+
'**/*.mjs',
27+
'**/*.js',
28+
'**/*.vue'
29+
],
30+
'ignores': [
31+
'node_modules/*',
32+
'dist/*',
33+
'tests/coverage/*'
34+
],
35+
'rules': {
36+
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
37+
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
38+
'vue/custom-event-name-casing': 'off',
39+
'vue/multi-word-component-names': 'off',
40+
'vue/no-reserved-component-names': 'off',
41+
'vue/order-in-components': 'off',
42+
'vue/max-attributes-per-line': 'off',
43+
'vue/attributes-order': 'off',
44+
'vue/html-self-closing': 'off'
45+
},
46+
'languageOptions': {
47+
'ecmaVersion': 2021,
48+
'globals': {
49+
'process': true,
50+
'describe': true,
51+
'it': true,
52+
'Cypress': true,
53+
'cy': true,
54+
'expect': true,
55+
'before': true,
56+
'beforeEach': true,
57+
'after': true,
58+
'afterEach': true,
59+
'__dirname': true
60+
}
61+
}
62+
}
63+
];

jena-fuseki2/jena-fuseki-ui/package.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"name": "apache-jena-fuseki",
3+
"type": "module",
34
"version": "1.0.0",
45
"private": false,
56
"description": "Apache Jena Fuseki UI",
@@ -11,7 +12,7 @@
1112
"build": "vite build",
1213
"test:unit": "vitest run --environment jsdom",
1314
"test:e2e": "cross-env FUSEKI_PORT=\"${FUSEKI_PORT:=3030}\" PORT=\"${PORT:=8080}\" concurrently --names 'SERVER,CLIENT,TESTS' --prefix-colors 'yellow,blue,green' --success 'first' --kill-others 'yarn run serve:fuseki' 'yarn wait-on http://localhost:${FUSEKI_PORT}/$/ping && yarn run dev' 'yarn wait-on http-get://localhost:${PORT}/index.html && cypress run $@'",
14-
"lint": "eslint --ext .js,.vue --ignore-path .gitignore --fix src",
15+
"lint": "eslint --fix src",
1516
"coverage:unit": "yarn run test:unit --coverage",
1617
"coverage:e2e": "cross-env-shell CYPRESS_COVERAGE=true yarn run test:e2e",
1718
"serve:fuseki": "nodemon src/services/mock/json-server.js",
@@ -36,8 +37,9 @@
3637
"devDependencies": {
3738
"@cypress/code-coverage": "^3.12.4",
3839
"@cypress/vue": "^6.0.0",
40+
"@eslint/js": "^9.2.0",
3941
"@vitejs/plugin-vue": "^5.0.3",
40-
"@vitest/coverage-c8": "^0.33.0",
42+
"@vitest/coverage-v8": "^1.6.0",
4143
"@vue/compiler-sfc": "^3.3.6",
4244
"@vue/eslint-config-standard": "^8.0.1",
4345
"@vue/test-utils": "^2.4.1",
@@ -60,7 +62,7 @@
6062
"sass": "^1.69.4",
6163
"sinon": "^17.0.0",
6264
"vite": "^5.0.12",
63-
"vite-plugin-istanbul": "6.0.0",
65+
"vite-plugin-istanbul": "^6.0.2",
6466
"vitest": "^1.3.1",
6567
"wait-on": "^7.0.1"
6668
},

jena-fuseki2/jena-fuseki-ui/src/main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* limitations under the License.
1616
*/
1717

18-
import { createApp, h } from 'vue'
18+
import { createApp } from 'vue'
1919
import App from './App.vue'
2020
import router from './router'
2121
import 'bootstrap/dist/js/bootstrap.bundle.min'

jena-fuseki2/jena-fuseki-ui/src/mixins/current-dataset-navigation-guards.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ export default {
3030
})
3131
},
3232
async beforeRouteUpdate (from, to, next) {
33+
// eslint-disable-next-line no-unused-vars
3334
next(async vm => {
3435
await this.loadCurrentDataset()
3536
})

jena-fuseki2/jena-fuseki-ui/src/mixins/list-datasets.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
* limitations under the License.
1616
*/
1717

18-
import { BUS } from '@/events'
19-
2018
export default {
2119
data () {
2220
return {

jena-fuseki2/jena-fuseki-ui/src/services/mock/json-server.js

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@
1515
* limitations under the License.
1616
*/
1717

18+
import jsonServer from 'json-server'
19+
1820
const PORT = process.env.FUSEKI_PORT || 3030
1921

2022
const data = {}
2123

22-
const jsonServer = require('json-server')
23-
2424
const server = jsonServer.create()
2525
const router = jsonServer.router(data)
2626
const middlewares = jsonServer.defaults()
@@ -260,8 +260,6 @@ server.get('/:datasetName/data', (req, res) => {
260260
.send(dataContent)
261261
})
262262

263-
let failUpload = false
264-
265263
// Upload data.
266264
server.post('/:datasetName/data', (req, res) => {
267265
res
@@ -282,9 +280,15 @@ server.get('/\\$/ping', (req, res) => {
282280
// RESET TEST DATA
283281
server.get('/tests/reset', (req, res) => {
284282
// Just delete the datasets to clean up for other tests to have a
285-
// brand new environment.
286-
for (const dataset in DATASETS) {
287-
delete DATASETS[dataset]
283+
// brand-new environment.
284+
if (DATASETS) {
285+
try {
286+
for (const dataset in DATASETS) {
287+
delete DATASETS[dataset]
288+
}
289+
} catch (e) {
290+
console.log(e)
291+
}
288292
}
289293
res.sendStatus(200)
290294
})

jena-fuseki2/jena-fuseki-ui/src/views/dataset/Edit.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,6 @@ export default {
261261
this.loadingGraph = true
262262
this.selectedGraph = graphName
263263
try {
264-
const dataEndpoint = this.services['gsp-rw']['srv.endpoints'].find(endpoint => endpoint !== '') || ''
265264
const result = await this.$fusekiService.fetchGraph(
266265
this.datasetName,
267266
this.services['gsp-rw']['srv.endpoints'],

jena-fuseki2/jena-fuseki-ui/src/views/dataset/Query.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,7 @@ export default {
327327
},
328328
329329
watch: {
330+
/* eslint-disable no-unused-vars */
330331
datasetUrl: function (val, oldVal) {
331332
this.currentDatasetUrl = val
332333
},
@@ -345,6 +346,7 @@ export default {
345346
this.yasqe.options.requestConfig.acceptHeaderGraph = this.contentTypeGraph
346347
}
347348
}
349+
/* eslint-enable no-unused-vars */
348350
},
349351
350352
methods: {

0 commit comments

Comments
 (0)