vercel 29.4.0 → 30.1.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/dist/index.js +1415 -702
- package/package.json +11 -10
package/dist/index.js
CHANGED
@@ -218636,8 +218636,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
218636
218636
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
218637
218637
|
};
|
218638
218638
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
218639
|
-
exports.createDeployment = exports.buildFileTree = exports.getVercelIgnore = void 0;
|
218639
|
+
exports.createDeployment = exports.buildFileTree = exports.getVercelIgnore = exports.checkDeploymentStatus = void 0;
|
218640
218640
|
const create_deployment_1 = __importDefault(__webpack_require__(36371));
|
218641
|
+
var check_deployment_status_1 = __webpack_require__(83633);
|
218642
|
+
Object.defineProperty(exports, "checkDeploymentStatus", ({ enumerable: true, get: function () { return check_deployment_status_1.checkDeploymentStatus; } }));
|
218641
218643
|
var index_1 = __webpack_require__(67110);
|
218642
218644
|
Object.defineProperty(exports, "getVercelIgnore", ({ enumerable: true, get: function () { return index_1.getVercelIgnore; } }));
|
218643
218645
|
Object.defineProperty(exports, "buildFileTree", ({ enumerable: true, get: function () { return index_1.buildFileTree; } }));
|
@@ -224852,7 +224854,9 @@ const help = () => `
|
|
224852
224854
|
ls | list [app] Lists deployments
|
224853
224855
|
login [email] Logs into your account or creates a new one
|
224854
224856
|
logout Logs out of your account
|
224857
|
+
promote [url|id] Promote an existing deployment to current
|
224855
224858
|
pull [path] Pull your Project Settings from the cloud
|
224859
|
+
redeploy [url|id] Rebuild and deploy a previous deployment.
|
224856
224860
|
rollback [url|id] Quickly revert back to a previous deployment
|
224857
224861
|
switch [scope] Switches between teams and your personal account
|
224858
224862
|
|
@@ -225793,7 +225797,7 @@ const help = () => {
|
|
225793
225797
|
`);
|
225794
225798
|
};
|
225795
225799
|
async function main(client) {
|
225796
|
-
const { output } = client;
|
225800
|
+
const { cwd, output } = client;
|
225797
225801
|
// Ensure that `vc build` is not being invoked recursively
|
225798
225802
|
if (process.env.__VERCEL_BUILD_RUNNING) {
|
225799
225803
|
output.error(`${(0, cmd_1.default)(`${cli.name} build`)} must not recursively invoke itself. Check the Build Command in the Project Settings or the ${(0, cmd_1.default)('build')} script in ${(0, cmd_1.default)('package.json')}`);
|
@@ -225814,7 +225818,6 @@ async function main(client) {
|
|
225814
225818
|
help();
|
225815
225819
|
return 2;
|
225816
225820
|
}
|
225817
|
-
const cwd = process.cwd();
|
225818
225821
|
// Build `target` influences which environment variables will be used
|
225819
225822
|
const target = argv['--prod'] ? 'production' : 'preview';
|
225820
225823
|
const yes = Boolean(argv['--yes']);
|
@@ -226946,14 +226949,13 @@ const stamp_1 = __importDefault(__webpack_require__(49079));
|
|
226946
226949
|
const create_deploy_1 = __importDefault(__webpack_require__(45303));
|
226947
226950
|
const get_deployment_1 = __importDefault(__webpack_require__(84249));
|
226948
226951
|
const parse_meta_1 = __importDefault(__webpack_require__(93983));
|
226949
|
-
const link_1 = __importDefault(__webpack_require__(39302));
|
226950
226952
|
const param_1 = __importDefault(__webpack_require__(20668));
|
226951
226953
|
const errors_ts_1 = __webpack_require__(39240);
|
226952
226954
|
const errors_1 = __webpack_require__(74148);
|
226953
226955
|
const purchase_domain_if_available_1 = __importDefault(__webpack_require__(9696));
|
226954
226956
|
const confirm_1 = __importDefault(__webpack_require__(59320));
|
226955
226957
|
const edit_project_settings_1 = __importDefault(__webpack_require__(18279));
|
226956
|
-
const
|
226958
|
+
const link_1 = __webpack_require__(49347);
|
226957
226959
|
const get_project_name_1 = __importDefault(__webpack_require__(960));
|
226958
226960
|
const select_org_1 = __importDefault(__webpack_require__(96339));
|
226959
226961
|
const input_project_1 = __importDefault(__webpack_require__(38877));
|
@@ -226961,7 +226963,6 @@ const emoji_1 = __webpack_require__(35172);
|
|
226961
226963
|
const input_root_directory_1 = __webpack_require__(70738);
|
226962
226964
|
const validate_paths_1 = __importStar(__webpack_require__(33922));
|
226963
226965
|
const pkg_name_1 = __webpack_require__(79000);
|
226964
|
-
const get_preferred_preview_url_1 = __webpack_require__(62666);
|
226965
226966
|
const args_1 = __webpack_require__(89097);
|
226966
226967
|
const get_deployment_checks_1 = __webpack_require__(10559);
|
226967
226968
|
const parse_target_1 = __importDefault(__webpack_require__(43667));
|
@@ -226971,7 +226972,7 @@ const validate_archive_format_1 = __webpack_require__(86974);
|
|
226971
226972
|
const parse_env_1 = __webpack_require__(59818);
|
226972
226973
|
const error_utils_1 = __webpack_require__(39799);
|
226973
226974
|
const project_settings_1 = __webpack_require__(61440);
|
226974
|
-
const
|
226975
|
+
const print_deployment_status_1 = __webpack_require__(27951);
|
226975
226976
|
exports.default = async (client) => {
|
226976
226977
|
const { output } = client;
|
226977
226978
|
let argv = null;
|
@@ -226990,6 +226991,7 @@ exports.default = async (client) => {
|
|
226990
226991
|
'--prod': Boolean,
|
226991
226992
|
'--archive': String,
|
226992
226993
|
'--no-wait': Boolean,
|
226994
|
+
'--skip-domain': Boolean,
|
226993
226995
|
'--yes': Boolean,
|
226994
226996
|
'-f': '--force',
|
226995
226997
|
'-p': '--public',
|
@@ -227025,21 +227027,17 @@ exports.default = async (client) => {
|
|
227025
227027
|
if (argv._.length > 0) {
|
227026
227028
|
// If path is relative: resolve
|
227027
227029
|
// if path is absolute: clear up strange `/` etc
|
227028
|
-
paths = argv._.map(item => (0, path_1.resolve)(
|
227030
|
+
paths = argv._.map(item => (0, path_1.resolve)(client.cwd, item));
|
227029
227031
|
}
|
227030
227032
|
else {
|
227031
|
-
paths = [
|
227033
|
+
paths = [client.cwd];
|
227032
227034
|
}
|
227033
|
-
|
227034
|
-
|
227035
|
-
|
227036
|
-
|
227037
|
-
}
|
227038
|
-
catch (err) {
|
227039
|
-
output.error(`The specified file or directory "${(0, path_1.basename)(path)}" does not exist.`);
|
227040
|
-
return 1;
|
227041
|
-
}
|
227035
|
+
// check paths
|
227036
|
+
const pathValidation = await (0, validate_paths_1.default)(client, paths);
|
227037
|
+
if (!pathValidation.valid) {
|
227038
|
+
return pathValidation.exitCode;
|
227042
227039
|
}
|
227040
|
+
let localConfig = client.localConfig || (0, files_1.readLocalConfig)(paths[0]);
|
227043
227041
|
if (localConfig) {
|
227044
227042
|
const { version } = localConfig;
|
227045
227043
|
const file = (0, highlight_1.default)(localConfig[client_1.fileNameSymbol]);
|
@@ -227060,12 +227058,7 @@ exports.default = async (client) => {
|
|
227060
227058
|
}
|
227061
227059
|
const { log, debug, error, prettyError } = output;
|
227062
227060
|
const quiet = !client.stdout.isTTY;
|
227063
|
-
|
227064
|
-
const pathValidation = await (0, validate_paths_1.default)(client, paths);
|
227065
|
-
if (!pathValidation.valid) {
|
227066
|
-
return pathValidation.exitCode;
|
227067
|
-
}
|
227068
|
-
const { path } = pathValidation;
|
227061
|
+
let { path: cwd } = pathValidation;
|
227069
227062
|
const autoConfirm = argv['--yes'];
|
227070
227063
|
// deprecate --name
|
227071
227064
|
if (argv['--name']) {
|
@@ -227081,12 +227074,12 @@ exports.default = async (client) => {
|
|
227081
227074
|
}
|
227082
227075
|
// build `--prebuilt`
|
227083
227076
|
if (argv['--prebuilt']) {
|
227084
|
-
const prebuiltExists = await fs_extra_1.default.pathExists((0, path_1.join)(
|
227077
|
+
const prebuiltExists = await fs_extra_1.default.pathExists((0, path_1.join)(cwd, '.vercel/output'));
|
227085
227078
|
if (!prebuiltExists) {
|
227086
227079
|
error(`The ${(0, param_1.default)('--prebuilt')} option was used, but no prebuilt output found in ".vercel/output". Run ${(0, pkg_name_1.getCommandName)('build')} to generate a local build.`);
|
227087
227080
|
return 1;
|
227088
227081
|
}
|
227089
|
-
const prebuiltBuild = await (0, get_prebuilt_json_1.default)(
|
227082
|
+
const prebuiltBuild = await (0, get_prebuilt_json_1.default)(cwd);
|
227090
227083
|
// Ensure that there was not a build error
|
227091
227084
|
const prebuiltError = prebuiltBuild?.error ||
|
227092
227085
|
prebuiltBuild?.builds?.find(build => 'error' in build)?.error;
|
@@ -227115,7 +227108,7 @@ exports.default = async (client) => {
|
|
227115
227108
|
return 1;
|
227116
227109
|
}
|
227117
227110
|
// retrieve `project` and `org` from .vercel
|
227118
|
-
const link = await (0,
|
227111
|
+
const link = await (0, link_1.getLinkedProject)(client, cwd);
|
227119
227112
|
if (link.status === 'error') {
|
227120
227113
|
return link.exitCode;
|
227121
227114
|
}
|
@@ -227125,7 +227118,7 @@ exports.default = async (client) => {
|
|
227125
227118
|
let sourceFilesOutsideRootDirectory = true;
|
227126
227119
|
if (status === 'not_linked') {
|
227127
227120
|
const shouldStartSetup = autoConfirm ||
|
227128
|
-
(await (0, confirm_1.default)(client, `Set up and deploy ${chalk_1.default.cyan(`“${(0, humanize_path_1.default)(
|
227121
|
+
(await (0, confirm_1.default)(client, `Set up and deploy ${chalk_1.default.cyan(`“${(0, humanize_path_1.default)(cwd)}”`)}?`, true));
|
227129
227122
|
if (!shouldStartSetup) {
|
227130
227123
|
output.print(`Canceled. Project not set up.\n`);
|
227131
227124
|
return 0;
|
@@ -227154,20 +227147,24 @@ exports.default = async (client) => {
|
|
227154
227147
|
const projectOrNewProjectName = await (0, input_project_1.default)(client, org, detectedProjectName, autoConfirm);
|
227155
227148
|
if (typeof projectOrNewProjectName === 'string') {
|
227156
227149
|
newProjectName = projectOrNewProjectName;
|
227157
|
-
rootDirectory = await (0, input_root_directory_1.inputRootDirectory)(client,
|
227150
|
+
rootDirectory = await (0, input_root_directory_1.inputRootDirectory)(client, cwd, autoConfirm);
|
227158
227151
|
}
|
227159
227152
|
else {
|
227160
227153
|
project = projectOrNewProjectName;
|
227161
227154
|
rootDirectory = project.rootDirectory;
|
227162
227155
|
sourceFilesOutsideRootDirectory = project.sourceFilesOutsideRootDirectory;
|
227163
227156
|
// we can already link the project
|
227164
|
-
await (0,
|
227157
|
+
await (0, link_1.linkFolderToProject)(client, cwd, {
|
227165
227158
|
projectId: project.id,
|
227166
227159
|
orgId: org.id,
|
227167
227160
|
}, project.name, org.slug);
|
227168
227161
|
status = 'linked';
|
227169
227162
|
}
|
227170
227163
|
}
|
227164
|
+
// For repo-style linking, reset the path to the root of the repository
|
227165
|
+
if (link.status === 'linked' && link.repoRoot) {
|
227166
|
+
cwd = link.repoRoot;
|
227167
|
+
}
|
227171
227168
|
// At this point `org` should be populated
|
227172
227169
|
if (!org) {
|
227173
227170
|
throw new Error(`"org" is not defined`);
|
@@ -227179,10 +227176,10 @@ exports.default = async (client) => {
|
|
227179
227176
|
// if we have `sourceFilesOutsideRootDirectory` set to `true`, we use the current path
|
227180
227177
|
// and upload the entire directory.
|
227181
227178
|
const sourcePath = rootDirectory && !sourceFilesOutsideRootDirectory
|
227182
|
-
? (0, path_1.join)(
|
227183
|
-
:
|
227179
|
+
? (0, path_1.join)(cwd, rootDirectory)
|
227180
|
+
: cwd;
|
227184
227181
|
if (rootDirectory &&
|
227185
|
-
(await (0, validate_paths_1.validateRootDirectory)(output,
|
227182
|
+
(await (0, validate_paths_1.validateRootDirectory)(output, cwd, sourcePath, project
|
227186
227183
|
? `To change your Project Settings, go to https://vercel.com/${org?.slug}/${project.name}/settings`
|
227187
227184
|
: '')) === false) {
|
227188
227185
|
return 1;
|
@@ -227190,7 +227187,7 @@ exports.default = async (client) => {
|
|
227190
227187
|
// If Root Directory is used we'll try to read the config
|
227191
227188
|
// from there instead and use it if it exists.
|
227192
227189
|
if (rootDirectory) {
|
227193
|
-
const rootDirectoryConfig = (0, files_1.readLocalConfig)((0, path_1.join)(
|
227190
|
+
const rootDirectoryConfig = (0, files_1.readLocalConfig)((0, path_1.join)(cwd, rootDirectory));
|
227194
227191
|
if (rootDirectoryConfig) {
|
227195
227192
|
debug(`Read local config from root directory (${rootDirectory})`);
|
227196
227193
|
localConfig = rootDirectoryConfig;
|
@@ -227225,7 +227222,7 @@ exports.default = async (client) => {
|
|
227225
227222
|
}
|
227226
227223
|
// build `meta`
|
227227
227224
|
const meta = Object.assign({}, (0, parse_meta_1.default)(localConfig.meta), (0, parse_meta_1.default)(argv['--meta']));
|
227228
|
-
const gitMetadata = await (0, create_git_meta_1.createGitMeta)(
|
227225
|
+
const gitMetadata = await (0, create_git_meta_1.createGitMeta)(cwd, output, project);
|
227229
227226
|
// Merge dotenv config, `env` from vercel.json, and `--env` / `-e` arguments
|
227230
227227
|
const deploymentEnv = Object.assign({}, (0, parse_env_1.parseEnv)(localConfig.env), (0, parse_env_1.parseEnv)(argv['--env']));
|
227231
227228
|
// Merge build env out of `build.env` from vercel.json, and `--build-env` args
|
@@ -227259,6 +227256,7 @@ exports.default = async (client) => {
|
|
227259
227256
|
throw new Error('`name` not found on project or provided by existing project');
|
227260
227257
|
}
|
227261
227258
|
try {
|
227259
|
+
const autoAssignCustomDomains = !argv['--skip-domain'];
|
227262
227260
|
const createArgs = {
|
227263
227261
|
name,
|
227264
227262
|
env: deploymentEnv,
|
@@ -227282,6 +227280,7 @@ exports.default = async (client) => {
|
|
227282
227280
|
target,
|
227283
227281
|
skipAutoDetectionConfirmation: autoConfirm,
|
227284
227282
|
noWait,
|
227283
|
+
autoAssignCustomDomains,
|
227285
227284
|
};
|
227286
227285
|
if (!localConfig.builds || localConfig.builds.length === 0) {
|
227287
227286
|
// Only add projectSettings for zero config deployments
|
@@ -227292,7 +227291,7 @@ exports.default = async (client) => {
|
|
227292
227291
|
}
|
227293
227292
|
: { ...localConfigurationOverrides, sourceFilesOutsideRootDirectory };
|
227294
227293
|
}
|
227295
|
-
deployment = await (0, create_deploy_1.default)(client, now, contextName,
|
227294
|
+
deployment = await (0, create_deploy_1.default)(client, now, contextName, sourcePath, createArgs, org, !project, cwd, archive);
|
227296
227295
|
if (deployment.code === 'missing_project_settings') {
|
227297
227296
|
let { projectSettings, framework } = deployment;
|
227298
227297
|
if (rootDirectory) {
|
@@ -227307,7 +227306,7 @@ exports.default = async (client) => {
|
|
227307
227306
|
createArgs.projectSettings = settings;
|
227308
227307
|
deployStamp = (0, stamp_1.default)();
|
227309
227308
|
createArgs.deployStamp = deployStamp;
|
227310
|
-
deployment = await (0, create_deploy_1.default)(client, now, contextName,
|
227309
|
+
deployment = await (0, create_deploy_1.default)(client, now, contextName, sourcePath, createArgs, org, false, cwd);
|
227311
227310
|
}
|
227312
227311
|
if (deployment instanceof errors_ts_1.NotDomainOwner) {
|
227313
227312
|
output.error(deployment.message);
|
@@ -227398,7 +227397,7 @@ exports.default = async (client) => {
|
|
227398
227397
|
(0, error_1.handleError)(err);
|
227399
227398
|
return 1;
|
227400
227399
|
}
|
227401
|
-
return
|
227400
|
+
return (0, print_deployment_status_1.printDeploymentStatus)(client, deployment, deployStamp, noWait);
|
227402
227401
|
};
|
227403
227402
|
function handleCreateDeployError(output, error, localConfig) {
|
227404
227403
|
if (error instanceof errors_ts_1.InvalidDomain) {
|
@@ -227464,62 +227463,6 @@ const addProcessEnv = async (log, env) => {
|
|
227464
227463
|
}
|
227465
227464
|
}
|
227466
227465
|
};
|
227467
|
-
const printDeploymentStatus = async (output, client, { readyState, alias: aliasList, aliasError, target, indications, url: deploymentUrl, aliasWarning, }, deployStamp, noWait) => {
|
227468
|
-
indications = indications || [];
|
227469
|
-
const isProdDeployment = target === 'production';
|
227470
|
-
let isStillBuilding = false;
|
227471
|
-
if (noWait) {
|
227472
|
-
if ((0, is_deploying_1.isDeploying)(readyState)) {
|
227473
|
-
isStillBuilding = true;
|
227474
|
-
output.print((0, emoji_1.prependEmoji)('Note: Deployment is still processing...', (0, emoji_1.emoji)('notice')) + '\n');
|
227475
|
-
}
|
227476
|
-
}
|
227477
|
-
if (!isStillBuilding && readyState !== 'READY') {
|
227478
|
-
output.error(`Your deployment failed. Please retry later. More: https://err.sh/vercel/deployment-error`);
|
227479
|
-
return 1;
|
227480
|
-
}
|
227481
|
-
if (aliasError) {
|
227482
|
-
output.warn(`Failed to assign aliases${aliasError.message ? `: ${aliasError.message}` : ''}`);
|
227483
|
-
}
|
227484
|
-
else {
|
227485
|
-
// print preview/production url
|
227486
|
-
let previewUrl;
|
227487
|
-
// if `noWait` is true, then use the deployment url, not an alias
|
227488
|
-
if (!noWait && Array.isArray(aliasList) && aliasList.length > 0) {
|
227489
|
-
const previewUrlInfo = await (0, get_preferred_preview_url_1.getPreferredPreviewURL)(client, aliasList);
|
227490
|
-
if (previewUrlInfo) {
|
227491
|
-
previewUrl = previewUrlInfo.previewUrl;
|
227492
|
-
}
|
227493
|
-
else {
|
227494
|
-
previewUrl = `https://${deploymentUrl}`;
|
227495
|
-
}
|
227496
|
-
}
|
227497
|
-
else {
|
227498
|
-
// fallback to deployment url
|
227499
|
-
previewUrl = `https://${deploymentUrl}`;
|
227500
|
-
}
|
227501
|
-
output.print((0, emoji_1.prependEmoji)(`${isProdDeployment ? 'Production' : 'Preview'}: ${chalk_1.default.bold(previewUrl)} ${deployStamp()}`, (0, emoji_1.emoji)('success')) + `\n`);
|
227502
|
-
}
|
227503
|
-
if (aliasWarning?.message) {
|
227504
|
-
indications.push({
|
227505
|
-
type: 'warning',
|
227506
|
-
payload: aliasWarning.message,
|
227507
|
-
link: aliasWarning.link,
|
227508
|
-
action: aliasWarning.action,
|
227509
|
-
});
|
227510
|
-
}
|
227511
|
-
const newline = '\n';
|
227512
|
-
for (let indication of indications) {
|
227513
|
-
const message = (0, emoji_1.prependEmoji)(chalk_1.default.dim(indication.payload), (0, emoji_1.emoji)(indication.type)) +
|
227514
|
-
newline;
|
227515
|
-
let link = '';
|
227516
|
-
if (indication.link)
|
227517
|
-
link =
|
227518
|
-
chalk_1.default.dim(`${indication.action || 'Learn More'}: ${(0, link_1.default)(indication.link)}`) + newline;
|
227519
|
-
output.print(message + link);
|
227520
|
-
}
|
227521
|
-
return 0;
|
227522
|
-
};
|
227523
227466
|
|
227524
227467
|
|
227525
227468
|
/***/ }),
|
@@ -229312,7 +229255,7 @@ const help = () => {
|
|
229312
229255
|
ls [environment] [gitbranch] List all variables for the specified Environment
|
229313
229256
|
add [name] [environment] [gitbranch] Add an Environment Variable (see examples below)
|
229314
229257
|
rm [name] [environment] [gitbranch] Remove an Environment Variable (see examples below)
|
229315
|
-
pull [filename] Pull all Development Environment Variables from the cloud and write to a file [.env]
|
229258
|
+
pull [filename] Pull all Development Environment Variables from the cloud and write to a file [.env.local]
|
229316
229259
|
|
229317
229260
|
${chalk_1.default.dim('Options:')}
|
229318
229261
|
|
@@ -229394,10 +229337,9 @@ async function main(client) {
|
|
229394
229337
|
help();
|
229395
229338
|
return 2;
|
229396
229339
|
}
|
229397
|
-
const cwd = argv['--cwd'] || process.cwd();
|
229398
229340
|
const subArgs = argv._.slice(1);
|
229399
229341
|
const { subcommand, args } = (0, get_subcommand_1.default)(subArgs, COMMAND_CONFIG);
|
229400
|
-
const { output, config } = client;
|
229342
|
+
const { cwd, output, config } = client;
|
229401
229343
|
const target = argv['--environment']?.toLowerCase() || 'development';
|
229402
229344
|
if (!(0, env_target_1.isValidEnvTarget)(target)) {
|
229403
229345
|
output.error(`Invalid environment \`${chalk_1.default.cyan(target)}\`. Valid options: ${(0, env_target_1.getEnvTargetPlaceholder)()}`);
|
@@ -229565,7 +229507,7 @@ async function pull(client, project, environment, opts, args, output, cwd, sourc
|
|
229565
229507
|
return 1;
|
229566
229508
|
}
|
229567
229509
|
// handle relative or absolute filename
|
229568
|
-
const [filename = '.env'] = args;
|
229510
|
+
const [filename = '.env.local'] = args;
|
229569
229511
|
const fullPath = (0, path_1.resolve)(cwd, filename);
|
229570
229512
|
const skipConfirmation = opts['--yes'];
|
229571
229513
|
const gitBranch = opts['--git-branch'];
|
@@ -229738,9 +229680,8 @@ const list_1 = __importDefault(__webpack_require__(48778));
|
|
229738
229680
|
const link_1 = __importDefault(__webpack_require__(39302));
|
229739
229681
|
const pkg_name_1 = __webpack_require__(79000);
|
229740
229682
|
const connect_git_provider_1 = __webpack_require__(82748);
|
229741
|
-
const validate_paths_1 = __importDefault(__webpack_require__(33922));
|
229742
229683
|
async function connect(client, argv, args, project, org) {
|
229743
|
-
const { output } = client;
|
229684
|
+
const { cwd, output } = client;
|
229744
229685
|
const confirm = Boolean(argv['--yes']);
|
229745
229686
|
const repoArg = argv._[1];
|
229746
229687
|
if (args.length > 1) {
|
@@ -229751,16 +229692,10 @@ async function connect(client, argv, args, project, org) {
|
|
229751
229692
|
output.error(`Can't find \`org\` or \`project\`. Make sure your current directory is linked to a Vercel project by running ${(0, pkg_name_1.getCommandName)('link')}.`);
|
229752
229693
|
return 1;
|
229753
229694
|
}
|
229754
|
-
let paths = [process.cwd()];
|
229755
|
-
const validate = await (0, validate_paths_1.default)(client, paths);
|
229756
|
-
if (!validate.valid) {
|
229757
|
-
return validate.exitCode;
|
229758
|
-
}
|
229759
|
-
const { path } = validate;
|
229760
229695
|
const gitProviderLink = project.link;
|
229761
229696
|
client.config.currentTeam = org.type === 'team' ? org.id : undefined;
|
229762
229697
|
// get project from .git
|
229763
|
-
const gitConfigPath = (0, path_1.join)(
|
229698
|
+
const gitConfigPath = (0, path_1.join)(cwd, '.git/config');
|
229764
229699
|
const gitConfig = await (0, create_git_meta_1.parseGitConfig)(gitConfigPath, output);
|
229765
229700
|
if (repoArg) {
|
229766
229701
|
// parse repo arg
|
@@ -229784,7 +229719,7 @@ async function connect(client, argv, args, project, org) {
|
|
229784
229719
|
confirm,
|
229785
229720
|
org,
|
229786
229721
|
project,
|
229787
|
-
repoInfo:
|
229722
|
+
repoInfo: parsedUrlArg,
|
229788
229723
|
});
|
229789
229724
|
}
|
229790
229725
|
if (!gitConfig) {
|
@@ -230045,7 +229980,6 @@ const get_invalid_subcommand_1 = __importDefault(__webpack_require__(6479));
|
|
230045
229980
|
const handle_error_1 = __importDefault(__webpack_require__(64377));
|
230046
229981
|
const logo_1 = __importDefault(__webpack_require__(66669));
|
230047
229982
|
const pkg_name_1 = __webpack_require__(79000);
|
230048
|
-
const validate_paths_1 = __importDefault(__webpack_require__(33922));
|
230049
229983
|
const connect_1 = __importDefault(__webpack_require__(44813));
|
230050
229984
|
const disconnect_1 = __importDefault(__webpack_require__(47108));
|
230051
229985
|
const help = () => {
|
@@ -230106,14 +230040,8 @@ async function main(client) {
|
|
230106
230040
|
subcommand = argv._[0];
|
230107
230041
|
const args = argv._.slice(1);
|
230108
230042
|
const autoConfirm = Boolean(argv['--yes']);
|
230109
|
-
const { output } = client;
|
230110
|
-
|
230111
|
-
const pathValidation = await (0, validate_paths_1.default)(client, paths);
|
230112
|
-
if (!pathValidation.valid) {
|
230113
|
-
return pathValidation.exitCode;
|
230114
|
-
}
|
230115
|
-
const { path } = pathValidation;
|
230116
|
-
const linkedProject = await (0, ensure_link_1.ensureLink)('git', client, path, { autoConfirm });
|
230043
|
+
const { cwd, output } = client;
|
230044
|
+
const linkedProject = await (0, ensure_link_1.ensureLink)('git', client, cwd, { autoConfirm });
|
230117
230045
|
if (typeof linkedProject === 'number') {
|
230118
230046
|
return linkedProject;
|
230119
230047
|
}
|
@@ -230169,7 +230097,9 @@ exports.default = new Map([
|
|
230169
230097
|
['ls', 'list'],
|
230170
230098
|
['project', 'project'],
|
230171
230099
|
['projects', 'project'],
|
230100
|
+
['promote', 'promote'],
|
230172
230101
|
['pull', 'pull'],
|
230102
|
+
['redeploy', 'redeploy'],
|
230173
230103
|
['remove', 'remove'],
|
230174
230104
|
['rm', 'remove'],
|
230175
230105
|
['rollback', 'rollback'],
|
@@ -230706,7 +230636,7 @@ async function main(client) {
|
|
230706
230636
|
client.output.warn(`The ${(0, cmd_1.default)('vc link <directory>')} syntax is deprecated, please use ${(0, cmd_1.default)(`vc link --cwd ${cwd}`)} instead`);
|
230707
230637
|
}
|
230708
230638
|
else {
|
230709
|
-
cwd =
|
230639
|
+
cwd = client.cwd;
|
230710
230640
|
}
|
230711
230641
|
if (argv['--repo']) {
|
230712
230642
|
client.output.warn(`The ${(0, cmd_1.default)('--repo')} flag is in alpha, please report issues`);
|
@@ -230755,7 +230685,6 @@ const parse_meta_1 = __importDefault(__webpack_require__(93983));
|
|
230755
230685
|
const is_valid_name_1 = __webpack_require__(64476);
|
230756
230686
|
const get_command_flags_1 = __importDefault(__webpack_require__(98395));
|
230757
230687
|
const pkg_name_1 = __webpack_require__(79000);
|
230758
|
-
const validate_paths_1 = __importDefault(__webpack_require__(33922));
|
230759
230688
|
const link_1 = __webpack_require__(49347);
|
230760
230689
|
const ensure_link_1 = __webpack_require__(65382);
|
230761
230690
|
const get_scope_1 = __importDefault(__webpack_require__(60324));
|
@@ -230818,7 +230747,7 @@ async function main(client) {
|
|
230818
230747
|
(0, error_1.handleError)(err);
|
230819
230748
|
return 1;
|
230820
230749
|
}
|
230821
|
-
const { output, config } = client;
|
230750
|
+
const { cwd, output, config } = client;
|
230822
230751
|
if ('--confirm' in argv) {
|
230823
230752
|
output.warn('`--confirm` is deprecated, please use `--yes` instead');
|
230824
230753
|
argv['--yes'] = argv['--confirm'];
|
@@ -230835,14 +230764,8 @@ async function main(client) {
|
|
230835
230764
|
const autoConfirm = !!argv['--yes'];
|
230836
230765
|
const prod = argv['--prod'] || false;
|
230837
230766
|
const meta = (0, parse_meta_1.default)(argv['--meta']);
|
230838
|
-
let paths = [process.cwd()];
|
230839
|
-
const pathValidation = await (0, validate_paths_1.default)(client, paths);
|
230840
|
-
if (!pathValidation.valid) {
|
230841
|
-
return pathValidation.exitCode;
|
230842
|
-
}
|
230843
|
-
const { path } = pathValidation;
|
230844
230767
|
// retrieve `project` and `org` from .vercel
|
230845
|
-
let link = await (0, link_1.getLinkedProject)(client,
|
230768
|
+
let link = await (0, link_1.getLinkedProject)(client, cwd);
|
230846
230769
|
if (link.status === 'error') {
|
230847
230770
|
return link.exitCode;
|
230848
230771
|
}
|
@@ -230857,7 +230780,7 @@ async function main(client) {
|
|
230857
230780
|
// If there's no linked project and user doesn't pass `app` arg,
|
230858
230781
|
// prompt to link their current directory.
|
230859
230782
|
if (status === 'not_linked' && !app) {
|
230860
|
-
const linkedProject = await (0, ensure_link_1.ensureLink)('list', client,
|
230783
|
+
const linkedProject = await (0, ensure_link_1.ensureLink)('list', client, cwd, {
|
230861
230784
|
autoConfirm,
|
230862
230785
|
link,
|
230863
230786
|
});
|
@@ -231815,7 +231738,7 @@ async function readConfirmation(client, projectName) {
|
|
231815
231738
|
|
231816
231739
|
/***/ }),
|
231817
231740
|
|
231818
|
-
/***/
|
231741
|
+
/***/ 62435:
|
231819
231742
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
231820
231743
|
|
231821
231744
|
"use strict";
|
@@ -231824,108 +231747,169 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
231824
231747
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
231825
231748
|
};
|
231826
231749
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
231827
|
-
exports.parseEnvironment = void 0;
|
231828
231750
|
const chalk_1 = __importDefault(__webpack_require__(90877));
|
231829
|
-
const path_1 = __webpack_require__(85622);
|
231830
|
-
const emoji_1 = __webpack_require__(35172);
|
231831
231751
|
const get_args_1 = __importDefault(__webpack_require__(2505));
|
231832
|
-
const
|
231833
|
-
const stamp_1 = __importDefault(__webpack_require__(49079));
|
231752
|
+
const get_project_by_cwd_or_link_1 = __importDefault(__webpack_require__(90675));
|
231834
231753
|
const pkg_name_1 = __webpack_require__(79000);
|
231835
|
-
const
|
231836
|
-
const
|
231837
|
-
const
|
231838
|
-
const
|
231839
|
-
const
|
231754
|
+
const handle_error_1 = __importDefault(__webpack_require__(64377));
|
231755
|
+
const error_utils_1 = __webpack_require__(39799);
|
231756
|
+
const logo_1 = __importDefault(__webpack_require__(66669));
|
231757
|
+
const ms_1 = __importDefault(__webpack_require__(21378));
|
231758
|
+
const request_promote_1 = __importDefault(__webpack_require__(73455));
|
231759
|
+
const status_1 = __importDefault(__webpack_require__(48821));
|
231840
231760
|
const help = () => {
|
231841
|
-
|
231842
|
-
${chalk_1.default.bold(`${logo_1.default} ${(0, pkg_name_1.getPkgName)()}
|
231761
|
+
console.log(`
|
231762
|
+
${chalk_1.default.bold(`${logo_1.default} ${(0, pkg_name_1.getPkgName)()} promote`)} [deployment id/url]
|
231843
231763
|
|
231844
|
-
|
231764
|
+
Promote an existing deployment to current.
|
231765
|
+
|
231766
|
+
${chalk_1.default.dim('Options:')}
|
231845
231767
|
|
231846
231768
|
-h, --help Output usage information
|
231847
231769
|
-A ${chalk_1.default.bold.underline('FILE')}, --local-config=${chalk_1.default.bold.underline('FILE')} Path to the local ${'`vercel.json`'} file
|
231848
231770
|
-Q ${chalk_1.default.bold.underline('DIR')}, --global-config=${chalk_1.default.bold.underline('DIR')} Path to the global ${'`.vercel`'} directory
|
231849
231771
|
-d, --debug Debug mode [off]
|
231850
231772
|
--no-color No color mode [off]
|
231851
|
-
|
231773
|
+
-t ${chalk_1.default.bold.underline('TOKEN')}, --token=${chalk_1.default.bold.underline('TOKEN')} Login token
|
231774
|
+
--timeout=${chalk_1.default.bold.underline('TIME')} Time to wait for promotion completion [3m]
|
231852
231775
|
-y, --yes Skip questions when setting up new project using default scope and settings
|
231853
231776
|
|
231854
231777
|
${chalk_1.default.dim('Examples:')}
|
231855
231778
|
|
231856
|
-
${chalk_1.default.gray('–')}
|
231857
|
-
and stores them in \`.vercel/.env.\${target}.local\` and \`.vercel/project.json\` respectively.
|
231858
|
-
|
231859
|
-
${chalk_1.default.cyan(`$ ${(0, pkg_name_1.getPkgName)()} pull`)}
|
231860
|
-
${chalk_1.default.cyan(`$ ${(0, pkg_name_1.getPkgName)()} pull ./path-to-project`)}
|
231779
|
+
${chalk_1.default.gray('–')} Show the status of any current pending promotions
|
231861
231780
|
|
231862
|
-
|
231781
|
+
${chalk_1.default.cyan(`$ ${(0, pkg_name_1.getPkgName)()} promote`)}
|
231782
|
+
${chalk_1.default.cyan(`$ ${(0, pkg_name_1.getPkgName)()} promote status`)}
|
231783
|
+
${chalk_1.default.cyan(`$ ${(0, pkg_name_1.getPkgName)()} promote status <project>`)}
|
231784
|
+
${chalk_1.default.cyan(`$ ${(0, pkg_name_1.getPkgName)()} promote status --timeout 30s`)}
|
231863
231785
|
|
231864
|
-
|
231786
|
+
${chalk_1.default.gray('–')} Promote a deployment using id or url
|
231865
231787
|
|
231866
|
-
|
231788
|
+
${chalk_1.default.cyan(`$ ${(0, pkg_name_1.getPkgName)()} promote <deployment id/url>`)}
|
231867
231789
|
`);
|
231868
231790
|
};
|
231869
|
-
|
231870
|
-
|
231871
|
-
|
231872
|
-
|
231873
|
-
|
231874
|
-
|
231875
|
-
|
231876
|
-
|
231877
|
-
|
231878
|
-
|
231879
|
-
|
231880
|
-
|
231881
|
-
|
231791
|
+
/**
|
231792
|
+
* `vc promote` command
|
231793
|
+
* @param {Client} client
|
231794
|
+
* @returns {Promise<number>} Resolves an exit code; 0 on success
|
231795
|
+
*/
|
231796
|
+
exports.default = async (client) => {
|
231797
|
+
let argv;
|
231798
|
+
try {
|
231799
|
+
argv = (0, get_args_1.default)(client.argv.slice(2), {
|
231800
|
+
'--timeout': String,
|
231801
|
+
'--yes': Boolean,
|
231802
|
+
'-y': '--yes',
|
231803
|
+
});
|
231804
|
+
}
|
231805
|
+
catch (err) {
|
231806
|
+
(0, handle_error_1.default)(err);
|
231807
|
+
return 1;
|
231808
|
+
}
|
231809
|
+
if (argv['--help'] || argv._[0] === 'help') {
|
231882
231810
|
help();
|
231883
231811
|
return 2;
|
231884
231812
|
}
|
231885
|
-
|
231886
|
-
|
231887
|
-
|
231888
|
-
|
231889
|
-
|
231890
|
-
}
|
231891
|
-
function parseEnvironment(environment = 'development') {
|
231892
|
-
if (!(0, env_target_1.isValidEnvTarget)(environment)) {
|
231893
|
-
throw new Error(`environment "${environment}" not supported; must be one of ${(0, env_target_1.getEnvTargetPlaceholder)()}`);
|
231813
|
+
// validate the timeout
|
231814
|
+
let timeout = argv['--timeout'];
|
231815
|
+
if (timeout && (0, ms_1.default)(timeout) === undefined) {
|
231816
|
+
client.output.error(`Invalid timeout "${timeout}"`);
|
231817
|
+
return 1;
|
231894
231818
|
}
|
231895
|
-
|
231896
|
-
|
231897
|
-
|
231898
|
-
|
231899
|
-
|
231900
|
-
|
231901
|
-
|
231819
|
+
const actionOrDeployId = argv._[1] || 'status';
|
231820
|
+
try {
|
231821
|
+
if (actionOrDeployId === 'status') {
|
231822
|
+
const project = await (0, get_project_by_cwd_or_link_1.default)({
|
231823
|
+
autoConfirm: Boolean(argv['--yes']),
|
231824
|
+
client,
|
231825
|
+
commandName: 'promote',
|
231826
|
+
cwd: client.cwd,
|
231827
|
+
projectNameOrId: argv._[2],
|
231828
|
+
});
|
231829
|
+
return await (0, status_1.default)({
|
231830
|
+
client,
|
231831
|
+
project,
|
231832
|
+
timeout,
|
231833
|
+
});
|
231834
|
+
}
|
231835
|
+
return await (0, request_promote_1.default)({
|
231836
|
+
client,
|
231837
|
+
deployId: actionOrDeployId,
|
231838
|
+
timeout,
|
231839
|
+
});
|
231902
231840
|
}
|
231903
|
-
|
231904
|
-
|
231905
|
-
|
231906
|
-
|
231907
|
-
|
231908
|
-
|
231841
|
+
catch (err) {
|
231842
|
+
if ((0, error_utils_1.isErrnoException)(err)) {
|
231843
|
+
if (err.code === 'ERR_CANCELED') {
|
231844
|
+
return 0;
|
231845
|
+
}
|
231846
|
+
if (err.code === 'ERR_INVALID_CWD' || err.code === 'ERR_LINK_PROJECT') {
|
231847
|
+
// do not show the message
|
231848
|
+
return 1;
|
231849
|
+
}
|
231850
|
+
}
|
231851
|
+
client.output.prettyError(err);
|
231852
|
+
return 1;
|
231909
231853
|
}
|
231910
|
-
|
231911
|
-
|
231912
|
-
|
231913
|
-
|
231914
|
-
|
231854
|
+
};
|
231855
|
+
|
231856
|
+
|
231857
|
+
/***/ }),
|
231858
|
+
|
231859
|
+
/***/ 73455:
|
231860
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
231861
|
+
|
231862
|
+
"use strict";
|
231863
|
+
|
231864
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
231865
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
231866
|
+
};
|
231867
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
231868
|
+
const chalk_1 = __importDefault(__webpack_require__(90877));
|
231869
|
+
const pkg_name_1 = __webpack_require__(79000);
|
231870
|
+
const get_project_by_deployment_1 = __importDefault(__webpack_require__(67231));
|
231871
|
+
const ms_1 = __importDefault(__webpack_require__(21378));
|
231872
|
+
const status_1 = __importDefault(__webpack_require__(48821));
|
231873
|
+
/**
|
231874
|
+
* Requests a promotion and waits for it complete.
|
231875
|
+
* @param {Client} client - The Vercel client instance
|
231876
|
+
* @param {string} deployId - The deployment name or id to promote
|
231877
|
+
* @param {string} [timeout] - Time to poll for succeeded/failed state
|
231878
|
+
* @returns {Promise<number>} Resolves an exit code; 0 on success
|
231879
|
+
*/
|
231880
|
+
async function requestPromote({ client, deployId, timeout, }) {
|
231881
|
+
const { output } = client;
|
231882
|
+
const { contextName, deployment, project } = await (0, get_project_by_deployment_1.default)({
|
231883
|
+
client,
|
231884
|
+
deployId,
|
231885
|
+
output: client.output,
|
231886
|
+
});
|
231887
|
+
// request the promotion
|
231888
|
+
await client.fetch(`/v9/projects/${project.id}/promote/${deployment.id}`, {
|
231889
|
+
body: {},
|
231890
|
+
json: false,
|
231891
|
+
method: 'POST',
|
231892
|
+
});
|
231893
|
+
if (timeout !== undefined && (0, ms_1.default)(timeout) === 0) {
|
231894
|
+
output.log(`Successfully requested promote of ${chalk_1.default.bold(project.name)} to ${deployment.url} (${deployment.id})`);
|
231895
|
+
output.log(`To check promote status, run ${(0, pkg_name_1.getCommandName)('promote')}.`);
|
231896
|
+
return 0;
|
231915
231897
|
}
|
231916
|
-
|
231917
|
-
|
231918
|
-
|
231919
|
-
|
231920
|
-
|
231921
|
-
|
231898
|
+
// check the status
|
231899
|
+
return await (0, status_1.default)({
|
231900
|
+
client,
|
231901
|
+
contextName,
|
231902
|
+
deployment,
|
231903
|
+
project,
|
231904
|
+
timeout,
|
231905
|
+
});
|
231922
231906
|
}
|
231923
|
-
exports.default =
|
231907
|
+
exports.default = requestPromote;
|
231924
231908
|
|
231925
231909
|
|
231926
231910
|
/***/ }),
|
231927
231911
|
|
231928
|
-
/***/
|
231912
|
+
/***/ 48821:
|
231929
231913
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
231930
231914
|
|
231931
231915
|
"use strict";
|
@@ -231935,9 +231919,461 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
231935
231919
|
};
|
231936
231920
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
231937
231921
|
const chalk_1 = __importDefault(__webpack_require__(90877));
|
231938
|
-
const
|
231939
|
-
const
|
231940
|
-
const
|
231922
|
+
const elapsed_1 = __importDefault(__webpack_require__(14099));
|
231923
|
+
const format_date_1 = __importDefault(__webpack_require__(738));
|
231924
|
+
const get_deployment_1 = __importDefault(__webpack_require__(84249));
|
231925
|
+
const pkg_name_1 = __webpack_require__(79000);
|
231926
|
+
const get_project_by_id_or_name_1 = __importDefault(__webpack_require__(6729));
|
231927
|
+
const get_scope_1 = __importDefault(__webpack_require__(60324));
|
231928
|
+
const ms_1 = __importDefault(__webpack_require__(21378));
|
231929
|
+
const errors_ts_1 = __webpack_require__(39240);
|
231930
|
+
const render_alias_status_1 = __importDefault(__webpack_require__(33688));
|
231931
|
+
const sleep_1 = __importDefault(__webpack_require__(89507));
|
231932
|
+
/**
|
231933
|
+
* Continuously checks a deployment status until it has succeeded, failed, or
|
231934
|
+
* taken longer than the timeout (default 3 minutes).
|
231935
|
+
*
|
231936
|
+
* @param {Client} client - The Vercel client instance
|
231937
|
+
* @param {string} [contextName] - The scope name; if not specified, it will be
|
231938
|
+
* extracted from the `client`
|
231939
|
+
* @param {Deployment} [deployment] - Info about the deployment which is used
|
231940
|
+
* to display different output following a promotion request
|
231941
|
+
* @param {Project} project - Project info instance
|
231942
|
+
* @param {string} [timeout] - Milliseconds to poll for succeeded/failed state
|
231943
|
+
* @returns {Promise<number>} Resolves an exit code; 0 on success
|
231944
|
+
*/
|
231945
|
+
async function promoteStatus({ client, contextName, deployment, project, timeout = '3m', }) {
|
231946
|
+
const { output } = client;
|
231947
|
+
const recentThreshold = Date.now() - (0, ms_1.default)('3m');
|
231948
|
+
const promoteTimeout = Date.now() + (0, ms_1.default)(timeout);
|
231949
|
+
let counter = 0;
|
231950
|
+
let spinnerMessage = deployment
|
231951
|
+
? 'Promote in progress'
|
231952
|
+
: `Checking promotion status of ${project.name}`;
|
231953
|
+
if (!contextName) {
|
231954
|
+
({ contextName } = await (0, get_scope_1.default)(client));
|
231955
|
+
}
|
231956
|
+
try {
|
231957
|
+
output.spinner(`${spinnerMessage}…`);
|
231958
|
+
// continuously loop until the promotion has explicitly succeeded, failed,
|
231959
|
+
// or timed out
|
231960
|
+
for (;;) {
|
231961
|
+
const projectCheck = await (0, get_project_by_id_or_name_1.default)(client, project.id, project.accountId, true);
|
231962
|
+
if (projectCheck instanceof errors_ts_1.ProjectNotFound) {
|
231963
|
+
throw projectCheck;
|
231964
|
+
}
|
231965
|
+
const { jobStatus, requestedAt, toDeploymentId, type, } = projectCheck.lastAliasRequest ?? {};
|
231966
|
+
if (!jobStatus ||
|
231967
|
+
(jobStatus !== 'in-progress' && jobStatus !== 'pending')) {
|
231968
|
+
output.stopSpinner();
|
231969
|
+
output.log(`${spinnerMessage}…`);
|
231970
|
+
}
|
231971
|
+
if (!jobStatus ||
|
231972
|
+
!requestedAt ||
|
231973
|
+
!toDeploymentId ||
|
231974
|
+
requestedAt < recentThreshold) {
|
231975
|
+
output.log('No deployment promotion in progress');
|
231976
|
+
return 0;
|
231977
|
+
}
|
231978
|
+
if (jobStatus === 'skipped' && type === 'promote') {
|
231979
|
+
output.log('Promote deployment was skipped');
|
231980
|
+
return 0;
|
231981
|
+
}
|
231982
|
+
if (jobStatus === 'succeeded') {
|
231983
|
+
return await renderJobSucceeded({
|
231984
|
+
client,
|
231985
|
+
contextName,
|
231986
|
+
performingPromote: !!deployment,
|
231987
|
+
requestedAt,
|
231988
|
+
project,
|
231989
|
+
toDeploymentId,
|
231990
|
+
});
|
231991
|
+
}
|
231992
|
+
if (jobStatus === 'failed') {
|
231993
|
+
return await renderJobFailed({
|
231994
|
+
client,
|
231995
|
+
contextName,
|
231996
|
+
deployment,
|
231997
|
+
project,
|
231998
|
+
toDeploymentId,
|
231999
|
+
});
|
232000
|
+
}
|
232001
|
+
// lastly, if we're not pending/in-progress, then we don't know what
|
232002
|
+
// the status is, so bail
|
232003
|
+
if (jobStatus !== 'pending' && jobStatus !== 'in-progress') {
|
232004
|
+
output.log(`Unknown promote deployment status "${jobStatus}"`);
|
232005
|
+
return 1;
|
232006
|
+
}
|
232007
|
+
// check if we have been running for too long
|
232008
|
+
if (requestedAt < recentThreshold || Date.now() >= promoteTimeout) {
|
232009
|
+
output.log(`The promotion exceeded its deadline - rerun ${chalk_1.default.bold(`${(0, pkg_name_1.getPkgName)()} promote ${toDeploymentId}`)} to try again`);
|
232010
|
+
return 1;
|
232011
|
+
}
|
232012
|
+
// if we've done our first poll and not rolling back, then print the
|
232013
|
+
// requested at date/time
|
232014
|
+
if (counter++ === 0 && !deployment) {
|
232015
|
+
spinnerMessage += ` requested at ${(0, format_date_1.default)(requestedAt)}`;
|
232016
|
+
}
|
232017
|
+
output.spinner(`${spinnerMessage}…`);
|
232018
|
+
await (0, sleep_1.default)(250);
|
232019
|
+
}
|
232020
|
+
}
|
232021
|
+
finally {
|
232022
|
+
output.stopSpinner();
|
232023
|
+
}
|
232024
|
+
}
|
232025
|
+
exports.default = promoteStatus;
|
232026
|
+
async function renderJobFailed({ client, contextName, deployment, project, toDeploymentId, }) {
|
232027
|
+
const { output } = client;
|
232028
|
+
try {
|
232029
|
+
const name = (deployment || (await (0, get_deployment_1.default)(client, contextName, toDeploymentId)))?.url;
|
232030
|
+
output.error(`Failed to remap all aliases to the requested deployment ${name} (${toDeploymentId})`);
|
232031
|
+
}
|
232032
|
+
catch (e) {
|
232033
|
+
output.error(`Failed to remap all aliases to the requested deployment ${toDeploymentId}`);
|
232034
|
+
}
|
232035
|
+
// aliases are paginated, so continuously loop until all of them have been
|
232036
|
+
// fetched
|
232037
|
+
let nextTimestamp;
|
232038
|
+
for (;;) {
|
232039
|
+
let url = `/v9/projects/${project.id}/promote/aliases?failedOnly=true&limit=20`;
|
232040
|
+
if (nextTimestamp) {
|
232041
|
+
url += `&until=${nextTimestamp}`;
|
232042
|
+
}
|
232043
|
+
const { aliases, pagination } = await client.fetch(url);
|
232044
|
+
for (const { alias, status } of aliases) {
|
232045
|
+
output.log(` ${(0, render_alias_status_1.default)(status).padEnd(11)} ${alias.alias} (${alias.deploymentId})`);
|
232046
|
+
}
|
232047
|
+
if (pagination?.next) {
|
232048
|
+
nextTimestamp = pagination.next;
|
232049
|
+
}
|
232050
|
+
else {
|
232051
|
+
break;
|
232052
|
+
}
|
232053
|
+
}
|
232054
|
+
return 1;
|
232055
|
+
}
|
232056
|
+
async function renderJobSucceeded({ client, contextName, performingPromote, project, requestedAt, toDeploymentId, }) {
|
232057
|
+
const { output } = client;
|
232058
|
+
// attempt to get the new deployment url
|
232059
|
+
let deploymentInfo = '';
|
232060
|
+
try {
|
232061
|
+
const deployment = await (0, get_deployment_1.default)(client, contextName, toDeploymentId);
|
232062
|
+
deploymentInfo = `${chalk_1.default.bold(deployment.url)} (${toDeploymentId})`;
|
232063
|
+
}
|
232064
|
+
catch (err) {
|
232065
|
+
output.debug(`Failed to get deployment url for ${toDeploymentId}: ${err?.toString() || err}`);
|
232066
|
+
deploymentInfo = chalk_1.default.bold(toDeploymentId);
|
232067
|
+
}
|
232068
|
+
const duration = performingPromote ? (0, elapsed_1.default)(Date.now() - requestedAt) : '';
|
232069
|
+
output.log(`Success! ${chalk_1.default.bold(project.name)} was promoted to ${deploymentInfo} ${duration}`);
|
232070
|
+
return 0;
|
232071
|
+
}
|
232072
|
+
|
232073
|
+
|
232074
|
+
/***/ }),
|
232075
|
+
|
232076
|
+
/***/ 65158:
|
232077
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
232078
|
+
|
232079
|
+
"use strict";
|
232080
|
+
|
232081
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
232082
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
232083
|
+
};
|
232084
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
232085
|
+
exports.parseEnvironment = void 0;
|
232086
|
+
const chalk_1 = __importDefault(__webpack_require__(90877));
|
232087
|
+
const path_1 = __webpack_require__(85622);
|
232088
|
+
const emoji_1 = __webpack_require__(35172);
|
232089
|
+
const get_args_1 = __importDefault(__webpack_require__(2505));
|
232090
|
+
const logo_1 = __importDefault(__webpack_require__(66669));
|
232091
|
+
const stamp_1 = __importDefault(__webpack_require__(49079));
|
232092
|
+
const pkg_name_1 = __webpack_require__(79000);
|
232093
|
+
const link_1 = __webpack_require__(49347);
|
232094
|
+
const project_settings_1 = __webpack_require__(61440);
|
232095
|
+
const pull_1 = __importDefault(__webpack_require__(80800));
|
232096
|
+
const env_target_1 = __webpack_require__(20229);
|
232097
|
+
const ensure_link_1 = __webpack_require__(65382);
|
232098
|
+
const help = () => {
|
232099
|
+
return console.log(`
|
232100
|
+
${chalk_1.default.bold(`${logo_1.default} ${(0, pkg_name_1.getPkgName)()} pull`)} [project-path]
|
232101
|
+
|
232102
|
+
${chalk_1.default.dim('Options:')}
|
232103
|
+
|
232104
|
+
-h, --help Output usage information
|
232105
|
+
-A ${chalk_1.default.bold.underline('FILE')}, --local-config=${chalk_1.default.bold.underline('FILE')} Path to the local ${'`vercel.json`'} file
|
232106
|
+
-Q ${chalk_1.default.bold.underline('DIR')}, --global-config=${chalk_1.default.bold.underline('DIR')} Path to the global ${'`.vercel`'} directory
|
232107
|
+
-d, --debug Debug mode [off]
|
232108
|
+
--no-color No color mode [off]
|
232109
|
+
--environment [environment] Deployment environment [development]
|
232110
|
+
-y, --yes Skip questions when setting up new project using default scope and settings
|
232111
|
+
|
232112
|
+
${chalk_1.default.dim('Examples:')}
|
232113
|
+
|
232114
|
+
${chalk_1.default.gray('–')} Pull the latest Environment Variables and Project Settings from the cloud
|
232115
|
+
and stores them in \`.vercel/.env.\${target}.local\` and \`.vercel/project.json\` respectively.
|
232116
|
+
|
232117
|
+
${chalk_1.default.cyan(`$ ${(0, pkg_name_1.getPkgName)()} pull`)}
|
232118
|
+
${chalk_1.default.cyan(`$ ${(0, pkg_name_1.getPkgName)()} pull ./path-to-project`)}
|
232119
|
+
|
232120
|
+
${chalk_1.default.gray('–')} Pull for a specific environment
|
232121
|
+
|
232122
|
+
${chalk_1.default.cyan(`$ ${(0, pkg_name_1.getPkgName)()} pull --environment=${(0, env_target_1.getEnvTargetPlaceholder)()}`)}
|
232123
|
+
|
232124
|
+
${chalk_1.default.gray('If you want to download environment variables to a specific file, use `vercel env pull` instead.')}
|
232125
|
+
`);
|
232126
|
+
};
|
232127
|
+
function processArgs(client) {
|
232128
|
+
return (0, get_args_1.default)(client.argv.slice(2), {
|
232129
|
+
'--yes': Boolean,
|
232130
|
+
'--environment': String,
|
232131
|
+
'--git-branch': String,
|
232132
|
+
'--debug': Boolean,
|
232133
|
+
'-d': '--debug',
|
232134
|
+
'-y': '--yes',
|
232135
|
+
});
|
232136
|
+
}
|
232137
|
+
function parseArgs(client) {
|
232138
|
+
const argv = processArgs(client);
|
232139
|
+
if (argv['--help']) {
|
232140
|
+
help();
|
232141
|
+
return 2;
|
232142
|
+
}
|
232143
|
+
return argv;
|
232144
|
+
}
|
232145
|
+
async function pullAllEnvFiles(environment, client, project, argv, cwd) {
|
232146
|
+
const environmentFile = `.env.${environment}.local`;
|
232147
|
+
return (0, pull_1.default)(client, project, environment, argv, [(0, path_1.join)('.vercel', environmentFile)], client.output, cwd, 'vercel-cli:pull');
|
232148
|
+
}
|
232149
|
+
function parseEnvironment(environment = 'development') {
|
232150
|
+
if (!(0, env_target_1.isValidEnvTarget)(environment)) {
|
232151
|
+
throw new Error(`environment "${environment}" not supported; must be one of ${(0, env_target_1.getEnvTargetPlaceholder)()}`);
|
232152
|
+
}
|
232153
|
+
return environment;
|
232154
|
+
}
|
232155
|
+
exports.parseEnvironment = parseEnvironment;
|
232156
|
+
async function main(client) {
|
232157
|
+
const argv = parseArgs(client);
|
232158
|
+
if (typeof argv === 'number') {
|
232159
|
+
return argv;
|
232160
|
+
}
|
232161
|
+
const cwd = argv._[1] || process.cwd();
|
232162
|
+
const autoConfirm = Boolean(argv['--yes']);
|
232163
|
+
const environment = parseEnvironment(argv['--environment'] || undefined);
|
232164
|
+
const link = await (0, ensure_link_1.ensureLink)('pull', client, cwd, { autoConfirm });
|
232165
|
+
if (typeof link === 'number') {
|
232166
|
+
return link;
|
232167
|
+
}
|
232168
|
+
const { project, org } = link;
|
232169
|
+
client.config.currentTeam = org.type === 'team' ? org.id : undefined;
|
232170
|
+
const pullResultCode = await pullAllEnvFiles(environment, client, project, argv, cwd);
|
232171
|
+
if (pullResultCode !== 0) {
|
232172
|
+
return pullResultCode;
|
232173
|
+
}
|
232174
|
+
client.output.print('\n');
|
232175
|
+
client.output.log('Downloading project settings');
|
232176
|
+
await (0, project_settings_1.writeProjectSettings)(cwd, project, org);
|
232177
|
+
const settingsStamp = (0, stamp_1.default)();
|
232178
|
+
client.output.print(`${(0, emoji_1.prependEmoji)(`Downloaded project settings to ${chalk_1.default.bold((0, path_1.join)(link_1.VERCEL_DIR, link_1.VERCEL_DIR_PROJECT))} ${chalk_1.default.gray(settingsStamp())}`, (0, emoji_1.emoji)('success'))}\n`);
|
232179
|
+
return 0;
|
232180
|
+
}
|
232181
|
+
exports.default = main;
|
232182
|
+
|
232183
|
+
|
232184
|
+
/***/ }),
|
232185
|
+
|
232186
|
+
/***/ 29281:
|
232187
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
232188
|
+
|
232189
|
+
"use strict";
|
232190
|
+
|
232191
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
232192
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
232193
|
+
};
|
232194
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
232195
|
+
const chalk_1 = __importDefault(__webpack_require__(90877));
|
232196
|
+
const client_1 = __webpack_require__(40521);
|
232197
|
+
const emoji_1 = __webpack_require__(35172);
|
232198
|
+
const get_args_1 = __importDefault(__webpack_require__(2505));
|
232199
|
+
const pkg_name_1 = __webpack_require__(79000);
|
232200
|
+
const get_deployment_by_id_or_url_1 = __webpack_require__(47662);
|
232201
|
+
const get_scope_1 = __importDefault(__webpack_require__(60324));
|
232202
|
+
const handle_error_1 = __importDefault(__webpack_require__(64377));
|
232203
|
+
const error_utils_1 = __webpack_require__(39799);
|
232204
|
+
const logo_1 = __importDefault(__webpack_require__(66669));
|
232205
|
+
const util_1 = __importDefault(__webpack_require__(4058));
|
232206
|
+
const print_deployment_status_1 = __webpack_require__(27951);
|
232207
|
+
const stamp_1 = __importDefault(__webpack_require__(49079));
|
232208
|
+
const ua_1 = __importDefault(__webpack_require__(36308));
|
232209
|
+
const help = () => {
|
232210
|
+
console.log(`
|
232211
|
+
${chalk_1.default.bold(`${logo_1.default} ${(0, pkg_name_1.getPkgName)()} redeploy`)} [deploymentId|deploymentName]
|
232212
|
+
|
232213
|
+
Rebuild and deploy a previous deployment.
|
232214
|
+
|
232215
|
+
${chalk_1.default.dim('Options:')}
|
232216
|
+
|
232217
|
+
-h, --help Output usage information
|
232218
|
+
-A ${chalk_1.default.bold.underline('FILE')}, --local-config=${chalk_1.default.bold.underline('FILE')} Path to the local ${'`vercel.json`'} file
|
232219
|
+
-Q ${chalk_1.default.bold.underline('DIR')}, --global-config=${chalk_1.default.bold.underline('DIR')} Path to the global ${'`.vercel`'} directory
|
232220
|
+
-d, --debug Debug mode [off]
|
232221
|
+
--no-color No color mode [off]
|
232222
|
+
--no-wait Don't wait for the redeploy to finish
|
232223
|
+
-t ${chalk_1.default.bold.underline('TOKEN')}, --token=${chalk_1.default.bold.underline('TOKEN')} Login token
|
232224
|
+
-y, --yes Skip questions when setting up new project using default scope and settings
|
232225
|
+
|
232226
|
+
${chalk_1.default.dim('Examples:')}
|
232227
|
+
|
232228
|
+
${chalk_1.default.gray('–')} Rebuild and deploy an existing deployment using id or url
|
232229
|
+
|
232230
|
+
${chalk_1.default.cyan(`$ ${(0, pkg_name_1.getPkgName)()} redeploy my-deployment.vercel.app`)}
|
232231
|
+
|
232232
|
+
${chalk_1.default.gray('–')} Write Deployment URL to a file
|
232233
|
+
|
232234
|
+
${chalk_1.default.cyan(`$ ${(0, pkg_name_1.getPkgName)()} redeploy my-deployment.vercel.app > deployment-url.txt`)}
|
232235
|
+
`);
|
232236
|
+
};
|
232237
|
+
/**
|
232238
|
+
* `vc redeploy` command
|
232239
|
+
* @param {Client} client
|
232240
|
+
* @returns {Promise<number>} Resolves an exit code; 0 on success
|
232241
|
+
*/
|
232242
|
+
exports.default = async (client) => {
|
232243
|
+
let argv;
|
232244
|
+
try {
|
232245
|
+
argv = (0, get_args_1.default)(client.argv.slice(2), {
|
232246
|
+
'--no-wait': Boolean,
|
232247
|
+
'--yes': Boolean,
|
232248
|
+
'-y': '--yes',
|
232249
|
+
});
|
232250
|
+
}
|
232251
|
+
catch (err) {
|
232252
|
+
(0, handle_error_1.default)(err);
|
232253
|
+
return 1;
|
232254
|
+
}
|
232255
|
+
if (argv['--help'] || argv._[0] === 'help') {
|
232256
|
+
help();
|
232257
|
+
return 2;
|
232258
|
+
}
|
232259
|
+
const { output } = client;
|
232260
|
+
const deployIdOrUrl = argv._[1];
|
232261
|
+
if (!deployIdOrUrl) {
|
232262
|
+
output.error(`Missing required deployment id or url: ${(0, pkg_name_1.getCommandName)(`redeploy <deployment-id-or-url>`)}`);
|
232263
|
+
return 1;
|
232264
|
+
}
|
232265
|
+
const { contextName } = await (0, get_scope_1.default)(client);
|
232266
|
+
const noWait = !!argv['--no-wait'];
|
232267
|
+
try {
|
232268
|
+
const fromDeployment = await (0, get_deployment_by_id_or_url_1.getDeploymentByIdOrURL)({
|
232269
|
+
client,
|
232270
|
+
contextName,
|
232271
|
+
deployIdOrUrl,
|
232272
|
+
});
|
232273
|
+
const deployStamp = (0, stamp_1.default)();
|
232274
|
+
output.spinner(`Redeploying project ${fromDeployment.id}`, 0);
|
232275
|
+
let deployment = await client.fetch(`/v13/deployments?forceNew=1`, {
|
232276
|
+
body: {
|
232277
|
+
deploymentId: fromDeployment.id,
|
232278
|
+
meta: {
|
232279
|
+
action: 'redeploy',
|
232280
|
+
},
|
232281
|
+
name: fromDeployment.name,
|
232282
|
+
target: fromDeployment.target || 'production',
|
232283
|
+
},
|
232284
|
+
method: 'POST',
|
232285
|
+
});
|
232286
|
+
output.stopSpinner();
|
232287
|
+
output.print(`${(0, emoji_1.prependEmoji)(`Inspect: ${chalk_1.default.bold(deployment.inspectorUrl)} ${deployStamp()}`, (0, emoji_1.emoji)('inspect'))}\n`);
|
232288
|
+
if (!client.stdout.isTTY) {
|
232289
|
+
client.stdout.write(`https://${deployment.url}`);
|
232290
|
+
}
|
232291
|
+
if (!noWait) {
|
232292
|
+
output.spinner(deployment.readyState === 'QUEUED' ? 'Queued' : 'Building', 0);
|
232293
|
+
if (deployment.readyState === 'READY' && deployment.aliasAssigned) {
|
232294
|
+
output.spinner('Completing', 0);
|
232295
|
+
}
|
232296
|
+
else {
|
232297
|
+
try {
|
232298
|
+
const clientOptions = {
|
232299
|
+
agent: client.agent,
|
232300
|
+
apiUrl: client.apiUrl,
|
232301
|
+
debug: client.output.debugEnabled,
|
232302
|
+
path: '',
|
232303
|
+
teamId: fromDeployment.team?.id,
|
232304
|
+
token: client.authConfig.token,
|
232305
|
+
userAgent: ua_1.default,
|
232306
|
+
};
|
232307
|
+
for await (const event of (0, client_1.checkDeploymentStatus)(deployment, clientOptions)) {
|
232308
|
+
if (event.type === 'building') {
|
232309
|
+
output.spinner('Building', 0);
|
232310
|
+
}
|
232311
|
+
else if (event.type === 'ready' &&
|
232312
|
+
(event.payload.checksState
|
232313
|
+
? event.payload.checksState === 'completed'
|
232314
|
+
: true)) {
|
232315
|
+
output.spinner('Completing', 0);
|
232316
|
+
}
|
232317
|
+
else if (event.type === 'checks-running') {
|
232318
|
+
output.spinner('Running Checks', 0);
|
232319
|
+
}
|
232320
|
+
else if (event.type === 'alias-assigned' ||
|
232321
|
+
event.type === 'checks-conclusion-failed') {
|
232322
|
+
output.stopSpinner();
|
232323
|
+
deployment = event.payload;
|
232324
|
+
break;
|
232325
|
+
}
|
232326
|
+
else if (event.type === 'canceled') {
|
232327
|
+
output.stopSpinner();
|
232328
|
+
output.print('The deployment has been canceled.\n');
|
232329
|
+
return 1;
|
232330
|
+
}
|
232331
|
+
else if (event.type === 'error') {
|
232332
|
+
output.stopSpinner();
|
232333
|
+
const now = new util_1.default({
|
232334
|
+
client,
|
232335
|
+
currentTeam: fromDeployment.team?.id,
|
232336
|
+
});
|
232337
|
+
const error = await now.handleDeploymentError(event.payload, {
|
232338
|
+
env: {},
|
232339
|
+
});
|
232340
|
+
throw error;
|
232341
|
+
}
|
232342
|
+
}
|
232343
|
+
}
|
232344
|
+
catch (err) {
|
232345
|
+
output.prettyError(err);
|
232346
|
+
process.exit(1);
|
232347
|
+
}
|
232348
|
+
}
|
232349
|
+
}
|
232350
|
+
return (0, print_deployment_status_1.printDeploymentStatus)(client, deployment, deployStamp, noWait);
|
232351
|
+
}
|
232352
|
+
catch (err) {
|
232353
|
+
output.prettyError(err);
|
232354
|
+
if ((0, error_utils_1.isErrnoException)(err) && err.code === 'ERR_INVALID_TEAM') {
|
232355
|
+
output.error(`Use ${chalk_1.default.bold('vc switch')} to change your current team`);
|
232356
|
+
}
|
232357
|
+
return 1;
|
232358
|
+
}
|
232359
|
+
};
|
232360
|
+
|
232361
|
+
|
232362
|
+
/***/ }),
|
232363
|
+
|
232364
|
+
/***/ 5445:
|
232365
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
232366
|
+
|
232367
|
+
"use strict";
|
232368
|
+
|
232369
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
232370
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
232371
|
+
};
|
232372
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
232373
|
+
const chalk_1 = __importDefault(__webpack_require__(90877));
|
232374
|
+
const ms_1 = __importDefault(__webpack_require__(21378));
|
232375
|
+
const pluralize_1 = __importDefault(__webpack_require__(43669));
|
232376
|
+
const text_table_1 = __importDefault(__webpack_require__(43362));
|
231941
232377
|
const util_1 = __importDefault(__webpack_require__(4058));
|
231942
232378
|
const get_aliases_1 = __importDefault(__webpack_require__(21674));
|
231943
232379
|
const logo_1 = __importDefault(__webpack_require__(66669));
|
@@ -232170,7 +232606,7 @@ function deploymentsAndProjects(deployments, projects, conjunction = 'and') {
|
|
232170
232606
|
|
232171
232607
|
/***/ }),
|
232172
232608
|
|
232173
|
-
/***/
|
232609
|
+
/***/ 78339:
|
232174
232610
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
232175
232611
|
|
232176
232612
|
"use strict";
|
@@ -232180,18 +232616,18 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
232180
232616
|
};
|
232181
232617
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
232182
232618
|
const chalk_1 = __importDefault(__webpack_require__(90877));
|
232183
|
-
const ensure_link_1 = __webpack_require__(65382);
|
232184
232619
|
const get_args_1 = __importDefault(__webpack_require__(2505));
|
232620
|
+
const get_project_by_cwd_or_link_1 = __importDefault(__webpack_require__(90675));
|
232185
232621
|
const pkg_name_1 = __webpack_require__(79000);
|
232186
232622
|
const handle_error_1 = __importDefault(__webpack_require__(64377));
|
232623
|
+
const error_utils_1 = __webpack_require__(39799);
|
232187
232624
|
const logo_1 = __importDefault(__webpack_require__(66669));
|
232188
232625
|
const ms_1 = __importDefault(__webpack_require__(21378));
|
232189
|
-
const request_rollback_1 = __importDefault(__webpack_require__(
|
232190
|
-
const status_1 = __importDefault(__webpack_require__(
|
232191
|
-
const validate_paths_1 = __importDefault(__webpack_require__(33922));
|
232626
|
+
const request_rollback_1 = __importDefault(__webpack_require__(30964));
|
232627
|
+
const status_1 = __importDefault(__webpack_require__(16097));
|
232192
232628
|
const help = () => {
|
232193
232629
|
console.log(`
|
232194
|
-
${chalk_1.default.bold(`${logo_1.default} ${(0, pkg_name_1.getPkgName)()} rollback`)} [
|
232630
|
+
${chalk_1.default.bold(`${logo_1.default} ${(0, pkg_name_1.getPkgName)()} rollback`)} [deployment id/url]
|
232195
232631
|
|
232196
232632
|
Quickly revert back to a previous deployment.
|
232197
232633
|
|
@@ -232212,6 +232648,7 @@ const help = () => {
|
|
232212
232648
|
|
232213
232649
|
${chalk_1.default.cyan(`$ ${(0, pkg_name_1.getPkgName)()} rollback`)}
|
232214
232650
|
${chalk_1.default.cyan(`$ ${(0, pkg_name_1.getPkgName)()} rollback status`)}
|
232651
|
+
${chalk_1.default.cyan(`$ ${(0, pkg_name_1.getPkgName)()} rollback status <project>`)}
|
232215
232652
|
${chalk_1.default.cyan(`$ ${(0, pkg_name_1.getPkgName)()} rollback status --timeout 30s`)}
|
232216
232653
|
|
232217
232654
|
${chalk_1.default.gray('–')} Rollback a deployment using id or url
|
@@ -232228,8 +232665,6 @@ exports.default = async (client) => {
|
|
232228
232665
|
let argv;
|
232229
232666
|
try {
|
232230
232667
|
argv = (0, get_args_1.default)(client.argv.slice(2), {
|
232231
|
-
'--debug': Boolean,
|
232232
|
-
'-d': '--debug',
|
232233
232668
|
'--timeout': String,
|
232234
232669
|
'--yes': Boolean,
|
232235
232670
|
'-y': '--yes',
|
@@ -232243,41 +232678,263 @@ exports.default = async (client) => {
|
|
232243
232678
|
help();
|
232244
232679
|
return 2;
|
232245
232680
|
}
|
232246
|
-
// ensure the current directory is good
|
232247
|
-
const cwd = argv['--cwd'] || process.cwd();
|
232248
|
-
const pathValidation = await (0, validate_paths_1.default)(client, [cwd]);
|
232249
|
-
if (!pathValidation.valid) {
|
232250
|
-
return pathValidation.exitCode;
|
232251
|
-
}
|
232252
|
-
// ensure the current directory is a linked project
|
232253
|
-
const linkedProject = await (0, ensure_link_1.ensureLink)('rollback', client, pathValidation.path, {
|
232254
|
-
autoConfirm: Boolean(argv['--yes']),
|
232255
|
-
});
|
232256
|
-
if (typeof linkedProject === 'number') {
|
232257
|
-
return linkedProject;
|
232258
|
-
}
|
232259
232681
|
// validate the timeout
|
232260
232682
|
let timeout = argv['--timeout'];
|
232261
232683
|
if (timeout && (0, ms_1.default)(timeout) === undefined) {
|
232262
232684
|
client.output.error(`Invalid timeout "${timeout}"`);
|
232263
232685
|
return 1;
|
232264
232686
|
}
|
232265
|
-
const { project } = linkedProject;
|
232266
232687
|
const actionOrDeployId = argv._[1] || 'status';
|
232267
|
-
|
232268
|
-
|
232688
|
+
try {
|
232689
|
+
if (actionOrDeployId === 'status') {
|
232690
|
+
const project = await (0, get_project_by_cwd_or_link_1.default)({
|
232691
|
+
autoConfirm: Boolean(argv['--yes']),
|
232692
|
+
client,
|
232693
|
+
commandName: 'promote',
|
232694
|
+
cwd: client.cwd,
|
232695
|
+
projectNameOrId: argv._[2],
|
232696
|
+
});
|
232697
|
+
return await (0, status_1.default)({
|
232698
|
+
client,
|
232699
|
+
project,
|
232700
|
+
timeout,
|
232701
|
+
});
|
232702
|
+
}
|
232703
|
+
return await (0, request_rollback_1.default)({
|
232269
232704
|
client,
|
232270
|
-
|
232705
|
+
deployId: actionOrDeployId,
|
232271
232706
|
timeout,
|
232272
232707
|
});
|
232273
232708
|
}
|
232274
|
-
|
232709
|
+
catch (err) {
|
232710
|
+
if ((0, error_utils_1.isErrnoException)(err)) {
|
232711
|
+
if (err.code === 'ERR_CANCELED') {
|
232712
|
+
return 0;
|
232713
|
+
}
|
232714
|
+
if (err.code === 'ERR_INVALID_CWD' || err.code === 'ERR_LINK_PROJECT') {
|
232715
|
+
// do not show the message
|
232716
|
+
return 1;
|
232717
|
+
}
|
232718
|
+
}
|
232719
|
+
client.output.prettyError(err);
|
232720
|
+
return 1;
|
232721
|
+
}
|
232722
|
+
};
|
232723
|
+
|
232724
|
+
|
232725
|
+
/***/ }),
|
232726
|
+
|
232727
|
+
/***/ 30964:
|
232728
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
232729
|
+
|
232730
|
+
"use strict";
|
232731
|
+
|
232732
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
232733
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
232734
|
+
};
|
232735
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
232736
|
+
const chalk_1 = __importDefault(__webpack_require__(90877));
|
232737
|
+
const pkg_name_1 = __webpack_require__(79000);
|
232738
|
+
const get_project_by_deployment_1 = __importDefault(__webpack_require__(67231));
|
232739
|
+
const ms_1 = __importDefault(__webpack_require__(21378));
|
232740
|
+
const status_1 = __importDefault(__webpack_require__(16097));
|
232741
|
+
/**
|
232742
|
+
* Requests a rollback and waits for it complete.
|
232743
|
+
* @param {Client} client - The Vercel client instance
|
232744
|
+
* @param {string} deployIdOrUrl - The deployment name or id to rollback
|
232745
|
+
* @param {string} [timeout] - Time to poll for succeeded/failed state
|
232746
|
+
* @returns {Promise<number>} Resolves an exit code; 0 on success
|
232747
|
+
*/
|
232748
|
+
async function requestRollback({ client, deployId, timeout, }) {
|
232749
|
+
const { output } = client;
|
232750
|
+
const { contextName, deployment, project } = await (0, get_project_by_deployment_1.default)({
|
232751
|
+
client,
|
232752
|
+
deployId,
|
232753
|
+
output: client.output,
|
232754
|
+
});
|
232755
|
+
// create the rollback
|
232756
|
+
await client.fetch(`/v9/projects/${project.id}/rollback/${deployment.id}`, {
|
232757
|
+
body: {},
|
232758
|
+
method: 'POST',
|
232759
|
+
});
|
232760
|
+
if (timeout !== undefined && (0, ms_1.default)(timeout) === 0) {
|
232761
|
+
output.log(`Successfully requested rollback of ${chalk_1.default.bold(project.name)} to ${deployment.url} (${deployment.id})`);
|
232762
|
+
output.log(`To check rollback status, run ${(0, pkg_name_1.getCommandName)('rollback')}.`);
|
232763
|
+
return 0;
|
232764
|
+
}
|
232765
|
+
// check the status
|
232766
|
+
return await (0, status_1.default)({
|
232275
232767
|
client,
|
232276
|
-
|
232768
|
+
contextName,
|
232769
|
+
deployment,
|
232277
232770
|
project,
|
232278
232771
|
timeout,
|
232279
232772
|
});
|
232773
|
+
}
|
232774
|
+
exports.default = requestRollback;
|
232775
|
+
|
232776
|
+
|
232777
|
+
/***/ }),
|
232778
|
+
|
232779
|
+
/***/ 16097:
|
232780
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
232781
|
+
|
232782
|
+
"use strict";
|
232783
|
+
|
232784
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
232785
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
232280
232786
|
};
|
232787
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
232788
|
+
const chalk_1 = __importDefault(__webpack_require__(90877));
|
232789
|
+
const elapsed_1 = __importDefault(__webpack_require__(14099));
|
232790
|
+
const format_date_1 = __importDefault(__webpack_require__(738));
|
232791
|
+
const get_deployment_1 = __importDefault(__webpack_require__(84249));
|
232792
|
+
const pkg_name_1 = __webpack_require__(79000);
|
232793
|
+
const get_project_by_id_or_name_1 = __importDefault(__webpack_require__(6729));
|
232794
|
+
const get_scope_1 = __importDefault(__webpack_require__(60324));
|
232795
|
+
const ms_1 = __importDefault(__webpack_require__(21378));
|
232796
|
+
const errors_ts_1 = __webpack_require__(39240);
|
232797
|
+
const render_alias_status_1 = __importDefault(__webpack_require__(33688));
|
232798
|
+
const sleep_1 = __importDefault(__webpack_require__(89507));
|
232799
|
+
/**
|
232800
|
+
* Continuously checks a deployment status until it has succeeded, failed, or
|
232801
|
+
* taken longer than the timeout (default 3 minutes).
|
232802
|
+
* @param {Client} client - The Vercel client instance
|
232803
|
+
* @param {string} [contextName] - The scope name; if not specified, it will be
|
232804
|
+
* extracted from the `client`
|
232805
|
+
* @param {Deployment} [deployment] - Info about the deployment which is used
|
232806
|
+
* to display different output following a rollback request
|
232807
|
+
* @param {Project} project - Project info instance
|
232808
|
+
* @param {string} [timeout] - Milliseconds to poll for succeeded/failed state
|
232809
|
+
* @returns {Promise<number>} Resolves an exit code; 0 on success
|
232810
|
+
*/
|
232811
|
+
async function rollbackStatus({ client, contextName, deployment, project, timeout = '3m', }) {
|
232812
|
+
const { output } = client;
|
232813
|
+
const recentThreshold = Date.now() - (0, ms_1.default)('3m');
|
232814
|
+
const rollbackTimeout = Date.now() + (0, ms_1.default)(timeout);
|
232815
|
+
let counter = 0;
|
232816
|
+
let spinnerMessage = deployment
|
232817
|
+
? 'Rollback in progress'
|
232818
|
+
: `Checking rollback status of ${project.name}`;
|
232819
|
+
if (!contextName) {
|
232820
|
+
({ contextName } = await (0, get_scope_1.default)(client));
|
232821
|
+
}
|
232822
|
+
try {
|
232823
|
+
output.spinner(`${spinnerMessage}…`);
|
232824
|
+
// continuously loop until the rollback has explicitly succeeded, failed,
|
232825
|
+
// or timed out
|
232826
|
+
for (;;) {
|
232827
|
+
const projectCheck = await (0, get_project_by_id_or_name_1.default)(client, project.id, project.accountId, true);
|
232828
|
+
if (projectCheck instanceof errors_ts_1.ProjectNotFound) {
|
232829
|
+
throw projectCheck;
|
232830
|
+
}
|
232831
|
+
const { jobStatus, requestedAt, toDeploymentId, type, } = projectCheck.lastAliasRequest ?? {};
|
232832
|
+
if (!jobStatus ||
|
232833
|
+
(jobStatus !== 'in-progress' && jobStatus !== 'pending')) {
|
232834
|
+
output.stopSpinner();
|
232835
|
+
output.log(`${spinnerMessage}…`);
|
232836
|
+
}
|
232837
|
+
if (!jobStatus ||
|
232838
|
+
!requestedAt ||
|
232839
|
+
!toDeploymentId ||
|
232840
|
+
requestedAt < recentThreshold) {
|
232841
|
+
output.log('No deployment rollback in progress');
|
232842
|
+
return 0;
|
232843
|
+
}
|
232844
|
+
if (jobStatus === 'skipped' && type === 'rollback') {
|
232845
|
+
output.log('Rollback was skipped');
|
232846
|
+
return 0;
|
232847
|
+
}
|
232848
|
+
if (jobStatus === 'succeeded') {
|
232849
|
+
return await renderJobSucceeded({
|
232850
|
+
client,
|
232851
|
+
contextName,
|
232852
|
+
performingRollback: !!deployment,
|
232853
|
+
requestedAt,
|
232854
|
+
project,
|
232855
|
+
toDeploymentId,
|
232856
|
+
});
|
232857
|
+
}
|
232858
|
+
if (jobStatus === 'failed') {
|
232859
|
+
return await renderJobFailed({
|
232860
|
+
client,
|
232861
|
+
contextName,
|
232862
|
+
deployment,
|
232863
|
+
project,
|
232864
|
+
toDeploymentId,
|
232865
|
+
});
|
232866
|
+
}
|
232867
|
+
// lastly, if we're not pending/in-progress, then we don't know what
|
232868
|
+
// the status is, so bail
|
232869
|
+
if (jobStatus !== 'pending' && jobStatus !== 'in-progress') {
|
232870
|
+
output.log(`Unknown rollback status "${jobStatus}"`);
|
232871
|
+
return 1;
|
232872
|
+
}
|
232873
|
+
// check if we have been running for too long
|
232874
|
+
if (requestedAt < recentThreshold || Date.now() >= rollbackTimeout) {
|
232875
|
+
output.log(`The rollback exceeded its deadline - rerun ${chalk_1.default.bold(`${(0, pkg_name_1.getPkgName)()} rollback ${toDeploymentId}`)} to try again`);
|
232876
|
+
return 1;
|
232877
|
+
}
|
232878
|
+
// if we've done our first poll and not rolling back, then print the
|
232879
|
+
// requested at date/time
|
232880
|
+
if (counter++ === 0 && !deployment) {
|
232881
|
+
spinnerMessage += ` requested at ${(0, format_date_1.default)(requestedAt)}`;
|
232882
|
+
}
|
232883
|
+
output.spinner(`${spinnerMessage}…`);
|
232884
|
+
await (0, sleep_1.default)(250);
|
232885
|
+
}
|
232886
|
+
}
|
232887
|
+
finally {
|
232888
|
+
output.stopSpinner();
|
232889
|
+
}
|
232890
|
+
}
|
232891
|
+
exports.default = rollbackStatus;
|
232892
|
+
async function renderJobFailed({ client, contextName, deployment, project, toDeploymentId, }) {
|
232893
|
+
const { output } = client;
|
232894
|
+
try {
|
232895
|
+
const name = (deployment || (await (0, get_deployment_1.default)(client, contextName, toDeploymentId)))?.url;
|
232896
|
+
output.error(`Failed to remap all aliases to the requested deployment ${name} (${toDeploymentId})`);
|
232897
|
+
}
|
232898
|
+
catch (e) {
|
232899
|
+
output.error(`Failed to remap all aliases to the requested deployment ${toDeploymentId}`);
|
232900
|
+
}
|
232901
|
+
// aliases are paginated, so continuously loop until all of them have been
|
232902
|
+
// fetched
|
232903
|
+
let nextTimestamp;
|
232904
|
+
for (;;) {
|
232905
|
+
let url = `/v9/projects/${project.id}/rollback/aliases?failedOnly=true&limit=20`;
|
232906
|
+
if (nextTimestamp) {
|
232907
|
+
url += `&until=${nextTimestamp}`;
|
232908
|
+
}
|
232909
|
+
const { aliases, pagination } = await client.fetch(url);
|
232910
|
+
for (const { alias, status } of aliases) {
|
232911
|
+
output.log(` ${(0, render_alias_status_1.default)(status).padEnd(11)} ${alias.alias} (${alias.deploymentId})`);
|
232912
|
+
}
|
232913
|
+
if (pagination?.next) {
|
232914
|
+
nextTimestamp = pagination.next;
|
232915
|
+
}
|
232916
|
+
else {
|
232917
|
+
break;
|
232918
|
+
}
|
232919
|
+
}
|
232920
|
+
return 1;
|
232921
|
+
}
|
232922
|
+
async function renderJobSucceeded({ client, contextName, performingRollback, project, requestedAt, toDeploymentId, }) {
|
232923
|
+
const { output } = client;
|
232924
|
+
// attempt to get the new deployment url
|
232925
|
+
let deploymentInfo = '';
|
232926
|
+
try {
|
232927
|
+
const deployment = await (0, get_deployment_1.default)(client, contextName, toDeploymentId);
|
232928
|
+
deploymentInfo = `${chalk_1.default.bold(deployment.url)} (${toDeploymentId})`;
|
232929
|
+
}
|
232930
|
+
catch (err) {
|
232931
|
+
output.debug(`Failed to get deployment url for ${toDeploymentId}: ${err?.toString() || err}`);
|
232932
|
+
deploymentInfo = chalk_1.default.bold(toDeploymentId);
|
232933
|
+
}
|
232934
|
+
const duration = performingRollback ? (0, elapsed_1.default)(Date.now() - requestedAt) : '';
|
232935
|
+
output.log(`Success! ${chalk_1.default.bold(project.name)} was rolled back to ${deploymentInfo} ${duration}`);
|
232936
|
+
return 0;
|
232937
|
+
}
|
232281
232938
|
|
232282
232939
|
|
232283
232940
|
/***/ }),
|
@@ -233101,11 +233758,6 @@ const main = async () => {
|
|
233101
233758
|
output.prettyError(localConfig);
|
233102
233759
|
return 1;
|
233103
233760
|
}
|
233104
|
-
let cwd = argv['--cwd'];
|
233105
|
-
if (cwd) {
|
233106
|
-
process.chdir(cwd);
|
233107
|
-
}
|
233108
|
-
cwd = process.cwd();
|
233109
233761
|
// The second argument to the command can be:
|
233110
233762
|
//
|
233111
233763
|
// * a path to deploy (as in: `vercel path/`)
|
@@ -233207,6 +233859,11 @@ const main = async () => {
|
|
233207
233859
|
localConfigPath,
|
233208
233860
|
argv: process.argv,
|
233209
233861
|
});
|
233862
|
+
// The `--cwd` flag is respected for all sub-commands
|
233863
|
+
if (argv['--cwd']) {
|
233864
|
+
client.cwd = argv['--cwd'];
|
233865
|
+
}
|
233866
|
+
const { cwd } = client;
|
233210
233867
|
// Gets populated to the subcommand name when a built-in is
|
233211
233868
|
// provided, otherwise it remains undefined for an extension
|
233212
233869
|
let subcommand = undefined;
|
@@ -233446,14 +234103,20 @@ const main = async () => {
|
|
233446
234103
|
case 'project':
|
233447
234104
|
func = __webpack_require__(80860).default;
|
233448
234105
|
break;
|
234106
|
+
case 'promote':
|
234107
|
+
func = __webpack_require__(62435).default;
|
234108
|
+
break;
|
233449
234109
|
case 'pull':
|
233450
234110
|
func = __webpack_require__(65158).default;
|
233451
234111
|
break;
|
234112
|
+
case 'redeploy':
|
234113
|
+
func = __webpack_require__(29281).default;
|
234114
|
+
break;
|
233452
234115
|
case 'remove':
|
233453
234116
|
func = __webpack_require__(5445).default;
|
233454
234117
|
break;
|
233455
234118
|
case 'rollback':
|
233456
|
-
func = __webpack_require__(
|
234119
|
+
func = __webpack_require__(78339).default;
|
233457
234120
|
break;
|
233458
234121
|
case 'secrets':
|
233459
234122
|
func = __webpack_require__(5200)/* .default */ .Z;
|
@@ -233909,6 +234572,38 @@ async function removeAliasById(client, id) {
|
|
233909
234572
|
exports.default = removeAliasById;
|
233910
234573
|
|
233911
234574
|
|
234575
|
+
/***/ }),
|
234576
|
+
|
234577
|
+
/***/ 33688:
|
234578
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
234579
|
+
|
234580
|
+
"use strict";
|
234581
|
+
|
234582
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
234583
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
234584
|
+
};
|
234585
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
234586
|
+
const chalk_1 = __importDefault(__webpack_require__(90877));
|
234587
|
+
/**
|
234588
|
+
* Stylize the alias status label.
|
234589
|
+
* @param {AliasStatus} status - The status label
|
234590
|
+
* @returns {string}
|
234591
|
+
*/
|
234592
|
+
function renderAliasStatus(status) {
|
234593
|
+
if (status === 'completed') {
|
234594
|
+
return chalk_1.default.green(status);
|
234595
|
+
}
|
234596
|
+
if (status === 'failed') {
|
234597
|
+
return chalk_1.default.red(status);
|
234598
|
+
}
|
234599
|
+
if (status === 'skipped') {
|
234600
|
+
return chalk_1.default.gray(status);
|
234601
|
+
}
|
234602
|
+
return chalk_1.default.yellow(status);
|
234603
|
+
}
|
234604
|
+
exports.default = renderAliasStatus;
|
234605
|
+
|
234606
|
+
|
233912
234607
|
/***/ }),
|
233913
234608
|
|
233914
234609
|
/***/ 73396:
|
@@ -233935,9 +234630,6 @@ const ARG_COMMON = {
|
|
233935
234630
|
'-Q': '--global-config',
|
233936
234631
|
'--api': String,
|
233937
234632
|
'--cwd': String,
|
233938
|
-
// Deprecated
|
233939
|
-
'--platform-version': Number,
|
233940
|
-
'-V': '--platform-version',
|
233941
234633
|
};
|
233942
234634
|
exports.default = () => ARG_COMMON;
|
233943
234635
|
|
@@ -235779,6 +236471,12 @@ class Client extends events_1.EventEmitter {
|
|
235779
236471
|
output: this.stderr,
|
235780
236472
|
});
|
235781
236473
|
}
|
236474
|
+
get cwd() {
|
236475
|
+
return process.cwd();
|
236476
|
+
}
|
236477
|
+
set cwd(v) {
|
236478
|
+
process.chdir(v);
|
236479
|
+
}
|
235782
236480
|
}
|
235783
236481
|
exports.default = Client;
|
235784
236482
|
|
@@ -236260,9 +236958,9 @@ const ERRORS_TS = __importStar(__webpack_require__(39240));
|
|
236260
236958
|
const ERRORS = __importStar(__webpack_require__(74148));
|
236261
236959
|
const now_error_1 = __webpack_require__(22216);
|
236262
236960
|
const map_cert_error_1 = __importDefault(__webpack_require__(72812));
|
236263
|
-
async function createDeploy(client, now, contextName,
|
236961
|
+
async function createDeploy(client, now, contextName, path, createArgs, org, isSettingUpProject, cwd, archive) {
|
236264
236962
|
try {
|
236265
|
-
return await now.create(
|
236963
|
+
return await now.create(path, createArgs, org, isSettingUpProject, cwd, archive);
|
236266
236964
|
}
|
236267
236965
|
catch (err) {
|
236268
236966
|
if (ERRORS_TS.isAPIError(err)) {
|
@@ -236317,7 +237015,7 @@ async function createDeploy(client, now, contextName, paths, createArgs, org, is
|
|
236317
237015
|
if (result instanceof now_error_1.NowError) {
|
236318
237016
|
return result;
|
236319
237017
|
}
|
236320
|
-
return createDeploy(client, now, contextName,
|
237018
|
+
return createDeploy(client, now, contextName, path, createArgs, org, isSettingUpProject, cwd);
|
236321
237019
|
}
|
236322
237020
|
if (err.code === 'not_found') {
|
236323
237021
|
throw new ERRORS_TS.DeploymentNotFound({ context: contextName });
|
@@ -236377,6 +237075,77 @@ async function generateCertForDeploy(client, contextName, deployURL) {
|
|
236377
237075
|
exports.default = generateCertForDeploy;
|
236378
237076
|
|
236379
237077
|
|
237078
|
+
/***/ }),
|
237079
|
+
|
237080
|
+
/***/ 47662:
|
237081
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
237082
|
+
|
237083
|
+
"use strict";
|
237084
|
+
|
237085
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
237086
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
237087
|
+
};
|
237088
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
237089
|
+
exports.getDeploymentByIdOrURL = void 0;
|
237090
|
+
const chalk_1 = __importDefault(__webpack_require__(90877));
|
237091
|
+
const get_deployment_1 = __importDefault(__webpack_require__(84249));
|
237092
|
+
const get_team_by_id_1 = __importDefault(__webpack_require__(94949));
|
237093
|
+
const is_valid_name_1 = __webpack_require__(64476);
|
237094
|
+
/**
|
237095
|
+
* Renders feedback while retrieving a deployment, then validates the
|
237096
|
+
* deployment belongs to the current team.
|
237097
|
+
*
|
237098
|
+
* @param client - The CLI client instance.
|
237099
|
+
* @param contextName - The context/team name.
|
237100
|
+
* @param deployIdOrUrl - The deployment id or URL.
|
237101
|
+
* @returns The deployment info.
|
237102
|
+
*/
|
237103
|
+
async function getDeploymentByIdOrURL({ client, contextName, deployIdOrUrl, }) {
|
237104
|
+
const { config, output } = client;
|
237105
|
+
if (!(0, is_valid_name_1.isValidName)(deployIdOrUrl)) {
|
237106
|
+
throw new Error(`The provided argument "${deployIdOrUrl}" is not a valid deployment ID or URL`);
|
237107
|
+
}
|
237108
|
+
let deployment;
|
237109
|
+
let team;
|
237110
|
+
try {
|
237111
|
+
output.spinner(`Fetching deployment "${deployIdOrUrl}" in ${chalk_1.default.bold(contextName)}…`);
|
237112
|
+
const [teamResult, deploymentResult] = await Promise.allSettled([
|
237113
|
+
config.currentTeam ? (0, get_team_by_id_1.default)(client, config.currentTeam) : undefined,
|
237114
|
+
(0, get_deployment_1.default)(client, contextName, deployIdOrUrl),
|
237115
|
+
]);
|
237116
|
+
if (teamResult.status === 'rejected') {
|
237117
|
+
throw new Error(`Failed to retrieve team information: ${teamResult.reason}`);
|
237118
|
+
}
|
237119
|
+
if (deploymentResult.status === 'rejected') {
|
237120
|
+
throw new Error(deploymentResult.reason.message);
|
237121
|
+
}
|
237122
|
+
team = teamResult.value;
|
237123
|
+
deployment = deploymentResult.value;
|
237124
|
+
// re-render the spinner text because it goes so fast
|
237125
|
+
output.log(`Fetching deployment "${deployIdOrUrl}" in ${chalk_1.default.bold(contextName)}…`);
|
237126
|
+
}
|
237127
|
+
finally {
|
237128
|
+
output.stopSpinner();
|
237129
|
+
}
|
237130
|
+
if (deployment.team?.id) {
|
237131
|
+
if (!team || deployment.team.id !== team.id) {
|
237132
|
+
const err = new Error(team
|
237133
|
+
? `Deployment doesn't belong to current team ${chalk_1.default.bold(contextName)}`
|
237134
|
+
: `Deployment belongs to a different team`);
|
237135
|
+
err.code = 'ERR_INVALID_TEAM';
|
237136
|
+
throw err;
|
237137
|
+
}
|
237138
|
+
}
|
237139
|
+
else if (team) {
|
237140
|
+
const err = new Error(`Deployment doesn't belong to current team ${chalk_1.default.bold(contextName)}`);
|
237141
|
+
err.code = 'ERR_INVALID_TEAM';
|
237142
|
+
throw err;
|
237143
|
+
}
|
237144
|
+
return deployment;
|
237145
|
+
}
|
237146
|
+
exports.getDeploymentByIdOrURL = getDeploymentByIdOrURL;
|
237147
|
+
|
237148
|
+
|
236380
237149
|
/***/ }),
|
236381
237150
|
|
236382
237151
|
/***/ 10559:
|
@@ -236614,6 +237383,83 @@ function parseTarget(output, targetArg, prodArg) {
|
|
236614
237383
|
exports.default = parseTarget;
|
236615
237384
|
|
236616
237385
|
|
237386
|
+
/***/ }),
|
237387
|
+
|
237388
|
+
/***/ 27951:
|
237389
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
237390
|
+
|
237391
|
+
"use strict";
|
237392
|
+
|
237393
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
237394
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
237395
|
+
};
|
237396
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
237397
|
+
exports.printDeploymentStatus = void 0;
|
237398
|
+
const chalk_1 = __importDefault(__webpack_require__(90877));
|
237399
|
+
const get_preferred_preview_url_1 = __webpack_require__(62666);
|
237400
|
+
const is_deploying_1 = __webpack_require__(25307);
|
237401
|
+
const link_1 = __importDefault(__webpack_require__(39302));
|
237402
|
+
const emoji_1 = __webpack_require__(35172);
|
237403
|
+
async function printDeploymentStatus(client, { readyState, alias: aliasList, aliasError, target, indications, url: deploymentUrl, aliasWarning, }, deployStamp, noWait) {
|
237404
|
+
const { output } = client;
|
237405
|
+
indications = indications || [];
|
237406
|
+
const isProdDeployment = target === 'production';
|
237407
|
+
let isStillBuilding = false;
|
237408
|
+
if (noWait) {
|
237409
|
+
if ((0, is_deploying_1.isDeploying)(readyState)) {
|
237410
|
+
isStillBuilding = true;
|
237411
|
+
output.print((0, emoji_1.prependEmoji)('Note: Deployment is still processing...', (0, emoji_1.emoji)('notice')) + '\n');
|
237412
|
+
}
|
237413
|
+
}
|
237414
|
+
if (!isStillBuilding && readyState !== 'READY') {
|
237415
|
+
output.error(`Your deployment failed. Please retry later. More: https://err.sh/vercel/deployment-error`);
|
237416
|
+
return 1;
|
237417
|
+
}
|
237418
|
+
if (aliasError) {
|
237419
|
+
output.warn(`Failed to assign aliases${aliasError.message ? `: ${aliasError.message}` : ''}`);
|
237420
|
+
}
|
237421
|
+
else {
|
237422
|
+
// print preview/production url
|
237423
|
+
let previewUrl;
|
237424
|
+
// if `noWait` is true, then use the deployment url, not an alias
|
237425
|
+
if (!noWait && Array.isArray(aliasList) && aliasList.length > 0) {
|
237426
|
+
const previewUrlInfo = await (0, get_preferred_preview_url_1.getPreferredPreviewURL)(client, aliasList);
|
237427
|
+
if (previewUrlInfo) {
|
237428
|
+
previewUrl = previewUrlInfo.previewUrl;
|
237429
|
+
}
|
237430
|
+
else {
|
237431
|
+
previewUrl = `https://${deploymentUrl}`;
|
237432
|
+
}
|
237433
|
+
}
|
237434
|
+
else {
|
237435
|
+
// fallback to deployment url
|
237436
|
+
previewUrl = `https://${deploymentUrl}`;
|
237437
|
+
}
|
237438
|
+
output.print((0, emoji_1.prependEmoji)(`${isProdDeployment ? 'Production' : 'Preview'}: ${chalk_1.default.bold(previewUrl)} ${deployStamp()}`, (0, emoji_1.emoji)('success')) + `\n`);
|
237439
|
+
}
|
237440
|
+
if (aliasWarning?.message) {
|
237441
|
+
indications.push({
|
237442
|
+
type: 'warning',
|
237443
|
+
payload: aliasWarning.message,
|
237444
|
+
link: aliasWarning.link,
|
237445
|
+
action: aliasWarning.action,
|
237446
|
+
});
|
237447
|
+
}
|
237448
|
+
const newline = '\n';
|
237449
|
+
for (let indication of indications) {
|
237450
|
+
const message = (0, emoji_1.prependEmoji)(chalk_1.default.dim(indication.payload), (0, emoji_1.emoji)(indication.type)) +
|
237451
|
+
newline;
|
237452
|
+
let link = '';
|
237453
|
+
if (indication.link)
|
237454
|
+
link =
|
237455
|
+
chalk_1.default.dim(`${indication.action || 'Learn More'}: ${(0, link_1.default)(indication.link)}`) + newline;
|
237456
|
+
output.print(message + link);
|
237457
|
+
}
|
237458
|
+
return 0;
|
237459
|
+
}
|
237460
|
+
exports.printDeploymentStatus = printDeploymentStatus;
|
237461
|
+
|
237462
|
+
|
236617
237463
|
/***/ }),
|
236618
237464
|
|
236619
237465
|
/***/ 54944:
|
@@ -236636,8 +237482,9 @@ function printInspectUrl(output, inspectorUrl, deployStamp) {
|
|
236636
237482
|
output.print((0, emoji_1.prependEmoji)(`Inspect: ${chalk_1.default.bold(inspectorUrl)} ${deployStamp()}`, (0, emoji_1.emoji)('inspect')) + `\n`);
|
236637
237483
|
}
|
236638
237484
|
async function processDeployment({ org, cwd, projectName, isSettingUpProject, archive, skipAutoDetectionConfirmation, noWait, agent, ...args }) {
|
236639
|
-
let { now,
|
236640
|
-
const
|
237485
|
+
let { now, path, requestBody, deployStamp, force, withCache, quiet, prebuilt, rootDirectory, } = args;
|
237486
|
+
const client = now._client;
|
237487
|
+
const { output } = client;
|
236641
237488
|
const { env = {} } = requestBody;
|
236642
237489
|
const token = now._token;
|
236643
237490
|
if (!token) {
|
@@ -236649,7 +237496,7 @@ async function processDeployment({ org, cwd, projectName, isSettingUpProject, ar
|
|
236649
237496
|
token,
|
236650
237497
|
debug: now._debug,
|
236651
237498
|
userAgent: ua_1.default,
|
236652
|
-
path
|
237499
|
+
path,
|
236653
237500
|
force,
|
236654
237501
|
withCache,
|
236655
237502
|
prebuilt,
|
@@ -236672,7 +237519,7 @@ async function processDeployment({ org, cwd, projectName, isSettingUpProject, ar
|
|
236672
237519
|
}
|
236673
237520
|
if (event.type === 'file-count') {
|
236674
237521
|
const { total, missing, uploads } = event.payload;
|
236675
|
-
debug(`Total files ${total.size}, ${missing.length} changed`);
|
237522
|
+
output.debug(`Total files ${total.size}, ${missing.length} changed`);
|
236676
237523
|
const missingSize = missing
|
236677
237524
|
.map((sha) => total.get(sha).data.length)
|
236678
237525
|
.reduce((a, b) => a + b, 0);
|
@@ -236705,10 +237552,10 @@ async function processDeployment({ org, cwd, projectName, isSettingUpProject, ar
|
|
236705
237552
|
updateProgress();
|
236706
237553
|
}
|
236707
237554
|
if (event.type === 'file-uploaded') {
|
236708
|
-
debug(`Uploaded: ${event.payload.file.names.join(' ')} (${(0, bytes_1.default)(event.payload.file.data.length)})`);
|
237555
|
+
output.debug(`Uploaded: ${event.payload.file.names.join(' ')} (${(0, bytes_1.default)(event.payload.file.data.length)})`);
|
236709
237556
|
}
|
236710
237557
|
if (event.type === 'created') {
|
236711
|
-
await (0, link_1.linkFolderToProject)(
|
237558
|
+
await (0, link_1.linkFolderToProject)(client, cwd, {
|
236712
237559
|
orgId: org.id,
|
236713
237560
|
projectId: event.payload.projectId,
|
236714
237561
|
}, projectName, org.slug);
|
@@ -242798,7 +243645,7 @@ const errors_ts_1 = __webpack_require__(39240);
|
|
242798
243645
|
const map_cert_error_1 = __importDefault(__webpack_require__(72812));
|
242799
243646
|
const to_host_1 = __importDefault(__webpack_require__(47914));
|
242800
243647
|
/**
|
242801
|
-
* Retrieves a
|
243648
|
+
* Retrieves a deployment by id or URL.
|
242802
243649
|
*
|
242803
243650
|
* @param client - The Vercel CLI client instance.
|
242804
243651
|
* @param contextName - The scope context/team name.
|
@@ -243622,11 +244469,11 @@ class Now extends events_1.default {
|
|
243622
244469
|
get _debug() {
|
243623
244470
|
return this._client.output.isDebugEnabled();
|
243624
244471
|
}
|
243625
|
-
async create(
|
244472
|
+
async create(path, {
|
243626
244473
|
// Legacy
|
243627
244474
|
nowConfig: nowConfig = {},
|
243628
244475
|
// Latest
|
243629
|
-
name, project, prebuilt = false, rootDirectory, wantsPublic, meta, gitMetadata, regions, quiet = false, env, build, forceNew = false, withCache = false, target = null, deployStamp, projectSettings, skipAutoDetectionConfirmation, noWait, }, org, isSettingUpProject,
|
244476
|
+
name, project, prebuilt = false, rootDirectory, wantsPublic, meta, gitMetadata, regions, quiet = false, env, build, forceNew = false, withCache = false, target = null, deployStamp, projectSettings, skipAutoDetectionConfirmation, noWait, autoAssignCustomDomains, }, org, isSettingUpProject, cwd, archive) {
|
243630
244477
|
let hashes = {};
|
243631
244478
|
const uploadStamp = (0, stamp_1.default)();
|
243632
244479
|
let requestBody = {
|
@@ -243642,15 +244489,15 @@ class Now extends events_1.default {
|
|
243642
244489
|
target: target || undefined,
|
243643
244490
|
projectSettings,
|
243644
244491
|
source: 'cli',
|
244492
|
+
autoAssignCustomDomains,
|
243645
244493
|
};
|
243646
244494
|
// Ignore specific items from vercel.json
|
243647
244495
|
delete requestBody.scope;
|
243648
244496
|
delete requestBody.github;
|
243649
244497
|
const deployment = await (0, process_deployment_1.default)({
|
243650
244498
|
now: this,
|
243651
|
-
output: this._output,
|
243652
244499
|
agent: this._client.agent,
|
243653
|
-
|
244500
|
+
path,
|
243654
244501
|
requestBody,
|
243655
244502
|
uploadStamp,
|
243656
244503
|
deployStamp,
|
@@ -245189,7 +246036,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
245189
246036
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
245190
246037
|
};
|
245191
246038
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
245192
|
-
exports.findProjectFromPath = exports.traverseUpDirectories = exports.findRepoRoot = exports.ensureRepoLink = exports.getRepoLink = void 0;
|
246039
|
+
exports.findProjectFromPath = exports.findProjectsFromPath = exports.traverseUpDirectories = exports.findRepoRoot = exports.ensureRepoLink = exports.getRepoLink = void 0;
|
245193
246040
|
const chalk_1 = __importDefault(__webpack_require__(90877));
|
245194
246041
|
const pluralize_1 = __importDefault(__webpack_require__(43669));
|
245195
246042
|
const os_1 = __webpack_require__(12087);
|
@@ -245328,8 +246175,20 @@ async function findRepoRoot(start) {
|
|
245328
246175
|
// this isn't the repo we're looking for. Bail.
|
245329
246176
|
break;
|
245330
246177
|
}
|
246178
|
+
// if `.vercel/repo.json` exists (already linked),
|
246179
|
+
// then consider this the repo root
|
246180
|
+
const repoConfigPath = (0, path_1.join)(current, link_1.VERCEL_DIR, link_1.VERCEL_DIR_REPO);
|
246181
|
+
let stat = await (0, fs_extra_1.lstat)(repoConfigPath).catch(err => {
|
246182
|
+
if (err.code !== 'ENOENT')
|
246183
|
+
throw err;
|
246184
|
+
});
|
246185
|
+
if (stat) {
|
246186
|
+
return current;
|
246187
|
+
}
|
246188
|
+
// if `.git/config` exists (unlinked),
|
246189
|
+
// then consider this the repo root
|
245331
246190
|
const gitConfigPath = (0, path_1.join)(current, '.git/config');
|
245332
|
-
|
246191
|
+
stat = await (0, fs_extra_1.lstat)(gitConfigPath).catch(err => {
|
245333
246192
|
if (err.code !== 'ENOENT')
|
245334
246193
|
throw err;
|
245335
246194
|
});
|
@@ -245355,16 +246214,16 @@ function sortByDirectory(a, b) {
|
|
245355
246214
|
return bParts.length - aParts.length;
|
245356
246215
|
}
|
245357
246216
|
/**
|
245358
|
-
* Finds the matching
|
246217
|
+
* Finds the matching Projects from an array of Project links
|
245359
246218
|
* where the provided relative path is within the Project's
|
245360
246219
|
* root directory.
|
245361
246220
|
*/
|
245362
|
-
function
|
246221
|
+
function findProjectsFromPath(projects, path) {
|
245363
246222
|
const normalizedPath = (0, build_utils_1.normalizePath)(path);
|
245364
246223
|
return projects
|
245365
246224
|
.slice()
|
245366
246225
|
.sort(sortByDirectory)
|
245367
|
-
.
|
246226
|
+
.filter(project => {
|
245368
246227
|
if (project.directory === '.') {
|
245369
246228
|
// Project has no "Root Directory" setting, so any path is valid
|
245370
246229
|
return true;
|
@@ -245373,6 +246232,13 @@ function findProjectFromPath(projects, path) {
|
|
245373
246232
|
normalizedPath.startsWith(`${project.directory}/`));
|
245374
246233
|
});
|
245375
246234
|
}
|
246235
|
+
exports.findProjectsFromPath = findProjectsFromPath;
|
246236
|
+
/**
|
246237
|
+
* TODO: remove
|
246238
|
+
*/
|
246239
|
+
function findProjectFromPath(projects, path) {
|
246240
|
+
return findProjectsFromPath(projects, path)[0];
|
246241
|
+
}
|
245376
246242
|
exports.findProjectFromPath = findProjectFromPath;
|
245377
246243
|
|
245378
246244
|
|
@@ -245464,7 +246330,7 @@ async function setupAndLink(client, path, { autoConfirm = false, forceDelete = f
|
|
245464
246330
|
}
|
245465
246331
|
else {
|
245466
246332
|
const project = projectOrNewProjectName;
|
245467
|
-
await (0, link_1.linkFolderToProject)(
|
246333
|
+
await (0, link_1.linkFolderToProject)(client, path, {
|
245468
246334
|
projectId: project.id,
|
245469
246335
|
orgId: org.id,
|
245470
246336
|
}, project.name, org.slug, successEmoji);
|
@@ -245514,8 +246380,9 @@ async function setupAndLink(client, path, { autoConfirm = false, forceDelete = f
|
|
245514
246380
|
...localConfigurationOverrides,
|
245515
246381
|
sourceFilesOutsideRootDirectory,
|
245516
246382
|
},
|
246383
|
+
autoAssignCustomDomains: true,
|
245517
246384
|
};
|
245518
|
-
const deployment = await (0, create_deploy_1.default)(client, now, config.currentTeam || 'current user',
|
246385
|
+
const deployment = await (0, create_deploy_1.default)(client, now, config.currentTeam || 'current user', sourcePath, createArgs, org, true, path);
|
245519
246386
|
if (!deployment ||
|
245520
246387
|
!('code' in deployment) ||
|
245521
246388
|
deployment.code !== 'missing_project_settings') {
|
@@ -245538,7 +246405,7 @@ async function setupAndLink(client, path, { autoConfirm = false, forceDelete = f
|
|
245538
246405
|
const project = await (0, create_project_1.default)(client, newProjectName);
|
245539
246406
|
await (0, update_project_1.default)(client, project.id, settings);
|
245540
246407
|
Object.assign(project, settings);
|
245541
|
-
await (0, link_1.linkFolderToProject)(
|
246408
|
+
await (0, link_1.linkFolderToProject)(client, path, {
|
245542
246409
|
projectId: project.id,
|
245543
246410
|
orgId: org.id,
|
245544
246411
|
}, project.name, org.slug, successEmoji);
|
@@ -247452,6 +248319,118 @@ async function findProjectsForDomain(client, domainName) {
|
|
247452
248319
|
exports.findProjectsForDomain = findProjectsForDomain;
|
247453
248320
|
|
247454
248321
|
|
248322
|
+
/***/ }),
|
248323
|
+
|
248324
|
+
/***/ 90675:
|
248325
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
248326
|
+
|
248327
|
+
"use strict";
|
248328
|
+
|
248329
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
248330
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
248331
|
+
};
|
248332
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
248333
|
+
const errors_ts_1 = __webpack_require__(39240);
|
248334
|
+
const ensure_link_1 = __webpack_require__(65382);
|
248335
|
+
const get_project_by_id_or_name_1 = __importDefault(__webpack_require__(6729));
|
248336
|
+
async function getProjectByCwdOrLink({ autoConfirm, client, commandName, cwd, projectNameOrId, }) {
|
248337
|
+
if (projectNameOrId) {
|
248338
|
+
const project = await (0, get_project_by_id_or_name_1.default)(client, projectNameOrId);
|
248339
|
+
if (project instanceof errors_ts_1.ProjectNotFound) {
|
248340
|
+
throw project;
|
248341
|
+
}
|
248342
|
+
return project;
|
248343
|
+
}
|
248344
|
+
// ensure the current directory is a linked project
|
248345
|
+
const linkedProject = await (0, ensure_link_1.ensureLink)(commandName, client, cwd, {
|
248346
|
+
autoConfirm,
|
248347
|
+
});
|
248348
|
+
if (typeof linkedProject === 'number') {
|
248349
|
+
const err = new Error('Link project error');
|
248350
|
+
err.code = 'ERR_LINK_PROJECT';
|
248351
|
+
throw err;
|
248352
|
+
}
|
248353
|
+
return linkedProject.project;
|
248354
|
+
}
|
248355
|
+
exports.default = getProjectByCwdOrLink;
|
248356
|
+
|
248357
|
+
|
248358
|
+
/***/ }),
|
248359
|
+
|
248360
|
+
/***/ 67231:
|
248361
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
248362
|
+
|
248363
|
+
"use strict";
|
248364
|
+
|
248365
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
248366
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
248367
|
+
};
|
248368
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
248369
|
+
const chalk_1 = __importDefault(__webpack_require__(90877));
|
248370
|
+
const get_deployment_1 = __importDefault(__webpack_require__(84249));
|
248371
|
+
const get_project_by_id_or_name_1 = __importDefault(__webpack_require__(6729));
|
248372
|
+
const get_scope_1 = __importDefault(__webpack_require__(60324));
|
248373
|
+
const get_team_by_id_1 = __importDefault(__webpack_require__(94949));
|
248374
|
+
const is_valid_name_1 = __webpack_require__(64476);
|
248375
|
+
const errors_ts_1 = __webpack_require__(39240);
|
248376
|
+
async function getProjectByDeployment({ client, deployId, output, }) {
|
248377
|
+
const { config } = client;
|
248378
|
+
const { contextName } = await (0, get_scope_1.default)(client);
|
248379
|
+
if (!(0, is_valid_name_1.isValidName)(deployId)) {
|
248380
|
+
throw new Error(`The provided argument "${deployId}" is not a valid deployment ID or URL`);
|
248381
|
+
}
|
248382
|
+
let deployment;
|
248383
|
+
let team;
|
248384
|
+
try {
|
248385
|
+
output?.spinner(`Fetching deployment "${deployId}" in ${chalk_1.default.bold(contextName)}…`);
|
248386
|
+
const [teamResult, deploymentResult] = await Promise.allSettled([
|
248387
|
+
config.currentTeam ? (0, get_team_by_id_1.default)(client, config.currentTeam) : undefined,
|
248388
|
+
(0, get_deployment_1.default)(client, contextName, deployId),
|
248389
|
+
]);
|
248390
|
+
if (teamResult.status === 'rejected') {
|
248391
|
+
throw new Error(`Failed to retrieve team information: ${teamResult.reason}`);
|
248392
|
+
}
|
248393
|
+
if (deploymentResult.status === 'rejected') {
|
248394
|
+
throw new Error(deploymentResult.reason);
|
248395
|
+
}
|
248396
|
+
team = teamResult.value;
|
248397
|
+
deployment = deploymentResult.value;
|
248398
|
+
// re-render the spinner text
|
248399
|
+
output?.log(`Fetching deployment "${deployId}" in ${chalk_1.default.bold(contextName)}…`);
|
248400
|
+
if (deployment.team?.id) {
|
248401
|
+
if (!team || deployment.team.id !== team.id) {
|
248402
|
+
const err = new Error(team
|
248403
|
+
? `Deployment doesn't belong to current team ${chalk_1.default.bold(contextName)}`
|
248404
|
+
: `Deployment belongs to a different team`);
|
248405
|
+
err.code = 'ERR_INVALID_TEAM';
|
248406
|
+
throw err;
|
248407
|
+
}
|
248408
|
+
}
|
248409
|
+
if (team) {
|
248410
|
+
const err = new Error(`Deployment doesn't belong to current team ${chalk_1.default.bold(contextName)}`);
|
248411
|
+
err.code = 'ERR_INVALID_TEAM';
|
248412
|
+
throw err;
|
248413
|
+
}
|
248414
|
+
if (!deployment.projectId) {
|
248415
|
+
throw new Error('Deployment is not associated to a project');
|
248416
|
+
}
|
248417
|
+
const project = await (0, get_project_by_id_or_name_1.default)(client, deployment.projectId);
|
248418
|
+
if (project instanceof errors_ts_1.ProjectNotFound) {
|
248419
|
+
throw project;
|
248420
|
+
}
|
248421
|
+
return {
|
248422
|
+
contextName,
|
248423
|
+
deployment,
|
248424
|
+
project,
|
248425
|
+
};
|
248426
|
+
}
|
248427
|
+
finally {
|
248428
|
+
output?.stopSpinner();
|
248429
|
+
}
|
248430
|
+
}
|
248431
|
+
exports.default = getProjectByDeployment;
|
248432
|
+
|
248433
|
+
|
247455
248434
|
/***/ }),
|
247456
248435
|
|
247457
248436
|
/***/ 6729:
|
@@ -247461,9 +248440,10 @@ exports.findProjectsForDomain = findProjectsForDomain;
|
|
247461
248440
|
|
247462
248441
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
247463
248442
|
const errors_ts_1 = __webpack_require__(39240);
|
247464
|
-
async function getProjectByNameOrId(client, projectNameOrId, accountId) {
|
248443
|
+
async function getProjectByNameOrId(client, projectNameOrId, accountId, includeRollbackInfo) {
|
247465
248444
|
try {
|
247466
|
-
const
|
248445
|
+
const qs = includeRollbackInfo ? '?rollbackInfo=true' : '';
|
248446
|
+
const project = await client.fetch(`/v9/projects/${encodeURIComponent(projectNameOrId)}${qs}`, { accountId });
|
247467
248447
|
return project;
|
247468
248448
|
}
|
247469
248449
|
catch (err) {
|
@@ -247545,34 +248525,38 @@ function getVercelDirectory(cwd) {
|
|
247545
248525
|
return existingDirs[0] || possibleDirs[0];
|
247546
248526
|
}
|
247547
248527
|
exports.getVercelDirectory = getVercelDirectory;
|
247548
|
-
async function
|
247549
|
-
|
247550
|
-
|
247551
|
-
|
247552
|
-
|
247553
|
-
|
247554
|
-
|
247555
|
-
// Try the repo linking style (`${repoRoot}/.vercel/repo.json`)
|
247556
|
-
return getLinkFromRepo(path);
|
247557
|
-
}
|
247558
|
-
async function getLinkFromRepo(path) {
|
247559
|
-
const repoRoot = await (0, repo_1.findRepoRoot)(path);
|
247560
|
-
if (!repoRoot) {
|
248528
|
+
async function getProjectLink(client, path) {
|
248529
|
+
return ((await getProjectLinkFromRepoLink(client, path)) ||
|
248530
|
+
(await getLinkFromDir(getVercelDirectory(path))));
|
248531
|
+
}
|
248532
|
+
async function getProjectLinkFromRepoLink(client, path) {
|
248533
|
+
const repoLink = await (0, repo_1.getRepoLink)(path);
|
248534
|
+
if (!repoLink?.repoConfig) {
|
247561
248535
|
return null;
|
247562
248536
|
}
|
247563
|
-
|
247564
|
-
|
247565
|
-
|
247566
|
-
|
247567
|
-
const project = (0, repo_1.findProjectFromPath)(repoJson.projects, (0, path_1.relative)(repoRoot, path));
|
247568
|
-
if (project) {
|
247569
|
-
return { orgId: repoJson.orgId, projectId: project.id };
|
247570
|
-
}
|
248537
|
+
const projects = (0, repo_1.findProjectsFromPath)(repoLink.repoConfig.projects, (0, path_1.relative)(repoLink.rootPath, path));
|
248538
|
+
let project;
|
248539
|
+
if (projects.length === 1) {
|
248540
|
+
project = projects[0];
|
247571
248541
|
}
|
247572
|
-
|
247573
|
-
|
247574
|
-
|
247575
|
-
|
248542
|
+
else {
|
248543
|
+
const { p } = await client.prompt({
|
248544
|
+
name: 'p',
|
248545
|
+
type: 'list',
|
248546
|
+
message: `Please select a Project:`,
|
248547
|
+
choices: repoLink.repoConfig.projects.map(p => ({
|
248548
|
+
value: p,
|
248549
|
+
name: p.name,
|
248550
|
+
})),
|
248551
|
+
});
|
248552
|
+
project = p;
|
248553
|
+
}
|
248554
|
+
if (project) {
|
248555
|
+
return {
|
248556
|
+
orgId: repoLink.repoConfig.orgId,
|
248557
|
+
projectId: project.id,
|
248558
|
+
repoRoot: repoLink.rootPath,
|
248559
|
+
};
|
247576
248560
|
}
|
247577
248561
|
return null;
|
247578
248562
|
}
|
@@ -247613,7 +248597,30 @@ async function getOrgById(client, orgId) {
|
|
247613
248597
|
return null;
|
247614
248598
|
return { type: 'user', id: orgId, slug: user.username };
|
247615
248599
|
}
|
247616
|
-
async function
|
248600
|
+
async function hasProjectLink(projectLink, path) {
|
248601
|
+
// "linked" via env vars?
|
248602
|
+
const VERCEL_ORG_ID = (0, build_utils_1.getPlatformEnv)('ORG_ID');
|
248603
|
+
const VERCEL_PROJECT_ID = (0, build_utils_1.getPlatformEnv)('PROJECT_ID');
|
248604
|
+
if (VERCEL_ORG_ID === projectLink.orgId &&
|
248605
|
+
VERCEL_PROJECT_ID === projectLink.projectId) {
|
248606
|
+
return true;
|
248607
|
+
}
|
248608
|
+
// linked via `repo.json`?
|
248609
|
+
const repoLink = await (0, repo_1.getRepoLink)(path);
|
248610
|
+
if (repoLink?.repoConfig?.orgId === projectLink.orgId &&
|
248611
|
+
repoLink.repoConfig.projects.find(p => p.id === projectLink.projectId)) {
|
248612
|
+
return true;
|
248613
|
+
}
|
248614
|
+
// if the project is already linked, we skip linking
|
248615
|
+
const link = await getLinkFromDir(getVercelDirectory(path));
|
248616
|
+
if (link &&
|
248617
|
+
link.orgId === projectLink.orgId &&
|
248618
|
+
link.projectId === projectLink.projectId) {
|
248619
|
+
return true;
|
248620
|
+
}
|
248621
|
+
return false;
|
248622
|
+
}
|
248623
|
+
async function getLinkedProject(client, path = client.cwd) {
|
247617
248624
|
const { output } = client;
|
247618
248625
|
const VERCEL_ORG_ID = (0, build_utils_1.getPlatformEnv)('ORG_ID');
|
247619
248626
|
const VERCEL_PROJECT_ID = (0, build_utils_1.getPlatformEnv)('PROJECT_ID');
|
@@ -247624,7 +248631,7 @@ async function getLinkedProject(client, path = process.cwd()) {
|
|
247624
248631
|
}
|
247625
248632
|
const link = VERCEL_ORG_ID && VERCEL_PROJECT_ID
|
247626
248633
|
? { orgId: VERCEL_ORG_ID, projectId: VERCEL_PROJECT_ID }
|
247627
|
-
: await
|
248634
|
+
: await getProjectLink(client, path);
|
247628
248635
|
if (!link) {
|
247629
248636
|
return { status: 'not_linked', org: null, project: null };
|
247630
248637
|
}
|
@@ -247668,21 +248675,12 @@ async function getLinkedProject(client, path = process.cwd()) {
|
|
247668
248675
|
output.print((0, emoji_1.prependEmoji)('Your Project was either deleted, transferred to a new Team, or you don’t have access to it anymore.\n', (0, emoji_1.emoji)('warning')));
|
247669
248676
|
return { status: 'not_linked', org: null, project: null };
|
247670
248677
|
}
|
247671
|
-
return { status: 'linked', org, project };
|
248678
|
+
return { status: 'linked', org, project, repoRoot: link.repoRoot };
|
247672
248679
|
}
|
247673
248680
|
exports.getLinkedProject = getLinkedProject;
|
247674
|
-
async function linkFolderToProject(
|
247675
|
-
const VERCEL_ORG_ID = (0, build_utils_1.getPlatformEnv)('ORG_ID');
|
247676
|
-
const VERCEL_PROJECT_ID = (0, build_utils_1.getPlatformEnv)('PROJECT_ID');
|
247677
|
-
// if defined, skip linking
|
247678
|
-
if (VERCEL_ORG_ID || VERCEL_PROJECT_ID) {
|
247679
|
-
return;
|
247680
|
-
}
|
248681
|
+
async function linkFolderToProject(client, path, projectLink, projectName, orgSlug, successEmoji = 'link') {
|
247681
248682
|
// if the project is already linked, we skip linking
|
247682
|
-
|
247683
|
-
if (link &&
|
247684
|
-
link.orgId === projectLink.orgId &&
|
247685
|
-
link.projectId === projectLink.projectId) {
|
248683
|
+
if (await hasProjectLink(projectLink, path)) {
|
247686
248684
|
return;
|
247687
248685
|
}
|
247688
248686
|
try {
|
@@ -247700,7 +248698,7 @@ async function linkFolderToProject(output, path, projectLink, projectName, orgSl
|
|
247700
248698
|
await writeFile((0, path_1.join)(path, exports.VERCEL_DIR, exports.VERCEL_DIR_README), await readFile((0, path_1.join)(__dirname, 'VERCEL_DIR_README.txt'), 'utf8'));
|
247701
248699
|
// update .gitignore
|
247702
248700
|
const isGitIgnoreUpdated = await (0, add_to_gitignore_1.addToGitIgnore)(path);
|
247703
|
-
output.print((0, emoji_1.prependEmoji)(`Linked to ${chalk_1.default.bold(`${orgSlug}/${projectName}`)} (created ${exports.VERCEL_DIR}${isGitIgnoreUpdated ? ' and added it to .gitignore' : ''})`, (0, emoji_1.emoji)(successEmoji)) + '\n');
|
248701
|
+
client.output.print((0, emoji_1.prependEmoji)(`Linked to ${chalk_1.default.bold(`${orgSlug}/${projectName}`)} (created ${exports.VERCEL_DIR}${isGitIgnoreUpdated ? ' and added it to .gitignore' : ''})`, (0, emoji_1.emoji)(successEmoji)) + '\n');
|
247704
248702
|
}
|
247705
248703
|
exports.linkFolderToProject = linkFolderToProject;
|
247706
248704
|
|
@@ -247912,278 +248910,23 @@ async function readJSONFile(file) {
|
|
247912
248910
|
return json;
|
247913
248911
|
}
|
247914
248912
|
catch (error) {
|
247915
|
-
return new errors_ts_1.CantParseJSONFile(file);
|
247916
|
-
}
|
247917
|
-
}
|
247918
|
-
exports.default = readJSONFile;
|
247919
|
-
async function readFileSafe(file) {
|
247920
|
-
try {
|
247921
|
-
return await fs_extra_1.default.readFile(file, 'utf8');
|
247922
|
-
}
|
247923
|
-
catch (_) {
|
247924
|
-
return null;
|
247925
|
-
}
|
247926
|
-
}
|
247927
|
-
|
247928
|
-
|
247929
|
-
/***/ }),
|
247930
|
-
|
247931
|
-
/***/ 67911:
|
247932
|
-
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
247933
|
-
|
247934
|
-
"use strict";
|
247935
|
-
|
247936
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
247937
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
247938
|
-
};
|
247939
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
247940
|
-
const get_scope_1 = __importDefault(__webpack_require__(60324));
|
247941
|
-
const get_args_1 = __importDefault(__webpack_require__(2505));
|
247942
|
-
const error_utils_1 = __webpack_require__(39799);
|
247943
|
-
async function reportError(sentry, client, error) {
|
247944
|
-
if (ignoreError(error)) {
|
247945
|
-
return;
|
247946
|
-
}
|
247947
|
-
let user;
|
247948
|
-
let team;
|
247949
|
-
let scopeError;
|
247950
|
-
try {
|
247951
|
-
({ user, team } = await (0, get_scope_1.default)(client));
|
247952
|
-
}
|
247953
|
-
catch (err) {
|
247954
|
-
// We can safely ignore this, as the error
|
247955
|
-
// reporting works even without this metadata attached.
|
247956
|
-
if ((0, error_utils_1.isError)(err)) {
|
247957
|
-
scopeError = err;
|
247958
|
-
}
|
247959
|
-
}
|
247960
|
-
sentry.withScope(scope => {
|
247961
|
-
if (user) {
|
247962
|
-
const spec = {
|
247963
|
-
email: user.email,
|
247964
|
-
id: user.id,
|
247965
|
-
username: user.username,
|
247966
|
-
name: user.name,
|
247967
|
-
};
|
247968
|
-
scope.setUser(spec);
|
247969
|
-
}
|
247970
|
-
if (team) {
|
247971
|
-
scope.setTag('currentTeam', team.id);
|
247972
|
-
}
|
247973
|
-
if (scopeError) {
|
247974
|
-
scope.setExtra('scopeError', {
|
247975
|
-
name: scopeError.name,
|
247976
|
-
message: scopeError.message,
|
247977
|
-
stack: scopeError.stack,
|
247978
|
-
});
|
247979
|
-
}
|
247980
|
-
// Report `process.argv` without sensitive data
|
247981
|
-
let args;
|
247982
|
-
let argsError;
|
247983
|
-
try {
|
247984
|
-
args = (0, get_args_1.default)(process.argv.slice(2), {});
|
247985
|
-
}
|
247986
|
-
catch (err) {
|
247987
|
-
if ((0, error_utils_1.isError)(err)) {
|
247988
|
-
argsError = err;
|
247989
|
-
}
|
247990
|
-
}
|
247991
|
-
if (args) {
|
247992
|
-
const flags = ['--env', '--build-env', '--token'];
|
247993
|
-
for (const flag of flags) {
|
247994
|
-
if (args[flag])
|
247995
|
-
args[flag] = 'REDACTED';
|
247996
|
-
}
|
247997
|
-
if (args._.length >= 4 &&
|
247998
|
-
args._[0].startsWith('secret') &&
|
247999
|
-
args._[1] === 'add') {
|
248000
|
-
args._[3] = 'REDACTED';
|
248001
|
-
}
|
248002
|
-
scope.setExtra('args', args);
|
248003
|
-
}
|
248004
|
-
else {
|
248005
|
-
let msg = 'Unable to parse args';
|
248006
|
-
if (argsError) {
|
248007
|
-
msg += `: ${argsError}`;
|
248008
|
-
}
|
248009
|
-
scope.setExtra('args', msg);
|
248010
|
-
}
|
248011
|
-
// Report information about the version of `node` being used
|
248012
|
-
scope.setExtra('node', {
|
248013
|
-
execPath: process.execPath,
|
248014
|
-
version: process.version,
|
248015
|
-
platform: process.platform,
|
248016
|
-
});
|
248017
|
-
sentry.captureException(error);
|
248018
|
-
});
|
248019
|
-
const sentryClient = sentry.getCurrentHub().getClient();
|
248020
|
-
if (sentryClient) {
|
248021
|
-
await sentryClient.close();
|
248022
|
-
}
|
248023
|
-
}
|
248024
|
-
exports.default = reportError;
|
248025
|
-
function ignoreError(error) {
|
248026
|
-
return (0, error_utils_1.isError)(error) && error.message.includes('uv_cwd');
|
248027
|
-
}
|
248028
|
-
|
248029
|
-
|
248030
|
-
/***/ }),
|
248031
|
-
|
248032
|
-
/***/ 88817:
|
248033
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
248034
|
-
|
248035
|
-
"use strict";
|
248036
|
-
|
248037
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
248038
|
-
const errors_ts_1 = __webpack_require__(39240);
|
248039
|
-
async function responseError(res, fallbackMessage = null, parsedBody = {}) {
|
248040
|
-
let bodyError;
|
248041
|
-
if (!res.ok) {
|
248042
|
-
let body;
|
248043
|
-
try {
|
248044
|
-
body = await res.json();
|
248045
|
-
}
|
248046
|
-
catch (err) {
|
248047
|
-
body = parsedBody;
|
248048
|
-
}
|
248049
|
-
// Some APIs wrongly return `err` instead of `error`
|
248050
|
-
bodyError = body.error || body.err || body;
|
248051
|
-
}
|
248052
|
-
const msg = bodyError?.message || fallbackMessage || 'Response Error';
|
248053
|
-
return new errors_ts_1.APIError(msg, res, bodyError);
|
248054
|
-
}
|
248055
|
-
exports.default = responseError;
|
248056
|
-
|
248057
|
-
|
248058
|
-
/***/ }),
|
248059
|
-
|
248060
|
-
/***/ 8644:
|
248061
|
-
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
248062
|
-
|
248063
|
-
"use strict";
|
248064
|
-
|
248065
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
248066
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
248067
|
-
};
|
248068
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
248069
|
-
const chalk_1 = __importDefault(__webpack_require__(90877));
|
248070
|
-
/**
|
248071
|
-
* Stylize the alias status label.
|
248072
|
-
* @param {AliasStatus} status - The status label
|
248073
|
-
* @returns {string}
|
248074
|
-
*/
|
248075
|
-
function renderAliasStatus(status) {
|
248076
|
-
if (status === 'completed') {
|
248077
|
-
return chalk_1.default.green(status);
|
248078
|
-
}
|
248079
|
-
if (status === 'failed') {
|
248080
|
-
return chalk_1.default.red(status);
|
248081
|
-
}
|
248082
|
-
if (status === 'skipped') {
|
248083
|
-
return chalk_1.default.gray(status);
|
248084
|
-
}
|
248085
|
-
return chalk_1.default.yellow(status);
|
248086
|
-
}
|
248087
|
-
exports.default = renderAliasStatus;
|
248088
|
-
|
248089
|
-
|
248090
|
-
/***/ }),
|
248091
|
-
|
248092
|
-
/***/ 58601:
|
248093
|
-
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
248094
|
-
|
248095
|
-
"use strict";
|
248096
|
-
|
248097
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
248098
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
248099
|
-
};
|
248100
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
248101
|
-
const chalk_1 = __importDefault(__webpack_require__(90877));
|
248102
|
-
const pkg_name_1 = __webpack_require__(79000);
|
248103
|
-
const get_deployment_1 = __importDefault(__webpack_require__(84249));
|
248104
|
-
const get_scope_1 = __importDefault(__webpack_require__(60324));
|
248105
|
-
const get_team_by_id_1 = __importDefault(__webpack_require__(94949));
|
248106
|
-
const is_valid_name_1 = __webpack_require__(64476);
|
248107
|
-
const ms_1 = __importDefault(__webpack_require__(21378));
|
248108
|
-
const status_1 = __importDefault(__webpack_require__(87181));
|
248109
|
-
/**
|
248110
|
-
* Requests a rollback and waits for it complete.
|
248111
|
-
* @param {Client} client - The Vercel client instance
|
248112
|
-
* @param {string} deployId - The deployment name or id to rollback
|
248113
|
-
* @param {Project} project - Project info instance
|
248114
|
-
* @param {string} [timeout] - Time to poll for succeeded/failed state
|
248115
|
-
* @returns {Promise<number>} Resolves an exit code; 0 on success
|
248116
|
-
*/
|
248117
|
-
async function requestRollback({ client, deployId, project, timeout, }) {
|
248118
|
-
const { config, output } = client;
|
248119
|
-
const { contextName } = await (0, get_scope_1.default)(client);
|
248120
|
-
if (!(0, is_valid_name_1.isValidName)(deployId)) {
|
248121
|
-
output.error(`The provided argument "${deployId}" is not a valid deployment or project`);
|
248122
|
-
return 1;
|
248123
|
-
}
|
248124
|
-
let deployment;
|
248125
|
-
let team;
|
248126
|
-
try {
|
248127
|
-
output.spinner(`Fetching deployment "${deployId}" in ${chalk_1.default.bold(contextName)}…`);
|
248128
|
-
const [teamResult, deploymentResult] = await Promise.allSettled([
|
248129
|
-
config.currentTeam ? (0, get_team_by_id_1.default)(client, config.currentTeam) : undefined,
|
248130
|
-
(0, get_deployment_1.default)(client, contextName, deployId),
|
248131
|
-
]);
|
248132
|
-
if (teamResult.status === 'rejected') {
|
248133
|
-
output.error(`Failed to retrieve team information: ${teamResult.reason}`);
|
248134
|
-
return 1;
|
248135
|
-
}
|
248136
|
-
if (deploymentResult.status === 'rejected') {
|
248137
|
-
output.error(deploymentResult.reason);
|
248138
|
-
return 1;
|
248139
|
-
}
|
248140
|
-
team = teamResult.value;
|
248141
|
-
deployment = deploymentResult.value;
|
248142
|
-
// re-render the spinner text because it goes so fast
|
248143
|
-
output.log(`Fetching deployment "${deployId}" in ${chalk_1.default.bold(contextName)}…`);
|
248144
|
-
}
|
248145
|
-
finally {
|
248146
|
-
output.stopSpinner();
|
248147
|
-
}
|
248148
|
-
if (deployment.team?.id) {
|
248149
|
-
if (!team || deployment.team.id !== team.id) {
|
248150
|
-
output.error(team
|
248151
|
-
? `Deployment doesn't belong to current team ${chalk_1.default.bold(contextName)}`
|
248152
|
-
: `Deployment belongs to a different team`);
|
248153
|
-
output.error(`Use ${chalk_1.default.bold('vc switch')} to change your current team`);
|
248154
|
-
return 1;
|
248155
|
-
}
|
248913
|
+
return new errors_ts_1.CantParseJSONFile(file);
|
248156
248914
|
}
|
248157
|
-
|
248158
|
-
|
248159
|
-
|
248160
|
-
|
248915
|
+
}
|
248916
|
+
exports.default = readJSONFile;
|
248917
|
+
async function readFileSafe(file) {
|
248918
|
+
try {
|
248919
|
+
return await fs_extra_1.default.readFile(file, 'utf8');
|
248161
248920
|
}
|
248162
|
-
|
248163
|
-
|
248164
|
-
body: {},
|
248165
|
-
method: 'POST',
|
248166
|
-
});
|
248167
|
-
if (timeout !== undefined && (0, ms_1.default)(timeout) === 0) {
|
248168
|
-
output.log(`Successfully requested rollback of ${chalk_1.default.bold(project.name)} to ${deployment.url} (${deployment.id})`);
|
248169
|
-
output.log(`To check rollback status, run ${(0, pkg_name_1.getCommandName)('rollback')}.`);
|
248170
|
-
return 0;
|
248921
|
+
catch (_) {
|
248922
|
+
return null;
|
248171
248923
|
}
|
248172
|
-
// check the status
|
248173
|
-
return await (0, status_1.default)({
|
248174
|
-
client,
|
248175
|
-
contextName,
|
248176
|
-
deployment,
|
248177
|
-
project,
|
248178
|
-
timeout,
|
248179
|
-
});
|
248180
248924
|
}
|
248181
|
-
exports.default = requestRollback;
|
248182
248925
|
|
248183
248926
|
|
248184
248927
|
/***/ }),
|
248185
248928
|
|
248186
|
-
/***/
|
248929
|
+
/***/ 67911:
|
248187
248930
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
248188
248931
|
|
248189
248932
|
"use strict";
|
@@ -248192,150 +248935,122 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
248192
248935
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
248193
248936
|
};
|
248194
248937
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
248195
|
-
const chalk_1 = __importDefault(__webpack_require__(90877));
|
248196
|
-
const elapsed_1 = __importDefault(__webpack_require__(14099));
|
248197
|
-
const format_date_1 = __importDefault(__webpack_require__(738));
|
248198
|
-
const get_deployment_1 = __importDefault(__webpack_require__(84249));
|
248199
248938
|
const get_scope_1 = __importDefault(__webpack_require__(60324));
|
248200
|
-
const
|
248201
|
-
const
|
248202
|
-
|
248203
|
-
|
248204
|
-
|
248205
|
-
* taken longer than the timeout (default 3 minutes).
|
248206
|
-
* @param {Client} client - The Vercel client instance
|
248207
|
-
* @param {string} [contextName] - The scope name; if not specified, it will be
|
248208
|
-
* extracted from the `client`
|
248209
|
-
* @param {Deployment} [deployment] - Info about the deployment which is used
|
248210
|
-
* to display different output following a rollback request
|
248211
|
-
* @param {Project} project - Project info instance
|
248212
|
-
* @param {string} [timeout] - Milliseconds to poll for succeeded/failed state
|
248213
|
-
* @returns {Promise<number>} Resolves an exit code; 0 on success
|
248214
|
-
*/
|
248215
|
-
async function rollbackStatus({ client, contextName, deployment, project, timeout = '3m', }) {
|
248216
|
-
const { output } = client;
|
248217
|
-
const recentThreshold = Date.now() - (0, ms_1.default)('3m');
|
248218
|
-
const rollbackTimeout = Date.now() + (0, ms_1.default)(timeout);
|
248219
|
-
let counter = 0;
|
248220
|
-
let spinnerMessage = deployment
|
248221
|
-
? 'Rollback in progress'
|
248222
|
-
: `Checking rollback status of ${project.name}`;
|
248223
|
-
const check = async () => {
|
248224
|
-
const { lastRollbackTarget } = await client.fetch(`/v9/projects/${project.id}?rollbackInfo=true`);
|
248225
|
-
return lastRollbackTarget;
|
248226
|
-
};
|
248227
|
-
if (!contextName) {
|
248228
|
-
({ contextName } = await (0, get_scope_1.default)(client));
|
248229
|
-
}
|
248230
|
-
try {
|
248231
|
-
output.spinner(`${spinnerMessage}…`);
|
248232
|
-
// continuously loop until the rollback has explicitly succeeded, failed,
|
248233
|
-
// or timed out
|
248234
|
-
for (;;) {
|
248235
|
-
const { jobStatus, requestedAt, toDeploymentId } = (await check()) ?? {};
|
248236
|
-
if (!jobStatus ||
|
248237
|
-
(jobStatus !== 'in-progress' && jobStatus !== 'pending')) {
|
248238
|
-
output.stopSpinner();
|
248239
|
-
output.log(`${spinnerMessage}…`);
|
248240
|
-
}
|
248241
|
-
if (!jobStatus || requestedAt < recentThreshold) {
|
248242
|
-
output.log('No deployment rollback in progress');
|
248243
|
-
return 0;
|
248244
|
-
}
|
248245
|
-
if (jobStatus === 'skipped') {
|
248246
|
-
output.log('Rollback was skipped');
|
248247
|
-
return 0;
|
248248
|
-
}
|
248249
|
-
if (jobStatus === 'succeeded') {
|
248250
|
-
return await renderJobSucceeded({
|
248251
|
-
client,
|
248252
|
-
contextName,
|
248253
|
-
performingRollback: !!deployment,
|
248254
|
-
requestedAt,
|
248255
|
-
project,
|
248256
|
-
toDeploymentId,
|
248257
|
-
});
|
248258
|
-
}
|
248259
|
-
if (jobStatus === 'failed') {
|
248260
|
-
return await renderJobFailed({
|
248261
|
-
client,
|
248262
|
-
contextName,
|
248263
|
-
deployment,
|
248264
|
-
project,
|
248265
|
-
toDeploymentId,
|
248266
|
-
});
|
248267
|
-
}
|
248268
|
-
// lastly, if we're not pending/in-progress, then we don't know what
|
248269
|
-
// the status is, so bail
|
248270
|
-
if (jobStatus !== 'pending' && jobStatus !== 'in-progress') {
|
248271
|
-
output.log(`Unknown rollback status "${jobStatus}"`);
|
248272
|
-
return 1;
|
248273
|
-
}
|
248274
|
-
// check if we have been running for too long
|
248275
|
-
if (requestedAt < recentThreshold || Date.now() >= rollbackTimeout) {
|
248276
|
-
output.log(`The rollback exceeded its deadline - rerun ${chalk_1.default.bold(`vercel rollback ${toDeploymentId}`)} to try again`);
|
248277
|
-
return 1;
|
248278
|
-
}
|
248279
|
-
// if we've done our first poll and not rolling back, then print the
|
248280
|
-
// requested at date/time
|
248281
|
-
if (counter++ === 0 && !deployment) {
|
248282
|
-
spinnerMessage += ` requested at ${(0, format_date_1.default)(requestedAt)}`;
|
248283
|
-
}
|
248284
|
-
output.spinner(`${spinnerMessage}…`);
|
248285
|
-
await (0, sleep_1.default)(250);
|
248286
|
-
}
|
248287
|
-
}
|
248288
|
-
finally {
|
248289
|
-
output.stopSpinner();
|
248939
|
+
const get_args_1 = __importDefault(__webpack_require__(2505));
|
248940
|
+
const error_utils_1 = __webpack_require__(39799);
|
248941
|
+
async function reportError(sentry, client, error) {
|
248942
|
+
if (ignoreError(error)) {
|
248943
|
+
return;
|
248290
248944
|
}
|
248291
|
-
|
248292
|
-
|
248293
|
-
|
248294
|
-
const { output } = client;
|
248945
|
+
let user;
|
248946
|
+
let team;
|
248947
|
+
let scopeError;
|
248295
248948
|
try {
|
248296
|
-
|
248297
|
-
output.error(`Failed to remap all aliases to the requested deployment ${name} (${toDeploymentId})`);
|
248949
|
+
({ user, team } = await (0, get_scope_1.default)(client));
|
248298
248950
|
}
|
248299
|
-
catch (
|
248300
|
-
|
248951
|
+
catch (err) {
|
248952
|
+
// We can safely ignore this, as the error
|
248953
|
+
// reporting works even without this metadata attached.
|
248954
|
+
if ((0, error_utils_1.isError)(err)) {
|
248955
|
+
scopeError = err;
|
248956
|
+
}
|
248301
248957
|
}
|
248302
|
-
|
248303
|
-
|
248304
|
-
|
248305
|
-
|
248306
|
-
|
248307
|
-
|
248308
|
-
|
248958
|
+
sentry.withScope(scope => {
|
248959
|
+
if (user) {
|
248960
|
+
const spec = {
|
248961
|
+
email: user.email,
|
248962
|
+
id: user.id,
|
248963
|
+
username: user.username,
|
248964
|
+
name: user.name,
|
248965
|
+
};
|
248966
|
+
scope.setUser(spec);
|
248309
248967
|
}
|
248310
|
-
|
248311
|
-
|
248312
|
-
output.log(` ${(0, render_alias_status_1.default)(status).padEnd(11)} ${alias.alias} (${alias.deploymentId})`);
|
248968
|
+
if (team) {
|
248969
|
+
scope.setTag('currentTeam', team.id);
|
248313
248970
|
}
|
248314
|
-
if (
|
248315
|
-
|
248971
|
+
if (scopeError) {
|
248972
|
+
scope.setExtra('scopeError', {
|
248973
|
+
name: scopeError.name,
|
248974
|
+
message: scopeError.message,
|
248975
|
+
stack: scopeError.stack,
|
248976
|
+
});
|
248977
|
+
}
|
248978
|
+
// Report `process.argv` without sensitive data
|
248979
|
+
let args;
|
248980
|
+
let argsError;
|
248981
|
+
try {
|
248982
|
+
args = (0, get_args_1.default)(process.argv.slice(2), {});
|
248983
|
+
}
|
248984
|
+
catch (err) {
|
248985
|
+
if ((0, error_utils_1.isError)(err)) {
|
248986
|
+
argsError = err;
|
248987
|
+
}
|
248988
|
+
}
|
248989
|
+
if (args) {
|
248990
|
+
const flags = ['--env', '--build-env', '--token'];
|
248991
|
+
for (const flag of flags) {
|
248992
|
+
if (args[flag])
|
248993
|
+
args[flag] = 'REDACTED';
|
248994
|
+
}
|
248995
|
+
if (args._.length >= 4 &&
|
248996
|
+
args._[0].startsWith('secret') &&
|
248997
|
+
args._[1] === 'add') {
|
248998
|
+
args._[3] = 'REDACTED';
|
248999
|
+
}
|
249000
|
+
scope.setExtra('args', args);
|
248316
249001
|
}
|
248317
249002
|
else {
|
248318
|
-
|
249003
|
+
let msg = 'Unable to parse args';
|
249004
|
+
if (argsError) {
|
249005
|
+
msg += `: ${argsError}`;
|
249006
|
+
}
|
249007
|
+
scope.setExtra('args', msg);
|
248319
249008
|
}
|
249009
|
+
// Report information about the version of `node` being used
|
249010
|
+
scope.setExtra('node', {
|
249011
|
+
execPath: process.execPath,
|
249012
|
+
version: process.version,
|
249013
|
+
platform: process.platform,
|
249014
|
+
});
|
249015
|
+
sentry.captureException(error);
|
249016
|
+
});
|
249017
|
+
const sentryClient = sentry.getCurrentHub().getClient();
|
249018
|
+
if (sentryClient) {
|
249019
|
+
await sentryClient.close();
|
248320
249020
|
}
|
248321
|
-
return 1;
|
248322
249021
|
}
|
248323
|
-
|
248324
|
-
|
248325
|
-
|
248326
|
-
|
248327
|
-
|
248328
|
-
|
248329
|
-
|
248330
|
-
|
248331
|
-
|
248332
|
-
|
248333
|
-
|
249022
|
+
exports.default = reportError;
|
249023
|
+
function ignoreError(error) {
|
249024
|
+
return (0, error_utils_1.isError)(error) && error.message.includes('uv_cwd');
|
249025
|
+
}
|
249026
|
+
|
249027
|
+
|
249028
|
+
/***/ }),
|
249029
|
+
|
249030
|
+
/***/ 88817:
|
249031
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
249032
|
+
|
249033
|
+
"use strict";
|
249034
|
+
|
249035
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
249036
|
+
const errors_ts_1 = __webpack_require__(39240);
|
249037
|
+
async function responseError(res, fallbackMessage = null, parsedBody = {}) {
|
249038
|
+
let bodyError;
|
249039
|
+
if (!res.ok) {
|
249040
|
+
let body;
|
249041
|
+
try {
|
249042
|
+
body = await res.json();
|
249043
|
+
}
|
249044
|
+
catch (err) {
|
249045
|
+
body = parsedBody;
|
249046
|
+
}
|
249047
|
+
// Some APIs wrongly return `err` instead of `error`
|
249048
|
+
bodyError = body.error || body.err || body;
|
248334
249049
|
}
|
248335
|
-
const
|
248336
|
-
|
248337
|
-
return 0;
|
249050
|
+
const msg = bodyError?.message || fallbackMessage || 'Response Error';
|
249051
|
+
return new errors_ts_1.APIError(msg, res, bodyError);
|
248338
249052
|
}
|
249053
|
+
exports.default = responseError;
|
248339
249054
|
|
248340
249055
|
|
248341
249056
|
/***/ }),
|
@@ -248787,18 +249502,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
248787
249502
|
};
|
248788
249503
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
248789
249504
|
exports.validateRootDirectory = void 0;
|
248790
|
-
const
|
248791
|
-
const util_1 = __webpack_require__(31669);
|
249505
|
+
const fs_extra_1 = __webpack_require__(36365);
|
248792
249506
|
const chalk_1 = __importDefault(__webpack_require__(90877));
|
248793
249507
|
const os_1 = __webpack_require__(12087);
|
248794
249508
|
const confirm_1 = __importDefault(__webpack_require__(59320));
|
248795
249509
|
const humanize_path_1 = __importDefault(__webpack_require__(33234));
|
248796
|
-
const stat = (0, util_1.promisify)(fs_1.lstat);
|
248797
249510
|
/**
|
248798
249511
|
* A helper function to validate the `rootDirectory` input.
|
248799
249512
|
*/
|
248800
249513
|
async function validateRootDirectory(output, cwd, path, errorSuffix) {
|
248801
|
-
const pathStat = await
|
249514
|
+
const pathStat = await (0, fs_extra_1.lstat)(path).catch(() => null);
|
248802
249515
|
const suffix = errorSuffix ? ` ${errorSuffix}` : '';
|
248803
249516
|
if (!pathStat) {
|
248804
249517
|
output.error(`The provided path ${chalk_1.default.cyan(`“${(0, humanize_path_1.default)(path)}”`)} does not exist.${suffix}`);
|
@@ -248824,7 +249537,7 @@ async function validatePaths(client, paths) {
|
|
248824
249537
|
}
|
248825
249538
|
const path = paths[0];
|
248826
249539
|
// can only deploy a directory
|
248827
|
-
const pathStat = await
|
249540
|
+
const pathStat = await (0, fs_extra_1.lstat)(path).catch(() => null);
|
248828
249541
|
if (!pathStat) {
|
248829
249542
|
output.error(`Could not find ${chalk_1.default.cyan(`“${(0, humanize_path_1.default)(path)}”`)}`);
|
248830
249543
|
return { valid: false, exitCode: 1 };
|
@@ -249207,7 +249920,7 @@ module.exports = JSON.parse("[[[0,44],\"disallowed_STD3_valid\"],[[45,46],\"vali
|
|
249207
249920
|
/***/ ((module) => {
|
249208
249921
|
|
249209
249922
|
"use strict";
|
249210
|
-
module.exports = JSON.parse("{\"name\":\"@vercel/client\",\"version\":\"12.
|
249923
|
+
module.exports = JSON.parse("{\"name\":\"@vercel/client\",\"version\":\"12.6.1\",\"main\":\"dist/index.js\",\"typings\":\"dist/index.d.ts\",\"homepage\":\"https://vercel.com\",\"license\":\"Apache-2.0\",\"files\":[\"dist\"],\"repository\":{\"type\":\"git\",\"url\":\"https://github.com/vercel/vercel.git\",\"directory\":\"packages/client\"},\"scripts\":{\"build\":\"tsc\",\"test-e2e\":\"pnpm test tests/create-deployment.test.ts tests/create-legacy-deployment.test.ts tests/paths.test.ts\",\"test\":\"jest --env node --verbose --runInBand --bail\",\"test-unit\":\"pnpm test tests/unit.*test.*\"},\"engines\":{\"node\":\">= 14\"},\"devDependencies\":{\"@types/async-retry\":\"1.4.5\",\"@types/fs-extra\":\"7.0.0\",\"@types/jest\":\"27.4.1\",\"@types/minimatch\":\"3.0.5\",\"@types/ms\":\"0.7.30\",\"@types/node\":\"14.18.33\",\"@types/node-fetch\":\"2.5.4\",\"@types/recursive-readdir\":\"2.2.0\",\"@types/tar-fs\":\"1.16.1\",\"typescript\":\"4.9.5\"},\"dependencies\":{\"@vercel/build-utils\":\"6.7.4\",\"@vercel/routing-utils\":\"2.2.1\",\"@zeit/fetch\":\"5.2.0\",\"async-retry\":\"1.2.3\",\"async-sema\":\"3.0.0\",\"fs-extra\":\"8.0.1\",\"ignore\":\"4.0.6\",\"minimatch\":\"5.0.1\",\"ms\":\"2.1.2\",\"node-fetch\":\"2.6.7\",\"querystring\":\"^0.2.0\",\"sleep-promise\":\"8.0.1\",\"tar-fs\":\"1.16.3\"}}");
|
249211
249924
|
|
249212
249925
|
/***/ }),
|
249213
249926
|
|