@depup/vercel 50.32.5-depup.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/LICENSE +202 -0
- package/README.md +38 -0
- package/changes.json +38 -0
- package/dist/chunks/chunk-2DLBVZWU.js +197 -0
- package/dist/chunks/chunk-2HSQ7YUK.js +93 -0
- package/dist/chunks/chunk-2IQTNMUG.js +86 -0
- package/dist/chunks/chunk-3FRG2XGZ.js +466 -0
- package/dist/chunks/chunk-3KMKI2FP.js +34 -0
- package/dist/chunks/chunk-3XFFP2BA.js +110 -0
- package/dist/chunks/chunk-4S3Y3ATR.js +5383 -0
- package/dist/chunks/chunk-7EHTK7LP.js +359 -0
- package/dist/chunks/chunk-7YHZDJ4G.js +116 -0
- package/dist/chunks/chunk-A3NYPUKZ.js +17 -0
- package/dist/chunks/chunk-AA7QEJFB.js +5204 -0
- package/dist/chunks/chunk-AHU7WNL2.js +24 -0
- package/dist/chunks/chunk-AKQZ7KG3.js +4172 -0
- package/dist/chunks/chunk-AQLVWVEN.js +39155 -0
- package/dist/chunks/chunk-BQ3DXZNT.js +968 -0
- package/dist/chunks/chunk-E65JE2CC.js +102 -0
- package/dist/chunks/chunk-EKPSCRJZ.js +26 -0
- package/dist/chunks/chunk-EOZFDJSY.js +18 -0
- package/dist/chunks/chunk-FDJURQMQ.js +4676 -0
- package/dist/chunks/chunk-FLKHKWZV.js +1854 -0
- package/dist/chunks/chunk-G6BUEBF5.js +192 -0
- package/dist/chunks/chunk-GBNIO3KP.js +771 -0
- package/dist/chunks/chunk-GGP5R3FU.js +129 -0
- package/dist/chunks/chunk-H5XJSH37.js +91 -0
- package/dist/chunks/chunk-IB5L4LKZ.js +1082 -0
- package/dist/chunks/chunk-IE7MNZ56.js +149 -0
- package/dist/chunks/chunk-IK7DLK2T.js +16112 -0
- package/dist/chunks/chunk-IUGPWINM.js +104 -0
- package/dist/chunks/chunk-J7HDA5GH.js +54 -0
- package/dist/chunks/chunk-JLYZNGYY.js +293 -0
- package/dist/chunks/chunk-JQ4NA5MX.js +250 -0
- package/dist/chunks/chunk-LL26LVRR.js +81 -0
- package/dist/chunks/chunk-LW5ZNGW7.js +127 -0
- package/dist/chunks/chunk-LWBSOTJP.js +1772 -0
- package/dist/chunks/chunk-MBGJBHYD.js +388 -0
- package/dist/chunks/chunk-NUKAG3YM.js +168 -0
- package/dist/chunks/chunk-O7I4ZOCC.js +58 -0
- package/dist/chunks/chunk-OWR3XNE3.js +48 -0
- package/dist/chunks/chunk-P3SKP5WM.js +27 -0
- package/dist/chunks/chunk-P4I4DMEU.js +342 -0
- package/dist/chunks/chunk-P5Q6F5IA.js +107 -0
- package/dist/chunks/chunk-PMSMUMUO.js +30 -0
- package/dist/chunks/chunk-QXRJ52T4.js +2977 -0
- package/dist/chunks/chunk-RQXPRFRM.js +90 -0
- package/dist/chunks/chunk-S7KYDPEM.js +1564 -0
- package/dist/chunks/chunk-SGGLJFUZ.js +68 -0
- package/dist/chunks/chunk-SOTR4CXR.js +34 -0
- package/dist/chunks/chunk-TEVP63TU.js +1717 -0
- package/dist/chunks/chunk-TNBMKNET.js +323 -0
- package/dist/chunks/chunk-TZ2YI2VH.js +87 -0
- package/dist/chunks/chunk-U6XOC6E4.js +903 -0
- package/dist/chunks/chunk-V5P25P7F.js +22 -0
- package/dist/chunks/chunk-WQ5CUZWR.js +333 -0
- package/dist/chunks/chunk-WU2BPWRP.js +12237 -0
- package/dist/chunks/chunk-XPKWKPWA.js +44 -0
- package/dist/chunks/chunk-XR53KVJD.js +33 -0
- package/dist/chunks/chunk-Y4JJYHUG.js +16 -0
- package/dist/chunks/chunk-YPQSDAEW.js +29 -0
- package/dist/chunks/chunk-ZB2UO4V2.js +135 -0
- package/dist/chunks/chunk-ZLCMHY2G.js +1528 -0
- package/dist/chunks/compile-vercel-config-XU3YY2CZ.js +32 -0
- package/dist/chunks/delete-EJ2V7KQO.js +144 -0
- package/dist/chunks/disable-BKRFMX4U.js +122 -0
- package/dist/chunks/discard-4WF34DXK.js +118 -0
- package/dist/chunks/edit-FQE7JGU3.js +509 -0
- package/dist/chunks/emit-flags-datafiles-QYKPNWPX.js +17 -0
- package/dist/chunks/enable-VCNMX63U.js +122 -0
- package/dist/chunks/export-3KNVJCQR.js +133 -0
- package/dist/chunks/list-43XQCGKH.js +382 -0
- package/dist/chunks/list-DUL6PHUR.js +394 -0
- package/dist/chunks/publish-CF7GVZK3.js +128 -0
- package/dist/chunks/query-KWKO7VWO.js +954 -0
- package/dist/chunks/reorder-GU65YMIN.js +259 -0
- package/dist/chunks/restore-Q7ENGWVJ.js +158 -0
- package/dist/chunks/routes-Q5CWG44T.js +20 -0
- package/dist/chunks/schema-PJKLO2K2.js +176 -0
- package/dist/chunks/stamp-RTPE2EBB.js +15 -0
- package/dist/chunks/types-563KUQRV.js +108 -0
- package/dist/chunks/update-route-version-E3V47KNI.js +13 -0
- package/dist/commands/build/index.js +1597 -0
- package/dist/commands/deploy/index.js +1711 -0
- package/dist/commands/dev/builder-worker.cjs +95 -0
- package/dist/commands/dev/index.js +20810 -0
- package/dist/commands/env/index.js +2154 -0
- package/dist/commands/link/index.js +225 -0
- package/dist/commands/list/index.js +528 -0
- package/dist/commands-bulk.js +29627 -0
- package/dist/get-latest-worker.cjs +272 -0
- package/dist/help.js +14 -0
- package/dist/index.js +24274 -0
- package/dist/vc.js +36 -0
- package/dist/version.mjs +1 -0
- package/package.json +254 -0
|
@@ -0,0 +1,528 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __fileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname as __dirname_ } from 'node:path';
|
|
4
|
+
const require = __createRequire(import.meta.url);
|
|
5
|
+
const __filename = __fileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = __dirname_(__filename);
|
|
7
|
+
import {
|
|
8
|
+
isValidName
|
|
9
|
+
} from "../../chunks/chunk-Y4JJYHUG.js";
|
|
10
|
+
import {
|
|
11
|
+
getCommandFlags
|
|
12
|
+
} from "../../chunks/chunk-EOZFDJSY.js";
|
|
13
|
+
import {
|
|
14
|
+
parseMeta
|
|
15
|
+
} from "../../chunks/chunk-EKPSCRJZ.js";
|
|
16
|
+
import {
|
|
17
|
+
getDeployment,
|
|
18
|
+
toHost
|
|
19
|
+
} from "../../chunks/chunk-2IQTNMUG.js";
|
|
20
|
+
import {
|
|
21
|
+
getScope
|
|
22
|
+
} from "../../chunks/chunk-3KMKI2FP.js";
|
|
23
|
+
import {
|
|
24
|
+
formatEnvironment,
|
|
25
|
+
validateLsArgs
|
|
26
|
+
} from "../../chunks/chunk-J7HDA5GH.js";
|
|
27
|
+
import {
|
|
28
|
+
validateJsonOutput
|
|
29
|
+
} from "../../chunks/chunk-XPKWKPWA.js";
|
|
30
|
+
import {
|
|
31
|
+
listCommand
|
|
32
|
+
} from "../../chunks/chunk-E65JE2CC.js";
|
|
33
|
+
import {
|
|
34
|
+
help
|
|
35
|
+
} from "../../chunks/chunk-JQ4NA5MX.js";
|
|
36
|
+
import {
|
|
37
|
+
formatProject,
|
|
38
|
+
getLinkedProject,
|
|
39
|
+
getProjectByNameOrId,
|
|
40
|
+
parseTarget
|
|
41
|
+
} from "../../chunks/chunk-AQLVWVEN.js";
|
|
42
|
+
import {
|
|
43
|
+
TelemetryClient
|
|
44
|
+
} from "../../chunks/chunk-P4I4DMEU.js";
|
|
45
|
+
import {
|
|
46
|
+
elapsed
|
|
47
|
+
} from "../../chunks/chunk-SOTR4CXR.js";
|
|
48
|
+
import {
|
|
49
|
+
table
|
|
50
|
+
} from "../../chunks/chunk-LWBSOTJP.js";
|
|
51
|
+
import "../../chunks/chunk-7EHTK7LP.js";
|
|
52
|
+
import {
|
|
53
|
+
require_ms
|
|
54
|
+
} from "../../chunks/chunk-GGP5R3FU.js";
|
|
55
|
+
import {
|
|
56
|
+
ProjectNotFound,
|
|
57
|
+
getCommandName,
|
|
58
|
+
getFlagsSpecification,
|
|
59
|
+
parseArguments,
|
|
60
|
+
printError,
|
|
61
|
+
require_lib
|
|
62
|
+
} from "../../chunks/chunk-ZLCMHY2G.js";
|
|
63
|
+
import "../../chunks/chunk-3XFFP2BA.js";
|
|
64
|
+
import {
|
|
65
|
+
output_manager_default,
|
|
66
|
+
require_dist
|
|
67
|
+
} from "../../chunks/chunk-FDJURQMQ.js";
|
|
68
|
+
import {
|
|
69
|
+
require_source
|
|
70
|
+
} from "../../chunks/chunk-S7KYDPEM.js";
|
|
71
|
+
import {
|
|
72
|
+
__toESM
|
|
73
|
+
} from "../../chunks/chunk-TZ2YI2VH.js";
|
|
74
|
+
|
|
75
|
+
// src/commands/list/index.ts
|
|
76
|
+
var import_ms = __toESM(require_ms(), 1);
|
|
77
|
+
var import_chalk = __toESM(require_source(), 1);
|
|
78
|
+
var import_title = __toESM(require_lib(), 1);
|
|
79
|
+
|
|
80
|
+
// src/util/parse-policy.ts
|
|
81
|
+
function parsePolicy(policy) {
|
|
82
|
+
if (!policy) {
|
|
83
|
+
return {};
|
|
84
|
+
}
|
|
85
|
+
if (typeof policy === "string") {
|
|
86
|
+
policy = [policy];
|
|
87
|
+
}
|
|
88
|
+
const parsed = {};
|
|
89
|
+
for (const item of policy) {
|
|
90
|
+
const [key, ...rest] = item.split("=");
|
|
91
|
+
parsed[key] = rest.join("=");
|
|
92
|
+
}
|
|
93
|
+
return parsed;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// src/commands/list/index.ts
|
|
97
|
+
var import_error_utils = __toESM(require_dist(), 1);
|
|
98
|
+
|
|
99
|
+
// src/util/telemetry/commands/list/index.ts
|
|
100
|
+
var ListTelemetryClient = class extends TelemetryClient {
|
|
101
|
+
trackCliFlagAll(all) {
|
|
102
|
+
if (all) {
|
|
103
|
+
this.trackCliFlag("all");
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
trackCliOptionMeta(meta) {
|
|
107
|
+
if (meta && meta.length > 0) {
|
|
108
|
+
this.trackCliOption({
|
|
109
|
+
option: "meta",
|
|
110
|
+
value: this.redactedValue
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
trackCliOptionPolicy(policy) {
|
|
115
|
+
if (policy && policy.length > 0) {
|
|
116
|
+
this.trackCliOption({
|
|
117
|
+
option: "policy",
|
|
118
|
+
value: this.redactedValue
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
trackCliOptionEnvironment(environment) {
|
|
123
|
+
if (environment) {
|
|
124
|
+
this.trackCliOption({
|
|
125
|
+
option: "environment",
|
|
126
|
+
value: this.redactedTargetName(environment)
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
trackCliOptionNext(next) {
|
|
131
|
+
if (next) {
|
|
132
|
+
this.trackCliOption({
|
|
133
|
+
option: "next",
|
|
134
|
+
value: this.redactedValue
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
trackCliFlagProd(flag) {
|
|
139
|
+
if (flag) {
|
|
140
|
+
this.trackCliFlag("prod");
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
trackCliFlagYes(flag) {
|
|
144
|
+
if (flag) {
|
|
145
|
+
this.trackCliFlag("yes");
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
trackCliFlagConfirm(flag) {
|
|
149
|
+
if (flag) {
|
|
150
|
+
this.trackCliFlag("confirm");
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
trackCliOptionStatus(status) {
|
|
154
|
+
if (status) {
|
|
155
|
+
this.trackCliOption({
|
|
156
|
+
option: "status",
|
|
157
|
+
value: this.redactedValue
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
trackCliArgumentApp(app) {
|
|
162
|
+
if (app) {
|
|
163
|
+
this.trackCliArgument({
|
|
164
|
+
arg: "app",
|
|
165
|
+
value: this.redactedValue
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
// src/commands/list/index.ts
|
|
172
|
+
function toDate(timestamp) {
|
|
173
|
+
const date = new Date(timestamp);
|
|
174
|
+
const options = {
|
|
175
|
+
year: "2-digit",
|
|
176
|
+
month: "2-digit",
|
|
177
|
+
day: "2-digit"
|
|
178
|
+
};
|
|
179
|
+
return date.toLocaleDateString("en-US", options);
|
|
180
|
+
}
|
|
181
|
+
async function list(client) {
|
|
182
|
+
const { print, log, warn, error, note, debug, spinner } = output_manager_default;
|
|
183
|
+
let parsedArgs = null;
|
|
184
|
+
const flagsSpecification = getFlagsSpecification(listCommand.options);
|
|
185
|
+
try {
|
|
186
|
+
parsedArgs = parseArguments(client.argv.slice(2), flagsSpecification);
|
|
187
|
+
} catch (error2) {
|
|
188
|
+
printError(error2);
|
|
189
|
+
return 1;
|
|
190
|
+
}
|
|
191
|
+
const telemetry = new ListTelemetryClient({
|
|
192
|
+
opts: {
|
|
193
|
+
store: client.telemetryEventStore
|
|
194
|
+
}
|
|
195
|
+
});
|
|
196
|
+
if (parsedArgs.flags["--help"]) {
|
|
197
|
+
telemetry.trackCliFlagHelp("list");
|
|
198
|
+
print(help(listCommand, { columns: client.stderr.columns }));
|
|
199
|
+
return 0;
|
|
200
|
+
}
|
|
201
|
+
const validationResult = validateLsArgs({
|
|
202
|
+
commandName: "ls [app]",
|
|
203
|
+
args: parsedArgs.args,
|
|
204
|
+
maxArgs: 2,
|
|
205
|
+
exitCode: 2
|
|
206
|
+
});
|
|
207
|
+
if (validationResult !== 0) {
|
|
208
|
+
return validationResult;
|
|
209
|
+
}
|
|
210
|
+
const formatResult = validateJsonOutput(parsedArgs.flags);
|
|
211
|
+
if (!formatResult.valid) {
|
|
212
|
+
error(formatResult.error);
|
|
213
|
+
return 1;
|
|
214
|
+
}
|
|
215
|
+
const asJson = formatResult.jsonOutput;
|
|
216
|
+
telemetry.trackCliFlagAll(parsedArgs.flags["--all"]);
|
|
217
|
+
telemetry.trackCliFlagProd(parsedArgs.flags["--prod"]);
|
|
218
|
+
telemetry.trackCliFlagYes(parsedArgs.flags["--yes"]);
|
|
219
|
+
telemetry.trackCliOptionEnvironment(parsedArgs.flags["--environment"]);
|
|
220
|
+
telemetry.trackCliOptionMeta(parsedArgs.flags["--meta"]);
|
|
221
|
+
telemetry.trackCliOptionNext(parsedArgs.flags["--next"]);
|
|
222
|
+
telemetry.trackCliOptionFormat(parsedArgs.flags["--format"]);
|
|
223
|
+
telemetry.trackCliOptionPolicy(parsedArgs.flags["--policy"]);
|
|
224
|
+
telemetry.trackCliOptionStatus(parsedArgs.flags["--status"]);
|
|
225
|
+
if ("--confirm" in parsedArgs.flags) {
|
|
226
|
+
telemetry.trackCliFlagConfirm(parsedArgs.flags["--confirm"]);
|
|
227
|
+
warn("`--confirm` is deprecated, please use `--yes` instead");
|
|
228
|
+
parsedArgs.flags["--yes"] = parsedArgs.flags["--confirm"];
|
|
229
|
+
}
|
|
230
|
+
const meta = parseMeta(parsedArgs.flags["--meta"]);
|
|
231
|
+
const policy = parsePolicy(parsedArgs.flags["--policy"]);
|
|
232
|
+
const target = parseTarget({
|
|
233
|
+
flagName: "environment",
|
|
234
|
+
flags: parsedArgs.flags
|
|
235
|
+
});
|
|
236
|
+
const statusFlag = parsedArgs.flags["--status"];
|
|
237
|
+
let status;
|
|
238
|
+
if (statusFlag) {
|
|
239
|
+
const validStatuses = [
|
|
240
|
+
"BUILDING",
|
|
241
|
+
"ERROR",
|
|
242
|
+
"INITIALIZING",
|
|
243
|
+
"QUEUED",
|
|
244
|
+
"READY",
|
|
245
|
+
"CANCELED"
|
|
246
|
+
];
|
|
247
|
+
const statusValues = statusFlag.split(",").map((s) => s.trim().toUpperCase());
|
|
248
|
+
const invalidStatuses = statusValues.filter(
|
|
249
|
+
(s) => !validStatuses.includes(s)
|
|
250
|
+
);
|
|
251
|
+
if (invalidStatuses.length > 0) {
|
|
252
|
+
error(
|
|
253
|
+
`Invalid status values: ${invalidStatuses.join(", ")}. Valid values are: ${validStatuses.join(", ")}`
|
|
254
|
+
);
|
|
255
|
+
return 1;
|
|
256
|
+
}
|
|
257
|
+
status = statusValues.join(",");
|
|
258
|
+
}
|
|
259
|
+
let project;
|
|
260
|
+
let pagination;
|
|
261
|
+
let contextName = "";
|
|
262
|
+
let app = parsedArgs.args[1];
|
|
263
|
+
const deployments = [];
|
|
264
|
+
let singleDeployment = false;
|
|
265
|
+
const allFlag = parsedArgs.flags["--all"];
|
|
266
|
+
let showAllProjects = false;
|
|
267
|
+
if (allFlag && app) {
|
|
268
|
+
error("Cannot use --all flag with a project argument");
|
|
269
|
+
return 1;
|
|
270
|
+
}
|
|
271
|
+
if (app) {
|
|
272
|
+
if (!isValidName(app)) {
|
|
273
|
+
error(`The provided argument "${app}" is not a valid project name`);
|
|
274
|
+
return 1;
|
|
275
|
+
}
|
|
276
|
+
telemetry.trackCliArgumentApp(app);
|
|
277
|
+
if (app.includes(".")) {
|
|
278
|
+
try {
|
|
279
|
+
({ contextName } = await getScope(client));
|
|
280
|
+
} catch (err) {
|
|
281
|
+
if ((0, import_error_utils.isErrnoException)(err) && (err.code === "NOT_AUTHORIZED" || err.code === "TEAM_DELETED")) {
|
|
282
|
+
error(err.message);
|
|
283
|
+
return 1;
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
if (!contextName) {
|
|
287
|
+
error("No context name found");
|
|
288
|
+
return 1;
|
|
289
|
+
}
|
|
290
|
+
const host = toHost(app);
|
|
291
|
+
const deployment = await getDeployment(client, contextName, host);
|
|
292
|
+
if (!deployment.projectId) {
|
|
293
|
+
error(`Could not find a deployment for "${host}"`);
|
|
294
|
+
return 1;
|
|
295
|
+
}
|
|
296
|
+
app = deployment.projectId;
|
|
297
|
+
note(
|
|
298
|
+
`We suggest using ${getCommandName(
|
|
299
|
+
"inspect <deployment>"
|
|
300
|
+
)} for retrieving details about a single deployment`
|
|
301
|
+
);
|
|
302
|
+
deployments.push(deployment);
|
|
303
|
+
singleDeployment = true;
|
|
304
|
+
}
|
|
305
|
+
const p = await getProjectByNameOrId(client, app);
|
|
306
|
+
if (p instanceof ProjectNotFound) {
|
|
307
|
+
error(`The provided argument "${app}" is not a valid project name`);
|
|
308
|
+
return 1;
|
|
309
|
+
}
|
|
310
|
+
project = p;
|
|
311
|
+
} else if (allFlag) {
|
|
312
|
+
showAllProjects = true;
|
|
313
|
+
} else {
|
|
314
|
+
const link = await getLinkedProject(client, client.cwd);
|
|
315
|
+
if (link.status === "error") {
|
|
316
|
+
return link.exitCode;
|
|
317
|
+
}
|
|
318
|
+
if (link.status === "linked") {
|
|
319
|
+
project = link.project;
|
|
320
|
+
client.config.currentTeam = link.org.id;
|
|
321
|
+
} else {
|
|
322
|
+
showAllProjects = true;
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
if (!contextName) {
|
|
326
|
+
try {
|
|
327
|
+
({ contextName } = await getScope(client));
|
|
328
|
+
} catch (err) {
|
|
329
|
+
if ((0, import_error_utils.isErrnoException)(err) && (err.code === "NOT_AUTHORIZED" || err.code === "TEAM_DELETED")) {
|
|
330
|
+
error(err.message);
|
|
331
|
+
return 1;
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
const nextTimestamp = parsedArgs.flags["--next"];
|
|
336
|
+
if (Number.isNaN(nextTimestamp)) {
|
|
337
|
+
error("Please provide a number for flag `--next`");
|
|
338
|
+
return 1;
|
|
339
|
+
}
|
|
340
|
+
const projectSlugLink = project ? formatProject(contextName, project.name) : null;
|
|
341
|
+
if (!singleDeployment) {
|
|
342
|
+
if (!asJson) {
|
|
343
|
+
spinner(`Fetching deployments in ${import_chalk.default.bold(contextName)}`);
|
|
344
|
+
}
|
|
345
|
+
const start = Date.now();
|
|
346
|
+
debug("Fetching deployments");
|
|
347
|
+
const query = new URLSearchParams({ limit: "20" });
|
|
348
|
+
if (project) {
|
|
349
|
+
query.set("projectId", project.id);
|
|
350
|
+
}
|
|
351
|
+
for (const [k, v] of Object.entries(meta)) {
|
|
352
|
+
query.set(`meta-${k}`, v);
|
|
353
|
+
}
|
|
354
|
+
for (const [k, v] of Object.entries(policy)) {
|
|
355
|
+
query.set(`policy-${k}`, v);
|
|
356
|
+
}
|
|
357
|
+
if (nextTimestamp) {
|
|
358
|
+
query.set("until", String(nextTimestamp));
|
|
359
|
+
}
|
|
360
|
+
if (target) {
|
|
361
|
+
query.set("target", target);
|
|
362
|
+
}
|
|
363
|
+
if (status) {
|
|
364
|
+
query.set("state", status);
|
|
365
|
+
}
|
|
366
|
+
for await (const chunk of client.fetchPaginated(`/v6/deployments?${query}`)) {
|
|
367
|
+
deployments.push(...chunk.deployments);
|
|
368
|
+
pagination = chunk.pagination;
|
|
369
|
+
if (deployments.length >= 20) {
|
|
370
|
+
break;
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
if (!deployments.length) {
|
|
374
|
+
if (asJson) {
|
|
375
|
+
const jsonOutput = { deployments: [], pagination };
|
|
376
|
+
client.stdout.write(`${JSON.stringify(jsonOutput, null, 2)}
|
|
377
|
+
`);
|
|
378
|
+
} else {
|
|
379
|
+
log("No deployments found.");
|
|
380
|
+
}
|
|
381
|
+
return 0;
|
|
382
|
+
}
|
|
383
|
+
if (!asJson) {
|
|
384
|
+
const deploymentsLabel = target === "production" ? "Production deployments" : "Deployments";
|
|
385
|
+
if (showAllProjects) {
|
|
386
|
+
log(`${deploymentsLabel} ${elapsed(Date.now() - start)}`);
|
|
387
|
+
} else {
|
|
388
|
+
log(
|
|
389
|
+
`${deploymentsLabel} for ${projectSlugLink} ${elapsed(Date.now() - start)}`
|
|
390
|
+
);
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
if (asJson) {
|
|
395
|
+
const jsonOutput = {
|
|
396
|
+
deployments: deployments.sort(sortByCreatedAt).map((dep) => ({
|
|
397
|
+
id: dep.id,
|
|
398
|
+
url: dep.url,
|
|
399
|
+
name: dep.name,
|
|
400
|
+
state: dep.readyState,
|
|
401
|
+
target: dep.target,
|
|
402
|
+
customEnvironment: dep.customEnvironment ? {
|
|
403
|
+
id: dep.customEnvironment.id,
|
|
404
|
+
slug: dep.customEnvironment.slug
|
|
405
|
+
} : void 0,
|
|
406
|
+
createdAt: dep.createdAt,
|
|
407
|
+
buildingAt: dep.buildingAt,
|
|
408
|
+
ready: dep.ready,
|
|
409
|
+
creator: dep.creator ? {
|
|
410
|
+
uid: dep.creator.uid,
|
|
411
|
+
username: dep.creator.username
|
|
412
|
+
} : void 0,
|
|
413
|
+
meta: dep.meta
|
|
414
|
+
})),
|
|
415
|
+
pagination
|
|
416
|
+
};
|
|
417
|
+
client.stdout.write(`${JSON.stringify(jsonOutput, null, 2)}
|
|
418
|
+
`);
|
|
419
|
+
return 0;
|
|
420
|
+
}
|
|
421
|
+
const headers = ["Age", "Project", "Deployment", "Status", "Environment"];
|
|
422
|
+
const showPolicy = Object.keys(policy).length > 0;
|
|
423
|
+
if (!showPolicy)
|
|
424
|
+
headers.push("Duration", "Username");
|
|
425
|
+
if (showPolicy)
|
|
426
|
+
headers.push("Proposed Expiration");
|
|
427
|
+
const urls = [];
|
|
428
|
+
const tablePrint = table(
|
|
429
|
+
[
|
|
430
|
+
headers.map((header) => import_chalk.default.bold(import_chalk.default.cyan(header))),
|
|
431
|
+
...deployments.sort(sortByCreatedAt).map((dep) => {
|
|
432
|
+
urls.push(`https://${dep.url}`);
|
|
433
|
+
const proposedExp = dep.proposedExpiration ? toDate(Math.min(Date.now(), dep.proposedExpiration)) : "No expiration";
|
|
434
|
+
const createdAt = (0, import_ms.default)(
|
|
435
|
+
Date.now() - (dep?.undeletedAt ?? dep.createdAt)
|
|
436
|
+
);
|
|
437
|
+
const targetName = dep.customEnvironment?.slug || (dep.target === "production" ? "Production" : "Preview");
|
|
438
|
+
const targetSlug = dep.customEnvironment?.id || dep.target || "preview";
|
|
439
|
+
return [
|
|
440
|
+
import_chalk.default.gray(createdAt),
|
|
441
|
+
formatProject(contextName, dep.name),
|
|
442
|
+
`https://${dep.url}`,
|
|
443
|
+
stateString(dep.readyState || ""),
|
|
444
|
+
formatEnvironment(contextName, dep.name, {
|
|
445
|
+
id: targetSlug,
|
|
446
|
+
slug: targetName
|
|
447
|
+
}),
|
|
448
|
+
...!showPolicy ? [import_chalk.default.gray(getDeploymentDuration(dep))] : [],
|
|
449
|
+
...!showPolicy ? [import_chalk.default.gray(dep.creator?.username)] : [],
|
|
450
|
+
...showPolicy ? [import_chalk.default.gray(proposedExp)] : []
|
|
451
|
+
];
|
|
452
|
+
}).filter(
|
|
453
|
+
(app2) => (
|
|
454
|
+
// if an app wasn't supplied to filter by,
|
|
455
|
+
// we only want to render one deployment per app
|
|
456
|
+
app2 === null ? filterUniqueApps() : () => true
|
|
457
|
+
)
|
|
458
|
+
)
|
|
459
|
+
],
|
|
460
|
+
{ hsep: 5 }
|
|
461
|
+
).replace(/^/gm, " ");
|
|
462
|
+
print(`
|
|
463
|
+
${tablePrint}
|
|
464
|
+
|
|
465
|
+
`);
|
|
466
|
+
if (!client.stdout.isTTY) {
|
|
467
|
+
client.stdout.write(urls.join("\n"));
|
|
468
|
+
client.stdout.write("\n");
|
|
469
|
+
}
|
|
470
|
+
if (pagination?.next) {
|
|
471
|
+
const flags = getCommandFlags(parsedArgs.flags, ["--next"]);
|
|
472
|
+
log(
|
|
473
|
+
`To display the next page, run ${getCommandName(
|
|
474
|
+
`ls${app ? ` ${app}` : ""}${flags} --next ${pagination.next}`
|
|
475
|
+
)}`
|
|
476
|
+
);
|
|
477
|
+
}
|
|
478
|
+
return 0;
|
|
479
|
+
}
|
|
480
|
+
function getDeploymentDuration(dep) {
|
|
481
|
+
if (!dep || !dep.ready || !dep.buildingAt) {
|
|
482
|
+
return "?";
|
|
483
|
+
}
|
|
484
|
+
const duration = (0, import_ms.default)(dep.ready - dep.buildingAt);
|
|
485
|
+
if (duration === "0ms") {
|
|
486
|
+
return "--";
|
|
487
|
+
}
|
|
488
|
+
return duration;
|
|
489
|
+
}
|
|
490
|
+
function stateString(s) {
|
|
491
|
+
const CIRCLE = "\u25CF ";
|
|
492
|
+
const sTitle = (0, import_title.default)(s);
|
|
493
|
+
switch (s) {
|
|
494
|
+
case "INITIALIZING":
|
|
495
|
+
case "BUILDING":
|
|
496
|
+
case "DEPLOYING":
|
|
497
|
+
case "ANALYZING":
|
|
498
|
+
return import_chalk.default.yellow(CIRCLE) + sTitle;
|
|
499
|
+
case "ERROR":
|
|
500
|
+
return import_chalk.default.red(CIRCLE) + sTitle;
|
|
501
|
+
case "READY":
|
|
502
|
+
return import_chalk.default.green(CIRCLE) + sTitle;
|
|
503
|
+
case "QUEUED":
|
|
504
|
+
return import_chalk.default.white(CIRCLE) + sTitle;
|
|
505
|
+
case "CANCELED":
|
|
506
|
+
return import_chalk.default.gray(sTitle);
|
|
507
|
+
default:
|
|
508
|
+
return import_chalk.default.gray("UNKNOWN");
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
function sortByCreatedAt(a, b) {
|
|
512
|
+
return b.createdAt - a.createdAt;
|
|
513
|
+
}
|
|
514
|
+
function filterUniqueApps() {
|
|
515
|
+
const uniqueApps = /* @__PURE__ */ new Set();
|
|
516
|
+
return function uniqueAppFilter([appName]) {
|
|
517
|
+
if (uniqueApps.has(appName)) {
|
|
518
|
+
return false;
|
|
519
|
+
}
|
|
520
|
+
uniqueApps.add(appName);
|
|
521
|
+
return true;
|
|
522
|
+
};
|
|
523
|
+
}
|
|
524
|
+
export {
|
|
525
|
+
list as default,
|
|
526
|
+
getDeploymentDuration,
|
|
527
|
+
stateString
|
|
528
|
+
};
|