ado-npm-auth 0.0.2 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/README.md +22 -2
  2. package/dist/ado-npm-auth.cjs +22542 -22481
  3. package/lib/.tsbuildinfo +1 -1
  4. package/lib/azureauth/azureauth-command.d.ts +1 -0
  5. package/lib/azureauth/azureauth-command.d.ts.map +1 -1
  6. package/lib/azureauth/azureauth-command.js +3 -0
  7. package/lib/azureauth/azureauth-command.js.map +1 -1
  8. package/lib/azureauth/is-azureauth-installed.d.ts +1 -0
  9. package/lib/azureauth/is-azureauth-installed.d.ts.map +1 -1
  10. package/lib/azureauth/is-azureauth-installed.js +4 -1
  11. package/lib/azureauth/is-azureauth-installed.js.map +1 -1
  12. package/lib/azureauth/is-azureauth-installed.test.d.ts +2 -0
  13. package/lib/azureauth/is-azureauth-installed.test.d.ts.map +1 -0
  14. package/lib/azureauth/is-azureauth-installed.test.js +51 -0
  15. package/lib/azureauth/is-azureauth-installed.test.js.map +1 -0
  16. package/lib/index.d.ts +1 -0
  17. package/lib/index.js +1 -1
  18. package/lib/npmrc/{checkADO.d.ts → check-tokens.d.ts} +3 -2
  19. package/lib/npmrc/check-tokens.d.ts.map +1 -0
  20. package/lib/npmrc/{checkADO.js → check-tokens.js} +7 -6
  21. package/lib/npmrc/check-tokens.js.map +1 -0
  22. package/lib/npmrc/get-repo-npmrc-ado-orgs.js +1 -1
  23. package/lib/npmrc/get-repo-npmrc-ado-orgs.js.map +1 -1
  24. package/lib/npmrc/{getUserPAT.d.ts → get-user-pat.d.ts} +3 -2
  25. package/lib/npmrc/get-user-pat.d.ts.map +1 -0
  26. package/lib/npmrc/{getUserPAT.js → get-user-pat.js} +4 -3
  27. package/lib/npmrc/get-user-pat.js.map +1 -0
  28. package/lib/npmrc/index.d.ts +1 -0
  29. package/lib/npmrc/index.js +1 -1
  30. package/lib/npmrc/is-valid-pat.js +3 -3
  31. package/lib/npmrc/is-valid-pat.js.map +1 -1
  32. package/lib/npmrc/{makeADORequest.d.ts → make-ado-request.d.ts} +1 -1
  33. package/lib/npmrc/make-ado-request.d.ts.map +1 -0
  34. package/lib/npmrc/{makeADORequest.js → make-ado-request.js} +2 -2
  35. package/lib/npmrc/make-ado-request.js.map +1 -0
  36. package/lib/npmrc/pat.js +1 -1
  37. package/lib/npmrc/pat.js.map +1 -1
  38. package/lib/npmrc/set-npmrc-pat.js +1 -1
  39. package/lib/npmrc/set-npmrc-pat.js.map +1 -1
  40. package/lib/utils/exec.d.ts +1 -1
  41. package/lib/{npmrc/getFeedWithoutProtocol.d.ts → utils/get-feed-without-protocol.d.ts} +1 -1
  42. package/lib/utils/get-feed-without-protocol.d.ts.map +1 -0
  43. package/lib/utils/get-feed-without-protocol.js +13 -0
  44. package/lib/utils/get-feed-without-protocol.js.map +1 -0
  45. package/lib/utils/get-feed-without-protocol.test.d.ts +2 -0
  46. package/lib/utils/get-feed-without-protocol.test.d.ts.map +1 -0
  47. package/lib/utils/get-feed-without-protocol.test.js +31 -0
  48. package/lib/utils/get-feed-without-protocol.test.js.map +1 -0
  49. package/lib/{npmrc/getOrganizationFromFeedUrl.d.ts → utils/get-organization-from-feed-url.d.ts} +1 -1
  50. package/lib/utils/get-organization-from-feed-url.d.ts.map +1 -0
  51. package/lib/utils/get-organization-from-feed-url.js +78 -0
  52. package/lib/utils/get-organization-from-feed-url.js.map +1 -0
  53. package/lib/utils/get-organization-from-feed-url.test.d.ts +2 -0
  54. package/lib/utils/get-organization-from-feed-url.test.d.ts.map +1 -0
  55. package/lib/utils/get-organization-from-feed-url.test.js +19 -0
  56. package/lib/utils/get-organization-from-feed-url.test.js.map +1 -0
  57. package/lib/{npmrc/makeRequest.d.ts → utils/request.d.ts} +2 -2
  58. package/lib/utils/request.d.ts.map +1 -0
  59. package/lib/{npmrc/makeRequest.js → utils/request.js} +1 -1
  60. package/lib/utils/request.js.map +1 -0
  61. package/package.json +8 -3
  62. package/static/image.png +0 -0
  63. package/static/preinstall.png +0 -0
  64. package/lib/npmrc/checkADO.d.ts.map +0 -1
  65. package/lib/npmrc/checkADO.js.map +0 -1
  66. package/lib/npmrc/getFeedWithoutProtocol.d.ts.map +0 -1
  67. package/lib/npmrc/getFeedWithoutProtocol.js +0 -11
  68. package/lib/npmrc/getFeedWithoutProtocol.js.map +0 -1
  69. package/lib/npmrc/getOrganizationFromFeedUrl.d.ts.map +0 -1
  70. package/lib/npmrc/getOrganizationFromFeedUrl.js +0 -27
  71. package/lib/npmrc/getOrganizationFromFeedUrl.js.map +0 -1
  72. package/lib/npmrc/getUserPAT.d.ts.map +0 -1
  73. package/lib/npmrc/getUserPAT.js.map +0 -1
  74. package/lib/npmrc/makeADORequest.d.ts.map +0 -1
  75. package/lib/npmrc/makeADORequest.js.map +0 -1
  76. package/lib/npmrc/makeRequest.d.ts.map +0 -1
  77. package/lib/npmrc/makeRequest.js.map +0 -1
