Skip to content

Commit be8f4db

Browse files
committed
AG-41223 update node to v22 and pnpm to v10 [vscode-adblock-syntax]
Squashed commit of the following: commit 6b707e0 Author: scripthunter7 <d.tota@adguard.com> Date: Mon Apr 7 17:53:07 2025 +0200 update gitignore commit 3bb35d0 Author: scripthunter7 <d.tota@adguard.com> Date: Mon Apr 7 13:47:40 2025 +0200 fix builds commit e28a00e Author: scripthunter7 <d.tota@adguard.com> Date: Mon Apr 7 13:42:57 2025 +0200 Remove packageManager field commit 470dee6 Author: scripthunter7 <d.tota@adguard.com> Date: Mon Apr 7 13:39:53 2025 +0200 update node to v22 and pnpm to v10
1 parent ce55b22 commit be8f4db

File tree

19 files changed

+8695
-6507
lines changed

19 files changed

+8695
-6507
lines changed

.github/workflows/check.yml

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
name: Check code
22

33
env:
4-
NODE_VERSION: 20
4+
NODE_VERSION: 22
5+
PNPM_VERSION: 10.7.1
56

67
on:
78
push:
@@ -19,26 +20,35 @@ jobs:
1920
- name: Check out to repository
2021
uses: actions/checkout@v4
2122

23+
- name: Setup pnpm
24+
uses: pnpm/action-setup@v4
25+
with:
26+
version: ${{ env.PNPM_VERSION }}
27+
run_install: false
28+
2229
- name: Set up Node.js
2330
uses: actions/setup-node@v4
2431
with:
2532
node-version: ${{ env.NODE_VERSION }}
26-
cache: yarn
33+
cache: pnpm
2734

2835
- name: Install dependencies
29-
run: yarn install --frozen-lockfile
36+
run: pnpm install
37+
38+
- name: List files
39+
run: ls -alt
3040

3141
- name: Check TypeScript types
32-
run: yarn test:compile
42+
run: pnpm test:compile
3343

3444
- name: Run markdownlint
35-
run: yarn lint:md
45+
run: pnpm lint:md
3646

3747
- name: Run ESLint
38-
run: yarn lint:ts
48+
run: pnpm lint:ts
3949

4050
- name: Run Jest tests
41-
run: yarn test
51+
run: pnpm test
4252

4353
notify:
4454
name: Send Slack notification on failure

.github/workflows/release.yml

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
name: Create GitHub Release
22

33
env:
4-
NODE_VERSION: 20
4+
NODE_VERSION: 22
5+
PNPM_VERSION: 10.7.1
56

67
on:
78
push:
@@ -19,35 +20,43 @@ jobs:
1920
- name: Check out the repository
2021
uses: actions/checkout@v4
2122

23+
- name: Setup pnpm
24+
uses: pnpm/action-setup@v4
25+
with:
26+
version: ${{ env.PNPM_VERSION }}
27+
run_install: false
28+
2229
- name: Set up Node.js
2330
uses: actions/setup-node@v4
2431
with:
2532
node-version: ${{ env.NODE_VERSION }}
26-
registry-url: https://registry.npmjs.org
27-
cache: yarn
33+
cache: pnpm
2834

2935
- name: Install dependencies
30-
run: yarn install --frozen-lockfile
36+
run: pnpm install
37+
38+
- name: List files
39+
run: ls -alt
3140

3241
- name: Run markdownlint
33-
run: yarn lint:md
42+
run: pnpm lint:md
3443

3544
- name: Run ESLint
36-
run: yarn lint:ts
45+
run: pnpm lint:ts
3746

3847
# Convert grammar to PList format & Test compile & Run ESBuild & Generate VSIX file
3948
- name: Create production build
40-
run: yarn build:prod
49+
run: pnpm build:prod
4150

4251
- name: Create build.txt with version
43-
run: yarn build:txt
52+
run: pnpm build:txt
4453

4554
- name: Extract changelog
4655
run: |
47-
# Import version from out/build.txt
48-
export VERSION=$(cat out/build.txt | cut -d '=' -f2)
56+
# Import version from package.json using pnpm
57+
export VERSION=$(pnpm pkg get version | tr -d '"')
4958
50-
yarn extract-changelog -e $VERSION
59+
pnpm extract-changelog -e $VERSION
5160
5261
- name: Create GitHub Release
5362
uses: softprops/action-gh-release@v2

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@
55
coverage
66
node_modules
77
out
8+
.pnpm-store/

