Skip to content

Commit

Permalink
Update vite and vitest and fix test compilation and tsconfigs (#410)
Browse files Browse the repository at this point in the history
- Fix vscode issue. Add proper tsc build configuration to examples integrate it into overall watch
- Fix references to local projects not resolved in vscode, fix lint, remove tasks
- Add test code compilation
- Only use one thread for test execution (circumvent vitest concurrency issue)
- Update inversify and reflect-metadata
  • Loading branch information
kaisalmen authored Dec 9, 2023
1 parent 4b4da39 commit ee9698d
Show file tree
Hide file tree
Showing 33 changed files with 714 additions and 536 deletions.
3 changes: 2 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ module.exports = {
parser: '@typescript-eslint/parser',
ignorePatterns: [
'**/{node_modules,lib}',
'**/sprotty-local-template/**/*'
'**/sprotty-local-template/**/*',
'**/lib/**/src/**/*'
],
parserOptions: {
tsconfigRootDir: __dirname,
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: '16'
node-version: '18'
- name: Build
run: yarn
- name: Lint
Expand Down
75 changes: 0 additions & 75 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,6 @@
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "Build all",
"type": "shell",
"detail": "Build Sprotty and Sprotty examples",
"group": {
"kind": "build",
"isDefault": true
},
"presentation": {
"echo": false,
"focus": false,
"panel": "shared",
"showReuseMessage": false,
"clear": false
},
"command": "echo 😎 Finished building Sprotty and Sprotty examples",
"isBackground": true,
"problemMatcher": [],
"dependsOrder": "sequence",
"dependsOn": [
"Build Sprotty",
"Build Sprotty examples"
]
},
{
"label": "Build Sprotty",
"type": "shell",
Expand All @@ -43,42 +19,6 @@
"$eslint-compact"
]
},
{
"label": "Build Sprotty examples",
"type": "shell",
"command": "yarn --cwd examples build",
"group": "build",
"presentation": {
"focus": false,
"panel": "shared",
"showReuseMessage": false,
"clear": false
},
"problemMatcher": [
"$tsc",
"$eslint-compact"
]
},
{
"label": "Watch all",
"detail": "Watch Sprotty and Sprotty example",
"type": "shell",
"group": "none",
"presentation": {
"echo": false,
"focus": false,
"panel": "dedicated",
"showReuseMessage": false,
"clear": true
},
"command": "echo",
"problemMatcher": [],
"dependsOrder": "parallel",
"dependsOn": [
"Watch Sprotty",
"Watch Sprotty examples"
]
},
{
"label": "Watch Sprotty",
"type": "shell",
Expand All @@ -93,21 +33,6 @@
"problemMatcher": [
"$tsc-watch"
]
},
{
"label": "Watch Sprotty examples",
"type": "shell",
"command": "yarn examples:watch",
"group": "none",
"presentation": {
"focus": false,
"panel": "dedicated",
"showReuseMessage": false,
"clear": true
},
"problemMatcher": [
"$tsc-watch"
]
}
]
}
5 changes: 2 additions & 3 deletions examples/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
/resources/
/server/*.js
/server/*.js.map
/resources
/lib
11 changes: 8 additions & 3 deletions examples/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"dependencies": {
"@vscode/codicons": "^0.0.33",
"express": "^4.18.2",
"inversify": "^6.0.1",
"reflect-metadata": "^0.1.13",
"inversify": "~6.0.2",
"reflect-metadata": "~0.1.14",
"sprotty": "^1.0.0",
"sprotty-elk": "^1.0.0",
"ws": "^8.14.2"
Expand All @@ -24,13 +24,18 @@
"webpack": "^5.88.2",
"webpack-cli": "^5.1.4"
},
"volta": {
"node": "18.19.0",
"yarn": "1.22.21"
},
"scripts": {
"prepare": "yarn run build",
"clean": "shx rm -fr lib artifacts *.tsbuildinfo",
"compile": "tsc -b tsconfig.json",
"build": "webpack && npm run compile",
"watch": "yarn run watch:browser",
"watch:browser": "webpack --watch",
"watch:server": "tsc -w",
"start": "node ./server/server-app"
"start": "node ./lib/server/server-app"
}
}
2 changes: 1 addition & 1 deletion examples/server/server-app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ wsServer.on('connection', socket => {
});
});

serverApp.use(express.static(path.join(__dirname, '..')));
serverApp.use(express.static(path.join(__dirname, '../..')));

const server = serverApp.listen(8080, () => {
console.log('Sprotty examples are available at http://localhost:8080');
Expand Down
23 changes: 13 additions & 10 deletions examples/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"types": [
"reflect-metadata",
"webpack-env"
],
"composite": false,
"declaration": false,
"declarationMap": false
"outDir": "lib",
"rootDir": "."
},
"include": [
"./server/**/*.ts"
"**/src/**/*.ts",
"**/src/**/*.tsx",
"server/**/*.ts"
],
"exclude": [
"**/*.spec.ts",
"**/*.spec.tsx"
"lib",
"node_modules",
"resources"
],
"references": [
{ "path": "../packages/sprotty-protocol/tsconfig.src.json" },
{ "path": "../packages/sprotty/tsconfig.src.json" },
{ "path": "../packages/sprotty-elk/tsconfig.src.json" },
]
}
19 changes: 13 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,37 @@
"prepare": "yarn run clean && yarn run build",
"clean": "lerna run clean",
"build": "tsc --build tsconfig.build.json && yarn --cwd examples build",
"watch": "concurrently -n sprotty,examples -c blue,green, \"yarn --cwd examples watch\" \"tsc -b tsconfig.build.json -w\"",
"watch:tsc": "tsc --build --watch tsconfig.build.json",
"watch": "concurrently -n sprotty,examples -c blue,green, \"yarn --cwd examples watch\" \"yarn run watch:tsc\"",
"lint": "eslint {**/src/**/*.ts,**/src/**/*.tsx}",
"lint:fix": "eslint {**/src/**/*.ts,**/src/**/*.tsx} --fix",
"test": "vitest run",
"coverage": "vitest run --coverage",
"test": "vitest run --config vite.config.mts",
"coverage": "vitest run --coverage --config vite.config.mts",
"publish:prepare": "lerna version --ignore-scripts --yes --no-push",
"publish:latest": "lerna publish from-git --yes --no-push",
"publish:next": "SHA=$(git rev-parse --short HEAD) && lerna publish preminor --exact --canary --preid next.${SHA} --dist-tag next --no-git-reset --no-git-tag-version --no-push --ignore-scripts --yes --no-verify-access"
},
"devDependencies": {
"@types/node": "~18.19.3",
"@typescript-eslint/eslint-plugin": "^6.10.0",
"@typescript-eslint/parser": "^6.10.0",
"@vitest/coverage-v8": "~1.0.2",
"eslint": "^8.53.0",
"concurrently": "~8.2.1",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-header": "^3.1.1",
"eslint-plugin-no-null": "^1.0.2",
"lerna": "^7.3.0",
"reflect-metadata": "^0.1.13",
"reflect-metadata": "~0.1.14",
"semver": "^7.5.4",
"shx": "^0.3.4",
"typescript": "~5.2.2",
"@vitest/coverage-v8": "~0.34.6",
"vitest": "~0.34.6"
"vite": "~5.0.6",
"vitest": "~1.0.2"
},
"volta": {
"node": "18.19.0",
"yarn": "1.22.21"
},
"workspaces": [
"packages/*",
Expand Down
4 changes: 4 additions & 0 deletions packages/generator-sprotty/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@
"@types/yeoman-test": "^4.0.4",
"yeoman-test": "^7.4.0"
},
"volta": {
"node": "18.19.0",
"yarn": "1.22.21"
},
"scripts": {
"clean": "shx rm -fr app *.tsbuildinfo",
"build": "tsc",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "<%= project-name %>",
"description": "Please enter a brief description here",
"dependencies": {
"inversify": "^6.0.1",
"inversify": "~6.0.2",
"reflect-metadata": "^0.1.13",
"sprotty": "^1.0.0"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
"compilerOptions": {
"target": "ES2022",
"module": "commonjs",
"types": [
"reflect-metadata"
],
"esModuleInterop": true,
"sourceMap": true,
"experimentalDecorators": true,
Expand Down
3 changes: 2 additions & 1 deletion packages/generator-sprotty/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"src"
],
"exclude": [
"app"
"app",
"node_modules"
]
}
6 changes: 5 additions & 1 deletion packages/sprotty-elk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@
"sprotty-protocol": "^1.0.0"
},
"optionalDependencies": {
"inversify": "^6.0.1"
"inversify": "~6.0.2"
},
"volta": {
"node": "18.19.0",
"yarn": "1.22.21"
},
"scripts": {
"clean": "shx rm -fr lib artifacts *.tsbuildinfo",
Expand Down
22 changes: 10 additions & 12 deletions packages/sprotty-elk/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
// this file is required for VSCode to work properly
{
"extends": "../../tsconfig.json",
"extends": "./tsconfig.src.json",
"compilerOptions": {
"rootDir": "src",
"outDir": "lib",
"types": [
"node"
]
"noEmit": true,
"rootDir": "."
},
"include": [
"src"
"src/**/*"
],
"exclude": [
"**/*.spec.ts",
"**/*.spec.tsx"
"lib",
"node_modules"
],
"references": [
{ "path": "../sprotty-protocol/tsconfig.json"},
{ "path": "../sprotty/tsconfig.json" }
{ "path": "../sprotty-protocol/tsconfig.src.json"},
{ "path": "../sprotty/tsconfig.src.json" }
]
}
}
21 changes: 21 additions & 0 deletions packages/sprotty-elk/tsconfig.src.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"rootDir": "src",
"outDir": "lib"
},
"include": [
"**/*.ts",
"**/*.tsx"
],
"exclude": [
"**/*.spec.ts",
"**/*.spec.tsx",
"lib",
"node_modules"
],
"references": [
{ "path": "../sprotty-protocol/tsconfig.src.json"},
{ "path": "../sprotty/tsconfig.src.json" }
]
}
19 changes: 19 additions & 0 deletions packages/sprotty-elk/tsconfig.test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"extends": "./tsconfig.src.json",
"compilerOptions": {
"rootDir": "src",
"noEmit": true,
"skipLibCheck": true
},
"references": [{
"path": "./tsconfig.src.json"
}],
"include": [
"**/*.spec.ts",
"**/*.spec.tsx"
],
"exclude": [
"lib",
"node_modules"
]
}
Loading

0 comments on commit ee9698d

Please sign in to comment.