Skip to content

Commit

Permalink
Move from yarn to pnpm (withastro#2455)
Browse files Browse the repository at this point in the history
* chore: `yarn` => `pnpm`

* docs: `yarn` => `pnpm`

* chore(ci): yarn => pnpm

* chore(ci): update pnpm cache path

* fix: add missing deps

* fix: add missing deps

* test: add package.json to all test fixtures

* chore: improve hoisting behavior

* chore: move turbo into package.json

* chore: update npmrc

* fix: add missing `debug` dependency

* chore: remove prepare script

* test: fix new tests

* fix: fully resolve renderer paths and `astro/internal` path

* chore: update lockfile

* chore: remove log

* fix: resolve renderers in vite-plugin-jsx

* fix: prefer public-hoist-pattern to shamefully-hoist

* chore: ignore @babel/core peer warning

* chore: update dependencies

* test: add autoprefixer as explicit dep

* chore: update `.npmrc` file in examples

* chore: update dependencies

* fix: resolve renderer dependencies in static build

* fix: static build renderer resolution

* chore: fix smoke tests

* chore: hoist autoprefixer

* chore: update lockfile

* attempt: use full file:// path on Windows

* attempt: use astro/internal

* attempt: optimize astro/internal

* attempt: expose ./internal.js

* chore: add missing package.json files

* attempt: resolve astro/internal path

* chore: tidy package.json

* chore: update lockfile

* chore: update deps

* chore: update deps

* chore: yarn -> pnpm

* attempt: explicit /@fs urls

* attempt: explicit /@fs urls

* chore: update all examples for pnpm

* chore: fix hoisting for with-vite-plugin-pwa

* chore(ci): fix sharp install

* chore: update with-vite-plugin-pwa example

* fix: pin vite-plugin-pwa to 0.11.11

* fix: add workbox-window to vite-plugin-pwa deps

* refactor: use pnpm update --recursive

Co-authored-by: JuanM04 <[email protected]>

* chore: yarn => pnpm

* chore: yarn => pnpm

* fix: update smoke test to skip examples which don't work in static build

* update lockfile

* chore: update .npmrc files

* chore: update lockfile

* fix: smoke script

* chore: update .npmrc file

* fix: return to shamefully-hoist (shamefully)

* chore: update lockfile

* fix(smoke): ignore scripts for smoke tests

* fix: update example to disable renderers

* chore: bump version

* chore(ci): fix smoke tests

* attempt: disable --frozen-lockfile for smoke tests

* chore: update smoke test

* chore: fix rebase issue

* chore: update lockfile

* fix: smoke tests

* fix(ci): run external smoke tests first

* fix(ci): run syntax

* chore: update lockfile

* fix(ci): ensure submodules are up-to-date

* fix(ci): ensure submodules are up-to-date

* chore: update lockfile

* chore: update for webapi

* chore: silence node:* warnings

* chore: update deps

* fix(ci): persist generated webapi assets

* fix(ci): webapi build script

* chore(ci): remove custom node caching

* chore: keep turbo.json

* chore: update turbo, ignore create-astro

* chore: update deps

* fix(ci): test command

* chore(ci): update test script

Co-authored-by: JuanM04 <[email protected]>
  • Loading branch information
natemoo-re and JuanM04 authored Mar 8, 2022
1 parent 2f7a4f8 commit d08ddaf
Show file tree
Hide file tree
Showing 161 changed files with 10,965 additions and 21,082 deletions.
114 changes: 47 additions & 67 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,26 @@ defaults:

jobs:
# Lint can run in parallel with Build.
# We also run `yarn install` with the `--prefer-offline` flag to speed things up.
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v2

- name: Setup PNPM
uses: pnpm/[email protected]
with:
version: 6.23.6

- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: 16
cache: 'yarn'
cache: 'pnpm'

- name: Install NPM Dependencies
run: yarn install --prefer-offline --frozen-lockfile --ignore-engines --registry https://registry.npmjs.org --network-timeout 300000
run: pnpm install
env:
CI: true

Expand All @@ -45,7 +49,7 @@ jobs:
# Lint autofix cannot run on forks, so just skip those! See https://github.com/wearerequired/lint-action/issues/13
- name: Lint (External)
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.owner.login != github.repository_owner }}
run: yarn lint
run: pnpm run lint

