5 Commits

Author SHA1 Message Date
0e9c99a89a rename PNPM_HOME to PNPM_HOME_PATH 2022-02-07 23:01:43 +02:00
9087a16275 rebundle 2022-02-07 22:54:57 +02:00
9c583927b0 fix: update deps 2022-02-07 22:49:02 +02:00
43a416008e fix: add PNPM_HOME env variable 2022-02-07 03:33:01 +02:00
eb99e9e4c7 fix: add pnpm to PATH 2022-02-07 03:26:03 +02:00
18 changed files with 214 additions and 268297 deletions

14
.github/FUNDING.yml vendored
View File

@ -1,2 +1,12 @@
custom: # These are supported funding model platforms
- https://opencollective.com/pnpm
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: khai96_
open_collective: # Collective unavailable
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # disabled
otechie: # Replace with a single Otechie username
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']

View File

@ -5,3 +5,6 @@ updates:
schedule: schedule:
interval: weekly interval: weekly
open-pull-requests-limit: 10 open-pull-requests-limit: 10
labels:
- dependabot
- github-actions

View File

@ -22,7 +22,7 @@ jobs:
- windows-latest - windows-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v2
- name: Run the action - name: Run the action
uses: ./ uses: ./
@ -51,7 +51,7 @@ jobs:
- windows-latest - windows-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v2
- name: Run the action - name: Run the action
uses: ./ uses: ./
@ -107,7 +107,7 @@ jobs:
- pnpm - pnpm
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v2
- name: Run the action - name: Run the action
uses: ./ uses: ./

1
.gitignore vendored
View File

