From bb9741af4d1fe00adb15e4a7596c7a3472d0bda3 Mon Sep 17 00:00:00 2001 From: Jason Grout Date: Fri, 8 Mar 2019 15:24:29 +0000 Subject: [PATCH] Clean up node path prepending (#7057) * Delete unused scriptsPrependNodePath config option. #6382 (e905f7479ef8ea5ecbc5ca115f0287be709c7d58) made this option obsolete. * Do not prepend the node exec path. #6382 (e905f7479ef8ea5ecbc5ca115f0287be709c7d58) made this unnecessary. * Update CHANGELOG.md * Clarify in changelog the --scripts-prepend-node-path is removed because it is obsolete The current behavior after this PR is not to make `--scripts-prepend-node-path` always on, but to have a better default behavior than the option provided. --- CHANGELOG.md | 4 ++++ src/config.js | 5 ----- src/util/execute-lifecycle-script.js | 7 ------- 3 files changed, 4 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 29df3cb430..56f03616d4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ Please add one entry in this file for each change in Yarn's behavior. Use the sa ## Master +- Removes `--scripts-prepend-node-path` as Yarn's default behavior makes this obsolete + + [#7057](https://github.com/yarnpkg/yarn/pull/7057/files) - [**Jason Grout**](https://github.com/jasongrout) + - Fixes the advisory link printed by `yarn audit` [#7091](https://github.com/yarnpkg/yarn/pull/7091) - [**Jakob Krigovsky**](https://github.com/sonicdoe) diff --git a/src/config.js b/src/config.js index 033b204d90..2fdf5ff162 100644 --- a/src/config.js +++ b/src/config.js @@ -50,7 +50,6 @@ export type ConfigOptions = { nonInteractive?: boolean, enablePnp?: boolean, disablePnp?: boolean, - scriptsPrependNodePath?: boolean, offlineCacheFolder?: string, enableDefaultRc?: boolean, @@ -177,8 +176,6 @@ export default class Config { plugnplayUnplugged: Array; plugnplayPurgeUnpluggedPackages: boolean; - scriptsPrependNodePath: boolean; - workspacesEnabled: boolean; workspacesNohoistEnabled: boolean; @@ -484,8 +481,6 @@ export default class Config { // $FlowFixMe$ this.nonInteractive = !!opts.nonInteractive || isCi || !process.stdout.isTTY; - this.scriptsPrependNodePath = !!opts.scriptsPrependNodePath; - this.requestManager.setOptions({ offline: !!opts.offline && !opts.preferOffline, captureHar: !!opts.captureHar, diff --git a/src/util/execute-lifecycle-script.js b/src/util/execute-lifecycle-script.js index 03b1cb4ae2..02dc6b29c0 100644 --- a/src/util/execute-lifecycle-script.js +++ b/src/util/execute-lifecycle-script.js @@ -164,13 +164,6 @@ export async function makeEnv( const envPath = env[constants.ENV_PATH_KEY]; const pathParts = envPath ? envPath.split(path.delimiter) : []; - // Include the directory that contains node so that we can guarantee that the scripts - // will always run with the exact same Node release than the one use to run Yarn - const execBin = path.dirname(process.execPath); - if (pathParts.indexOf(execBin) === -1) { - pathParts.unshift(execBin); - } - // Include node-gyp version that was bundled with the current Node.js version, // if available. pathParts.unshift(path.join(path.dirname(process.execPath), 'node_modules', 'npm', 'bin', 'node-gyp-bin'));