From 0461abfc73fbf75fe41d2004cd52444d5b9b4904 Mon Sep 17 00:00:00 2001 From: Nigel Breslaw Date: Wed, 13 Nov 2024 20:19:17 +0200 Subject: [PATCH] Avoid building Rust on pnpm install --- .../actions/test-online-editor/action.yaml | 2 +- .github/workflows/build_docs.yaml | 2 +- .github/workflows/ci.yaml | 4 ++-- .github/workflows/fmt_lint_typecheck.yaml | 2 +- .github/workflows/nightly_snapshot.yaml | 2 +- .../wasm_editor_and_interpreter.yaml | 2 +- api/node/package.json | 3 +-- cspell.json | 1 + demos/home-automation/node/package.json | 3 ++- demos/printerdemo/node/README | 4 ---- demos/printerdemo/node/package.json | 5 ++-- editors/vscode/README.md | 2 +- examples/carousel/node/README | 8 ++----- examples/carousel/node/package.json | 5 ++-- examples/imagefilter/node/README | 5 ---- examples/imagefilter/node/package.json | 4 ++-- examples/memory/package.json | 5 ++-- examples/todo/node/README | 8 ++----- examples/todo/node/package.json | 5 ++-- pnpm-lock.yaml | 24 ++++++++++++++++--- pnpm-workspace.yaml | 3 +++ 21 files changed, 54 insertions(+), 45 deletions(-) diff --git a/.github/actions/test-online-editor/action.yaml b/.github/actions/test-online-editor/action.yaml index f4a03d1be02..a23362de3ff 100644 --- a/.github/actions/test-online-editor/action.yaml +++ b/.github/actions/test-online-editor/action.yaml @@ -57,7 +57,7 @@ runs: uses: pnpm/action-setup@v4.0.0 with: version: 9.11.0 - run: pnpm install --frozen-lockfile --ignore-scripts + run: pnpm install --frozen-lockfile shell: bash working-directory: tools/slintpad diff --git a/.github/workflows/build_docs.yaml b/.github/workflows/build_docs.yaml index d2d4867cd4b..2bb9d85225f 100644 --- a/.github/workflows/build_docs.yaml +++ b/.github/workflows/build_docs.yaml @@ -100,7 +100,7 @@ jobs: - name: "Node docs" run: | - pnpm install --frozen-lockfile --ignore-scripts + pnpm install --frozen-lockfile pnpm run docs working-directory: api/node diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index c355611d22d..be4b6e8e809 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -142,7 +142,7 @@ jobs: key: x-napi-v2-${{ steps.node-install.outputs.node-version }} # the cache key consists of a manually bumpable version and the node version, as the cached rustc artifacts contain linking information where to find node.lib, which is in a versioned directory. - name: Run pnpm install working-directory: api/node - run: pnpm install --frozen-lockfile --ignore-scripts + run: pnpm install --frozen-lockfile - name: Build node plugin in debug run: pnpm build:testing working-directory: api/node @@ -345,7 +345,7 @@ jobs: echo 1 > target/debug/slint-lsp - name: Run pnpm install working-directory: editors/vscode - run: pnpm install --frozen-lockfile --ignore-scripts + run: pnpm install --frozen-lockfile - name: vscode prebuild working-directory: editors/vscode run: pnpm vscode:prepublish diff --git a/.github/workflows/fmt_lint_typecheck.yaml b/.github/workflows/fmt_lint_typecheck.yaml index 26e2d3cfb93..54bac057b32 100644 --- a/.github/workflows/fmt_lint_typecheck.yaml +++ b/.github/workflows/fmt_lint_typecheck.yaml @@ -39,7 +39,7 @@ jobs: run: biome format biome.json - name: Format, Lint on npm projects run: | - pnpm install --frozen-lockfile --ignore-scripts + pnpm install --frozen-lockfile pnpm format pnpm lint - name: Suggest format changes diff --git a/.github/workflows/nightly_snapshot.yaml b/.github/workflows/nightly_snapshot.yaml index deb40ca759e..743e19023e4 100644 --- a/.github/workflows/nightly_snapshot.yaml +++ b/.github/workflows/nightly_snapshot.yaml @@ -291,7 +291,7 @@ jobs: shell: bash - name: "pnpm install" working-directory: editors/vscode - run: pnpm install --frozen-lockfile --ignore-scripts + run: pnpm install --frozen-lockfile - name: Install wasm-pack run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh - name: Build package and optionally publish to Visual Studio Marketplace diff --git a/.github/workflows/wasm_editor_and_interpreter.yaml b/.github/workflows/wasm_editor_and_interpreter.yaml index eadf1c74cad..0f27f2a1f47 100644 --- a/.github/workflows/wasm_editor_and_interpreter.yaml +++ b/.github/workflows/wasm_editor_and_interpreter.yaml @@ -67,7 +67,7 @@ jobs: with: name: wasm - name: Install NPM dependencies - run: pnpm install --frozen-lockfile --ignore-scripts + run: pnpm install --frozen-lockfile working-directory: tools/slintpad - name: Compile slintpad diff --git a/api/node/package.json b/api/node/package.json index 1fb872f0ddb..98a9c431270 100644 --- a/api/node/package.json +++ b/api/node/package.json @@ -36,11 +36,10 @@ }, "scripts": { "artifacts": "napi artifacts", - "compile": "tsc", + "compile": "tsc --build", "build": "napi build --platform --release --js rust-module.cjs --dts rust-module.d.ts -c binaries.json", "build:debug": "napi build --platform --js rust-module.cjs --dts rust-module.d.ts -c binaries.json && pnpm compile", "build:testing": "napi build --platform --js rust-module.cjs --dts rust-module.d.ts -c binaries.json --features testing && pnpm compile", - "install": "node build-on-demand.mjs", "docs": "pnpm build && typedoc --hideGenerator --treatWarningsAsErrors --readme cover.md typescript/index.ts", "check": "biome check", "format": "biome format", diff --git a/cspell.json b/cspell.json index c1028e71719..8e25b9a3cf0 100644 --- a/cspell.json +++ b/cspell.json @@ -106,6 +106,7 @@ "opengl", "opengles", "pixmap", + "prestart", "printerdemo", "riscv", "rowspan", diff --git a/demos/home-automation/node/package.json b/demos/home-automation/node/package.json index 6f6bb42c2d8..d12e64a609d 100644 --- a/demos/home-automation/node/package.json +++ b/demos/home-automation/node/package.json @@ -5,10 +5,11 @@ "type": "module", "dependencies": { "@biomejs/biome": "1.9.3", - "slint-ui": "../../../api/node" + "slint-ui": "workspace:*" }, "scripts": { "start": "node .", + "prestart": "cd ../../../api/node/ && node build-on-demand.mjs && pnpm compile", "check": "biome check", "format": "biome format", "format:fix": "biome format --write", diff --git a/demos/printerdemo/node/README b/demos/printerdemo/node/README index 4a07b806302..8d840292cab 100644 --- a/demos/printerdemo/node/README +++ b/demos/printerdemo/node/README @@ -1,8 +1,4 @@ Run with -# pushd ../../../api/node # pnpm install -# pnpm compile -# popd -# pnpm install --ignore-scripts # pnpm start diff --git a/demos/printerdemo/node/package.json b/demos/printerdemo/node/package.json index 326f50a243b..982273884b0 100644 --- a/demos/printerdemo/node/package.json +++ b/demos/printerdemo/node/package.json @@ -4,9 +4,10 @@ "main": "main.js", "type": "module", "dependencies": { - "slint-ui": "../../../api/node" + "slint-ui": "workspace:*" }, "scripts": { - "start": "node ." + "start": "node .", + "prestart": "cd ../../../api/node/ && node build-on-demand.mjs && pnpm compile" } } \ No newline at end of file diff --git a/editors/vscode/README.md b/editors/vscode/README.md index 51633efa2be..6e60be90cf6 100644 --- a/editors/vscode/README.md +++ b/editors/vscode/README.md @@ -45,7 +45,7 @@ The following step will build a local version of the vscode extension and the LS cargo install wasm-pack cargo build -p slint-lsp cd editors/vscode -pnpm install --frozen-lockfile --ignore-scripts +pnpm install --frozen-lockfile pnpm build:wasm_lsp pnpm compile ``` diff --git a/examples/carousel/node/README b/examples/carousel/node/README index 64f0239f262..657ccd24561 100644 --- a/examples/carousel/node/README +++ b/examples/carousel/node/README @@ -1,7 +1,3 @@ Run with -# pushd ../../../api/node -# npm install -# npm run compile -# popd -# npm install -# npm start +# pnpm install +# pnpm start diff --git a/examples/carousel/node/package.json b/examples/carousel/node/package.json index 95e012c56a7..03bb18a1e99 100644 --- a/examples/carousel/node/package.json +++ b/examples/carousel/node/package.json @@ -4,9 +4,10 @@ "main": "main.js", "type": "module", "dependencies": { - "slint-ui": "../../../api/node" + "slint-ui": "workspace:*" }, "scripts": { - "start": "node ." + "start": "node .", + "prestart": "cd ../../../api/node/ && node build-on-demand.mjs && pnpm compile" } } \ No newline at end of file diff --git a/examples/imagefilter/node/README b/examples/imagefilter/node/README index 15c2bb29194..657ccd24561 100644 --- a/examples/imagefilter/node/README +++ b/examples/imagefilter/node/README @@ -1,8 +1,3 @@ Run with - -# pushd ../../../api/node # pnpm install -# pnpm run compile -# popd -# pnpm install --ignore-scripts # pnpm start diff --git a/examples/imagefilter/node/package.json b/examples/imagefilter/node/package.json index 0e9495cb45b..554c9be59ed 100644 --- a/examples/imagefilter/node/package.json +++ b/examples/imagefilter/node/package.json @@ -4,7 +4,7 @@ "main": "main.js", "type": "module", "dependencies": { - "slint-ui": "../../../api/node", + "slint-ui": "workspace:*", "jimp": "1.6.0" }, "devDependencies": { @@ -13,7 +13,7 @@ }, "scripts": { "start": "tsc --build && node ./main.js", + "prestart": "cd ../../../api/node/ && node build-on-demand.mjs && pnpm compile", "type-check": "tsc --noEmit" - } } diff --git a/examples/memory/package.json b/examples/memory/package.json index bd11eb2f549..f7505c0e855 100644 --- a/examples/memory/package.json +++ b/examples/memory/package.json @@ -4,9 +4,10 @@ "main": "main.js", "type": "module", "dependencies": { - "slint-ui": "../../api/node" + "slint-ui": "workspace:*" }, "scripts": { - "start": "node ." + "start": "node .", + "prestart": "cd ../../api/node/ && node build-on-demand.mjs && pnpm compile" } } \ No newline at end of file diff --git a/examples/todo/node/README b/examples/todo/node/README index 64f0239f262..657ccd24561 100644 --- a/examples/todo/node/README +++ b/examples/todo/node/README @@ -1,7 +1,3 @@ Run with -# pushd ../../../api/node -# npm install -# npm run compile -# popd -# npm install -# npm start +# pnpm install +# pnpm start diff --git a/examples/todo/node/package.json b/examples/todo/node/package.json index ec36ff70c0c..6e6cc45797d 100644 --- a/examples/todo/node/package.json +++ b/examples/todo/node/package.json @@ -4,9 +4,10 @@ "main": "main.js", "type": "module", "dependencies": { - "slint-ui": "../../../api/node" + "slint-ui": "workspace:*" }, "scripts": { - "start": "node ." + "start": "node .", + "prestart": "cd ../../../api/node/ && node build-on-demand.mjs && pnpm compile" } } \ No newline at end of file diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 2b18f381104..4a4cb2798b1 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -51,13 +51,13 @@ importers: specifier: 1.9.3 version: 1.9.3 slint-ui: - specifier: ../../../api/node + specifier: workspace:* version: link:../../../api/node demos/printerdemo/node: dependencies: slint-ui: - specifier: ../../../api/node + specifier: workspace:* version: link:../../../api/node docs/editor: @@ -146,13 +146,19 @@ importers: specifier: 0.1.3 version: 0.1.3 + examples/carousel/node: + dependencies: + slint-ui: + specifier: workspace:* + version: link:../../../api/node + examples/imagefilter/node: dependencies: jimp: specifier: 1.6.0 version: 1.6.0 slint-ui: - specifier: ../../../api/node + specifier: workspace:* version: link:../../../api/node devDependencies: '@types/node': @@ -162,6 +168,18 @@ importers: specifier: 5.6.2 version: 5.6.2 + examples/memory: + dependencies: + slint-ui: + specifier: workspace:* + version: link:../../api/node + + examples/todo/node: + dependencies: + slint-ui: + specifier: workspace:* + version: link:../../../api/node + tools/slintpad: devDependencies: '@biomejs/biome': diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index 907be1bedc3..fd9987504ac 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -7,4 +7,7 @@ packages: - "demos/printerdemo/node" - "demos/home-automation/node" - "examples/imagefilter/node" + - "examples/carousel/node" + - "examples/todo/node" + - "examples/memory" - "docs/editor"