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

build: use pnpm instead of npm #355

Merged
merged 2 commits into from
Jan 18, 2024
Merged
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
68 changes: 42 additions & 26 deletions .github/workflows/continuous-deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,58 +8,74 @@ on:

jobs:
continuous-integration:
name: Continuous integration
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Download code from GitHub
uses: actions/checkout@v4.1.1

- name: Install pnpm package manager
uses: pnpm/action-setup@v2.4.0
with:
version: 8.14.1

- name: Set up Node.js version
uses: actions/setup-node@v3.1.0
uses: actions/setup-node@v4.0.1
with:
node-version: "18"
node-version-file: .nvmrc
cache: pnpm

- name: Install
- name: Install dependencies specified in package.json
run: |
npm ci
npm ls
pnpm install
pnpm ls --recursive

- name: "Continuous Integration: lint"
- name: Run the lint script in package.json scripts
run: |
npm run lint --if-present
pnpm run --if-present lint

- name: "Continuous Integration: build"
- name: Run the build script in package.json scripts
run: |
npm run build --if-present
pnpm run --if-present build

- name: "Continuous Integration: test"
- name: Run the test script in package.json scripts
run: |
npm run test --if-present
pnpm run --if-present test

publish-npm:
name: Publish to npm
runs-on: ubuntu-latest
needs: continuous-integration
if: github.ref == 'refs/heads/main'

steps:
- uses: actions/checkout@v3
- name: Download code from GitHub
uses: actions/checkout@v4.1.1
with:
token: ${{ secrets.GH_REPO_TOKEN }}

- name: Install pnpm package manager
uses: pnpm/action-setup@v2.4.0
with:
version: 8.14.1

- name: Set up Node.js version
uses: actions/setup-node@v3.1.0
uses: actions/setup-node@v4.0.1
with:
node-version: "18"
node-version-file: .nvmrc
cache: pnpm

- name: "Continuous Deployment: install"
- name: Install dependencies as specified in package.json
run: |
npm ci
npm ls
pnpm install
pnpm ls --recursive

- name: "Continuous Deployment: build"
- name: Run the build script in package.json scripts
run: |
npm run build --if-present
pnpm run --if-present build

- name: "Continuous Deployment: publish to GitHub repository"
- name: Publish to GitHub repository
env:
GITHUB_TOKEN: ${{ secrets.GH_REPO_TOKEN }}
GIT_AUTHOR_EMAIL: ${{ secrets.GIT_AUTHOR_EMAIL }}
Expand All @@ -68,12 +84,12 @@ jobs:
GIT_COMMITTER_NAME: "NL Design System"
run: |
git push --set-upstream origin HEAD
npm run release -- --yes
pnpm run release -- --yes

- name: "Continuous Deployment: publish to npm"
- name: Publish to npm repository
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
npm config set "//registry.npmjs.org/:_authToken" "${NPM_TOKEN}"
npm run publish -- --no-verify-access --yes
npm config delete "//registry.npmjs.org/:_authToken"
pnpm config set "//registry.npmjs.org/:_authToken" "${NPM_TOKEN}"
pnpm run publish -- --no-verify-access --yes
pnpm config delete "//registry.npmjs.org/:_authToken"
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
# Ignore 3rd party files
node_modules/
vendor/

# prevent accidentally committing files generated by a package manager other than pnpm
package-lock.json
yarn.lock
.yarn/
.npm/

# Ignore generated files
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v18
20
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ CHANGELOG.md
# Snyk) automatically use the correct indentation.
package-lock.json
yarn.lock
pnpm-lock.yaml
3 changes: 1 addition & 2 deletions lerna.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"npmClient": "npm",
"npmClient": "pnpm",
"version": "independent",
"useWorkspaces": true,
"command": {
"publish": {},
"version": {
Expand Down
Loading