Skip to content

Commit 97e43c0

Browse files
authored
Merge pull request #1350 from raineorshine/upgrade-spawn-please
2 parents 2235c29 + b800ecd commit 97e43c0

28 files changed

+736
-448
lines changed

package-lock.json

Lines changed: 169 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@
8787
"semver": "^7.6.0",
8888
"semver-utils": "^1.1.4",
8989
"source-map-support": "^0.5.21",
90-
"spawn-please": "^2.0.2",
90+
"spawn-please": "^3.0.0",
9191
"strip-ansi": "^7.1.0",
9292
"strip-json-comments": "^5.0.1",
9393
"untildify": "^4.0.0",

src/index.ts

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -145,26 +145,32 @@ const install = async (
145145
const cwd = options.cwd || path.resolve(pkgFile, '..')
146146
let stdout = ''
147147
try {
148-
await spawn(cmd, ['install'], {
149-
cwd,
150-
env: {
151-
...process.env,
152-
...(options.color !== false ? { FORCE_COLOR: true } : null),
153-
// With spawn, pnpm install will fail with ERR_PNPM_PEER_DEP_ISSUES Unmet peer dependencies.
154-
// When pnpm install is run directly from the terminal, this error does not occur.
155-
// When pnpm install is run from a simple spawn script, this error does not occur.
156-
// The issue only seems to be when pnpm install is executed from npm-check-updates, but it's not clear what configuration or environmental factors are causing this.
157-
// For now, turn off strict-peer-dependencies on pnpm auto-install.
158-
// See: https://github.com/raineorshine/npm-check-updates/issues/1191
159-
...(packageManager === 'pnpm' ? { npm_config_strict_peer_dependencies: false } : null),
148+
await spawn(
149+
cmd,
150+
['install'],
151+
{
152+
stdout: (data: string) => {
153+
stdout += data
154+
},
155+
stderr: (data: string) => {
156+
console.error(chalk.red(data.toString()))
157+
},
160158
},
161-
stdout: (data: string) => {
162-
stdout += data
159+
{
160+
cwd,
161+
env: {
162+
...process.env,
163+
...(options.color !== false ? { FORCE_COLOR: true } : null),
164+
// With spawn, pnpm install will fail with ERR_PNPM_PEER_DEP_ISSUES Unmet peer dependencies.
165+
// When pnpm install is run directly from the terminal, this error does not occur.
166+
// When pnpm install is run from a simple spawn script, this error does not occur.
167+
// The issue only seems to be when pnpm install is executed from npm-check-updates, but it's not clear what configuration or environmental factors are causing this.
168+
// For now, turn off strict-peer-dependencies on pnpm auto-install.
169+
// See: https://github.com/raineorshine/npm-check-updates/issues/1191
170+
...(packageManager === 'pnpm' ? { npm_config_strict_peer_dependencies: false } : null),
171+
},
163172
},
164-
stderr: (data: string) => {
165-
console.error(chalk.red(data.toString()))
166-
},
167-
})
173+
)
168174
print(options, stdout)
169175
print(options, 'Done')
170176
} catch (err: any) {

0 commit comments

Comments
 (0)