.husky/pre-commit

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env sh
22
. "$(dirname -- "$0")/_/husky.sh"
33

4-
yarn test:compile
5-
yarn lint:staged
6-
yarn test
4+
pnpm test:compile
5+
pnpm lint:staged
6+
pnpm test

.yarnrc

Lines changed: 0 additions & 1 deletion
This file was deleted.

CONTRIBUTING.md

Lines changed: 37 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,24 @@ Table of Contents:
2222

2323
Ensure that the following software is installed on your computer:
2424

25-
- [Node.js][nodejs] (we recommend using the latest LTS version)
26-
- [Yarn][yarn]
27-
- [Git][git]
25+
- [Node.js][nodejs]: v22 (you can install multiple versions using [nvm][nvm])
26+
- [pnpm][pnpm]: v10
2827
- [VSCode][vscode]
28+
- [Git][git]
29+
30+
[git]: https://git-scm.com/
31+
[nodejs]: https://nodejs.org/en/download
32+
[nvm]: https://github.com/nvm-sh/nvm
33+
[pnpm]: https://pnpm.io/installation
2934

3035
## Initial setup
3136

3237
After cloning the repository, follow these steps to initialize the project:
3338

34-
1. Install dependencies by calling `yarn`. This will also install client and server dependencies via `postinstall`
35-
scripts. After installation, it will initialize [Husky Git hooks][husky] through the `prepare` script.
36-
1. Install recommended VSCode extensions (refer to the [`.vscode/extensions.json`][vscode-extensions-file] file).
39+
1. Install dependencies by calling `pnpm install`.
40+
This will also install client and server dependencies via `postinstall` scripts.
41+
After installation, it will initialize [Husky Git hooks][husky] through the `prepare` script.
42+
2. Install recommended VSCode extensions (refer to the [`.vscode/extensions.json`][vscode-extensions-file] file).
3743
**These extensions are REQUIRED for the development process.**
3844

3945
## Project structure
@@ -76,7 +82,7 @@ If you've made changes to the extension code and want to test them, follow these
7682

7783
To create a production build of the extension:
7884

79-
1. Run `yarn build:prod` command. This generates a production build and a `.vsix` file in the `out` folder.
85+
1. Run `pnpm build:prod` command. This generates a production build and a `.vsix` file in the `out` folder.
8086
1. To ensure the build is correct, install the generated `.vsix` file in VSCode. Open the command palette
8187
(`Ctrl + Shift + P`), select "Extensions: Install from VSIX...", and choose the `vscode-adblock.vsix` file.
8288

@@ -101,7 +107,7 @@ To create a production build of the extension:
101107
1. Update the TM grammar in the `syntaxes/adblock.yaml-tmLanguage` file.
102108
1. Create/modify example rules in the `test/static/rules` folder. Add link for GitHub issues to rules if related to some
103109
issue.
104-
1. Create/modify unit tests in `test/grammar`. Ensure tests pass by running `yarn test`.
110+
1. Create/modify unit tests in `test/grammar`. Ensure tests pass by running `pnpm test`.
105111

106112
> [!TIP]
107113
> Open the `test/static` folder in the "Extension Development Host" window and you can check the syntax highlighting
@@ -114,39 +120,39 @@ To create a production build of the extension:
114120

115121
During development, you can use the following commands (listed in `package.json`).
116122

