mirror of
https://github.com/pnpm/action-setup.git
synced 2025-07-08 04:59:27 +08:00
Compare commits
37 Commits
add-to-pat
...
v2.2.4
Author | SHA1 | Date | |
---|---|---|---|
c3b53f6a16 | |||
21e88da200 | |||
fc3334fa11 | |||
d01953a678 | |||
3360b50db7 | |||
6f9e9a867a | |||
537643d491 | |||
f4129fb46e | |||
6e1964dde3 | |||
10693b3829 | |||
99ecd24520 | |||
958500fcab | |||
57b9359b4c | |||
ec1a8b444c | |||
73e15250cb | |||
10b4b0b462 | |||
5fa8980bf4 | |||
ae78e9abbe | |||
35ab4267a1 | |||
11ba3424e0 | |||
847a737d63 | |||
225f3bb4b0 | |||
777a50d72e | |||
e7c10c6fc5 | |||
a576a70bc6 | |||
1d51e20937 | |||
ad2b35ae0c | |||
d8ea532ac4 | |||
2270f39ef6 | |||
394c848db6 | |||
e13928ccc5 | |||
93bd5a123d | |||
9eb14dd77c | |||
eafb777c56 | |||
e6378df420 | |||
6ff6e97bc6 | |||
45d9c91ff6 |
3
.github/dependabot.yml
vendored
3
.github/dependabot.yml
vendored
@ -5,6 +5,3 @@ updates:
|
||||
schedule:
|
||||
interval: weekly
|
||||
open-pull-requests-limit: 10
|
||||
labels:
|
||||
- dependabot
|
||||
- github-actions
|
||||
|
6
.github/workflows/test.yaml
vendored
6
.github/workflows/test.yaml
vendored
@ -22,7 +22,7 @@ jobs:
|
||||
- windows-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Run the action
|
||||
uses: ./
|
||||
@ -51,7 +51,7 @@ jobs:
|
||||
- windows-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Run the action
|
||||
uses: ./
|
||||
@ -107,7 +107,7 @@ jobs:
|
||||
- pnpm
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Run the action
|
||||
uses: ./
|
||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -2,6 +2,7 @@ node_modules
|
||||
*.log
|
||||
/dist/*
|
||||
!/dist/index.js
|
||||
!/dist/pnpm.js
|
||||
tmp
|
||||
temp
|
||||
*.tmp
|
||||
|
78
README.md
78
README.md
@ -6,7 +6,11 @@ Install pnpm package manager.
|
||||
|
||||
### `version`
|
||||
|
||||
**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`.
|
||||
Version of pnpm to install.
|
||||
|
||||
**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`
|
||||
|
||||
@ -54,12 +58,13 @@ on:
|
||||
- pull_request
|
||||
|
||||
jobs:
|
||||
runs-on: ubuntu-latest
|
||||
install:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: pnpm/action-setup@v2.0.1
|
||||
with:
|
||||
version: 6.0.2
|
||||
steps:
|
||||
- uses: pnpm/action-setup@v2.2.4
|
||||
with:
|
||||
version: 6.0.2
|
||||
```
|
||||
|
||||
### Install pnpm and a few npm packages
|
||||
@ -70,18 +75,19 @@ on:
|
||||
- pull_request
|
||||
|
||||
jobs:
|
||||
runs-on: ubuntu-latest
|
||||
install:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- uses: pnpm/action-setup@v2.0.1
|
||||
with:
|
||||
version: 6.0.2
|
||||
run_install: |
|
||||
- recursive: true
|
||||
args: [--frozen-lockfile, --strict-peer-dependencies]
|
||||
- args: [--global, gulp, prettier, typescript]
|
||||
- uses: pnpm/action-setup@v2.2.4
|
||||
with:
|
||||
version: 6.0.2
|
||||
run_install: |
|
||||
- recursive: true
|
||||
args: [--frozen-lockfile, --strict-peer-dependencies]
|
||||
- args: [--global, gulp, prettier, typescript]
|
||||
```
|
||||
|
||||
### Use cache to reduce installation time
|
||||
@ -92,24 +98,40 @@ on:
|
||||
- pull_request
|
||||
|
||||
jobs:
|
||||
runs-on: ubuntu-latest
|
||||
cache-and-install:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
build:
|
||||
- uses: actions/checkout@v2
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Cache pnpm modules
|
||||
uses: actions/cache@v2
|
||||
- name: Install Node.js
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
path: ~/.pnpm-store
|
||||
key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-
|
||||
node-version: 16
|
||||
|
||||
- uses: pnpm/action-setup@v2.0.1
|
||||
name: Install pnpm
|
||||
id: pnpm-install
|
||||
with:
|
||||
version: 6.0.2
|
||||
run_install: true
|
||||
version: 7
|
||||
run_install: false
|
||||
|
||||
- name: Get pnpm store directory
|
||||
id: pnpm-cache
|
||||
run: |
|
||||
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
|
||||
|
||||
- uses: actions/cache@v3
|
||||
name: Setup pnpm cache
|
||||
with:
|
||||
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
|
||||
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pnpm-store-
|
||||
|
||||
- name: Install dependencies
|
||||
run: pnpm install
|
||||
```
|
||||
|
||||
**Note:** You don't need to run `pnpm store prune` at the end; post-action has already taken care of that.
|
||||
|
11
action.yml
11
action.yml
@ -1,14 +1,13 @@
|
||||
name: Setup PNPM
|
||||
description: Install PNPM package manager
|
||||
name: Setup pnpm
|
||||
description: Install pnpm package manager
|
||||
branding:
|
||||
icon: package
|
||||
color: orange
|
||||
inputs:
|
||||
version:
|
||||
description: Version of PNPM to install
|
||||
required: true
|
||||
description: Version of pnpm to install
|
||||
dest:
|
||||
description: Where to store PNPM files
|
||||
description: Where to store pnpm files
|
||||
required: false
|
||||
default: ~/setup-pnpm
|
||||
run_install:
|
||||
@ -16,6 +15,6 @@ inputs:
|
||||
required: false
|
||||
default: 'null'
|
||||
runs:
|
||||
using: node12
|
||||
using: node16
|
||||
main: dist/index.js
|
||||
post: dist/index.js
|
||||
|
11
dist/index.js
vendored
11
dist/index.js
vendored
File diff suppressed because one or more lines are too long
134031
dist/pnpm.js
vendored
Normal file
134031
dist/pnpm.js
vendored
Normal file
File diff suppressed because one or more lines are too long
17
package.json
17
package.json
@ -3,25 +3,24 @@
|
||||
"scripts": {
|
||||
"build:schemas": "ts-schema-autogen generate",
|
||||
"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",
|
||||
"build": "pnpm run build:schemas && tsc && pnpm run build:ncc && cp src/install-pnpm/pnpm.js dist/pnpm.js",
|
||||
"start": "pnpm run build && sh ./run.sh"
|
||||
},
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.6.0",
|
||||
"@actions/core": "^1.10.0",
|
||||
"@types/expand-tilde": "^2.0.0",
|
||||
"@types/fs-extra": "^9.0.13",
|
||||
"@types/js-yaml": "^4.0.5",
|
||||
"@types/node": "^14.18.10",
|
||||
"@types/node-fetch": "^2.5.12",
|
||||
"@types/node": "^14.18.32",
|
||||
"@types/node-fetch": "^2.6.2",
|
||||
"ajv": "^6.12.6",
|
||||
"expand-tilde": "^2.0.2",
|
||||
"fs-extra": "^9.1.0",
|
||||
"js-yaml": "^4.1.0",
|
||||
"node-fetch": "^2.6.7"
|
||||
"fs-extra": "^10.1.0",
|
||||
"js-yaml": "^4.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@ts-schema-autogen/cli": "^0.1.2",
|
||||
"@vercel/ncc": "^0.27.0",
|
||||
"typescript": "^4.5.5"
|
||||
"@vercel/ncc": "^0.33.4",
|
||||
"typescript": "^4.8.4"
|
||||
}
|
||||
}
|
||||
|
217
pnpm-lock.yaml
generated
217
pnpm-lock.yaml
generated
@ -1,49 +1,48 @@
|
||||
lockfileVersion: 5.3
|
||||
lockfileVersion: 5.4
|
||||
|
||||
specifiers:
|
||||
'@actions/core': ^1.6.0
|
||||
'@actions/core': ^1.10.0
|
||||
'@ts-schema-autogen/cli': ^0.1.2
|
||||
'@types/expand-tilde': ^2.0.0
|
||||
'@types/fs-extra': ^9.0.13
|
||||
'@types/js-yaml': ^4.0.5
|
||||
'@types/node': ^14.18.10
|
||||
'@types/node-fetch': ^2.5.12
|
||||
'@vercel/ncc': ^0.27.0
|
||||
'@types/node': ^14.18.32
|
||||
'@types/node-fetch': ^2.6.2
|
||||
'@vercel/ncc': ^0.33.4
|
||||
ajv: ^6.12.6
|
||||
expand-tilde: ^2.0.2
|
||||
fs-extra: ^9.1.0
|
||||
fs-extra: ^10.1.0
|
||||
js-yaml: ^4.1.0
|
||||
node-fetch: ^2.6.7
|
||||
typescript: ^4.5.5
|
||||
typescript: ^4.8.4
|
||||
|
||||
dependencies:
|
||||
'@actions/core': 1.6.0
|
||||
'@actions/core': 1.10.0
|
||||
'@types/expand-tilde': 2.0.0
|
||||
'@types/fs-extra': 9.0.13
|
||||
'@types/js-yaml': 4.0.5
|
||||
'@types/node': 14.18.10
|
||||
'@types/node-fetch': 2.5.12
|
||||
'@types/node': 14.18.32
|
||||
'@types/node-fetch': 2.6.2
|
||||
ajv: 6.12.6
|
||||
expand-tilde: 2.0.2
|
||||
fs-extra: 9.1.0
|
||||
fs-extra: 10.1.0
|
||||
js-yaml: 4.1.0
|
||||
node-fetch: 2.6.7
|
||||
|
||||
devDependencies:
|
||||
'@ts-schema-autogen/cli': 0.1.2
|
||||
'@vercel/ncc': 0.27.0
|
||||
typescript: 4.5.5
|
||||
'@vercel/ncc': 0.33.4
|
||||
typescript: 4.8.4
|
||||
|
||||
packages:
|
||||
|
||||
/@actions/core/1.6.0:
|
||||
resolution: {integrity: sha512-NB1UAZomZlCV/LmJqkLhNTqtKfFXJZAUPcfl/zqG7EfsQdeUJtaWO98SGbuQ3pydJ3fHl2CvI/51OKYlCYYcaw==}
|
||||
/@actions/core/1.10.0:
|
||||
resolution: {integrity: sha512-2aZDDa3zrrZbP5ZYg159sNoLRb61nQ7awl5pSvIq5Qpj81vwDzdMRKzkWJGJuwVvWpvZKx7vspJALyvaaIQyug==}
|
||||
dependencies:
|
||||
'@actions/http-client': 1.0.11
|
||||
'@actions/http-client': 2.0.1
|
||||
uuid: 8.3.2
|
||||
dev: false
|
||||
|
||||
/@actions/http-client/1.0.11:
|
||||
resolution: {integrity: sha512-VRYHGQV1rqnROJqdMvGUbY/Kn8vriQe/F9HR2AlYHzmKuM/p3kjNuXhmdBfcVgsvRWTz5C5XW5xvndZrVBuAYg==}
|
||||
/@actions/http-client/2.0.1:
|
||||
resolution: {integrity: sha512-PIXiMVtz6VvyaRsGY268qvj57hXQEpsYogYOu2nrQhlf+XCGmZstmuZBbAybUl1nQGnvS1k1eEsQ69ZoD7xlSw==}
|
||||
dependencies:
|
||||
tunnel: 0.0.6
|
||||
dev: false
|
||||
@ -195,13 +194,13 @@ packages:
|
||||
/@types/fs-extra/8.1.2:
|
||||
resolution: {integrity: sha512-SvSrYXfWSc7R4eqnOzbQF4TZmfpNSM9FrSWLU3EUnWBuyZqNBOrv1B1JA3byUDPUl9z4Ab3jeZG2eDdySlgNMg==}
|
||||
dependencies:
|
||||
'@types/node': 14.18.10
|
||||
'@types/node': 14.18.32
|
||||
dev: true
|
||||
|
||||
/@types/fs-extra/9.0.13:
|
||||
resolution: {integrity: sha512-nEnwB++1u5lVDM2UI4c1+5R+FYaKfaAzS4OococimjVm3nQw3TuzH5UNsocrcTBbhnerblyHj4A49qXbIiZdpA==}
|
||||
dependencies:
|
||||
'@types/node': 14.18.10
|
||||
'@types/node': 14.18.32
|
||||
dev: false
|
||||
|
||||
/@types/js-yaml/3.12.7:
|
||||
@ -212,14 +211,14 @@ packages:
|
||||
resolution: {integrity: sha512-FhpRzf927MNQdRZP0J5DLIdTXhjLYzeUTmLAu69mnVksLH9CJY3IuSeEgbKUki7GQZm0WqDkGzyxju2EZGD2wA==}
|
||||
dev: false
|
||||
|
||||
/@types/json-schema/7.0.9:
|
||||
resolution: {integrity: sha512-qcUXuemtEu+E5wZSJHNxUXeCZhAfXKQ41D+duX+VYPde7xyEVZci+/oXKJL13tnRs9lR2pr4fod59GT6/X1/yQ==}
|
||||
/@types/json-schema/7.0.11:
|
||||
resolution: {integrity: sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==}
|
||||
dev: true
|
||||
|
||||
/@types/node-fetch/2.5.12:
|
||||
resolution: {integrity: sha512-MKgC4dlq4kKNa/mYrwpKfzQMB5X3ee5U6fSprkKpToBqBmX4nFZL9cW5jl6sWn+xpRJ7ypWh2yyqqr8UUCstSw==}
|
||||
/@types/node-fetch/2.6.2:
|
||||
resolution: {integrity: sha512-DHqhlq5jeESLy19TYhLakJ07kNumXWjcDdxXsLUMJZ6ue8VZJj4kLPQVE/2mdHh3xZziNF1xppu5lwmS53HR+A==}
|
||||
dependencies:
|
||||
'@types/node': 14.18.10
|
||||
'@types/node': 14.18.32
|
||||
form-data: 3.0.1
|
||||
dev: false
|
||||
|
||||
@ -227,21 +226,21 @@ packages:
|
||||
resolution: {integrity: sha512-s3nugnZumCC//n4moGGe6tkNMyYEdaDBitVjwPxXmR5lnMG5dHePinH2EdxkG3Rh1ghFHHixAG4NJhpJW1rthQ==}
|
||||
dev: true
|
||||
|
||||
/@types/node/14.18.10:
|
||||
resolution: {integrity: sha512-6iihJ/Pp5fsFJ/aEDGyvT4pHGmCpq7ToQ/yf4bl5SbVAvwpspYJ+v3jO7n8UyjhQVHTy+KNszOozDdv+O6sovQ==}
|
||||
/@types/node/14.18.32:
|
||||
resolution: {integrity: sha512-Y6S38pFr04yb13qqHf8uk1nHE3lXgQ30WZbv1mLliV9pt0NjvqdWttLcrOYLnXbOafknVYRHZGoMSpR9UwfYow==}
|
||||
|
||||
/@types/yargs-parser/20.2.1:
|
||||
resolution: {integrity: sha512-7tFImggNeNBVMsn0vLrpn1H1uPrUBdnARPTpZoitY37ZrdJREzf7I16tMrlK3hen349gr1NYh8CmZQa7CTG6Aw==}
|
||||
/@types/yargs-parser/21.0.0:
|
||||
resolution: {integrity: sha512-iO9ZQHkZxHn4mSakYV0vFHAVDyEOIJQrV2uZ06HxEPcx+mt8swXoZHIbaaJ2crJYFfErySgktuTZ3BeLz+XmFA==}
|
||||
dev: true
|
||||
|
||||
/@types/yargs/15.0.14:
|
||||
resolution: {integrity: sha512-yEJzHoxf6SyQGhBhIYGXQDSCkJjB6HohDShto7m8vaKg9Yp0Yn8+71J9eakh2bnPg6BfsH9PRMhiRTZnd4eXGQ==}
|
||||
dependencies:
|
||||
'@types/yargs-parser': 20.2.1
|
||||
'@types/yargs-parser': 21.0.0
|
||||
dev: true
|
||||
|
||||
/@vercel/ncc/0.27.0:
|
||||
resolution: {integrity: sha512-DllIJQapnU2YwewIhh/4dYesmMQw3h2cFtabECc/zSJHqUbNa0eJuEkRa6DXbZvh1YPWBtYQoPV17NlDpBw1Vw==}
|
||||
/@vercel/ncc/0.33.4:
|
||||
resolution: {integrity: sha512-ln18hs7dMffelP47tpkaR+V5Tj6coykNyxJrlcmCormPqRQjB/Gv4cu2FfBG+PMzIfdZp2CLDsrrB1NPU22Qhg==}
|
||||
hasBin: true
|
||||
dev: true
|
||||
|
||||
@ -253,8 +252,8 @@ packages:
|
||||
json-schema-traverse: 0.4.1
|
||||
uri-js: 4.4.1
|
||||
|
||||
/ansi-regex/4.1.0:
|
||||
resolution: {integrity: sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==}
|
||||
/ansi-regex/4.1.1:
|
||||
resolution: {integrity: sha512-ILlv4k/3f6vfQ4OoP2AGvirOktlQ98ZEL1k9FaQjxa3L1abBgbuTDAdPOpvbGncC0BTVQrl+OM8xZGK6tWXt7g==}
|
||||
engines: {node: '>=6'}
|
||||
dev: true
|
||||
|
||||
@ -288,12 +287,7 @@ packages:
|
||||
dev: false
|
||||
|
||||
/asynckit/0.4.0:
|
||||
resolution: {integrity: sha1-x57Zf380y48robyXkLzDZkdLS3k=}
|
||||
dev: false
|
||||
|
||||
/at-least-node/1.0.0:
|
||||
resolution: {integrity: sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==}
|
||||
engines: {node: '>= 4.0.0'}
|
||||
resolution: {integrity: sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==}
|
||||
dev: false
|
||||
|
||||
/balanced-match/1.0.2:
|
||||
@ -349,7 +343,7 @@ packages:
|
||||
dev: true
|
||||
|
||||
/color-name/1.1.3:
|
||||
resolution: {integrity: sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=}
|
||||
resolution: {integrity: sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==}
|
||||
dev: true
|
||||
|
||||
/color-name/1.1.4:
|
||||
@ -364,16 +358,16 @@ packages:
|
||||
dev: false
|
||||
|
||||
/concat-map/0.0.1:
|
||||
resolution: {integrity: sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=}
|
||||
resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==}
|
||||
dev: true
|
||||
|
||||
/decamelize/1.2.0:
|
||||
resolution: {integrity: sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=}
|
||||
resolution: {integrity: sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA==}
|
||||
engines: {node: '>=0.10.0'}
|
||||
dev: true
|
||||
|
||||
/delayed-stream/1.0.0:
|
||||
resolution: {integrity: sha1-3zrhmayt+31ECqrgsp4icrJOxhk=}
|
||||
resolution: {integrity: sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==}
|
||||
engines: {node: '>=0.4.0'}
|
||||
dev: false
|
||||
|
||||
@ -394,12 +388,12 @@ packages:
|
||||
/exec-once/0.1.8:
|
||||
resolution: {integrity: sha512-zv8nmN+jF366nAEuNgOh5U2owy5MMkv+N1LCp1utCH63ujSXr92H3x2lDR+Mstm9xNmXNlo45W/Ch+TrN1jAdw==}
|
||||
dependencies:
|
||||
'@types/node': 14.18.10
|
||||
tslib: 2.3.1
|
||||
'@types/node': 14.18.32
|
||||
tslib: 2.4.0
|
||||
dev: true
|
||||
|
||||
/expand-tilde/2.0.2:
|
||||
resolution: {integrity: sha1-l+gBqgUt8CRU3kawK/YhZCzchQI=}
|
||||
resolution: {integrity: sha512-A5EmesHW6rfnZ9ysHQjPdJRni0SRar0tjtG5MNtm9n5TUvsYU8oozprtRD4AqHxcZWWlVuAmQo2nWKfN9oyjTw==}
|
||||
engines: {node: '>=0.10.0'}
|
||||
dependencies:
|
||||
homedir-polyfill: 1.0.3
|
||||
@ -414,8 +408,8 @@ packages:
|
||||
/fast-traverse/0.1.7:
|
||||
resolution: {integrity: sha512-gZTQvJSgrGV24F8AeeTNxip8OEkjRHwDDpGw0b51TzRVGjJsKzh6CuHf9ltVjJZzni5Ead+EEQJ0IFCuoCJUtA==}
|
||||
dependencies:
|
||||
'@types/node': 14.18.10
|
||||
tslib: 2.3.1
|
||||
'@types/node': 14.18.32
|
||||
tslib: 2.4.0
|
||||
dev: true
|
||||
|
||||
/find-up/3.0.0:
|
||||
@ -439,30 +433,29 @@ packages:
|
||||
dependencies:
|
||||
asynckit: 0.4.0
|
||||
combined-stream: 1.0.8
|
||||
mime-types: 2.1.34
|
||||
mime-types: 2.1.35
|
||||
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
|
||||
|
||||
/fs-extra/8.1.0:
|
||||
resolution: {integrity: sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==}
|
||||
engines: {node: '>=6 <7 || >=8'}
|
||||
dependencies:
|
||||
graceful-fs: 4.2.9
|
||||
graceful-fs: 4.2.10
|
||||
jsonfile: 4.0.0
|
||||
universalify: 0.1.2
|
||||
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:
|
||||
resolution: {integrity: sha1-FQStJSMVjKpA20onh8sBQRmU6k8=}
|
||||
resolution: {integrity: sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==}
|
||||
dev: true
|
||||
|
||||
/get-caller-file/2.0.5:
|
||||
@ -476,13 +469,13 @@ packages:
|
||||
fs.realpath: 1.0.0
|
||||
inflight: 1.0.6
|
||||
inherits: 2.0.4
|
||||
minimatch: 3.0.5
|
||||
minimatch: 3.1.2
|
||||
once: 1.4.0
|
||||
path-is-absolute: 1.0.1
|
||||
dev: true
|
||||
|
||||
/graceful-fs/4.2.9:
|
||||
resolution: {integrity: sha512-NtNxqUcXgpW2iMrfqSfR73Glt39K+BLwWsPs94yR63v45T0Wbej7eRmL5cWfwEgqXnmjQp3zaJTshdRW/qC2ZQ==}
|
||||
/graceful-fs/4.2.10:
|
||||
resolution: {integrity: sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==}
|
||||
|
||||
/homedir-polyfill/1.0.3:
|
||||
resolution: {integrity: sha512-eSmmWE5bZTK2Nou4g0AI3zZ9rswp7GRKoKXS1BLUkvPviOqs4YTN1djQIqrXy9k5gEtdLPy86JjRwsNM9tnDcA==}
|
||||
@ -492,7 +485,7 @@ packages:
|
||||
dev: false
|
||||
|
||||
/inflight/1.0.6:
|
||||
resolution: {integrity: sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=}
|
||||
resolution: {integrity: sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==}
|
||||
dependencies:
|
||||
once: 1.4.0
|
||||
wrappy: 1.0.2
|
||||
@ -503,7 +496,7 @@ packages:
|
||||
dev: true
|
||||
|
||||
/is-fullwidth-code-point/2.0.0:
|
||||
resolution: {integrity: sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=}
|
||||
resolution: {integrity: sha512-VHskAKYM8RfSFXwee5t5cbN5PZeq1Wrh6qd5bkyiXIf6UQcN6w/A0eXM9r6t8d+GYOh+o6ZhiEnb88LN/Y8m2w==}
|
||||
engines: {node: '>=4'}
|
||||
dev: true
|
||||
|
||||
@ -531,15 +524,15 @@ packages:
|
||||
resolution: {integrity: sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==}
|
||||
|
||||
/json-stable-stringify/1.0.1:
|
||||
resolution: {integrity: sha1-mnWdOcXy/1A/1TAGRu1EX4jE+a8=}
|
||||
resolution: {integrity: sha512-i/J297TW6xyj7sDFa7AmBPkQvLIxWr2kKPWI26tXydnZrzVAocNqn5DMNT1Mzk0vit1V5UkRM7C1KdVNp7Lmcg==}
|
||||
dependencies:
|
||||
jsonify: 0.0.0
|
||||
jsonify: 0.0.1
|
||||
dev: true
|
||||
|
||||
/jsonfile/4.0.0:
|
||||
resolution: {integrity: sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=}
|
||||
resolution: {integrity: sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==}
|
||||
optionalDependencies:
|
||||
graceful-fs: 4.2.9
|
||||
graceful-fs: 4.2.10
|
||||
dev: true
|
||||
|
||||
/jsonfile/6.1.0:
|
||||
@ -547,11 +540,11 @@ packages:
|
||||
dependencies:
|
||||
universalify: 2.0.0
|
||||
optionalDependencies:
|
||||
graceful-fs: 4.2.9
|
||||
graceful-fs: 4.2.10
|
||||
dev: false
|
||||
|
||||
/jsonify/0.0.0:
|
||||
resolution: {integrity: sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM=}
|
||||
/jsonify/0.0.1:
|
||||
resolution: {integrity: sha512-2/Ki0GcmuqSrgFyelQq9M05y7PS0mEwuIzrf3f1fPqkVDVRvZrPZtVSMHxdgo8Aq0sxAOb/cr2aqqA3LeWHVPg==}
|
||||
dev: true
|
||||
|
||||
/locate-path/3.0.0:
|
||||
@ -569,38 +562,26 @@ packages:
|
||||
p-locate: 4.1.0
|
||||
dev: true
|
||||
|
||||
/mime-db/1.51.0:
|
||||
resolution: {integrity: sha512-5y8A56jg7XVQx2mbv1lu49NR4dokRnhZYTtL+KGfaa27uq4pSTXkwQkFJl4pkRMyNFz/EtYDSkiiEHx3F7UN6g==}
|
||||
/mime-db/1.52.0:
|
||||
resolution: {integrity: sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==}
|
||||
engines: {node: '>= 0.6'}
|
||||
dev: false
|
||||
|
||||
/mime-types/2.1.34:
|
||||
resolution: {integrity: sha512-6cP692WwGIs9XXdOO4++N+7qjqv0rqxxVvJ3VHPh/Sc9mVZcQP+ZGhkKiTvWMQRr2tbHkJP/Yn7Y0npb3ZBs4A==}
|
||||
/mime-types/2.1.35:
|
||||
resolution: {integrity: sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==}
|
||||
engines: {node: '>= 0.6'}
|
||||
dependencies:
|
||||
mime-db: 1.51.0
|
||||
mime-db: 1.52.0
|
||||
dev: false
|
||||
|
||||
/minimatch/3.0.5:
|
||||
resolution: {integrity: sha512-tUpxzX0VAzJHjLu0xUfFv1gwVp9ba3IOuRAVH2EGuRW8a5emA2FlACLqiT/lDVtS1W+TGNwqz3sWaNyLgDJWuw==}
|
||||
/minimatch/3.1.2:
|
||||
resolution: {integrity: sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==}
|
||||
dependencies:
|
||||
brace-expansion: 1.1.11
|
||||
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:
|
||||
resolution: {integrity: sha1-WDsap3WWHUsROsF9nFC6753Xa9E=}
|
||||
resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==}
|
||||
dependencies:
|
||||
wrappy: 1.0.2
|
||||
dev: true
|
||||
@ -632,12 +613,12 @@ packages:
|
||||
dev: true
|
||||
|
||||
/parse-passwd/1.0.0:
|
||||
resolution: {integrity: sha1-bVuTSkVpk7I9N/QKOC1vFmao5cY=}
|
||||
resolution: {integrity: sha512-1Y1A//QUXEZK7YKz+rD9WydcE1+EuPr6ZBgKecAB8tmoW6UFv0NREVJe1p+jRxtThkcbbKkfwIbWJe/IeE6m2Q==}
|
||||
engines: {node: '>=0.10.0'}
|
||||
dev: false
|
||||
|
||||
/path-exists/3.0.0:
|
||||
resolution: {integrity: sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=}
|
||||
resolution: {integrity: sha512-bpC7GYwiDYQ4wYLe+FA8lhRjhQCMcQGuSgGGqDkg/QerRWw9CmGRT0iSOVRSZJ29NMLZgIzqaljJ63oaL4NIJQ==}
|
||||
engines: {node: '>=4'}
|
||||
dev: true
|
||||
|
||||
@ -647,7 +628,7 @@ packages:
|
||||
dev: true
|
||||
|
||||
/path-is-absolute/1.0.1:
|
||||
resolution: {integrity: sha1-F0uSaHNVNP+8es5r9TpanhtcX18=}
|
||||
resolution: {integrity: sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==}
|
||||
engines: {node: '>=0.10.0'}
|
||||
dev: true
|
||||
|
||||
@ -656,7 +637,7 @@ packages:
|
||||
engines: {node: '>=6'}
|
||||
|
||||
/require-directory/2.1.1:
|
||||
resolution: {integrity: sha1-jGStX9MNqxyXbiNE/+f3kqam30I=}
|
||||
resolution: {integrity: sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==}
|
||||
engines: {node: '>=0.10.0'}
|
||||
dev: true
|
||||
|
||||
@ -665,11 +646,11 @@ packages:
|
||||
dev: true
|
||||
|
||||
/set-blocking/2.0.0:
|
||||
resolution: {integrity: sha1-BF+XgtARrppoA93TgrJDkrPYkPc=}
|
||||
resolution: {integrity: sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==}
|
||||
dev: true
|
||||
|
||||
/sprintf-js/1.0.3:
|
||||
resolution: {integrity: sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=}
|
||||
resolution: {integrity: sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==}
|
||||
dev: true
|
||||
|
||||
/string-width/3.1.0:
|
||||
@ -694,7 +675,7 @@ packages:
|
||||
resolution: {integrity: sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==}
|
||||
engines: {node: '>=6'}
|
||||
dependencies:
|
||||
ansi-regex: 4.1.0
|
||||
ansi-regex: 4.1.1
|
||||
dev: true
|
||||
|
||||
/strip-ansi/6.0.1:
|
||||
@ -704,16 +685,12 @@ packages:
|
||||
ansi-regex: 5.0.1
|
||||
dev: true
|
||||
|
||||
/tr46/0.0.3:
|
||||
resolution: {integrity: sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o=}
|
||||
dev: false
|
||||
|
||||
/tslib/1.14.1:
|
||||
resolution: {integrity: sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==}
|
||||
dev: true
|
||||
|
||||
/tslib/2.3.1:
|
||||
resolution: {integrity: sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw==}
|
||||
/tslib/2.4.0:
|
||||
resolution: {integrity: sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==}
|
||||
dev: true
|
||||
|
||||
/tunnel/0.0.6:
|
||||
@ -725,7 +702,7 @@ packages:
|
||||
resolution: {integrity: sha512-9WO+lVmlph7Ecb7lPd9tU84XFUQh44kpAf3cWe/Ym4G5EKw/SS6XGpi1DZDthvxqkIdNSDlWi7FhKfxuIV/3yw==}
|
||||
hasBin: true
|
||||
dependencies:
|
||||
'@types/json-schema': 7.0.9
|
||||
'@types/json-schema': 7.0.11
|
||||
glob: 7.1.7
|
||||
json-stable-stringify: 1.0.1
|
||||
typescript: 3.9.10
|
||||
@ -738,8 +715,8 @@ packages:
|
||||
hasBin: true
|
||||
dev: true
|
||||
|
||||
/typescript/4.5.5:
|
||||
resolution: {integrity: sha512-TCTIul70LyWe6IJWT8QSYeA54WQe8EjQFU4wY52Fasj5UKx88LNYKCgBEHcOMOrFF1rKGbD8v/xcNWVUq9SymA==}
|
||||
/typescript/4.8.4:
|
||||
resolution: {integrity: sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ==}
|
||||
engines: {node: '>=4.2.0'}
|
||||
hasBin: true
|
||||
dev: true
|
||||
@ -764,19 +741,13 @@ packages:
|
||||
engines: {node: '>= 4'}
|
||||
dev: true
|
||||
|
||||
/webidl-conversions/3.0.1:
|
||||
resolution: {integrity: sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE=}
|
||||
dev: false
|
||||
|
||||
/whatwg-url/5.0.0:
|
||||
resolution: {integrity: sha1-lmRU6HZUYuN2RNNib2dCzotwll0=}
|
||||
dependencies:
|
||||
tr46: 0.0.3
|
||||
webidl-conversions: 3.0.1
|
||||
/uuid/8.3.2:
|
||||
resolution: {integrity: sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==}
|
||||
hasBin: true
|
||||
dev: false
|
||||
|
||||
/which-module/2.0.0:
|
||||
resolution: {integrity: sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=}
|
||||
resolution: {integrity: sha512-B+enWhmw6cjfVC7kS8Pj9pCrKSc5txArRyaYGe088shv/FGWH+0Rjx/xPgtsWfsUtS27FkP697E4DDhgrgoc0Q==}
|
||||
dev: true
|
||||
|
||||
/wrap-ansi/5.1.0:
|
||||
@ -798,7 +769,7 @@ packages:
|
||||
dev: true
|
||||
|
||||
/wrappy/1.0.2:
|
||||
resolution: {integrity: sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=}
|
||||
resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==}
|
||||
dev: true
|
||||
|
||||
/y18n/4.0.3:
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { setFailed, saveState, getState } from '@actions/core'
|
||||
import getInputs from './inputs'
|
||||
import setOutputs from './outputs'
|
||||
import installPnpm from './install-pnpm'
|
||||
import setOutputs from './outputs'
|
||||
import pnpmInstall from './pnpm-install'
|
||||
import pruneStore from './pnpm-store-prune'
|
||||
|
||||
|
@ -3,7 +3,7 @@ import expandTilde from 'expand-tilde'
|
||||
import { RunInstall, parseRunInstall } from './run-install'
|
||||
|
||||
export interface Inputs {
|
||||
readonly version: string
|
||||
readonly version?: string
|
||||
readonly dest: string
|
||||
readonly runInstall: RunInstall[]
|
||||
}
|
||||
@ -15,7 +15,7 @@ const options: InputOptions = {
|
||||
const parseInputPath = (name: string) => expandTilde(getInput(name, options))
|
||||
|
||||
export const getInputs = (): Inputs => ({
|
||||
version: getInput('version', options),
|
||||
version: getInput('version'),
|
||||
dest: parseInputPath('dest'),
|
||||
runInstall: parseRunInstall('run_install'),
|
||||
})
|
||||
|
@ -1,7 +1,7 @@
|
||||
import process from 'process'
|
||||
import { load } from 'js-yaml'
|
||||
import Ajv from 'ajv'
|
||||
import { getInput, error, InputOptions } from '@actions/core'
|
||||
import Ajv from 'ajv'
|
||||
import { load } from 'js-yaml'
|
||||
import process from 'process'
|
||||
import runInstallSchema from './run-install-input.schema.json'
|
||||
|
||||
export interface RunInstall {
|
||||
|
134031
src/install-pnpm/pnpm.js
Normal file
134031
src/install-pnpm/pnpm.js
Normal file
File diff suppressed because one or more lines are too long
@ -1,38 +1,61 @@
|
||||
import * as core from '@actions/core'
|
||||
import { addPath, exportVariable } from '@actions/core'
|
||||
import { spawn } from 'child_process'
|
||||
import { remove, ensureFile, writeFile, readFile } from 'fs-extra'
|
||||
import path from 'path'
|
||||
import { execPath } from 'process'
|
||||
import { join } from 'path'
|
||||
import { remove, ensureFile, writeFile } from 'fs-extra'
|
||||
import fetch from 'node-fetch'
|
||||
import { Inputs } from '../inputs'
|
||||
|
||||
export async function runSelfInstaller(inputs: Inputs): Promise<number> {
|
||||
const { version, dest } = inputs
|
||||
const target = version ? `pnpm@${version}` : 'pnpm'
|
||||
const pkgJson = join(dest, 'package.json')
|
||||
|
||||
// prepare self install
|
||||
await remove(dest)
|
||||
const pkgJson = path.join(dest, 'package.json')
|
||||
await ensureFile(pkgJson)
|
||||
await writeFile(pkgJson, JSON.stringify({ private: true }))
|
||||
|
||||
const cp = spawn(execPath, ['-', 'install', target, '--no-lockfile'], {
|
||||
// prepare target pnpm
|
||||
const target = await readTarget(version)
|
||||
const cp = spawn(execPath, [path.join(__dirname, 'pnpm.js'), 'install', target, '--no-lockfile'], {
|
||||
cwd: dest,
|
||||
stdio: ['pipe', 'inherit', 'inherit'],
|
||||
})
|
||||
|
||||
const response = await fetch('https://pnpm.js.org/pnpm.js')
|
||||
response.body.pipe(cp.stdin)
|
||||
|
||||
const result = await new Promise<number>((resolve, reject) => {
|
||||
const exitCode = await new Promise<number>((resolve, reject) => {
|
||||
cp.on('error', reject)
|
||||
cp.on('close', resolve)
|
||||
})
|
||||
if (result === 0) {
|
||||
const pnpmHome = join(dest, 'node_modules/.bin')
|
||||
core.addPath(pnpmHome)
|
||||
core.exportVariable('PNPM_HOME_PATH', pnpmHome)
|
||||
if (exitCode === 0) {
|
||||
const pnpmHome = path.join(dest, 'node_modules/.bin')
|
||||
addPath(pnpmHome)
|
||||
exportVariable('PNPM_HOME', pnpmHome)
|
||||
}
|
||||
return result
|
||||
return exitCode
|
||||
}
|
||||
|
||||
async function readTarget(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, 'package.json'), '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" (See https://nodejs.org/api/corepack.html)`)
|
||||
}
|
||||
|
||||
if (!packageManager.startsWith('pnpm@')) {
|
||||
throw new Error('Invalid packageManager field in package.json')
|
||||
}
|
||||
return packageManager
|
||||
}
|
||||
|
||||
export default runSelfInstaller
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { spawnSync } from 'child_process'
|
||||
import { setFailed, startGroup, endGroup } from '@actions/core'
|
||||
import { spawnSync } from 'child_process'
|
||||
import { Inputs } from '../inputs'
|
||||
import { patchPnpmEnv } from '../utils'
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { spawnSync } from 'child_process'
|
||||
import { warning, startGroup, endGroup } from '@actions/core'
|
||||
import { spawnSync } from 'child_process'
|
||||
import { Inputs } from '../inputs'
|
||||
import { patchPnpmEnv } from '../utils'
|
||||
|
||||
@ -13,7 +13,7 @@ export function pruneStore(inputs: Inputs) {
|
||||
const { error, status } = spawnSync('pnpm', ['store', 'prune'], {
|
||||
stdio: 'inherit',
|
||||
shell: true,
|
||||
env: patchPnpmEnv(inputs)
|
||||
env: patchPnpmEnv(inputs),
|
||||
})
|
||||
endGroup()
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
import process from 'process'
|
||||
import path from 'path'
|
||||
import process from 'process'
|
||||
import { Inputs } from '../inputs'
|
||||
|
||||
export const getBinDest = (inputs: Inputs): string => path.join(inputs.dest, 'node_modules', '.bin')
|
||||
|
||||
export const patchPnpmEnv = (inputs: Inputs): NodeJS.ProcessEnv => ({
|
||||
...process.env,
|
||||
PATH: getBinDest(inputs) + path.delimiter + process.env.PATH
|
||||
PATH: getBinDest(inputs) + path.delimiter + process.env.PATH,
|
||||
})
|
||||
|
Reference in New Issue
Block a user