Skip to content

Commit

Permalink
feat(repo): migrate to pnpm (#16284)
Browse files Browse the repository at this point in the history
  • Loading branch information
meeroslav authored Apr 25, 2023
1 parent 8329395 commit 2628658
Show file tree
Hide file tree
Showing 38 changed files with 29,430 additions and 171,902 deletions.
61 changes: 29 additions & 32 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,19 @@ orbs:
# -------------------------
machine:
pre:
- mkdir ~/.cache/yarn
- mkdir ~/.pnpm-store
- mkdir ~/.cache/Cypress
- mkdir ~/Library/Caches/Homebrew
- mkdir /usr/local/Homebrew

dependencies:
cache_directories:
- ~/.cache/yarn
- ~/.pnpm-store
- ~/.cache/Cypress
- /usr/local/Homebrew
- ~/Library/Caches/Homebrew
override:
- yarn install
- pnpm install
- brew install

defaults: &defaults
Expand All @@ -52,29 +52,30 @@ executors:
# COMMANDS
# -------------------------
commands:
run-yarn-install:
run-pnpm-install:
parameters:
os:
type: string
steps:
- restore_cache:
name: Restore Yarn Package Cache
name: Restore pnpm Package Cache
keys:
- node-deps-{{ arch }}-v2-{{ checksum "package.json" }}-{{ checksum "yarn.lock" }}
- node-deps-{{ arch }}-v3-{{ checksum "pnpm-lock.yaml" }}
- run:
name: Install dependencies
command: yarn install --prefer-offline --frozen-lockfile --non-interactive --cache-folder ~/.cache/yarn
name: Install pnpm package manager
command: |
npm install -g @pnpm/[email protected]
- run:
name: Install Dependencies
command: |
pnpm install --frozen-lockfile
- save_cache:
name: Save Yarn Package Cache
key: node-deps-{{ arch }}-v2-{{ checksum "package.json" }}-{{ checksum "yarn.lock" }}
name: Save pnpm Package Cache
key: node-deps-{{ arch }}-v3-{{ checksum "pnpm-lock.yaml" }}
paths:
- ~/.cache/yarn
- ~/.pnpm-store
- ~/.cache/Cypress
install-pnpm:
steps:
- run:
name: Install PNPM
command: npm install --prefix=$HOME/.local -g @pnpm/[email protected]
- node_modules

setup:
parameters:
Expand Down Expand Up @@ -114,13 +115,8 @@ commands:
- node/install:
# Use LTS version
node-version: ''
- run-yarn-install:
- run-pnpm-install:
os: << parameters.os >>
- when:
condition:
equal: [<< parameters.os >>, linux]
steps:
- install-pnpm

# -------------------------
# JOBS
Expand Down Expand Up @@ -162,7 +158,7 @@ jobs:
os: << parameters.os >>
- run:
name: Agent
command: npx nx-cloud start-agent
command: pnpm nx-cloud start-agent
no_output_timeout: 60m

# -------------------------
Expand All @@ -184,29 +180,29 @@ jobs:
os: linux
- nx/set-shas:
main-branch-name: 'master'
- run: npx nx-cloud start-ci-run --stop-agents-after="e2e"
- run: pnpm nx-cloud start-ci-run --stop-agents-after="e2e"
- run:
name: Check Documentation
command: npx nx documentation --no-dte
command: pnpm nx documentation --no-dte
no_output_timeout: 20m
- run:
name: Run Checks/Lint/Test/Build
no_output_timeout: 60m
command: |
pids=()
npx nx-cloud record -- nx format:check --base=$NX_BASE --head=$NX_HEAD &
pnpm nx-cloud record -- nx format:check --base=$NX_BASE --head=$NX_HEAD &
pids+=($!)
npx nx run-many -t check-imports check-commit check-lock-files depcheck --parallel=1 --no-dte &
pnpm nx run-many -t check-imports check-commit check-lock-files depcheck --parallel=1 --no-dte &
pids+=($!)
yarn nx affected --target=lint --base=$NX_BASE --head=$NX_HEAD --parallel=3 &
pnpm nx affected --target=lint --base=$NX_BASE --head=$NX_HEAD --parallel=3 &
pids+=($!)
yarn nx affected --target=test --base=$NX_BASE --head=$NX_HEAD --parallel=1 &
pnpm nx affected --target=test --base=$NX_BASE --head=$NX_HEAD --parallel=1 &
pids+=($!)
(yarn nx affected --target=build --base=$NX_BASE --head=$NX_HEAD --parallel=3 &&
npx nx affected --target=e2e --base=$NX_BASE --head=$NX_HEAD --parallel=1) &
(pnpm nx affected --target=build --base=$NX_BASE --head=$NX_HEAD --parallel=3 &&
pnpm nx affected --target=e2e --base=$NX_BASE --head=$NX_HEAD --parallel=1) &
pids+=($!)
for pid in "${pids[@]}"; do
Expand All @@ -221,6 +217,7 @@ jobs:
NX_E2E_CI_CACHE_KEY: e2e-circleci-macos
NX_DAEMON: 'true'
NX_PERF_LOGGING: 'false'
SELECTED_PM: 'npm' # explicitly define npm for macOS tests
steps:
- run:
name: Set dynamic nx run variable
Expand All @@ -232,7 +229,7 @@ jobs:
- run:
name: Run E2E Tests for macOS
command: |
npx nx affected -t e2e-macos --parallel=1
pnpm nx affected -t e2e-macos --parallel=1 --base=$NX_BASE --head=$NX_HEAD
no_output_timeout: 45m

# -------------------------
Expand Down
12 changes: 8 additions & 4 deletions .github/workflows/e2e-matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,15 @@ jobs:
- name: Checkout
uses: actions/checkout@v3

- name: Install PNPM
run: |
npm install -g @pnpm/[email protected]
- name: Set node
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node_version }}
cache: 'pnpm'

