Skip to content

Commit 9c768b9

Browse files
author
Ethan Arrowood
authored
[tests] Migrate from yarn to pnpm (#9198)
<picture data-single-emoji=":pnpm:" title=":pnpm:"><img class="emoji" src="https://single-emoji.vercel.app/api/emoji/eyJhbGciOiJkaXIiLCJlbmMiOiJBMjU2R0NNIn0..4mJzrO94AnSn0Pue.4apgaKtTUdQ-wxNyahjdJj28u8bbXreLoTA8AGqYjLta3MrsFvbo9DsQFth4CoIkBgXFhQ5_BVcKNfYbwLg4bKzyIvItKe4OFS8AzG7Kkicz2kUUZk0.nXyK_PvHzZFGA-MQB6XHfA" alt=":pnpm:" width="20" height="auto" align="absmiddle"></picture> yarn has become increasingly more difficult to use as the v1 we rely on no longer receives updates. pnpm is faster and is actively maintained. This PR migrates us to pnpm.
1 parent 4c3bc05 commit 9c768b9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+15143
-14581
lines changed

.github/CONTRIBUTING.md

+10-10
Original file line numberDiff line numberDiff line change
@@ -6,30 +6,30 @@ Please read our [Code of Conduct](CODE_OF_CONDUCT.md) and follow it in all your
66

77
## Local development
88

9-
This project is configured in a monorepo, where one repository contains multiple npm packages. Dependencies are installed and managed with `yarn`, not `npm` CLI.
9+
This project is configured in a monorepo, where one repository contains multiple npm packages. Dependencies are installed and managed with `pnpm`, not `npm` CLI.
1010

1111
To get started, execute the following:
1212

1313
```
1414
git clone https://github.com/vercel/vercel
1515
cd vercel
1616
corepack enable
17-
yarn install
18-
yarn bootstrap
19-
yarn build
20-
yarn lint
21-
yarn test-unit
17+
pnpm install
18+
pnpm bootstrap
19+
pnpm build
20+
pnpm lint
21+
pnpm test-unit
2222
```
2323

2424
Make sure all the tests pass before making changes.
2525

2626
### Running Vercel CLI Changes
2727

28-
You can use `yarn dev` from the `cli` package to invoke Vercel CLI with local changes:
28+
You can use `pnpm dev` from the `cli` package to invoke Vercel CLI with local changes:
2929

3030
```
3131
cd ./packages/cli
32-
yarn dev <cli-commands...>
32+
pnpm dev <cli-commands...>
3333
```
3434

3535
See [CLI Local Development](../packages/cli#local-development) for more details.
@@ -39,7 +39,7 @@ See [CLI Local Development](../packages/cli#local-development) for more details.
3939
Once you are done with your changes (we even suggest doing it along the way), make sure all the tests still pass by running:
4040

4141
```
42-
yarn test-unit
42+
pnpm test-unit
4343
```
4444

4545
from the root of the project.
@@ -102,7 +102,7 @@ When you run this script, you'll see all the imported files. If anything file is
102102
Sometimes you want to test changes to a Builder against an existing project, maybe with `vercel dev` or actual deployment. You can avoid publishing every Builder change to npm by uploading the Builder as a tarball.
103103

104104
1. Change directory to the desired Builder `cd ./packages/node`
105-
2. Run `yarn build` to compile typescript and other build steps
105+
2. Run `pnpm build` to compile typescript and other build steps
106106
3. Run `npm pack` to create a tarball file
107107
4. Run `vercel *.tgz` to upload the tarball file and get a URL
108108
5. Edit any existing `vercel.json` project and replace `use` with the URL

.github/workflows/publish.yml

+7-5
Original file line numberDiff line numberDiff line change
@@ -47,20 +47,22 @@ jobs:
4747
uses: actions/cache@v3
4848
with:
4949
path: '**/node_modules'
50-
key: yarn-${{ matrix.os }}-${{ matrix.node }}-${{ hashFiles('yarn.lock') }}
51-
restore-keys: yarn-${{ matrix.os }}-${{ matrix.node }}
50+
key: pnpm-${{ matrix.os }}-${{ matrix.node }}-${{ hashFiles('pnpm-lock.yaml') }}
51+
restore-keys: pnpm-${{ matrix.os }}-${{ matrix.node }}
52+
- name: install [email protected]
53+
run: npm i -g [email protected]
5254
- name: Install
5355
if: ${{ steps.check-release.outputs.IS_RELEASE == 'true' }}
54-
run: yarn install --check-files --frozen-lockfile --network-timeout 1000000
56+
run: pnpm install
5557
- name: Build
5658
if: ${{ steps.check-release.outputs.IS_RELEASE == 'true' }}
57-
run: yarn build
59+
run: pnpm build
5860
env:
5961
GA_TRACKING_ID: ${{ secrets.GA_TRACKING_ID }}
6062
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
6163
- name: Publish
6264
if: ${{ steps.check-release.outputs.IS_RELEASE == 'true' }}
63-
run: yarn publish-from-github
65+
run: pnpm publish-from-github
6466
env:
6567
NPM_TOKEN: ${{ secrets.NPM_TOKEN_ELEVATED }}
6668
GA_TRACKING_ID: ${{ secrets.GA_TRACKING_ID }}

.github/workflows/test-integration-cli.yml

+7-5
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,13 @@ jobs:
4141
- uses: actions/cache@v3
4242
with:
4343
path: '**/node_modules'
44-
key: yarn-${{ matrix.os }}-${{ matrix.node }}-${{ hashFiles('yarn.lock') }}
45-
restore-keys: yarn-${{ matrix.os }}-${{ matrix.node }}
46-
- run: yarn install --network-timeout 1000000 --frozen-lockfile
47-
- run: yarn run build
48-
- run: yarn test-integration-cli
44+
key: pnpm-${{ matrix.os }}-${{ matrix.node }}-${{ hashFiles('pnpm-lock.yaml') }}
45+
restore-keys: pnpm-${{ matrix.os }}-${{ matrix.node }}
46+
- name: install [email protected]
47+
run: npm i -g [email protected]
48+
- run: pnpm install
49+
- run: pnpm run build
50+
- run: pnpm test-integration-cli
4951
env:
5052
VERCEL_TEST_TOKEN: ${{ secrets.VERCEL_TEST_TOKEN }}
5153
VERCEL_TEST_REGISTRATION_URL: ${{ secrets.VERCEL_TEST_REGISTRATION_URL }}

.github/workflows/test-unit.yml

+9-7
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,16 @@ jobs:
4141
- uses: actions/cache@v3
4242
with:
4343
path: '**/node_modules'
44-
key: yarn-${{ matrix.os }}-${{ matrix.node }}-${{ hashFiles('yarn.lock') }}
45-
restore-keys: yarn-${{ matrix.os }}-${{ matrix.node }}
46-
- run: yarn install --network-timeout 1000000 --frozen-lockfile
47-
- run: yarn run build
48-
- run: yarn run lint
44+
key: pnpm-${{ matrix.os }}-${{ matrix.node }}-${{ hashFiles('pnpm-lock.yaml') }}
45+
restore-keys: pnpm-${{ matrix.os }}-${{ matrix.node }}
46+
- name: install [email protected]
47+
run: npm i -g [email protected]
48+
- run: pnpm install
49+
- run: pnpm run build
50+
- run: pnpm run lint
4951
if: matrix.os == 'ubuntu-latest' && matrix.node == 14 # only run lint once
50-
- run: yarn run test-unit
51-
- run: yarn workspace vercel run coverage
52+
- run: pnpm run test-unit
53+
- run: pnpm -C packages/cli run coverage
5254
if: matrix.os == 'ubuntu-latest' && matrix.node == 14 # only run coverage once
5355
env:
5456
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

.github/workflows/test.yml

+11-6
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,11 @@ jobs:
3939
- uses: actions/cache@v3
4040
with:
4141
path: '**/node_modules'
42-
key: yarn-${{ matrix.os }}-${{ matrix.node }}-${{ hashFiles('yarn.lock') }}
43-
restore-keys: yarn-${{ matrix.os }}-${{ matrix.node }}
44-
- run: yarn install --network-timeout 1000000 --frozen-lockfile
42+
key: pnpm-${{ matrix.os }}-${{ matrix.node }}-${{ hashFiles('pnpm-lock.yaml') }}
43+
restore-keys: pnpm-${{ matrix.os }}-${{ matrix.node }}
44+
- name: install [email protected]
45+
run: npm i -g [email protected]
46+
- run: pnpm install
4547
- id: set-tests
4648
run: |
4749
TESTS_ARRAY=$(node utils/chunk-tests.js $SCRIPT_NAME)
@@ -80,14 +82,17 @@ jobs:
8082
- uses: actions/cache@v3
8183
with:
8284
path: '**/node_modules'
83-
key: yarn-${{ matrix.os }}-${{ matrix.node }}-${{ hashFiles('yarn.lock') }}
84-
restore-keys: yarn-${{ matrix.os }}-${{ matrix.node }}
85+
key: pnpm-${{ matrix.os }}-${{ matrix.node }}-${{ hashFiles('pnpm-lock.yaml') }}
86+
restore-keys: pnpm-${{ matrix.os }}-${{ matrix.node }}
8587

8688
- name: Install Hugo
8789
if: matrix.runner == 'macos-latest'
8890
run: curl -L -O https://github.com/gohugoio/hugo/releases/download/v0.56.0/hugo_0.56.0_macOS-64bit.tar.gz && tar -xzf hugo_0.56.0_macOS-64bit.tar.gz && mv ./hugo packages/cli/test/dev/fixtures/08-hugo/
8991

90-
- run: yarn install --network-timeout 1000000
92+
- name: install [email protected]
93+
run: npm i -g [email protected]
94+
95+
- run: pnpm install
9196

9297
- name: Build ${{matrix.packageName}} and all its dependencies
9398
run: node utils/gen.js && node_modules/.bin/turbo run build --cache-dir=".turbo" --scope=${{matrix.packageName}} --include-dependencies --no-deps

.husky/pre-commit

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/bin/sh
22
. "$(dirname "$0")/_/husky.sh"
33

4-
yarn pre-commit
4+
pnpm pre-commit

.npmrc

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
save-exact=true
2+
hoist-pattern[]=!"**/@types/**"
3+
hoist-pattern[]=!"**/typedoc"
4+
hoist-pattern[]=!"**/typedoc-plugin-markdown"
5+
hoist-pattern[]=!"**/typedoc-plugin-mdn-links"

.yarnrc

-1
This file was deleted.

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ For details on how to use Vercel, check out our [documentation](https://vercel.c
3333

3434
## Contributing
3535

36-
This project uses [yarn](https://yarnpkg.com/) to install dependencies and run scripts.
36+
This project uses [pnpm](https://pnpm.io/) to install dependencies and run scripts.
3737

38-
You can use the `dev` script to run local changes as if you were invoking Vercel CLI. For example, `vercel deploy --cwd=/path/to/project` could be run with local changes with `yarn dev deploy --cwd=/path/to/project`.
38+
You can use the `dev` script to run local changes as if you were invoking Vercel CLI. For example, `vercel deploy --cwd=/path/to/project` could be run with local changes with `pnpm dev deploy --cwd=/path/to/project`.
3939

4040
See the [Contributing Guidelines](./.github/CONTRIBUTING.md) for more details.
4141

api/_lib/util/error-handler.ts

+2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ function initSentry() {
1313
sentryInitDone = true;
1414

1515
init({
16+
// Cannot figure out whats going wrong here. VSCode resolves this fine. But when we build it blows up.
17+
// @ts-ignore
1618
dsn: assertEnv('SENTRY_DSN'),
1719
environment: process.env.NODE_ENV || 'production',
1820
release: `${serviceName}`,

api/package.json

+3-4
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
"description": "API for the vercel/vercel repo",
66
"main": "index.js",
77
"scripts": {
8-
"//TODO": "We should add this pkg to yarn workspaces"
98
},
109
"dependencies": {
1110
"@sentry/node": "5.11.1",
@@ -16,9 +15,9 @@
1615
"unzip-stream": "0.3.0"
1716
},
1817
"devDependencies": {
19-
"@types/node": "14.18.33",
18+
"@types/node": "16.18.11",
2019
"@types/node-fetch": "2.5.4",
21-
"@vercel/node": "1.9.0",
22-
"typescript": "3.9.6"
20+
"@vercel/node": "workspace:2.8.6",
21+
"typescript": "4.3.4"
2322
}
2423
}

api/tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@
1212
"resolveJsonModule": true,
1313
"isolatedModules": true
1414
},
15-
"include": ["examples", "frameworks.ts"]
15+
"include": ["examples", "frameworks.ts", "_lib"]
1616
}

0 commit comments

Comments
 (0)