Skip to content

Commit

Permalink
Use pnpm (#1578)
Browse files Browse the repository at this point in the history
  • Loading branch information
scott-rc authored Jul 25, 2024
1 parent 7a64bd8 commit 44080dc
Show file tree
Hide file tree
Showing 10 changed files with 9,292 additions and 28,445 deletions.
14 changes: 8 additions & 6 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,26 @@ jobs:
fetch-depth: 0
persist-credentials: false

- name: Setup pnpm
uses: pnpm/action-setup@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18
cache: npm
cache: pnpm

- name: Install dependencies
run: npm ci
run: pnpm install

- name: Create release PR or publish to NPM
uses: changesets/action@v1
id: changesets
with:
title: Release
commit: Release
version: npm run version
publish: npm run release
version: pnpm run version
publish: pnpm run release
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
Expand All @@ -47,8 +50,7 @@ jobs:
run: |
jq '.name = "@gadgetinc/ggt"' package.json > package.json.tmp
mv package.json.tmp package.json
npm install --package-lock-only
npm run release
pnpm run release
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
Expand Down
34 changes: 24 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,37 +11,48 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup pnpm
uses: pnpm/action-setup@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18
cache: npm
cache: pnpm

- name: Install dependencies
run: npm ci
run: pnpm install

- name: Run lint
run: npm run lint
run: pnpm run lint

build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup pnpm
uses: pnpm/action-setup@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18
cache: npm
cache: pnpm

- name: Install dependencies
run: npm ci
run: pnpm install

- name: Run build
run: |
npm run build
npm install --omit=dev # remove dev dependencies to mimic a user installing the package
pnpm run build
# remove dev dependencies to mimic a user installing the package
rm -rf node_modules
pnpm install --prod
# ensure we can run it
dist/main.js
test:
Expand All @@ -53,17 +64,20 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup pnpm
uses: pnpm/action-setup@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18
cache: npm
cache: pnpm

- name: Install dependencies
run: npm ci
run: pnpm install

- name: Run tests
run: npm run test
run: pnpm run test

dependabot:
needs: [lint, build, test]
Expand Down
2 changes: 1 addition & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ __generated__
dist
tmp/*
!tmp/apps
npm-shrinkwrap.json
pnpm-lock.yaml
.direnv
2 changes: 1 addition & 1 deletion cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"flake.lock",
"flake.nix",
"node_modules",
"npm-shrinkwrap.json",
"pnpm-lock.yaml",
"tmp"
]
}
1 change: 1 addition & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
in
{
packages = {
corepack = pkgs.corepack;
direnv = pkgs.direnv;
git = pkgs.git;
mkcert = pkgs.mkcert;
Expand Down
Loading

0 comments on commit 44080dc

Please sign in to comment.