- name: Cache node_modules
id: cache-modules
Expand All @@ -54,7 +59,7 @@ jobs:

- name: Install packages
if: steps.cache-modules.outputs.cache-hit != 'true'
run: yarn install --prefer-offline --frozen-lockfile --non-interactive
run: pnpm install --frozen-lockfile

- name: Homebrew cache directory path
if: ${{ matrix.os == 'macos-latest' }}
Expand Down Expand Up @@ -320,14 +325,14 @@ jobs:
run: mkdir -p outputs

- name: Install PNPM
if: ${{ matrix.package_manager == 'pnpm' }}
run: |
npm install -g @pnpm/[email protected]
- name: Use Node.js ${{ matrix.node_version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node_version }}
cache: 'pnpm'
registry-url: http://localhost:4872

- name: Cache node_modules
Expand All @@ -338,8 +343,7 @@ jobs:
key: ${{ runner.os }}-modules-${{ matrix.node_version }}-${{ github.run_id }}

- name: Install packages
if: steps.cache-modules.outputs.cache-hit != 'true'
run: yarn install --prefer-offline --frozen-lockfile --non-interactive
run: pnpm install --frozen-lockfile

- name: Cleanup
if: ${{ matrix.os == 'ubuntu-latest' }}
Expand Down
15 changes: 12 additions & 3 deletions .github/workflows/e2e-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,15 @@ jobs:
- name: Checkout
uses: actions/checkout@v3

- name: Install PNPM
run: |
npm install -g @pnpm/[email protected]
- name: Set node
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node_version }}
cache: 'pnpm'

- name: Cache node_modules
id: cache-modules
Expand All @@ -44,7 +49,7 @@ jobs:

- name: Install packages
if: steps.cache-modules.outputs.cache-hit != 'true'
run: yarn install --prefer-offline --frozen-lockfile --non-interactive
run: pnpm install --frozen-lockfile

- name: Cache Cypress
id: cache-cypress
Expand Down Expand Up @@ -243,10 +248,15 @@ jobs:
- name: Prepare dir for output
run: mkdir -p outputs

- name: Install PNPM
run: |
npm install -g @pnpm/[email protected]
- name: Use Node.js ${{ matrix.node_version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node_version }}
cache: 'pnpm'
registry-url: http://localhost:4872

- name: Cache node_modules
Expand All @@ -257,8 +267,7 @@ jobs:
key: ${{ runner.os }}-modules-${{ matrix.node_version }}-${{ github.run_id }}

- name: Install packages
if: steps.cache-modules.outputs.cache-hit != 'true'
run: yarn install --prefer-offline --frozen-lockfile --non-interactive
run: pnpm install --frozen-lockfile

- name: Cache Cypress
id: cache-cypress
Expand Down
21 changes: 12 additions & 9 deletions .github/workflows/issue-notifier.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,27 @@ jobs:
- name: Checkout
uses: actions/checkout@v3

- uses: pnpm/action-setup@v2
with:
version: 8.2

- name: Use Node.js ${{ matrix.node_version }}
uses: actions/setup-node@v3
with:
node-version: '18'
cache: 'pnpm'
registry-url: http://localhost:4872

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

- name: Cache yarn
- name: Cache node_modules
id: cache-modules
uses: actions/cache@v3
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: yarn-${{ hashFiles('yarn.lock') }}
lookup-only: true
path: '**/node_modules'
key: pnpm-${{ hashFiles('pnpm-lock.yaml') }}

- name: Install packages
run: yarn install --prefer-offline --frozen-lockfile --non-interactive
run: pnpm install --frozen-lockfile

- name: Download artifact
id: download-artifact
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/npm-audit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ jobs:
- name: Run a security audit
run: npx audit-ci --critical --report-type summary

- name: Check lock file for invalid hosts
run: npx lockfile-lint -s -n -p yarn.lock -a hosts yarn npm

# - name: Run Dependency confusion supply chain check
# run: npx snync -d .

Expand Down
Loading

1 comment on commit 2628658

@vercel
Copy link

@vercel vercel bot commented on 2628658 Apr 25, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

nx-dev – ./

nx-dev-git-master-nrwl.vercel.app
nx-dev-nrwl.vercel.app
nx-five.vercel.app
nx.dev

Please sign in to comment.