Skip to content

Commit bae2bb1

Browse files
authoredMay 26, 2023
chore: switch to pnpm (#2027)
Svelte repos use it, we should, too Also removes obsolete nightly build CI
1 parent 932b8d3 commit bae2bb1

25 files changed

+2208
-2004
lines changed
 

‎.github/workflows/CI.yml

+10-21
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,19 @@ jobs:
77

88
steps:
99
- uses: actions/checkout@v3
10+
- uses: pnpm/action-setup@v2.2.4
1011
- uses: actions/setup-node@v3
1112
with:
1213
node-version: "16.x"
13-
cache: yarn
14+
cache: pnpm
1415

1516
# Get projects set up
16-
- run: yarn install
17-
- run: yarn bootstrap
18-
- run: yarn build
17+
- run: pnpm install
18+
- run: pnpm bootstrap
19+
- run: pnpm build
1920

2021
# Run any tests
21-
- run: yarn test
22+
- run: pnpm test
2223
env:
2324
CI: true
2425

@@ -27,24 +28,12 @@ jobs:
2728

2829
steps:
2930
- uses: actions/checkout@v3
31+
- uses: pnpm/action-setup@v2.2.4
3032
- uses: actions/setup-node@v3
3133
with:
3234
node-version: "16.x"
33-
cache: yarn
34-
35-
- name: Get yarn cache directory path
36-
id: yarn-cache-dir-path
37-
run: echo "::set-output name=dir::$(yarn cache dir)"
38-
39-
- uses: actions/cache@v1
40-
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
41-
with:
42-
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
43-
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
44-
restore-keys: |
45-
${{ runner.os }}-yarn-
35+
cache: pnpm
4636

4737
# Get projects set up
48-
- run: yarn install
49-
50-
- run: yarn lint
38+
- run: pnpm install
39+
- run: pnpm lint

‎.github/workflows/Deploy.yml

-49
This file was deleted.

‎.github/workflows/DeployExtensionsProd.yml

+14-10
Original file line numberDiff line numberDiff line change
@@ -11,37 +11,41 @@ jobs:
1111

1212
steps:
1313
- uses: actions/checkout@v3
14+
- uses: pnpm/action-setup@v2.2.4
1415
- uses: actions/setup-node@v3
1516
with:
1617
node-version: "16.x"
1718
registry-url: "https://registry.npmjs.org"
18-
cache: yarn
19+
cache: pnpm
1920

2021
# Ensure everything is compiling
21-
- run: "yarn install"
22-
- run: "yarn build"
23-
- run: "yarn bootstrap"
22+
- run: "pnpm install"
23+
- run: "pnpm build"
24+
- run: "pnpm bootstrap"
2425

2526
# Lets us use one-liner JSON manipulations the package.json files
2627
- run: "npm install -g json"
2728

2829
# Setup the environment
29-
- run: 'json -I -f packages/svelte-vscode/package.json -e "this.version=\`${{ github.ref }}\`.split(\`-\`).pop()"'
30+
- run: json -I -f packages/svelte-vscode/package.json -e "this.version=\`${{ github.ref }}\`.split(\`-\`).pop()"
3031

31-
# To deploy we need isolated node_modules folders which yarn won't do because it is a workspace
32+
# To deploy we need isolated node_modules folders which pnpm won't do because it is a workspace
3233
# So, remove the workspace
33-
- run: "rm package.json yarn.lock" # Re-run the yarn install outside of the workspace
34+
- run: "rm package.json pnpm-workspace.yaml pnpm-lock.yaml" # Re-run the pnpm install outside of the workspace
35+
# ... and remove the workspace:* references
36+
- run: json -I -f packages/svelte-vscode/package.json -e 'this.dependencies["svelte-language-server"]="*"'
37+
- run: json -I -f packages/svelte-vscode/package.json -e 'this.dependencies["typescript-svelte-plugin"]="*"'
3438

3539
- run: |
3640
cd packages/svelte-vscode
37-
yarn install
41+
npm install
3842
3943
# Just a hard constraint from the vscode marketplace's usage of azure tokens
4044
echo "Once a year this expires, tell Orta to access https://dev.azure.com/ortatherox0608/_usersSettings/tokens (logging in with GitHub) to get a new one"
4145
4246
# Ship it
43-
npx vsce publish --yarn -p $VSCE_TOKEN
44-
npx ovsx publish --yarn -p $OVSX_TOKEN
47+
npx vsce publish --npm -p $VSCE_TOKEN
48+
npx ovsx publish --npm -p $OVSX_TOKEN
4549
4650
env:
4751
VSCE_TOKEN: ${{ secrets.AZURE_PAN_TOKEN }}

‎.github/workflows/DeploySvelte2tsxProd.yml

+6-5
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,16 @@ jobs:
1111

1212
steps:
1313
- uses: actions/checkout@v3
14+
- uses: pnpm/action-setup@v2.2.4
1415
- uses: actions/setup-node@v3
1516
with:
1617
node-version: "16.x"
1718
registry-url: "https://registry.npmjs.org"
18-
cache: yarn
19+
cache: pnpm
1920

2021
# Ensure everything is compiling
21-
- run: "yarn install"
22-
- run: "yarn build"
22+
- run: "pnpm install"
23+
- run: "pnpm build"
2324

2425
# Lets us use one-liner JSON manipulations the package.json files
2526
- run: "npm install -g json"
@@ -30,8 +31,8 @@ jobs:
3031
# Ship it
3132
- run: |
3233
cd packages/svelte2tsx
33-
npm install
34-
npm publish
34+
pnpm install
35+
pnpm publish
3536
3637
env:
3738
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

‎.github/workflows/DeploySvelteCheckProd.yml

+7-6
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,17 @@ jobs:
1111

1212
steps:
1313
- uses: actions/checkout@v3
14+
- uses: pnpm/action-setup@v2.2.4
1415
- uses: actions/setup-node@v3
1516
with:
1617
node-version: "16.x"
1718
registry-url: "https://registry.npmjs.org"
18-
cache: yarn
19+
cache: pnpm
1920

2021
# Ensure everything is compiling
21-
- run: "yarn install"
22-
- run: "yarn build"
23-
- run: "yarn bootstrap"
22+
- run: "pnpm install"
23+
- run: "pnpm build"
24+
- run: "pnpm bootstrap"
2425

2526
# Lets us use one-liner JSON manipulations the package.json files
2627
- run: "npm install -g json"
@@ -31,8 +32,8 @@ jobs:
3132
# Ship it
3233
- run: |
3334
cd packages/svelte-check
34-
npm install
35-
npm publish
35+
pnpm install
36+
pnpm publish
3637
3738
env:
3839
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

‎.github/workflows/DeploySvelteLanguageServerProd.yml

+6-5
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,16 @@ jobs:
1111

1212
steps:
1313
- uses: actions/checkout@v3
14+
- uses: pnpm/action-setup@v2.2.4
1415
- uses: actions/setup-node@v3
1516
with:
1617
node-version: "16.x"
1718
registry-url: "https://registry.npmjs.org"
18-
cache: yarn
19+
cache: pnpm
1920

2021
# Ensure everything is compiling
21-
- run: "yarn install"
22-
- run: "yarn build"
22+
- run: "pnpm install"
23+
- run: "pnpm build"
2324

2425
# Lets us use one-liner JSON manipulations the package.json files
2526
- run: "npm install -g json"
@@ -30,8 +31,8 @@ jobs:
3031
# Ship it
3132
- run: |
3233
cd packages/language-server
33-
npm install
34-
npm publish
34+
pnpm install
35+
pnpm publish
3536
3637
env:
3738
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

‎.github/workflows/DeployTypescriptPluginProd.yaml

+6-5
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,16 @@ jobs:
1111

1212
steps:
1313
- uses: actions/checkout@v3
14+
- uses: pnpm/action-setup@v2.2.4
1415
- uses: actions/setup-node@v3
1516
with:
1617
node-version: "16.x"
1718
registry-url: "https://registry.npmjs.org"
18-
cache: yarn
19+
cache: pnpm
1920

2021
# Ensure everything is compiling
21-
- run: "yarn install"
22-
- run: "yarn build"
22+
- run: "pnpm install"
23+
- run: "pnpm build"
2324

2425
# Lets us use one-liner JSON manipulations the package.json files
2526
- run: "npm install -g json"
@@ -30,8 +31,8 @@ jobs:
3031
# Ship it
3132
- run: |
3233
cd packages/typescript-plugin
33-
npm install
34-
npm publish
34+
pnpm install
35+
pnpm publish
3536
3637
env:
3738
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

‎.npmrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
resolution-mode=highest

‎.prettierignore

+1
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@ packages/typescript-plugin/src/**/*.d.ts
1414
**/dist
1515
.github/**
1616
.history/**
17+
pnpm-lock.yaml

‎README.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ This repo contains the tools which provide editor integrations for Svelte files
4545

4646
## Packages
4747

48-
This repo uses [`yarn workspaces`](https://classic.yarnpkg.com/blog/2017/08/02/introducing-workspaces/), which TLDR means if you want to run a commands in each project then you can either `cd` to that directory and run the command, or use `yarn workspace [package_name] [command]`.
48+
This repo uses [`pnpm workspaces`](https://pnpm.io/workspaces/), which TLDR means if you want to run a commands in each project then you can either `cd` to that directory and run the command, or use `pnpm -r [command]`.
4949

50-
For example `yarn workspace svelte-language-server test`.
50+
For example `pnpm -r test`.
5151

5252
#### [`svelte-language-server`](packages/language-server)
5353

@@ -127,16 +127,16 @@ To install and work on these tools locally:
127127
```bash
128128
git clone https://github.com/sveltejs/language-tools.git svelte-language-tools
129129
cd svelte-language-tools
130-
yarn install
131-
yarn bootstrap
130+
pnpm install
131+
pnpm bootstrap
132132
```
133133

134-
> Do not use npm to install the dependencies, as the specific package versions in `yarn.lock` are used to build and test Svelte.
134+
> Do not use npm to install the dependencies, as the specific package versions in `pnpm-lock.yaml` are used to build and test Svelte.
135135
136136
To build all of the tools, run:
137137

138138
```bash
139-
yarn build
139+
pnpm build
140140
```
141141

142142
The tools are written in [TypeScript](https://www.typescriptlang.org/), but don't let that put you off — it's basically just JavaScript with type annotations. You'll pick it up in no time. If you're using an editor other than [Visual Studio Code](https://code.visualstudio.com/) you may need to install a plugin in order to get syntax highlighting and code hints etc.
@@ -153,7 +153,7 @@ To run the developer version of both the language server and the VSCode extensio
153153
- Go to the debugging panel
154154
- Make sure "Run VSCode Extension" is selected, and hit run
155155

156-
This launches a new VSCode window and a watcher for your changes. In this dev window you can choose an existing Svelte project to work against. If you don't use pure Javascript and CSS, but languages like Typescript or SCSS, your project will need a [Svelte preprocessor setup](docs#using-with-preprocessors). When you make changes to the extension or language server you can use the command "Reload Window" in the VSCode command palette to see your changes. When you make changes to `svelte2tsx`, you first need to run `yarn build` within its folder.
156+
This launches a new VSCode window and a watcher for your changes. In this dev window you can choose an existing Svelte project to work against. If you don't use pure Javascript and CSS, but languages like Typescript or SCSS, your project will need a [Svelte preprocessor setup](docs#using-with-preprocessors). When you make changes to the extension or language server you can use the command "Reload Window" in the VSCode command palette to see your changes. When you make changes to `svelte2tsx`, you first need to run `pnpm build` within its folder.
157157

158158
### Running Tests
159159

@@ -162,7 +162,7 @@ You might think that as a language server, you'd need to handle a lot of back an
162162
This means it's easy to write tests for your changes:
163163

164164
```bash
165-
yarn test
165+
pnpm test
166166
```
167167

168168
For tricker issues, you can run the tests with a debugger in VSCode by setting a breakpoint (or adding `debugger` in the code) and launching the task: "Run tests with debugger".

‎package.json

+4-6
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,10 @@
44
"author": "Svelte Contributors",
55
"license": "MIT",
66
"private": true,
7-
"workspaces": [
8-
"packages/*"
9-
],
107
"scripts": {
11-
"bootstrap": "yarn workspace svelte2tsx build && yarn workspace svelte-vscode build:grammar",
8+
"bootstrap": "cd ./packages/svelte2tsx && pnpm build && cd ../svelte-vscode && pnpm build:grammar",
129
"build": "tsc -b",
13-
"test": "cross-env CI=true yarn workspaces run test",
10+
"test": "cross-env CI=true pnpm test -r",
1411
"watch": "tsc -b -watch",
1512
"format": "prettier --write .",
1613
"lint": "prettier --check ."
@@ -22,5 +19,6 @@
2219
"prettier": "2.8.6",
2320
"cross-env": "^7.0.2",
2421
"ts-node": "^10.0.0"
25-
}
22+
},
23+
"packageManager": "pnpm@8.4.0"
2624
}

‎packages/language-server/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
},
4949
"dependencies": {
5050
"@jridgewell/trace-mapping": "^0.3.17",
51-
"@vscode/emmet-helper": "^2.8.4",
51+
"@vscode/emmet-helper": "2.8.4",
5252
"chokidar": "^3.4.1",
5353
"estree-walker": "^2.0.1",
5454
"fast-glob": "^3.2.7",
@@ -57,7 +57,7 @@
5757
"prettier-plugin-svelte": "~2.10.0",
5858
"svelte": "^3.57.0",
5959
"svelte-preprocess": "~5.0.3",
60-
"svelte2tsx": "~0.6.8",
60+
"svelte2tsx": "workspace:~",
6161
"typescript": "*",
6262
"vscode-css-languageservice": "~6.2.0",
6363
"vscode-html-languageservice": "~5.0.0",

‎packages/language-server/test/plugins/css/CSSPlugin.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ describe('CSS Plugin', () => {
4444
assert.deepStrictEqual(plugin.doHover(document, Position.create(0, 8)), <Hover>{
4545
contents: [
4646
{ language: 'html', value: '<h1>' },
47-
'[Selector Specificity](https://developer.mozilla.org/en-US/docs/Web/CSS/Specificity): (0, 0, 1)'
47+
'[Selector Specificity](https://developer.mozilla.org/docs/Web/CSS/Specificity): (0, 0, 1)'
4848
],
4949
range: Range.create(0, 7, 0, 9)
5050
});

‎packages/language-server/tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"extends": "@tsconfig/node12/tsconfig.json",
2+
"extends": "@tsconfig/node16/tsconfig.json",
33
"compilerOptions": {
44
"moduleResolution": "node",
55
"strict": true,

0 commit comments

Comments
 (0)
Please sign in to comment.