Skip to content

build: do not prompt on postinstall in bazel yarn install #20294

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions tools/postinstall/apply-patches.js
Original file line number Diff line number Diff line change
Expand Up @@ -247,12 +247,18 @@ async function readAndValidatePatchMarker() {
console.error(chalk.red('cleaned up.'));
}

const {cleanupModules} = await inquirer.prompt({
name: 'cleanupModules',
type: 'confirm',
message: 'Clean up node modules automatically?',
default: false
});
let cleanupModules = true;

// Do not prompt if there is no TTY. Inquirer does not skip in non-tty environments.
// TODO: Remove once inquirer has been updated to v8.x where TTY is respected.
if (process.stdin.isTTY) {
cleanupModules = (await inquirer.prompt({
name: 'result',
type: 'confirm',
message: 'Clean up node modules automatically?',
default: false
})).result;
}

if (cleanupModules) {
// This re-runs Yarn with `--check-files` mode. The postinstall will rerun afterwards,
Expand Down