Use pnpm to build the vscode extension (#5888)

Replaces npm with pnpm for building the extension.
This commit is contained in:
Nigel Breslaw 2024-08-21 16:55:12 +03:00 committed by GitHub
parent 85063dc4dc
commit ab49903a06
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 2971 additions and 13 deletions

View file

@ -238,6 +238,9 @@ jobs:
with:
name: vscode-lsp-binary-x86_64-unknown-linux-gnu
path: editors/vscode/bin
- uses: pnpm/action-setup@v4.0.0
with:
version: 9.7.1
- uses: actions/download-artifact@v4
with:
name: vscode-lsp-binary-x86_64-pc-windows-msvc
@ -265,9 +268,9 @@ jobs:
if [ "$RELEASE_INPUT" != "true" ]; then
../../scripts/prepare_vscode_nightly.sh
fi
- name: "npm install"
- name: "pnpm install"
working-directory: editors/vscode
run: npm install
run: pnpm install
- 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

View file

@ -147,7 +147,11 @@ License: OFL-1.1
Files: examples/weather-demo/android-res/*/ic_launcher.png
Copyright: Copyright © Felgo GmbH <contact@felgo.com>
License: CC-BY-ND-4.0
x
Files: examples/weather-demo/ui/assets/felgo-logo.svg
Copyright: Copyright © Felgo GmbH <contact@felgo.com>
License: CC-BY-ND-4.0
Files: editors/vscode/pnpm-lock.yaml
Copyright: Copyright © SixtyFPS GmbH <info@slint.dev>
License: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0

View file

@ -2,3 +2,4 @@
LICENSE.txt
bin/
out/
webviews/

View file

@ -4,8 +4,12 @@
"out": false // set this to true to hide the "out" folder with the compiled JS files
},
"search.exclude": {
"out": true // set this to false to include "out" folder in search results
"out": true, // set this to false to include "out" folder in search results
"dist": true // set this to false to include "dist" folders in search results
},
// Turn off tsc task auto detection since we have the necessary tasks as npm scripts
"typescript.tsc.autoDetect": "off"
"typescript.tsc.autoDetect": "off",
"cSpell.words": [
"webviews"
]
}

View file

@ -31,6 +31,12 @@ visible, it is not necessary to save the file.
Issues should be reported in the [Slint issue tracker](https://github.com/slint-ui/slint/labels/vscode-extension).
## Tools
Ensure you have node 18.x or higher and a pnpm version >= 9.x installed. The exact latest versions can be found in the package.json file.
## New NPM dependencies
The pnpm-lock.yaml file should be updated and committed to the repository. If you end up with a conflict do not delete the lock file, but instead run `pnpm install` to update and fix it.
## Building from source and debugging
The following step will build a local version of the vscode extension and the LSP
@ -39,13 +45,13 @@ 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
npm install
npm run build:wasm_lsp
npm run compile
pnpm install
pnpm build:wasm_lsp
pnpm compile
```
Later, you only need to do the steps for the part you change like `cargo build -p slint-lsp` to rebuild the lsp binary
or `npm run compile` to rebuild the typescript.
or `pnpm compile` to rebuild the typescript.
You can run vscode with that extension by running, in the `editors/vscode` directory:
@ -64,7 +70,7 @@ To create a `.vsix` package for local installation:
2. Create a `.vsix` package (needs `vsce` installed)
```sh
npm run local-package
pnpm local-package
```
3. Install the `.vsix` file with

View file

@ -185,7 +185,7 @@
"bin/slint-lsp-*"
],
"scripts": {
"vscode:prepublish": "npm run build:wasm_lsp-release && npm run compile && shx echo \"GPL-3.0-only OR LicenseRef-Slint-Software-3.0\" > LICENSE.txt",
"vscode:prepublish": "pnpm build:wasm_lsp-release && pnpm compile && shx echo \"GPL-3.0-only OR LicenseRef-Slint-Software-3.0\" > LICENSE.txt",
"build:lsp": "cargo build -p slint-lsp",
"build:lsp-release": "cargo build --release -p slint-lsp",
"build:wasm_lsp": "env-var wasm-pack build --dev --target web --no-pack ../../tools/lsp --out-dir {{npm_config_local_prefix}}/out -- --no-default-features --features backend-winit,renderer-femtovg,preview",
@ -193,7 +193,7 @@
"compile": "node ./esbuild.js",
"local-package": "shx mkdir -p bin && shx cp ../../target/debug/slint-lsp* bin/ && npx vsce package",
"watch": "tsc -watch -p ./",
"pretest": "npm run compile && npm run lint",
"pretest": "pnpm compile && pnpm lint",
"lint": "eslint src --ext ts",
"syntax_check": "tsc --build --force",
"test": "node ./out/test/runTest.js",
@ -218,5 +218,6 @@
"vscode-test": "^1.6.1",
"webpack": "^5.88.2",
"webpack-cli": "^5.1.4"
}
},
"packageManager": "pnpm@9.7.1"
}

2938
editors/vscode/pnpm-lock.yaml generated Normal file

File diff suppressed because it is too large Load diff

View file

@ -428,6 +428,7 @@ lazy_static! {
("(^|/)partitions\\.csv$", LicenseLocation::NoLicense),
("(^|/)sdkconfig", LicenseLocation::NoLicense), // auto-generated
("(^|/)Pipfile$", LicenseLocation::Tag(LicenseTagStyle::shell_comment_style())),
("(^|/)pnpm-lock\\.yaml$", LicenseLocation::NoLicense),
// Path prefix matches:
("^editors/tree-sitter-slint/corpus/", LicenseLocation::NoLicense), // liberal license