Skip to content

Commit

Permalink
chore: switch to pnpm (#2027)
Browse files Browse the repository at this point in the history
Svelte repos use it, we should, too
Also removes obsolete nightly build CI
  • Loading branch information
dummdidumm committed May 26, 2023
1 parent 932b8d3 commit bae2bb1
Show file tree
Hide file tree
Showing 25 changed files with 2,208 additions and 2,004 deletions.
31 changes: 10 additions & 21 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,19 @@ jobs:

steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2.2.4
- uses: actions/setup-node@v3
with:
node-version: "16.x"
cache: yarn
cache: pnpm

# Get projects set up
- run: yarn install
- run: yarn bootstrap
- run: yarn build
- run: pnpm install
- run: pnpm bootstrap
- run: pnpm build

# Run any tests
- run: yarn test
- run: pnpm test
env:
CI: true

Expand All @@ -27,24 +28,12 @@ jobs:

steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2.2.4
- uses: actions/setup-node@v3
with:
node-version: "16.x"
cache: yarn

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"

- uses: actions/cache@v1
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
cache: pnpm

# Get projects set up
- run: yarn install

- run: yarn lint
- run: pnpm install
- run: pnpm lint
49 changes: 0 additions & 49 deletions .github/workflows/Deploy.yml

This file was deleted.

24 changes: 14 additions & 10 deletions .github/workflows/DeployExtensionsProd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,37 +11,41 @@ jobs:

steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2.2.4
- uses: actions/setup-node@v3
with:
node-version: "16.x"
registry-url: "https://registry.npmjs.org"
cache: yarn
cache: pnpm

# Ensure everything is compiling
- run: "yarn install"
- run: "yarn build"
- run: "yarn bootstrap"
- run: "pnpm install"
- run: "pnpm build"
- run: "pnpm bootstrap"

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

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

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

- run: |
cd packages/svelte-vscode
yarn install
npm install
# Just a hard constraint from the vscode marketplace's usage of azure tokens
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"
# Ship it
npx vsce publish --yarn -p $VSCE_TOKEN
npx ovsx publish --yarn -p $OVSX_TOKEN
npx vsce publish --npm -p $VSCE_TOKEN
npx ovsx publish --npm -p $OVSX_TOKEN
env:
VSCE_TOKEN: ${{ secrets.AZURE_PAN_TOKEN }}
Expand Down
11 changes: 6 additions & 5 deletions .github/workflows/DeploySvelte2tsxProd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,16 @@ jobs:

steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2.2.4
- uses: actions/setup-node@v3
with:
node-version: "16.x"
registry-url: "https://registry.npmjs.org"
cache: yarn
cache: pnpm

# Ensure everything is compiling
- run: "yarn install"
- run: "yarn build"
- run: "pnpm install"
- run: "pnpm build"

# Lets us use one-liner JSON manipulations the package.json files
- run: "npm install -g json"
Expand All @@ -30,8 +31,8 @@ jobs:
# Ship it
- run: |
cd packages/svelte2tsx
npm install
npm publish
pnpm install
pnpm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
13 changes: 7 additions & 6 deletions .github/workflows/DeploySvelteCheckProd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,17 @@ jobs:

steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2.2.4
- uses: actions/setup-node@v3
with:
node-version: "16.x"
registry-url: "https://registry.npmjs.org"
cache: yarn
cache: pnpm

# Ensure everything is compiling
- run: "yarn install"
- run: "yarn build"
- run: "yarn bootstrap"
- run: "pnpm install"
- run: "pnpm build"
- run: "pnpm bootstrap"

# Lets us use one-liner JSON manipulations the package.json files
- run: "npm install -g json"
Expand All @@ -31,8 +32,8 @@ jobs:
# Ship it
- run: |
cd packages/svelte-check
npm install
npm publish
pnpm install
pnpm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
11 changes: 6 additions & 5 deletions .github/workflows/DeploySvelteLanguageServerProd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,16 @@ jobs:

steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2.2.4
- uses: actions/setup-node@v3
with:
node-version: "16.x"
registry-url: "https://registry.npmjs.org"
cache: yarn
cache: pnpm

# Ensure everything is compiling
- run: "yarn install"
- run: "yarn build"
- run: "pnpm install"
- run: "pnpm build"

# Lets us use one-liner JSON manipulations the package.json files
- run: "npm install -g json"
Expand All @@ -30,8 +31,8 @@ jobs:
# Ship it
- run: |
cd packages/language-server
npm install
npm publish
pnpm install
pnpm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
11 changes: 6 additions & 5 deletions .github/workflows/DeployTypescriptPluginProd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,16 @@ jobs:

steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2.2.4
- uses: actions/setup-node@v3
with:
node-version: "16.x"
registry-url: "https://registry.npmjs.org"
cache: yarn
cache: pnpm

# Ensure everything is compiling
- run: "yarn install"
- run: "yarn build"
- run: "pnpm install"
- run: "pnpm build"

# Lets us use one-liner JSON manipulations the package.json files
- run: "npm install -g json"
Expand All @@ -30,8 +31,8 @@ jobs:
# Ship it
- run: |
cd packages/typescript-plugin
npm install
npm publish
pnpm install
pnpm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
resolution-mode=highest
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ packages/typescript-plugin/src/**/*.d.ts
**/dist
.github/**
.history/**
pnpm-lock.yaml
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ This repo contains the tools which provide editor integrations for Svelte files

## Packages

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]`.
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]`.

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

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

Expand Down Expand Up @@ -127,16 +127,16 @@ To install and work on these tools locally:
```bash
git clone https://github.com/sveltejs/language-tools.git svelte-language-tools
cd svelte-language-tools
yarn install
yarn bootstrap
pnpm install
pnpm bootstrap
```

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

```bash
yarn build
pnpm build
```

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.
Expand All @@ -153,7 +153,7 @@ To run the developer version of both the language server and the VSCode extensio
- Go to the debugging panel
- Make sure "Run VSCode Extension" is selected, and hit run

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.
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.

### Running Tests

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

```bash
yarn test
pnpm test
```

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".
Expand Down
10 changes: 4 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,10 @@
"author": "Svelte Contributors",
"license": "MIT",
"private": true,
"workspaces": [
"packages/*"
],
"scripts": {
"bootstrap": "yarn workspace svelte2tsx build && yarn workspace svelte-vscode build:grammar",
"bootstrap": "cd ./packages/svelte2tsx && pnpm build && cd ../svelte-vscode && pnpm build:grammar",
"build": "tsc -b",
"test": "cross-env CI=true yarn workspaces run test",
"test": "cross-env CI=true pnpm test -r",
"watch": "tsc -b -watch",
"format": "prettier --write .",
"lint": "prettier --check ."
Expand All @@ -22,5 +19,6 @@
"prettier": "2.8.6",
"cross-env": "^7.0.2",
"ts-node": "^10.0.0"
}
},
"packageManager": "pnpm@8.4.0"
}
4 changes: 2 additions & 2 deletions packages/language-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
},
"dependencies": {
"@jridgewell/trace-mapping": "^0.3.17",
"@vscode/emmet-helper": "^2.8.4",
"@vscode/emmet-helper": "2.8.4",
"chokidar": "^3.4.1",
"estree-walker": "^2.0.1",
"fast-glob": "^3.2.7",
Expand All @@ -57,7 +57,7 @@
"prettier-plugin-svelte": "~2.10.0",
"svelte": "^3.57.0",
"svelte-preprocess": "~5.0.3",
"svelte2tsx": "~0.6.8",
"svelte2tsx": "workspace:~",
"typescript": "*",
"vscode-css-languageservice": "~6.2.0",
"vscode-html-languageservice": "~5.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ describe('CSS Plugin', () => {
assert.deepStrictEqual(plugin.doHover(document, Position.create(0, 8)), <Hover>{
contents: [
{ language: 'html', value: '<h1>' },
'[Selector Specificity](https://developer.mozilla.org/en-US/docs/Web/CSS/Specificity): (0, 0, 1)'
'[Selector Specificity](https://developer.mozilla.org/docs/Web/CSS/Specificity): (0, 0, 1)'
],
range: Range.create(0, 7, 0, 9)
});
Expand Down
2 changes: 1 addition & 1 deletion packages/language-server/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "@tsconfig/node12/tsconfig.json",
"extends": "@tsconfig/node16/tsconfig.json",
"compilerOptions": {
"moduleResolution": "node",
"strict": true,
Expand Down
Loading

0 comments on commit bae2bb1

Please sign in to comment.