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.
- package/README.md +22 -2
- package/dist/ado-npm-auth.cjs +22542 -22481
- package/lib/.tsbuildinfo +1 -1
- package/lib/azureauth/azureauth-command.d.ts +1 -0
- package/lib/azureauth/azureauth-command.d.ts.map +1 -1
- package/lib/azureauth/azureauth-command.js +3 -0
- package/lib/azureauth/azureauth-command.js.map +1 -1
- package/lib/azureauth/is-azureauth-installed.d.ts +1 -0
- package/lib/azureauth/is-azureauth-installed.d.ts.map +1 -1
- package/lib/azureauth/is-azureauth-installed.js +4 -1
- package/lib/azureauth/is-azureauth-installed.js.map +1 -1
- package/lib/azureauth/is-azureauth-installed.test.d.ts +2 -0
- package/lib/azureauth/is-azureauth-installed.test.d.ts.map +1 -0
- package/lib/azureauth/is-azureauth-installed.test.js +51 -0
- package/lib/azureauth/is-azureauth-installed.test.js.map +1 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -1
- package/lib/npmrc/{checkADO.d.ts → check-tokens.d.ts} +3 -2
- package/lib/npmrc/check-tokens.d.ts.map +1 -0
- package/lib/npmrc/{checkADO.js → check-tokens.js} +7 -6
- package/lib/npmrc/check-tokens.js.map +1 -0
- package/lib/npmrc/get-repo-npmrc-ado-orgs.js +1 -1
- package/lib/npmrc/get-repo-npmrc-ado-orgs.js.map +1 -1
- package/lib/npmrc/{getUserPAT.d.ts → get-user-pat.d.ts} +3 -2
- package/lib/npmrc/get-user-pat.d.ts.map +1 -0
- package/lib/npmrc/{getUserPAT.js → get-user-pat.js} +4 -3
- package/lib/npmrc/get-user-pat.js.map +1 -0
- package/lib/npmrc/index.d.ts +1 -0
- package/lib/npmrc/index.js +1 -1
- package/lib/npmrc/is-valid-pat.js +3 -3
- package/lib/npmrc/is-valid-pat.js.map +1 -1
- package/lib/npmrc/{makeADORequest.d.ts → make-ado-request.d.ts} +1 -1
- package/lib/npmrc/make-ado-request.d.ts.map +1 -0
- package/lib/npmrc/{makeADORequest.js → make-ado-request.js} +2 -2
- package/lib/npmrc/make-ado-request.js.map +1 -0
- package/lib/npmrc/pat.js +1 -1
- package/lib/npmrc/pat.js.map +1 -1
- package/lib/npmrc/set-npmrc-pat.js +1 -1
- package/lib/npmrc/set-npmrc-pat.js.map +1 -1
- package/lib/utils/exec.d.ts +1 -1
- package/lib/{npmrc/getFeedWithoutProtocol.d.ts → utils/get-feed-without-protocol.d.ts} +1 -1
- package/lib/utils/get-feed-without-protocol.d.ts.map +1 -0
- package/lib/utils/get-feed-without-protocol.js +13 -0
- package/lib/utils/get-feed-without-protocol.js.map +1 -0
- package/lib/utils/get-feed-without-protocol.test.d.ts +2 -0
- package/lib/utils/get-feed-without-protocol.test.d.ts.map +1 -0
- package/lib/utils/get-feed-without-protocol.test.js +31 -0
- package/lib/utils/get-feed-without-protocol.test.js.map +1 -0
- package/lib/{npmrc/getOrganizationFromFeedUrl.d.ts → utils/get-organization-from-feed-url.d.ts} +1 -1
- package/lib/utils/get-organization-from-feed-url.d.ts.map +1 -0
- package/lib/utils/get-organization-from-feed-url.js +78 -0
- package/lib/utils/get-organization-from-feed-url.js.map +1 -0
- package/lib/utils/get-organization-from-feed-url.test.d.ts +2 -0
- package/lib/utils/get-organization-from-feed-url.test.d.ts.map +1 -0
- package/lib/utils/get-organization-from-feed-url.test.js +19 -0
- package/lib/utils/get-organization-from-feed-url.test.js.map +1 -0
- package/lib/{npmrc/makeRequest.d.ts → utils/request.d.ts} +2 -2
- package/lib/utils/request.d.ts.map +1 -0
- package/lib/{npmrc/makeRequest.js → utils/request.js} +1 -1
- package/lib/utils/request.js.map +1 -0
- package/package.json +8 -3
- package/static/image.png +0 -0
- package/static/preinstall.png +0 -0
- package/lib/npmrc/checkADO.d.ts.map +0 -1
- package/lib/npmrc/checkADO.js.map +0 -1
- package/lib/npmrc/getFeedWithoutProtocol.d.ts.map +0 -1
- package/lib/npmrc/getFeedWithoutProtocol.js +0 -11
- package/lib/npmrc/getFeedWithoutProtocol.js.map +0 -1
- package/lib/npmrc/getOrganizationFromFeedUrl.d.ts.map +0 -1
- package/lib/npmrc/getOrganizationFromFeedUrl.js +0 -27
- package/lib/npmrc/getOrganizationFromFeedUrl.js.map +0 -1
- package/lib/npmrc/getUserPAT.d.ts.map +0 -1
- package/lib/npmrc/getUserPAT.js.map +0 -1
- package/lib/npmrc/makeADORequest.d.ts.map +0 -1
- package/lib/npmrc/makeADORequest.js.map +0 -1
- package/lib/npmrc/makeRequest.d.ts.map +0 -1
- 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
|
-

|
|
29
|
+

|
|
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
|
-
|
|
43
|
+

|