Compare commits

...

59 Commits

Author SHA1 Message Date
dependabot[bot]
ebcfd6995d
Bump actions/setup-node from 3 to 4 (#103)
Bumps [actions/setup-node](https://github.com/actions/setup-node) from 3 to 4.
- [Release notes](https://github.com/actions/setup-node/releases)
- [Commits](https://github.com/actions/setup-node/compare/v3...v4)

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

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-11-10 21:58:17 +02:00
Steven Yung
d2613e087f
docs: update pnpm version in caching example (#94) 2023-09-27 19:17:23 +03:00
dependabot[bot]
d928be8e0c
Bump actions/checkout from 3 to 4 (#96)
Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4.
- [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/v3...v4)

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

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-27 19:17:06 +03:00
Khải
d882d12c64
feat: standalone binary (#92)
* feat: add an option to install the self-contained binary version of pnpm

* test: add a test about nodejs_bundled

* style: remove an empty line

* chore: use newer pnpm

* chore: update dependencies

* feat: rename `nodejs_bundled` to `standalone`

as @zkochan suggested

* docs: add

---------

Co-authored-by: Takashi Sato <takashi@tks.st>
2023-07-26 14:50:04 +03:00
Khải
0b715c7ebb
Merge pull request #75 from ojeytonwilliams/fix/caching-example
docs: update the caching example
2023-07-25 17:00:41 +07:00
Khải
2ed49cbb02
Merge pull request #88 from KengoTODA/make-path-configurable
support projects that have package.json in non-root directory
2023-07-25 16:59:00 +07:00
Khải
218cb35941
Merge pull request #69 from zakuro9715/zakuro9715-patch-2
Remove corepack url in error message
2023-07-25 14:16:42 +07:00
Khải
3723f63bb4
Merge pull request #90 from pnpm/optional-version
feat: make version actually optional
2023-07-25 14:05:04 +07:00
khai96_
849d884800 feat: make version actually optional
closes https://github.com/pnpm/action-setup/issues/85
2023-07-25 14:01:28 +07:00
khai96_
f92eb0edb6 docs: update pnpm version in readme
fixes https://github.com/pnpm/action-setup/issues/89
2023-07-25 13:50:35 +07:00
Kengo TODA
b27f801bf9 feat: add package_json_file option
Signed-off-by: Kengo TODA <skypencil@gmail.com>
2023-07-08 07:02:46 +08:00
Khải
11dd14d0c0
Change sponsor to pnpm's opencollective 2023-04-22 17:39:01 +07:00
Oliver Eyton-Williams
61eb8c655a
docs: update the caching example 2023-03-08 00:13:47 +01:00
zakuro
65db188e28
Remove corepack url in error message 2022-11-09 06:54:12 +09:00
Khải
0609f0983b
Merge pull request #66 from mrienstra/patch-1
docs: drop minor & patch version from examples
2022-11-02 12:09:43 +07:00
Michael Rienstra
7208fa2733
docs: drop minor & patch version from examples 2022-11-01 21:55:20 -07:00
Khải
1bd00a2972
Merge pull request #64 from mrienstra/patch-1
typo: not latest version
2022-10-26 10:32:07 +07:00
Michael Rienstra
d5601fb603
bump first occurrence of actions/checkout to v3 2022-10-25 10:52:54 -07:00
Michael Rienstra
bc06aa6030
typo: not latest version 2022-10-25 10:42:24 -07:00
Khải
cd2af74528
Merge pull request #62 from melMass/mel/fix-readme
fix: ️ cross-platform example
2022-10-18 17:29:18 +07:00
Mel Massadian
c8a150e137
fix: ️ just use shell:bash
set-output is deprecated see #58
2022-10-18 12:23:15 +02:00
Mel Massadian
ed0172a253
fix: ️ cross-platform example 2022-10-18 12:02:38 +02:00
Zoltan Kochan
c3b53f6a16
chore(release): 2.2.4 2022-10-15 21:12:50 +03:00
Zoltan Kochan
21e88da200
fix(deps): update 2022-10-15 21:12:13 +03:00
Zoltan Kochan
fc3334fa11
build 2022-10-15 21:09:00 +03:00
Sébastien Vanvelthem
d01953a678
Update action/core to 1.10.0 to fix deprecation warnings (#59)
* chore: update action/core to 1.10.0

* chore(lock): freshen
2022-10-15 20:57:21 +03:00
Khải
3360b50db7
Merge pull request #58 from belgattitude/doc-adapt-to-new-github-env
Doc update to account for deprecated `set-output`.
2022-10-13 22:23:23 +07:00
Sébastien Vanvelthem
6f9e9a867a docs: update to new github env 2022-10-13 16:58:06 +02:00
Khải
537643d491
Merge pull request #56 from i7eo/master
chore: bump node version
2022-10-11 11:58:06 +07:00
George Tan
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
Lew Blood
6e1964dde3
Fix spacing issue in README.md example (#48) 2022-06-17 23:17:05 +03:00
Zoltan Kochan
10693b3829
Update action.yml 2022-05-28 17:23:43 +03:00
Zoltan Kochan
99ecd24520 v2.2.2 2022-05-28 17:22:28 +03:00
Zoltan Kochan
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
Khải
57b9359b4c
Merge pull request #41 from nelson6e65/patch-1
docs(readme): improve Cache example
2022-05-07 10:00:37 +07:00
Khải
ec1a8b444c
Change runs-on back to ubuntu-latest 2022-05-07 09:59:56 +07:00
Nelson Martell
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
Khải
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
Khải
5fa8980bf4
Update dependabot.yml 2022-03-08 10:32:48 +07:00
dependabot[bot]
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
Jack Works
35ab4267a1
fix: packageManager reader (#35)
* fix: packageManager reader

* chore: resolve review

* chore: run build
2022-02-25 12:43:26 +08:00
khai96_
11ba3424e0 fmt 2022-02-23 10:07:15 +07:00
Khải
847a737d63
Merge pull request #33 from pnpm/packageManager
feat: try support packageManager
2022-02-22 16:39:23 +07:00
Zoltan Kochan
225f3bb4b0
build 2022-02-22 11:34:20 +02:00
Zoltan Kochan
777a50d72e
Update src/install-pnpm/run.ts 2022-02-22 11:32:59 +02:00
khai96_
e7c10c6fc5 Update dist/index.js 2022-02-22 13:04:41 +07:00
Jack Works
a576a70bc6 chore: resolve review 2022-02-22 13:37:35 +08:00
Jack Works
1d51e20937 feat: try support packageManager 2022-02-22 12:26:05 +08:00
Khải
ad2b35ae0c
Merge pull request #32 from pnpm/retry-fetch
fix: retry fetch of pnpm script
2022-02-21 10:28:16 +07:00
Zoltan Kochan
d8ea532ac4
fix: retry fetch of pnpm script
close #22
2022-02-20 21:49:26 +02:00
khai96_
2270f39ef6 v2.1.0 2022-02-08 19:53:18 +07:00
khai96_
394c848db6 Update the bundle 2022-02-08 19:50:57 +07:00
Khải
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
Khải
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
Zoltan Kochan
9eb14dd77c
decrease bundle size 2022-02-08 14:44:50 +02:00
Zoltan Kochan
eafb777c56
download script from pnpm.io 2022-02-08 00:39:20 +02:00
Zoltan Kochan
e6378df420
PNPM_HOME_PATH=>PNPM_HOME 2022-02-08 00:21:53 +02:00
Zoltan Kochan
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
Eric Liu
45d9c91ff6 Specify job name to fix syntax error 2022-01-29 08:17:29 -08:00
19 changed files with 268844 additions and 694 deletions

14
.github/FUNDING.yml vendored
View File

@ -1,12 +1,2 @@
# These are supported funding model platforms
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: khai96_
open_collective: # Collective unavailable
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # disabled
otechie: # Replace with a single Otechie username
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
custom:
- https://opencollective.com/pnpm

View File

@ -5,6 +5,3 @@ updates:
schedule:
interval: weekly
open-pull-requests-limit: 10
labels:
- dependabot
- github-actions

View File

@ -22,7 +22,7 @@ jobs:
- windows-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Run the action
uses: ./
@ -35,8 +35,8 @@ jobs:
- name: 'Test: install'
run: pnpm install
test_explicit_inputs:
name: Test with explicit inputs
test_dest:
name: Test with dest
runs-on: ${{ matrix.os }}
@ -51,7 +51,7 @@ jobs:
- windows-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Run the action
uses: ./
@ -65,6 +65,61 @@ jobs:
- name: 'Test: install'
run: pnpm install
test_standalone:
name: Test with standalone
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest
standalone:
- true
- false
steps:
- uses: actions/checkout@v4
- name: Run the action
uses: ./
with:
version: 7.0.0
standalone: ${{ matrix.standalone }}
- name: install Node.js
uses: actions/setup-node@v4
with:
# pnpm@7.0.0 is not compatible with Node.js 12
node-version: 12.22.12
- name: 'Test: which (pnpm)'
run: which pnpm
- name: 'Test: which (pnpx)'
if: matrix.standalone == false
run: which pnpx
- name: 'Test: install when standalone is true'
if: matrix.standalone
run: pnpm install
- name: 'Test: install when standalone is false'
if: matrix.standalone == false
# Since the default shell on windows runner is pwsh, we specify bash explicitly
shell: bash
run: |
if pnpm install; then
echo "pnpm install should fail"
exit 1
else
echo "pnpm install failed as expected"
fi
test_run_install:
name: 'Test with run_install (${{ matrix.run_install.name }}, ${{ matrix.os }})'
@ -107,7 +162,7 @@ jobs:
- pnpm
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Run the action
uses: ./

1
.gitignore vendored
View File

@ -2,6 +2,7 @@ node_modules
*.log
/dist/*
!/dist/index.js
!/dist/pnpm.js
tmp
temp
*.tmp

View File

@ -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`
@ -34,6 +38,16 @@ If `run_install` is a YAML string representation of either an object or an array
**Optional** (_type:_ `string[]`) Additional arguments after `pnpm [recursive] install`, e.g. `[--frozen-lockfile, --strict-peer-dependencies]`.
### `package_json_file`
**Optional** (_type:_ `string`, _default:_ `package.json`) File path to the `package.json` to read "packageManager" configuration.
### `standalone`
**Optional** (_type:_ `boolean`, _default:_ `false`) When set to true, [@pnpm/exe](https://www.npmjs.com/package/@pnpm/exe), which is a Node.js bundled package, will be installed, enabling using `pnpm` without Node.js.
This is useful when you want to use a incompatible pair of Node.js and pnpm.
## Outputs
### `dest`
@ -54,12 +68,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
with:
version: 8
```
### Install pnpm and a few npm packages
@ -70,18 +85,19 @@ on:
- pull_request
jobs:
runs-on: ubuntu-latest
install:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
steps:
- uses: actions/checkout@v3
- 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
with:
version: 8
run_install: |
- recursive: true
args: [--frozen-lockfile, --strict-peer-dependencies]
- args: [--global, gulp, prettier, typescript]
```
### Use cache to reduce installation time
@ -92,24 +108,39 @@ 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') }}
node-version: 16
- uses: pnpm/action-setup@v2
name: Install pnpm
with:
version: 8
run_install: false
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-
${{ runner.os }}-pnpm-store-
- uses: pnpm/action-setup@v2.0.1
with:
version: 6.0.2
run_install: true
- 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.

View File

@ -1,21 +1,29 @@
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
required: false
dest:
description: Where to store PNPM files
description: Where to store pnpm files
required: false
default: ~/setup-pnpm
run_install:
description: If specified, run `pnpm install`
required: false
default: 'null'
package_json_file:
description: File path to the package.json to read "packageManager" configuration
required: false
default: 'package.json'
standalone:
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
default: 'false'
runs:
using: node12
using: node16
main: dist/index.js
post: dist/index.js

BIN
dist/index.js vendored

Binary file not shown.

134031
dist/pnpm.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -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": {
"node-fetch": "^2.6.1",
"expand-tilde": "^2.0.2",
"js-yaml": "^4.0.0",
"ajv": "^6.12.5",
"fs-extra": "^9.1.0",
"@actions/core": "^1.2.6",
"@actions/core": "^1.10.0",
"@types/expand-tilde": "^2.0.0",
"@types/node-fetch": "^2.5.8",
"@types/js-yaml": "^4.0.0",
"@types/fs-extra": "^9.0.8",
"@types/node": "^14.14.35"
"@types/fs-extra": "^9.0.13",
"@types/js-yaml": "^4.0.5",
"@types/node": "^14.18.54",
"@types/node-fetch": "^2.6.4",
"ajv": "^6.12.6",
"expand-tilde": "^2.0.2",
"fs-extra": "^10.1.0",
"js-yaml": "^4.1.0"
},
"devDependencies": {
"typescript": "^4.2.3",
"@ts-schema-autogen/cli": "^0.1.2",
"@vercel/ncc": "^0.27.0"
"@vercel/ncc": "^0.33.4",
"typescript": "^4.9.5"
}
}

File diff suppressed because it is too large Load Diff

1
run.sh
View File

@ -4,4 +4,5 @@ export HOME="$(pwd)"
export INPUT_VERSION=4.11.1
export INPUT_DEST='~/pnpm.temp'
export INPUT_RUN_INSTALL=null
export INPUT_standalone=false
exec node dist/index.js

View File

@ -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'

View File

@ -1,11 +1,13 @@
import { getInput, InputOptions } from '@actions/core'
import { getBooleanInput, getInput, InputOptions } from '@actions/core'
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[]
readonly packageJsonFile: string
readonly standalone: boolean
}
const options: InputOptions = {
@ -15,9 +17,11 @@ 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'),
packageJsonFile: parseInputPath('package_json_file'),
standalone: getBooleanInput('standalone'),
})
export default getInputs

View File

@ -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

File diff suppressed because one or more lines are too long

View File

@ -1,31 +1,72 @@
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')
const { version, dest, packageJsonFile, standalone } = inputs
// 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, packageJsonFile, standalone })
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)
return new Promise((resolve, reject) => {
const exitCode = await new Promise<number>((resolve, reject) => {
cp.on('error', reject)
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(opts: {
readonly version?: string | undefined
readonly packageJsonFile: string
readonly standalone: boolean
}) {
const { version, packageJsonFile, standalone } = opts
if (version) return `${ standalone ? '@pnpm/exe' : '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, packageJsonFile), '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"`)
}
if (!packageManager.startsWith('pnpm@')) {
throw new Error('Invalid packageManager field in package.json')
}
if(standalone){
return packageManager.replace('pnpm@', '@pnpm/exe@')
}
return packageManager
}
export default runSelfInstaller

View File

@ -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'

View File

@ -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()

View File

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