Skip to content

Commit

Permalink
chore: migrate to pnpm with workspace: protocol (#1133)
Browse files Browse the repository at this point in the history
* chore: migrate to pnpm with workspace: protocol
- npm workspaces doesn't support `workspace:` and because of that, I think that it doesn't use local code like pnpm does
  • Loading branch information
ghiscoding authored Dec 21, 2023
1 parent 57c9fb6 commit aa531f3
Show file tree
Hide file tree
Showing 13 changed files with 10,876 additions and 22,408 deletions.
43 changes: 25 additions & 18 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,32 +30,42 @@ jobs:
with:
fetch-depth: 3

- name: Set Node.js version
- name: Set NodeJS
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}

- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8
run_install: false

- run: node --version
- run: npm --version
- run: pnpm --version

- name: Get npm cache directory
id: npm-cache-dir
- name: Get pnpm store directory
shell: bash
run: echo "dir=$(npm config get cache)" >> ${GITHUB_OUTPUT}
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v3
id: npm-cache # use this to check for `cache-hit` ==> if: steps.npm-cache.outputs.cache-hit != 'true'
- name: Setup pnpm cache
uses: actions/cache@v3
with:
path: ${{ steps.npm-cache-dir.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-node-
${{ runner.os }}-pnpm-store-
- name: Run npm install dependencies
run: npm ci
- name: Run pnpm install dependencies
run: pnpm install

- name: Build Plugin
run: pnpm build

- name: Run Jest unit tests
run: npm run test:ci
if: ${{ !contains(github.event.head_commit.message, 'chore(release)') }}
run: pnpm test:ci

- name: Upload Jest coverage to Codecov
if: ${{ !contains(github.event.head_commit.message, format('chore{0} release', ':')) }}
Expand All @@ -65,18 +75,15 @@ jobs:
directory: test/jest-coverage
verbose: true

- name: Build
run: npm run build

- name: Website Dev Build (served for Cypress)
run: npm run build:demo
run: pnpm build:demo

- name: Run Cypress E2E tests
uses: cypress-io/github-action@v6
with:
install: false
# working-directory: packages/dnd
start: npm start
start: pnpm start
wait-on: "http://localhost:9000"
config-file: test/cypress.config.ts
browser: chrome
Expand Down
44 changes: 23 additions & 21 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,21 +41,28 @@ jobs:
registry-url: 'https://registry.npmjs.org/'
node-version: 20

- name: Get npm cache directory
id: npm-cache-dir
shell: bash
run: echo "dir=$(npm config get cache)" >> ${GITHUB_OUTPUT}
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8
run_install: false

- name: Get pnpm store directory
run: echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV

- uses: actions/cache@v3
id: npm-cache # use this to check for `cache-hit` ==> if: steps.npm-cache.outputs.cache-hit != 'true'
- name: Setup pnpm cache
uses: actions/cache@v3
with:
path: ${{ steps.npm-cache-dir.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-node-
${{ runner.os }}-pnpm-store-
- name: Run npm install dependencies
run: npm ci
- name: Run pnpm install dependencies
run: pnpm install

- name: Build Library
run: pnpm build

- name: 🧪 Dry-Run - GitHub Release
if: ${{ inputs.dryrun == true }}
Expand All @@ -66,9 +73,9 @@ jobs:
run: |
git config --global user.name "${{ github.actor }}"
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
npm whoami
pnpm whoami
cd packages/aurelia-slickgrid
npx release-it --ci --dry-run
pnpm exec release-it --ci --dry-run
- name: OTP
if: ${{ inputs.dryrun != true }}
Expand All @@ -89,13 +96,13 @@ jobs:
run: |
git config --global user.name "${{ github.actor }}"
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
npm whoami
pnpm whoami
cd packages/aurelia-slickgrid
npx release-it --ci --npm.otp=${{ steps.wait-for-secrets.outputs.OTP }}
pnpm exec release-it --ci --npm.otp=${{ steps.wait-for-secrets.outputs.OTP }}
- name: Website Dev Build (served for Cypress)
if: ${{ inputs.dryrun != true }}
run: npm run build:demo
run: pnpm build:demo

# deploy (re-publish) GitHub demo page with a Prod build but only when merging to "master" branch
# and the commit message contains the text "chore: release"
Expand All @@ -105,8 +112,3 @@ jobs:
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./packages/demo/website

- name: Update NPM lock file
run: |
npm i
git commit -a -m "chore: release update npm lock file"
2 changes: 2 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
enable-pre-post-scripts=true
registry=https://registry.npmjs.org/
Loading

0 comments on commit aa531f3

Please sign in to comment.