Skip to content

Commit 343e29b

Browse files
Add file watching with automated reloads for VSCode & Codemirror (#487)
* bump typescript * fix clean scripts * esm builds work, barring antlr-c3 * fix build * fix bundling * selfreview * selfreview * fold in exporting change * fix bundling * mergemain * self review * unignore files * fix lock file * update node version * prevent timeout of e2e tests by testing production builds * mergemain
1 parent 9fcfd2b commit 343e29b

File tree

20 files changed

+111
-69
lines changed

20 files changed

+111
-69
lines changed

.eslintignore

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,8 @@ out/
22
dist/
33
esm/
44
packages/language-support/src/generated-parser/*
5-
vitest.config.ts
6-
vitest.config.mts
7-
rollup.config.js
8-
index.html
9-
packages/language-support/src/highlighting/semanticAnalysis.js
10-
.eslintrc.js
5+
semanticAnalysis.js
116
vendor/*
12-
packages/vscode-extension/genTextMate.js
13-
packages/vscode-extension/esbuild.js
14-
modify-semantic-analysis.js
7+
node_modules/*
8+
packages/vscode-extension/tests/fixtures/textmate/simple-match.js
9+
packages/react-codemirror/playwright/index.tsx

.eslintrc.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,18 @@ module.exports = {
88
env: {
99
browser: true,
1010
es2022: true,
11+
node: true,
1112
},
1213
parser: '@typescript-eslint/parser',
1314
parserOptions: {
15+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
1416
tsconfigRootDir: __dirname,
1517
project: ['./**/tsconfig.json', './**/tsconfig.node.json'],
1618
},
1719
rules: {
1820
'@typescript-eslint/consistent-type-exports': 'error',
1921
'no-console': ['warn', { allow: ['warn', 'error'] }],
22+
'@typescript-eslint/no-var-requires': 'off',
23+
'@typescript-eslint/unbound-method': 'off',
2024
},
2125
};

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
22.15.0
1+
v22.15.0

.vscode/launch.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,16 @@
66
"command": "pnpm dev-codemirror",
77
"name": "Codemirror Playground",
88
"request": "launch",
9-
"type": "node-terminal",
10-
"preLaunchTask": "npm: watch"
9+
"type": "node-terminal"
1110
},
1211
{
1312
"type": "extensionHost",
1413
"request": "launch",
1514
"name": "VSCode Playground",
1615
"runtimeExecutable": "${execPath}",
16+
"env": {
17+
"watch": "true"
18+
},
1719
"args": [
1820
"--extensionDevelopmentPath=${workspaceRoot}/packages/vscode-extension"
1921
],
@@ -25,7 +27,7 @@
2527
],
2628
"autoAttachChildProcesses": true,
2729
"sourceMaps": true,
28-
"preLaunchTask": "npm: build-vscode"
30+
"preLaunchTask": "npm: dev-vscode"
2931
},
3032
{
3133
"type": "extensionHost",

.vscode/tasks.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,12 @@
1313
},
1414
{
1515
"type": "npm",
16-
"script": "build-vscode",
16+
"script": "dev-vscode",
1717
"group": "build",
18-
"problemMatcher": [],
19-
"label": "npm: build-vscode",
20-
"detail": "pnpm build-vscode"
18+
"problemMatcher": "$tsc-watch",
19+
"isBackground": true,
20+
"label": "npm: dev-vscode",
21+
"detail": "pnpm dev-vscode"
2122
}
2223
]
2324
}

package.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,17 @@
1313
"prepare": "husky install",
1414
"build": "pnpm --recursive build",
1515
"build-vscode": "pnpm --filter='neo4j-for-vscode...' build",
16-
"dev-codemirror": "pnpm --filter='...@neo4j-cypher/react-codemirror-playground' build && pnpm --filter='@neo4j-cypher/react-codemirror-playground' dev",
16+
"dev-codemirror": "pnpm --recursive --parallel --filter='@neo4j-cypher/react-codemirror-playground...' dev",
17+
"dev-vscode": "pnpm --recursive --parallel --filter='neo4j-for-vscode...' dev",
1718
"release": "pnpm build && pnpm publish -r --tag next --access=public",
1819
"snapshot-release": "pnpm changeset pre exit && pnpm changeset version --snapshot canary && pnpm install --frozen-lockfile=false && pnpm build && pnpm publish -r --tag canary --no-git-checks --access=public",
1920
"deep-clean": "rimraf -g **/{node_modules,dist,tsconfig.tsbuildinfo}",
2021
"clean": "pnpm --recursive --parallel clean",
2122
"test": "pnpm --recursive --parallel test",
2223
"test:e2e": "pnpm --recursive test:e2e",
2324
"test:formattingIntegrity": "ts-node ./packages/language-support/src/tests/formatting/verification/verificationCheck.ts",
24-
"lint": "eslint . --ext .ts",
25-
"lint-fix": "eslint . --fix --ext .ts",
25+
"lint": "eslint . --ext .ts,.tsx,.js,.mts",
26+
"lint-fix": "pnpm lint --fix",
2627
"format": "prettier --config .prettierrc.json '**/*.ts' --write",
2728
"benchmark": "pnpm --recursive benchmark --concurrency=1"
2829
},
@@ -33,6 +34,7 @@
3334
},
3435
"devDependencies": {
3536
"@changesets/cli": "^2.28.1",
37+
"@types/node": "^22.15.0",
3638
"@typescript-eslint/eslint-plugin": "^7.8.0",
3739
"@typescript-eslint/parser": "^7.0.0",
3840
"concurrently": "^8.2.1",
@@ -48,8 +50,7 @@
4850
"semver": "^7.6.1",
4951
"ts-node": "10.9.1",
5052
"typescript": "5.8.3",
51-
"vitest": "^2.1.9",
52-
"@types/node": "^22.15.0"
53+
"vitest": "^2.1.9"
5354
},
5455
"packageManager": "[email protected]+sha512.2d92c86b7928dc8284f53494fb4201f983da65f0fb4f0d40baafa5cf628fa31dae3e5968f12466f17df7e97310e30f343a648baea1b9b350685dafafffdf5808"
5556
}