117-
- `yarn build:grammar` - Compiles the TextMate (TM) grammar into a PList format, since VSCode does not natively support
123+
- `pnpm build:grammar` - Compiles the TextMate (TM) grammar into a PList format, since VSCode does not natively support
118124
YAML grammars.
119-
- `yarn build:prod` - Generates a production build of the extension, including a `.vsix` file in the `out` directory for
125+
- `pnpm build:prod` - Generates a production build of the extension, including a `.vsix` file in the `out` directory for
120126
VSCode installation.
121-
- `yarn build:txt` - Creates a `build.txt` file in the out directory containing the current version number, primarily
127+
- `pnpm build:txt` - Creates a `build.txt` file in the out directory containing the current version number, primarily
122128
for Continuous Integration (CI) purposes.
123-
- `yarn build:vsix` - Produces a `.vsix` file in the out directory, which is used to install the extension in VSCode.
124-
- `yarn clean` - Removes all generated files in the output directories, cleaning up the build results.
125-
- `yarn esbuild:aglint` - Base ESBuild command for building integrated AGLint with the common options.
126-
- `yarn esbuild:agtree` - Base ESBuild command for building integrated AGTree with the common options.
129+
- `pnpm build:vsix` - Produces a `.vsix` file in the out directory, which is used to install the extension in VSCode.
130+
- `pnpm clean` - Removes all generated files in the output directories, cleaning up the build results.
131+
- `pnpm esbuild:aglint` - Base ESBuild command for building integrated AGLint with the common options.
132+
- `pnpm esbuild:agtree` - Base ESBuild command for building integrated AGTree with the common options.
127133
Integrated AGTree comes with the integrated AGLint, this command just helps to bundle it to a separate file.
128134
This is needed because AGTree is also used by the server, and by bundling it to a separate file, we can avoid
129135
double-bundling AGTree.
130-
- `yarn esbuild:server` - Base ESBuild command for building the server with the common options.
131-
- `yarn esbuild:client` - Base ESBuild command for building the client with the common options.
132-
- `yarn extract-changelog` - Extract changes from the `CHANGELOG.md` for a specific version. Typically, this is used by
136+
- `pnpm esbuild:server` - Base ESBuild command for building the server with the common options.
137+
- `pnpm esbuild:client` - Base ESBuild command for building the client with the common options.
138+
- `pnpm extract-changelog` - Extract changes from the `CHANGELOG.md` for a specific version. Typically, this is used by
133139
CI.
134-
- `yarn increment` - Increment the patch version number of the extension in the `package.json` file. Typically, this is
140+
- `pnpm increment` - Increment the patch version number of the extension in the `package.json` file. Typically, this is
135141
used by CI.
136-
- `yarn lint:md` - Lint the markdown files with [markdownlint][markdownlint].
137-
- `yarn lint:staged` - Run linters on staged files. Typically, this is used by Husky Git hooks.
138-
- `yarn lint:ts` - Lint the code with [ESLint][eslint].
139-
- `yarn lint` - Run all linters.
140-
- `yarn test:compile` - Check if the code compiles with [TypeScript][typescript].
141-
- `yarn test` - Run tests with [Jest][jest].
142-
- `yarn watch:aglint` - Watch for changes in the AGLint code and create a development build automatically.
143-
- `yarn watch:agtree` - Watch for changes in the AGTree code and create a development build automatically.
144-
- `yarn watch:client` - Watch for changes in the client code and create a development build automatically.
145-
- `yarn watch:grammar` - Watch for changes in the TM grammar and rebuild it automatically.
146-
- `yarn watch:server` - Watch for changes in the server code and create a development build automatically.
142+
- `pnpm lint:md` - Lint the markdown files with [markdownlint][markdownlint].
143+
- `pnpm lint:staged` - Run linters on staged files. Typically, this is used by Husky Git hooks.
144+
- `pnpm lint:ts` - Lint the code with [ESLint][eslint].
145+
- `pnpm lint` - Run all linters.
146+
- `pnpm test:compile` - Check if the code compiles with [TypeScript][typescript].
147+
- `pnpm test` - Run tests with [Jest][jest].
148+
- `pnpm watch:aglint` - Watch for changes in the AGLint code and create a development build automatically.
149+
- `pnpm watch:agtree` - Watch for changes in the AGTree code and create a development build automatically.
150+
- `pnpm watch:client` - Watch for changes in the client code and create a development build automatically.
151+
- `pnpm watch:grammar` - Watch for changes in the TM grammar and rebuild it automatically.
152+
- `pnpm watch:server` - Watch for changes in the server code and create a development build automatically.
147153