package/README.md CHANGED
@@ -12,12 +12,32 @@ You can run the binary `"ado-npm-auth"` via `yarn ado-npm-auth` or `npm exec ado
12
12
 
13
13
  It will then shell out to the `azureauth` package on [npm](https://www.npmjs.com/package/azureauth), retrieve a token, and update your `~/.npmrc`.
14
14
 
15
+ ## Beware the chicken and egg problem
16
+
17
+ You may need to set the registry to the public NPM feed when running `npm exec` or `npx`.
18
+
19
+ If that's the case, set the environment variable `npm_config_registry=https://registry.npmjs.org`.
20
+
21
+ That will ensure that `npx` or `npm exec` grabs from the public NPM feed, bypassing the soon-to-be authenticated ADO feed.
22
+
15
23
  ## ado-npm-auth vs vsts-npm-auth
16
24
 
17
25
  The main difference between the two is how they function, and where they can run. The `vsts-npm-auth` tool is Windows only, and uses MSAL authentication.
18
26
 
19
27
  `ado-npm-auth` uses the `node-azureauth` library, to wrap the [azureauth-cli](https://github.com/AzureAD/microsoft-authentication-cli), which itself is a cross platform MSAL wrapper.
20
28
 
21
- ![screenshot of tool running](image.png)
29
+ ![screenshot of tool running](https://github.com/microsoft/ado-npm-auth/raw/main/packages/ado-npm-auth/static/image.png)
30
+
31
+ Since the `azureauth-cli` is cross-platform, `ado-npm-auth` will also run cross-platform as well!
32
+
33
+ One of the easiest ways to use the tool is to add it to your `"preinstall"` script in your repo like this...
34
+
35
+ ```json
36
+ "scripts": {
37
+ "preinstall": "npm exec ado-npm-auth"
38
+ },
39
+ ```
40
+
41
+ It will then perform a quick "pre-flight" check to assess if the token is valid, and generate a new one if it has expired.
22
42
 
23
- Since the `azureauth-cli` is cross-platform, `ado-npm-auth` will also run cross-platform as well.
43
+ ![screenshot of tool running via preinstall](https://github.com/microsoft/ado-npm-auth/raw/main/packages/ado-npm-auth/static/preinstall.png)