Skip to content

Commit

Permalink
Merge pull request #1350 from raineorshine/upgrade-spawn-please
Browse files Browse the repository at this point in the history
  • Loading branch information
raineorshine committed Mar 14, 2024
2 parents 2235c29 + b800ecd commit 97e43c0
Show file tree
Hide file tree
Showing 28 changed files with 736 additions and 448 deletions.
188 changes: 169 additions & 19 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -87,7 +87,7 @@
"semver": "^7.6.0",
"semver-utils": "^1.1.4",
"source-map-support": "^0.5.21",
"spawn-please": "^2.0.2",
"spawn-please": "^3.0.0",
"strip-ansi": "^7.1.0",
"strip-json-comments": "^5.0.1",
"untildify": "^4.0.0",
Expand Down
42 changes: 24 additions & 18 deletions src/index.ts
Expand Up @@ -145,26 +145,32 @@ const install = async (
const cwd = options.cwd || path.resolve(pkgFile, '..')
let stdout = ''
try {
await spawn(cmd, ['install'], {
cwd,
env: {
...process.env,
...(options.color !== false ? { FORCE_COLOR: true } : null),
// With spawn, pnpm install will fail with ERR_PNPM_PEER_DEP_ISSUES Unmet peer dependencies.
// When pnpm install is run directly from the terminal, this error does not occur.
// When pnpm install is run from a simple spawn script, this error does not occur.
// 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.
// For now, turn off strict-peer-dependencies on pnpm auto-install.
// See: https://github.com/raineorshine/npm-check-updates/issues/1191
...(packageManager === 'pnpm' ? { npm_config_strict_peer_dependencies: false } : null),
await spawn(
cmd,
['install'],
{
stdout: (data: string) => {
stdout += data
},
stderr: (data: string) => {
console.error(chalk.red(data.toString()))
},
},
stdout: (data: string) => {
stdout += data
{
cwd,
env: {
...process.env,
...(options.color !== false ? { FORCE_COLOR: true } : null),
// With spawn, pnpm install will fail with ERR_PNPM_PEER_DEP_ISSUES Unmet peer dependencies.
// When pnpm install is run directly from the terminal, this error does not occur.
// When pnpm install is run from a simple spawn script, this error does not occur.
// 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.
// For now, turn off strict-peer-dependencies on pnpm auto-install.
// See: https://github.com/raineorshine/npm-check-updates/issues/1191
...(packageManager === 'pnpm' ? { npm_config_strict_peer_dependencies: false } : null),
},
},
stderr: (data: string) => {
console.error(chalk.red(data.toString()))
},
})
)
print(options, stdout)
print(options, 'Done')
} catch (err: any) {
Expand Down

0 comments on commit 97e43c0

Please sign in to comment.