Skip to content
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

Use pnpm to build the vscode extension #5888

Merged
merged 4 commits into from
Aug 21, 2024
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
7 changes: 5 additions & 2 deletions .github/workflows/nightly_snapshot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,9 @@ jobs:
with:
name: vscode-lsp-binary-x86_64-unknown-linux-gnu
path: editors/vscode/bin
- uses: pnpm/[email protected]
with:
version: 9.7.1
- uses: actions/download-artifact@v4
with:
name: vscode-lsp-binary-x86_64-pc-windows-msvc
Expand Down Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion .reuse/dep5
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,11 @@ License: OFL-1.1
Files: examples/weather-demo/android-res/*/ic_launcher.png
Copyright: Copyright © Felgo GmbH <[email protected]>
License: CC-BY-ND-4.0

x
Files: examples/weather-demo/ui/assets/felgo-logo.svg
Copyright: Copyright © Felgo GmbH <[email protected]>
License: CC-BY-ND-4.0

Files: editors/vscode/pnpm-lock.yaml
Copyright: Copyright © SixtyFPS GmbH <[email protected]>
License: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0
1 change: 1 addition & 0 deletions editors/vscode/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
LICENSE.txt
bin/
out/
webviews/
8 changes: 6 additions & 2 deletions editors/vscode/.vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
]
}
16 changes: 11 additions & 5 deletions editors/vscode/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:

Expand All @@ -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
Expand Down
7 changes: 4 additions & 3 deletions editors/vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -185,15 +185,15 @@
"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",
"build:wasm_lsp-release": "env-var wasm-pack build --release --target web --no-pack ../../tools/lsp --out-dir {{npm_config_local_prefix}}/out -- --no-default-features --features backend-winit,renderer-femtovg,preview",
"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",
Expand All @@ -218,5 +218,6 @@
"vscode-test": "^1.6.1",
"webpack": "^5.88.2",
"webpack-cli": "^5.1.4"
}
},
"packageManager": "[email protected]"
}
Loading
Loading