@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,32 @@
|
|
|
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
|
+
DEFAULT_VERCEL_CONFIG_FILENAME,
|
|
9
|
+
VERCEL_CONFIG_EXTENSIONS,
|
|
10
|
+
compileVercelConfig,
|
|
11
|
+
findSourceVercelConfigFile,
|
|
12
|
+
getVercelConfigPath,
|
|
13
|
+
normalizeConfig
|
|
14
|
+
} from "./chunk-MBGJBHYD.js";
|
|
15
|
+
import "./chunk-AQLVWVEN.js";
|
|
16
|
+
import "./chunk-P4I4DMEU.js";
|
|
17
|
+
import "./chunk-SOTR4CXR.js";
|
|
18
|
+
import "./chunk-7EHTK7LP.js";
|
|
19
|
+
import "./chunk-GGP5R3FU.js";
|
|
20
|
+
import "./chunk-ZLCMHY2G.js";
|
|
21
|
+
import "./chunk-3XFFP2BA.js";
|
|
22
|
+
import "./chunk-FDJURQMQ.js";
|
|
23
|
+
import "./chunk-S7KYDPEM.js";
|
|
24
|
+
import "./chunk-TZ2YI2VH.js";
|
|
25
|
+
export {
|
|
26
|
+
DEFAULT_VERCEL_CONFIG_FILENAME,
|
|
27
|
+
VERCEL_CONFIG_EXTENSIONS,
|
|
28
|
+
compileVercelConfig,
|
|
29
|
+
findSourceVercelConfigFile,
|
|
30
|
+
getVercelConfigPath,
|
|
31
|
+
normalizeConfig
|
|
32
|
+
};
|
|
@@ -0,0 +1,144 @@
|
|
|
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
|
+
getRouteVersions
|
|
9
|
+
} from "./chunk-AHU7WNL2.js";
|
|
10
|
+
import {
|
|
11
|
+
ensureProjectLink,
|
|
12
|
+
getRouteTypeLabel,
|
|
13
|
+
getRoutes,
|
|
14
|
+
offerAutoPromote,
|
|
15
|
+
parseSubcommandArgs,
|
|
16
|
+
resolveRoutes
|
|
17
|
+
} from "./chunk-TNBMKNET.js";
|
|
18
|
+
import {
|
|
19
|
+
deleteSubcommand
|
|
20
|
+
} from "./chunk-U6XOC6E4.js";
|
|
21
|
+
import "./chunk-AQLVWVEN.js";
|
|
22
|
+
import "./chunk-P4I4DMEU.js";
|
|
23
|
+
import {
|
|
24
|
+
stamp_default
|
|
25
|
+
} from "./chunk-SOTR4CXR.js";
|
|
26
|
+
import "./chunk-7EHTK7LP.js";
|
|
27
|
+
import "./chunk-GGP5R3FU.js";
|
|
28
|
+
import {
|
|
29
|
+
getCommandName
|
|
30
|
+
} from "./chunk-ZLCMHY2G.js";
|
|
31
|
+
import "./chunk-3XFFP2BA.js";
|
|
32
|
+
import {
|
|
33
|
+
output_manager_default
|
|
34
|
+
} from "./chunk-FDJURQMQ.js";
|
|
35
|
+
import {
|
|
36
|
+
require_source
|
|
37
|
+
} from "./chunk-S7KYDPEM.js";
|
|
38
|
+
import {
|
|
39
|
+
__toESM
|
|
40
|
+
} from "./chunk-TZ2YI2VH.js";
|
|
41
|
+
|
|
42
|
+
// src/commands/routes/delete.ts
|
|
43
|
+
var import_chalk = __toESM(require_source(), 1);
|
|
44
|
+
|
|
45
|
+
// src/util/routes/delete-routes.ts
|
|
46
|
+
async function deleteRoutes(client, projectId, routeIds, options = {}) {
|
|
47
|
+
const { teamId } = options;
|
|
48
|
+
const query = new URLSearchParams();
|
|
49
|
+
if (teamId)
|
|
50
|
+
query.set("teamId", teamId);
|
|
51
|
+
const queryString = query.toString();
|
|
52
|
+
const url = `/v1/projects/${projectId}/routes${queryString ? `?${queryString}` : ""}`;
|
|
53
|
+
return await client.fetch(url, {
|
|
54
|
+
method: "DELETE",
|
|
55
|
+
headers: {
|
|
56
|
+
"Content-Type": "application/json"
|
|
57
|
+
},
|
|
58
|
+
body: JSON.stringify({ routeIds })
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// src/commands/routes/delete.ts
|
|
63
|
+
async function deleteRoute(client, argv) {
|
|
64
|
+
const parsed = await parseSubcommandArgs(argv, deleteSubcommand);
|
|
65
|
+
if (typeof parsed === "number")
|
|
66
|
+
return parsed;
|
|
67
|
+
const link = await ensureProjectLink(client);
|
|
68
|
+
if (typeof link === "number")
|
|
69
|
+
return link;
|
|
70
|
+
const { project, org } = link;
|
|
71
|
+
const teamId = org.type === "team" ? org.id : void 0;
|
|
72
|
+
const { args, flags } = parsed;
|
|
73
|
+
const skipConfirmation = flags["--yes"];
|
|
74
|
+
if (args.length === 0) {
|
|
75
|
+
output_manager_default.error(
|
|
76
|
+
`At least one route name or ID is required. Usage: ${getCommandName("routes delete <name-or-id> [...]")}`
|
|
77
|
+
);
|
|
78
|
+
return 1;
|
|
79
|
+
}
|
|
80
|
+
const { versions } = await getRouteVersions(client, project.id, { teamId });
|
|
81
|
+
const existingStagingVersion = versions.find((v) => v.isStaging);
|
|
82
|
+
output_manager_default.spinner("Fetching routes");
|
|
83
|
+
const { routes } = await getRoutes(client, project.id, { teamId });
|
|
84
|
+
output_manager_default.stopSpinner();
|
|
85
|
+
if (routes.length === 0) {
|
|
86
|
+
output_manager_default.error("No routes found in this project.");
|
|
87
|
+
return 1;
|
|
88
|
+
}
|
|
89
|
+
const resolved = await resolveRoutes(client, routes, args);
|
|
90
|
+
if (!resolved)
|
|
91
|
+
return 1;
|
|
92
|
+
output_manager_default.print("\n");
|
|
93
|
+
output_manager_default.log(
|
|
94
|
+
`The following ${resolved.length === 1 ? "route" : `${resolved.length} routes`} will be deleted:`
|
|
95
|
+
);
|
|
96
|
+
for (const route of resolved) {
|
|
97
|
+
const typeLabels = getRouteTypeLabel(route);
|
|
98
|
+
output_manager_default.print(
|
|
99
|
+
` ${import_chalk.default.red("\xD7")} ${route.name} ${import_chalk.default.gray(`(${route.route.src})`)} ${import_chalk.default.gray(`[${typeLabels}]`)}
|
|
100
|
+
`
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
output_manager_default.print("\n");
|
|
104
|
+
if (!skipConfirmation) {
|
|
105
|
+
const confirmed = await client.input.confirm(
|
|
106
|
+
`Delete ${resolved.length === 1 ? "this route" : `these ${resolved.length} routes`}?`,
|
|
107
|
+
false
|
|
108
|
+
);
|
|
109
|
+
if (!confirmed) {
|
|
110
|
+
output_manager_default.log("Aborted.");
|
|
111
|
+
return 0;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
const deleteStamp = stamp_default();
|
|
115
|
+
output_manager_default.spinner(
|
|
116
|
+
`Deleting ${resolved.length === 1 ? "route" : `${resolved.length} routes`}`
|
|
117
|
+
);
|
|
118
|
+
try {
|
|
119
|
+
const { deletedCount, version } = await deleteRoutes(
|
|
120
|
+
client,
|
|
121
|
+
project.id,
|
|
122
|
+
resolved.map((r) => r.id),
|
|
123
|
+
{ teamId }
|
|
124
|
+
);
|
|
125
|
+
output_manager_default.log(
|
|
126
|
+
`${import_chalk.default.cyan("Deleted")} ${deletedCount} ${deletedCount === 1 ? "route" : "routes"} ${import_chalk.default.gray(deleteStamp())}`
|
|
127
|
+
);
|
|
128
|
+
await offerAutoPromote(
|
|
129
|
+
client,
|
|
130
|
+
project.id,
|
|
131
|
+
version,
|
|
132
|
+
!!existingStagingVersion,
|
|
133
|
+
{ teamId, skipPrompts: skipConfirmation }
|
|
134
|
+
);
|
|
135
|
+
return 0;
|
|
136
|
+
} catch (e) {
|
|
137
|
+
const error = e;
|
|
138
|
+
output_manager_default.error(error.message || "Failed to delete routes");
|
|
139
|
+
return 1;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
export {
|
|
143
|
+
deleteRoute as default
|
|
144
|
+
};
|
|
@@ -0,0 +1,122 @@
|
|
|
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
|
+
editRoute
|
|
9
|
+
} from "./chunk-P3SKP5WM.js";
|
|
10
|
+
import {
|
|
11
|
+
getRouteVersions
|
|
12
|
+
} from "./chunk-AHU7WNL2.js";
|
|
13
|
+
import {
|
|
14
|
+
ensureProjectLink,
|
|
15
|
+
getRoutes,
|
|
16
|
+
offerAutoPromote,
|
|
17
|
+
parseSubcommandArgs,
|
|
18
|
+
resolveRoute
|
|
19
|
+
} from "./chunk-TNBMKNET.js";
|
|
20
|
+
import {
|
|
21
|
+
disableSubcommand
|
|
22
|
+
} from "./chunk-U6XOC6E4.js";
|
|
23
|
+
import "./chunk-AQLVWVEN.js";
|
|
24
|
+
import "./chunk-P4I4DMEU.js";
|
|
25
|
+
import {
|
|
26
|
+
stamp_default
|
|
27
|
+
} from "./chunk-SOTR4CXR.js";
|
|
28
|
+
import "./chunk-7EHTK7LP.js";
|
|
29
|
+
import "./chunk-GGP5R3FU.js";
|
|
30
|
+
import {
|
|
31
|
+
getCommandName
|
|
32
|
+
} from "./chunk-ZLCMHY2G.js";
|
|
33
|
+
import "./chunk-3XFFP2BA.js";
|
|
34
|
+
import {
|
|
35
|
+
output_manager_default
|
|
36
|
+
} from "./chunk-FDJURQMQ.js";
|
|
37
|
+
import {
|
|
38
|
+
require_source
|
|
39
|
+
} from "./chunk-S7KYDPEM.js";
|
|
40
|
+
import {
|
|
41
|
+
__toESM
|
|
42
|
+
} from "./chunk-TZ2YI2VH.js";
|
|
43
|
+
|
|
44
|
+
// src/commands/routes/disable.ts
|
|
45
|
+
var import_chalk = __toESM(require_source(), 1);
|
|
46
|
+
async function disable(client, argv) {
|
|
47
|
+
const parsed = await parseSubcommandArgs(argv, disableSubcommand);
|
|
48
|
+
if (typeof parsed === "number")
|
|
49
|
+
return parsed;
|
|
50
|
+
const link = await ensureProjectLink(client);
|
|
51
|
+
if (typeof link === "number")
|
|
52
|
+
return link;
|
|
53
|
+
const { project, org } = link;
|
|
54
|
+
const teamId = org.type === "team" ? org.id : void 0;
|
|
55
|
+
const { args } = parsed;
|
|
56
|
+
const identifier = args[0];
|
|
57
|
+
if (!identifier) {
|
|
58
|
+
output_manager_default.error(
|
|
59
|
+
`Route name or ID is required. Usage: ${getCommandName("routes disable <name-or-id>")}`
|
|
60
|
+
);
|
|
61
|
+
return 1;
|
|
62
|
+
}
|
|
63
|
+
const { versions } = await getRouteVersions(client, project.id, { teamId });
|
|
64
|
+
const existingStagingVersion = versions.find((v) => v.isStaging);
|
|
65
|
+
output_manager_default.spinner("Fetching routes");
|
|
66
|
+
const { routes } = await getRoutes(client, project.id, { teamId });
|
|
67
|
+
output_manager_default.stopSpinner();
|
|
68
|
+
if (routes.length === 0) {
|
|
69
|
+
output_manager_default.error("No routes found in this project.");
|
|
70
|
+
return 1;
|
|
71
|
+
}
|
|
72
|
+
const route = await resolveRoute(client, routes, identifier);
|
|
73
|
+
if (!route) {
|
|
74
|
+
output_manager_default.error(
|
|
75
|
+
`No route found matching "${identifier}". Run ${import_chalk.default.cyan(
|
|
76
|
+
getCommandName("routes list")
|
|
77
|
+
)} to see all routes.`
|
|
78
|
+
);
|
|
79
|
+
return 1;
|
|
80
|
+
}
|
|
81
|
+
if (route.enabled === false) {
|
|
82
|
+
output_manager_default.log(`Route "${route.name}" is already disabled.`);
|
|
83
|
+
return 0;
|
|
84
|
+
}
|
|
85
|
+
const disableStamp = stamp_default();
|
|
86
|
+
output_manager_default.spinner(`Disabling route "${route.name}"`);
|
|
87
|
+
try {
|
|
88
|
+
const { version } = await editRoute(
|
|
89
|
+
client,
|
|
90
|
+
project.id,
|
|
91
|
+
route.id,
|
|
92
|
+
{
|
|
93
|
+
route: {
|
|
94
|
+
name: route.name,
|
|
95
|
+
description: route.description,
|
|
96
|
+
enabled: false,
|
|
97
|
+
srcSyntax: route.srcSyntax,
|
|
98
|
+
route: route.route
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
{ teamId }
|
|
102
|
+
);
|
|
103
|
+
output_manager_default.log(
|
|
104
|
+
`${import_chalk.default.cyan("Disabled")} route "${route.name}" ${import_chalk.default.gray(disableStamp())}`
|
|
105
|
+
);
|
|
106
|
+
await offerAutoPromote(
|
|
107
|
+
client,
|
|
108
|
+
project.id,
|
|
109
|
+
version,
|
|
110
|
+
!!existingStagingVersion,
|
|
111
|
+
{ teamId }
|
|
112
|
+
);
|
|
113
|
+
return 0;
|
|
114
|
+
} catch (e) {
|
|
115
|
+
const error = e;
|
|
116
|
+
output_manager_default.error(error.message || "Failed to disable route");
|
|
117
|
+
return 1;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
export {
|
|
121
|
+
disable as default
|
|
122
|
+
};
|
|
@@ -0,0 +1,118 @@
|
|
|
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
|
+
updateRouteVersion
|
|
9
|
+
} from "./chunk-PMSMUMUO.js";
|
|
10
|
+
import {
|
|
11
|
+
getRouteVersions
|
|
12
|
+
} from "./chunk-AHU7WNL2.js";
|
|
13
|
+
import {
|
|
14
|
+
confirmAction,
|
|
15
|
+
ensureProjectLink,
|
|
16
|
+
getRoutes,
|
|
17
|
+
parseSubcommandArgs,
|
|
18
|
+
printDiffSummary
|
|
19
|
+
} from "./chunk-TNBMKNET.js";
|
|
20
|
+
import {
|
|
21
|
+
discardSubcommand
|
|
22
|
+
} from "./chunk-U6XOC6E4.js";
|
|
23
|
+
import "./chunk-AQLVWVEN.js";
|
|
24
|
+
import "./chunk-P4I4DMEU.js";
|
|
25
|
+
import {
|
|
26
|
+
stamp_default
|
|
27
|
+
} from "./chunk-SOTR4CXR.js";
|
|
28
|
+
import "./chunk-7EHTK7LP.js";
|
|
29
|
+
import "./chunk-GGP5R3FU.js";
|
|
30
|
+
import {
|
|
31
|
+
getCommandName
|
|
32
|
+
} from "./chunk-ZLCMHY2G.js";
|
|
33
|
+
import "./chunk-3XFFP2BA.js";
|
|
34
|
+
import {
|
|
35
|
+
output_manager_default
|
|
36
|
+
} from "./chunk-FDJURQMQ.js";
|
|
37
|
+
import {
|
|
38
|
+
require_source
|
|
39
|
+
} from "./chunk-S7KYDPEM.js";
|
|
40
|
+
import {
|
|
41
|
+
__toESM
|
|
42
|
+
} from "./chunk-TZ2YI2VH.js";
|
|
43
|
+
|
|
44
|
+
// src/commands/routes/discard.ts
|
|
45
|
+
var import_chalk = __toESM(require_source(), 1);
|
|
46
|
+
async function discard(client, argv) {
|
|
47
|
+
const parsed = await parseSubcommandArgs(argv, discardSubcommand);
|
|
48
|
+
if (typeof parsed === "number")
|
|
49
|
+
return parsed;
|
|
50
|
+
const link = await ensureProjectLink(client);
|
|
51
|
+
if (typeof link === "number")
|
|
52
|
+
return link;
|
|
53
|
+
const { project, org } = link;
|
|
54
|
+
const teamId = org.type === "team" ? org.id : void 0;
|
|
55
|
+
output_manager_default.spinner(`Fetching route versions for ${import_chalk.default.bold(project.name)}`);
|
|
56
|
+
const { versions } = await getRouteVersions(client, project.id, { teamId });
|
|
57
|
+
const stagingVersion = versions.find((v) => v.isStaging);
|
|
58
|
+
if (!stagingVersion) {
|
|
59
|
+
output_manager_default.warn(
|
|
60
|
+
`No staged changes to discard. Make changes first with ${import_chalk.default.cyan(
|
|
61
|
+
getCommandName("routes add")
|
|
62
|
+
)}.`
|
|
63
|
+
);
|
|
64
|
+
return 0;
|
|
65
|
+
}
|
|
66
|
+
output_manager_default.spinner("Fetching staged changes");
|
|
67
|
+
const { routes: diffRoutes } = await getRoutes(client, project.id, {
|
|
68
|
+
teamId,
|
|
69
|
+
versionId: stagingVersion.id,
|
|
70
|
+
diff: true
|
|
71
|
+
});
|
|
72
|
+
const changedRoutes = diffRoutes.filter((r) => r.action !== void 0);
|
|
73
|
+
if (changedRoutes.length > 0) {
|
|
74
|
+
output_manager_default.print(`
|
|
75
|
+
${import_chalk.default.bold("Changes to be discarded:")}
|
|
76
|
+
|
|
77
|
+
`);
|
|
78
|
+
printDiffSummary(changedRoutes);
|
|
79
|
+
output_manager_default.print("\n");
|
|
80
|
+
} else {
|
|
81
|
+
output_manager_default.print(
|
|
82
|
+
`
|
|
83
|
+
${import_chalk.default.gray("No changes detected in staging version.")}
|
|
84
|
+
|
|
85
|
+
`
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
const confirmed = await confirmAction(
|
|
89
|
+
client,
|
|
90
|
+
parsed.flags["--yes"],
|
|
91
|
+
"Discard all staged changes?",
|
|
92
|
+
`This action cannot be undone.`
|
|
93
|
+
);
|
|
94
|
+
if (!confirmed) {
|
|
95
|
+
output_manager_default.log("Canceled");
|
|
96
|
+
return 0;
|
|
97
|
+
}
|
|
98
|
+
const updateStamp = stamp_default();
|
|
99
|
+
output_manager_default.spinner("Discarding staged changes");
|
|
100
|
+
try {
|
|
101
|
+
await updateRouteVersion(client, project.id, stagingVersion.id, "discard", {
|
|
102
|
+
teamId
|
|
103
|
+
});
|
|
104
|
+
output_manager_default.log(
|
|
105
|
+
`${import_chalk.default.cyan("Success!")} Staged changes discarded ${import_chalk.default.gray(
|
|
106
|
+
updateStamp()
|
|
107
|
+
)}`
|
|
108
|
+
);
|
|
109
|
+
return 0;
|
|
110
|
+
} catch (e) {
|
|
111
|
+
const error = e;
|
|
112
|
+
output_manager_default.error(error.message || "Failed to discard staged changes");
|
|
113
|
+
return 1;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
export {
|
|
117
|
+
discard as default
|
|
118
|
+
};
|