Skip to content

Commit

Permalink
Migrate to pnpm (vercel#336)
Browse files Browse the repository at this point in the history
### turbo tracing in pnpm projects

How pnpm link packages:

![image](https://user-images.githubusercontent.com/3468483/191022172-962af095-9b44-4b69-8e2f-1e8d440d1c31.png)

After turbo tracing:

```
dist
├── crates
│   └── turbopack
│       └── tests
│           └── node-file-trace
│               ├── integration
│               └── node_modules
│                   └── better-sqlite3 -> ../../../../../node_modules/.pnpm/[email protected]/node_modules/better-sqlite3
└── node_modules
    └── .pnpm
        ├── [email protected]
        │   └── node_modules
        │       ├── better-sqlite3
        │       │   ├── build
        │       │   │   └── Release
        │       │   └── lib
        │       │       └── methods
        │       └── bindings -> ../../[email protected]/node_modules/bindings
        ├── [email protected]
        │   └── node_modules
        │       ├── bindings
        │       └── file-uri-to-path -> ../../[email protected]/node_modules/file-uri-to-path
        └── [email protected]
            └── node_modules
                └── file-uri-to-path
```

No more **global .pnpm store**. The directory link will follow the original path created by pnpm.
  • Loading branch information
Brooooooklyn authored Oct 5, 2022
1 parent 0eee71c commit 06ccbf1
Show file tree
Hide file tree
Showing 47 changed files with 20,468 additions and 28,824 deletions.
48 changes: 48 additions & 0 deletions .github/actions/setup-node/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: "Turborepo Node.js Setup"
description: "Sets Node.js up for CI"
inputs:
enable-corepack:
description: "Control turning on corepack."
required: false
default: true
disable-scripts:
description: "Control turning on corepack."
required: false
default: false
runs:
using: "composite"
steps:
- name: Setup pnpm
uses: pnpm/[email protected]
with:
version: 7.12.1

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 16
cache: pnpm

- name: Configure corepack
# Forcibly upgrade our available version of corepack.
# The bundled version in node 16 has known issues.
# Prepends the npm bin dir so that it is always first.
shell: bash
run: |
npm install --force --global corepack@latest
npm config get prefix >> $GITHUB_PATH
corepack enable
- name: Enable corepack
if: ${{ inputs.enable-corepack == 'true' }}
shell: bash
run: |
corepack enable
- name: pnpm install
if: ${{ inputs.disable-scripts == 'false' }}
shell: bash
run: pnpm install

- name: pnpm install
if: ${{ inputs.disable-scripts == 'true' }}
shell: bash
run: pnpm install --ignore-scripts
9 changes: 1 addition & 8 deletions .github/workflows/bench.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,7 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Setup node
uses: actions/setup-node@v3
with:
cache: "yarn"
node-version: 16

- name: install node.js dependencies
run: yarn install
- uses: ./.github/actions/setup-node

- uses: Swatinem/rust-cache@v1
with:
Expand Down
9 changes: 1 addition & 8 deletions .github/workflows/bench_against_node_nft.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,7 @@ jobs:
with:
key: bench_nft

- name: Setup node
uses: actions/setup-node@v3
with:
cache: "yarn"
node-version: 16

- name: install Node.js dependencies
run: yarn install
- uses: ./.github/actions/setup-node

- name: Install nextest
run: curl -LsSf https://get.nexte.st/latest/linux | tar zxf - -C ${CARGO_HOME:-~/.cargo}/bin
Expand Down
9 changes: 1 addition & 8 deletions .github/workflows/bench_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,7 @@ jobs:
- name: Fetch the base branch
run: git -c protocol.version=2 fetch --no-tags --progress --no-recurse-submodules --depth=1 origin +${{ github.base_ref }}:base

- name: Setup node
uses: actions/setup-node@v3
with:
cache: "yarn"
node-version: 16

- name: install node.js dependencies
run: yarn install
- uses: ./.github/actions/setup-node

- uses: Swatinem/rust-cache@v1
with:
Expand Down
6 changes: 1 addition & 5 deletions .github/workflows/build_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,7 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 16
check-latest: true
- uses: ./.github/actions/setup-node

- name: Set release name
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
Expand Down
15 changes: 4 additions & 11 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -125,20 +125,13 @@ jobs:
command: fmt
args: --check

- name: Setup node
uses: actions/setup-node@v3
with:
cache: "yarn"
node-version: 16

- name: install Node.js dependencies
run: yarn workspaces focus
- uses: ./.github/actions/setup-node

- name: Prettier
run: yarn prettier -c .
run: pnpm exec prettier -c .

- name: toml
run: yarn taplo format --check
run: pnpm exec taplo format --check

- name: eslint
run: yarn lint
run: pnpm lint
9 changes: 1 addition & 8 deletions .github/workflows/custom_bench.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,7 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Setup node
uses: actions/setup-node@v3
with:
cache: "yarn"
node-version: 16

- name: install node.js dependencies
run: yarn install
- uses: ./.github/actions/setup-node

- uses: Swatinem/rust-cache@v1
with:
Expand Down
9 changes: 1 addition & 8 deletions .github/workflows/custom_matrix_bench.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,7 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Setup node
uses: actions/setup-node@v3
with:
cache: "yarn"
node-version: 16

- name: install node.js dependencies
run: yarn install
- uses: ./.github/actions/setup-node

- uses: Swatinem/rust-cache@v1
with:
Expand Down
11 changes: 3 additions & 8 deletions .github/workflows/publish_npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,9 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Setup node
uses: actions/setup-node@v3
- uses: ./.github/actions/setup-node
with:
node-version: 16
check-latest: true
cache: yarn
disable-scripts: true

- name: Cache cargo registry
uses: actions/cache@v3
Expand All @@ -29,10 +26,8 @@ jobs:
target
key: publish-npm-cargo-cache

- run: yarn install --mode=skip-build

- name: Build packages
run: yarn turbo run build
run: pnpm turbo run build

- name: Write NPM_TOKEN
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN_ELEVATED }}" > ~/.npmrc
Expand Down
10 changes: 1 addition & 9 deletions .github/workflows/quick-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,7 @@ jobs:
with:
key: test

