Skip to content

Commit

Permalink
Cleanup npm scripts and tooling configs
Browse files Browse the repository at this point in the history
Signed-off-by: Vit Gottwald <vit.gottwald@broadcom.com>
  • Loading branch information
VitGottwald committed Jan 29, 2025
1 parent 132f589 commit b0750c4
Show file tree
Hide file tree
Showing 15 changed files with 76 additions and 218 deletions.
4 changes: 4 additions & 0 deletions .env_sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Make your own copy to .env which is .gitignore(d)

# Stop the language server at initial breakpoint
DEBUG_BREAK="true"
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
- name: Build monorepo
shell: bash
run: |
pnpm install
pnpm install --frozen-lockfile
pnpm build
- name: Test monorepo
if: success() || failure()
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
node_modules/
dist/
out/
.DS_Store
.env
**/src/generated
**/syntaxes/pli.merged.json
*.tsbuildinfo
Expand Down
11 changes: 8 additions & 3 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@
"${workspaceFolder}/packages/language/out/**/*",
"${workspaceFolder}/packages/vscode-extension/out/**/*"
],
"env": {
// "DEBUG_BREAK": "true"
}
"envFile": "${workspaceFolder}/.env"
},
{
"name": "Run Web Extension",
Expand Down Expand Up @@ -87,5 +85,12 @@
"smartStep": true,
"console": "integratedTerminal"
}
],
"compounds": [
{
"name": "Extension + Language Server",
"configurations": ["Run Extension", "Attach to Language Server"],
"stopAll": true
}
]
}
46 changes: 24 additions & 22 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,26 @@
{
"name": "pli-workspace",
"description": "Base workspace package",
"version": "0.0.1",
"type": "module",
"private": true,
"scripts": {
"watch": "tsc -b tsconfig.build.json --watch",
"build": "pnpm langium:generate && tsc -b tsconfig.build.json && pnpm --dir packages/vscode-extension build && node ./scripts/merge-tmlanguage.mjs",
"build:clean": "pnpm clean && pnpm build",
"langium:generate": "pnpm --dir packages/language langium:generate",
"langium:watch": "pnpm --dir packages/language langium:watch",
"test": "vitest"
},
"devDependencies": {
"@types/node": "^18.19.70",
"deepmerge": "^1.5.2",
"langium": "~3.2.1",
"prettier": "^3.4.2",
"shx": "~0.3.4",
"typescript": "~5.4.5",
"vitest": "^1.6.0"
}
"name": "pli-workspace",
"description": "Base workspace package",
"version": "0.0.1",
"type": "module",
"private": true,
"scripts": {
"clean": "pnpm --dir packages/language clean; pnpm --dir packages/vscode-extension clean",
"generate": "pnpm --dir packages/language langium:generate",
"compile": "tsc -b tsconfig.build.json",
"bundle": "pnpm --dir packages/vscode-extension esbuild:bundle",
"merge": "node ./scripts/merge-tmlanguage.mjs",
"build": "pnpm clean && pnpm generate && pnpm compile && pnpm bundle && pnpm merge",
"test": "vitest",
"pretty": "prettier -w '**/*.ts'"
},
"devDependencies": {
"@types/node": "^18.19.70",
"deepmerge": "^1.5.2",
"langium": "~3.2.1",
"prettier": "^3.4.2",
"shx": "~0.3.4",
"typescript": "~5.4.5",
"vitest": "^1.6.0"
}
}
7 changes: 2 additions & 5 deletions packages/language/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,8 @@
}
},
"scripts": {
"clean": "shx rm -fr *.tsbuildinfo out",
"build": "echo 'No build step'",
"build:clean": "npm run clean && npm run build",
"langium:generate": "langium generate",
"langium:watch": "langium generate --watch"
"clean": "shx rm -fr *.tsbuildinfo out src/generated",
"langium:generate": "langium generate"
},
"dependencies": {
"chevrotain": "^11.0.3",
Expand Down
2 changes: 1 addition & 1 deletion packages/language/src/parser/pli-token-builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export class PliTokenBuilder extends DefaultTokenBuilder {
}
});
const execFragment = tokens.find((e) => e.name === "ExecFragment")!;
execFragment.START_CHARS_HINT = ["S", "C"];
execFragment.START_CHARS_HINT = ["S", "C"]; // (S)QL, (C)ICS
return tokens;
}
}
6 changes: 3 additions & 3 deletions packages/language/tsconfig.test.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"extends": "./tsconfig.src.json",
"extends": "../../tsconfig.json",
"compilerOptions": {
"noEmit": true,
"rootDir": "test"
"rootDir": "test",
"noEmit": true
},
"references": [
{
Expand Down
8 changes: 4 additions & 4 deletions packages/vscode-extension/esbuild.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const nodeCtx = await esbuild.context({
entryPoints: ["src/extension/main.ts", "src/language/main.ts"],
outdir: "out",
bundle: true,
target: "ES2017",
target: "ESNext",
// VSCode's extension host is still using cjs, so we need to transform the code
format: "cjs",
// To prevent confusing node, we explicitly use the `.cjs` extension
Expand All @@ -54,7 +54,7 @@ const nodeCtx = await esbuild.context({
loader: { ".ts": "ts" },
external: ["vscode"],
platform: "node",
sourcemap: !minify,
sourcemap: true,
minify,
plugins,
});
Expand All @@ -67,12 +67,12 @@ const browserCtx = await esbuild.context({
],
outdir: "out",
bundle: true,
target: "ES2017",
target: "ESNext",
format: "cjs",
loader: { ".ts": "ts" },
external: ["vscode"],
platform: "browser",
sourcemap: !minify,
sourcemap: true,
minify,
plugins,
});
Expand Down
9 changes: 3 additions & 6 deletions packages/vscode-extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,10 @@
"main": "./out/extension/main.cjs",
"browser": "./out/extension/main-browser.js",
"scripts": {
"clean": "shx rm -fr *.tsbuildinfo out",
"vscode:prepublish": "npm run build && node esbuild.mjs --minify",
"clean": "shx rm -fr *.tsbuildinfo out syntaxes/pli.merged.json",
"vscode:prepublish": "node esbuild.mjs --minify",
"package": "vsce package",
"build": "tsc -b tsconfig.json && node esbuild.mjs",
"build:clean": "npm run clean && npm run build",
"watch": "concurrently -n tsc,esbuild -c blue,yellow \"tsc -b tsconfig.json --watch\" \"node esbuild.mjs --watch\""
"esbuild:bundle": "node esbuild.mjs"
},
"vsce": {
"dependencies": false
Expand All @@ -64,7 +62,6 @@
"devDependencies": {
"@types/vscode": "~1.67.0",
"@vscode/vsce": "^3.0.0",
"concurrently": "~8.2.1",
"esbuild": "~0.21.5"
}
}
4 changes: 2 additions & 2 deletions packages/vscode-extension/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"noEmit": true,
"rootDir": ".",
"lib": ["DOM", "ES2022"]
"noEmit": true,
"lib": ["DOM", "ESNext"]
},
"references": [
{
Expand Down
Loading

0 comments on commit b0750c4

Please sign in to comment.