vercel 59.0.0 → 59.1.3
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/chunks/{add-SQ6ERCFZ.js → add-CUGPQYFW.js} +8 -8
- package/dist/chunks/{add-QZUQNL2C.js → add-PP3PJPJV.js} +5 -5
- package/dist/chunks/{add-3LO3UMYC.js → add-PRG4KKYH.js} +9 -11
- package/dist/chunks/{build-WMUKZEFH.js → build-T22GMLY6.js} +8 -8
- package/dist/chunks/{chunk-ELA5VN3A.js → chunk-2MF3ZAVW.js} +13 -4
- package/dist/chunks/{chunk-ZFTRB6AB.js → chunk-43DD2KNM.js} +1 -1
- package/dist/chunks/{chunk-N5DK7EMY.js → chunk-4HI7G6KG.js} +1 -1
- package/dist/chunks/{chunk-DQDJVHA5.js → chunk-4JKZ7SRX.js} +4 -4
- package/dist/chunks/{chunk-ZRWSSPW5.js → chunk-57G6HBJ4.js} +2 -2
- package/dist/chunks/{chunk-RWRSUGXY.js → chunk-5DVMXOFT.js} +2 -2
- package/dist/chunks/{chunk-SHR6DYA5.js → chunk-7NQLRE5V.js} +1 -1
- package/dist/chunks/{chunk-JLWQWYKO.js → chunk-BBSS3XIW.js} +2 -4
- package/dist/chunks/{chunk-V42UVZDX.js → chunk-BCZFZETZ.js} +5 -5
- package/dist/chunks/{chunk-MZ3L3SGZ.js → chunk-DAWJOQF6.js} +4 -6
- package/dist/chunks/{chunk-W34XLJ44.js → chunk-DEB45ND4.js} +3 -3
- package/dist/chunks/{chunk-QGQX7BYN.js → chunk-DOMLWKKZ.js} +38 -15
- package/dist/chunks/{chunk-TEQKKTJQ.js → chunk-F7OXZLY2.js} +2 -2
- package/dist/chunks/{chunk-J6LK45HT.js → chunk-GFCTRJI5.js} +16 -2
- package/dist/chunks/{chunk-O26N2UPI.js → chunk-GGPE5377.js} +1 -1
- package/dist/chunks/{chunk-4LDQIDRM.js → chunk-GMWRTZVZ.js} +9 -1
- package/dist/chunks/{chunk-LT5UQNTC.js → chunk-IKKUCZE7.js} +3 -3
- package/dist/chunks/{chunk-XIG4GH62.js → chunk-JYEO6OJS.js} +188 -102
- package/dist/chunks/{chunk-DMLU5KQE.js → chunk-KTLFN5FV.js} +1 -1
- package/dist/chunks/{chunk-L6NIIAB7.js → chunk-LNVZ3T7X.js} +6 -8
- package/dist/chunks/{chunk-UQVOFOP2.js → chunk-M34ZRNDQ.js} +1 -1
- package/dist/chunks/{chunk-2SFMOCWR.js → chunk-PD7ZUXE7.js} +1 -1
- package/dist/chunks/chunk-QCVKGY2A.js +151 -0
- package/dist/chunks/{chunk-S3H7ITUR.js → chunk-QD5NX7RG.js} +1 -1
- package/dist/chunks/{chunk-4N7XLXM2.js → chunk-QQ6PH4RY.js} +1 -0
- package/dist/chunks/{chunk-A5KP5HAI.js → chunk-RIB4S2IB.js} +10 -1
- package/dist/chunks/{chunk-ZX2FSPWV.js → chunk-SJQEGGH7.js} +4 -4
- package/dist/chunks/{chunk-5KI3SUJI.js → chunk-SOKQBFF7.js} +609 -73
- package/dist/chunks/{chunk-PSZQNYEV.js → chunk-SQGMTRZD.js} +91 -43
- package/dist/chunks/{chunk-TJJ562C5.js → chunk-TJLBCLEX.js} +15 -0
- package/dist/chunks/{chunk-WE3TFESA.js → chunk-TM3F7PLR.js} +2 -2
- package/dist/chunks/{chunk-SD2QZHZA.js → chunk-TNKRSTMB.js} +1 -1
- package/dist/chunks/{chunk-KT4XXKJK.js → chunk-VAFU7DXZ.js} +195 -3
- package/dist/chunks/{chunk-RQ7H43CJ.js → chunk-VDJN4WKH.js} +1 -1
- package/dist/chunks/{chunk-3R5JGMHV.js → chunk-VE545BR3.js} +4473 -2796
- package/dist/chunks/{chunk-B3JTF4CF.js → chunk-WC7IINFV.js} +10 -1
- package/dist/chunks/{chunk-SQAQED4U.js → chunk-XZLI27ES.js} +2 -2
- package/dist/chunks/{chunk-CMR5KQVR.js → chunk-ZUVJISHS.js} +3 -3
- package/dist/chunks/{clear-W2B4CHTP.js → clear-Z4IKUIN7.js} +5 -5
- package/dist/chunks/{compile-vercel-config-HTWOS7DZ.js → compile-vercel-config-PSVXFAZW.js} +3 -3
- package/dist/chunks/{config-EGJY4UUE.js → config-M5GMZ2X5.js} +8 -8
- package/dist/chunks/{constants-WEQVJSYS.js → constants-YMCRE6IG.js} +1 -1
- package/dist/chunks/{delete-BVMID4W2.js → delete-5GRRDJSF.js} +4 -4
- package/dist/chunks/{delete-6I7V5AGV.js → delete-P4XIBY7T.js} +5 -5
- package/dist/chunks/{disable-I54JNXJE.js → disable-NT5NYVO7.js} +4 -4
- package/dist/chunks/{discard-6TSJJCUQ.js → discard-TBNIEAJZ.js} +4 -4
- package/dist/chunks/{edit-YS2SWHFJ.js → edit-DJ6MT6HA.js} +5 -5
- package/dist/chunks/{edit-KCWYQ2YT.js → edit-UF3D2CCH.js} +5 -5
- package/dist/chunks/{enable-RYXRIGQN.js → enable-JTQBQMBO.js} +4 -4
- package/dist/chunks/{export-G3NYOADE.js → export-OKMRGRVM.js} +4 -4
- package/dist/chunks/{image-RJBLSUES.js → image-ARUJH4H5.js} +4 -4
- package/dist/chunks/{import-builders-M6F3F4DH.js → import-builders-3NTMZM64.js} +6 -4
- package/dist/chunks/{inspect-YTCVTZHY.js → inspect-5NETOGAI.js} +6 -7
- package/dist/chunks/{inspect-AE4YIJYS.js → inspect-CHFKZKKP.js} +5 -5
- package/dist/chunks/{inspect-Z74NZZ2A.js → inspect-FXZTQY62.js} +6 -6
- package/dist/chunks/{inspect-E7TBGK7D.js → inspect-PTXIBSYW.js} +8 -8
- package/dist/chunks/{inspect-7XUEVBDM.js → inspect-UXP2HDES.js} +5 -5
- package/dist/chunks/{list-SGPLL4KJ.js → list-2WMIVJ2R.js} +15 -10
- package/dist/chunks/{list-KJNC3NOE.js → list-ADI55WKW.js} +6 -7
- package/dist/chunks/{list-WXS2AFQD.js → list-DYCZA2VX.js} +3 -3
- package/dist/chunks/{login-XD3CFPBF.js → login-YCSIQG6B.js} +8 -8
- package/dist/chunks/{ls-5DSOTTYX.js → ls-2TKUIUK4.js} +11 -12
- package/dist/chunks/{ls-KE5I7BZO.js → ls-EOMIQLRH.js} +11 -12
- package/dist/chunks/{ls-SVSO3677.js → ls-PQFDGOJL.js} +7 -8
- package/dist/chunks/{ls-5A4327XJ.js → ls-RZVTIP5U.js} +11 -12
- package/dist/chunks/{ls-NBKSDTWX.js → ls-VIOMDUGW.js} +14 -15
- package/dist/chunks/{open-M2MOAE2K.js → open-JYPWOXQD.js} +5 -5
- package/dist/chunks/{permissions-ADPY554K.js → permissions-SGJWGEVD.js} +6 -6
- package/dist/chunks/{publish-OBIOOL7T.js → publish-ZUQHJAXL.js} +4 -4
- package/dist/chunks/{push-5237XBTO.js → push-XMVKG5A5.js} +8 -8
- package/dist/chunks/{query-ILL74HIA.js → query-ZLJZEGZB.js} +237 -49
- package/dist/chunks/{reorder-GAUAO4LW.js → reorder-NVHDWMRU.js} +4 -4
- package/dist/chunks/{reply-IZJHEULD.js → reply-PUUPUQ3V.js} +5 -5
- package/dist/chunks/{resolve-HTIT7CGL.js → resolve-5U2LJVE6.js} +5 -5
- package/dist/chunks/{restore-IKL74HSE.js → restore-OXIUY2UI.js} +4 -4
- package/dist/chunks/{rm-QAVNP5KX.js → rm-3IOCBNPE.js} +5 -5
- package/dist/chunks/{rm-5Y6BL47T.js → rm-BZNKJRXU.js} +5 -5
- package/dist/chunks/{rm-C37ZORQV.js → rm-OUI4ZB5R.js} +5 -5
- package/dist/chunks/{rm-XJU5SBGH.js → rm-Z2KYJ7XT.js} +8 -8
- package/dist/chunks/{rule-inspect-DYHWWROS.js → rule-inspect-ZBJJCDQV.js} +7 -8
- package/dist/chunks/{rules-M6EJ2Y6S.js → rules-HEGAXXUN.js} +8 -8
- package/dist/chunks/{schema-LLBDZNIC.js → schema-7GVL3BNP.js} +63 -31
- package/dist/chunks/{schema-ZNPIMQL5.js → schema-ZYIJYA2E.js} +2 -3
- package/dist/chunks/{tags-HR5RVQFA.js → tags-3SCWCMNQ.js} +3 -3
- package/dist/chunks/{types-UWI4HETD.js → types-AJHILHO5.js} +2 -4
- package/dist/chunks/{update-6A5V6HBH.js → update-YR2GCCJN.js} +7 -8
- package/dist/commands/build/index.js +10 -15
- package/dist/commands/deploy/index.js +310 -302
- package/dist/commands/dev/index.js +254 -181
- package/dist/commands/env/index.js +15 -16
- package/dist/commands/link/index.js +14 -20
- package/dist/commands/list/index.js +7 -9
- package/dist/commands-bulk.js +4408 -1246
- package/dist/help.js +1 -1
- package/dist/index.js +30 -22
- package/dist/version.mjs +1 -1
- package/package.json +41 -40
- package/dist/chunks/chunk-BGILSKZ5.js +0 -85
- package/dist/chunks/chunk-GFG6QDIE.js +0 -101
- package/dist/chunks/chunk-KBEX5MYS.js +0 -208
- package/dist/chunks/chunk-PBECT5BN.js +0 -107
- package/dist/chunks/chunk-PVCJIMVY.js +0 -1552
- /package/dist/{commands/dev/next-dev-websocket-shim-preload.cjs → runtime-assets/node-preloads/next-dev-websocket.cjs} +0 -0
|
@@ -6,7 +6,7 @@ const __filename = __fileURLToPath(import.meta.url);
|
|
|
6
6
|
const __dirname = __dirname_(__filename);
|
|
7
7
|
import {
|
|
8
8
|
promptMissingCredentials
|
|
9
|
-
} from "../../chunks/chunk-
|
|
9
|
+
} from "../../chunks/chunk-DEB45ND4.js";
|
|
10
10
|
import {
|
|
11
11
|
Now,
|
|
12
12
|
UploadErrorMissingArchive,
|
|
@@ -16,15 +16,15 @@ import {
|
|
|
16
16
|
purchaseDomainIfAvailable,
|
|
17
17
|
require_cjs,
|
|
18
18
|
setupDomain
|
|
19
|
-
} from "../../chunks/chunk-
|
|
19
|
+
} from "../../chunks/chunk-BCZFZETZ.js";
|
|
20
20
|
import "../../chunks/chunk-PRWJUY5U.js";
|
|
21
21
|
import {
|
|
22
22
|
login,
|
|
23
23
|
require_ci_info
|
|
24
|
-
} from "../../chunks/chunk-
|
|
24
|
+
} from "../../chunks/chunk-4JKZ7SRX.js";
|
|
25
25
|
import {
|
|
26
26
|
readLocalConfig
|
|
27
|
-
} from "../../chunks/chunk-
|
|
27
|
+
} from "../../chunks/chunk-DAWJOQF6.js";
|
|
28
28
|
import {
|
|
29
29
|
highlight
|
|
30
30
|
} from "../../chunks/chunk-JKQWQA2T.js";
|
|
@@ -44,14 +44,14 @@ import {
|
|
|
44
44
|
deprecatedArchiveSplitTgz,
|
|
45
45
|
getCommandAliases,
|
|
46
46
|
initSubcommand
|
|
47
|
-
} from "../../chunks/chunk-
|
|
48
|
-
import "../../chunks/chunk-
|
|
49
|
-
import "../../chunks/chunk-
|
|
50
|
-
import "../../chunks/chunk-
|
|
51
|
-
import "../../chunks/chunk-
|
|
47
|
+
} from "../../chunks/chunk-SOKQBFF7.js";
|
|
48
|
+
import "../../chunks/chunk-2MF3ZAVW.js";
|
|
49
|
+
import "../../chunks/chunk-WC7IINFV.js";
|
|
50
|
+
import "../../chunks/chunk-RIB4S2IB.js";
|
|
51
|
+
import "../../chunks/chunk-GFCTRJI5.js";
|
|
52
52
|
import "../../chunks/chunk-CSJBZKC5.js";
|
|
53
53
|
import "../../chunks/chunk-M22O6CYY.js";
|
|
54
|
-
import "../../chunks/chunk-
|
|
54
|
+
import "../../chunks/chunk-GMWRTZVZ.js";
|
|
55
55
|
import "../../chunks/chunk-3KNPVXJ3.js";
|
|
56
56
|
import "../../chunks/chunk-3L2YLLHC.js";
|
|
57
57
|
import "../../chunks/chunk-UMA66MKW.js";
|
|
@@ -59,33 +59,23 @@ import "../../chunks/chunk-7QVJTI5H.js";
|
|
|
59
59
|
import "../../chunks/chunk-O5GNPPTU.js";
|
|
60
60
|
import {
|
|
61
61
|
pickOverrides
|
|
62
|
-
} from "../../chunks/chunk-
|
|
62
|
+
} from "../../chunks/chunk-4HI7G6KG.js";
|
|
63
63
|
import "../../chunks/chunk-HT2XWSAJ.js";
|
|
64
64
|
import {
|
|
65
65
|
stamp_default
|
|
66
66
|
} from "../../chunks/chunk-64IF634X.js";
|
|
67
67
|
import "../../chunks/chunk-VXYGCOKL.js";
|
|
68
|
-
import
|
|
69
|
-
ensureLink
|
|
70
|
-
} from "../../chunks/chunk-PBECT5BN.js";
|
|
71
|
-
import {
|
|
72
|
-
validatePaths,
|
|
73
|
-
validateRootDirectory
|
|
74
|
-
} from "../../chunks/chunk-PVCJIMVY.js";
|
|
75
|
-
import "../../chunks/chunk-BGILSKZ5.js";
|
|
76
|
-
import "../../chunks/chunk-SHR6DYA5.js";
|
|
68
|
+
import "../../chunks/chunk-7NQLRE5V.js";
|
|
77
69
|
import {
|
|
78
70
|
help
|
|
79
|
-
} from "../../chunks/chunk-
|
|
80
|
-
import {
|
|
81
|
-
table
|
|
82
|
-
} from "../../chunks/chunk-KT4XXKJK.js";
|
|
71
|
+
} from "../../chunks/chunk-SJQEGGH7.js";
|
|
83
72
|
import {
|
|
84
73
|
VERCEL_DIR,
|
|
85
74
|
VERCEL_DIR_PROJECT,
|
|
86
75
|
addToGitIgnore,
|
|
87
76
|
compileVercelConfig,
|
|
88
77
|
createGitMeta,
|
|
78
|
+
ensureLink,
|
|
89
79
|
getDeployment,
|
|
90
80
|
getLinkFromDir,
|
|
91
81
|
getRepoLink,
|
|
@@ -100,26 +90,25 @@ import {
|
|
|
100
90
|
printAlignedLabel,
|
|
101
91
|
require_dist as require_dist2,
|
|
102
92
|
require_frameworks,
|
|
103
|
-
require_lib
|
|
104
|
-
|
|
93
|
+
require_lib,
|
|
94
|
+
validatePaths,
|
|
95
|
+
validateRootDirectory
|
|
96
|
+
} from "../../chunks/chunk-VE545BR3.js";
|
|
105
97
|
import {
|
|
106
98
|
TelemetryClient
|
|
107
99
|
} from "../../chunks/chunk-ECCWJHC6.js";
|
|
108
100
|
import {
|
|
109
|
-
AGENT_ACTION,
|
|
110
|
-
AGENT_REASON,
|
|
111
101
|
AGENT_STATUS,
|
|
112
|
-
buildCommandWithYes,
|
|
113
|
-
outputActionRequired,
|
|
114
102
|
outputAgentError,
|
|
115
103
|
withGlobalFlags
|
|
116
|
-
} from "../../chunks/chunk-
|
|
104
|
+
} from "../../chunks/chunk-TJLBCLEX.js";
|
|
117
105
|
import {
|
|
118
106
|
require_ms
|
|
119
107
|
} from "../../chunks/chunk-GGP5R3FU.js";
|
|
120
108
|
import {
|
|
121
|
-
printError
|
|
122
|
-
|
|
109
|
+
printError,
|
|
110
|
+
table
|
|
111
|
+
} from "../../chunks/chunk-VAFU7DXZ.js";
|
|
123
112
|
import {
|
|
124
113
|
parseArguments
|
|
125
114
|
} from "../../chunks/chunk-XLKFJPMT.js";
|
|
@@ -173,94 +162,14 @@ var import_error_utils2 = __toESM(require_dist(), 1);
|
|
|
173
162
|
var import_frameworks = __toESM(require_frameworks(), 1);
|
|
174
163
|
var import_bytes = __toESM(require_bytes(), 1);
|
|
175
164
|
var import_chalk = __toESM(require_source(), 1);
|
|
176
|
-
var
|
|
165
|
+
var import_fs_extra4 = __toESM(require_lib(), 1);
|
|
177
166
|
var import_ms = __toESM(require_ms(), 1);
|
|
178
167
|
import {
|
|
179
168
|
getPrettyError,
|
|
180
169
|
getSupportedNodeVersion,
|
|
181
170
|
scanParentDirs
|
|
182
171
|
} from "@vercel/build-utils";
|
|
183
|
-
import { join as
|
|
184
|
-
|
|
185
|
-
// src/util/deploy/anonymous.ts
|
|
186
|
-
var import_fs_extra = __toESM(require_lib(), 1);
|
|
187
|
-
var import_ci_info = __toESM(require_ci_info(), 1);
|
|
188
|
-
var import_error_utils = __toESM(require_dist(), 1);
|
|
189
|
-
import { join } from "path";
|
|
190
|
-
import { getPlatformEnv } from "@vercel/build-utils";
|
|
191
|
-
var VERCEL_DIR_ANONYMOUS = "anonymous.json";
|
|
192
|
-
function anonymousStatePath(cwd) {
|
|
193
|
-
return join(cwd, VERCEL_DIR, VERCEL_DIR_ANONYMOUS);
|
|
194
|
-
}
|
|
195
|
-
async function readAnonymousState(cwd) {
|
|
196
|
-
try {
|
|
197
|
-
const state = await (0, import_fs_extra.readJSON)(anonymousStatePath(cwd));
|
|
198
|
-
if (typeof state?.projectId === "string" && typeof state.token === "string" && typeof state.claimUrl === "string" && typeof state.expiresAt === "number") {
|
|
199
|
-
return state;
|
|
200
|
-
}
|
|
201
|
-
} catch (_error) {
|
|
202
|
-
}
|
|
203
|
-
return null;
|
|
204
|
-
}
|
|
205
|
-
async function writeAnonymousState(cwd, state) {
|
|
206
|
-
await (0, import_fs_extra.outputJSON)(anonymousStatePath(cwd), state, { spaces: 2 });
|
|
207
|
-
await addToGitIgnore(cwd);
|
|
208
|
-
}
|
|
209
|
-
async function clearAnonymousState(cwd) {
|
|
210
|
-
await (0, import_fs_extra.remove)(anonymousStatePath(cwd));
|
|
211
|
-
}
|
|
212
|
-
async function bootstrapAnonymousProject(client) {
|
|
213
|
-
const { projectId, token, claimUrl, expiresAt } = await client.fetch("/v1/anonymous/projects?surface=cli", {
|
|
214
|
-
method: "POST",
|
|
215
|
-
body: {},
|
|
216
|
-
useCurrentTeam: false,
|
|
217
|
-
// Not idempotent: each attempt creates a project server-side.
|
|
218
|
-
retry: { retries: 0 }
|
|
219
|
-
});
|
|
220
|
-
return { projectId, token, claimUrl, expiresAt };
|
|
221
|
-
}
|
|
222
|
-
async function ensureAnonymousLink(client, cwd, { requireExistingState = false, confirmed = true } = {}) {
|
|
223
|
-
if (import_ci_info.default.isCI) {
|
|
224
|
-
return "refused";
|
|
225
|
-
}
|
|
226
|
-
const linked = Boolean(getPlatformEnv("ORG_ID") && getPlatformEnv("PROJECT_ID")) || Boolean(await getLinkFromDir(getVercelDirectory(cwd))) || Boolean((await getRepoLink(client, cwd))?.repoConfig);
|
|
227
|
-
if (linked) {
|
|
228
|
-
return "refused";
|
|
229
|
-
}
|
|
230
|
-
let state = await readAnonymousState(cwd);
|
|
231
|
-
if (state && state.expiresAt <= Date.now()) {
|
|
232
|
-
output_manager_default.prettyError({
|
|
233
|
-
message: `Your temporary deployment has expired. Run ${getCommandName("login")} to create an account and keep deploying this app.`
|
|
234
|
-
});
|
|
235
|
-
return "failed";
|
|
236
|
-
}
|
|
237
|
-
if (!state && requireExistingState) {
|
|
238
|
-
return "refused";
|
|
239
|
-
}
|
|
240
|
-
if (!confirmed && !state) {
|
|
241
|
-
return "confirmation-required";
|
|
242
|
-
}
|
|
243
|
-
if (!state) {
|
|
244
|
-
try {
|
|
245
|
-
state = await bootstrapAnonymousProject(client);
|
|
246
|
-
} catch (err) {
|
|
247
|
-
output_manager_default.debug(`Anonymous bootstrap failed: ${(0, import_error_utils.errorToString)(err)}`);
|
|
248
|
-
return "refused";
|
|
249
|
-
}
|
|
250
|
-
await writeAnonymousState(cwd, state);
|
|
251
|
-
output_manager_default.log("Not authenticated. Deploying anonymously.");
|
|
252
|
-
}
|
|
253
|
-
client.authConfig = { token: state.token, skipWrite: true };
|
|
254
|
-
delete process.env.VERCEL_TEAM_ID;
|
|
255
|
-
return {
|
|
256
|
-
status: "linked",
|
|
257
|
-
anonymous: true,
|
|
258
|
-
expiresAt: state.expiresAt,
|
|
259
|
-
claimUrl: state.claimUrl,
|
|
260
|
-
org: { type: "user", id: "", slug: "anonymous" },
|
|
261
|
-
project: { id: state.projectId, name: state.projectId }
|
|
262
|
-
};
|
|
263
|
-
}
|
|
172
|
+
import { join as join4, resolve } from "path";
|
|
264
173
|
|
|
265
174
|
// src/util/deploy/generate-cert-for-deploy.ts
|
|
266
175
|
var import_tldts = __toESM(require_cjs(), 1);
|
|
@@ -427,11 +336,11 @@ async function getDeploymentCheckRunLogs(client, deploymentId, checkRunId) {
|
|
|
427
336
|
}
|
|
428
337
|
|
|
429
338
|
// src/util/deploy/get-prebuilt-json.ts
|
|
430
|
-
var
|
|
431
|
-
import { join
|
|
339
|
+
var import_fs_extra = __toESM(require_lib(), 1);
|
|
340
|
+
import { join } from "path";
|
|
432
341
|
async function getPrebuiltJson(directory) {
|
|
433
342
|
try {
|
|
434
|
-
return await
|
|
343
|
+
return await import_fs_extra.default.readJSON(join(directory, "builds.json"));
|
|
435
344
|
} catch (_error) {
|
|
436
345
|
}
|
|
437
346
|
return null;
|
|
@@ -589,6 +498,11 @@ var DeployTelemetryClient = class extends TelemetryClient {
|
|
|
589
498
|
this.trackCliFlag("prod");
|
|
590
499
|
}
|
|
591
500
|
}
|
|
501
|
+
trackCliFlagTemporary(flag) {
|
|
502
|
+
if (flag) {
|
|
503
|
+
this.trackCliFlag("temporary");
|
|
504
|
+
}
|
|
505
|
+
}
|
|
592
506
|
trackTargetEnvironment(target) {
|
|
593
507
|
super.trackTargetEnvironment(
|
|
594
508
|
target === "production" ? "production" : "preview"
|
|
@@ -639,6 +553,221 @@ var DeployTelemetryClient = class extends TelemetryClient {
|
|
|
639
553
|
|
|
640
554
|
// src/commands/deploy/index.ts
|
|
641
555
|
import { determineAgent } from "@vercel/detect-agent";
|
|
556
|
+
|
|
557
|
+
// src/commands/deploy/anonymous.ts
|
|
558
|
+
var import_fs_extra3 = __toESM(require_lib(), 1);
|
|
559
|
+
import { join as join3 } from "path";
|
|
560
|
+
|
|
561
|
+
// src/util/deploy/anonymous.ts
|
|
562
|
+
var import_fs_extra2 = __toESM(require_lib(), 1);
|
|
563
|
+
var import_ci_info = __toESM(require_ci_info(), 1);
|
|
564
|
+
var import_error_utils = __toESM(require_dist(), 1);
|
|
565
|
+
import { join as join2 } from "path";
|
|
566
|
+
import { getPlatformEnv } from "@vercel/build-utils";
|
|
567
|
+
var VERCEL_DIR_ANONYMOUS = "anonymous.json";
|
|
568
|
+
function anonymousStatePath(cwd) {
|
|
569
|
+
return join2(cwd, VERCEL_DIR, VERCEL_DIR_ANONYMOUS);
|
|
570
|
+
}
|
|
571
|
+
async function readAnonymousState(cwd) {
|
|
572
|
+
try {
|
|
573
|
+
const state = await (0, import_fs_extra2.readJSON)(anonymousStatePath(cwd));
|
|
574
|
+
if (typeof state?.projectId === "string" && typeof state.token === "string" && typeof state.claimUrl === "string" && typeof state.expiresAt === "number") {
|
|
575
|
+
return state;
|
|
576
|
+
}
|
|
577
|
+
} catch (_error) {
|
|
578
|
+
}
|
|
579
|
+
return null;
|
|
580
|
+
}
|
|
581
|
+
async function writeAnonymousState(cwd, state) {
|
|
582
|
+
await (0, import_fs_extra2.outputJSON)(anonymousStatePath(cwd), state, { spaces: 2 });
|
|
583
|
+
await addToGitIgnore(cwd);
|
|
584
|
+
}
|
|
585
|
+
async function clearAnonymousState(cwd) {
|
|
586
|
+
await (0, import_fs_extra2.remove)(anonymousStatePath(cwd));
|
|
587
|
+
}
|
|
588
|
+
async function bootstrapAnonymousProject(client) {
|
|
589
|
+
const { projectId, token, claimUrl, expiresAt } = await client.fetch("/v1/anonymous/projects?surface=cli", {
|
|
590
|
+
method: "POST",
|
|
591
|
+
body: {},
|
|
592
|
+
useCurrentTeam: false,
|
|
593
|
+
// Not idempotent: each attempt creates a project server-side.
|
|
594
|
+
retry: { retries: 0 }
|
|
595
|
+
});
|
|
596
|
+
return { projectId, token, claimUrl, expiresAt };
|
|
597
|
+
}
|
|
598
|
+
async function ensureAnonymousLink(client, cwd, { requireExistingState = false, confirmed = true } = {}) {
|
|
599
|
+
if (import_ci_info.default.isCI) {
|
|
600
|
+
return "refused";
|
|
601
|
+
}
|
|
602
|
+
const linked = Boolean(getPlatformEnv("ORG_ID") && getPlatformEnv("PROJECT_ID")) || Boolean(await getLinkFromDir(getVercelDirectory(cwd))) || Boolean((await getRepoLink(client, cwd))?.repoConfig);
|
|
603
|
+
if (linked) {
|
|
604
|
+
return "refused";
|
|
605
|
+
}
|
|
606
|
+
let state = await readAnonymousState(cwd);
|
|
607
|
+
if (state && state.expiresAt <= Date.now()) {
|
|
608
|
+
output_manager_default.prettyError({
|
|
609
|
+
message: `Your temporary deployment has expired. Run ${getCommandName("login")} to create an account and keep deploying this app.`
|
|
610
|
+
});
|
|
611
|
+
return "failed";
|
|
612
|
+
}
|
|
613
|
+
if (!state && requireExistingState) {
|
|
614
|
+
return "refused";
|
|
615
|
+
}
|
|
616
|
+
if (!confirmed && !state) {
|
|
617
|
+
return "confirmation-required";
|
|
618
|
+
}
|
|
619
|
+
if (!state) {
|
|
620
|
+
try {
|
|
621
|
+
state = await bootstrapAnonymousProject(client);
|
|
622
|
+
} catch (err) {
|
|
623
|
+
output_manager_default.debug(`Anonymous bootstrap failed: ${(0, import_error_utils.errorToString)(err)}`);
|
|
624
|
+
return "refused";
|
|
625
|
+
}
|
|
626
|
+
await writeAnonymousState(cwd, state);
|
|
627
|
+
output_manager_default.log("Not authenticated. Deploying anonymously.");
|
|
628
|
+
}
|
|
629
|
+
client.authConfig = { token: state.token, skipWrite: true };
|
|
630
|
+
delete process.env.VERCEL_TEAM_ID;
|
|
631
|
+
return {
|
|
632
|
+
status: "linked",
|
|
633
|
+
anonymous: true,
|
|
634
|
+
expiresAt: state.expiresAt,
|
|
635
|
+
claimUrl: state.claimUrl,
|
|
636
|
+
org: { type: "user", id: "", slug: "anonymous" },
|
|
637
|
+
project: { id: state.projectId, name: state.projectId }
|
|
638
|
+
};
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
// src/commands/deploy/anonymous.ts
|
|
642
|
+
function validateAnonymousTarget(isAnonymous, target) {
|
|
643
|
+
if (isAnonymous && target && target !== "production") {
|
|
644
|
+
output_manager_default.error(
|
|
645
|
+
`Anonymous deployments always target production, so "${target}" is not available. Remove the ${param(
|
|
646
|
+
"--target"
|
|
647
|
+
)} option, or run ${getCommandName("login")} to deploy to other environments.`
|
|
648
|
+
);
|
|
649
|
+
return false;
|
|
650
|
+
}
|
|
651
|
+
return true;
|
|
652
|
+
}
|
|
653
|
+
async function setupAnonymousDeployment(client, cwd, { isAnonymous, dryRun }) {
|
|
654
|
+
if (!isAnonymous) {
|
|
655
|
+
await clearAnonymousState(cwd);
|
|
656
|
+
}
|
|
657
|
+
let anonymousLink;
|
|
658
|
+
if (isAnonymous) {
|
|
659
|
+
const anonymous = await ensureAnonymousLink(client, cwd, {
|
|
660
|
+
requireExistingState: dryRun
|
|
661
|
+
});
|
|
662
|
+
if (anonymous === "refused") {
|
|
663
|
+
const loginExitCode = await promptMissingCredentials(client);
|
|
664
|
+
if (loginExitCode !== 0) {
|
|
665
|
+
return loginExitCode;
|
|
666
|
+
}
|
|
667
|
+
isAnonymous = false;
|
|
668
|
+
} else if (anonymous === "failed") {
|
|
669
|
+
return 1;
|
|
670
|
+
} else if (anonymous === "confirmation-required") {
|
|
671
|
+
return 1;
|
|
672
|
+
} else {
|
|
673
|
+
anonymousLink = anonymous;
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
return { isAnonymous, anonymousLink };
|
|
677
|
+
}
|
|
678
|
+
async function handleAnonymousDeploymentError({
|
|
679
|
+
client,
|
|
680
|
+
cwd,
|
|
681
|
+
error,
|
|
682
|
+
link,
|
|
683
|
+
isV0,
|
|
684
|
+
retry
|
|
685
|
+
}) {
|
|
686
|
+
if (!link || !isAPIError(error)) {
|
|
687
|
+
return;
|
|
688
|
+
}
|
|
689
|
+
if (error.code === "anonymous_project_claimed") {
|
|
690
|
+
if (client.nonInteractive || !client.stdin.isTTY) {
|
|
691
|
+
output_manager_default.prettyError({
|
|
692
|
+
message: `This project was claimed successfully. Run ${getCommandName("login")} to continue deploying it.`
|
|
693
|
+
});
|
|
694
|
+
return 1;
|
|
695
|
+
}
|
|
696
|
+
output_manager_default.log(
|
|
697
|
+
"This project was claimed successfully. Log in to continue deploying it."
|
|
698
|
+
);
|
|
699
|
+
let loginExitCode;
|
|
700
|
+
try {
|
|
701
|
+
loginExitCode = await login(client, { shouldParseArgs: false });
|
|
702
|
+
} catch (loginError) {
|
|
703
|
+
printError(loginError);
|
|
704
|
+
return 1;
|
|
705
|
+
}
|
|
706
|
+
if (loginExitCode !== 0) {
|
|
707
|
+
return loginExitCode;
|
|
708
|
+
}
|
|
709
|
+
const claimedProjectLink = await ensureLink("deploy", client, cwd, {
|
|
710
|
+
autoConfirm: true,
|
|
711
|
+
projectName: link.project.id,
|
|
712
|
+
failIfNotFound: true,
|
|
713
|
+
allowOwnerLookupFallback: true,
|
|
714
|
+
v0: isV0
|
|
715
|
+
});
|
|
716
|
+
if (typeof claimedProjectLink === "number") {
|
|
717
|
+
return claimedProjectLink;
|
|
718
|
+
}
|
|
719
|
+
await linkFolderToProject(
|
|
720
|
+
client,
|
|
721
|
+
cwd,
|
|
722
|
+
{
|
|
723
|
+
projectId: claimedProjectLink.project.id,
|
|
724
|
+
orgId: claimedProjectLink.org.id
|
|
725
|
+
},
|
|
726
|
+
claimedProjectLink.project.name,
|
|
727
|
+
claimedProjectLink.org.slug,
|
|
728
|
+
"link",
|
|
729
|
+
true,
|
|
730
|
+
false
|
|
731
|
+
);
|
|
732
|
+
await clearAnonymousState(cwd);
|
|
733
|
+
return retry();
|
|
734
|
+
}
|
|
735
|
+
if (error.status === 401 || error.status === 410) {
|
|
736
|
+
await clearAnonymousState(cwd);
|
|
737
|
+
output_manager_default.prettyError({
|
|
738
|
+
message: `Your temporary deployment has expired. Run ${getCommandName("login")} to create an account and keep deploying this app.`
|
|
739
|
+
});
|
|
740
|
+
return 1;
|
|
741
|
+
}
|
|
742
|
+
}
|
|
743
|
+
async function runImplicitBuild(client, cwd) {
|
|
744
|
+
const projectJsonPath = join3(cwd, VERCEL_DIR, VERCEL_DIR_PROJECT);
|
|
745
|
+
if (!await import_fs_extra3.default.pathExists(projectJsonPath)) {
|
|
746
|
+
await import_fs_extra3.default.outputJSON(projectJsonPath, { settings: {} }, { spaces: 2 });
|
|
747
|
+
}
|
|
748
|
+
if (await import_fs_extra3.default.pathExists(join3(cwd, "package.json"))) {
|
|
749
|
+
output_manager_default.log("Building your project locally\u2026");
|
|
750
|
+
}
|
|
751
|
+
const originalArgv = client.argv;
|
|
752
|
+
const originalCwd = client.cwd;
|
|
753
|
+
const originalStdout = client.stdout;
|
|
754
|
+
client.cwd = cwd;
|
|
755
|
+
client.setArgv([...originalArgv.slice(0, 2), "build", "--prod", "--yes"]);
|
|
756
|
+
client.stdout = createSinkStream();
|
|
757
|
+
try {
|
|
758
|
+
const build = (await import("../build/index.js")).default;
|
|
759
|
+
return await build(client);
|
|
760
|
+
} finally {
|
|
761
|
+
client.setArgv(originalArgv);
|
|
762
|
+
client.cwd = originalCwd;
|
|
763
|
+
client.stdout = originalStdout;
|
|
764
|
+
}
|
|
765
|
+
}
|
|
766
|
+
function createSinkStream() {
|
|
767
|
+
return { isTTY: false, write: () => true };
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
// src/commands/deploy/index.ts
|
|
642
771
|
var COMMAND_CONFIG = {
|
|
643
772
|
init: getCommandAliases(initSubcommand),
|
|
644
773
|
continue: getCommandAliases(continueSubcommand)
|
|
@@ -803,13 +932,13 @@ async function handleInitDeployment(client, telemetryClient) {
|
|
|
803
932
|
client.config.currentTeam = org.type === "team" ? org.id : void 0;
|
|
804
933
|
if (rootDirectory && await validateRootDirectory(
|
|
805
934
|
cwd,
|
|
806
|
-
|
|
935
|
+
join4(cwd, rootDirectory),
|
|
807
936
|
project ? `To change your Project Settings, go to https://vercel.com/${org?.slug}/${project.name}/settings` : ""
|
|
808
937
|
) === false) {
|
|
809
938
|
return 1;
|
|
810
939
|
}
|
|
811
940
|
if (rootDirectory) {
|
|
812
|
-
const rootDirectoryPath =
|
|
941
|
+
const rootDirectoryPath = join4(cwd, rootDirectory);
|
|
813
942
|
await compileVercelConfig(rootDirectoryPath);
|
|
814
943
|
const rootDirectoryConfig = readLocalConfig(rootDirectoryPath);
|
|
815
944
|
if (rootDirectoryConfig) {
|
|
@@ -868,7 +997,7 @@ async function handleInitDeployment(client, telemetryClient) {
|
|
|
868
997
|
}
|
|
869
998
|
const meta = Object.assign({}, parseMeta(localConfig.meta), cliMeta);
|
|
870
999
|
const gitMetadata = await createGitMeta(
|
|
871
|
-
|
|
1000
|
+
join4(cwd, project.rootDirectory || ""),
|
|
872
1001
|
project
|
|
873
1002
|
);
|
|
874
1003
|
const deploymentEnv = Object.assign(
|
|
@@ -941,7 +1070,7 @@ async function handleInitDeployment(client, telemetryClient) {
|
|
|
941
1070
|
};
|
|
942
1071
|
}
|
|
943
1072
|
const { packageJson } = await scanParentDirs(
|
|
944
|
-
|
|
1073
|
+
join4(cwd, project?.rootDirectory ?? ""),
|
|
945
1074
|
true,
|
|
946
1075
|
cwd
|
|
947
1076
|
);
|
|
@@ -1279,11 +1408,11 @@ async function handleContinueSubcommand(client, telemetryClient) {
|
|
|
1279
1408
|
return 1;
|
|
1280
1409
|
}
|
|
1281
1410
|
}
|
|
1282
|
-
let vercelOutputDir =
|
|
1411
|
+
let vercelOutputDir = join4(cwd, ".vercel/output");
|
|
1283
1412
|
if (link.repoRoot && link.project.rootDirectory) {
|
|
1284
|
-
vercelOutputDir =
|
|
1413
|
+
vercelOutputDir = join4(cwd, link.project.rootDirectory, ".vercel/output");
|
|
1285
1414
|
}
|
|
1286
|
-
const prebuiltExists = await
|
|
1415
|
+
const prebuiltExists = await import_fs_extra4.default.pathExists(vercelOutputDir);
|
|
1287
1416
|
if (!prebuiltExists) {
|
|
1288
1417
|
if (client.nonInteractive) {
|
|
1289
1418
|
outputAgentError(
|
|
@@ -1350,6 +1479,7 @@ async function handleDefaultDeploy(client, telemetryClient) {
|
|
|
1350
1479
|
telemetryClient.trackCliFlagYes(parsedArguments.flags["--yes"]);
|
|
1351
1480
|
telemetryClient.trackCliOptionTarget(parsedArguments.flags["--target"]);
|
|
1352
1481
|
telemetryClient.trackCliFlagProd(parsedArguments.flags["--prod"]);
|
|
1482
|
+
telemetryClient.trackCliFlagTemporary(parsedArguments.flags["--temporary"]);
|
|
1353
1483
|
telemetryClient.trackCliFlagSkipDomain(
|
|
1354
1484
|
parsedArguments.flags["--skip-domain"]
|
|
1355
1485
|
);
|
|
@@ -1451,18 +1581,20 @@ async function handleDefaultDeploy(client, telemetryClient) {
|
|
|
1451
1581
|
);
|
|
1452
1582
|
telemetryClient.trackCliFlagNoClipboard(true);
|
|
1453
1583
|
}
|
|
1454
|
-
let isAnonymous = !client.authConfig.token;
|
|
1584
|
+
let isAnonymous = !client.authConfig.token && Boolean(parsedArguments.flags["--temporary"]);
|
|
1585
|
+
if (!client.authConfig.token && !isAnonymous) {
|
|
1586
|
+
output_manager_default.prettyError({
|
|
1587
|
+
message: `No existing credentials found. Run ${getCommandName("deploy --temporary")} to create a temporary deployment you can claim later, or ${getCommandName("login")} to log in.`,
|
|
1588
|
+
link: "https://err.sh/vercel/no-credentials-found"
|
|
1589
|
+
});
|
|
1590
|
+
return 1;
|
|
1591
|
+
}
|
|
1455
1592
|
let target = parseTarget({
|
|
1456
1593
|
flagName: "target",
|
|
1457
1594
|
flags: parsedArguments.flags
|
|
1458
1595
|
});
|
|
1459
1596
|
telemetryClient.trackTargetEnvironment(target);
|
|
1460
|
-
if (isAnonymous
|
|
1461
|
-
error(
|
|
1462
|
-
`Anonymous deployments always target production, so "${target}" is not available. Remove the ${param(
|
|
1463
|
-
"--target"
|
|
1464
|
-
)} option, or run ${getCommandName("login")} to deploy to other environments.`
|
|
1465
|
-
);
|
|
1597
|
+
if (!validateAnonymousTarget(isAnonymous, target)) {
|
|
1466
1598
|
return 1;
|
|
1467
1599
|
}
|
|
1468
1600
|
const skipDomain = parsedArguments.flags["--skip-domain"];
|
|
@@ -1490,77 +1622,17 @@ async function handleDefaultDeploy(client, telemetryClient) {
|
|
|
1490
1622
|
}
|
|
1491
1623
|
const cliMeta = parseMeta(parsedArguments.flags["--meta"]);
|
|
1492
1624
|
const isV0 = cliMeta.v0 === "true";
|
|
1493
|
-
|
|
1494
|
-
|
|
1625
|
+
const anonymousSetup = await setupAnonymousDeployment(client, cwd, {
|
|
1626
|
+
isAnonymous,
|
|
1627
|
+
dryRun: Boolean(parsedArguments.flags["--dry"])
|
|
1628
|
+
});
|
|
1629
|
+
if (typeof anonymousSetup === "number") {
|
|
1630
|
+
return anonymousSetup;
|
|
1495
1631
|
}
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
confirmed: Boolean(
|
|
1501
|
-
parsedArguments.flags["--yes"] || parsedArguments.flags["--dry"]
|
|
1502
|
-
)
|
|
1503
|
-
};
|
|
1504
|
-
let anonymous = await ensureAnonymousLink(client, cwd, anonymousOptions);
|
|
1505
|
-
let temporaryDeploymentsUnavailable = anonymous === "refused";
|
|
1506
|
-
if (anonymous === "confirmation-required") {
|
|
1507
|
-
const command = buildCommandWithYes(client.argv);
|
|
1508
|
-
if (client.nonInteractive) {
|
|
1509
|
-
outputActionRequired(
|
|
1510
|
-
client,
|
|
1511
|
-
{
|
|
1512
|
-
status: AGENT_STATUS.ACTION_REQUIRED,
|
|
1513
|
-
reason: AGENT_REASON.CONFIRMATION_REQUIRED,
|
|
1514
|
-
action: AGENT_ACTION.CONFIRMATION_REQUIRED,
|
|
1515
|
-
message: "Deploying without credentials creates a temporary deployment. Re-run with --yes to confirm.",
|
|
1516
|
-
next: [
|
|
1517
|
-
{
|
|
1518
|
-
command,
|
|
1519
|
-
when: "Create a temporary deployment"
|
|
1520
|
-
}
|
|
1521
|
-
]
|
|
1522
|
-
},
|
|
1523
|
-
1
|
|
1524
|
-
);
|
|
1525
|
-
return 1;
|
|
1526
|
-
}
|
|
1527
|
-
if (!client.stdin.isTTY) {
|
|
1528
|
-
error(
|
|
1529
|
-
`Temporary deployment requires confirmation. Re-run with ${code(command)}.`
|
|
1530
|
-
);
|
|
1531
|
-
return 1;
|
|
1532
|
-
}
|
|
1533
|
-
const confirmed = await client.input.confirm(
|
|
1534
|
-
"Deploy temporarily without logging in?",
|
|
1535
|
-
true
|
|
1536
|
-
);
|
|
1537
|
-
if (confirmed) {
|
|
1538
|
-
anonymous = await ensureAnonymousLink(client, cwd, {
|
|
1539
|
-
...anonymousOptions,
|
|
1540
|
-
confirmed: true
|
|
1541
|
-
});
|
|
1542
|
-
temporaryDeploymentsUnavailable = anonymous === "refused";
|
|
1543
|
-
} else {
|
|
1544
|
-
anonymous = "refused";
|
|
1545
|
-
}
|
|
1546
|
-
}
|
|
1547
|
-
if (anonymous === "refused") {
|
|
1548
|
-
if (temporaryDeploymentsUnavailable) {
|
|
1549
|
-
output_manager_default.log("Temporary deployments aren't available.");
|
|
1550
|
-
}
|
|
1551
|
-
const loginExitCode = await promptMissingCredentials(client);
|
|
1552
|
-
if (loginExitCode !== 0) {
|
|
1553
|
-
return loginExitCode;
|
|
1554
|
-
}
|
|
1555
|
-
isAnonymous = false;
|
|
1556
|
-
} else if (anonymous === "failed") {
|
|
1557
|
-
return 1;
|
|
1558
|
-
} else if (anonymous === "confirmation-required") {
|
|
1559
|
-
return 1;
|
|
1560
|
-
} else {
|
|
1561
|
-
anonymousLink = anonymous;
|
|
1562
|
-
target = "production";
|
|
1563
|
-
}
|
|
1632
|
+
isAnonymous = anonymousSetup.isAnonymous;
|
|
1633
|
+
const anonymousLink = anonymousSetup.anonymousLink;
|
|
1634
|
+
if (anonymousLink) {
|
|
1635
|
+
target = "production";
|
|
1564
1636
|
}
|
|
1565
1637
|
const link = anonymousLink ?? await ensureLink("deploy", client, cwd, {
|
|
1566
1638
|
autoConfirm,
|
|
@@ -1576,6 +1648,10 @@ async function handleDefaultDeploy(client, telemetryClient) {
|
|
|
1576
1648
|
if (typeof link === "number") {
|
|
1577
1649
|
return link;
|
|
1578
1650
|
}
|
|
1651
|
+
const redeployCommand = withGlobalFlags(
|
|
1652
|
+
client,
|
|
1653
|
+
isAnonymous ? "deploy --temporary" : "deploy"
|
|
1654
|
+
);
|
|
1579
1655
|
const { org, project } = link;
|
|
1580
1656
|
const rootDirectory = project.rootDirectory;
|
|
1581
1657
|
const sourceFilesOutsideRootDirectory = project.sourceFilesOutsideRootDirectory ?? true;
|
|
@@ -1585,17 +1661,17 @@ async function handleDefaultDeploy(client, telemetryClient) {
|
|
|
1585
1661
|
const prebuilt = isAnonymous || !!parsedArguments.flags["--prebuilt"];
|
|
1586
1662
|
let vercelOutputDir;
|
|
1587
1663
|
if (prebuilt) {
|
|
1588
|
-
vercelOutputDir =
|
|
1664
|
+
vercelOutputDir = join4(cwd, ".vercel/output");
|
|
1589
1665
|
if (link.repoRoot && link.project.rootDirectory) {
|
|
1590
|
-
vercelOutputDir =
|
|
1666
|
+
vercelOutputDir = join4(cwd, link.project.rootDirectory, ".vercel/output");
|
|
1591
1667
|
}
|
|
1592
|
-
let prebuiltExists = await
|
|
1668
|
+
let prebuiltExists = await import_fs_extra4.default.pathExists(vercelOutputDir);
|
|
1593
1669
|
if (!prebuiltExists && isAnonymous && !parsedArguments.flags["--dry"]) {
|
|
1594
1670
|
const buildExitCode = await runImplicitBuild(client, cwd);
|
|
1595
1671
|
if (buildExitCode !== 0) {
|
|
1596
1672
|
return buildExitCode;
|
|
1597
1673
|
}
|
|
1598
|
-
prebuiltExists = await
|
|
1674
|
+
prebuiltExists = await import_fs_extra4.default.pathExists(vercelOutputDir);
|
|
1599
1675
|
}
|
|
1600
1676
|
if (!prebuiltExists) {
|
|
1601
1677
|
error(
|
|
@@ -1640,13 +1716,13 @@ async function handleDefaultDeploy(client, telemetryClient) {
|
|
|
1640
1716
|
client.config.currentTeam = currentTeam;
|
|
1641
1717
|
if (rootDirectory && await validateRootDirectory(
|
|
1642
1718
|
cwd,
|
|
1643
|
-
|
|
1719
|
+
join4(cwd, rootDirectory),
|
|
1644
1720
|
project && orgSlug ? `To change your Project Settings, go to https://vercel.com/${orgSlug}/${project.name}/settings` : ""
|
|
1645
1721
|
) === false) {
|
|
1646
1722
|
return 1;
|
|
1647
1723
|
}
|
|
1648
1724
|
if (rootDirectory) {
|
|
1649
|
-
const rootDirectoryPath =
|
|
1725
|
+
const rootDirectoryPath = join4(cwd, rootDirectory);
|
|
1650
1726
|
await compileVercelConfig(rootDirectoryPath);
|
|
1651
1727
|
const rootDirectoryConfig = readLocalConfig(rootDirectoryPath);
|
|
1652
1728
|
if (rootDirectoryConfig) {
|
|
@@ -1733,7 +1809,7 @@ async function handleDefaultDeploy(client, telemetryClient) {
|
|
|
1733
1809
|
}
|
|
1734
1810
|
const meta = Object.assign({}, parseMeta(localConfig.meta), cliMeta);
|
|
1735
1811
|
const gitMetadata = await createGitMeta(
|
|
1736
|
-
|
|
1812
|
+
join4(cwd, project.rootDirectory || ""),
|
|
1737
1813
|
project
|
|
1738
1814
|
);
|
|
1739
1815
|
const deploymentEnv = Object.assign(
|
|
@@ -1810,7 +1886,7 @@ async function handleDefaultDeploy(client, telemetryClient) {
|
|
|
1810
1886
|
};
|
|
1811
1887
|
}
|
|
1812
1888
|
const { packageJson } = await scanParentDirs(
|
|
1813
|
-
|
|
1889
|
+
join4(cwd, project?.rootDirectory ?? ""),
|
|
1814
1890
|
true,
|
|
1815
1891
|
cwd
|
|
1816
1892
|
);
|
|
@@ -1853,7 +1929,7 @@ async function handleDefaultDeploy(client, telemetryClient) {
|
|
|
1853
1929
|
message: deployment.message,
|
|
1854
1930
|
next: [
|
|
1855
1931
|
{
|
|
1856
|
-
command:
|
|
1932
|
+
command: redeployCommand,
|
|
1857
1933
|
when: "retry deploy"
|
|
1858
1934
|
}
|
|
1859
1935
|
]
|
|
@@ -1880,7 +1956,7 @@ async function handleDefaultDeploy(client, telemetryClient) {
|
|
|
1880
1956
|
message: msg,
|
|
1881
1957
|
next: [
|
|
1882
1958
|
{
|
|
1883
|
-
command:
|
|
1959
|
+
command: redeployCommand,
|
|
1884
1960
|
when: "retry deploy"
|
|
1885
1961
|
}
|
|
1886
1962
|
]
|
|
@@ -1919,7 +1995,7 @@ async function handleDefaultDeploy(client, telemetryClient) {
|
|
|
1919
1995
|
deployment: deploymentJson,
|
|
1920
1996
|
next: [
|
|
1921
1997
|
{
|
|
1922
|
-
command:
|
|
1998
|
+
command: redeployCommand,
|
|
1923
1999
|
when: "retry deploy"
|
|
1924
2000
|
}
|
|
1925
2001
|
]
|
|
@@ -1932,7 +2008,7 @@ async function handleDefaultDeploy(client, telemetryClient) {
|
|
|
1932
2008
|
return 1;
|
|
1933
2009
|
}
|
|
1934
2010
|
if (deployment.checks?.["deployment-alias"]?.state === "failed") {
|
|
1935
|
-
return handleFailedCheckRuns(client, deployment, asJson);
|
|
2011
|
+
return handleFailedCheckRuns(client, deployment, asJson, redeployCommand);
|
|
1936
2012
|
}
|
|
1937
2013
|
if (deployment.checksConclusion === "failed") {
|
|
1938
2014
|
const { checks } = await getDeploymentChecks(client, deployment.id);
|
|
@@ -1959,7 +2035,7 @@ async function handleDefaultDeploy(client, telemetryClient) {
|
|
|
1959
2035
|
deployment: deploymentJson,
|
|
1960
2036
|
next: [
|
|
1961
2037
|
{
|
|
1962
|
-
command:
|
|
2038
|
+
command: redeployCommand,
|
|
1963
2039
|
when: "retry deploy"
|
|
1964
2040
|
}
|
|
1965
2041
|
]
|
|
@@ -1984,7 +2060,7 @@ async function handleDefaultDeploy(client, telemetryClient) {
|
|
|
1984
2060
|
message: "Uploading failed. Please try again.",
|
|
1985
2061
|
next: [
|
|
1986
2062
|
{
|
|
1987
|
-
command:
|
|
2063
|
+
command: redeployCommand,
|
|
1988
2064
|
when: "retry deploy"
|
|
1989
2065
|
}
|
|
1990
2066
|
]
|
|
@@ -2005,58 +2081,16 @@ async function handleDefaultDeploy(client, telemetryClient) {
|
|
|
2005
2081
|
debug(`Error: ${err}
|
|
2006
2082
|
${err.stack}`);
|
|
2007
2083
|
}
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
let loginExitCode;
|
|
2019
|
-
try {
|
|
2020
|
-
loginExitCode = await login(client, { shouldParseArgs: false });
|
|
2021
|
-
} catch (loginError) {
|
|
2022
|
-
printError(loginError);
|
|
2023
|
-
return 1;
|
|
2024
|
-
}
|
|
2025
|
-
if (loginExitCode !== 0) {
|
|
2026
|
-
return loginExitCode;
|
|
2027
|
-
}
|
|
2028
|
-
const claimedProjectLink = await ensureLink("deploy", client, cwd, {
|
|
2029
|
-
autoConfirm: true,
|
|
2030
|
-
projectName: anonymousLink.project.id,
|
|
2031
|
-
failIfNotFound: true,
|
|
2032
|
-
allowOwnerLookupFallback: true,
|
|
2033
|
-
v0: isV0
|
|
2034
|
-
});
|
|
2035
|
-
if (typeof claimedProjectLink === "number") {
|
|
2036
|
-
return claimedProjectLink;
|
|
2037
|
-
}
|
|
2038
|
-
await linkFolderToProject(
|
|
2039
|
-
client,
|
|
2040
|
-
cwd,
|
|
2041
|
-
{
|
|
2042
|
-
projectId: claimedProjectLink.project.id,
|
|
2043
|
-
orgId: claimedProjectLink.org.id
|
|
2044
|
-
},
|
|
2045
|
-
claimedProjectLink.project.name,
|
|
2046
|
-
claimedProjectLink.org.slug,
|
|
2047
|
-
"link",
|
|
2048
|
-
true,
|
|
2049
|
-
false
|
|
2050
|
-
);
|
|
2051
|
-
await clearAnonymousState(cwd);
|
|
2052
|
-
return handleDefaultDeploy(client, telemetryClient);
|
|
2053
|
-
}
|
|
2054
|
-
if (anonymousLink && isAPIError(err) && (err.status === 401 || err.status === 410)) {
|
|
2055
|
-
await clearAnonymousState(cwd);
|
|
2056
|
-
prettyError({
|
|
2057
|
-
message: `Your temporary deployment has expired. Run ${getCommandName("login")} to create an account and keep deploying this app.`
|
|
2058
|
-
});
|
|
2059
|
-
return 1;
|
|
2084
|
+
const anonymousExitCode = await handleAnonymousDeploymentError({
|
|
2085
|
+
client,
|
|
2086
|
+
cwd,
|
|
2087
|
+
error: err,
|
|
2088
|
+
link: anonymousLink,
|
|
2089
|
+
isV0,
|
|
2090
|
+
retry: () => handleDefaultDeploy(client, telemetryClient)
|
|
2091
|
+
});
|
|
2092
|
+
if (anonymousExitCode !== void 0) {
|
|
2093
|
+
return anonymousExitCode;
|
|
2060
2094
|
}
|
|
2061
2095
|
if (err instanceof UploadErrorMissingArchive) {
|
|
2062
2096
|
if (client.nonInteractive) {
|
|
@@ -2068,7 +2102,7 @@ ${err.stack}`);
|
|
|
2068
2102
|
message: err.message,
|
|
2069
2103
|
next: [
|
|
2070
2104
|
{
|
|
2071
|
-
command:
|
|
2105
|
+
command: redeployCommand,
|
|
2072
2106
|
when: "retry deploy"
|
|
2073
2107
|
}
|
|
2074
2108
|
]
|
|
@@ -2094,7 +2128,7 @@ ${err.stack}`);
|
|
|
2094
2128
|
message: err.message,
|
|
2095
2129
|
next: [
|
|
2096
2130
|
{
|
|
2097
|
-
command:
|
|
2131
|
+
command: redeployCommand,
|
|
2098
2132
|
when: "retry deploy"
|
|
2099
2133
|
}
|
|
2100
2134
|
]
|
|
@@ -2140,7 +2174,7 @@ ${err.stack}`);
|
|
|
2140
2174
|
message: err instanceof Error ? err.message : String(err),
|
|
2141
2175
|
next: [
|
|
2142
2176
|
{
|
|
2143
|
-
command:
|
|
2177
|
+
command: redeployCommand,
|
|
2144
2178
|
when: "retry deploy"
|
|
2145
2179
|
}
|
|
2146
2180
|
]
|
|
@@ -2225,7 +2259,7 @@ ${err.stack}`);
|
|
|
2225
2259
|
message,
|
|
2226
2260
|
next: [
|
|
2227
2261
|
{
|
|
2228
|
-
command:
|
|
2262
|
+
command: redeployCommand,
|
|
2229
2263
|
when: "retry deploy"
|
|
2230
2264
|
}
|
|
2231
2265
|
]
|
|
@@ -2248,7 +2282,7 @@ ${err.stack}`);
|
|
|
2248
2282
|
message: err instanceof Error ? err.message : String(err),
|
|
2249
2283
|
next: [
|
|
2250
2284
|
{
|
|
2251
|
-
command:
|
|
2285
|
+
command: redeployCommand,
|
|
2252
2286
|
when: "retry deploy"
|
|
2253
2287
|
}
|
|
2254
2288
|
]
|
|
@@ -2283,7 +2317,7 @@ ${err.stack}`);
|
|
|
2283
2317
|
} : {},
|
|
2284
2318
|
next: anonymousLink ? [
|
|
2285
2319
|
{
|
|
2286
|
-
command:
|
|
2320
|
+
command: redeployCommand,
|
|
2287
2321
|
when: "Redeploy changes to the same anonymous deployment"
|
|
2288
2322
|
},
|
|
2289
2323
|
{
|
|
@@ -2331,32 +2365,6 @@ ${err.stack}`);
|
|
|
2331
2365
|
guidanceMode
|
|
2332
2366
|
);
|
|
2333
2367
|
}
|
|
2334
|
-
async function runImplicitBuild(client, cwd) {
|
|
2335
|
-
const projectJsonPath = join3(cwd, VERCEL_DIR, VERCEL_DIR_PROJECT);
|
|
2336
|
-
if (!await import_fs_extra3.default.pathExists(projectJsonPath)) {
|
|
2337
|
-
await import_fs_extra3.default.outputJSON(projectJsonPath, { settings: {} }, { spaces: 2 });
|
|
2338
|
-
}
|
|
2339
|
-
if (await import_fs_extra3.default.pathExists(join3(cwd, "package.json"))) {
|
|
2340
|
-
output_manager_default.log("Building your project locally\u2026");
|
|
2341
|
-
}
|
|
2342
|
-
const originalArgv = client.argv;
|
|
2343
|
-
const originalCwd = client.cwd;
|
|
2344
|
-
const originalStdout = client.stdout;
|
|
2345
|
-
client.cwd = cwd;
|
|
2346
|
-
client.setArgv([...originalArgv.slice(0, 2), "build", "--prod", "--yes"]);
|
|
2347
|
-
client.stdout = createSinkStream();
|
|
2348
|
-
try {
|
|
2349
|
-
const build = (await import("../build/index.js")).default;
|
|
2350
|
-
return await build(client);
|
|
2351
|
-
} finally {
|
|
2352
|
-
client.setArgv(originalArgv);
|
|
2353
|
-
client.cwd = originalCwd;
|
|
2354
|
-
client.stdout = originalStdout;
|
|
2355
|
-
}
|
|
2356
|
-
}
|
|
2357
|
-
function createSinkStream() {
|
|
2358
|
-
return { isTTY: false, write: () => true };
|
|
2359
|
-
}
|
|
2360
2368
|
function handleCreateDeployError(error, localConfig) {
|
|
2361
2369
|
if (error instanceof InvalidDomain) {
|
|
2362
2370
|
output_manager_default.error(`The domain ${error.meta.domain} is not valid`);
|
|
@@ -2704,7 +2712,7 @@ function shouldReconcileFinalDeployment(deployment) {
|
|
|
2704
2712
|
}
|
|
2705
2713
|
return false;
|
|
2706
2714
|
}
|
|
2707
|
-
async function handleFailedCheckRuns(client, deployment, asJson) {
|
|
2715
|
+
async function handleFailedCheckRuns(client, deployment, asJson, retryCommand = withGlobalFlags(client, "deploy")) {
|
|
2708
2716
|
const { runs } = await getDeploymentCheckRuns(client, deployment.id);
|
|
2709
2717
|
const failedRuns = (runs ?? []).filter((run) => run.conclusion === "failed");
|
|
2710
2718
|
const counters = /* @__PURE__ */ new Map();
|
|
@@ -2757,7 +2765,7 @@ async function handleFailedCheckRuns(client, deployment, asJson) {
|
|
|
2757
2765
|
failedCheckRuns: failedCheckRunsWithLogs,
|
|
2758
2766
|
next: [
|
|
2759
2767
|
{
|
|
2760
|
-
command:
|
|
2768
|
+
command: retryCommand,
|
|
2761
2769
|
when: "retry deploy after fixing check failures"
|
|
2762
2770
|
}
|
|
2763
2771
|
]
|