@ -2,7 +2,6 @@ node_modules
*.log *.log
/dist/* /dist/*
!/dist/index.js !/dist/index.js
!/dist/pnpm.js
tmp tmp
temp temp
*.tmp *.tmp

View File

@ -6,11 +6,7 @@ Install pnpm package manager.
### `version` ### `version`
Version of pnpm to install. **Required** Version of pnpm to install. It supports npm versioning scheme, it could be an exact version (such as `6.24.1`), or a version range (such as `6`, `6.x.x`, `6.24.x`, `^6.24.1`, `*`, etc.), or `latest`.
**Optional** when there is a [`packageManager` field in the `package.json`](https://nodejs.org/api/corepack.html).
otherwise, this field is **required** It supports npm versioning scheme, it could be an exact version (such as `6.24.1`), or a version range (such as `6`, `6.x.x`, `6.24.x`, `^6.24.1`, `*`, etc.), or `latest`.
### `dest` ### `dest`
@ -38,10 +34,6 @@ If `run_install` is a YAML string representation of either an object or an array
**Optional** (_type:_ `string[]`) Additional arguments after `pnpm [recursive] install`, e.g. `[--frozen-lockfile, --strict-peer-dependencies]`. **Optional** (_type:_ `string[]`) Additional arguments after `pnpm [recursive] install`, e.g. `[--frozen-lockfile, --strict-peer-dependencies]`.
### `package_json_file`
**Optional** File path to the `package.json` to read "packageManager" configutation. If not specified, `package.json` in the project root directory is used.
## Outputs ## Outputs
### `dest` ### `dest`
@ -62,13 +54,12 @@ on:
- pull_request - pull_request
jobs: jobs:
install: runs-on: ubuntu-latest
runs-on: ubuntu-latest
steps: steps:
- uses: pnpm/action-setup@v2 - uses: pnpm/action-setup@v2.0.1
with: with:
version: 8 version: 6.0.2
``` ```
### Install pnpm and a few npm packages ### Install pnpm and a few npm packages
@ -79,19 +70,18 @@ on:
- pull_request - pull_request
jobs: jobs:
install: runs-on: ubuntu-latest
runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v2
- uses: pnpm/action-setup@v2 - uses: pnpm/action-setup@v2.0.1
with: with:
version: 8 version: 6.0.2
run_install: | run_install: |
- recursive: true - recursive: true
args: [--frozen-lockfile, --strict-peer-dependencies] args: [--frozen-lockfile, --strict-peer-dependencies]
- args: [--global, gulp, prettier, typescript] - args: [--global, gulp, prettier, typescript]
``` ```
### Use cache to reduce installation time ### Use cache to reduce installation time
@ -102,39 +92,24 @@ on:
- pull_request - pull_request
jobs: jobs:
cache-and-install: runs-on: ubuntu-latest
runs-on: ubuntu-latest
steps: steps:
- name: Checkout build:
uses: actions/checkout@v3 - uses: actions/checkout@v2
- name: Install Node.js - name: Cache pnpm modules
uses: actions/setup-node@v3 uses: actions/cache@v2
with: with:
node-version: 16 path: ~/.pnpm-store
key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}
- uses: pnpm/action-setup@v2
name: Install pnpm
with:
version: 7
run_install: false
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: | restore-keys: |
${{ runner.os }}-pnpm-store- ${{ runner.os }}-
- name: Install dependencies - uses: pnpm/action-setup@v2.0.1
run: pnpm install with:
version: 6.0.2
run_install: true
``` ```
**Note:** You don't need to run `pnpm store prune` at the end; post-action has already taken care of that. **Note:** You don't need to run `pnpm store prune` at the end; post-action has already taken care of that.

View File

@ -1,25 +1,21 @@
name: Setup pnpm name: Setup PNPM
description: Install pnpm package manager description: Install PNPM package manager
branding: branding:
icon: package icon: package
color: orange color: orange
inputs: inputs:
version: version:
description: Version of pnpm to install description: Version of PNPM to install
required: false required: true
dest: dest:
description: Where to store pnpm files description: Where to store PNPM files
required: false required: false
default: ~/setup-pnpm default: ~/setup-pnpm
run_install: run_install:
description: If specified, run `pnpm install` description: If specified, run `pnpm install`
required: false required: false
default: 'null' default: 'null'
package_json_file:
description: File path to the package.json to read "packageManager" configutation
required: false
default: 'package.json'
runs: runs:
using: node16 using: node12
main: dist/index.js main: dist/index.js
post: dist/index.js post: dist/index.js

11
dist/index.js vendored

File diff suppressed because one or more lines are too long

134031
dist/pnpm.js vendored

File diff suppressed because one or more lines are too long

View File

@ -3,24 +3,25 @@
"scripts": { "scripts": {
"build:schemas": "ts-schema-autogen generate", "build:schemas": "ts-schema-autogen generate",
"build:ncc": "ncc build --minify --no-source-map-register --no-cache dist/tsc/index.js --out dist/", "build:ncc": "ncc build --minify --no-source-map-register --no-cache dist/tsc/index.js --out dist/",
"build": "pnpm run build:schemas && tsc && pnpm run build:ncc && cp src/install-pnpm/pnpm.js dist/pnpm.js", "build": "pnpm run build:schemas && tsc && pnpm run build:ncc",
"start": "pnpm run build && sh ./run.sh" "start": "pnpm run build && sh ./run.sh"
}, },
"dependencies": { "dependencies": {
"@actions/core": "^1.10.0", "@actions/core": "^1.6.0",
"@types/expand-tilde": "^2.0.0", "@types/expand-tilde": "^2.0.0",
"@types/fs-extra": "^9.0.13", "@types/fs-extra": "^9.0.13",
"@types/js-yaml": "^4.0.5", "@types/js-yaml": "^4.0.5",
"@types/node": "^14.18.32", "@types/node": "^14.18.10",
"@types/node-fetch": "^2.6.2", "@types/node-fetch": "^2.5.12",
"ajv": "^6.12.6", "ajv": "^6.12.6",
"expand-tilde": "^2.0.2", "expand-tilde": "^2.0.2",
"fs-extra": "^10.1.0", "fs-extra": "^9.1.0",
"js-yaml": "^4.1.0" "js-yaml": "^4.1.0",
"node-fetch": "^2.6.7"
}, },
"devDependencies": { "devDependencies": {
"@ts-schema-autogen/cli": "^0.1.2", "@ts-schema-autogen/cli": "^0.1.2",
"@vercel/ncc": "^0.33.4", "@vercel/ncc": "^0.27.0",
"typescript": "^4.8.4" "typescript": "^4.5.5"
} }
} }

217
pnpm-lock.yaml generated
View File

@ -1,48 +1,49 @@
lockfileVersion: 5.4 lockfileVersion: 5.3
specifiers: specifiers:
'@actions/core': ^1.10.0 '@actions/core': ^1.6.0
'@ts-schema-autogen/cli': ^0.1.2 '@ts-schema-autogen/cli': ^0.1.2
'@types/expand-tilde': ^2.0.0 '@types/expand-tilde': ^2.0.0
'@types/fs-extra': ^9.0.13 '@types/fs-extra': ^9.0.13
'@types/js-yaml': ^4.0.5 '@types/js-yaml': ^4.0.5
'@types/node': ^14.18.32 '@types/node': ^14.18.10
'@types/node-fetch': ^2.6.2 '@types/node-fetch': ^2.5.12
'@vercel/ncc': ^0.33.4 '@vercel/ncc': ^0.27.0
ajv: ^6.12.6 ajv: ^6.12.6
expand-tilde: ^2.0.2 expand-tilde: ^2.0.2
fs-extra: ^10.1.0 fs-extra: ^9.1.0
js-yaml: ^4.1.0 js-yaml: ^4.1.0
typescript: ^4.8.4 node-fetch: ^2.6.7
typescript: ^4.5.5
dependencies: dependencies:
'@actions/core': 1.10.0 '@actions/core': 1.6.0
'@types/expand-tilde': 2.0.0 '@types/expand-tilde': 2.0.0
'@types/fs-extra': 9.0.13 '@types/fs-extra': 9.0.13
'@types/js-yaml': 4.0.5 '@types/js-yaml': 4.0.5
'@types/node': 14.18.32 '@types/node': 14.18.10
'@types/node-fetch': 2.6.2 '@types/node-fetch': 2.5.12
ajv: 6.12.6 ajv: 6.12.6
expand-tilde: 2.0.2 expand-tilde: 2.0.2
fs-extra: 10.1.0 fs-extra: 9.1.0
js-yaml: 4.1.0 js-yaml: 4.1.0
node-fetch: 2.6.7
devDependencies: devDependencies:
'@ts-schema-autogen/cli': 0.1.2 '@ts-schema-autogen/cli': 0.1.2
'@vercel/ncc': 0.33.4 '@vercel/ncc': 0.27.0
typescript: 4.8.4 typescript: 4.5.5
packages: packages:
/@actions/core/1.10.0: /@actions/core/1.6.0:
resolution: {integrity: sha512-2aZDDa3zrrZbP5ZYg159sNoLRb61nQ7awl5pSvIq5Qpj81vwDzdMRKzkWJGJuwVvWpvZKx7vspJALyvaaIQyug==} resolution: {integrity: sha512-NB1UAZomZlCV/LmJqkLhNTqtKfFXJZAUPcfl/zqG7EfsQdeUJtaWO98SGbuQ3pydJ3fHl2CvI/51OKYlCYYcaw==}
dependencies: dependencies:
'@actions/http-client': 2.0.1 '@actions/http-client': 1.0.11
uuid: 8.3.2
dev: false dev: false
/@actions/http-client/2.0.1: /@actions/http-client/1.0.11:
resolution: {integrity: sha512-PIXiMVtz6VvyaRsGY268qvj57hXQEpsYogYOu2nrQhlf+XCGmZstmuZBbAybUl1nQGnvS1k1eEsQ69ZoD7xlSw==} resolution: {integrity: sha512-VRYHGQV1rqnROJqdMvGUbY/Kn8vriQe/F9HR2AlYHzmKuM/p3kjNuXhmdBfcVgsvRWTz5C5XW5xvndZrVBuAYg==}
dependencies: dependencies:
tunnel: 0.0.6 tunnel: 0.0.6
dev: false dev: false
@ -194,13 +195,13 @@ packages:
/@types/fs-extra/8.1.2: /@types/fs-extra/8.1.2:
resolution: {integrity: sha512-SvSrYXfWSc7R4eqnOzbQF4TZmfpNSM9FrSWLU3EUnWBuyZqNBOrv1B1JA3byUDPUl9z4Ab3jeZG2eDdySlgNMg==} resolution: {integrity: sha512-SvSrYXfWSc7R4eqnOzbQF4TZmfpNSM9FrSWLU3EUnWBuyZqNBOrv1B1JA3byUDPUl9z4Ab3jeZG2eDdySlgNMg==}
dependencies: dependencies:
'@types/node': 14.18.32 '@types/node': 14.18.10
dev: true dev: true
/@types/fs-extra/9.0.13: /@types/fs-extra/9.0.13:
resolution: {integrity: sha512-nEnwB++1u5lVDM2UI4c1+5R+FYaKfaAzS4OococimjVm3nQw3TuzH5UNsocrcTBbhnerblyHj4A49qXbIiZdpA==} resolution: {integrity: sha512-nEnwB++1u5lVDM2UI4c1+5R+FYaKfaAzS4OococimjVm3nQw3TuzH5UNsocrcTBbhnerblyHj4A49qXbIiZdpA==}
dependencies: dependencies:
'@types/node': 14.18.32 '@types/node': 14.18.10
dev: false dev: false
/@types/js-yaml/3.12.7: /@types/js-yaml/3.12.7:
@ -211,14 +212,14 @@ packages:
resolution: {integrity: sha512-FhpRzf927MNQdRZP0J5DLIdTXhjLYzeUTmLAu69mnVksLH9CJY3IuSeEgbKUki7GQZm0WqDkGzyxju2EZGD2wA==} resolution: {integrity: sha512-FhpRzf927MNQdRZP0J5DLIdTXhjLYzeUTmLAu69mnVksLH9CJY3IuSeEgbKUki7GQZm0WqDkGzyxju2EZGD2wA==}
dev: false dev: false
/@types/json-schema/7.0.11: /@types/json-schema/7.0.9:
resolution: {integrity: sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==} resolution: {integrity: sha512-qcUXuemtEu+E5wZSJHNxUXeCZhAfXKQ41D+duX+VYPde7xyEVZci+/oXKJL13tnRs9lR2pr4fod59GT6/X1/yQ==}
dev: true dev: true
/@types/node-fetch/2.6.2: /@types/node-fetch/2.5.12:
resolution: {integrity: sha512-DHqhlq5jeESLy19TYhLakJ07kNumXWjcDdxXsLUMJZ6ue8VZJj4kLPQVE/2mdHh3xZziNF1xppu5lwmS53HR+A==} resolution: {integrity: sha512-MKgC4dlq4kKNa/mYrwpKfzQMB5X3ee5U6fSprkKpToBqBmX4nFZL9cW5jl6sWn+xpRJ7ypWh2yyqqr8UUCstSw==}
dependencies: dependencies:
'@types/node': 14.18.32 '@types/node': 14.18.10
form-data: 3.0.1 form-data: 3.0.1
dev: false dev: false
@ -226,21 +227,21 @@ packages:
resolution: {integrity: sha512-s3nugnZumCC//n4moGGe6tkNMyYEdaDBitVjwPxXmR5lnMG5dHePinH2EdxkG3Rh1ghFHHixAG4NJhpJW1rthQ==} resolution: {integrity: sha512-s3nugnZumCC//n4moGGe6tkNMyYEdaDBitVjwPxXmR5lnMG5dHePinH2EdxkG3Rh1ghFHHixAG4NJhpJW1rthQ==}
dev: true dev: true
/@types/node/14.18.32: /@types/node/14.18.10:
resolution: {integrity: sha512-Y6S38pFr04yb13qqHf8uk1nHE3lXgQ30WZbv1mLliV9pt0NjvqdWttLcrOYLnXbOafknVYRHZGoMSpR9UwfYow==} resolution: {integrity: sha512-6iihJ/Pp5fsFJ/aEDGyvT4pHGmCpq7ToQ/yf4bl5SbVAvwpspYJ+v3jO7n8UyjhQVHTy+KNszOozDdv+O6sovQ==}
/@types/yargs-parser/21.0.0: /@types/yargs-parser/20.2.1:
resolution: {integrity: sha512-iO9ZQHkZxHn4mSakYV0vFHAVDyEOIJQrV2uZ06HxEPcx+mt8swXoZHIbaaJ2crJYFfErySgktuTZ3BeLz+XmFA==} resolution: {integrity: sha512-7tFImggNeNBVMsn0vLrpn1H1uPrUBdnARPTpZoitY37ZrdJREzf7I16tMrlK3hen349gr1NYh8CmZQa7CTG6Aw==}
dev: true dev: true
/@types/yargs/15.0.14: /@types/yargs/15.0.14:
resolution: {integrity: sha512-yEJzHoxf6SyQGhBhIYGXQDSCkJjB6HohDShto7m8vaKg9Yp0Yn8+71J9eakh2bnPg6BfsH9PRMhiRTZnd4eXGQ==} resolution: {integrity: sha512-yEJzHoxf6SyQGhBhIYGXQDSCkJjB6HohDShto7m8vaKg9Yp0Yn8+71J9eakh2bnPg6BfsH9PRMhiRTZnd4eXGQ==}
dependencies: dependencies:
'@types/yargs-parser': 21.0.0 '@types/yargs-parser': 20.2.1
dev: true dev: true
/@vercel/ncc/0.33.4: /@vercel/ncc/0.27.0:
resolution: {integrity: sha512-ln18hs7dMffelP47tpkaR+V5Tj6coykNyxJrlcmCormPqRQjB/Gv4cu2FfBG+PMzIfdZp2CLDsrrB1NPU22Qhg==} resolution: {integrity: sha512-DllIJQapnU2YwewIhh/4dYesmMQw3h2cFtabECc/zSJHqUbNa0eJuEkRa6DXbZvh1YPWBtYQoPV17NlDpBw1Vw==}
hasBin: true hasBin: true
dev: true dev: true
@ -252,8 +253,8 @@ packages:
json-schema-traverse: 0.4.1 json-schema-traverse: 0.4.1
uri-js: 4.4.1 uri-js: 4.4.1
/ansi-regex/4.1.1: /ansi-regex/4.1.0:
resolution: {integrity: sha512-ILlv4k/3f6vfQ4OoP2AGvirOktlQ98ZEL1k9FaQjxa3L1abBgbuTDAdPOpvbGncC0BTVQrl+OM8xZGK6tWXt7g==} resolution: {integrity: sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==}
engines: {node: '>=6'} engines: {node: '>=6'}
dev: true dev: true
@ -287,7 +288,12 @@ packages:
dev: false dev: false
/asynckit/0.4.0: /asynckit/0.4.0:
resolution: {integrity: sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==} resolution: {integrity: sha1-x57Zf380y48robyXkLzDZkdLS3k=}
dev: false
/at-least-node/1.0.0:
resolution: {integrity: sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==}
engines: {node: '>= 4.0.0'}
dev: false dev: false
/balanced-match/1.0.2: /balanced-match/1.0.2:
@ -343,7 +349,7 @@ packages:
dev: true dev: true
/color-name/1.1.3: /color-name/1.1.3:
resolution: {integrity: sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==} resolution: {integrity: sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=}
dev: true dev: true
/color-name/1.1.4: /color-name/1.1.4:
@ -358,16 +364,16 @@ packages:
dev: false dev: false
/concat-map/0.0.1: /concat-map/0.0.1:
resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==} resolution: {integrity: sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=}
dev: true dev: true
/decamelize/1.2.0: /decamelize/1.2.0:
resolution: {integrity: sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA==} resolution: {integrity: sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=}
engines: {node: '>=0.10.0'} engines: {node: '>=0.10.0'}
dev: true dev: true
/delayed-stream/1.0.0: /delayed-stream/1.0.0:
resolution: {integrity: sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==} resolution: {integrity: sha1-3zrhmayt+31ECqrgsp4icrJOxhk=}
engines: {node: '>=0.4.0'} engines: {node: '>=0.4.0'}
dev: false dev: false
@ -388,12 +394,12 @@ packages:
/exec-once/0.1.8: /exec-once/0.1.8:
resolution: {integrity: sha512-zv8nmN+jF366nAEuNgOh5U2owy5MMkv+N1LCp1utCH63ujSXr92H3x2lDR+Mstm9xNmXNlo45W/Ch+TrN1jAdw==} resolution: {integrity: sha512-zv8nmN+jF366nAEuNgOh5U2owy5MMkv+N1LCp1utCH63ujSXr92H3x2lDR+Mstm9xNmXNlo45W/Ch+TrN1jAdw==}
dependencies: dependencies:
'@types/node': 14.18.32 '@types/node': 14.18.10
tslib: 2.4.0 tslib: 2.3.1
dev: true dev: true
/expand-tilde/2.0.2: /expand-tilde/2.0.2:
resolution: {integrity: sha512-A5EmesHW6rfnZ9ysHQjPdJRni0SRar0tjtG5MNtm9n5TUvsYU8oozprtRD4AqHxcZWWlVuAmQo2nWKfN9oyjTw==} resolution: {integrity: sha1-l+gBqgUt8CRU3kawK/YhZCzchQI=}
engines: {node: '>=0.10.0'} engines: {node: '>=0.10.0'}
dependencies: dependencies:
homedir-polyfill: 1.0.3 homedir-polyfill: 1.0.3
@ -408,8 +414,8 @@ packages:
/fast-traverse/0.1.7: /fast-traverse/0.1.7:
resolution: {integrity: sha512-gZTQvJSgrGV24F8AeeTNxip8OEkjRHwDDpGw0b51TzRVGjJsKzh6CuHf9ltVjJZzni5Ead+EEQJ0IFCuoCJUtA==} resolution: {integrity: sha512-gZTQvJSgrGV24F8AeeTNxip8OEkjRHwDDpGw0b51TzRVGjJsKzh6CuHf9ltVjJZzni5Ead+EEQJ0IFCuoCJUtA==}
dependencies: dependencies:
'@types/node': 14.18.32 '@types/node': 14.18.10
tslib: 2.4.0 tslib: 2.3.1
dev: true dev: true
/find-up/3.0.0: /find-up/3.0.0:
@ -433,29 +439,30 @@ packages:
dependencies: dependencies:
asynckit: 0.4.0 asynckit: 0.4.0
combined-stream: 1.0.8 combined-stream: 1.0.8
mime-types: 2.1.35 mime-types: 2.1.34
dev: false
/fs-extra/10.1.0:
resolution: {integrity: sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==}
engines: {node: '>=12'}
dependencies:
graceful-fs: 4.2.10
jsonfile: 6.1.0
universalify: 2.0.0
dev: false dev: false
/fs-extra/8.1.0: /fs-extra/8.1.0:
resolution: {integrity: sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==} resolution: {integrity: sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==}
engines: {node: '>=6 <7 || >=8'} engines: {node: '>=6 <7 || >=8'}
dependencies: dependencies:
graceful-fs: 4.2.10 graceful-fs: 4.2.9
jsonfile: 4.0.0 jsonfile: 4.0.0
universalify: 0.1.2 universalify: 0.1.2
dev: true dev: true
/fs-extra/9.1.0:
resolution: {integrity: sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==}
engines: {node: '>=10'}
dependencies:
at-least-node: 1.0.0
graceful-fs: 4.2.9
jsonfile: 6.1.0
universalify: 2.0.0
dev: false
/fs.realpath/1.0.0: /fs.realpath/1.0.0:
resolution: {integrity: sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==} resolution: {integrity: sha1-FQStJSMVjKpA20onh8sBQRmU6k8=}
dev: true dev: true
/get-caller-file/2.0.5: /get-caller-file/2.0.5:
@ -469,13 +476,13 @@ packages:
fs.realpath: 1.0.0 fs.realpath: 1.0.0
inflight: 1.0.6 inflight: 1.0.6
inherits: 2.0.4 inherits: 2.0.4
minimatch: 3.1.2 minimatch: 3.0.5
once: 1.4.0 once: 1.4.0
path-is-absolute: 1.0.1 path-is-absolute: 1.0.1
dev: true dev: true
/graceful-fs/4.2.10: /graceful-fs/4.2.9:
resolution: {integrity: sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==} resolution: {integrity: sha512-NtNxqUcXgpW2iMrfqSfR73Glt39K+BLwWsPs94yR63v45T0Wbej7eRmL5cWfwEgqXnmjQp3zaJTshdRW/qC2ZQ==}
/homedir-polyfill/1.0.3: /homedir-polyfill/1.0.3:
resolution: {integrity: sha512-eSmmWE5bZTK2Nou4g0AI3zZ9rswp7GRKoKXS1BLUkvPviOqs4YTN1djQIqrXy9k5gEtdLPy86JjRwsNM9tnDcA==} resolution: {integrity: sha512-eSmmWE5bZTK2Nou4g0AI3zZ9rswp7GRKoKXS1BLUkvPviOqs4YTN1djQIqrXy9k5gEtdLPy86JjRwsNM9tnDcA==}
@ -485,7 +492,7 @@ packages:
dev: false dev: false
/inflight/1.0.6: /inflight/1.0.6:
resolution: {integrity: sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==} resolution: {integrity: sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=}
dependencies: dependencies:
once: 1.4.0 once: 1.4.0
wrappy: 1.0.2 wrappy: 1.0.2
@ -496,7 +503,7 @@ packages:
dev: true dev: true
/is-fullwidth-code-point/2.0.0: /is-fullwidth-code-point/2.0.0:
resolution: {integrity: sha512-VHskAKYM8RfSFXwee5t5cbN5PZeq1Wrh6qd5bkyiXIf6UQcN6w/A0eXM9r6t8d+GYOh+o6ZhiEnb88LN/Y8m2w==} resolution: {integrity: sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=}
engines: {node: '>=4'} engines: {node: '>=4'}
dev: true dev: true
@ -524,15 +531,15 @@ packages:
resolution: {integrity: sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==} resolution: {integrity: sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==}
/json-stable-stringify/1.0.1: /json-stable-stringify/1.0.1:
resolution: {integrity: sha512-i/J297TW6xyj7sDFa7AmBPkQvLIxWr2kKPWI26tXydnZrzVAocNqn5DMNT1Mzk0vit1V5UkRM7C1KdVNp7Lmcg==} resolution: {integrity: sha1-mnWdOcXy/1A/1TAGRu1EX4jE+a8=}
dependencies: dependencies:
jsonify: 0.0.1 jsonify: 0.0.0
dev: true dev: true
/jsonfile/4.0.0: /jsonfile/4.0.0:
resolution: {integrity: sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==} resolution: {integrity: sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=}
optionalDependencies: optionalDependencies:
graceful-fs: 4.2.10 graceful-fs: 4.2.9
dev: true dev: true
/jsonfile/6.1.0: /jsonfile/6.1.0:
@ -540,11 +547,11 @@ packages:
dependencies: dependencies:
universalify: 2.0.0 universalify: 2.0.0
optionalDependencies: optionalDependencies:
graceful-fs: 4.2.10 graceful-fs: 4.2.9
dev: false dev: false
/jsonify/0.0.1: /jsonify/0.0.0:
resolution: {integrity: sha512-2/Ki0GcmuqSrgFyelQq9M05y7PS0mEwuIzrf3f1fPqkVDVRvZrPZtVSMHxdgo8Aq0sxAOb/cr2aqqA3LeWHVPg==} resolution: {integrity: sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM=}
dev: true dev: true
/locate-path/3.0.0: /locate-path/3.0.0:
@ -562,26 +569,38 @@ packages:
p-locate: 4.1.0 p-locate: 4.1.0
dev: true dev: true
/mime-db/1.52.0: /mime-db/1.51.0:
resolution: {integrity: sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==} resolution: {integrity: sha512-5y8A56jg7XVQx2mbv1lu49NR4dokRnhZYTtL+KGfaa27uq4pSTXkwQkFJl4pkRMyNFz/EtYDSkiiEHx3F7UN6g==}
engines: {node: '>= 0.6'} engines: {node: '>= 0.6'}
dev: false dev: false
/mime-types/2.1.35: /mime-types/2.1.34:
resolution: {integrity: sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==} resolution: {integrity: sha512-6cP692WwGIs9XXdOO4++N+7qjqv0rqxxVvJ3VHPh/Sc9mVZcQP+ZGhkKiTvWMQRr2tbHkJP/Yn7Y0npb3ZBs4A==}
engines: {node: '>= 0.6'} engines: {node: '>= 0.6'}
dependencies: dependencies:
mime-db: 1.52.0 mime-db: 1.51.0
dev: false dev: false
/minimatch/3.1.2: /minimatch/3.0.5:
resolution: {integrity: sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==} resolution: {integrity: sha512-tUpxzX0VAzJHjLu0xUfFv1gwVp9ba3IOuRAVH2EGuRW8a5emA2FlACLqiT/lDVtS1W+TGNwqz3sWaNyLgDJWuw==}
dependencies: dependencies:
brace-expansion: 1.1.11 brace-expansion: 1.1.11
dev: true dev: true
/node-fetch/2.6.7:
resolution: {integrity: sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==}
engines: {node: 4.x || >=6.0.0}
peerDependencies:
encoding: ^0.1.0
peerDependenciesMeta:
encoding:
optional: true
dependencies:
whatwg-url: 5.0.0
dev: false
/once/1.4.0: /once/1.4.0:
resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==} resolution: {integrity: sha1-WDsap3WWHUsROsF9nFC6753Xa9E=}
dependencies: dependencies:
wrappy: 1.0.2 wrappy: 1.0.2
dev: true dev: true
@ -613,12 +632,12 @@ packages:
dev: true dev: true
/parse-passwd/1.0.0: /parse-passwd/1.0.0:
resolution: {integrity: sha512-1Y1A//QUXEZK7YKz+rD9WydcE1+EuPr6ZBgKecAB8tmoW6UFv0NREVJe1p+jRxtThkcbbKkfwIbWJe/IeE6m2Q==} resolution: {integrity: sha1-bVuTSkVpk7I9N/QKOC1vFmao5cY=}
engines: {node: '>=0.10.0'} engines: {node: '>=0.10.0'}
dev: false dev: false
/path-exists/3.0.0: /path-exists/3.0.0:
resolution: {integrity: sha512-bpC7GYwiDYQ4wYLe+FA8lhRjhQCMcQGuSgGGqDkg/QerRWw9CmGRT0iSOVRSZJ29NMLZgIzqaljJ63oaL4NIJQ==} resolution: {integrity: sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=}
engines: {node: '>=4'} engines: {node: '>=4'}
dev: true dev: true
@ -628,7 +647,7 @@ packages:
dev: true dev: true
/path-is-absolute/1.0.1: /path-is-absolute/1.0.1:
resolution: {integrity: sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==} resolution: {integrity: sha1-F0uSaHNVNP+8es5r9TpanhtcX18=}
engines: {node: '>=0.10.0'} engines: {node: '>=0.10.0'}
dev: true dev: true
@ -637,7 +656,7 @@ packages:
engines: {node: '>=6'} engines: {node: '>=6'}
/require-directory/2.1.1: /require-directory/2.1.1:
resolution: {integrity: sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==} resolution: {integrity: sha1-jGStX9MNqxyXbiNE/+f3kqam30I=}
engines: {node: '>=0.10.0'} engines: {node: '>=0.10.0'}
dev: true dev: true
@ -646,11 +665,11 @@ packages:
dev: true dev: true
/set-blocking/2.0.0: /set-blocking/2.0.0:
resolution: {integrity: sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==} resolution: {integrity: sha1-BF+XgtARrppoA93TgrJDkrPYkPc=}
dev: true dev: true
/sprintf-js/1.0.3: /sprintf-js/1.0.3:
resolution: {integrity: sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==} resolution: {integrity: sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=}
dev: true dev: true
/string-width/3.1.0: /string-width/3.1.0:
@ -675,7 +694,7 @@ packages:
resolution: {integrity: sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==} resolution: {integrity: sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==}
engines: {node: '>=6'} engines: {node: '>=6'}
dependencies: dependencies:
ansi-regex: 4.1.1 ansi-regex: 4.1.0
dev: true dev: true
/strip-ansi/6.0.1: /strip-ansi/6.0.1:
@ -685,12 +704,16 @@ packages:
ansi-regex: 5.0.1 ansi-regex: 5.0.1
dev: true dev: true
/tr46/0.0.3:
resolution: {integrity: sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o=}
dev: false
/tslib/1.14.1: /tslib/1.14.1:
resolution: {integrity: sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==} resolution: {integrity: sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==}
dev: true dev: true
/tslib/2.4.0: /tslib/2.3.1:
resolution: {integrity: sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==} resolution: {integrity: sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw==}
dev: true dev: true
/tunnel/0.0.6: /tunnel/0.0.6:
@ -702,7 +725,7 @@ packages:
resolution: {integrity: sha512-9WO+lVmlph7Ecb7lPd9tU84XFUQh44kpAf3cWe/Ym4G5EKw/SS6XGpi1DZDthvxqkIdNSDlWi7FhKfxuIV/3yw==} resolution: {integrity: sha512-9WO+lVmlph7Ecb7lPd9tU84XFUQh44kpAf3cWe/Ym4G5EKw/SS6XGpi1DZDthvxqkIdNSDlWi7FhKfxuIV/3yw==}
hasBin: true hasBin: true
dependencies: dependencies:
'@types/json-schema': 7.0.11 '@types/json-schema': 7.0.9
glob: 7.1.7 glob: 7.1.7
json-stable-stringify: 1.0.1 json-stable-stringify: 1.0.1
typescript: 3.9.10 typescript: 3.9.10
@ -715,8 +738,8 @@ packages:
hasBin: true hasBin: true
dev: true dev: true
/typescript/4.8.4: /typescript/4.5.5:
resolution: {integrity: sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ==} resolution: {integrity: sha512-TCTIul70LyWe6IJWT8QSYeA54WQe8EjQFU4wY52Fasj5UKx88LNYKCgBEHcOMOrFF1rKGbD8v/xcNWVUq9SymA==}
engines: {node: '>=4.2.0'} engines: {node: '>=4.2.0'}
hasBin: true hasBin: true
dev: true dev: true
@ -741,13 +764,19 @@ packages:
engines: {node: '>= 4'} engines: {node: '>= 4'}
dev: true dev: true
/uuid/8.3.2: /webidl-conversions/3.0.1:
resolution: {integrity: sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==} resolution: {integrity: sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE=}
hasBin: true dev: false
/whatwg-url/5.0.0:
resolution: {integrity: sha1-lmRU6HZUYuN2RNNib2dCzotwll0=}
dependencies:
tr46: 0.0.3
webidl-conversions: 3.0.1
dev: false dev: false
/which-module/2.0.0: /which-module/2.0.0:
resolution: {integrity: sha512-B+enWhmw6cjfVC7kS8Pj9pCrKSc5txArRyaYGe088shv/FGWH+0Rjx/xPgtsWfsUtS27FkP697E4DDhgrgoc0Q==} resolution: {integrity: sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=}
dev: true dev: true
/wrap-ansi/5.1.0: /wrap-ansi/5.1.0:
@ -769,7 +798,7 @@ packages:
dev: true dev: true
/wrappy/1.0.2: /wrappy/1.0.2:
resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==} resolution: {integrity: sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=}
dev: true dev: true
/y18n/4.0.3: /y18n/4.0.3:

View File

@ -1,7 +1,7 @@
import { setFailed, saveState, getState } from '@actions/core' import { setFailed, saveState, getState } from '@actions/core'
import getInputs from './inputs' import getInputs from './inputs'
import installPnpm from './install-pnpm'
import setOutputs from './outputs' import setOutputs from './outputs'
import installPnpm from './install-pnpm'
import pnpmInstall from './pnpm-install' import pnpmInstall from './pnpm-install'
import pruneStore from './pnpm-store-prune' import pruneStore from './pnpm-store-prune'

View File

@ -3,10 +3,9 @@ import expandTilde from 'expand-tilde'
import { RunInstall, parseRunInstall } from './run-install' import { RunInstall, parseRunInstall } from './run-install'
export interface Inputs { export interface Inputs {
readonly version?: string readonly version: string
readonly dest: string readonly dest: string
readonly runInstall: RunInstall[] readonly runInstall: RunInstall[]
readonly packageJsonFile: string
} }
const options: InputOptions = { const options: InputOptions = {
@ -16,10 +15,9 @@ const options: InputOptions = {
const parseInputPath = (name: string) => expandTilde(getInput(name, options)) const parseInputPath = (name: string) => expandTilde(getInput(name, options))
export const getInputs = (): Inputs => ({ export const getInputs = (): Inputs => ({
version: getInput('version'), version: getInput('version', options),
dest: parseInputPath('dest'), dest: parseInputPath('dest'),
runInstall: parseRunInstall('run_install'), runInstall: parseRunInstall('run_install'),
packageJsonFile: parseInputPath('package_json_file'),
}) })
export default getInputs export default getInputs

View File

@ -1,7 +1,7 @@
import { getInput, error, InputOptions } from '@actions/core'
import Ajv from 'ajv'
import { load } from 'js-yaml'
import process from 'process' import process from 'process'
import { load } from 'js-yaml'
import Ajv from 'ajv'
import { getInput, error, InputOptions } from '@actions/core'
import runInstallSchema from './run-install-input.schema.json' import runInstallSchema from './run-install-input.schema.json'
export interface RunInstall { export interface RunInstall {

File diff suppressed because one or more lines are too long

View File

@ -1,61 +1,38 @@
import { addPath, exportVariable } from '@actions/core' import * as core from '@actions/core'
import { spawn } from 'child_process' import { spawn } from 'child_process'
import { remove, ensureFile, writeFile, readFile } from 'fs-extra'
import path from 'path'
import { execPath } from 'process' import { execPath } from 'process'
import { join } from 'path'
import { remove, ensureFile, writeFile } from 'fs-extra'
import fetch from 'node-fetch'
import { Inputs } from '../inputs' import { Inputs } from '../inputs'
export async function runSelfInstaller(inputs: Inputs): Promise<number> { export async function runSelfInstaller(inputs: Inputs): Promise<number> {
const { version, dest, packageJsonFile } = inputs const { version, dest } = inputs
const target = version ? `pnpm@${version}` : 'pnpm'
const pkgJson = join(dest, 'package.json')
// prepare self install
await remove(dest) await remove(dest)
const pkgJson = path.join(dest, 'package.json')
await ensureFile(pkgJson) await ensureFile(pkgJson)
await writeFile(pkgJson, JSON.stringify({ private: true })) await writeFile(pkgJson, JSON.stringify({ private: true }))
// prepare target pnpm const cp = spawn(execPath, ['-', 'install', target, '--no-lockfile'], {
const target = await readTarget(packageJsonFile, version)
const cp = spawn(execPath, [path.join(__dirname, 'pnpm.js'), 'install', target, '--no-lockfile'], {
cwd: dest, cwd: dest,
stdio: ['pipe', 'inherit', 'inherit'], stdio: ['pipe', 'inherit', 'inherit'],
}) })
const exitCode = await new Promise<number>((resolve, reject) => { const response = await fetch('https://pnpm.js.org/pnpm.js')
response.body.pipe(cp.stdin)
const result = await new Promise<number>((resolve, reject) => {
cp.on('error', reject) cp.on('error', reject)
cp.on('close', resolve) cp.on('close', resolve)
}) })
if (exitCode === 0) { if (result === 0) {
const pnpmHome = path.join(dest, 'node_modules/.bin') const pnpmHome = join(dest, 'node_modules/.bin')
addPath(pnpmHome) core.addPath(pnpmHome)
exportVariable('PNPM_HOME', pnpmHome) core.exportVariable('PNPM_HOME_PATH', pnpmHome)
} }
return exitCode return result
}
async function readTarget(packageJsonFile: string, version?: string | undefined) {
if (version) return `pnpm@${version}`
const { GITHUB_WORKSPACE } = process.env
if (!GITHUB_WORKSPACE) {
throw new Error(`No workspace is found.
If you're intended to let pnpm/action-setup read preferred pnpm version from the "packageManager" field in the package.json file,
please run the actions/checkout before pnpm/action-setup.
Otherwise, please specify the pnpm version in the action configuration.`)
}
const { packageManager } = JSON.parse(await readFile(path.join(GITHUB_WORKSPACE, packageJsonFile), 'utf8'))
if (typeof packageManager !== 'string') {
throw new Error(`No pnpm version is specified.
Please specify it by one of the following ways:
- in the GitHub Action config with the key "version"
- in the package.json with the key "packageManager"`)
}
if (!packageManager.startsWith('pnpm@')) {
throw new Error('Invalid packageManager field in package.json')
}
return packageManager
} }
export default runSelfInstaller export default runSelfInstaller

View File

@ -1,5 +1,5 @@
import { setFailed, startGroup, endGroup } from '@actions/core'
import { spawnSync } from 'child_process' import { spawnSync } from 'child_process'
import { setFailed, startGroup, endGroup } from '@actions/core'
import { Inputs } from '../inputs' import { Inputs } from '../inputs'
import { patchPnpmEnv } from '../utils' import { patchPnpmEnv } from '../utils'

View File

@ -1,5 +1,5 @@
import { warning, startGroup, endGroup } from '@actions/core'
import { spawnSync } from 'child_process' import { spawnSync } from 'child_process'
import { warning, startGroup, endGroup } from '@actions/core'
import { Inputs } from '../inputs' import { Inputs } from '../inputs'
import { patchPnpmEnv } from '../utils' import { patchPnpmEnv } from '../utils'
@ -13,7 +13,7 @@ export function pruneStore(inputs: Inputs) {
const { error, status } = spawnSync('pnpm', ['store', 'prune'], { const { error, status } = spawnSync('pnpm', ['store', 'prune'], {
stdio: 'inherit', stdio: 'inherit',
shell: true, shell: true,
env: patchPnpmEnv(inputs), env: patchPnpmEnv(inputs)
}) })
endGroup() endGroup()

View File

@ -1,10 +1,10 @@
import path from 'path'
import process from 'process' import process from 'process'
import path from 'path'
import { Inputs } from '../inputs' import { Inputs } from '../inputs'
export const getBinDest = (inputs: Inputs): string => path.join(inputs.dest, 'node_modules', '.bin') export const getBinDest = (inputs: Inputs): string => path.join(inputs.dest, 'node_modules', '.bin')
export const patchPnpmEnv = (inputs: Inputs): NodeJS.ProcessEnv => ({ export const patchPnpmEnv = (inputs: Inputs): NodeJS.ProcessEnv => ({
...process.env, ...process.env,
PATH: getBinDest(inputs) + path.delimiter + process.env.PATH, PATH: getBinDest(inputs) + path.delimiter + process.env.PATH
}) })