mirror of
https://github.com/pnpm/action-setup.git
synced 2025-08-27 03:21:09 +08:00
Compare commits
17 Commits
v2.0.0
...
add-to-pat
Author | SHA1 | Date | |
---|---|---|---|
![]() |
0e9c99a89a | ||
![]() |
9087a16275 | ||
![]() |
9c583927b0 | ||
![]() |
43a416008e | ||
![]() |
eb99e9e4c7 | ||
![]() |
15569a497d | ||
![]() |
d70eebd14a | ||
![]() |
3bf8acf16f | ||
![]() |
3c2fe8c592 | ||
![]() |
76cc04cd5e | ||
![]() |
bcad811784 | ||
![]() |
602b36f177 | ||
![]() |
74a0fdc1a4 | ||
![]() |
493e98ec5e | ||
![]() |
646cdf4821 | ||
![]() |
a1ba6cf5ae | ||
![]() |
41b381a08b |
30
README.md
30
README.md
@@ -1,16 +1,16 @@
|
|||||||
# Setup PNPM
|
# Setup pnpm
|
||||||
|
|
||||||
Install PNPM package manager.
|
Install pnpm package manager.
|
||||||
|
|
||||||
## Inputs
|
## Inputs
|
||||||
|
|
||||||
### `version`
|
### `version`
|
||||||
|
|
||||||
**Required** 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`.
|
||||||
|
|
||||||
### `dest`
|
### `dest`
|
||||||
|
|
||||||
**Optional** Where to store PNPM files.
|
**Optional** Where to store pnpm files.
|
||||||
|
|
||||||
### `run_install`
|
### `run_install`
|
||||||
|
|
||||||
@@ -46,7 +46,7 @@ Location of `pnpm` and `pnpx` command.
|
|||||||
|
|
||||||
## Usage example
|
## Usage example
|
||||||
|
|
||||||
### Just install PNPM
|
### Just install pnpm
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
on:
|
on:
|
||||||
@@ -57,12 +57,12 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: pnpm/action-setup@v1.2.1
|
- uses: pnpm/action-setup@v2.0.1
|
||||||
with:
|
with:
|
||||||
version: 5.17.2
|
version: 6.0.2
|
||||||
```
|
```
|
||||||
|
|
||||||
### Install PNPM and a few NPM packages
|
### Install pnpm and a few npm packages
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
on:
|
on:
|
||||||
@@ -75,9 +75,9 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
- uses: pnpm/action-setup@v1.2.1
|
- uses: pnpm/action-setup@v2.0.1
|
||||||
with:
|
with:
|
||||||
version: 5.17.2
|
version: 6.0.2
|
||||||
run_install: |
|
run_install: |
|
||||||
- recursive: true
|
- recursive: true
|
||||||
args: [--frozen-lockfile, --strict-peer-dependencies]
|
args: [--frozen-lockfile, --strict-peer-dependencies]
|
||||||
@@ -100,17 +100,15 @@ jobs:
|
|||||||
|
|
||||||
- name: Cache pnpm modules
|
- name: Cache pnpm modules
|
||||||
uses: actions/cache@v2
|
uses: actions/cache@v2
|
||||||
env:
|
|
||||||
cache-name: cache-pnpm-modules
|
|
||||||
with:
|
with:
|
||||||
path: ~/.pnpm-store
|
path: ~/.pnpm-store
|
||||||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ matrix.node-version }}-${{ hashFiles('**/package.json') }}
|
key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}
|
||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-build-${{ env.cache-name }}-${{ matrix.node-version }}-
|
${{ runner.os }}-
|
||||||
|
|
||||||
- uses: pnpm/action-setup@v1.2.1
|
- uses: pnpm/action-setup@v2.0.1
|
||||||
with:
|
with:
|
||||||
version: 5.17.2
|
version: 6.0.2
|
||||||
run_install: true
|
run_install: true
|
||||||
```
|
```
|
||||||
|
|
||||||
|
2
dist/index.js
vendored
2
dist/index.js
vendored
File diff suppressed because one or more lines are too long
24
package.json
24
package.json
@@ -7,21 +7,21 @@
|
|||||||
"start": "pnpm run build && sh ./run.sh"
|
"start": "pnpm run build && sh ./run.sh"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"node-fetch": "^2.6.1",
|
"@actions/core": "^1.6.0",
|
||||||
"expand-tilde": "^2.0.2",
|
|
||||||
"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/expand-tilde": "^2.0.0",
|
||||||
"@types/node-fetch": "^2.5.8",
|
"@types/fs-extra": "^9.0.13",
|
||||||
"@types/js-yaml": "^4.0.0",
|
"@types/js-yaml": "^4.0.5",
|
||||||
"@types/fs-extra": "^9.0.8",
|
"@types/node": "^14.18.10",
|
||||||
"@types/node": "^14.14.35"
|
"@types/node-fetch": "^2.5.12",
|
||||||
|
"ajv": "^6.12.6",
|
||||||
|
"expand-tilde": "^2.0.2",
|
||||||
|
"fs-extra": "^9.1.0",
|
||||||
|
"js-yaml": "^4.1.0",
|
||||||
|
"node-fetch": "^2.6.7"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"typescript": "^4.2.3",
|
|
||||||
"@ts-schema-autogen/cli": "^0.1.2",
|
"@ts-schema-autogen/cli": "^0.1.2",
|
||||||
"@vercel/ncc": "^0.27.0"
|
"@vercel/ncc": "^0.27.0",
|
||||||
|
"typescript": "^4.5.5"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
971
pnpm-lock.yaml
generated
971
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@@ -9,7 +9,7 @@ export async function install(inputs: Inputs) {
|
|||||||
const status = await runSelfInstaller(inputs)
|
const status = await runSelfInstaller(inputs)
|
||||||
endGroup()
|
endGroup()
|
||||||
if (status) {
|
if (status) {
|
||||||
return setFailed(`Something does wrong, self-installer exits with code ${status}`)
|
return setFailed(`Something went wrong, self-installer exits with code ${status}`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,3 +1,4 @@
|
|||||||
|
import * as core from '@actions/core'
|
||||||
import { spawn } from 'child_process'
|
import { spawn } from 'child_process'
|
||||||
import { execPath } from 'process'
|
import { execPath } from 'process'
|
||||||
import { join } from 'path'
|
import { join } from 'path'
|
||||||
@@ -22,10 +23,16 @@ export async function runSelfInstaller(inputs: Inputs): Promise<number> {
|
|||||||
const response = await fetch('https://pnpm.js.org/pnpm.js')
|
const response = await fetch('https://pnpm.js.org/pnpm.js')
|
||||||
response.body.pipe(cp.stdin)
|
response.body.pipe(cp.stdin)
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
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 (result === 0) {
|
||||||
|
const pnpmHome = join(dest, 'node_modules/.bin')
|
||||||
|
core.addPath(pnpmHome)
|
||||||
|
core.exportVariable('PNPM_HOME_PATH', pnpmHome)
|
||||||
|
}
|
||||||
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
export default runSelfInstaller
|
export default runSelfInstaller
|
||||||
|
Reference in New Issue
Block a user