148154
> [!NOTE]
149-
> Watch commands (e.g., `yarn watch:client`) are typically used by VSCode tasks (see
155+
> Watch commands (e.g., `pnpm watch:client`) are typically used by VSCode tasks (see
150156
> [`.vscode/tasks.json`][vscode-tasks-file] file and
151157
> [*Running the extension in development mode*](#running-the-extension-in-development-mode) section).
152158
> In most cases, you don't need to run them manually.
@@ -168,11 +174,9 @@ Explore the following links for more information on development:
168174
[contribute]: https://adguard.com/contribute.html
169175
[esbuild-problem-matcher-extension]: https://marketplace.visualstudio.com/items?itemName=connor4312.esbuild-problem-matchers
170176
[eslint]: https://eslint.org/
171-
[git]: https://git-scm.com/
172177
[husky]: https://typicode.github.io/husky
173178
[jest]: https://jestjs.io/
174179
[markdownlint]: https://github.com/DavidAnson/markdownlint
175-
[nodejs]: https://nodejs.org/en/
176180
[nova-light-show]: https://novalightshow.netlify.app/
177181
[server-dir]: ./server
178182
[syntaxes-dir]: ./syntaxes
@@ -187,4 +191,3 @@ Explore the following links for more information on development:
187191
[vscode-problem-matcher-docs]: https://code.visualstudio.com/docs/editor/tasks#_processing-task-output-with-problem-matchers
188192
[vscode-tasks-file]: ./.vscode/tasks.json
189193
[vscode]: https://code.visualstudio.com/
190-
[yarn]: https://yarnpkg.com/

bamboo-specs/build.yaml

Lines changed: 14 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ plan:
55
key: VSCODEADBLOCKSYNTAXBUILD
66
name: vscode adblock syntax - build release
77
variables:
8-
dockerNode: adguard/node-ssh:21.7--1
8+
dockerNode: adguard/node-ssh:22.14--0
99

1010
stages:
1111
- Build:
@@ -21,7 +21,7 @@ Build:
2121
docker:
2222
image: ${bamboo.dockerNode}
2323
volumes:
24-
${system.YARN_DIR}: '${bamboo.cacheYarn}'
24+
${system.PNPM_DIR}: "${bamboo.cachePnpm}"
2525
tasks:
2626
- checkout:
2727
force-clean-build: true
@@ -37,41 +37,29 @@ Build:
3737
3838
ls -laht
3939
40-
# Exclude '--ignore-optional' from yarn arguments
41-
# This is needed for installing swc core optional dependencies properly
42-
originalYarnArgs="$bamboo_varsYarn"
43-
modifiedYarnArgs=$(echo "$originalYarnArgs" | sed 's/--ignore-optional//g')
40+
# Set cache directory
41+
pnpm config set store-dir ${bamboo.cachePnpm}
4442
45-
# Install common dependencies
46-
yarn install ${modifiedYarnArgs}
47-
48-
# Install dependencies in ./server
49-
cd ./server
50-
yarn install ${modifiedYarnArgs}
51-
cd ..
52-
53-
# Install dependencies in ./client
54-
cd ./client
55-
yarn install ${modifiedYarnArgs}
56-
cd ..
43+
# Install dependencies
44+
pnpm install
5745
5846
# Check TypeScript types
59-
yarn test:compile
47+
pnpm test:compile
6048
6149
# Run markdownlint
62-
yarn lint:md
50+
pnpm lint:md
6351
6452
# Run ESLint
65-
yarn lint:ts
53+
pnpm lint:ts
6654
6755
# Run Jest tests
68-
yarn test
56+
pnpm test
6957
7058
# Create production build
71-
yarn build:prod
59+
pnpm build:prod
7260
7361
# Create build.txt file with version
74-
yarn build:txt
62+
pnpm build:txt
7563
- inject-variables:
7664
file: out/build.txt
7765
scope: RESULT
@@ -96,14 +84,8 @@ Build:
9684
9785
echo "Size before cleanup:" && du -h | tail -n 1
9886
99-
# cleanup root directory
100-
rm -rf node_modules
101-
102-
# cleanup client directory
103-
rm -rf client/node_modules
104-
105-
# cleanup server directory
106-
rm -rf server/node_modules
87+
# Cleanup
88+
pnpm clean
10789
10890
echo "Size after cleanup:" && du -h | tail -n 1
10991
# Store the .vsix file as a build artifact

0 commit comments

Comments
 (0)