Skip to content

Commit

Permalink
chore(infra): migrate to pnpm (#428)
Browse files Browse the repository at this point in the history
  • Loading branch information
sean-perkins authored May 14, 2024
1 parent f8a1cde commit 3579f6d
Show file tree
Hide file tree
Showing 48 changed files with 23,068 additions and 85,471 deletions.
12 changes: 8 additions & 4 deletions .github/workflows/actions/publish-npm/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,23 @@ inputs:
runs:
using: 'composite'
steps:
- uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1
- uses: pnpm/action-setup@a3252b78c470c02df07e9d59298aecedc3ccdd6d # v3.0.0
with:
node-version-file: './package.json'
version: 8
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version: '20.10.0'
cache: 'pnpm'
- name: Install Dependencies
run: npx lerna bootstrap --include-dependencies --scope ${{ inputs.scope }} --ignore-scripts -- --legacy-peer-deps
run: pnpm --filter ${{ inputs.scope }} install
shell: bash
working-directory: ${{ inputs.working-directory }}
- name: Update Version
run: npx lerna version ${{ inputs.version }} --yes --exact --no-changelog --no-git-tag-version --preid=${{ inputs.preid }}
shell: bash
working-directory: ${{ inputs.working-directory }}
- name: Run Build
run: npm run build
run: pnpm run build
shell: bash
working-directory: ${{ inputs.working-directory }}
- name: Prepare NPM Token
Expand Down
28 changes: 9 additions & 19 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,33 +21,23 @@ jobs:
steps:
- name: Checkout Code
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1
- uses: pnpm/action-setup@a3252b78c470c02df07e9d59298aecedc3ccdd6d # v3.0.0
with:
node-version-file: './package.json'
- name: Restore Dependency Cache
uses: actions/cache@e12d46a63a90f2fae62d114769bbf2a179198b5c # v3.3.3
env:
cache-name: cache-node-modules
version: 8
- name: Use Node
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
node-version: '20.10.0'
cache: 'pnpm'

- name: Install Dependencies
run: npm ci

- name: Setup Testing Environment
run: npm run bootstrap
run: pnpm install

- name: Build
run: npm run build
run: pnpm run build

- name: Test
run: npm test
run: pnpm test
format:
name: Format
uses: ./.github/workflows/format.yml
13 changes: 7 additions & 6 deletions .github/workflows/dev-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@ jobs:
steps:
- name: Checkout Code
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1
- uses: pnpm/action-setup@a3252b78c470c02df07e9d59298aecedc3ccdd6d # v3.0.0
with:
node-version-file: './package.json'
- name: Install root dependencies
run: npm ci
shell: bash
version: 8
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version: '20.10.0'
cache: 'pnpm'
- name: Install Dependencies
run: npx lerna bootstrap --ignore-scripts -- --legacy-peer-deps
run: pnpm install
shell: bash
- name: Prepare NPM Token
run: echo //registry.npmjs.org/:_authToken=${NPM_TOKEN} > .npmrc
Expand Down
14 changes: 8 additions & 6 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,19 @@ jobs:
steps:
- name: Checkout Code
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- uses: pnpm/action-setup@a3252b78c470c02df07e9d59298aecedc3ccdd6d # v3.0.0
with:
version: 8
- name: Use Node
uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version-file: './package.json'
cache: 'npm'
node-version: '20.10.0'
cache: 'pnpm'

- name: Install Dependencies
run: npm ci
run: pnpm install
shell: bash

- name: Prettier Check
run: npm run prettier.dry-run
run: pnpm run prettier.dry-run
shell: bash
17 changes: 9 additions & 8 deletions .github/workflows/prod-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,15 @@ jobs:
version: ${{ steps.prod-build.outputs.version }}
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1
- uses: pnpm/action-setup@a3252b78c470c02df07e9d59298aecedc3ccdd6d # v3.0.0
with:
node-version-file: './package.json'
- name: Install root dependencies
run: npm ci
shell: bash
version: 8
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version: '20.10.0'
cache: 'pnpm'
- name: Install Dependencies
run: npx lerna bootstrap --ignore-scripts -- --legacy-peer-deps
run: pnpm install
shell: bash
- name: Prepare NPM Token
run: echo //registry.npmjs.org/:_authToken=${NPM_TOKEN} > .npmrc
Expand All @@ -67,9 +68,9 @@ jobs:
version: ${{ inputs.version }} # "patch", "minor", "major", "prepatch", "preminor", "premajor", "prerelease"
tag: ${{ inputs.tag }} # "latest" or "next"
preid: ${{ inputs.preid }} # Only needed when version is "prepatch", "preminor", "premajor", or "prerelease"
scope: "@stencil/${{ inputs.package }}-output-target"
scope: '@stencil/${{ inputs.package }}-output-target'
# Look at package.json's name
# Coupled to project structure. Update this when adding a new output target.
# Examples: vue-output-target, angular-output-target, react-output-target
working-directory: "./packages/${{ inputs.package }}-output-target" # Follow the repo structure
working-directory: './packages/${{ inputs.package }}-output-target' # Follow the repo structure
token: ${{ secrets.NPM_TOKEN }} # Private, accessible by team leads
20 changes: 15 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,29 +22,39 @@ At this time, only new issues & pull requests that support the Ionic Framework w

# Local development

This project uses [pnpm](https://pnpm.io/) for package management. You can install it by following the [installation instructions](https://pnpm.io/installation).

## Getting started

To set up this project and prepare the example project to be used in your own projects run the following commands.

```bash
npm install
npm run bootstrap
npm run build
pnpm install
pnpm build
```

This will generate all necessary builds in the example projects. You can then either publish the packages to npm or a private package manager, or use `npm pack` to start using the builds in a local project for testing purposes where you manually place the package in the project `node_modules` folder.

For example, if you have an Angular project, run `npm pack` in `packages/example-project/component-library` and `packages/example-project/component-library-angular`. Since the framework component libraries depend on the Stencil project, you will need to provide the `component-library` package in your project `node_modules` folder.

### Node Versions
## Formatting

This project uses [Prettier](https://prettier.io/) for code formatting. You can run the following command to format the code:

This project uses [Volta](https://volta.sh/) to automatically manage what npm and node versions are used when developing. If you don't use Volta, don't worry about it... just check the root `package.json` for what version of node and npm is currently being used.
```bash
pnpm prettier
```

### Node.js Versions

This project requires Node.js v20.10.0 or higher.

## Deploying

There is a manual workflow task called "Production Release" within the GitHub Actions workflows directory. We currently do not release all packages that have been changed at once. You will need to deploy each package (vue, react, angular) individually.

You'll need to fill out a few bits of information when you submit the deploy workflow:

1. Which package should be published (Currently `vue`, `react`, or `angular`).
2. What version should be published.
3. What npm tag it should be published under (`next` or `latest`)
Expand Down
Loading

0 comments on commit 3579f6d

Please sign in to comment.