chore: yarn => pnpm

This commit is contained in:
Nate Moore 2022-01-18 16:15:25 -06:00
parent 1a34fab1e4
commit 95e5d13bba
18 changed files with 10810 additions and 10257 deletions

View file

@ -21,7 +21,7 @@ defaults:
jobs:
# Lint can run in parallel with Build.
# We also run `yarn install` with the `--prefer-offline` flag to speed things up.
# We also run `pnpm install` with the `--prefer-offline` flag to speed things up.
lint:
name: Lint
runs-on: ubuntu-latest
@ -29,14 +29,18 @@ jobs:
- name: Check out repository
uses: actions/checkout@v2
- uses: pnpm/action-setup@v2.0.1
with:
version: 6.23.x
- 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 --prefer-offline --frozen-lockfile --ignore-engines --registry https://registry.npmjs.org --network-timeout 300000
env:
CI: true
@ -46,7 +50,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
@ -80,25 +84,25 @@ jobs:
uses: actions/setup-node@v2
with:
node-version: 16
cache: 'yarn'
cache: 'pnpm'
- 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 }}
key: cache-node_modules-${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}-${{ 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-node_modules-${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}-${{ github.run_id }}
cache-node_modules-${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}-
- name: Install NPM Dependencies
run: yarn install --prefer-offline --frozen-lockfile --ignore-engines --registry https://registry.npmjs.org --network-timeout 300000
run: pnpm install --prefer-offline --frozen-lockfile --ignore-engines --registry https://registry.npmjs.org --network-timeout 300000
env:
CI: true
- name: Build Packages
run: yarn build --force
run: pnpm run build --force
- name: Upload Package Artifacts
uses: actions/upload-artifact@v2
@ -108,7 +112,7 @@ jobs:
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.
# We also run `pnpm install` with the `--prefer-offline` flag to speed things up.
test:
name: 'Test: ${{ matrix.os }} (node@${{ matrix.node_version }})'
runs-on: ${{ matrix.os }}
@ -132,7 +136,7 @@ jobs:
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node_version }}
cache: 'yarn'
cache: 'pnpm'
- name: Download Build Artifacts
uses: actions/download-artifact@v2
@ -145,24 +149,24 @@ jobs:
uses: actions/cache@v2
with:
path: "**/node_modules"
key: cache-node_modules-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-${{ github.run_id }}
key: cache-node_modules-${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}-${{ 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-node_modules-${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}-${{ github.run_id }}
cache-node_modules-${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}-
- name: Install NPM Dependencies
run: yarn install --prefer-offline --frozen-lockfile --ignore-engines --registry https://registry.npmjs.org --network-timeout 300000
run: pnpm install --prefer-offline --frozen-lockfile --ignore-engines --registry https://registry.npmjs.org --network-timeout 300000
env:
CI: true
- name: Test
if: ${{ matrix.os != 'windows-latest' }}
run: yarn test
run: pnpm run 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 --filter=astro
smoke:
name: 'Test (Smoke) ${{ matrix.os }}'
@ -180,7 +184,7 @@ jobs:
uses: actions/setup-node@v2
with:
node-version: 14
cache: 'yarn'
cache: 'pnpm'
- name: Download Build Artifacts
uses: actions/download-artifact@v2
@ -193,19 +197,19 @@ jobs:
uses: actions/cache@v2
with:
path: "**/node_modules"
key: cache-node_modules-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-${{ github.run_id }}
key: cache-node_modules-${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}-${{ 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-node_modules-${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}-${{ github.run_id }}
cache-node_modules-${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}-
- name: Install NPM Dependencies
run: yarn install --prefer-offline --frozen-lockfile --ignore-engines --registry https://registry.npmjs.org --network-timeout 300000
run: pnpm install --prefer-offline --frozen-lockfile --ignore-engines --registry https://registry.npmjs.org --network-timeout 300000
env:
CI: true
- name: Test
if: ${{ matrix.os != 'windows-latest' }}
run: yarn run build:examples --concurrency=1
run: pnpm run build:examples --concurrency=1
# Turbo seems to fail on Windows, so run a custom script directly.
- name: Test (Windows)
@ -229,7 +233,7 @@ jobs:
uses: actions/setup-node@v2
with:
node-version: 16
cache: 'yarn'
cache: 'pnpm'
- name: Download Build Artifacts
uses: actions/download-artifact@v2
@ -242,13 +246,13 @@ jobs:
uses: actions/cache@v2
with:
path: "**/node_modules"
key: cache-node_modules-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-${{ github.run_id }}
key: cache-node_modules-${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}-${{ 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-node_modules-${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}-${{ github.run_id }}
cache-node_modules-${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}-
- name: Install NPM Dependencies
run: yarn install --prefer-offline --frozen-lockfile --ignore-engines --registry https://registry.npmjs.org --network-timeout 300000
run: pnpm install --prefer-offline --frozen-lockfile --ignore-engines --registry https://registry.npmjs.org --network-timeout 300000
env:
CI: true
@ -256,7 +260,7 @@ jobs:
id: changesets
uses: changesets/action@v1
with:
publish: yarn changeset publish
publish: pnpm exec changeset publish
commit: '[ci] release'
title: '[ci] release'
env:

View file

@ -13,19 +13,22 @@ jobs:
uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}
- uses: pnpm/action-setup@v2.0.1
with:
version: 6.23.x
- name: Set Node version to 16
uses: actions/setup-node@v2
with:
node-version: 16
cache: 'yarn'
cache: 'pnpm'
- name: Install dependencies
run: yarn --frozen-lockfile --ignore-engines
run: pnpm install --frozen-lockfile --ignore-engines
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 }}

View file

@ -39,20 +39,24 @@ jobs:
steps:
- uses: actions/checkout@v2
- uses: pnpm/action-setup@v2.0.1
with:
version: 6.23.x
- 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 --prefer-offline --frozen-lockfile --ignore-engines --registry https://registry.npmjs.org --network-timeout 300000
env:
CI: true
- name: Check Modified
run: yarn changeset status --output ./status.json
run: pnpm changeset status --output ./status.json
- name: Check Output
id: check_files

View file

@ -13,13 +13,16 @@ jobs:
steps:
- name: Check out code using Git
uses: actions/checkout@v2
- uses: pnpm/action-setup@v2.0.1
with:
version: 6.23.x
- name: Set Node version to 16
uses: actions/setup-node@v2
with:
node-version: 16
cache: 'yarn'
cache: 'pnpm'
- name: Install dependencies
run: yarn install --frozen-lockfile --ignore-engines --ignore-scripts
run: pnpm install --frozen-lockfile --ignore-engines --ignore-scripts
- name: Collect stats
run: node scripts/stats/index.js
env:
@ -37,18 +40,22 @@ jobs:
- name: Check out code using Git
uses: actions/checkout@v2
- uses: pnpm/action-setup@v2.0.1
with:
version: 6.23.x
- name: Set Node version to 16
uses: actions/setup-node@v2
with:
node-version: 16
cache: 'yarn'
cache: 'pnpm'
- name: Clear lockfile
run: rm -rf yarn.lock node_modules
run: rm -rf pnpm-lock.yaml node_modules
- name: Install dependencies
run: yarn install --ignore-engines --ignore-scripts
run: pnpm install --ignore-engines --ignore-scripts
- name: Create Pull Request
id: createpr

View file

@ -1,8 +1,8 @@
---
# Commands to start on workspace startup
tasks:
- init: yarn install
command: yarn build
- init: pnpm install
command: pnpm 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!

View file

@ -11,18 +11,18 @@ We welcome contributions of any size and skill level. As an open source project,
```shell
node: "^14.15.0 || >=16.0.0"
yarn: "^1.22.10"
pnpm: "^6.23.6"
# otherwise, your build will fail
```
### Setting up your local repo
Astro uses yarn workspaces, so you should **always run `yarn install` from the top-level project directory.** running `yarn install` in the top-level project root will install dependencies for `astro`, `docs`, and every package in the repo.
Astro uses pnpm workspaces, so you should **always run `pnpm install` from the top-level project directory.** running `pnpm install` in the top-level project root will install dependencies for `astro`, `docs`, and every package in the repo.
```shell
git clone && cd ...
yarn install
yarn build
pnpm install
pnpm run build
```
In [#2254](https://github.com/withastro/astro/pull/2254) a `.git-blame-ignore-revs` file was added to ignore repo-wide formatting changes. To improve your experience, you should run the following command locally.
@ -35,9 +35,9 @@ git config --local blame.ignoreRevsFile .git-blame-ignore-revs
```shell
# starts a file-watching, live-reloading dev script for active development
yarn dev
pnpm run dev
# build the entire project, one time.
yarn build
pnpm run build
```
#### Debugging Vite
@ -53,10 +53,10 @@ DEBUG=vite:[name] astro dev # debug specific process, e.g. "vite:deps" or "vit
```shell
# run this in the top-level project root to run all tests
yarn test
pnpm run test
# run only a few tests, great for working on a single feature
# (example - `yarn test -g "RSS"` runs `astro-rss.test.js`)
yarn test -g "$STRING_MATCH"
# (example - `pnpm run test -g "RSS"` runs `astro-rss.test.js`)
pnpm test -g "$STRING_MATCH"
```
### Other useful commands
@ -64,13 +64,13 @@ yarn test -g "$STRING_MATCH"
```shell
# auto-format the entire project
# (optional - a GitHub Action formats every commit after a PR is merged)
yarn format
pnpm run format
```
```shell
# lint the project
# (optional - our linter creates helpful warnings, but not errors.)
yarn lint
pnpm run lint
```
### Making a Pull Request
@ -78,7 +78,7 @@ yarn lint
When making a pull request, be sure to add a changeset when something has changed with Astro. Non-packages (`examples/*`, `docs/*`) do not need changesets.
```shell
yarn changeset
pnpm exec changeset
```
### Running benchmarks
@ -86,7 +86,7 @@ yarn changeset
We have benchmarks to keep performance under control. You can run these by running (from the project root):
```shell
yarn workspace astro run benchmark
pnpm run benchmark --filter=astro
```
Which will fail if the performance has regressed by **10%** or more.
@ -142,11 +142,11 @@ To release a snapshot, run the following locally:
# Note: XXX should be a keyword to identify this release. Ex: `--snapshot routing` & `--tag next--routing`
# 1:
yarn changeset version --snapshot XXX
pnpm exec changeset version --snapshot XXX
# 2: (Manual) review the diff, and make sure that you're not releasing more than you need to.
git checkout -- examples/ docs/
# 3:
yarn release --tag next--XXX
pnpm run release --tag next--XXX
# 4: (Manual) review the publish, and if you're happy then you can throw out all local changes
git reset --hard
```
@ -165,7 +165,7 @@ Full documentation: https://github.com/atlassian/changesets/blob/main/docs/prere
If you have gotten permission from the core contributors, you can enter into prerelease mode by following the following steps:
- Run: `yarn changeset pre enter next` in the project root
- Run: `pnpm exec changeset pre enter next` in the project root
- Create a new PR from the changes created by this command
- Review, approve, and more the PR to enter prerelease mode.
- If successful, The "Version Packages" PR (if one exists) will now say "Version Packages (next)".
@ -174,7 +174,7 @@ If you have gotten permission from the core contributors, you can enter into pre
Exiting prerelease mode should happen once an experimental release is ready to go from `npm install astro@next` to `npm install astro`. Only a core contributor run these steps. These steps should be run before
- Run: `yarn changeset pre exit` in the project root
- Run: `pnpm exec changeset pre exit` in the project root
- Create a new PR from the changes created by this command.
- Review, approve, and more the PR to enter prerelease mode.
- If successful, The "Version Packages (next)" PR (if one exists) will now say "Version Packages".
@ -187,9 +187,9 @@ When in prerelease mode, the automatic PR release process will no longer release
1. Create a new `release/0.X` branch, if none exists.
1. Point `release/0.X` to the latest commit for the `v0.X` version.
1. `git cherry-pick` commits from `main`, as needed.
1. Make sure that all changesets for the new release are included. You can create some manually (via `yarn changeset`) if needed.
1. Run `yarn changeset version` to create your new release.
1. Run `yarn release` to publish your new release.
1. Make sure that all changesets for the new release are included. You can create some manually (via `pnpm exec changeset`) if needed.
1. Run `pnpm exec changeset version` to create your new release.
1. Run `pnpm run release` to publish your new release.
1. Run `git push && git push --tags` to push your new release to GitHub.
1. Run `git push release/0.X:latest` to push your release branch to `latest`. This will trigger an update to the docs site, etc.
1. Go to https://github.com/withastro/astro/releases/new and create a new release. Copy the new changelog entry from https://github.com/withastro/astro/blob/latest/packages/astro/CHANGELOG.md.

View file

@ -10,9 +10,9 @@ For the RFC writing guide, check out the [RFC issue template](https://github.com
### Linting (Style Rules)
We use tools like ESLint and TypeScript to automatically enforce some parts of our style guide. Run the `yarn lint` command to lint the codebase. We also use tools like Prettier to automatically enforce code formatting. Run the `yarn format` command to format the entire codebase.
We use tools like ESLint and TypeScript to automatically enforce some parts of our style guide. Run the `pnpm run lint` command to lint the codebase. We also use tools like Prettier to automatically enforce code formatting. Run the `pnpm run format` command to format the entire codebase.
Anything enforced by linting and formatting is considered a **style rule.** It is strictly required that you follow all style rules while working in the codebase. Run the `yarn lint` and `yarn format` commands to check your code at any time.
Anything enforced by linting and formatting is considered a **style rule.** It is strictly required that you follow all style rules while working in the codebase. Run the `pnpm run lint` and `pnpm run format` commands to check your code at any time.
These style rules are maintained in configuration files, and therefore not documented in this document. Read any of the following configuration files to learn more about the style rules that we strictly enforced across the codebase:

View file

@ -11,10 +11,10 @@ Every pull request needs to be reviewed by another contributor to the documentat
- Clone the Project
`git clone git@github.com:withastro/astro.git`
- Run `yarn install` to install latest dependencies.
> This project uses yarn to manage dependencies. [Make sure that you have yarn v1 installed.](https://classic.yarnpkg.com/)
- Run `yarn workspace docs dev` to start the dev server.
- Run `yarn workspace docs build` to build the final site for production.
- Run `pnpm install` to install latest dependencies.
> This project uses pnpm to manage dependencies.
- Run `pnpm run dev --filter docs` to start the dev server.
- Run `pnpm run build --filter docs` to build the final site for production.
> The environment variable `SNOWPACK_PUBLIC_GITHUB_TOKEN` must be set to a personal access token with `public_repo` permissions to prevent rate-limiting.
## Deploying

View file

@ -8,10 +8,10 @@
"build": "astro build",
"preview": "astro preview",
"lint": "run-p --aggregate-output lint:linkcheck",
"lint:a11y": "start-test 'yarn build && yarn preview' 3000 'yarn lint:a11y:local'",
"lint:a11y": "start-test 'pnpm run build && pnpm run preview' 3000 'pnpm run lint:a11y:local'",
"lint:a11y:local": "pa11y-ci --sitemap 'http://localhost:3000/sitemap.xml' --sitemap-find 'https://docs.astro.build' --sitemap-replace 'http://localhost:3000'",
"lint:a11y:remote": "pa11y-ci --sitemap 'https://docs.astro.build/sitemap.xml'",
"lint:linkcheck": "start-test 'yarn dev --silent' 3000 'yarn lint:linkcheck:local'",
"lint:linkcheck": "start-test 'pnpm run dev --silent' 3000 'pnpm run lint:linkcheck:local'",
"lint:linkcheck:local": "blc -roe --user-agent 'broken-link-checker/0.7.8' 'http://localhost:3000/en/getting-started'",
"lint:linkcheck:remote": "blc -ro --user-agent 'broken-link-checker/0.7.8' 'https://docs.astro.build/'"
},

View file

@ -7,7 +7,7 @@
"url": "https://github.com/withastro/astro.git"
},
"scripts": {
"release": "yarn build && changeset publish",
"release": "pnpm run build && changeset publish",
"build": "turbo run build --no-deps --scope=astro --scope=create-astro --scope=\"@astrojs/*\"",
"build:examples": "turbo run build --scope=docs --scope=\"@example/*\"",
"dev": "turbo run dev --no-deps --no-cache --parallel --scope=astro --scope=create-astro --scope=\"@astrojs/*\"",
@ -65,8 +65,7 @@
],
"volta": {
"node": "14.17.0",
"npm": "7.11.2",
"yarn": "1.22.10"
"npm": "7.11.2"
},
"devDependencies": {
"@changesets/changelog-github": "^0.4.2",

View file

@ -17,7 +17,7 @@
"dist"
],
"scripts": {
"prepublish": "yarn build",
"prepublish": "pnpm run build",
"build": "astro-scripts build \"src/**/*.ts\" && tsc -p tsconfig.json",
"dev": "astro-scripts dev \"src/**/*.ts\""
},

View file

@ -20,7 +20,7 @@
"scripts": {
"build": "astro-scripts build \"src/**/*.ts\" && tsc",
"dev": "astro-scripts dev \"src/**/*.ts\"",
"prepare": "yarn build",
"prepare": "pnpm run build",
"test": "rm -rf test/fixtures && mkdir test/fixtures && node --unhandled-rejections=strict test/create-astro.test.js"
},
"files": [
@ -38,7 +38,8 @@
"yargs-parser": "^21.0.0"
},
"devDependencies": {
"uvu": "^0.5.1"
"uvu": "^0.5.1",
"astro-scripts": "0.0.1"
},
"engines": {
"node": "^14.15.0 || >=16.0.0"

View file

@ -111,7 +111,7 @@ async function testAll() {
await execa('../../create-astro.mjs', [template, '--template', template, '--commit', GITHUB_SHA, '--force-overwrite'], {
cwd: FIXTURES_DIR,
});
// setup: `npm install` (note: running multiple `yarn`s in parallel in CI will conflict)
// setup: `npm install` (note: running multiple `pnpm`s in parallel in CI will conflict)
await execa('npm', ['install', '--no-package-lock', '--silent'], { cwd: path.join(FIXTURES_DIR, template) });
})
);

View file

@ -16,7 +16,7 @@
".": "./dist/index.js"
},
"scripts": {
"prepublish": "yarn build",
"prepublish": "pnpm run build",
"build": "astro-scripts build \"src/**/*.ts\" && tsc -p tsconfig.json",
"postbuild": "astro-scripts copy \"src/**/*.js\"",
"dev": "astro-scripts dev \"src/**/*.ts\""
@ -44,6 +44,7 @@
},
"devDependencies": {
"@types/github-slugger": "^1.3.0",
"@types/prismjs": "^1.16.6"
"@types/prismjs": "^1.16.6",
"astro-scripts": "0.0.1"
}
}

10696
pnpm-lock.yaml Normal file

File diff suppressed because it is too large Load diff

13
pnpm-workspace.yaml Normal file
View file

@ -0,0 +1,13 @@
packages:
- "compiled/*"
- "packages/markdown/*"
- "packages/renderers/*"
- "packages/*"
- "examples/*"
- "examples/component/demo"
- "examples/component/packages/*"
- "scripts"
- "docs"
- "packages/astro/test/fixtures/builtins/packages/*"
- "packages/astro/test/fixtures/builtins-polyfillnode"
- "packages/astro/test/fixtures/custom-elements/my-component-lib"

View file

@ -19,7 +19,7 @@ export default async function run() {
const filePath = fileURLToPath(projectToTest);
console.log(' 🤖 Testing', filePath, '\n');
try {
await execa('yarn', ['build'], { cwd: fileURLToPath(projectToTest), stdout: 'inherit', stderr: 'inherit' });
await execa('pnpm', ['run', 'build'], { cwd: fileURLToPath(projectToTest), stdout: 'inherit', stderr: 'inherit' });
} catch (err) {
console.log(err);
process.exit(1);

10175
yarn.lock

File diff suppressed because it is too large Load diff