Disable interaction when running in lifecycle scripts#147
Closed
Fryuni wants to merge 1 commit into
Closed
Conversation
|
👋 @Fryuni
☝️ Lastly, the title for the commit will come from the pull request title. So please provide a descriptive title that summarizes the changes in 50 characters or less using the imperative mood. |
commit: |
Member
|
Tks for the PR. As discussed, in newer versions, the CLI automatically include the no-interaction flag in the package script. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Package-manager lifecycle hooks can currently block dependency installation by asking unrelated interactive questions, such as whether to enable deep links. This is especially problematic for
pre*andpost*scripts, which must run unattended.This change detects npm-compatible lifecycle context through
npm_lifecycle_event. Event names beginning with the case-sensitivepreorpostprefixes force the CLI into its existing non-interactive path. The requested command still executes normally, but optional prompts and host-environment changes remain suppressed.The solution:
Processboundary into the CLI bootstrap and classifies lifecycle events withHasEnvVar;Cli.fromDefaults;NodeProcess;--no-interactioncases.The existing SDK-generated
croct --no-interaction installpostinstall command remains unchanged as defense in depth.Verification
npm test -- --runInBand --runTestsByPath test/infrastructure/application/cli/program.test.ts— 10 tests passednpm run validatenpm run lintnpm run build--usernamediagnostic instead of promptingChecklist