Skip to content

Commit

Permalink
feat: add pnpm binary and use pnpm for bootstrapping
Browse files Browse the repository at this point in the history
  • Loading branch information
aminya committed Jul 23, 2021
1 parent 0f7c3ed commit d260adb
Show file tree
Hide file tree
Showing 10 changed files with 4,887 additions and 11 deletions.
30 changes: 23 additions & 7 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,17 @@ jobs:
- 14
node_arch:
- x64
pnpm:
- 6
include:
- os: windows-latest
node_version: 12
node_arch: x64
pnpm: 6
- os: windows-2016
node_version: 12
node_arch: x86
pnpm: 6
steps:
- uses: actions/checkout@v2

Expand All @@ -35,30 +39,37 @@ jobs:
uses: actions/cache@v2
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('BUNDLED_NODE_VERSION') }}"
key: "cache-OS:${{ matrix.os }}-${{ matrix.node_arch }}-pnpm:${{ matrix.pnpm }}-node:${{ matrix.node_version }}-${{ hashFiles('./package.json') }}-${{ hashFiles('BUNDLED_NODE_VERSION') }}"

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

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

- 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 run test
if: "!contains(matrix.os, 'windows')" # TODO

Lint:
Expand All @@ -73,11 +84,16 @@ jobs:
- name: Commit lint ✨
uses: wagoid/commitlint-github-action@v2

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

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

- 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
2 changes: 1 addition & 1 deletion .npmrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
public-hoist-pattern[]=*
package-lock=false
lockfile=false
lockfile=true
prefer-frozen-lockfile=true
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" %*
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
"jasmine-focused": ">=1.0.7 <2.0",
"node-downloader-helper": "^1.0.18",
"node-gyp": "^5.1.1",
"pnpm": "^6.10.3",
"prettier-config-atomic": "^2.1.0",
"shx": "^0.3.3"
},
Expand Down
Loading

0 comments on commit d260adb

Please sign in to comment.