Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to PNPM #2612

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

- [ ] I have added tests that prove my fix is effective or that my feature works
- [ ] I have added necessary documentation (if appropriate)
- [ ] I have run `yarn changeset` and documented my changes
- [ ] I have run `pnpm changeset` and documented my changes

### For new components

Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/clean.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: pnpm
uses: pnpm/action-setup@v4
with:
version: 9.15.0

- name: Cleanup
run: |
Expand Down
117 changes: 72 additions & 45 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,91 +14,108 @@ jobs:
name: Build packages
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: actions/cache@v3
- name: pnpm
uses: pnpm/action-setup@v4
with:
version: 9.15.0

- uses: actions/cache@v4
name: Check for build cache
id: build-cache
with:
path: |
**/dist
!**/node_modules
key: ${{ runner.os }}-build-cache-${{ hashFiles('package.json', 'yarn.lock', '**/src/', '!**/node_modules', '!**/dist') }}
.pnpm-store
key: ${{ runner.os }}-build-cache-${{ hashFiles('pnpm-lock.yaml', '**/src/**/*', 'package.json') }}
restore-keys: |
${{ runner.os }}-build-cache-

# Only setup & build if there was no build cache hit
- name: Use Node 18
uses: actions/setup-node@v3
uses: actions/setup-node@v4
if: ${{ steps.build-cache.outputs.cache-hit != 'true' }}
with:
node-version: '18'
cache: yarn
cache-dependency-path: 'yarn.lock'
node-version: 18
cache: 'pnpm'
cache-dependency-path: 'pnpm-lock.yaml'

- name: Install
if: ${{ steps.build-cache.outputs.cache-hit != 'true' }}
run: yarn install --frozen-lockfile --prefer-offline
run: pnpm install --frozen-lockfile --prefer-offline

- name: Build
if: ${{ steps.build-cache.outputs.cache-hit != 'true' }}
run: yarn build
run: pnpm build

lint:
name: Check lints
runs-on: ubuntu-latest
needs: [build]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: pnpm
uses: pnpm/action-setup@v4
with:
version: 9.15.0

- name: Use Node 18
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: '18'
cache: yarn
cache-dependency-path: 'yarn.lock'
node-version: 18
cache: 'pnpm'
cache-dependency-path: 'pnpm-lock.yaml'

- uses: actions/cache/restore@v3
- uses: actions/cache/restore@v4
name: Restore build cache
id: build-cache
with:
path: |
**/dist
!**/node_modules
key: ${{ runner.os }}-build-cache-${{ hashFiles('package.json', 'yarn.lock', '**/src/', '!**/node_modules', '!**/dist') }}
key: ${{ runner.os }}-build-cache-${{ hashFiles('package.json', 'pnpm-lock.yaml', '**/src/', '!**/node_modules', '!**/dist') }}

- name: Install Dependencies
run: yarn install --frozen-lockfile --prefer-offline
run: pnpm install --frozen-lockfile --prefer-offline

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

chromatic:
name: Chromatic
runs-on: ubuntu-latest
needs: [build]
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: pnpm
uses: pnpm/action-setup@v4
with:
version: 9.15.0

- name: Use Node 18
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: '18'
cache: yarn
cache-dependency-path: 'yarn.lock'
node-version: 18
cache: 'pnpm'
cache-dependency-path: 'pnpm-lock.yaml'

- name: Install Dependencies
run: yarn install --frozen-lockfile --prefer-offline
run: pnpm install --frozen-lockfile --prefer-offline

- uses: actions/cache/restore@v3
- uses: actions/cache/restore@v4
name: Restore build cache
id: build-cache
with:
path: |
**/dist
!**/node_modules
key: ${{ runner.os }}-build-cache-${{ hashFiles('package.json', 'yarn.lock', '**/src/', '!**/node_modules', '!**/dist') }}
key: ${{ runner.os }}-build-cache-${{ hashFiles('package.json', 'pnpm-lock.yaml', '**/src/', '!**/node_modules', '!**/dist') }}

- name: Publish to Chromatic
env:
Expand All @@ -116,29 +133,34 @@ jobs:
runs-on: ubuntu-latest
needs: [build]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: pnpm
uses: pnpm/action-setup@v4
with:
version: 9.15.0

- name: Use Node 18
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: '18'
cache: yarn
cache-dependency-path: 'yarn.lock'
node-version: 18
cache: 'pnpm'
cache-dependency-path: 'pnpm-lock.yaml'

- name: Install Dependencies
run: yarn install --frozen-lockfile --prefer-offline
run: pnpm install --frozen-lockfile --prefer-offline

- uses: actions/cache/restore@v3
- uses: actions/cache/restore@v4
name: Restore build cache
id: build-cache
with:
path: |
**/dist
!**/node_modules
key: ${{ runner.os }}-build-cache-${{ hashFiles('package.json', 'yarn.lock', '**/src/', '!**/node_modules', '!**/dist') }}
key: ${{ runner.os }}-build-cache-${{ hashFiles('package.json', 'pnpm-lock.yaml', '**/src/', '!**/node_modules', '!**/dist') }}

- name: tests
run: yarn test --ci
run: pnpm test:custom --ci
env:
JEST_JUNIT_OUTPUT: 'reports/junit/js-test-results.xml'

Expand All @@ -147,26 +169,31 @@ jobs:
runs-on: ubuntu-latest
needs: [build]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: pnpm
uses: pnpm/action-setup@v4
with:
version: 9.15.0

- name: Use Node 18
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: '18'
cache: yarn
cache-dependency-path: 'yarn.lock'
node-version: 18
cache: 'pnpm'
cache-dependency-path: 'pnpm-lock.yaml'

- name: Install Dependencies
run: yarn install --frozen-lockfile --prefer-offline
run: pnpm install --frozen-lockfile --prefer-offline

- uses: actions/cache/restore@v3
- uses: actions/cache/restore@v4
name: Restore build cache
id: build-cache
with:
path: |
**/dist
!**/node_modules
key: ${{ runner.os }}-build-cache-${{ hashFiles('package.json', 'yarn.lock', '**/src/', '!**/node_modules', '!**/dist') }}
key: ${{ runner.os }}-build-cache-${{ hashFiles('package.json', 'pnpm-lock.yaml', '**/src/', '!**/node_modules', '!**/dist') }}

- name: validate
run: yarn validate
run: pnpm validate
23 changes: 14 additions & 9 deletions .github/workflows/react17.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,29 +14,34 @@ jobs:
name: Test in React 17
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: pnpm
uses: pnpm/action-setup@v4
with:
version: 9.15.0

- name: Setup Node 18
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'yarn'
node-version: 18
cache: 'pnpm'

- name: Install node-gyp
run: yarn global add node-gyp
run: pnpm add --global node-gyp

- name: Install package.json
run: yarn install --prefer-offline
run: pnpm install --prefer-offline

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

# TODO: Will nohoist help here?
- name: Install testing tools for React 17
run: npx ts-node tools/test/scripts/install-react17.ts

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

- name: Run tests in React 17
run: yarn lg test --react17
run: pnpm test:custom --react17
Loading