@scalar/cli 2.12.0 → 2.12.2
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 +2 -0
- package/chunks/{action-NF5E7JKA.js → action-2GIOY3HU.js} +20 -20
- package/chunks/{action-YWQ2OKS3.js → action-2NJJO35T.js} +9 -9
- package/chunks/{action-KDT6H6ML.js → action-2RIPHL6V.js} +4 -4
- package/chunks/{action-2OPUQFUY.js → action-6IL6KE3L.js} +16 -16
- package/chunks/{action-UTFRCKGE.js → action-7OJTNQRM.js} +4 -4
- package/chunks/{action-AC5ENU6Z.js → action-AZNY2B7G.js} +7 -7
- package/chunks/{action-FUO5F7NV.js → action-DJ6FLPXH.js} +4 -4
- package/chunks/{action-VGFAIFYE.js → action-H5XQIZKX.js} +13 -13
- package/chunks/{action-NIZBME45.js → action-HMPATNVE.js} +18 -18
- package/chunks/{action-SLB52XRG.js → action-HOLFCPUY.js} +12 -12
- package/chunks/{action-6CLEENBI.js → action-HRRNN33O.js} +18 -18
- package/chunks/{action-36LZ6XXE.js → action-II3OJSGP.js} +12 -12
- package/chunks/{action-FDTVHVHF.js → action-IYUOT7XX.js} +6 -6
- package/chunks/{action-ONR7QSN7.js → action-JDXGQSQN.js} +13 -13
- package/chunks/{action-EBZJS367.js → action-JXCU2JKC.js} +2 -2
- package/chunks/{action-WCU5O2VT.js → action-KE53K5EJ.js} +15 -15
- package/chunks/{action-XS5EESHW.js → action-LCTTNNFD.js} +17 -17
- package/chunks/{action-QM2BMMHG.js → action-LGNWFVEG.js} +14 -14
- package/chunks/{action-AOKHLTZ6.js → action-OWWGJ34K.js} +5 -5
- package/chunks/{action-JT6C472I.js → action-OY5LI7TW.js} +4 -4
- package/chunks/{action-VESBFIP3.js → action-PRLW546C.js} +13 -13
- package/chunks/{action-EZXHSAJ2.js → action-QA5ATGWB.js} +9 -9
- package/chunks/{action-7HXYZPOT.js → action-QEYNGQXG.js} +4 -4
- package/chunks/{action-3XMTJJRT.js → action-RNVV27ET.js} +8 -8
- package/chunks/{action-D3IVCY24.js → action-SFRYHYTZ.js} +4 -4
- package/chunks/{action-ADGLTNFC.js → action-U3R6AXJY.js} +4 -4
- package/chunks/{action-KJDIJQ3A.js → action-UHXBY3RD.js} +2 -2
- package/chunks/{action-AVSJ3AJY.js → action-UOH5L2JF.js} +8 -8
- package/chunks/{action-IG3BK2LF.js → action-WLPCBFRE.js} +16 -16
- package/chunks/{action-HA3CMV3P.js → action-XBTIONQD.js} +4 -4
- package/chunks/{action-O757TFA2.js → action-Z3UXS5KI.js} +4 -4
- package/chunks/{action-XVNRZ5VX.js → action-ZHDGAUGG.js} +13 -13
- package/chunks/{action-QVTAZCKY.js → action-ZNBXKA7T.js} +4 -4
- package/chunks/{actions-6QG7LH7P.js → actions-DKQERAKZ.js} +13 -13
- package/chunks/{agent-ONXROEAE.js → agent-KQKNJZKK.js} +4 -4
- package/chunks/{asyncapi-7IFXAIE3.js → asyncapi-MKBEQYBV.js} +8 -8
- package/chunks/{build.action-FI4OWY3T.js → build.action-EGAOPKSX.js} +16 -16
- package/chunks/{chunk-BCFUMXMC.js → chunk-3DKOVKCV.js} +3 -3
- package/chunks/{chunk-VUNOOPEG.js → chunk-4RF2NKQN.js} +1 -1
- package/chunks/{chunk-BB6WWG25.js → chunk-4YQVGOHX.js} +1 -1
- package/chunks/{chunk-LCSU43NJ.js → chunk-5VZSFLRO.js} +2 -2
- package/chunks/{chunk-PERC34BV.js → chunk-672Y6REB.js} +1 -1
- package/chunks/{chunk-RYWXF3LO.js → chunk-6YOXEMMX.js} +1 -1
- package/chunks/{chunk-QJQTSRU4.js → chunk-7GOHWSPA.js} +93 -2
- package/chunks/{chunk-RNZVZMYC.js → chunk-A27OERJM.js} +55 -10
- package/chunks/{chunk-ZNLMQKDU.js → chunk-AC62V47N.js} +1 -1
- package/chunks/{chunk-UODTHS76.js → chunk-BDNCJLJP.js} +1 -1
- package/chunks/{chunk-FJCOYEKT.js → chunk-F3TQHNSQ.js} +139 -95
- package/chunks/{chunk-VVQOFG76.js → chunk-FD364GM7.js} +1 -1
- package/chunks/{chunk-UAFCSWQ6.js → chunk-FJREFWEE.js} +1 -1
- package/chunks/{chunk-3HCEUGOE.js → chunk-GUF4PKDL.js} +39 -7
- package/chunks/{chunk-26VIHQGL.js → chunk-GZA7GEZW.js} +2 -2
- package/chunks/{chunk-EJSGWV2K.js → chunk-HDNCXPCZ.js} +1 -1
- package/chunks/{chunk-YTFFBGNQ.js → chunk-MLBEF6MB.js} +2 -2
- package/chunks/{chunk-T3R66THO.js → chunk-MQ65WBVF.js} +28 -4
- package/chunks/{chunk-V3MYP5SQ.js → chunk-TQL55CUG.js} +13 -2
- package/chunks/{chunk-U73OW57G.js → chunk-UJU2ORWU.js} +1 -1
- package/chunks/{chunk-UBLFIMUA.js → chunk-VJAVNG6U.js} +1 -1
- package/chunks/{chunk-HU47OMI4.js → chunk-VRZRTOZF.js} +2 -2
- package/chunks/{chunk-SNOAL2C5.js → chunk-W2JGSGIQ.js} +1 -1
- package/chunks/{chunk-RLBS4HJT.js → chunk-W3Y5X3X3.js} +2 -2
- package/chunks/{chunk-5TNKTLQP.js → chunk-W6FLDNRM.js} +7 -5
- package/chunks/{chunk-Y6C3H27E.js → chunk-YTTDYTVB.js} +1 -1
- package/chunks/{chunk-JLNHOA5Z.js → chunk-ZK76AK3B.js} +17 -4
- package/chunks/{chunk-N645RGAB.js → chunk-ZZTCEMCG.js} +33 -33
- package/chunks/{create.action-PPMZEMZL.js → create.action-UUDVWZ3F.js} +16 -16
- package/chunks/{delete.action-VAHKEHEU.js → delete.action-EUQ4ESLJ.js} +15 -15
- package/chunks/{delete.action-GDOHATRZ.js → delete.action-XRP3VU5C.js} +16 -16
- package/chunks/{get.action-XON3EZDT.js → get.action-IYA5Q3RI.js} +9 -9
- package/chunks/{get.action-UXFTGO7W.js → get.action-UHCFOKUQ.js} +15 -15
- package/chunks/{list.action-OQEAEJ5U.js → list.action-3CCWEEAM.js} +15 -15
- package/chunks/{list.action-24F5WDGR.js → list.action-D3GHA6S5.js} +16 -16
- package/chunks/{publish.action-G7FPDRBZ.js → publish.action-HIVWJ7QE.js} +20 -20
- package/chunks/{update.action-MJDHVVR3.js → update.action-NSKVEZES.js} +16 -16
- package/chunks/{update.action-IFIFXZWA.js → update.action-VOZNA7BV.js} +15 -15
- package/index.js +206 -92
- package/package.json +1 -1
- package/skills/scalar-cli/SKILL.md +1 -1
- package/template.md +2 -0
- /package/chunks/{chunk-U764PQUA.js → chunk-PIWBFJX3.js} +0 -0
package/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
|
|
3
3
|
import {
|
|
4
4
|
DownloadIsolateCommand
|
|
5
|
-
} from "./chunks/chunk-
|
|
5
|
+
} from "./chunks/chunk-UJU2ORWU.js";
|
|
6
6
|
import {
|
|
7
7
|
buildCliContext,
|
|
8
8
|
runnableCommands
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
BundleCommand,
|
|
18
18
|
parseFetchLimit,
|
|
19
19
|
parsePort
|
|
20
|
-
} from "./chunks/chunk-
|
|
20
|
+
} from "./chunks/chunk-HDNCXPCZ.js";
|
|
21
21
|
import {
|
|
22
22
|
completeFiles
|
|
23
23
|
} from "./chunks/chunk-DFOZG7ZV.js";
|
|
@@ -27,7 +27,11 @@ import {
|
|
|
27
27
|
} from "./chunks/chunk-NAC63XJF.js";
|
|
28
28
|
import {
|
|
29
29
|
SdkLanguage
|
|
30
|
-
} from "./chunks/chunk-
|
|
30
|
+
} from "./chunks/chunk-6YOXEMMX.js";
|
|
31
|
+
import {
|
|
32
|
+
err,
|
|
33
|
+
ok
|
|
34
|
+
} from "./chunks/chunk-5ENKYZA4.js";
|
|
31
35
|
import {
|
|
32
36
|
checkNodeVersion
|
|
33
37
|
} from "./chunks/chunk-VUXPDHTQ.js";
|
|
@@ -35,14 +39,14 @@ import {
|
|
|
35
39
|
getMetadata,
|
|
36
40
|
logout,
|
|
37
41
|
setMetadata
|
|
38
|
-
} from "./chunks/chunk-
|
|
39
|
-
import "./chunks/chunk-
|
|
42
|
+
} from "./chunks/chunk-MLBEF6MB.js";
|
|
43
|
+
import "./chunks/chunk-VJAVNG6U.js";
|
|
40
44
|
import {
|
|
41
45
|
bin,
|
|
42
46
|
name,
|
|
43
47
|
version
|
|
44
|
-
} from "./chunks/chunk-
|
|
45
|
-
import "./chunks/chunk-
|
|
48
|
+
} from "./chunks/chunk-FD364GM7.js";
|
|
49
|
+
import "./chunks/chunk-F3TQHNSQ.js";
|
|
46
50
|
import "./chunks/chunk-VRZSDUZK.js";
|
|
47
51
|
import {
|
|
48
52
|
requireInteractive
|
|
@@ -50,7 +54,7 @@ import {
|
|
|
50
54
|
import {
|
|
51
55
|
output
|
|
52
56
|
} from "./chunks/chunk-T5HJUAWB.js";
|
|
53
|
-
import "./chunks/chunk-
|
|
57
|
+
import "./chunks/chunk-PIWBFJX3.js";
|
|
54
58
|
import "./chunks/chunk-Q26DFKTY.js";
|
|
55
59
|
import {
|
|
56
60
|
external_exports
|
|
@@ -74,7 +78,7 @@ var DeleteSchemaCommand = () => {
|
|
|
74
78
|
cmd3.option("-s, --slug <slug>", "Schema slug");
|
|
75
79
|
cmd3.option("-n, --namespace <namespace>", "Team namespace");
|
|
76
80
|
cmd3.action(async (...args) => {
|
|
77
|
-
const { deleteAction } = await import("./chunks/delete.action-
|
|
81
|
+
const { deleteAction } = await import("./chunks/delete.action-EUQ4ESLJ.js");
|
|
78
82
|
return deleteAction(...args);
|
|
79
83
|
});
|
|
80
84
|
return cmd3;
|
|
@@ -94,7 +98,7 @@ var GetSchemaCommand = () => {
|
|
|
94
98
|
cmd3.option("-o, --output <file>", "Output file (defaults to stdout)");
|
|
95
99
|
completeFiles(cmd3, [], ["--output"]);
|
|
96
100
|
cmd3.action(async (...args) => {
|
|
97
|
-
const { getAction } = await import("./chunks/get.action-
|
|
101
|
+
const { getAction } = await import("./chunks/get.action-IYA5Q3RI.js");
|
|
98
102
|
return getAction(...args);
|
|
99
103
|
});
|
|
100
104
|
return cmd3;
|
|
@@ -108,7 +112,7 @@ var ListSchemaCommand = () => {
|
|
|
108
112
|
cmd3.option("--namespace <namespace>", "Team namespace");
|
|
109
113
|
cmd3.option("--json", "Output schema metadata as JSON");
|
|
110
114
|
cmd3.action(async (...args) => {
|
|
111
|
-
const { listAction } = await import("./chunks/list.action-
|
|
115
|
+
const { listAction } = await import("./chunks/list.action-D3GHA6S5.js");
|
|
112
116
|
return listAction(...args);
|
|
113
117
|
});
|
|
114
118
|
return cmd3;
|
|
@@ -142,7 +146,7 @@ var PublishSchemaCommand = () => {
|
|
|
142
146
|
);
|
|
143
147
|
completeFiles(cmd3, ["file"], []);
|
|
144
148
|
cmd3.action(async (...args) => {
|
|
145
|
-
const { publishAction } = await import("./chunks/publish.action-
|
|
149
|
+
const { publishAction } = await import("./chunks/publish.action-HIVWJ7QE.js");
|
|
146
150
|
return publishAction(...args);
|
|
147
151
|
});
|
|
148
152
|
return cmd3;
|
|
@@ -164,7 +168,7 @@ var UpdateSchemaCommand = () => {
|
|
|
164
168
|
).choices([...PRIVACY_VALUES])
|
|
165
169
|
);
|
|
166
170
|
cmd3.action(async (...args) => {
|
|
167
|
-
const { updateAction } = await import("./chunks/update.action-
|
|
171
|
+
const { updateAction } = await import("./chunks/update.action-VOZNA7BV.js");
|
|
168
172
|
return updateAction(...args);
|
|
169
173
|
});
|
|
170
174
|
return cmd3;
|
|
@@ -194,7 +198,7 @@ var BuildSdkCommand = () => {
|
|
|
194
198
|
cmd3.option("-s, --slug <slug>", "SDK slug");
|
|
195
199
|
cmd3.option("-n, --namespace <namespace>", "Team namespace");
|
|
196
200
|
cmd3.action(async (...args) => {
|
|
197
|
-
const { buildAction } = await import("./chunks/build.action-
|
|
201
|
+
const { buildAction } = await import("./chunks/build.action-EGAOPKSX.js");
|
|
198
202
|
return buildAction(...args);
|
|
199
203
|
});
|
|
200
204
|
return cmd3;
|
|
@@ -213,7 +217,7 @@ var CreateSdkCommand = () => {
|
|
|
213
217
|
)
|
|
214
218
|
);
|
|
215
219
|
cmd3.action(async (...args) => {
|
|
216
|
-
const { createAction } = await import("./chunks/create.action-
|
|
220
|
+
const { createAction } = await import("./chunks/create.action-UUDVWZ3F.js");
|
|
217
221
|
return createAction(...args);
|
|
218
222
|
});
|
|
219
223
|
return cmd3;
|
|
@@ -227,7 +231,7 @@ var DeleteSdkCommand = () => {
|
|
|
227
231
|
cmd3.option("-s, --slug <slug>", "SDK slug");
|
|
228
232
|
cmd3.option("-n, --namespace <namespace>", "Team namespace");
|
|
229
233
|
cmd3.action(async (...args) => {
|
|
230
|
-
const { deleteAction } = await import("./chunks/delete.action-
|
|
234
|
+
const { deleteAction } = await import("./chunks/delete.action-XRP3VU5C.js");
|
|
231
235
|
return deleteAction(...args);
|
|
232
236
|
});
|
|
233
237
|
return cmd3;
|
|
@@ -248,7 +252,7 @@ var UpdateSdkCommand = () => {
|
|
|
248
252
|
).choices([...PRIVACY_VALUES])
|
|
249
253
|
);
|
|
250
254
|
cmd3.action(async (...args) => {
|
|
251
|
-
const { updateAction } = await import("./chunks/update.action-
|
|
255
|
+
const { updateAction } = await import("./chunks/update.action-NSKVEZES.js");
|
|
252
256
|
return updateAction(...args);
|
|
253
257
|
});
|
|
254
258
|
return cmd3;
|
|
@@ -265,7 +269,7 @@ var GetSdkCommand = () => {
|
|
|
265
269
|
cmd3.option("-n, --namespace <namespace>", "Team namespace");
|
|
266
270
|
cmd3.option("--json", "Output structured SDK metadata as JSON");
|
|
267
271
|
cmd3.action(async (...args) => {
|
|
268
|
-
const { getAction } = await import("./chunks/get.action-
|
|
272
|
+
const { getAction } = await import("./chunks/get.action-UHCFOKUQ.js");
|
|
269
273
|
return getAction(...args);
|
|
270
274
|
});
|
|
271
275
|
return cmd3;
|
|
@@ -279,7 +283,7 @@ var ListSdkCommand = () => {
|
|
|
279
283
|
cmd3.option("--json", "Output structured SDK metadata as JSON");
|
|
280
284
|
cmd3.option("--namespace <namespace>", "Team namespace");
|
|
281
285
|
cmd3.action(async (...args) => {
|
|
282
|
-
const { listAction } = await import("./chunks/list.action-
|
|
286
|
+
const { listAction } = await import("./chunks/list.action-3CCWEEAM.js");
|
|
283
287
|
return listAction(...args);
|
|
284
288
|
});
|
|
285
289
|
return cmd3;
|
|
@@ -308,41 +312,41 @@ function createAccessGroupCommand() {
|
|
|
308
312
|
"Manage access groups and allowed email domains for the current team"
|
|
309
313
|
);
|
|
310
314
|
command.command("list").description("List access groups for the current team").option("--json", "Print the result as JSON").action(async (options) => {
|
|
311
|
-
const { runAction } = await import("./chunks/actions-
|
|
315
|
+
const { runAction } = await import("./chunks/actions-DKQERAKZ.js");
|
|
312
316
|
await runAction({ operation: "list", ...options });
|
|
313
317
|
});
|
|
314
318
|
command.command("create").description("Create an access group (Pro or above)").argument("<slug>", "New access group slug").option("--name <name>", "Display name").option("--domain <domains...>", "Allowed email domains").option("--json", "Print the result as JSON").action(
|
|
315
319
|
async (slug, options) => {
|
|
316
|
-
const { runAction } = await import("./chunks/actions-
|
|
320
|
+
const { runAction } = await import("./chunks/actions-DKQERAKZ.js");
|
|
317
321
|
await runAction({ operation: "create", slug, ...options });
|
|
318
322
|
}
|
|
319
323
|
);
|
|
320
324
|
command.command("get").description("Get an access group and its allowlists").argument("<slug>", "Access group slug").option("--json", "Print the result as JSON").action(async (slug, options) => {
|
|
321
|
-
const { runAction } = await import("./chunks/actions-
|
|
325
|
+
const { runAction } = await import("./chunks/actions-DKQERAKZ.js");
|
|
322
326
|
await runAction({ operation: "get", slug, ...options });
|
|
323
327
|
});
|
|
324
328
|
command.command("update").description("Update access group metadata").argument("<slug>", "Current access group slug").option("--name <name>", "New display name").option("--new-slug <slug>", "New access group slug").option("--json", "Print the result as JSON").action(
|
|
325
329
|
async (slug, options) => {
|
|
326
|
-
const { runAction } = await import("./chunks/actions-
|
|
330
|
+
const { runAction } = await import("./chunks/actions-DKQERAKZ.js");
|
|
327
331
|
await runAction({ operation: "update", slug, ...options });
|
|
328
332
|
}
|
|
329
333
|
);
|
|
330
334
|
command.command("delete").description("Delete an access group and remove its project assignments").argument("<slug>", "Access group slug").option("-y, --yes", "Confirm deletion without prompting").option("--json", "Print the result as JSON (requires --yes)").action(
|
|
331
335
|
async (slug, options) => {
|
|
332
|
-
const { runAction } = await import("./chunks/actions-
|
|
336
|
+
const { runAction } = await import("./chunks/actions-DKQERAKZ.js");
|
|
333
337
|
await runAction({ operation: "delete", slug, ...options });
|
|
334
338
|
}
|
|
335
339
|
);
|
|
336
340
|
const domain = command.command("domain").description("Manage allowed email domains");
|
|
337
341
|
domain.command("add").description("Add an exact email domain to an access group").argument("<slug>", "Access group slug").argument("<domain>", "Email domain, such as example.com").option("--json", "Print the result as JSON").action(
|
|
338
342
|
async (slug, domain2, options) => {
|
|
339
|
-
const { runAction } = await import("./chunks/actions-
|
|
343
|
+
const { runAction } = await import("./chunks/actions-DKQERAKZ.js");
|
|
340
344
|
await runAction({ operation: "add-domain", slug, domain: domain2, ...options });
|
|
341
345
|
}
|
|
342
346
|
);
|
|
343
347
|
domain.command("remove").description("Remove an exact email domain from an access group").argument("<slug>", "Access group slug").argument("<domain>", "Email domain, such as example.com").option("--json", "Print the result as JSON").action(
|
|
344
348
|
async (slug, domain2, options) => {
|
|
345
|
-
const { runAction } = await import("./chunks/actions-
|
|
349
|
+
const { runAction } = await import("./chunks/actions-DKQERAKZ.js");
|
|
346
350
|
await runAction({
|
|
347
351
|
operation: "remove-domain",
|
|
348
352
|
slug,
|
|
@@ -377,7 +381,7 @@ var LoginCommand = () => {
|
|
|
377
381
|
).hideHelp()
|
|
378
382
|
);
|
|
379
383
|
cmd3.action(async (...args) => {
|
|
380
|
-
const { loginAction } = await import("./chunks/action-
|
|
384
|
+
const { loginAction } = await import("./chunks/action-DJ6FLPXH.js");
|
|
381
385
|
return loginAction(...args);
|
|
382
386
|
});
|
|
383
387
|
return cmd3;
|
|
@@ -402,7 +406,7 @@ var WhoAmICommand = () => {
|
|
|
402
406
|
cmd3.description("Show the logged-in user and current team");
|
|
403
407
|
cmd3.option("--json", "Output authentication details as JSON");
|
|
404
408
|
cmd3.action(async (options) => {
|
|
405
|
-
const { whoamiAction } = await import("./chunks/action-
|
|
409
|
+
const { whoamiAction } = await import("./chunks/action-HOLFCPUY.js");
|
|
406
410
|
return whoamiAction(options);
|
|
407
411
|
});
|
|
408
412
|
return cmd3;
|
|
@@ -481,7 +485,7 @@ function JoinCommand() {
|
|
|
481
485
|
);
|
|
482
486
|
completeFiles(cmd3, ["files"], ["--output"]);
|
|
483
487
|
cmd3.action(async (...args) => {
|
|
484
|
-
const { joinAction } = await import("./chunks/action-
|
|
488
|
+
const { joinAction } = await import("./chunks/action-OY5LI7TW.js");
|
|
485
489
|
return joinAction(...args);
|
|
486
490
|
});
|
|
487
491
|
return cmd3;
|
|
@@ -505,7 +509,7 @@ function SplitCommand() {
|
|
|
505
509
|
);
|
|
506
510
|
completeFiles(cmd3, ["file|url"], ["--output"]);
|
|
507
511
|
cmd3.action(async (...args) => {
|
|
508
|
-
const { splitAction } = await import("./chunks/action-
|
|
512
|
+
const { splitAction } = await import("./chunks/action-QEYNGQXG.js");
|
|
509
513
|
return splitAction(...args);
|
|
510
514
|
});
|
|
511
515
|
return cmd3;
|
|
@@ -523,7 +527,7 @@ function FormatCommand() {
|
|
|
523
527
|
);
|
|
524
528
|
completeFiles(cmd3, ["file|url"], ["--output"]);
|
|
525
529
|
cmd3.action(async (...args) => {
|
|
526
|
-
const { formatAction } = await import("./chunks/action-
|
|
530
|
+
const { formatAction } = await import("./chunks/action-2RIPHL6V.js");
|
|
527
531
|
return formatAction(...args);
|
|
528
532
|
});
|
|
529
533
|
return cmd3;
|
|
@@ -576,7 +580,7 @@ function LintCommand() {
|
|
|
576
580
|
);
|
|
577
581
|
completeFiles(cmd3, ["file|url"], ["--rule", "--output", "--ignore-file"]);
|
|
578
582
|
cmd3.action(async (...args) => {
|
|
579
|
-
const { lintAction } = await import("./chunks/action-
|
|
583
|
+
const { lintAction } = await import("./chunks/action-U3R6AXJY.js");
|
|
580
584
|
return lintAction(...args);
|
|
581
585
|
});
|
|
582
586
|
return cmd3;
|
|
@@ -591,7 +595,7 @@ function MarkdownCommand() {
|
|
|
591
595
|
cmd3.option("-o, --output <file>", "Output file (defaults to stdout)");
|
|
592
596
|
completeFiles(cmd3, ["file|url"], ["--output"]);
|
|
593
597
|
cmd3.action(async (...args) => {
|
|
594
|
-
const { markdownAction } = await import("./chunks/action-
|
|
598
|
+
const { markdownAction } = await import("./chunks/action-SFRYHYTZ.js");
|
|
595
599
|
return markdownAction(...args);
|
|
596
600
|
});
|
|
597
601
|
return cmd3;
|
|
@@ -610,7 +614,7 @@ function MockCommand() {
|
|
|
610
614
|
cmd3.option("-p, --port <port>", "HTTP port for the Mock Server", parsePort);
|
|
611
615
|
completeFiles(cmd3, ["file|url"], []);
|
|
612
616
|
cmd3.action(async (...args) => {
|
|
613
|
-
const { mockAction } = await import("./chunks/action-
|
|
617
|
+
const { mockAction } = await import("./chunks/action-QA5ATGWB.js");
|
|
614
618
|
return mockAction(...args);
|
|
615
619
|
});
|
|
616
620
|
return cmd3;
|
|
@@ -629,7 +633,7 @@ function ConvertCommand() {
|
|
|
629
633
|
);
|
|
630
634
|
completeFiles(cmd3, ["file|url"], ["--output"]);
|
|
631
635
|
cmd3.action(async (...args) => {
|
|
632
|
-
const { convertAction } = await import("./chunks/action-
|
|
636
|
+
const { convertAction } = await import("./chunks/action-Z3UXS5KI.js");
|
|
633
637
|
return convertAction(...args);
|
|
634
638
|
});
|
|
635
639
|
return cmd3;
|
|
@@ -656,7 +660,7 @@ function ServeCommand() {
|
|
|
656
660
|
);
|
|
657
661
|
completeFiles(cmd3, ["file|url"], ["--config"]);
|
|
658
662
|
cmd3.action(async (...args) => {
|
|
659
|
-
const { serveAction } = await import("./chunks/action-
|
|
663
|
+
const { serveAction } = await import("./chunks/action-UOH5L2JF.js");
|
|
660
664
|
return serveAction(...args);
|
|
661
665
|
});
|
|
662
666
|
return cmd3;
|
|
@@ -676,7 +680,7 @@ function ShareCommand() {
|
|
|
676
680
|
);
|
|
677
681
|
completeFiles(cmd3, ["file"], []);
|
|
678
682
|
cmd3.action(async (...args) => {
|
|
679
|
-
const { shareAction } = await import("./chunks/action-
|
|
683
|
+
const { shareAction } = await import("./chunks/action-IYUOT7XX.js");
|
|
680
684
|
return shareAction(...args);
|
|
681
685
|
});
|
|
682
686
|
return cmd3;
|
|
@@ -696,7 +700,7 @@ function UpgradeCommand() {
|
|
|
696
700
|
);
|
|
697
701
|
completeFiles(cmd3, ["file|url"], ["--output"]);
|
|
698
702
|
cmd3.action(async (...args) => {
|
|
699
|
-
const { upgradeAction } = await import("./chunks/action-
|
|
703
|
+
const { upgradeAction } = await import("./chunks/action-XBTIONQD.js");
|
|
700
704
|
return upgradeAction(...args);
|
|
701
705
|
});
|
|
702
706
|
return cmd3;
|
|
@@ -710,7 +714,7 @@ function ValidateCommand() {
|
|
|
710
714
|
cmd3.argument("[file|url]", "File or URL to validate");
|
|
711
715
|
completeFiles(cmd3, ["file|url"], []);
|
|
712
716
|
cmd3.action(async (...args) => {
|
|
713
|
-
const { validateAction } = await import("./chunks/action-
|
|
717
|
+
const { validateAction } = await import("./chunks/action-7OJTNQRM.js");
|
|
714
718
|
return validateAction(...args);
|
|
715
719
|
});
|
|
716
720
|
return cmd3;
|
|
@@ -779,7 +783,7 @@ var PreviewCommand = () => {
|
|
|
779
783
|
cmd3.option("-N, --no-open", "Do not open the browser automatically", true);
|
|
780
784
|
completeFiles(cmd3, ["config"], []);
|
|
781
785
|
cmd3.action(async (...args) => {
|
|
782
|
-
const { previewAction } = await import("./chunks/action-
|
|
786
|
+
const { previewAction } = await import("./chunks/action-RNVV27ET.js");
|
|
783
787
|
return previewAction(...args);
|
|
784
788
|
});
|
|
785
789
|
return cmd3;
|
|
@@ -796,7 +800,7 @@ function CheckConfigCommand() {
|
|
|
796
800
|
);
|
|
797
801
|
completeFiles(cmd3, ["file"], []);
|
|
798
802
|
cmd3.action(async (...args) => {
|
|
799
|
-
const { checkConfigAction } = await import("./chunks/action-
|
|
803
|
+
const { checkConfigAction } = await import("./chunks/action-UHXBY3RD.js");
|
|
800
804
|
return checkConfigAction(...args);
|
|
801
805
|
});
|
|
802
806
|
return cmd3;
|
|
@@ -810,7 +814,7 @@ var CreateCommand = () => {
|
|
|
810
814
|
cmd3.option("-n, --name <name>", "Project name");
|
|
811
815
|
cmd3.option("-s, --slug <slug>", "Project slug");
|
|
812
816
|
cmd3.action(async (...args) => {
|
|
813
|
-
const { createAction } = await import("./chunks/action-
|
|
817
|
+
const { createAction } = await import("./chunks/action-JDXGQSQN.js");
|
|
814
818
|
return createAction(...args);
|
|
815
819
|
});
|
|
816
820
|
return cmd3;
|
|
@@ -826,7 +830,7 @@ var ListCommand = () => {
|
|
|
826
830
|
cmd3.description("List production deployments for a project");
|
|
827
831
|
cmd3.option("-s, --slug [slug]", "Project slug from scalar project list");
|
|
828
832
|
cmd3.action(async (...args) => {
|
|
829
|
-
const { listAction } = await import("./chunks/action-
|
|
833
|
+
const { listAction } = await import("./chunks/action-LCTTNNFD.js");
|
|
830
834
|
return listAction(...args);
|
|
831
835
|
});
|
|
832
836
|
return cmd3;
|
|
@@ -846,7 +850,7 @@ function GetCommand() {
|
|
|
846
850
|
const command = new Command39("get").description("Show project details for the current team").argument("<slug>", "Project slug from scalar project list").option("--json", "Print project details as JSON");
|
|
847
851
|
command.action(
|
|
848
852
|
async (slug, options) => {
|
|
849
|
-
const { getAction } = await import("./chunks/action-
|
|
853
|
+
const { getAction } = await import("./chunks/action-PRLW546C.js");
|
|
850
854
|
await getAction(slug, options);
|
|
851
855
|
}
|
|
852
856
|
);
|
|
@@ -864,7 +868,7 @@ var InitCommand = () => {
|
|
|
864
868
|
);
|
|
865
869
|
cmd3.option("--force", "Overwrite existing configuration");
|
|
866
870
|
cmd3.action(async (...args) => {
|
|
867
|
-
const { initAction } = await import("./chunks/action-
|
|
871
|
+
const { initAction } = await import("./chunks/action-LGNWFVEG.js");
|
|
868
872
|
return initAction(...args);
|
|
869
873
|
});
|
|
870
874
|
return cmd3;
|
|
@@ -875,7 +879,7 @@ import { Command as Command41 } from "commander";
|
|
|
875
879
|
function ListCommand2() {
|
|
876
880
|
const command = new Command41("list").description("List projects and their slugs for the current team").option("--json", "Print project details as JSON");
|
|
877
881
|
command.action(async (options) => {
|
|
878
|
-
const { listAction } = await import("./chunks/action-
|
|
882
|
+
const { listAction } = await import("./chunks/action-6IL6KE3L.js");
|
|
879
883
|
await listAction(options);
|
|
880
884
|
});
|
|
881
885
|
return command;
|
|
@@ -901,7 +905,7 @@ var PublishCommand = () => {
|
|
|
901
905
|
);
|
|
902
906
|
completeFiles(cmd3, [], ["--config"]);
|
|
903
907
|
cmd3.action(async (...args) => {
|
|
904
|
-
const { publishAction } = await import("./chunks/action-
|
|
908
|
+
const { publishAction } = await import("./chunks/action-HRRNN33O.js");
|
|
905
909
|
return publishAction(...args);
|
|
906
910
|
});
|
|
907
911
|
return cmd3;
|
|
@@ -921,7 +925,7 @@ var RollbackCommand = () => {
|
|
|
921
925
|
);
|
|
922
926
|
cmd3.option("-y, --yes", "Skip the confirmation prompt");
|
|
923
927
|
cmd3.action(async (...args) => {
|
|
924
|
-
const { rollbackAction } = await import("./chunks/action-
|
|
928
|
+
const { rollbackAction } = await import("./chunks/action-HMPATNVE.js");
|
|
925
929
|
return rollbackAction(...args);
|
|
926
930
|
});
|
|
927
931
|
return cmd3;
|
|
@@ -938,7 +942,7 @@ var UpgradeCommand2 = () => {
|
|
|
938
942
|
);
|
|
939
943
|
completeFiles(cmd3, ["config"], []);
|
|
940
944
|
cmd3.action(async (...args) => {
|
|
941
|
-
const { upgradeAction } = await import("./chunks/action-
|
|
945
|
+
const { upgradeAction } = await import("./chunks/action-JXCU2JKC.js");
|
|
942
946
|
return upgradeAction(...args);
|
|
943
947
|
});
|
|
944
948
|
return cmd3;
|
|
@@ -1096,7 +1100,7 @@ var PublishCommand2 = () => {
|
|
|
1096
1100
|
);
|
|
1097
1101
|
completeFiles(cmd3, ["file"], []);
|
|
1098
1102
|
cmd3.action(async (...args) => {
|
|
1099
|
-
const { publishAction } = await import("./chunks/action-
|
|
1103
|
+
const { publishAction } = await import("./chunks/action-2GIOY3HU.js");
|
|
1100
1104
|
return publishAction(...args);
|
|
1101
1105
|
});
|
|
1102
1106
|
return cmd3;
|
|
@@ -1110,7 +1114,7 @@ var DeleteCommand = () => {
|
|
|
1110
1114
|
cmd3.argument("[namespace]", "Team namespace");
|
|
1111
1115
|
cmd3.argument("[slug]", "API description slug");
|
|
1112
1116
|
cmd3.action(async (...args) => {
|
|
1113
|
-
const { deleteAction } = await import("./chunks/action-
|
|
1117
|
+
const { deleteAction } = await import("./chunks/action-ZHDGAUGG.js");
|
|
1114
1118
|
return deleteAction(...args);
|
|
1115
1119
|
});
|
|
1116
1120
|
return cmd3;
|
|
@@ -1135,7 +1139,7 @@ var GetCommand2 = () => {
|
|
|
1135
1139
|
cmd3.option("-o, --output <file>", "Output file (defaults to stdout)");
|
|
1136
1140
|
completeFiles(cmd3, [], ["--output"]);
|
|
1137
1141
|
cmd3.action(async (...args) => {
|
|
1138
|
-
const { getAction } = await import("./chunks/action-
|
|
1142
|
+
const { getAction } = await import("./chunks/action-2NJJO35T.js");
|
|
1139
1143
|
return getAction(...args);
|
|
1140
1144
|
});
|
|
1141
1145
|
return cmd3;
|
|
@@ -1149,7 +1153,7 @@ var ListCommand3 = () => {
|
|
|
1149
1153
|
cmd3.option("--namespace <namespace>", "Team namespace");
|
|
1150
1154
|
cmd3.option("--json", "Output Scalar Registry API metadata as JSON");
|
|
1151
1155
|
cmd3.action(async (...args) => {
|
|
1152
|
-
const { listAction } = await import("./chunks/action-
|
|
1156
|
+
const { listAction } = await import("./chunks/action-WLPCBFRE.js");
|
|
1153
1157
|
return listAction(...args);
|
|
1154
1158
|
});
|
|
1155
1159
|
return cmd3;
|
|
@@ -1165,7 +1169,7 @@ var UpdateCommand = () => {
|
|
|
1165
1169
|
cmd3.option("--title <title>", "API description title");
|
|
1166
1170
|
cmd3.option("--description <description>", "API description summary");
|
|
1167
1171
|
cmd3.action(async (...args) => {
|
|
1168
|
-
const { updateAction } = await import("./chunks/action-
|
|
1172
|
+
const { updateAction } = await import("./chunks/action-H5XQIZKX.js");
|
|
1169
1173
|
return updateAction(...args);
|
|
1170
1174
|
});
|
|
1171
1175
|
return cmd3;
|
|
@@ -1194,7 +1198,7 @@ var GetCommand3 = () => {
|
|
|
1194
1198
|
cmd3.description("Show the current team and its namespaces");
|
|
1195
1199
|
cmd3.option("--json", "Output the current team as JSON");
|
|
1196
1200
|
cmd3.action(async (...args) => {
|
|
1197
|
-
const { getAction } = await import("./chunks/action-
|
|
1201
|
+
const { getAction } = await import("./chunks/action-II3OJSGP.js");
|
|
1198
1202
|
return getAction(...args);
|
|
1199
1203
|
});
|
|
1200
1204
|
return cmd3;
|
|
@@ -1207,7 +1211,7 @@ var ListCommand4 = () => {
|
|
|
1207
1211
|
cmd3.description("List your Scalar teams");
|
|
1208
1212
|
cmd3.option("--json", "Output teams as JSON");
|
|
1209
1213
|
cmd3.action(async (...args) => {
|
|
1210
|
-
const { listAction } = await import("./chunks/action-
|
|
1214
|
+
const { listAction } = await import("./chunks/action-KE53K5EJ.js");
|
|
1211
1215
|
return listAction(...args);
|
|
1212
1216
|
});
|
|
1213
1217
|
return cmd3;
|
|
@@ -1220,7 +1224,7 @@ var SetCommand = () => {
|
|
|
1220
1224
|
cmd3.description("Select the current team");
|
|
1221
1225
|
cmd3.option("--team <team>", "Team ID");
|
|
1222
1226
|
cmd3.action(async (...args) => {
|
|
1223
|
-
const { setAction } = await import("./chunks/action-
|
|
1227
|
+
const { setAction } = await import("./chunks/action-AZNY2B7G.js");
|
|
1224
1228
|
return setAction(...args);
|
|
1225
1229
|
});
|
|
1226
1230
|
return cmd3;
|
|
@@ -1237,45 +1241,35 @@ var team_default = teamDomain;
|
|
|
1237
1241
|
|
|
1238
1242
|
// src/domains/upgrade/index.ts
|
|
1239
1243
|
import { execSync } from "node:child_process";
|
|
1240
|
-
import
|
|
1241
|
-
import { Command as Command58 } from "commander";
|
|
1244
|
+
import { Command as Command58, Option as Option9 } from "commander";
|
|
1242
1245
|
|
|
1243
1246
|
// src/helpers/upgrade.ts
|
|
1244
1247
|
import as3 from "ansis";
|
|
1245
1248
|
import semver from "semver";
|
|
1246
1249
|
var packageJsonSchema = external_exports.object({
|
|
1247
|
-
version: external_exports.string()
|
|
1250
|
+
version: external_exports.string().refine((value) => semver.valid(value) !== null)
|
|
1248
1251
|
});
|
|
1249
1252
|
var BACKGROUND_CHECK_TIMEOUT_MS = 2e3;
|
|
1250
1253
|
var USER_INITIATED_TIMEOUT_MS = 1e4;
|
|
1251
1254
|
async function getRemotePackageJson(packageName, version2 = "latest", timeoutMs = BACKGROUND_CHECK_TIMEOUT_MS) {
|
|
1252
|
-
|
|
1255
|
+
return fetchReleaseVersion(
|
|
1253
1256
|
`https://registry.npmjs.org/${packageName}/${version2}`,
|
|
1254
|
-
|
|
1255
|
-
signal: AbortSignal.timeout(timeoutMs)
|
|
1256
|
-
}
|
|
1257
|
+
timeoutMs
|
|
1257
1258
|
);
|
|
1258
|
-
const body = await response.json();
|
|
1259
|
-
return packageJsonSchema.parse(body);
|
|
1260
1259
|
}
|
|
1261
1260
|
async function getUpgradeInformation(timeoutMs = USER_INITIATED_TIMEOUT_MS) {
|
|
1262
|
-
const
|
|
1263
|
-
|
|
1264
|
-
"latest",
|
|
1261
|
+
const release = process.env.SCALAR_CLI_DISTRIBUTION === "portable" ? await fetchReleaseVersion(
|
|
1262
|
+
"https://cdn.scalar.com/cli/latest/manifest.json",
|
|
1265
1263
|
timeoutMs
|
|
1266
|
-
);
|
|
1267
|
-
if (
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
};
|
|
1272
|
-
}
|
|
1273
|
-
return {
|
|
1274
|
-
upgrade: true,
|
|
1264
|
+
) : await getRemotePackageJson(name, "latest", timeoutMs);
|
|
1265
|
+
if (!release.ok) return release;
|
|
1266
|
+
const latestVersion = release.data.version;
|
|
1267
|
+
return ok({
|
|
1268
|
+
upgrade: semver.lt(version, latestVersion),
|
|
1275
1269
|
name,
|
|
1276
1270
|
currentVersion: version,
|
|
1277
1271
|
latestVersion
|
|
1278
|
-
};
|
|
1272
|
+
});
|
|
1279
1273
|
}
|
|
1280
1274
|
async function checkUpgrade(stream = "stdout") {
|
|
1281
1275
|
const emitOutput = () => {
|
|
@@ -1296,7 +1290,9 @@ async function checkUpgrade(stream = "stdout") {
|
|
|
1296
1290
|
lastKnownVersion = version
|
|
1297
1291
|
} = await getMetadata();
|
|
1298
1292
|
if (lastUpdateCheck + delay < now) {
|
|
1299
|
-
return getUpgradeInformation(BACKGROUND_CHECK_TIMEOUT_MS).then(async (
|
|
1293
|
+
return getUpgradeInformation(BACKGROUND_CHECK_TIMEOUT_MS).then(async (result) => {
|
|
1294
|
+
if (!result.ok) return;
|
|
1295
|
+
const { upgrade, latestVersion } = result.data;
|
|
1300
1296
|
await setMetadata({
|
|
1301
1297
|
lastUpdateCheck: now,
|
|
1302
1298
|
lastKnownVersion: latestVersion
|
|
@@ -1311,32 +1307,150 @@ async function checkUpgrade(stream = "stdout") {
|
|
|
1311
1307
|
emitOutput();
|
|
1312
1308
|
}
|
|
1313
1309
|
}
|
|
1310
|
+
async function fetchReleaseVersion(url, timeoutMs) {
|
|
1311
|
+
const response = await fetch(url, {
|
|
1312
|
+
signal: AbortSignal.timeout(timeoutMs)
|
|
1313
|
+
}).catch(() => null);
|
|
1314
|
+
if (!response?.ok) return err("Could not fetch the latest release");
|
|
1315
|
+
const body = await response.json().catch(() => null);
|
|
1316
|
+
const parsed = packageJsonSchema.safeParse(body);
|
|
1317
|
+
return parsed.success ? ok(parsed.data) : err("Invalid release metadata");
|
|
1318
|
+
}
|
|
1319
|
+
|
|
1320
|
+
// src/domains/upgrade/instructions.ts
|
|
1321
|
+
function getUpgradeInstructions(portable, platform, arch, env, latestVersion) {
|
|
1322
|
+
if (!portable)
|
|
1323
|
+
return ["To upgrade, run:", "npm install -g @scalar/cli@latest"];
|
|
1324
|
+
const quoteBash = (value) => `'${value.replaceAll("'", `'"'"'`)}'`;
|
|
1325
|
+
const quotePowerShell = (value) => `'${value.replaceAll("'", "''")}'`;
|
|
1326
|
+
const overrides = [
|
|
1327
|
+
"SCALAR_INSTALL_DIR",
|
|
1328
|
+
"SCALAR_BIN_DIR",
|
|
1329
|
+
"SCALAR_NO_MODIFY_PATH"
|
|
1330
|
+
].filter((key) => env[key]);
|
|
1331
|
+
const installer = platform === "win32" ? [
|
|
1332
|
+
"$env:SCALAR_VERSION = 'latest'",
|
|
1333
|
+
...overrides.map(
|
|
1334
|
+
(key) => `$env:${key} = ${quotePowerShell(env[key] ?? "")}`
|
|
1335
|
+
),
|
|
1336
|
+
"irm https://cdn.scalar.com/cli/install.ps1 | iex"
|
|
1337
|
+
].join("\n") : `curl -fsSL https://cdn.scalar.com/cli/install.sh | SCALAR_VERSION=latest ${overrides.map((key) => `${key}=${quoteBash(env[key] ?? "")} `).join("")}bash`;
|
|
1338
|
+
const target = `${platform}-${arch}`;
|
|
1339
|
+
const supported = [
|
|
1340
|
+
"darwin-arm64",
|
|
1341
|
+
"darwin-x64",
|
|
1342
|
+
"linux-arm64",
|
|
1343
|
+
"linux-x64",
|
|
1344
|
+
"win32-x64"
|
|
1345
|
+
].includes(target);
|
|
1346
|
+
const hasArchive = latestVersion && /^\d+\.\d+\.\d+$/.test(latestVersion) && supported;
|
|
1347
|
+
const archive = hasArchive ? `https://cdn.scalar.com/cli/${latestVersion}/scalar-${latestVersion}-${target}.tar.gz` : "https://cdn.scalar.com/cli/latest/manifest.json";
|
|
1348
|
+
return [
|
|
1349
|
+
"For an installer-managed installation, run:",
|
|
1350
|
+
installer,
|
|
1351
|
+
"If you used custom installation paths, reuse the same SCALAR_INSTALL_DIR and SCALAR_BIN_DIR values when running the installer.",
|
|
1352
|
+
...platform === "win32" ? [
|
|
1353
|
+
"Close running Scalar processes before running the installer in PowerShell."
|
|
1354
|
+
] : [],
|
|
1355
|
+
hasArchive ? "For a manually extracted installation, download the archive below, verify its .sha256 checksum, extract it, and replace the complete installation directory (including app and runtime):" : "For a manually extracted installation, find your platform archive in the release manifest below, verify its SHA-256 checksum, extract it, and replace the complete installation directory (including app and runtime):",
|
|
1356
|
+
archive
|
|
1357
|
+
];
|
|
1358
|
+
}
|
|
1314
1359
|
|
|
1315
1360
|
// src/domains/upgrade/index.ts
|
|
1316
1361
|
var cmd2 = new Command58("upgrade");
|
|
1317
1362
|
cmd2.description("Upgrade the Scalar CLI to the latest version");
|
|
1318
|
-
cmd2.
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1363
|
+
cmd2.option(
|
|
1364
|
+
"--check",
|
|
1365
|
+
"Show installed and available versions without installing"
|
|
1366
|
+
);
|
|
1367
|
+
cmd2.addOption(
|
|
1368
|
+
new Option9(
|
|
1369
|
+
"--json",
|
|
1370
|
+
"Show the version check as JSON without installing"
|
|
1371
|
+
).implies({ check: true })
|
|
1372
|
+
);
|
|
1373
|
+
cmd2.addHelpText(
|
|
1374
|
+
"after",
|
|
1375
|
+
"\nExamples:\n scalar upgrade\n scalar upgrade --check\n scalar upgrade --json"
|
|
1376
|
+
);
|
|
1377
|
+
cmd2.action(async (options) => {
|
|
1378
|
+
const portable = process.env.SCALAR_CLI_DISTRIBUTION === "portable";
|
|
1379
|
+
const result = await getUpgradeInformation();
|
|
1380
|
+
const upgradeStatus = result.ok ? result.data : null;
|
|
1381
|
+
const instructions = getUpgradeInstructions(
|
|
1382
|
+
portable,
|
|
1383
|
+
process.platform,
|
|
1384
|
+
process.arch,
|
|
1385
|
+
process.env,
|
|
1386
|
+
upgradeStatus?.latestVersion
|
|
1387
|
+
);
|
|
1388
|
+
if (options.json) {
|
|
1389
|
+
process.stdout.write(
|
|
1390
|
+
`${JSON.stringify({
|
|
1391
|
+
status: upgradeStatus ? "ok" : "error",
|
|
1392
|
+
data: {
|
|
1393
|
+
currentVersion: version,
|
|
1394
|
+
latestVersion: upgradeStatus?.latestVersion ?? null,
|
|
1395
|
+
upgradeAvailable: upgradeStatus?.upgrade ?? null,
|
|
1396
|
+
distribution: portable ? "portable" : "npm",
|
|
1397
|
+
instructions
|
|
1398
|
+
},
|
|
1399
|
+
...upgradeStatus ? {} : {
|
|
1400
|
+
error: {
|
|
1401
|
+
code: "VERSION_CHECK_FAILED",
|
|
1402
|
+
message: "Could not check the latest version. Run scalar upgrade --check to retry."
|
|
1403
|
+
}
|
|
1404
|
+
}
|
|
1405
|
+
})}
|
|
1406
|
+
`
|
|
1407
|
+
);
|
|
1408
|
+
if (!upgradeStatus) process.exitCode = 1;
|
|
1409
|
+
return;
|
|
1410
|
+
}
|
|
1411
|
+
process.stdout.write(
|
|
1412
|
+
`Installed: ${version}
|
|
1413
|
+
Latest available: ${upgradeStatus?.latestVersion ?? "could not check"}
|
|
1414
|
+
`
|
|
1415
|
+
);
|
|
1416
|
+
if (!upgradeStatus) {
|
|
1417
|
+
process.stderr.write(
|
|
1418
|
+
"Could not check the latest version. Check your connection and run `scalar upgrade --check` to retry.\n"
|
|
1419
|
+
);
|
|
1420
|
+
process.stdout.write(`
|
|
1421
|
+
${instructions.join("\n\n")}
|
|
1422
|
+
`);
|
|
1423
|
+
process.exitCode = 1;
|
|
1323
1424
|
return;
|
|
1324
1425
|
}
|
|
1325
|
-
const upgradeStatus = await getUpgradeInformation();
|
|
1326
1426
|
if (!upgradeStatus.upgrade) {
|
|
1327
|
-
|
|
1427
|
+
process.stdout.write("Scalar CLI is already up to date.\n");
|
|
1328
1428
|
return;
|
|
1329
1429
|
}
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1430
|
+
if (portable || options.check) {
|
|
1431
|
+
process.stdout.write(
|
|
1432
|
+
`
|
|
1433
|
+
A Scalar CLI update is available.
|
|
1434
|
+
|
|
1435
|
+
${instructions.join("\n\n")}
|
|
1436
|
+
`
|
|
1437
|
+
);
|
|
1438
|
+
return;
|
|
1439
|
+
}
|
|
1440
|
+
process.stderr.write(
|
|
1441
|
+
`Upgrading from ${upgradeStatus.currentVersion} to ${upgradeStatus.latestVersion}\u2026
|
|
1442
|
+
`
|
|
1443
|
+
);
|
|
1333
1444
|
try {
|
|
1334
1445
|
execSync(`npm install -g ${upgradeStatus.name}@latest`, {
|
|
1335
1446
|
stdio: "inherit"
|
|
1336
1447
|
});
|
|
1337
|
-
|
|
1448
|
+
process.stdout.write("Scalar CLI upgraded to the latest version.\n");
|
|
1338
1449
|
} catch {
|
|
1339
|
-
|
|
1450
|
+
process.stderr.write(`Upgrade failed.
|
|
1451
|
+
${instructions.join("\n")}
|
|
1452
|
+
`);
|
|
1453
|
+
process.exitCode = 1;
|
|
1340
1454
|
}
|
|
1341
1455
|
});
|
|
1342
1456
|
var upgrade_default = cmd2;
|