- name: Setup node
uses: actions/setup-node@v3
with:
cache: "yarn"
node-version: 16
- uses: ./.github/actions/setup-node

- name: Start Redis
uses: supercharge/[email protected]
Expand All @@ -40,10 +36,6 @@ jobs:
- name: Set Redis URL
run: echo "BULL_REDIS_CONNECTION=redis://127.0.0.1:6379" >> $GITHUB_ENV

- name: install Node.js dependencies
run: |
yarn install
- name: Install nextest
run: curl -LsSf https://get.nexte.st/latest/linux | tar zxf - -C ${CARGO_HOME:-~/.cargo}/bin
shell: bash
Expand Down
23 changes: 10 additions & 13 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,6 @@ jobs:
with:
key: test

- name: Setup node
uses: actions/setup-node@v3
with:
cache: "yarn"
node-version: 16

- name: Start Redis
uses: supercharge/[email protected]
with:
Expand All @@ -91,16 +85,19 @@ jobs:
description: Installing Node.js dependencies...
url: https://github.com/vercel/turbo-tooling/actions/runs/${{ github.run_id }}

- name: Install node dependencies
run: |
yarn install
- uses: ./.github/actions/setup-node
if: matrix.os.name != 'windows-latest'

- name: Install node dependencies
- name: install Node.js dependencies on Windows without scripts
uses: ./.github/actions/setup-node
with:
disable-scripts: true
if: matrix.os.name == 'windows-latest'

- name: install Node.js dependencies with scripts
run: |
yarn install --mode=skip-build
yarn node-gyp install
yarn install
pnpm node-gyp install
pnpm install --force
if: matrix.os.name == 'windows-latest'

- name: Report progress
Expand Down
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

yarn lint-staged
pnpm lint-staged
2 changes: 2 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
auto-install-peers = true
hoist = false
2 changes: 1 addition & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.yarn
target
yarn.lock
pnpm-lock.yaml
crates/turbopack-ecmascript/tests
crates/turbopack/tests/node-file-trace/integration
crates/turbopack/bench.json
Expand Down
8 changes: 0 additions & 8 deletions .yarn/plugins/@yarnpkg/plugin-changed.cjs

This file was deleted.

550 changes: 0 additions & 550 deletions .yarn/plugins/@yarnpkg/plugin-version.cjs

This file was deleted.

Loading

0 comments on commit 06ccbf1

Please sign in to comment.