packages/language-server/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
"build": "tsc -b && pnpm bundle && pnpm make-executable && pnpm bundle-worker",
4747
"bundle": "esbuild ./src/server.ts --bundle --format=cjs --platform=node --outfile=dist/cypher-language-server.js --minify --conditions=require",
4848
"bundle-worker": "esbuild ./src/lintWorker.ts --bundle --format=cjs --platform=node --conditions=require --outfile=dist/lintWorker.js --minify",
49+
"dev": "tsc --watch",
4950
"make-executable": "cd dist && echo '#!/usr/bin/env node' > cypher-language-server && cat cypher-language-server.js >> cypher-language-server",
5051
"clean": "rm -rf {dist,tsconfig.tsbuildinfo}"
5152
},
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import '@neo4j-cypher/lint-worker/lintWorker';

packages/language-support/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@
2828
"types": "./dist/esm/project/language-support/src/index.d.ts",
2929
"exports": {
3030
".": {
31+
"types": "./dist/esm/project/language-support/src/index.d.ts",
3132
"require": "./dist/cjs/index.cjs",
3233
"import": "./dist/esm/project/language-support/src/index.js",
33-
"default": "./dist/cjs/index.cjs",
34-
"types": "./dist/esm/project/language-support/src/index.d.ts"
34+
"default": "./dist/cjs/index.cjs"
3535
}
3636
},
3737
"sideEffects": false,
@@ -56,6 +56,7 @@
5656
"build": "cd ../../vendor/antlr4-c3/ && pnpm build && cd - && pnpm gen-parser && concurrently 'npm:build-esm-and-types' 'npm:build-commonjs'",
5757
"build-esm-and-types": "tsc --module esnext --outDir dist/esm/project/language-support && cp src/syntaxValidation/semanticAnalysis.js dist/esm/project/language-support/src/syntaxValidation/semanticAnalysis.js && mkdir -p dist/esm/vendor/antlr4-c3/dist/ && cp -r ../../vendor/antlr4-c3/dist/esm dist/esm/vendor/antlr4-c3/dist/",
5858
"build-commonjs": "esbuild ./src/index.ts --bundle --format=cjs --sourcemap --outfile=dist/cjs/index.cjs",
59+
"dev": "pnpm build && concurrently 'tsc --module esnext --outDir dist/esm/project/language-support --watch' 'npm:build-commonjs -- --watch'",
5960
"benchmark": "esbuild ./src/tests/benchmarks/benchmark.ts --bundle --outfile=dist/benchmark/benchmark.js && BENCHMARKING=true node dist/benchmark/benchmark.js",
6061
"clean": "rm -rf {dist,src/generated-parser}",
6162
"test": "vitest run"

packages/query-tools/package.json

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,10 @@
3030
"neo4j-driver": "catalog:"
3131
},
3232
"scripts": {
33-
"build": "concurrently \"npm:build-esm\" \"npm:build-commonjs\"",
33+
"build": "concurrently 'npm:build-esm' 'npm:build-commonjs'",
3434
"build-esm": "tsc --module esnext --outDir dist/esm",
3535
"build-commonjs": "tsc --module commonjs --outDir dist/cjs",
36+
"dev": "concurrently 'npm:build-esm -- --watch' 'npm:build-commonjs -- --watch'",
3637
"clean": "rm -rf {dist,tsconfig.tsbuildinfo}"
37-
},
38-
"devDependencies": {
39-
"@types/node": "^22.15.0"
4038
}
4139
}

0 commit comments

Comments
 (0)