@vltpkg/cli-sdk 1.0.8 → 1.0.9
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/dist/commands/setup.js +25 -1
- package/package.json +25 -25
package/dist/commands/setup.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { error } from '@vltpkg/error-cause';
|
|
2
2
|
import { RegistryClient } from '@vltpkg/registry-client';
|
|
3
3
|
import { defaultRegistries } from '@vltpkg/spec';
|
|
4
|
+
import { asError, isErrorWithCause, isObject } from '@vltpkg/types';
|
|
4
5
|
import { createInterface } from 'node:readline/promises';
|
|
5
6
|
import { configWriteTarget } from "../config/index.js";
|
|
6
7
|
import { registrySelectionFields } from "../config/merge-layers.js";
|
|
@@ -17,6 +18,24 @@ export const VLT_REGISTRY_BASE = 'https://registry.vlt.io';
|
|
|
17
18
|
export const accountRegistries = ['npm', 'main'];
|
|
18
19
|
/** Build the per-account registry URL for a given registry name. */
|
|
19
20
|
export const accountRegistryURL = (account, name) => `${VLT_REGISTRY_BASE}/${encodeURIComponent(account)}/${name}/`;
|
|
21
|
+
/**
|
|
22
|
+
* The account registries live at `${VLT_REGISTRY_BASE}/<account>/<name>/`, so
|
|
23
|
+
* an account slug that doesn't exist is a 404 from the login endpoint. Say
|
|
24
|
+
* that in terms of the slug the user typed, rather than passing along the
|
|
25
|
+
* bare HTTP failure.
|
|
26
|
+
*/
|
|
27
|
+
const accountAuthError = (account, er) => (isErrorWithCause(er) &&
|
|
28
|
+
isObject(er.cause) &&
|
|
29
|
+
er.cause.status === 404) ?
|
|
30
|
+
error([
|
|
31
|
+
`No vlt.io account or organization named "${account}".`,
|
|
32
|
+
'',
|
|
33
|
+
`Looked for it at ${accountRegistryURL(account, accountRegistries[0])}`,
|
|
34
|
+
'',
|
|
35
|
+
'Check the spelling of the slug, or sign up / create the',
|
|
36
|
+
`organization at ${VLT_SIGNUP_URL}, then run \`vlt setup\` again.`,
|
|
37
|
+
].join('\n'), { code: 'ECONFIG', cause: er })
|
|
38
|
+
: asError(er);
|
|
20
39
|
/** Ensure a registry URL ends with a single trailing slash. */
|
|
21
40
|
const normalizeRegistryURL = (url) => url.endsWith('/') ? url : `${url}/`;
|
|
22
41
|
export const views = {
|
|
@@ -113,7 +132,12 @@ export const command = async (conf) => {
|
|
|
113
132
|
// one token covers every registry on the account, so the browser
|
|
114
133
|
// opens once and the token is stored for all of them.
|
|
115
134
|
stdout(`Authenticating your account registries (${accountRegistries.join(', ')})...`);
|
|
116
|
-
|
|
135
|
+
try {
|
|
136
|
+
await rc.login(accountRegistries.map(name => accountRegistryURL(account, name)));
|
|
137
|
+
}
|
|
138
|
+
catch (er) {
|
|
139
|
+
throw accountAuthError(account, er);
|
|
140
|
+
}
|
|
117
141
|
}
|
|
118
142
|
// 5. offer to add further custom aliases
|
|
119
143
|
for (;;) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vltpkg/cli-sdk",
|
|
3
3
|
"description": "The source for the vlt CLI",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.9",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git+https://github.com/vltpkg/vltpkg.git",
|
|
@@ -14,30 +14,30 @@
|
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"@resvg/resvg-wasm": "^2.6.2",
|
|
17
|
-
"@vltpkg/config": "1.0.
|
|
18
|
-
"@vltpkg/dep-id": "1.0.
|
|
19
|
-
"@vltpkg/dot-prop": "1.0.
|
|
20
|
-
"@vltpkg/error-cause": "1.0.
|
|
21
|
-
"@vltpkg/git": "1.0.
|
|
22
|
-
"@vltpkg/graph": "1.0.
|
|
23
|
-
"@vltpkg/graph-run": "1.0.
|
|
24
|
-
"@vltpkg/init": "1.0.
|
|
25
|
-
"@vltpkg/output": "1.0.
|
|
26
|
-
"@vltpkg/package-info": "1.0.
|
|
27
|
-
"@vltpkg/package-json": "1.0.
|
|
28
|
-
"@vltpkg/promise-spawn": "1.0.
|
|
29
|
-
"@vltpkg/query": "1.0.
|
|
30
|
-
"@vltpkg/registry-client": "1.0.
|
|
31
|
-
"@vltpkg/rollback-remove": "1.0.
|
|
32
|
-
"@vltpkg/run": "1.0.
|
|
33
|
-
"@vltpkg/security-archive": "1.0.
|
|
34
|
-
"@vltpkg/spec": "1.0.
|
|
35
|
-
"@vltpkg/types": "1.0.
|
|
36
|
-
"@vltpkg/url-open": "1.0.
|
|
37
|
-
"@vltpkg/vlt-json": "1.0.
|
|
38
|
-
"@vltpkg/vlx": "1.0.
|
|
39
|
-
"@vltpkg/workspaces": "1.0.
|
|
40
|
-
"@vltpkg/xdg": "1.0.
|
|
17
|
+
"@vltpkg/config": "1.0.9",
|
|
18
|
+
"@vltpkg/dep-id": "1.0.9",
|
|
19
|
+
"@vltpkg/dot-prop": "1.0.9",
|
|
20
|
+
"@vltpkg/error-cause": "1.0.9",
|
|
21
|
+
"@vltpkg/git": "1.0.9",
|
|
22
|
+
"@vltpkg/graph": "1.0.9",
|
|
23
|
+
"@vltpkg/graph-run": "1.0.9",
|
|
24
|
+
"@vltpkg/init": "1.0.9",
|
|
25
|
+
"@vltpkg/output": "1.0.9",
|
|
26
|
+
"@vltpkg/package-info": "1.0.9",
|
|
27
|
+
"@vltpkg/package-json": "1.0.9",
|
|
28
|
+
"@vltpkg/promise-spawn": "1.0.9",
|
|
29
|
+
"@vltpkg/query": "1.0.9",
|
|
30
|
+
"@vltpkg/registry-client": "1.0.9",
|
|
31
|
+
"@vltpkg/rollback-remove": "1.0.9",
|
|
32
|
+
"@vltpkg/run": "1.0.9",
|
|
33
|
+
"@vltpkg/security-archive": "1.0.9",
|
|
34
|
+
"@vltpkg/spec": "1.0.9",
|
|
35
|
+
"@vltpkg/types": "1.0.9",
|
|
36
|
+
"@vltpkg/url-open": "1.0.9",
|
|
37
|
+
"@vltpkg/vlt-json": "1.0.9",
|
|
38
|
+
"@vltpkg/vlx": "1.0.9",
|
|
39
|
+
"@vltpkg/workspaces": "1.0.9",
|
|
40
|
+
"@vltpkg/xdg": "1.0.9",
|
|
41
41
|
"ansi-to-pre": "^1.0.6",
|
|
42
42
|
"beautiful-mermaid": "^1.1.3",
|
|
43
43
|
"chalk": "^5.6.2",
|