Skip to content

Commit

Permalink
Update vite and vitest and fix test compilation and tsconfigs
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
  • Loading branch information
kaisalmen committed Dec 8, 2023
1 parent 781c032 commit ed0eff3
Show file tree
Hide file tree
Showing 28 changed files with 662 additions and 518 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
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
3 changes: 2 additions & 1 deletion examples/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,12 @@
},
"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" },
]
}
13 changes: 8 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,21 @@
"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.18.14",
"@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",
Expand All @@ -26,8 +29,8 @@
"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"
},
"workspaces": [
"packages/*",
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"
]
}
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 ed0eff3

Please sign in to comment.