# Otherwise, run lint autofixer
- name: Lint
Expand Down Expand Up @@ -80,39 +84,36 @@ jobs:
- name: Checkout
uses: actions/checkout@v2

- name: Setup PNPM
uses: pnpm/[email protected]
with:
version: 6.23.6

- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: 16
cache: 'yarn'

- name: Cache Node Modules
id: cache-node
uses: actions/cache@v2
with:
path: "**/node_modules"
key: cache-node_modules-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-${{ github.run_id }}
restore-keys: |
cache-node_modules-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-${{ github.run_id }}
cache-node_modules-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-
cache: 'pnpm'

- name: Install NPM Dependencies
run: yarn install --prefer-offline --frozen-lockfile --ignore-engines --registry https://registry.npmjs.org --network-timeout 300000
run: pnpm install
env:
CI: true

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

- name: Upload Package Artifacts
uses: actions/upload-artifact@v2
with:
name: artifacts
path: packages/**/dist/**
path: |
packages/**/dist/**
packages/webapi/mod.js
packages/webapi/mod.js.map
if-no-files-found: error

# Test depends on Build's output, which allows us to skip any build process!
# We also run `yarn install` with the `--prefer-offline` flag to speed things up.
test:
name: 'Test: ${{ matrix.os }} (node@${{ matrix.node_version }})'
runs-on: ${{ matrix.os }}
Expand All @@ -132,41 +133,30 @@ jobs:
- name: Checkout
uses: actions/checkout@v2

- name: Setup PNPM
uses: pnpm/[email protected]
with:
version: 6.23.6

- name: Setup node@${{ matrix.node_version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node_version }}
cache: 'yarn'
cache: 'pnpm'

- name: Download Build Artifacts
uses: actions/download-artifact@v2

- name: Extract Artifacts
run: ./.github/extract-artifacts.sh

- name: Cache Node Modules
id: cache-node
uses: actions/cache@v2
with:
path: "**/node_modules"
key: cache-node_modules-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-${{ github.run_id }}
restore-keys: |
cache-node_modules-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-${{ github.run_id }}
cache-node_modules-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-
- name: Install NPM Dependencies
run: yarn install --prefer-offline --frozen-lockfile --ignore-engines --registry https://registry.npmjs.org --network-timeout 300000
run: pnpm install
env:
CI: true

- name: Test
if: ${{ matrix.os != 'windows-latest' }}
run: yarn test

# Turbo seems to make the tests hang on Windows, just run them directly
- name: Test (Windows)
if: ${{ matrix.os == 'windows-latest' }}
run: yarn workspace astro run test
run: pnpm run test

smoke:
name: 'Test (Smoke) ${{ matrix.os }}'
Expand All @@ -182,36 +172,31 @@ jobs:
with:
submodules: 'recursive'

- name: Update submodules
run: git submodule update --remote

- name: Setup PNPM
uses: pnpm/[email protected]
with:
version: 6.23.6

- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: 14
cache: 'yarn'
cache: 'pnpm'

- name: Download Build Artifacts
uses: actions/download-artifact@v2

- name: Extract Artifacts
run: ./.github/extract-artifacts.sh

- name: Cache Node Modules
id: cache-node
uses: actions/cache@v2
with:
path: "**/node_modules"
key: cache-node_modules-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-${{ github.run_id }}
restore-keys: |
cache-node_modules-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-${{ github.run_id }}
cache-node_modules-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-
- name: Install NPM Dependencies
# NOTE: Do NOT use `--frozen-lockfile` here! The lockfile needs to be updated in order to pull the submodules into the monorepo
run: yarn install --prefer-offline --ignore-engines --registry https://registry.npmjs.org --network-timeout 300000
env:
CI: true
run: pnpm install --frozen-lockfile=false

- name: Test
run: yarn test:smoke
run: pnpm run test:smoke

- name: Memory Leak Test
run: |
Expand All @@ -230,39 +215,34 @@ jobs:
- uses: actions/checkout@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Setup PNPM
uses: pnpm/[email protected]
with:
version: 6.23.6

- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: 16
cache: 'yarn'
cache: 'pnpm'

- name: Download Build Artifacts
uses: actions/download-artifact@v2

- name: Extract Artifacts
run: ./.github/extract-artifacts.sh

