mirror of
https://github.com/pnpm/action-setup.git
synced 2025-07-08 04:49:14 +08:00
Compare commits
18 Commits
Author | SHA1 | Date | |
---|---|---|---|
646cdf4821 | |||
a1ba6cf5ae | |||
41b381a08b | |||
3236b209b5 | |||
2124926520 | |||
ba9826e81c | |||
7c4472dbcf | |||
0db7fb9961 | |||
aefcd1e623 | |||
b7b9d6344b | |||
7e61ea5847 | |||
3a2c7247e1 | |||
2a105263a5 | |||
9facd4db8e | |||
6c1466d327 | |||
b26427e53e | |||
086f5bd3b6 | |||
bdb2a5ee76 |
10
.github/dependabot.yml
vendored
Normal file
10
.github/dependabot.yml
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: github-actions
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: weekly
|
||||
open-pull-requests-limit: 10
|
||||
labels:
|
||||
- dependabot
|
||||
- github-actions
|
2
.github/workflows/test.yaml
vendored
2
.github/workflows/test.yaml
vendored
@ -58,8 +58,6 @@ jobs:
|
||||
with:
|
||||
version: 4.11.1
|
||||
dest: ~/test/pnpm
|
||||
bin_dest: ~/test/pnpm/.bin
|
||||
registry: http://registry.yarnpkg.com/
|
||||
|
||||
- name: 'Test: which'
|
||||
run: which pnpm && which pnpx
|
||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -8,3 +8,4 @@ temp
|
||||
*.temp
|
||||
tmp.*
|
||||
temp.*
|
||||
.pnpm-store
|
||||
|
62
README.md
62
README.md
@ -1,24 +1,16 @@
|
||||
# Setup PNPM
|
||||
# Setup pnpm
|
||||
|
||||
Install PNPM package manager.
|
||||
Install pnpm package manager.
|
||||
|
||||
## Inputs
|
||||
|
||||
### `version`
|
||||
|
||||
**Required** Version of PNPM to install.
|
||||
**Required** Version of pnpm to install.
|
||||
|
||||
### `dest`
|
||||
|
||||
**Optional** Where to store PNPM files.
|
||||
|
||||
### `bin_dest`
|
||||
|
||||
**Optional** Where to store executables (`pnpm` and `pnpx` commands).
|
||||
|
||||
### `registry`
|
||||
|
||||
**Optional** (_default:_ `https://registry.npmjs.com`) Registry to download PNPM from.
|
||||
**Optional** Where to store pnpm files.
|
||||
|
||||
### `run_install`
|
||||
|
||||
@ -50,11 +42,11 @@ Expanded path of inputs#dest.
|
||||
|
||||
### `bin_dest`
|
||||
|
||||
Expanded path of inputs#bin_dest.
|
||||
Location of `pnpm` and `pnpx` command.
|
||||
|
||||
## Usage example
|
||||
|
||||
### Just install PNPM
|
||||
### Just install pnpm
|
||||
|
||||
```yaml
|
||||
on:
|
||||
@ -65,12 +57,12 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: pnpm/action-setup@v1.2.0
|
||||
- uses: pnpm/action-setup@v2.0.1
|
||||
with:
|
||||
version: 4.11.1
|
||||
version: 6.0.2
|
||||
```
|
||||
|
||||
### Install PNPM and a few NPM packages
|
||||
### Install pnpm and a few npm packages
|
||||
|
||||
```yaml
|
||||
on:
|
||||
@ -83,15 +75,47 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- uses: pnpm/action-setup@v1.2.0
|
||||
- uses: pnpm/action-setup@v2.0.1
|
||||
with:
|
||||
version: 4.11.1
|
||||
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
|
||||
|
||||
```yaml
|
||||
on:
|
||||
- push
|
||||
- pull_request
|
||||
|
||||
jobs:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
build:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Cache pnpm modules
|
||||
uses: actions/cache@v2
|
||||
env:
|
||||
cache-name: cache-pnpm-modules
|
||||
with:
|
||||
path: ~/.pnpm-store
|
||||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ matrix.node-version }}-${{ hashFiles('**/package.json') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-build-${{ env.cache-name }}-${{ matrix.node-version }}-
|
||||
|
||||
- uses: pnpm/action-setup@v2.0.1
|
||||
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.
|
||||
|
||||
## Notes
|
||||
|
||||
This action does not setup Node.js for you, use [actions/setup-node](https://github.com/actions/setup-node) yourself.
|
||||
|
@ -11,14 +11,6 @@ inputs:
|
||||
description: Where to store PNPM files
|
||||
required: false
|
||||
default: ~/setup-pnpm
|
||||
bin_dest:
|
||||
description: Where to store executables (pnpm and pnpx commands)
|
||||
required: false
|
||||
default: ~/setup-pnpm/.bin
|
||||
registry:
|
||||
description: Registry to download PNPM from
|
||||
required: false
|
||||
default: https://registry.npmjs.com
|
||||
run_install:
|
||||
description: If specified, run `pnpm install`
|
||||
required: false
|
||||
|
2
dist/index.js
vendored
2
dist/index.js
vendored
File diff suppressed because one or more lines are too long
14
package.json
14
package.json
@ -9,17 +9,19 @@
|
||||
"dependencies": {
|
||||
"node-fetch": "^2.6.1",
|
||||
"expand-tilde": "^2.0.2",
|
||||
"js-yaml": "^3.14.0",
|
||||
"js-yaml": "^4.0.0",
|
||||
"ajv": "^6.12.5",
|
||||
"fs-extra": "^9.1.0",
|
||||
"@actions/core": "^1.2.6",
|
||||
"@types/expand-tilde": "^2.0.0",
|
||||
"@types/node-fetch": "^2.5.7",
|
||||
"@types/js-yaml": "^3.12.5",
|
||||
"@types/node": "^14.11.2"
|
||||
"@types/node-fetch": "^2.5.8",
|
||||
"@types/js-yaml": "^4.0.0",
|
||||
"@types/fs-extra": "^9.0.8",
|
||||
"@types/node": "^14.14.35"
|
||||
},
|
||||
"devDependencies": {
|
||||
"typescript": "^4.0.3",
|
||||
"typescript": "^4.2.3",
|
||||
"@ts-schema-autogen/cli": "^0.1.2",
|
||||
"@zeit/ncc": "^0.22.3"
|
||||
"@vercel/ncc": "^0.27.0"
|
||||
}
|
||||
}
|
||||
|
112
pnpm-lock.yaml
generated
112
pnpm-lock.yaml
generated
@ -1,18 +1,20 @@
|
||||
dependencies:
|
||||
'@actions/core': 1.2.6
|
||||
'@types/expand-tilde': 2.0.0
|
||||
'@types/js-yaml': 3.12.5
|
||||
'@types/node': 14.11.2
|
||||
'@types/node-fetch': 2.5.7
|
||||
ajv: 6.12.5
|
||||
'@types/fs-extra': 9.0.8
|
||||
'@types/js-yaml': 4.0.0
|
||||
'@types/node': 14.14.35
|
||||
'@types/node-fetch': 2.5.8
|
||||
ajv: 6.12.6
|
||||
expand-tilde: 2.0.2
|
||||
js-yaml: 3.14.0
|
||||
fs-extra: 9.1.0
|
||||
js-yaml: 4.0.0
|
||||
node-fetch: 2.6.1
|
||||
devDependencies:
|
||||
'@ts-schema-autogen/cli': 0.1.2
|
||||
'@zeit/ncc': 0.22.3
|
||||
typescript: 4.0.3
|
||||
lockfileVersion: 5.1
|
||||
'@vercel/ncc': 0.27.0
|
||||
typescript: 4.2.3
|
||||
lockfileVersion: 5.2
|
||||
packages:
|
||||
/@actions/core/1.2.6:
|
||||
dev: false
|
||||
@ -175,32 +177,39 @@ packages:
|
||||
dev: true
|
||||
resolution:
|
||||
integrity: sha512-UoOfVEzAUpeSPmjm7h1uk5MH6KZma2z2O7a75onTGjnNvAvMVrPzPL/vBbT65iIGHWj6rokwfmYcmxmlSf2uwg==
|
||||
/@types/fs-extra/9.0.8:
|
||||
dependencies:
|
||||
'@types/node': 14.14.35
|
||||
dev: false
|
||||
resolution:
|
||||
integrity: sha512-bnlTVTwq03Na7DpWxFJ1dvnORob+Otb8xHyUqUWhqvz/Ksg8+JXPlR52oeMSZ37YEOa5PyccbgUNutiQdi13TA==
|
||||
/@types/js-yaml/3.12.3:
|
||||
dev: true
|
||||
resolution:
|
||||
integrity: sha512-otRe77JNNWzoVGLKw8TCspKswRoQToys4tuL6XYVBFxjgeM0RUrx7m3jkaTdxILxeGry3zM8mGYkGXMeQ02guA==
|
||||
/@types/js-yaml/3.12.5:
|
||||
/@types/js-yaml/4.0.0:
|
||||
dev: false
|
||||
resolution:
|
||||
integrity: sha512-JCcp6J0GV66Y4ZMDAQCXot4xprYB+Zfd3meK9+INSJeVZwJmHAW30BBEEkPzXswMXuiyReUGOP3GxrADc9wPww==
|
||||
integrity: sha512-4vlpCM5KPCL5CfGmTbpjwVKbISRYhduEJvvUWsH5EB7QInhEj94XPZ3ts/9FPiLZFqYO0xoW4ZL8z2AabTGgJA==
|
||||
/@types/json-schema/7.0.4:
|
||||
dev: true
|
||||
resolution:
|
||||
integrity: sha512-8+KAKzEvSUdeo+kmqnKrqgeE+LcA0tjYWFY7RPProVYwnqDjukzO+3b6dLD56rYX5TdWejnEOLJYOIeh4CXKuA==
|
||||
/@types/node-fetch/2.5.7:
|
||||
/@types/node-fetch/2.5.8:
|
||||
dependencies:
|
||||
'@types/node': 13.13.5
|
||||
'@types/node': 14.14.35
|
||||
form-data: 3.0.0
|
||||
dev: false
|
||||
resolution:
|
||||
integrity: sha512-o2WVNf5UhWRkxlf6eq+jMZDu7kjgpgJfl4xVNlvryc95O/6F2ld8ztKX+qu+Rjyet93WAWm5LjeX9H5FGkODvw==
|
||||
integrity: sha512-fbjI6ja0N5ZA8TV53RUqzsKNkl9fv8Oj3T7zxW7FGv1GSH7gwJaNF8dzCjrqKaxKeUpTz4yT1DaJFq/omNpGfw==
|
||||
/@types/node/13.13.5:
|
||||
dev: true
|
||||
resolution:
|
||||
integrity: sha512-3ySmiBYJPqgjiHA7oEaIo2Rzz0HrOZ7yrNO5HWyaE5q0lQ3BppDZ3N53Miz8bw2I7gh1/zir2MGVZBvpb1zq9g==
|
||||
/@types/node/14.11.2:
|
||||
/@types/node/14.14.35:
|
||||
dev: false
|
||||
resolution:
|
||||
integrity: sha512-jiE3QIxJ8JLNcb1Ps6rDbysDhN4xa8DJJvuC9prr6w+1tIh+QAbYyNF3tyiZNLDBIuBCf4KEcV2UvQm/V60xfA==
|
||||
integrity: sha512-Lt+wj8NVPx0zUmUwumiVXapmaLUcAk3yPuHCFVXras9k5VT9TdhJqKqGVUQCD60OTMCl0qxJ57OiTL0Mic3Iag==
|
||||
/@types/yargs-parser/15.0.0:
|
||||
dev: true
|
||||
resolution:
|
||||
@ -211,12 +220,11 @@ packages:
|
||||
dev: true
|
||||
resolution:
|
||||
integrity: sha512-9T1auFmbPZoxHz0enUFlUuKRy3it01R+hlggyVUMtnCTQRunsQYifnSGb8hET4Xo8yiC0o0r1paW3ud5+rbURg==
|
||||
/@zeit/ncc/0.22.3:
|
||||
deprecated: '@zeit/ncc is no longer maintained. Please use @vercel/ncc instead.'
|
||||
/@vercel/ncc/0.27.0:
|
||||
dev: true
|
||||
hasBin: true
|
||||
resolution:
|
||||
integrity: sha512-jnCLpLXWuw/PAiJiVbLjA8WBC0IJQbFeUwF4I9M+23MvIxTxk5pD4Q8byQBSPmHQjz5aBoA7AKAElQxMpjrCLQ==
|
||||
integrity: sha512-DllIJQapnU2YwewIhh/4dYesmMQw3h2cFtabECc/zSJHqUbNa0eJuEkRa6DXbZvh1YPWBtYQoPV17NlDpBw1Vw==
|
||||
/ajv/6.12.0:
|
||||
dependencies:
|
||||
fast-deep-equal: 3.1.1
|
||||
@ -226,7 +234,7 @@ packages:
|
||||
dev: true
|
||||
resolution:
|
||||
integrity: sha512-D6gFiFA0RRLyUbvijN74DWAjXSFxWKaWP7mldxkVhyhAV3+SWA9HEJPHQ2c9soIeTFJqcSdFDGFgdqs1iUU2Hw==
|
||||
/ajv/6.12.5:
|
||||
/ajv/6.12.6:
|
||||
dependencies:
|
||||
fast-deep-equal: 3.1.1
|
||||
fast-json-stable-stringify: 2.1.0
|
||||
@ -234,7 +242,7 @@ packages:
|
||||
uri-js: 4.2.2
|
||||
dev: false
|
||||
resolution:
|
||||
integrity: sha512-lRF8RORchjpKG50/WFf8xmg7sgCLFiYNNnqdKflk63whMQcWR5ngGjiSXkL9bjxy6B2npOK2HSMN49jEBMSkag==
|
||||
integrity: sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==
|
||||
/ansi-regex/4.1.0:
|
||||
dev: true
|
||||
engines:
|
||||
@ -267,12 +275,23 @@ packages:
|
||||
/argparse/1.0.10:
|
||||
dependencies:
|
||||
sprintf-js: 1.0.3
|
||||
dev: true
|
||||
resolution:
|
||||
integrity: sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==
|
||||
/argparse/2.0.1:
|
||||
dev: false
|
||||
resolution:
|
||||
integrity: sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==
|
||||
/asynckit/0.4.0:
|
||||
dev: false
|
||||
resolution:
|
||||
integrity: sha1-x57Zf380y48robyXkLzDZkdLS3k=
|
||||
/at-least-node/1.0.0:
|
||||
dev: false
|
||||
engines:
|
||||
node: '>= 4.0.0'
|
||||
resolution:
|
||||
integrity: sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==
|
||||
/balanced-match/1.0.0:
|
||||
dev: true
|
||||
resolution:
|
||||
@ -368,6 +387,7 @@ packages:
|
||||
resolution:
|
||||
integrity: sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==
|
||||
/esprima/4.0.1:
|
||||
dev: true
|
||||
engines:
|
||||
node: '>=4'
|
||||
hasBin: true
|
||||
@ -438,6 +458,17 @@ packages:
|
||||
node: '>=6 <7 || >=8'
|
||||
resolution:
|
||||
integrity: sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==
|
||||
/fs-extra/9.1.0:
|
||||
dependencies:
|
||||
at-least-node: 1.0.0
|
||||
graceful-fs: 4.2.3
|
||||
jsonfile: 6.1.0
|
||||
universalify: 2.0.0
|
||||
dev: false
|
||||
engines:
|
||||
node: '>=10'
|
||||
resolution:
|
||||
integrity: sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==
|
||||
/fs.realpath/1.0.0:
|
||||
dev: true
|
||||
resolution:
|
||||
@ -460,7 +491,6 @@ packages:
|
||||
resolution:
|
||||
integrity: sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==
|
||||
/graceful-fs/4.2.3:
|
||||
dev: true
|
||||
resolution:
|
||||
integrity: sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ==
|
||||
/homedir-polyfill/1.0.3:
|
||||
@ -502,14 +532,13 @@ packages:
|
||||
hasBin: true
|
||||
resolution:
|
||||
integrity: sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==
|
||||
/js-yaml/3.14.0:
|
||||
/js-yaml/4.0.0:
|
||||
dependencies:
|
||||
argparse: 1.0.10
|
||||
esprima: 4.0.1
|
||||
argparse: 2.0.1
|
||||
dev: false
|
||||
hasBin: true
|
||||
resolution:
|
||||
integrity: sha512-/4IbIeHcD9VMHFqDR/gQ7EdZdLimOvW2DdcxFjdyyZ9NsbS+ccrXqVWDtab/lRl5AlUqmpBx8EhPaWR+OtY17A==
|
||||
integrity: sha512-pqon0s+4ScYUvX30wxQi3PogGFAlUyH0awepWvwkj4jD4v+ova3RiYw8bmA6x2rDrEaj8i/oWKoRxpVNW+Re8Q==
|
||||
/json-schema-traverse/0.4.1:
|
||||
resolution:
|
||||
integrity: sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==
|
||||
@ -525,6 +554,14 @@ packages:
|
||||
graceful-fs: 4.2.3
|
||||
resolution:
|
||||
integrity: sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=
|
||||
/jsonfile/6.1.0:
|
||||
dependencies:
|
||||
universalify: 2.0.0
|
||||
dev: false
|
||||
optionalDependencies:
|
||||
graceful-fs: 4.2.3
|
||||
resolution:
|
||||
integrity: sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==
|
||||
/jsonify/0.0.0:
|
||||
dev: true
|
||||
resolution:
|
||||
@ -652,6 +689,7 @@ packages:
|
||||
resolution:
|
||||
integrity: sha1-BF+XgtARrppoA93TgrJDkrPYkPc=
|
||||
/sprintf-js/1.0.3:
|
||||
dev: true
|
||||
resolution:
|
||||
integrity: sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=
|
||||
/string-width/3.1.0:
|
||||
@ -712,19 +750,25 @@ packages:
|
||||
hasBin: true
|
||||
resolution:
|
||||
integrity: sha512-MYlEfn5VrLNsgudQTVJeNaQFUAI7DkhnOjdpAp4T+ku1TfQClewlbSuTVHiA+8skNBgaf02TL/kLOvig4y3G8w==
|
||||
/typescript/4.0.3:
|
||||
/typescript/4.2.3:
|
||||
dev: true
|
||||
engines:
|
||||
node: '>=4.2.0'
|
||||
hasBin: true
|
||||
resolution:
|
||||
integrity: sha512-tEu6DGxGgRJPb/mVPIZ48e69xCn2yRmCgYmDugAVwmJ6o+0u1RI18eO7E7WBTLYLaEVVOhwQmcdhQHweux/WPg==
|
||||
integrity: sha512-qOcYwxaByStAWrBf4x0fibwZvMRG+r4cQoTjbPtUlrWjBHbmCAww1i448U0GJ+3cNNEtebDteo/cHOR3xJ4wEw==
|
||||
/universalify/0.1.2:
|
||||
dev: true
|
||||
engines:
|
||||
node: '>= 4.0.0'
|
||||
resolution:
|
||||
integrity: sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==
|
||||
/universalify/2.0.0:
|
||||
dev: false
|
||||
engines:
|
||||
node: '>= 10.0.0'
|
||||
resolution:
|
||||
integrity: sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==
|
||||
/uri-js/4.2.2:
|
||||
dependencies:
|
||||
punycode: 2.1.1
|
||||
@ -822,12 +866,14 @@ specifiers:
|
||||
'@actions/core': ^1.2.6
|
||||
'@ts-schema-autogen/cli': ^0.1.2
|
||||
'@types/expand-tilde': ^2.0.0
|
||||
'@types/js-yaml': ^3.12.5
|
||||
'@types/node': ^14.11.2
|
||||
'@types/node-fetch': ^2.5.7
|
||||
'@zeit/ncc': ^0.22.3
|
||||
'@types/fs-extra': ^9.0.8
|
||||
'@types/js-yaml': ^4.0.0
|
||||
'@types/node': ^14.14.35
|
||||
'@types/node-fetch': ^2.5.8
|
||||
'@vercel/ncc': ^0.27.0
|
||||
ajv: ^6.12.5
|
||||
expand-tilde: ^2.0.2
|
||||
js-yaml: ^3.14.0
|
||||
fs-extra: ^9.1.0
|
||||
js-yaml: ^4.0.0
|
||||
node-fetch: ^2.6.1
|
||||
typescript: ^4.0.3
|
||||
typescript: ^4.2.3
|
||||
|
@ -1,6 +1,10 @@
|
||||
{
|
||||
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
||||
"pinVersions": false,
|
||||
"extends": [
|
||||
"config:base"
|
||||
],
|
||||
"ignoreDeps": [
|
||||
"ajv"
|
||||
]
|
||||
}
|
||||
|
2
run.sh
2
run.sh
@ -3,7 +3,5 @@
|
||||
export HOME="$(pwd)"
|
||||
export INPUT_VERSION=4.11.1
|
||||
export INPUT_DEST='~/pnpm.temp'
|
||||
export INPUT_BIN_DEST='~/pnpm.temp/.bin'
|
||||
export INPUT_REGISTRY=https://registry.npmjs.com
|
||||
export INPUT_RUN_INSTALL=null
|
||||
exec node dist/index.js
|
||||
|
@ -5,8 +5,6 @@ import { RunInstall, parseRunInstall } from './run-install'
|
||||
export interface Inputs {
|
||||
readonly version: string
|
||||
readonly dest: string
|
||||
readonly binDest: string
|
||||
readonly registry: string
|
||||
readonly runInstall: RunInstall[]
|
||||
}
|
||||
|
||||
@ -19,8 +17,6 @@ const parseInputPath = (name: string) => expandTilde(getInput(name, options))
|
||||
export const getInputs = (): Inputs => ({
|
||||
version: getInput('version', options),
|
||||
dest: parseInputPath('dest'),
|
||||
binDest: parseInputPath('bin_dest'),
|
||||
registry: getInput('registry', options),
|
||||
runInstall: parseRunInstall('run_install'),
|
||||
})
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
import process from 'process'
|
||||
import { safeLoad } from 'js-yaml'
|
||||
import { load } from 'js-yaml'
|
||||
import Ajv from 'ajv'
|
||||
import { getInput, error, InputOptions } from '@actions/core'
|
||||
import runInstallSchema from './run-install-input.schema.json'
|
||||
@ -21,10 +21,9 @@ const options: InputOptions = {
|
||||
}
|
||||
|
||||
export function parseRunInstall(name: string): RunInstall[] {
|
||||
const result: RunInstallInput = safeLoad(getInput(name, options)) as any
|
||||
const result: RunInstallInput = load(getInput(name, options)) as any
|
||||
const ajv = new Ajv({
|
||||
allErrors: true,
|
||||
async: false,
|
||||
})
|
||||
const validate = ajv.compile(runInstallSchema)
|
||||
if (!validate(result)) {
|
||||
|
@ -1,20 +1,25 @@
|
||||
import { spawn } from 'child_process'
|
||||
import { execPath } from 'process'
|
||||
import { downloadSelfInstaller } from '../self-installer'
|
||||
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 cp = spawn(execPath, {
|
||||
env: {
|
||||
PNPM_VERSION: inputs.version,
|
||||
PNPM_DEST: inputs.dest,
|
||||
PNPM_BIN_DEST: inputs.binDest,
|
||||
PNPM_REGISTRY: inputs.registry,
|
||||
},
|
||||
const { version, dest } = inputs
|
||||
const target = version ? `pnpm@${version}` : 'pnpm'
|
||||
const pkgJson = join(dest, 'package.json')
|
||||
|
||||
await remove(dest)
|
||||
await ensureFile(pkgJson)
|
||||
await writeFile(pkgJson, JSON.stringify({ private: true }))
|
||||
|
||||
const cp = spawn(execPath, ['-', 'install', target, '--no-lockfile'], {
|
||||
cwd: dest,
|
||||
stdio: ['pipe', 'inherit', 'inherit'],
|
||||
})
|
||||
|
||||
const response = await downloadSelfInstaller()
|
||||
const response = await fetch('https://pnpm.js.org/pnpm.js')
|
||||
response.body.pipe(cp.stdin)
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
|
@ -1,10 +1,12 @@
|
||||
import { setOutput, addPath } from '@actions/core'
|
||||
import { Inputs } from '../inputs'
|
||||
import { getBinDest } from '../utils'
|
||||
|
||||
export function setOutputs(inputs: Inputs) {
|
||||
addPath(inputs.binDest)
|
||||
const binDest = getBinDest(inputs)
|
||||
addPath(binDest)
|
||||
setOutput('dest', inputs.dest)
|
||||
setOutput('bin_dest', inputs.binDest)
|
||||
setOutput('bin_dest', binDest)
|
||||
}
|
||||
|
||||
export default setOutputs
|
||||
|
@ -1,4 +0,0 @@
|
||||
import fetch from 'node-fetch'
|
||||
import url from './url'
|
||||
export const downloadSelfInstaller = () => fetch(url)
|
||||
export default downloadSelfInstaller
|
@ -1,2 +0,0 @@
|
||||
export * from './url'
|
||||
export * from './download'
|
@ -1,3 +0,0 @@
|
||||
export const ref = '301414cec74a2b6b63c95b42f2ad1790ccb980ed'
|
||||
export const url = `https://raw.githubusercontent.com/pnpm/self-installer/${ref}/install.js`
|
||||
export default url
|
@ -2,7 +2,9 @@ import process from 'process'
|
||||
import path from 'path'
|
||||
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: inputs.binDest + path.delimiter + process.env.PATH
|
||||
PATH: getBinDest(inputs) + path.delimiter + process.env.PATH
|
||||
})
|
||||
|
Reference in New Issue
Block a user