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

feat: add pnpm binary - use pnpm for bootstrapping #9

Merged
merged 9 commits into from
Jun 22, 2022
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
57 changes: 41 additions & 16 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,26 @@ jobs:
os:
- ubuntu-latest
- macos-latest
- windows-2019
node_version:
- 12
- 12.18.3
- 14
node_arch:
arch:
- x64
pnpm:
- 6
include:
- os: windows-2019
node_version: 12
node_arch: x64
- os: windows-2016
node_version: 12
node_arch: x86
node_version: 12.18.3
arch: x86
pnpm: 6
- os: windows-2019
node_version: 14
arch: x86
pnpm: 6
env:
arch: ${{ matrix.arch }}
npm_config_arch: ${{ matrix.arch }}
steps:
- uses: actions/checkout@v3

Expand All @@ -35,30 +43,42 @@ jobs:
uses: actions/cache@v3
with:
path: |
~/.pnpm-store
D:\.pnpm-store
./node_modules/
~/npm-cache
~/.pnpm-store
D:\.pnpm-store
./bin/node
./bin/node.exe
key: "cache-OS:${{ matrix.os }}-${{ matrix.node_arch }}-node:${{ matrix.node_version }}-${{ hashFiles('./package.json') }}-${{ hashFiles('./.npmrc') }}"
key: "cache-OS:${{ matrix.os }}-${{ matrix.arch }}-pnpm:${{ matrix.pnpm }}-node:${{ matrix.node_version }}-${{ hashFiles('./package.json') }}-${{ hashFiles('./.npmrc') }}"

- name: Install Node
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node_version }}
architecture: ${{ matrix.node_arch }}
architecture: ${{ matrix.arch }}

- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: ${{ matrix.pnpm }}

- uses: actions/setup-python@v4
with:
python-version: "3.x"
architecture: ${{ matrix.arch }}

- name: Install dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: npm install
run: pnpm install

- name: Build
if: steps.cache.outputs.cache-hit == 'true'
run: npm run prepare
run: pnpm run prepare

- name: Run tests
run: ./bin/npm test
run: ./bin/pnpm test

Lint:
if: "!contains(github.event.head_commit.message, '[skip ci]')"
Expand All @@ -72,13 +92,18 @@ jobs:
- name: Commit lint ✨
uses: wagoid/commitlint-github-action@v5

- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 6

- name: Install dependencies
run: |
npm install --ignore-scripts # native modules are not used here
npm run prepare
pnpm install --ignore-scripts
pnpm run prepare

- name: Format ✨
run: npm run test.format
run: pnpm run test.format

- name: Lint ✨
run: npm run test.lint
run: pnpm run test.lint
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ Thumbs.db
# Node
node_modules
npm-debug.log
pnpm-lock.yaml
package-lock.json

# TypeScript
Expand Down
5 changes: 4 additions & 1 deletion .npmrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
target=v12.18.3
node-version=12.18.3
use-node-version=12.18.3
public-hoist-pattern[]=*
package-lock=false
lockfile=false
lockfile=true
prefer-frozen-lockfile=true
child-concurrency=1 # node-gyp fails on windows
8 changes: 8 additions & 0 deletions bin/pnpm
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
export PATH="$SCRIPT_DIR:$PATH"

# Force npm to use its builtin node-gyp
unset npm_config_node_gyp

"$SCRIPT_DIR"/../node_modules/.bin/pnpm $@
9 changes: 9 additions & 0 deletions bin/pnpm.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
@echo off
setlocal EnableDelayedExpansion

set "PATH=%~dp0;%PATH%"

:: Force npm to use its builtin node-gyp
set npm_config_node_gyp=

"%~dp0\..\node_modules\.bin\pnpm.cmd" %*
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@
"jasmine-focused": ">=1.0.7 <2.0",
"node-downloader-helper": "^2.0.0",
"node-gyp": "^9.0.0",
"pnpm": "^6.12.1",
"prettier": "^2.7.1",
"prettier-config-atomic": "^3.0.10",
"shx": "^0.3.3"
}
Expand Down
Loading