- name: Cache Node Modules
id: cache-node
uses: actions/cache@v2
with:
path: "**/node_modules"
key: cache-node_modules-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-${{ github.run_id }}
restore-keys: |
cache-node_modules-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-${{ github.run_id }}
cache-node_modules-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-
- name: Install NPM Dependencies
run: yarn install --prefer-offline --frozen-lockfile --ignore-engines --registry https://registry.npmjs.org --network-timeout 300000
run: pnpm install
env:
CI: true

- name: Create Release Pull Request or Publish
id: changesets
uses: changesets/action@v1
with:
publish: yarn changeset publish
publish: pnpm exec changeset publish
commit: '[ci] release'
title: '[ci] release'
env:
Expand Down
13 changes: 4 additions & 9 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,14 @@ jobs:
uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}
- name: Set Node version to 16
uses: actions/setup-node@v2
with:
node-version: 16
cache: 'yarn'
- name: Install dependencies
run: yarn --frozen-lockfile --ignore-engines
- name: Install NPM Dependencies
run: pnpm install
env:
CI: true
- name: Format code
run: yarn format
run: pnpm run format
- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: '[ci] yarn format'
commit_message: '[ci] format'
branch: ${{ github.head_ref }}
12 changes: 8 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,21 +40,25 @@ jobs:
run_job: ${{ steps.check_files.outputs.run_job }}
steps:
- uses: actions/checkout@v2

- name: Setup PNPM
uses: pnpm/[email protected]
with:
version: 6.23.6

- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: 16
cache: 'yarn'
cache: 'pnpm'

- name: Install NPM Dependencies
if: steps.cache-npm.outputs.cache-hit != 'true'
run: yarn install --prefer-offline --frozen-lockfile --ignore-engines --registry https://registry.npmjs.org --network-timeout 300000
run: pnpm install
env:
CI: true

- name: Check Modified
run: yarn changeset status --output ./status.json
run: pnpm exec changeset status --output ./status.json

- name: Check Output
id: check_files
Expand Down
36 changes: 25 additions & 11 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,23 @@ jobs:
steps:
- name: Check out code using Git
uses: actions/checkout@v2
- name: Set Node version to 16

- name: Setup PNPM
uses: pnpm/[email protected]
with:
version: 6.23.6

- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: 16
cache: 'yarn'
- name: Install dependencies
run: yarn install --frozen-lockfile --ignore-engines --ignore-scripts
cache: 'pnpm'

- name: Install NPM Dependencies
run: pnpm install
env:
CI: true

- name: Collect stats
run: node scripts/stats/index.js
env:
Expand All @@ -38,17 +48,21 @@ jobs:
- name: Check out code using Git
uses: actions/checkout@v2

- name: Set Node version to 16
- name: Setup PNPM
uses: pnpm/[email protected]
with:
version: 6.23.6

- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: 16
cache: 'yarn'
cache: 'pnpm'

- name: Clear lockfile
run: rm -rf yarn.lock node_modules

- name: Install dependencies
run: yarn install --ignore-engines --ignore-scripts
- name: Install NPM Dependencies
run: pnpm upgrade --recursive
env:
CI: true

- name: Create Pull Request
id: createpr
Expand Down
4 changes: 2 additions & 2 deletions .gitpod.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
# Commands to start on workspace startup
tasks:
- init: yarn install
command: yarn build
- init: pnpm install
command: pnpm run build
vscode:
extensions:
# TODO Once astro is on [vsx](https://open-vsx.org/), we should be able to specify it as an extension as well!
Expand Down
16 changes: 16 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Important! Never install `astro` even when new version is in registry
prefer-workspace-packages=true
# Rather than shamefully hoisting everything, just make problematic packages public
public-hoist-pattern[]=autoprefixer
public-hoist-pattern[]=astro
public-hoist-pattern[]=remark-*
public-hoist-pattern[]=rehype-*
public-hoist-pattern[]=react
public-hoist-pattern[]=react-dom
public-hoist-pattern[]=preact
public-hoist-pattern[]=preact-render-to-string
public-hoist-pattern[]=vue
public-hoist-pattern[]=svelte
public-hoist-pattern[]=solid-js
public-hoist-pattern[]=lit
public-hoist-pattern[]=@webcomponents/template-shadowroot
Loading

0 comments on commit d08ddaf

Please sign in to comment.