63 Commits

Author SHA1 Message Date
537643d491 Merge pull request #56 from i7eo/master
chore: bump node version
2022-10-11 11:58:06 +07:00
f4129fb46e fix
Update node version, see https://github.blog/changelog/2022-09-22-github-actions-all-actions-will-begin-running-on-node16-instead-of-node12/
2022-10-11 10:56:24 +08:00
6e1964dde3 Fix spacing issue in README.md example (#48) 2022-06-17 23:17:05 +03:00
10693b3829 Update action.yml 2022-05-28 17:23:43 +03:00
99ecd24520 v2.2.2 2022-05-28 17:22:28 +03:00
958500fcab fix: do not download pnpm from get.pnpm.io (#46)
* fix: do not download pnpm from get.pnpm.io

* fix: remove redundant files
2022-05-28 16:54:43 +03:00
57b9359b4c Merge pull request #41 from nelson6e65/patch-1
docs(readme): improve Cache example
2022-05-07 10:00:37 +07:00
ec1a8b444c Change runs-on back to ubuntu-latest 2022-05-07 09:59:56 +07:00
73e15250cb docs(readme): improve and fix cache example
Dynamically detect the Store directory and use the latest GitHub actions.
2022-05-06 21:57:00 -05:00
10b4b0b462 Merge pull request #36 from pnpm/dependabot/github_actions/actions/checkout-3
Bump actions/checkout from 2 to 3
2022-03-08 10:33:01 +07:00
5fa8980bf4 Update dependabot.yml 2022-03-08 10:32:48 +07:00
ae78e9abbe Bump actions/checkout from 2 to 3
Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 3.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v2...v3)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-07 23:02:26 +00:00
35ab4267a1 fix: packageManager reader (#35)
* fix: packageManager reader

* chore: resolve review

* chore: run build
2022-02-25 12:43:26 +08:00
11ba3424e0 fmt 2022-02-23 10:07:15 +07:00
847a737d63 Merge pull request #33 from pnpm/packageManager
feat: try support packageManager
2022-02-22 16:39:23 +07:00
225f3bb4b0 build 2022-02-22 11:34:20 +02:00
777a50d72e Update src/install-pnpm/run.ts 2022-02-22 11:32:59 +02:00
e7c10c6fc5 Update dist/index.js 2022-02-22 13:04:41 +07:00
a576a70bc6 chore: resolve review 2022-02-22 13:37:35 +08:00
1d51e20937 feat: try support packageManager 2022-02-22 12:26:05 +08:00
ad2b35ae0c Merge pull request #32 from pnpm/retry-fetch
fix: retry fetch of pnpm script
2022-02-21 10:28:16 +07:00
d8ea532ac4 fix: retry fetch of pnpm script
close #22
2022-02-20 21:49:26 +02:00
2270f39ef6 v2.1.0 2022-02-08 19:53:18 +07:00
394c848db6 Update the bundle 2022-02-08 19:50:57 +07:00
e13928ccc5 Merge pull request #27 from metonym/fix-jobs-syntax
Specify job name to fix syntax error
2022-02-08 19:48:36 +07:00
93bd5a123d Merge pull request #29 from pnpm/pnpm-v7
The pnpm home directory should be added to PATH and PNPM_HOME
2022-02-08 19:47:28 +07:00
9eb14dd77c decrease bundle size 2022-02-08 14:44:50 +02:00
eafb777c56 download script from pnpm.io 2022-02-08 00:39:20 +02:00
e6378df420 PNPM_HOME_PATH=>PNPM_HOME 2022-02-08 00:21:53 +02:00
6ff6e97bc6 The pnpm home directory should be added to PATH and PNPM_HOME
This change is needed to make the action compatible with pnpm v7.

Related breaking change in pnpm: pnpm/pnpm#4280
2022-02-07 23:15:44 +02:00
45d9c91ff6 Specify job name to fix syntax error 2022-01-29 08:17:29 -08:00
15569a497d Merge pull request #26 from ai/patch-1
Improve `version` docs
2021-12-16 21:20:06 +07:00
d70eebd14a Update README.md
Co-authored-by: Khải <hvksmr1996@gmail.com>
2021-12-16 17:18:46 +03:00
3bf8acf16f Improve version docs 2021-12-16 17:12:07 +03:00
3c2fe8c592 Merge pull request #21 from gaggle/patch-1
Spelling
2021-10-12 19:45:45 +07:00
76cc04cd5e Spelling 2021-10-12 13:34:10 +02:00
bcad811784 Remove unused env from examples 2021-07-24 08:25:23 +07:00
602b36f177 Remove uses of undefined variables from examples 2021-07-24 08:22:22 +07:00
74a0fdc1a4 Merge pull request #14 from Jack-Works-forks/master
Update README: use lockfile hash instead of package.json hash
2021-06-01 09:44:13 +07:00
493e98ec5e Update README.md 2021-06-01 10:42:26 +08:00
646cdf4821 Update versions in README examples to the latest 2021-04-24 21:13:36 +07:00
a1ba6cf5ae Merge pull request #11 from pnpm/zkochan-patch-1
docs(readme): PNPM=>pnpm
2021-03-27 18:50:58 +07:00
41b381a08b docs(readme): PNPM=>pnpm 2021-03-27 13:45:01 +02:00
3236b209b5 Merge branch 'v2' 2021-03-27 16:56:27 +07:00
2124926520 Update README.md 2021-03-23 12:53:37 +07:00
ba9826e81c Update test workflow 2021-03-23 12:53:25 +07:00
7c4472dbcf Forgot to specify working directory 2021-03-23 12:48:54 +07:00
0db7fb9961 Add .pnpm-store to .gitignore 2021-03-23 12:48:07 +07:00
aefcd1e623 Use pnpm.js to install pnpm 2021-03-23 12:42:43 +07:00
b7b9d6344b Instruct renovate to ignore ajv updates 2021-03-23 11:47:55 +07:00
7e61ea5847 Add "$schema" to renovate.json 2021-03-23 11:46:56 +07:00
3a2c7247e1 Fix js-yaml usage 2021-03-23 11:43:49 +07:00
2a105263a5 Update dependencies 2021-03-23 11:43:36 +07:00
9facd4db8e Merge pull request #9 from hildjj/cache-docs
Adds documentation hints for caching
2021-02-18 08:31:04 +07:00
6c1466d327 Make some tweaks to example code snippets 2021-02-18 08:30:07 +07:00
b26427e53e Adds documentation hints for caching. Fixes #8. 2021-02-17 09:45:25 -07:00
086f5bd3b6 Update README.md
close https://github.com/pnpm/action-setup/issues/6
2020-10-19 14:10:51 +07:00
bdb2a5ee76 Enable Dependabot 2020-10-05 22:16:14 +07:00
8e1abe543f Update dist/index.js 2020-10-05 21:51:43 +07:00
af6247d08a Fix https://github.com/pnpm/action-setup/issues/5 2020-10-05 21:45:45 +07:00
f87c8a916e Fix TypeScript error 2020-10-05 21:45:20 +07:00
d6790970e0 Update dependencies 2020-10-05 21:44:44 +07:00
fa62771e12 Add workflow_dispatch event 2020-08-27 08:25:30 +07:00
24 changed files with 268722 additions and 558 deletions

7
.github/dependabot.yml vendored Normal file
View File

@ -0,0 +1,7 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: weekly
open-pull-requests-limit: 10

View File

@ -3,6 +3,7 @@ name: Test Action
on: on:
- push - push
- pull_request - pull_request
- workflow_dispatch
jobs: jobs:
test_default_inputs: test_default_inputs:
@ -21,7 +22,7 @@ jobs:
- windows-latest - windows-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- name: Run the action - name: Run the action
uses: ./ uses: ./
@ -50,15 +51,13 @@ jobs:
- windows-latest - windows-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- name: Run the action - name: Run the action
uses: ./ uses: ./
with: with:
version: 4.11.1 version: 4.11.1
dest: ~/test/pnpm dest: ~/test/pnpm
bin_dest: ~/test/pnpm/.bin
registry: http://registry.yarnpkg.com/
- name: 'Test: which' - name: 'Test: which'
run: which pnpm && which pnpx run: which pnpm && which pnpx
@ -108,7 +107,7 @@ jobs:
- pnpm - pnpm
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- name: Run the action - name: Run the action
uses: ./ uses: ./

2
.gitignore vendored
View File

@ -2,9 +2,11 @@ node_modules
*.log *.log
/dist/* /dist/*
!/dist/index.js !/dist/index.js
!/dist/pnpm.js
tmp tmp
temp temp
*.tmp *.tmp
*.temp *.temp
tmp.* tmp.*
temp.* temp.*
.pnpm-store

104
README.md
View File

@ -1,24 +1,20 @@
# Setup PNPM # Setup pnpm
Install PNPM package manager. Install pnpm package manager.
## Inputs ## Inputs
### `version` ### `version`
**Required** Version of PNPM to install. 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` ### `dest`
**Optional** Where to store PNPM files. **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.
### `run_install` ### `run_install`
@ -50,11 +46,11 @@ Expanded path of inputs#dest.
### `bin_dest` ### `bin_dest`
Expanded path of inputs#bin_dest. Location of `pnpm` and `pnpx` command.
## Usage example ## Usage example
### Just install PNPM ### Just install pnpm
```yaml ```yaml
on: on:
@ -62,15 +58,16 @@ on:
- pull_request - pull_request
jobs: jobs:
runs-on: ubuntu-latest install:
runs-on: ubuntu-latest
steps: steps:
- uses: pnpm/action-setup@v1.2.0 - uses: pnpm/action-setup@v2.2.2
with: with:
version: 4.11.1 version: 6.0.2
``` ```
### Install PNPM and a few NPM packages ### Install pnpm and a few npm packages
```yaml ```yaml
on: on:
@ -78,20 +75,67 @@ on:
- pull_request - pull_request
jobs: jobs:
runs-on: ubuntu-latest install:
runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- uses: pnpm/action-setup@v1.2.0 - uses: pnpm/action-setup@v2.2.2
with: with:
version: 4.11.1 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
```yaml
on:
- push
- pull_request
jobs:
cache-and-install:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 16
- uses: pnpm/action-setup@v2.0.1
name: Install pnpm
id: pnpm-install
with:
version: 7
run_install: false
- name: Get pnpm store directory
id: pnpm-cache
run: |
echo "::set-output name=pnpm_cache_dir::$(pnpm store path)"
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
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.
## Notes ## Notes
This action does not setup Node.js for you, use [actions/setup-node](https://github.com/actions/setup-node) yourself. This action does not setup Node.js for you, use [actions/setup-node](https://github.com/actions/setup-node) yourself.

View File

@ -1,29 +1,20 @@
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: 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
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: run_install:
description: If specified, run `pnpm install` description: If specified, run `pnpm install`
required: false required: false
default: 'null' default: 'null'
runs: runs:
using: node12 using: node16
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 Normal file

File diff suppressed because one or more lines are too long

View File

@ -3,23 +3,24 @@
"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", "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" "start": "pnpm run build && sh ./run.sh"
}, },
"dependencies": { "dependencies": {
"node-fetch": "^2.6.0", "@actions/core": "^1.6.0",
"expand-tilde": "^2.0.2",
"js-yaml": "^3.13.1",
"ajv": "^6.12.0",
"@actions/core": "^1.2.4",
"@types/expand-tilde": "^2.0.0", "@types/expand-tilde": "^2.0.0",
"@types/node-fetch": "^2.5.7", "@types/fs-extra": "^9.0.13",
"@types/js-yaml": "^3.12.3", "@types/js-yaml": "^4.0.5",
"@types/node": "^13.13.5" "@types/node": "^14.18.10",
"@types/node-fetch": "^2.6.1",
"ajv": "^6.12.6",
"expand-tilde": "^2.0.2",
"fs-extra": "^10.0.0",
"js-yaml": "^4.1.0"
}, },
"devDependencies": { "devDependencies": {
"typescript": "^3.8.3",
"@ts-schema-autogen/cli": "^0.1.2", "@ts-schema-autogen/cli": "^0.1.2",
"@zeit/ncc": "^0.22.1" "@vercel/ncc": "^0.33.3",
"typescript": "^4.5.5"
} }
} }

930
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,10 @@
{ {
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"pinVersions": false, "pinVersions": false,
"extends": [ "extends": [
"config:base" "config:base"
],
"ignoreDeps": [
"ajv"
] ]
} }

2
run.sh
View File

@ -3,7 +3,5 @@
export HOME="$(pwd)" export HOME="$(pwd)"
export INPUT_VERSION=4.11.1 export INPUT_VERSION=4.11.1
export INPUT_DEST='~/pnpm.temp' export INPUT_DEST='~/pnpm.temp'
export INPUT_BIN_DEST='~/pnpm.temp/.bin'
export INPUT_REGISTRY=https://registry.npmjs.com
export INPUT_RUN_INSTALL=null export INPUT_RUN_INSTALL=null
exec node dist/index.js exec node dist/index.js

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 setOutputs from './outputs'
import installPnpm from './install-pnpm' import installPnpm from './install-pnpm'
import setOutputs from './outputs'
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,8 @@ 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 binDest: string
readonly registry: string
readonly runInstall: RunInstall[] readonly runInstall: RunInstall[]
} }
@ -17,10 +15,8 @@ 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', options), version: getInput('version'),
dest: parseInputPath('dest'), dest: parseInputPath('dest'),
binDest: parseInputPath('bin_dest'),
registry: getInput('registry', options),
runInstall: parseRunInstall('run_install'), runInstall: parseRunInstall('run_install'),
}) })

View File

@ -1,7 +1,7 @@
import process from 'process'
import { safeLoad } from 'js-yaml'
import Ajv from 'ajv'
import { getInput, error, InputOptions } from '@actions/core' 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' import runInstallSchema from './run-install-input.schema.json'
export interface RunInstall { export interface RunInstall {
@ -21,10 +21,9 @@ const options: InputOptions = {
} }
export function parseRunInstall(name: string): RunInstall[] { export function parseRunInstall(name: string): RunInstall[] {
const result: RunInstallInput = safeLoad(getInput(name, options)) const result: RunInstallInput = load(getInput(name, options)) as any
const ajv = new Ajv({ const ajv = new Ajv({
allErrors: true, allErrors: true,
async: false,
}) })
const validate = ajv.compile(runInstallSchema) const validate = ajv.compile(runInstallSchema)
if (!validate(result)) { if (!validate(result)) {

View File

@ -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}`)
} }
} }

134031
src/install-pnpm/pnpm.js Normal file

File diff suppressed because one or more lines are too long

View File

@ -1,26 +1,61 @@
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 path from 'path'
import { execPath } from 'process' import { execPath } from 'process'
import { downloadSelfInstaller } from '../self-installer'
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 cp = spawn(execPath, { const { version, dest } = inputs
env: {
PNPM_VERSION: inputs.version, // prepare self install
PNPM_DEST: inputs.dest, await remove(dest)
PNPM_BIN_DEST: inputs.binDest, const pkgJson = path.join(dest, 'package.json')
PNPM_REGISTRY: inputs.registry, await ensureFile(pkgJson)
}, await writeFile(pkgJson, JSON.stringify({ private: true }))
// 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'], stdio: ['pipe', 'inherit', 'inherit'],
}) })
const response = await downloadSelfInstaller() const exitCode = await new Promise<number>((resolve, reject) => {
response.body.pipe(cp.stdin)
return new Promise((resolve, reject) => {
cp.on('error', reject) cp.on('error', reject)
cp.on('close', resolve) cp.on('close', resolve)
}) })
if (exitCode === 0) {
const pnpmHome = path.join(dest, 'node_modules/.bin')
addPath(pnpmHome)
exportVariable('PNPM_HOME', pnpmHome)
}
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 export default runSelfInstaller

View File

@ -1,10 +1,12 @@
import { setOutput, addPath } from '@actions/core' import { setOutput, addPath } from '@actions/core'
import { Inputs } from '../inputs' import { Inputs } from '../inputs'
import { getBinDest } from '../utils'
export function setOutputs(inputs: Inputs) { export function setOutputs(inputs: Inputs) {
addPath(inputs.binDest) const binDest = getBinDest(inputs)
addPath(binDest)
setOutput('dest', inputs.dest) setOutput('dest', inputs.dest)
setOutput('bin_dest', inputs.binDest) setOutput('bin_dest', binDest)
} }
export default setOutputs export default setOutputs

View File

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

View File

@ -1,5 +1,5 @@
import { spawnSync } from 'child_process'
import { warning, startGroup, endGroup } from '@actions/core' import { warning, startGroup, endGroup } from '@actions/core'
import { spawnSync } from 'child_process'
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,4 +0,0 @@
import fetch from 'node-fetch'
import url from './url'
export const downloadSelfInstaller = () => fetch(url)
export default downloadSelfInstaller

View File

@ -1,2 +0,0 @@
export * from './url'
export * from './download'

View File

@ -1,3 +0,0 @@
export const ref = '301414cec74a2b6b63c95b42f2ad1790ccb980ed'
export const url = `https://raw.githubusercontent.com/pnpm/self-installer/${ref}/install.js`
export default url

View File

@ -1,8 +1,10 @@
import process from 'process'
import path from 'path' import path from 'path'
import process from 'process'
import { Inputs } from '../inputs' import { Inputs } from '../inputs'
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: inputs.binDest + path.delimiter + process.env.PATH PATH: getBinDest(inputs) + path.delimiter + process.env.PATH,
}) })