Skip to content

Commit

Permalink
chore(workspace): Migrate from yarn to pnpm (#2837)
Browse files Browse the repository at this point in the history
  • Loading branch information
kitten authored Nov 28, 2022
1 parent af93ef9 commit 72e0ca2
Show file tree
Hide file tree
Showing 53 changed files with 17,308 additions and 17,104 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const run = require('execa')(
'yarn',
'pnpm',
['run', process.env.INPUT_COMMAND],
{ cwd: process.cwd(), }
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: 'Run a Yarn command'
description: 'Locally run a forked Yarn command as an action.'
name: 'Run a pnpm command'
description: 'Locally run a forked pnpm command as an action.'
inputs:
command:
description: 'Command'
Expand Down
188 changes: 101 additions & 87 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,132 +15,141 @@ jobs:
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: '16'
- name: Get Yarn cache directory
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
node-version: 18

- name: Setup pnpm
uses: pnpm/[email protected]
with:
version: 7
run_install: false

- name: Use Yarn cache
- name: Get pnpm store directory
id: pnpm-store
run: echo "::set-output name=pnpm_cache_dir::$(pnpm store path)"

- name: Use pnpm store
uses: actions/cache@v3
id: yarn-cache
id: pnpm-cache
with:
path: |
~/.cache/Cypress
${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
${{ steps.pnpm-store.outputs.dir }}
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Use node_modules cache
id: node-modules-cache
uses: actions/cache@v3
with:
path: node_modules
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/yarn.lock') }}
${{ runner.os }}-pnpm-
- name: Install Dependencies
if: |
steps.yarn-cache.outputs.cache-hit != 'true' ||
steps.node-modules-cache.outputs.cache-hit != 'true'
run: yarn install --prefer-offline --frozen-lockfile --non-interactive --silent
run: pnpm install --frozen-lockfile --prefer-offline

- name: TypeScript
run: yarn run check
run: pnpm run check

- name: Linting
run: yarn run lint
run: pnpm run lint

- name: Unit Tests
run: yarn run test
run: pnpm run test

react-e2e:
name: React end-to-end tests
name: React E2E
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout Repo
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: '16'
- name: Get Yarn cache directory
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
node-version: 18

- name: Setup pnpm
uses: pnpm/[email protected]
with:
version: 7
run_install: false

- name: Use Yarn cache
- name: Get pnpm store directory
id: pnpm-store
run: echo "::set-output name=pnpm_cache_dir::$(pnpm store path)"

- name: Use pnpm store
uses: actions/cache@v3
id: yarn-cache
id: pnpm-cache
with:
path: |
~/.cache/Cypress
${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
${{ steps.pnpm-store.outputs.dir }}
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Use node_modules cache
id: node-modules-cache
uses: actions/cache@v3
with:
path: node_modules
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/yarn.lock') }}
${{ runner.os }}-pnpm-
- name: Install Dependencies
if: |
steps.yarn-cache.outputs.cache-hit != 'true' ||
steps.node-modules-cache.outputs.cache-hit != 'true'
run: yarn install --prefer-offline --frozen-lockfile --non-interactive --silent
run: pnpm install --frozen-lockfile --prefer-offline

- name: Build
run: yarn workspace @urql/core build
run: pnpm -F urql build

- name: e2e tests 🧪
uses: cypress-io/github-action@v4
with:
command: yarn cypress run --component
install: false
command: pnpm cypress run --component
working-directory: packages/react-urql

graphcache-e2e:
name: Graphcache end-to-end tests
name: Graphcache E2E
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout Repo
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: '16'
- name: Get Yarn cache directory
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
node-version: 18

- name: Use Yarn cache
- name: Setup pnpm
uses: pnpm/[email protected]
with:
version: 7
run_install: false

- name: Get pnpm store directory
id: pnpm-store
run: echo "::set-output name=pnpm_cache_dir::$(pnpm store path)"

- name: Use pnpm store
uses: actions/cache@v3
id: yarn-cache
id: pnpm-cache
with:
path: |
~/.cache/Cypress
${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
${{ steps.pnpm-store.outputs.dir }}
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Use node_modules cache
id: node-modules-cache
uses: actions/cache@v3
with:
path: node_modules
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/yarn.lock') }}
${{ runner.os }}-pnpm-
- name: Install Dependencies
if: |
steps.yarn-cache.outputs.cache-hit != 'true' ||
steps.node-modules-cache.outputs.cache-hit != 'true'
run: yarn install --prefer-offline --frozen-lockfile --non-interactive --silent
run: pnpm install --frozen-lockfile --prefer-offline

- name: Build
run: yarn workspace @urql/core build && yarn workspace urql build && yarn workspace @urql/exchange-execute build
run: pnpm -F "@urql/core" -F urql -F "@urql/exchange-execute" build

- name: e2e tests 🧪
uses: cypress-io/github-action@v4
with:
command: yarn cypress run --component
install: false
command: pnpm cypress run --component
working-directory: exchanges/graphcache

build:
Expand All @@ -158,35 +167,40 @@ jobs:
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: '16'
- name: Get Yarn cache directory
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
- name: Use Yarn cache
uses: actions/cache@v3
id: yarn-cache
node-version: 18

- name: Setup pnpm
uses: pnpm/[email protected]
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Use node_modules cache
id: node-modules-cache
version: 7
run_install: false

- name: Get pnpm store directory
id: pnpm-store
run: echo "::set-output name=pnpm_cache_dir::$(pnpm store path)"

- name: Use pnpm store
uses: actions/cache@v3
id: pnpm-cache
with:
path: node_modules
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/yarn.lock') }}
path: |
~/.cache/Cypress
${{ steps.pnpm-store.outputs.dir }}
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-
- name: Install Dependencies
if: |
steps.yarn-cache.outputs.cache-hit != 'true' ||
steps.node-modules-cache.outputs.cache-hit != 'true'
run: yarn install --prefer-offline --frozen-lockfile --non-interactive --silent
run: pnpm install --frozen-lockfile --prefer-offline

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

- name: Pack
uses: ./.github/actions/yarn-run
uses: ./.github/actions/pnpm-run
with:
command: pack
40 changes: 19 additions & 21 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,39 +17,37 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: '16'
node-version: 18

- name: Get Yarn cache directory
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT

- name: Use Yarn cache
uses: actions/cache@v3
id: yarn-cache
- name: Setup pnpm
uses: pnpm/[email protected]
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
version: 7
run_install: false

- name: Use node_modules cache
id: node-modules-cache
- name: Get pnpm store directory
id: pnpm-store
run: echo "::set-output name=pnpm_cache_dir::$(pnpm store path)"

- name: Use pnpm store
uses: actions/cache@v3
id: pnpm-cache
with:
path: node_modules
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/yarn.lock') }}
path: |
~/.cache/Cypress
${{ steps.pnpm-store.outputs.dir }}
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-
- name: Install Dependencies
if: |
steps.yarn-cache.outputs.cache-hit != 'true' ||
steps.node-modules-cache.outputs.cache-hit != 'true'
run: yarn install --prefer-offline --frozen-lockfile --non-interactive --silent
run: pnpm install --frozen-lockfile --prefer-offline

- name: PR or Publish
id: changesets
uses: changesets/action@b3300fad33b6ab794313da28d27424c0e2f78991
with:
publish: yarn changeset publish
publish: pnpm changeset publish
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Loading

0 comments on commit 72e0ca2

Please sign in to comment.