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

Chore: Remove wasm files from repo #243

15 changes: 13 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ jobs:
package-lock.json
server/package-lock.json
client/package-lock.json
server/tree-sitter-bash.info
server/tree-sitter-bitbake.info

- name: Install Node.js dependencies
run: npm install
Expand All @@ -65,6 +63,19 @@ jobs:
if: steps.cache-poky.outputs.cache-hit != 'true'
run: npm run fetch

- name: Cache build Wasm files
id: cache-wasm
uses: actions/cache@v4
with:
path: |
server/tree-sitter-bash.wasm
server/tree-sitter-bitbake.wasm
key: cache-${{ hashFiles('server/tree-sitter-bash.info', 'server/tree-sitter-bitbake.info') }}

- name: Build Wasm files
if: steps.cache-wasm.outputs.cache-hit != 'true'
run: npm run build:wasm

- name: Run Linter
run: npm run lint

Expand Down
7 changes: 4 additions & 3 deletions README-DEVELOPER.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ Manual installation takes place in two steps. The code must be installed via `np
To install the dependencies:
``` sh
npm install
npm run build:wasm
deribaucourt marked this conversation as resolved.
Show resolved Hide resolved
```
To compile the typescript files:
``` sh
Expand Down Expand Up @@ -82,11 +83,11 @@ These tests allow running the BitBake extension in a live VSCode environment.
See [the individual integration tests README](integration-tests/README.md).

## Tree-sitter
This extension uses [tree-sitter-bitbake](https://github.com/tree-sitter-grammars/tree-sitter-bitbake) and [tree-sitter-bash](https://github.com/tree-sitter/tree-sitter-bash) to parse the documents. When installing the project's dependencies with `npm install`, these tools are automatically built into WASM files. The versions of tree-sitter-bitbake and tree-sitter-bash are documented in [server/tree-sitter-bitbake.info](server/tree-sitter-bitbake.info) and [server/tree-sitter-bash.info](server/tree-sitter-bash.info) respectively, along with the version of the tree-sitter-cli that has been used.
This extension uses [tree-sitter-bitbake](https://github.com/tree-sitter-grammars/tree-sitter-bitbake) and [tree-sitter-bash](https://github.com/tree-sitter/tree-sitter-bash) to parse the BitBake documents. They are installed with `npm run build:wasm`. The versions of tree-sitter-bitbake and tree-sitter-bash are documented in [server/tree-sitter-bitbake.info](server/tree-sitter-bitbake.info) and [server/tree-sitter-bash.info](server/tree-sitter-bash.info) respectively, along with the versions of the tree-sitter-cli that have to be used.

To update the .info files to the latest versions of tree-sitter-bitbake and tree-sitter-bash, it is recommended to use the scripts [scripts/update-tree-sitter-bitbake-wasm.sh](scripts/update-tree-sitter-bitbake-wasm.sh) and [scripts/update-tree-sitter-bash-wasm.sh](scripts/update-tree-sitter-bash-wasm.sh). The GitHub workflow [update-tree-sitter-wasm-file.yml](.github/workflows/update-tree-sitter-wasm-file.yml) is already responsible for doing it automatically.
To update the .info files with the latest versions of tree-sitter-bitbake and tree-sitter-bash, it is recommended to use the scripts [scripts/update-tree-sitter-bitbake-wasm.sh](scripts/update-tree-sitter-bitbake-wasm.sh) and [scripts/update-tree-sitter-bash-wasm.sh](scripts/update-tree-sitter-bash-wasm.sh). The GitHub workflow [update-tree-sitter-wasm-file.yml](.github/workflows/update-tree-sitter-wasm-file.yml) is already responsible for doing it automatically.

After updating the .info files, it is required to use [scripts/build-tree-sitter-wasm.sh](scripts/build-tree-sitter-wasm.sh) in order to rebuild the WASM files.
After updating the .info files, it is required to call `npm run build:wasm` in order to rebuild the Wasm files.

For more information about the tree-sitter and its CLI, Check out the official [site](https://tree-sitter.github.io/tree-sitter/) and [npm page](https://www.npmjs.com/package/tree-sitter-cli)

Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -870,7 +870,7 @@
},
"scripts": {
"build:wasm": "bash ./scripts/build-tree-sitter-wasm.sh",
"postinstall": "npm run build:wasm && cd server && npm install && cd ../client && npm install && cd ..",
"postinstall": "cd server && npm install && cd ../client && npm install && cd ..",
"fetch": "npm run fetch:poky && npm run fetch:docs",
"fetch:docs": "sh scripts/fetch-docs.sh",
"fetch:poky": "sh scripts/fetch-poky.sh",
Expand All @@ -889,8 +889,8 @@
"test:watch": "jest --watchAll",
"test:grammar": "vscode-tmgrammar-test ./client/test/grammars/test-cases/*.bb",
"snap-grammar": "vscode-tmgrammar-snap ./client/test/grammars/snaps/*.bb -u",
"dev:vsix": "npm run clean && npm install && npm run fetch:docs && npm run compile && npm run package",
"dev:npm": "npm run clean && npm install && npm run fetch:docs && cd server && npm pack"
"dev:vsix": "npm run clean && npm install && npm run build:wasm && npm run fetch:docs && npm run compile && npm run package",
"dev:npm": "npm run clean && npm install && npm run build:wasm && npm run fetch:docs && cd server && npm pack"
},
"devDependencies": {
"@types/glob": "^8.1.0",
Expand Down