Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: fallback to using the Azure CLI (#11)
<!-- 👋 Hi, thanks for sending a PR to ado-npm-auth-lite! 💖. Please fill out all fields below and make sure each item is true and [x] checked. Otherwise we may not be able to review your PR. --> ## PR Checklist - [ ] Addresses an existing open issue: fixes #10 - [ ] That issue was marked as [`status: accepting prs`](https://github.com/johnnyreilly/ado-npm-auth-lite/issues?q=is%3Aopen+is%3Aissue+label%3A%22status%3A+accepting+prs%22) - [ ] Steps in [CONTRIBUTING.md](https://github.com/johnnyreilly/ado-npm-auth-lite/blob/main/.github/CONTRIBUTING.md) were taken ## Overview <!-- Description of what is changed and how the code change does that. --> Falls back to using the AZ CLI with execa if the initial attempt fails. Output looks like this: ```sh ┌ 📦🔑 Welcome to ado-npm-auth-lite 0.5.0! 📦🔑 │ │ ● options: │ - pat: [NONE SUPPLIED - WILL ACQUIRE FROM AZURE API] │ - config: ./ignore/.npmrc │ - email: [NONE SUPPLIED - WILL USE DEFAULT] │ │ ● Loading .npmrc at: /home/john/code/github/ado-npm-auth-lite/ignore/.npmrc │ ● Parsed: │ - organisation: johnnyreilly │ - urlWithoutRegistryAtStart: //pkgs.dev.azure.com/johnnyreilly/_packaging/npmrc-script-organization/npm/registry/ │ - urlWithoutRegistryAtEnd: //pkgs.dev.azure.com/johnnyreilly/_packaging/npmrc-script-organization/npm/ ◇ ✅ Passed parsing project .npmrc. │ │ ● Creating Azure CLI Token ◓ Creating Personal Access Token..│ ● Creating Personal Access Token with API: { │ "displayName": "made by ado-npm-auth-lite at: 2024-11-10T17:41:11.033Z", │ "scope": "vso.packaging", │ "validTo": "2024-12-10T17:41:11.033Z", │ "allOrgs": false │ } ◓ Creating Personal Access Token...│ ■ Error creating Personal Access Token with API: HTTP error! status: 401 - {"$id":"1","innerException":null,"message":"TF401444: Please sign-in at least once as Windows Live ID\\johnny_reilly@hotmail.com in a web browser to enable access to the service.","typeName":"Microsoft.TeamFoundation.Framework.Server.UnauthorizedRequestException, Microsoft.TeamFoundation.Framework.Server","typeKey":"UnauthorizedRequestException","errorCode":0,"eventId":3000} │ ● Will re-attempt with Azure CLI │ ● Creating Personal Access Token with Azure CLI: { │ "displayName": "made by ado-npm-auth-lite at: 2024-11-10T17:41:11.033Z", │ "scope": "vso.packaging", │ "validTo": "2024-12-10T17:41:11.033Z", │ "allOrgs": false │ } ◒ Creating Personal Access Token.│ ● Created Personal Access Token with Azure CLI ◇ ✅ Passed creating Personal Access Token. │ ◇ ✅ Passed constructing user .npmrc. │ │ ● Writing users .npmrc to: /home/john/.npmrc ◇ ✅ Passed writing user .npmrc. │ └ 📦🔑 Thanks for using ado-npm-auth-lite 0.5.0! 📦🔑 ```
- Loading branch information