Skip to content

Cleanup npm scripts and tooling configs #36

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Jan 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"
4 changes: 4 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
* text=auto
*.ts text eol=lf
*.json text eol=lf
*.md text eol=lf
9 changes: 8 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,17 @@ jobs:
with:
node-version-file: '.nvmrc'
cache: 'pnpm'
- name: Install node modules
shell: bash
run: |
pnpm install --frozen-lockfile
- name: Lint sources
shell: bash
run: |
pnpm lint
- name: Build monorepo
shell: bash
run: |
pnpm install
pnpm build
- name: Test monorepo
if: success() || failure()
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/playground.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ jobs:
cache: 'pnpm'
- name: Build Playground
run: |
pnpm install
pnpm build:playground
pnpm install --frozen-lockfile
pnpm build
pnpm playground
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@v4.7.2
with:
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/pr-previews.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,12 @@ jobs:
with:
node-version-file: '.nvmrc'
cache: 'pnpm'
- name: Build Playground
- name: Build PR Preview
if: github.event.action != 'closed'
run: |
pnpm install
pnpm build:playground
pnpm install --frozen-lockfile
pnpm build
pnpm playground
- uses: rossjrw/pr-preview-action@v1.6.0
with:
source-dir: ./packages/playground/out
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
3 changes: 2 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"recommendations": [
"langium.langium-vscode",
"vitest.explorer"
"vitest.explorer",
"esbenp.prettier-vscode"
]
}
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
}
]
}
49 changes: 26 additions & 23 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,28 @@
{
"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",
"build:playground": "pnpm build && pnpm --dir packages/playground 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",
"lint": "prettier -c \"**/*.ts\"",
"pretty": "prettier -w \"**/*.ts\"",
"playground": "pnpm --dir packages/playground build"
},
"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
3 changes: 1 addition & 2 deletions packages/playground/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import importMetaUrlPlugin from "@codingame/esbuild-import-meta-url-plugin";
import type { UserConfig } from "vite";

const config: UserConfig = {
base: '',
base: "",
build: {
target: "ES2022",
rollupOptions: {
Expand All @@ -29,4 +29,3 @@ const config: UserConfig = {
},
};
export default config;

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