Skip to content

Add a new CLI flag to allow the user to specify a custom exit code#67

Merged
dannyvv merged 4 commits intomicrosoft:mainfrom
dannyvv:pr/AddFlag
May 9, 2025
Merged

Add a new CLI flag to allow the user to specify a custom exit code#67
dannyvv merged 4 commits intomicrosoft:mainfrom
dannyvv:pr/AddFlag

Conversation

@dannyvv
Copy link
Copy Markdown
Member

@dannyvv dannyvv commented May 8, 2025

Add a new CLI flag to allow the user to specify a custom exit code that gets returned when ado-npm-auth had to re-authenticate. This is useful when one uses a prerelease step to call ado-npm-auth after which yarn has already parsed the configuration and tokens. So the first time the install will fail with a 401, but the second time it will work. This way a prerelease script can be used to make sure yarn is stopped and asked to rerun.

dannyvv added 2 commits May 8, 2025 09:32
exit code that gets returned when ado-npm-auth had to
re-authenticate. This is useful when one uses a prerelease
step to call ado-npm-auth after which yarn has already
parsed the configuration and tokens. So the first time
the install will fail with a 401, but the second time
it will work. This way a prerelease script can be used
to make sure yarn is stopped and asked to rerun..
@dannyvv dannyvv requested a review from Copilot May 8, 2025 16:38
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces a new CLI flag (exitCodeOnReAuthenticate) that allows users to specify a custom exit code when ado-npm-auth undergoes re-authentication.

  • Added a process.exit call in cli.ts to handle the exit code if the flag is provided.
  • Updated the argument parsing in args.ts to support the new CLI flag.
  • Recorded the change in the change log JSON to document the update.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
packages/ado-npm-auth/src/cli.ts Added flag check and process.exit call on successful auth
packages/ado-npm-auth/src/args.ts Integrated new CLI flag in argument parsing
change/change-72abf428-c4ea-439b-bc1e-4f77dc37ce7d.json Documented the change in the change log

@dannyvv dannyvv merged commit 9429a12 into microsoft:main May 9, 2025
12 checks passed
@dannyvv dannyvv deleted the pr/AddFlag branch May 9, 2025 19:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants