mirror of
https://github.com/pnpm/action-setup.git
synced 2025-04-01 22:00:11 +08:00
Compare commits
20 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
d648c2dd06 | ||
|
a7487c7e89 | ||
|
fff70888d0 | ||
|
6e3017af18 | ||
|
0cb0538c33 | ||
|
e303250a24 | ||
|
ac5bf11548 | ||
|
18ac635edf | ||
|
0d0b43217a | ||
|
0eb0e97082 | ||
|
23657c8550 | ||
|
5d79380f29 | ||
|
562dbbf611 | ||
|
00884bcdc5 | ||
|
fe02b34f77 | ||
|
bee1f099e5 | ||
|
ce859e384f | ||
|
2ab6dce4f5 | ||
|
e280758d01 | ||
|
129abb77bf |
16
.github/workflows/test.yaml
vendored
16
.github/workflows/test.yaml
vendored
@ -15,7 +15,7 @@ jobs:
|
|||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
pnpm:
|
pnpm:
|
||||||
- 4.11.1
|
- 9.15.5
|
||||||
os:
|
os:
|
||||||
- ubuntu-latest
|
- ubuntu-latest
|
||||||
- macos-latest
|
- macos-latest
|
||||||
@ -27,7 +27,7 @@ jobs:
|
|||||||
- name: Run the action
|
- name: Run the action
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
version: 4.11.1
|
version: 9.15.5
|
||||||
|
|
||||||
- name: 'Test: which'
|
- name: 'Test: which'
|
||||||
run: which pnpm; which pnpx
|
run: which pnpm; which pnpx
|
||||||
@ -44,7 +44,7 @@ jobs:
|
|||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
pnpm:
|
pnpm:
|
||||||
- 4.11.1
|
- 9.15.5
|
||||||
os:
|
os:
|
||||||
- ubuntu-latest
|
- ubuntu-latest
|
||||||
- macos-latest
|
- macos-latest
|
||||||
@ -56,7 +56,7 @@ jobs:
|
|||||||
- name: Run the action
|
- name: Run the action
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
version: 4.11.1
|
version: 9.15.5
|
||||||
dest: ~/test/pnpm
|
dest: ~/test/pnpm
|
||||||
|
|
||||||
- name: 'Test: which'
|
- name: 'Test: which'
|
||||||
@ -88,7 +88,7 @@ jobs:
|
|||||||
- name: Run the action
|
- name: Run the action
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
version: 7.0.0
|
version: 9.15.0
|
||||||
standalone: ${{ matrix.standalone }}
|
standalone: ${{ matrix.standalone }}
|
||||||
|
|
||||||
- name: install Node.js
|
- name: install Node.js
|
||||||
@ -129,7 +129,7 @@ jobs:
|
|||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
pnpm:
|
pnpm:
|
||||||
- 4.11.1
|
- 9.15.5
|
||||||
os:
|
os:
|
||||||
- ubuntu-latest
|
- ubuntu-latest
|
||||||
- macos-latest
|
- macos-latest
|
||||||
@ -149,7 +149,6 @@ jobs:
|
|||||||
- --global-dir=./pnpm-global
|
- --global-dir=./pnpm-global
|
||||||
- npm
|
- npm
|
||||||
- yarn
|
- yarn
|
||||||
- pnpm
|
|
||||||
- name: 'array'
|
- name: 'array'
|
||||||
value: |
|
value: |
|
||||||
- {}
|
- {}
|
||||||
@ -159,7 +158,6 @@ jobs:
|
|||||||
- --global-dir=./pnpm-global
|
- --global-dir=./pnpm-global
|
||||||
- npm
|
- npm
|
||||||
- yarn
|
- yarn
|
||||||
- pnpm
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
@ -167,7 +165,7 @@ jobs:
|
|||||||
- name: Run the action
|
- name: Run the action
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
version: 4.11.1
|
version: 9.15.5
|
||||||
run_install: ${{ matrix.run_install.value }}
|
run_install: ${{ matrix.run_install.value }}
|
||||||
|
|
||||||
- name: 'Test: which'
|
- name: 'Test: which'
|
||||||
|
65
README.md
65
README.md
@ -1,3 +1,7 @@
|
|||||||
|
> ## :warning: Upgrade from v2!
|
||||||
|
>
|
||||||
|
> The v2 version of this action [has stopped working](https://github.com/pnpm/action-setup/issues/135) with newer Node.js versions. Please, upgrade to the latest version to fix any issues.
|
||||||
|
|
||||||
# Setup pnpm
|
# Setup pnpm
|
||||||
|
|
||||||
Install pnpm package manager.
|
Install pnpm package manager.
|
||||||
@ -40,7 +44,7 @@ If `run_install` is a YAML string representation of either an object or an array
|
|||||||
|
|
||||||
### `package_json_file`
|
### `package_json_file`
|
||||||
|
|
||||||
**Optional** (_type:_ `string`, _default:_ `package.json`) File path to the `package.json` to read "packageManager" configuration.
|
**Optional** (_type:_ `string`, _default:_ `package.json`) File path to the `package.json`/[`package.yaml`](https://github.com/pnpm/pnpm/pull/1799) to read "packageManager" configuration.
|
||||||
|
|
||||||
### `standalone`
|
### `standalone`
|
||||||
|
|
||||||
@ -60,7 +64,9 @@ Location of `pnpm` and `pnpx` command.
|
|||||||
|
|
||||||
## Usage example
|
## Usage example
|
||||||
|
|
||||||
### Just install pnpm
|
### Install only pnpm without `packageManager`
|
||||||
|
|
||||||
|
This works when the repo either doesn't have a `package.json` or has a `package.json` but it doesn't specify `packageManager`.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
on:
|
on:
|
||||||
@ -72,9 +78,26 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: pnpm/action-setup@v3
|
- uses: pnpm/action-setup@v4
|
||||||
with:
|
with:
|
||||||
version: 8
|
version: 10
|
||||||
|
```
|
||||||
|
|
||||||
|
### Install only pnpm with `packageManager`
|
||||||
|
|
||||||
|
Omit `version` input to use the version in the [`packageManager` field in the `package.json`](https://nodejs.org/api/corepack.html).
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
on:
|
||||||
|
- push
|
||||||
|
- pull_request
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
install:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: pnpm/action-setup@v4
|
||||||
```
|
```
|
||||||
|
|
||||||
### Install pnpm and a few npm packages
|
### Install pnpm and a few npm packages
|
||||||
@ -89,11 +112,11 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- uses: pnpm/action-setup@v3
|
- uses: pnpm/action-setup@v4
|
||||||
with:
|
with:
|
||||||
version: 8
|
version: 10
|
||||||
run_install: |
|
run_install: |
|
||||||
- recursive: true
|
- recursive: true
|
||||||
args: [--frozen-lockfile, --strict-peer-dependencies]
|
args: [--frozen-lockfile, --strict-peer-dependencies]
|
||||||
@ -113,31 +136,19 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Install Node.js
|
- uses: pnpm/action-setup@v4
|
||||||
uses: actions/setup-node@v3
|
|
||||||
with:
|
|
||||||
node-version: 16
|
|
||||||
|
|
||||||
- uses: pnpm/action-setup@v3
|
|
||||||
name: Install pnpm
|
name: Install pnpm
|
||||||
with:
|
with:
|
||||||
version: 8
|
version: 10
|
||||||
run_install: false
|
run_install: false
|
||||||
|
|
||||||
- name: Get pnpm store directory
|
- name: Install Node.js
|
||||||
shell: bash
|
uses: actions/setup-node@v4
|
||||||
run: |
|
|
||||||
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
- uses: actions/cache@v3
|
|
||||||
name: Setup pnpm cache
|
|
||||||
with:
|
with:
|
||||||
path: ${{ env.STORE_PATH }}
|
node-version: 20
|
||||||
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
|
cache: 'pnpm'
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-pnpm-store-
|
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: pnpm install
|
run: pnpm install
|
||||||
@ -151,4 +162,4 @@ This action does not setup Node.js for you, use [actions/setup-node](https://git
|
|||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
[MIT](https://git.io/JfclH) © [Hoàng Văn Khải](https://github.com/KSXGitHub/)
|
[MIT](https://github.com/pnpm/action-setup/blob/master/LICENSE.md) © [Hoàng Văn Khải](https://github.com/KSXGitHub/)
|
||||||
|
@ -23,6 +23,11 @@ inputs:
|
|||||||
description: When set to true, @pnpm/exe, which is a Node.js bundled package, will be installed, enabling using pnpm without Node.js.
|
description: When set to true, @pnpm/exe, which is a Node.js bundled package, will be installed, enabling using pnpm without Node.js.
|
||||||
required: false
|
required: false
|
||||||
default: 'false'
|
default: 'false'
|
||||||
|
outputs:
|
||||||
|
dest:
|
||||||
|
description: Expanded path of inputs#dest
|
||||||
|
bin_dest:
|
||||||
|
description: Location of `pnpm` and `pnpx` command
|
||||||
runs:
|
runs:
|
||||||
using: node20
|
using: node20
|
||||||
main: dist/index.js
|
main: dist/index.js
|
||||||
|
6
dist/index.js
vendored
6
dist/index.js
vendored
File diff suppressed because one or more lines are too long
@ -9,11 +9,9 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.10.1",
|
"@actions/core": "^1.10.1",
|
||||||
"@types/expand-tilde": "^2.0.2",
|
"@types/expand-tilde": "^2.0.2",
|
||||||
"@types/fs-extra": "^11.0.4",
|
|
||||||
"@types/node": "^20.11.5",
|
"@types/node": "^20.11.5",
|
||||||
"@types/node-fetch": "^2.6.11",
|
"@types/node-fetch": "^2.6.11",
|
||||||
"expand-tilde": "^2.0.2",
|
"expand-tilde": "^2.0.2",
|
||||||
"fs-extra": "^11.2.0",
|
|
||||||
"yaml": "^2.3.4",
|
"yaml": "^2.3.4",
|
||||||
"zod": "^3.22.4"
|
"zod": "^3.22.4"
|
||||||
},
|
},
|
||||||
|
327
pnpm-lock.yaml
generated
327
pnpm-lock.yaml
generated
@ -1,225 +1,200 @@
|
|||||||
lockfileVersion: '6.0'
|
lockfileVersion: '9.0'
|
||||||
|
|
||||||
settings:
|
settings:
|
||||||
autoInstallPeers: true
|
autoInstallPeers: true
|
||||||
excludeLinksFromLockfile: false
|
excludeLinksFromLockfile: false
|
||||||
|
|
||||||
dependencies:
|
importers:
|
||||||
'@actions/core':
|
|
||||||
specifier: ^1.10.1
|
|
||||||
version: 1.10.1
|
|
||||||
'@types/expand-tilde':
|
|
||||||
specifier: ^2.0.2
|
|
||||||
version: 2.0.2
|
|
||||||
'@types/fs-extra':
|
|
||||||
specifier: ^11.0.4
|
|
||||||
version: 11.0.4
|
|
||||||
'@types/node':
|
|
||||||
specifier: ^20.11.5
|
|
||||||
version: 20.11.5
|
|
||||||
'@types/node-fetch':
|
|
||||||
specifier: ^2.6.11
|
|
||||||
version: 2.6.11
|
|
||||||
expand-tilde:
|
|
||||||
specifier: ^2.0.2
|
|
||||||
version: 2.0.2
|
|
||||||
fs-extra:
|
|
||||||
specifier: ^11.2.0
|
|
||||||
version: 11.2.0
|
|
||||||
yaml:
|
|
||||||
specifier: ^2.3.4
|
|
||||||
version: 2.3.4
|
|
||||||
zod:
|
|
||||||
specifier: ^3.22.4
|
|
||||||
version: 3.22.4
|
|
||||||
|
|
||||||
devDependencies:
|
.:
|
||||||
'@vercel/ncc':
|
dependencies:
|
||||||
specifier: ^0.38.1
|
'@actions/core':
|
||||||
version: 0.38.1
|
specifier: ^1.10.1
|
||||||
pnpm:
|
version: 1.11.1
|
||||||
specifier: ^8.14.3
|
'@types/expand-tilde':
|
||||||
version: 8.14.3
|
specifier: ^2.0.2
|
||||||
typescript:
|
version: 2.0.2
|
||||||
specifier: ^5.3.3
|
'@types/node':
|
||||||
version: 5.3.3
|
specifier: ^20.11.5
|
||||||
|
version: 20.17.17
|
||||||
|
'@types/node-fetch':
|
||||||
|
specifier: ^2.6.11
|
||||||
|
version: 2.6.12
|
||||||
|
expand-tilde:
|
||||||
|
specifier: ^2.0.2
|
||||||
|
version: 2.0.2
|
||||||
|
yaml:
|
||||||
|
specifier: ^2.3.4
|
||||||
|
version: 2.7.0
|
||||||
|
zod:
|
||||||
|
specifier: ^3.22.4
|
||||||
|
version: 3.24.1
|
||||||
|
devDependencies:
|
||||||
|
'@vercel/ncc':
|
||||||
|
specifier: ^0.38.1
|
||||||
|
version: 0.38.3
|
||||||
|
pnpm:
|
||||||
|
specifier: ^8.14.3
|
||||||
|
version: 8.15.9
|
||||||
|
typescript:
|
||||||
|
specifier: ^5.3.3
|
||||||
|
version: 5.7.3
|
||||||
|
|
||||||
packages:
|
packages:
|
||||||
|
|
||||||
/@actions/core@1.10.1:
|
'@actions/core@1.11.1':
|
||||||
resolution: {integrity: sha512-3lBR9EDAY+iYIpTnTIXmWcNbX3T2kCkAEQGIQx4NVQ0575nk2k3GRZDTPQG+vVtS2izSLmINlxXf0uLtnrTP+g==}
|
resolution: {integrity: sha512-hXJCSrkwfA46Vd9Z3q4cpEpHB1rL5NG04+/rbqW9d3+CSvtB1tYe8UTpAlixa1vj0m/ULglfEK2UKxMGxCxv5A==}
|
||||||
dependencies:
|
|
||||||
'@actions/http-client': 2.2.0
|
|
||||||
uuid: 8.3.2
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/@actions/http-client@2.2.0:
|
'@actions/exec@1.1.1':
|
||||||
resolution: {integrity: sha512-q+epW0trjVUUHboliPb4UF9g2msf+w61b32tAkFEwL/IwP0DQWgbCMM0Hbe3e3WXSKz5VcUXbzJQgy8Hkra/Lg==}
|
resolution: {integrity: sha512-+sCcHHbVdk93a0XT19ECtO/gIXoxvdsgQLzb2fE2/5sIZmWQuluYyjPQtrtTHdU1YzTZ7bAPN4sITq2xi1679w==}
|
||||||
dependencies:
|
|
||||||
tunnel: 0.0.6
|
|
||||||
undici: 5.28.2
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/@fastify/busboy@2.1.0:
|
'@actions/http-client@2.1.0':
|
||||||
resolution: {integrity: sha512-+KpH+QxZU7O4675t3mnkQKcZZg56u+K/Ct2K+N2AZYNVK8kyeo/bI18tI8aPm3tvNNRyTWfj6s5tnGNlcbQRsA==}
|
resolution: {integrity: sha512-BonhODnXr3amchh4qkmjPMUO8mFi/zLaaCeCAJZqch8iQqyDnVIkySjB38VHAC8IJ+bnlgfOqlhpyCUZHlQsqw==}
|
||||||
engines: {node: '>=14'}
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/@types/expand-tilde@2.0.2:
|
'@actions/io@1.1.3':
|
||||||
|
resolution: {integrity: sha512-wi9JjgKLYS7U/z8PPbco+PvTb/nRWjeoFlJ1Qer83k/3C5PHQi28hiVdeE2kHXmIL99mQFawx8qt/JPjZilJ8Q==}
|
||||||
|
|
||||||
|
'@types/expand-tilde@2.0.2':
|
||||||
resolution: {integrity: sha512-wlsMYiapmIR4Eq/Z0qysN8xaDMjSkO6AIDNFx9oxgWGeKVA1jU+NzwPRZErBNP5z6/dx6QNkNpKglBGPO9OkTA==}
|
resolution: {integrity: sha512-wlsMYiapmIR4Eq/Z0qysN8xaDMjSkO6AIDNFx9oxgWGeKVA1jU+NzwPRZErBNP5z6/dx6QNkNpKglBGPO9OkTA==}
|
||||||
dev: false
|
|
||||||
|
|
||||||
/@types/fs-extra@11.0.4:
|
'@types/node-fetch@2.6.12':
|
||||||
resolution: {integrity: sha512-yTbItCNreRooED33qjunPthRcSjERP1r4MqCZc7wv0u2sUkzTFp45tgUfS5+r7FrZPdmCCNflLhVSP/o+SemsQ==}
|
resolution: {integrity: sha512-8nneRWKCg3rMtF69nLQJnOYUcbafYeFSjqkw3jCRLsqkWFlHaoQrr5mXmofFGOx3DKn7UfmBMyov8ySvLRVldA==}
|
||||||
dependencies:
|
|
||||||
'@types/jsonfile': 6.1.4
|
|
||||||
'@types/node': 20.11.5
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/@types/jsonfile@6.1.4:
|
'@types/node@20.17.17':
|
||||||
resolution: {integrity: sha512-D5qGUYwjvnNNextdU59/+fI+spnwtTFmyQP0h+PfIOSkNfpU6AOICUOkm4i0OnSk+NyjdPJrxCDro0sJsWlRpQ==}
|
resolution: {integrity: sha512-/WndGO4kIfMicEQLTi/mDANUu/iVUhT7KboZPdEqqHQ4aTS+3qT3U5gIqWDFV+XouorjfgGqvKILJeHhuQgFYg==}
|
||||||
dependencies:
|
|
||||||
'@types/node': 20.11.5
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/@types/node-fetch@2.6.11:
|
'@vercel/ncc@0.38.3':
|
||||||
resolution: {integrity: sha512-24xFj9R5+rfQJLRyM56qh+wnVSYhyXC2tkoBndtY0U+vubqNsYXGjufB2nn8Q6gt0LrARwL6UBtMCSVCwl4B1g==}
|
resolution: {integrity: sha512-rnK6hJBS6mwc+Bkab+PGPs9OiS0i/3kdTO+CkI8V0/VrW3vmz7O2Pxjw/owOlmo6PKEIxRSeZKv/kuL9itnpYA==}
|
||||||
dependencies:
|
|
||||||
'@types/node': 20.11.5
|
|
||||||
form-data: 4.0.0
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/@types/node@20.11.5:
|
|
||||||
resolution: {integrity: sha512-g557vgQjUUfN76MZAN/dt1z3dzcUsimuysco0KeluHgrPdJXkP/XdAURgyO2W9fZWHRtRBiVKzKn8vyOAwlG+w==}
|
|
||||||
dependencies:
|
|
||||||
undici-types: 5.26.5
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/@vercel/ncc@0.38.1:
|
|
||||||
resolution: {integrity: sha512-IBBb+iI2NLu4VQn3Vwldyi2QwaXt5+hTyh58ggAMoCGE6DJmPvwL3KPBWcJl1m9LYPChBLE980Jw+CS4Wokqxw==}
|
|
||||||
hasBin: true
|
hasBin: true
|
||||||
dev: true
|
|
||||||
|
|
||||||
/asynckit@0.4.0:
|
asynckit@0.4.0:
|
||||||
resolution: {integrity: sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==}
|
resolution: {integrity: sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==}
|
||||||
dev: false
|
|
||||||
|
|
||||||
/combined-stream@1.0.8:
|
combined-stream@1.0.8:
|
||||||
resolution: {integrity: sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==}
|
resolution: {integrity: sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==}
|
||||||
engines: {node: '>= 0.8'}
|
engines: {node: '>= 0.8'}
|
||||||
dependencies:
|
|
||||||
delayed-stream: 1.0.0
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/delayed-stream@1.0.0:
|
delayed-stream@1.0.0:
|
||||||
resolution: {integrity: sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==}
|
resolution: {integrity: sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==}
|
||||||
engines: {node: '>=0.4.0'}
|
engines: {node: '>=0.4.0'}
|
||||||
dev: false
|
|
||||||
|
|
||||||
/expand-tilde@2.0.2:
|
expand-tilde@2.0.2:
|
||||||
resolution: {integrity: sha512-A5EmesHW6rfnZ9ysHQjPdJRni0SRar0tjtG5MNtm9n5TUvsYU8oozprtRD4AqHxcZWWlVuAmQo2nWKfN9oyjTw==}
|
resolution: {integrity: sha512-A5EmesHW6rfnZ9ysHQjPdJRni0SRar0tjtG5MNtm9n5TUvsYU8oozprtRD4AqHxcZWWlVuAmQo2nWKfN9oyjTw==}
|
||||||
engines: {node: '>=0.10.0'}
|
engines: {node: '>=0.10.0'}
|
||||||
|
|
||||||
|
form-data@4.0.1:
|
||||||
|
resolution: {integrity: sha512-tzN8e4TX8+kkxGPK8D5u0FNmjPUjw3lwC9lSLxxoB/+GtsJG91CO8bSWy73APlgAZzZbXEYZJuxjkHH2w+Ezhw==}
|
||||||
|
engines: {node: '>= 6'}
|
||||||
|
|
||||||
|
homedir-polyfill@1.0.3:
|
||||||
|
resolution: {integrity: sha512-eSmmWE5bZTK2Nou4g0AI3zZ9rswp7GRKoKXS1BLUkvPviOqs4YTN1djQIqrXy9k5gEtdLPy86JjRwsNM9tnDcA==}
|
||||||
|
engines: {node: '>=0.10.0'}
|
||||||
|
|
||||||
|
mime-db@1.52.0:
|
||||||
|
resolution: {integrity: sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==}
|
||||||
|
engines: {node: '>= 0.6'}
|
||||||
|
|
||||||
|
mime-types@2.1.35:
|
||||||
|
resolution: {integrity: sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==}
|
||||||
|
engines: {node: '>= 0.6'}
|
||||||
|
|
||||||
|
parse-passwd@1.0.0:
|
||||||
|
resolution: {integrity: sha512-1Y1A//QUXEZK7YKz+rD9WydcE1+EuPr6ZBgKecAB8tmoW6UFv0NREVJe1p+jRxtThkcbbKkfwIbWJe/IeE6m2Q==}
|
||||||
|
engines: {node: '>=0.10.0'}
|
||||||
|
|
||||||
|
pnpm@8.15.9:
|
||||||
|
resolution: {integrity: sha512-SZQ0ydj90aJ5Tr9FUrOyXApjOrzuW7Fee13pDzL0e1E6ypjNXP0AHDHw20VLw4BO3M1XhQHkyik6aBYWa72fgQ==}
|
||||||
|
engines: {node: '>=16.14'}
|
||||||
|
hasBin: true
|
||||||
|
|
||||||
|
tunnel@0.0.6:
|
||||||
|
resolution: {integrity: sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==}
|
||||||
|
engines: {node: '>=0.6.11 <=0.7.0 || >=0.7.3'}
|
||||||
|
|
||||||
|
typescript@5.7.3:
|
||||||
|
resolution: {integrity: sha512-84MVSjMEHP+FQRPy3pX9sTVV/INIex71s9TL2Gm5FG/WG1SqXeKyZ0k7/blY/4FdOzI12CBy1vGc4og/eus0fw==}
|
||||||
|
engines: {node: '>=14.17'}
|
||||||
|
hasBin: true
|
||||||
|
|
||||||
|
undici-types@6.19.8:
|
||||||
|
resolution: {integrity: sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==}
|
||||||
|
|
||||||
|
yaml@2.7.0:
|
||||||
|
resolution: {integrity: sha512-+hSoy/QHluxmC9kCIJyL/uyFmLmc+e5CFR5Wa+bpIhIj85LVb9ZH2nVnqrHoSvKogwODv0ClqZkmiSSaIH5LTA==}
|
||||||
|
engines: {node: '>= 14'}
|
||||||
|
hasBin: true
|
||||||
|
|
||||||
|
zod@3.24.1:
|
||||||
|
resolution: {integrity: sha512-muH7gBL9sI1nciMZV67X5fTKKBLtwpZ5VBp1vsOQzj1MhrBZ4wlVCm3gedKZWLp0Oyel8sIGfeiz54Su+OVT+A==}
|
||||||
|
|
||||||
|
snapshots:
|
||||||
|
|
||||||
|
'@actions/core@1.11.1':
|
||||||
|
dependencies:
|
||||||
|
'@actions/exec': 1.1.1
|
||||||
|
'@actions/http-client': 2.1.0
|
||||||
|
|
||||||
|
'@actions/exec@1.1.1':
|
||||||
|
dependencies:
|
||||||
|
'@actions/io': 1.1.3
|
||||||
|
|
||||||
|
'@actions/http-client@2.1.0':
|
||||||
|
dependencies:
|
||||||
|
tunnel: 0.0.6
|
||||||
|
|
||||||
|
'@actions/io@1.1.3': {}
|
||||||
|
|
||||||
|
'@types/expand-tilde@2.0.2': {}
|
||||||
|
|
||||||
|
'@types/node-fetch@2.6.12':
|
||||||
|
dependencies:
|
||||||
|
'@types/node': 20.17.17
|
||||||
|
form-data: 4.0.1
|
||||||
|
|
||||||
|
'@types/node@20.17.17':
|
||||||
|
dependencies:
|
||||||
|
undici-types: 6.19.8
|
||||||
|
|
||||||
|
'@vercel/ncc@0.38.3': {}
|
||||||
|
|
||||||
|
asynckit@0.4.0: {}
|
||||||
|
|
||||||
|
combined-stream@1.0.8:
|
||||||
|
dependencies:
|
||||||
|
delayed-stream: 1.0.0
|
||||||
|
|
||||||
|
delayed-stream@1.0.0: {}
|
||||||
|
|
||||||
|
expand-tilde@2.0.2:
|
||||||
dependencies:
|
dependencies:
|
||||||
homedir-polyfill: 1.0.3
|
homedir-polyfill: 1.0.3
|
||||||
dev: false
|
|
||||||
|
|
||||||
/form-data@4.0.0:
|
form-data@4.0.1:
|
||||||
resolution: {integrity: sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==}
|
|
||||||
engines: {node: '>= 6'}
|
|
||||||
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.35
|
||||||
dev: false
|
|
||||||
|
|
||||||
/fs-extra@11.2.0:
|
homedir-polyfill@1.0.3:
|
||||||
resolution: {integrity: sha512-PmDi3uwK5nFuXh7XDTlVnS17xJS7vW36is2+w3xcv8SVxiB4NyATf4ctkVY5bkSjX0Y4nbvZCq1/EjtEyr9ktw==}
|
|
||||||
engines: {node: '>=14.14'}
|
|
||||||
dependencies:
|
|
||||||
graceful-fs: 4.2.11
|
|
||||||
jsonfile: 6.1.0
|
|
||||||
universalify: 2.0.1
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/graceful-fs@4.2.11:
|
|
||||||
resolution: {integrity: sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==}
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/homedir-polyfill@1.0.3:
|
|
||||||
resolution: {integrity: sha512-eSmmWE5bZTK2Nou4g0AI3zZ9rswp7GRKoKXS1BLUkvPviOqs4YTN1djQIqrXy9k5gEtdLPy86JjRwsNM9tnDcA==}
|
|
||||||
engines: {node: '>=0.10.0'}
|
|
||||||
dependencies:
|
dependencies:
|
||||||
parse-passwd: 1.0.0
|
parse-passwd: 1.0.0
|
||||||
dev: false
|
|
||||||
|
|
||||||
/jsonfile@6.1.0:
|
mime-db@1.52.0: {}
|
||||||
resolution: {integrity: sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==}
|
|
||||||
dependencies:
|
|
||||||
universalify: 2.0.1
|
|
||||||
optionalDependencies:
|
|
||||||
graceful-fs: 4.2.11
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/mime-db@1.52.0:
|
mime-types@2.1.35:
|
||||||
resolution: {integrity: sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==}
|
|
||||||
engines: {node: '>= 0.6'}
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/mime-types@2.1.35:
|
|
||||||
resolution: {integrity: sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==}
|
|
||||||
engines: {node: '>= 0.6'}
|
|
||||||
dependencies:
|
dependencies:
|
||||||
mime-db: 1.52.0
|
mime-db: 1.52.0
|
||||||
dev: false
|
|
||||||
|
|
||||||
/parse-passwd@1.0.0:
|
parse-passwd@1.0.0: {}
|
||||||
resolution: {integrity: sha512-1Y1A//QUXEZK7YKz+rD9WydcE1+EuPr6ZBgKecAB8tmoW6UFv0NREVJe1p+jRxtThkcbbKkfwIbWJe/IeE6m2Q==}
|
|
||||||
engines: {node: '>=0.10.0'}
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/pnpm@8.14.3:
|
pnpm@8.15.9: {}
|
||||||
resolution: {integrity: sha512-w+2A61g74+K37zHrlri5z6oFA+XUTscXUUEgtRh7L5M3NukDjFGlojrVgnkLpB1Kt4RhjIn6fiNl9mZWhdYS7g==}
|
|
||||||
engines: {node: '>=16.14'}
|
|
||||||
hasBin: true
|
|
||||||
dev: true
|
|
||||||
|
|
||||||
/tunnel@0.0.6:
|
tunnel@0.0.6: {}
|
||||||
resolution: {integrity: sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==}
|
|
||||||
engines: {node: '>=0.6.11 <=0.7.0 || >=0.7.3'}
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/typescript@5.3.3:
|
typescript@5.7.3: {}
|
||||||
resolution: {integrity: sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==}
|
|
||||||
engines: {node: '>=14.17'}
|
|
||||||
hasBin: true
|
|
||||||
dev: true
|
|
||||||
|
|
||||||
/undici-types@5.26.5:
|
undici-types@6.19.8: {}
|
||||||
resolution: {integrity: sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==}
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/undici@5.28.2:
|
yaml@2.7.0: {}
|
||||||
resolution: {integrity: sha512-wh1pHJHnUeQV5Xa8/kyQhO7WFa8M34l026L5P/+2TYiakvGy5Rdc8jWZVyG7ieht/0WgJLEd3kcU5gKx+6GC8w==}
|
|
||||||
engines: {node: '>=14.0'}
|
|
||||||
dependencies:
|
|
||||||
'@fastify/busboy': 2.1.0
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/universalify@2.0.1:
|
zod@3.24.1: {}
|
||||||
resolution: {integrity: sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==}
|
|
||||||
engines: {node: '>= 10.0.0'}
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/uuid@8.3.2:
|
|
||||||
resolution: {integrity: sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==}
|
|
||||||
hasBin: true
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/yaml@2.3.4:
|
|
||||||
resolution: {integrity: sha512-8aAvwVUSHpfEqTQ4w/KMlf3HcRdt50E5ODIQJBw1fQ5RL34xabzxtUlzTXVqc4rkZsPbvrXKWnABCD7kWSmocA==}
|
|
||||||
engines: {node: '>= 14'}
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/zod@3.22.4:
|
|
||||||
resolution: {integrity: sha512-iC+8Io04lddc+mVqQ9AZ7OQ2MrUKGN+oIQyq1vemgt46jwCwLfhq7/pwnBnNXXXZb8VTVLKwp9EDkx+ryxIWmg==}
|
|
||||||
dev: false
|
|
||||||
|
@ -1,17 +1,22 @@
|
|||||||
import { addPath, exportVariable } from '@actions/core'
|
import { addPath, exportVariable } from '@actions/core'
|
||||||
import { spawn } from 'child_process'
|
import { spawn } from 'child_process'
|
||||||
import { remove, ensureFile, writeFile, readFile } from 'fs-extra'
|
import { rm, writeFile, mkdir } from 'fs/promises'
|
||||||
|
import { readFileSync } from 'fs'
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
import { execPath } from 'process'
|
import { execPath } from 'process'
|
||||||
|
import util from 'util'
|
||||||
import { Inputs } from '../inputs'
|
import { Inputs } from '../inputs'
|
||||||
|
import YAML from 'yaml'
|
||||||
|
|
||||||
export async function runSelfInstaller(inputs: Inputs): Promise<number> {
|
export async function runSelfInstaller(inputs: Inputs): Promise<number> {
|
||||||
const { version, dest, packageJsonFile, standalone } = inputs
|
const { version, dest, packageJsonFile, standalone } = inputs
|
||||||
|
|
||||||
// prepare self install
|
// prepare self install
|
||||||
await remove(dest)
|
await rm(dest, { recursive: true, force: true })
|
||||||
|
// create dest directory after removal
|
||||||
|
await mkdir(dest, { recursive: true })
|
||||||
const pkgJson = path.join(dest, 'package.json')
|
const pkgJson = path.join(dest, 'package.json')
|
||||||
await ensureFile(pkgJson)
|
// we have ensured the dest directory exists, we can write the file directly
|
||||||
await writeFile(pkgJson, JSON.stringify({ private: true }))
|
await writeFile(pkgJson, JSON.stringify({ private: true }))
|
||||||
|
|
||||||
// prepare target pnpm
|
// prepare target pnpm
|
||||||
@ -39,18 +44,45 @@ async function readTarget(opts: {
|
|||||||
readonly standalone: boolean
|
readonly standalone: boolean
|
||||||
}) {
|
}) {
|
||||||
const { version, packageJsonFile, standalone } = opts
|
const { version, packageJsonFile, standalone } = opts
|
||||||
|
|
||||||
if (version) return `${ standalone ? '@pnpm/exe' : 'pnpm' }@${version}`
|
|
||||||
|
|
||||||
const { GITHUB_WORKSPACE } = process.env
|
const { GITHUB_WORKSPACE } = process.env
|
||||||
|
|
||||||
|
let packageManager
|
||||||
|
|
||||||
|
if (GITHUB_WORKSPACE) {
|
||||||
|
try {
|
||||||
|
const content = readFileSync(path.join(GITHUB_WORKSPACE, packageJsonFile), 'utf8');
|
||||||
|
({ packageManager } = packageJsonFile.endsWith(".yaml")
|
||||||
|
? YAML.parse(content, { merge: true })
|
||||||
|
: JSON.parse(content)
|
||||||
|
)
|
||||||
|
} catch (error: unknown) {
|
||||||
|
// Swallow error if package.json doesn't exist in root
|
||||||
|
if (!util.types.isNativeError(error) || !('code' in error) || error.code !== 'ENOENT') throw error
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (version) {
|
||||||
|
if (
|
||||||
|
typeof packageManager === 'string' &&
|
||||||
|
packageManager.startsWith('pnpm@') &&
|
||||||
|
packageManager.replace('pnpm@', '') !== version
|
||||||
|
) {
|
||||||
|
throw new Error(`Multiple versions of pnpm specified:
|
||||||
|
- version ${version} in the GitHub Action config with the key "version"
|
||||||
|
- version ${packageManager} in the package.json with the key "packageManager"
|
||||||
|
Remove one of these versions to avoid version mismatch errors like ERR_PNPM_BAD_PM_VERSION`)
|
||||||
|
}
|
||||||
|
|
||||||
|
return `${ standalone ? '@pnpm/exe' : 'pnpm' }@${version}`
|
||||||
|
}
|
||||||
|
|
||||||
if (!GITHUB_WORKSPACE) {
|
if (!GITHUB_WORKSPACE) {
|
||||||
throw new Error(`No workspace is found.
|
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,
|
If you've 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.
|
please run the actions/checkout before pnpm/action-setup.
|
||||||
Otherwise, please specify the pnpm version in the action configuration.`)
|
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') {
|
if (typeof packageManager !== 'string') {
|
||||||
throw new Error(`No pnpm version is specified.
|
throw new Error(`No pnpm version is specified.
|
||||||
Please specify it by one of the following ways:
|
Please specify it by one of the following ways:
|
||||||
@ -62,7 +94,7 @@ Please specify it by one of the following ways:
|
|||||||
throw new Error('Invalid packageManager field in package.json')
|
throw new Error('Invalid packageManager field in package.json')
|
||||||
}
|
}
|
||||||
|
|
||||||
if(standalone){
|
if (standalone) {
|
||||||
return packageManager.replace('pnpm@', '@pnpm/exe@')
|
return packageManager.replace('pnpm@', '@pnpm/exe@')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user