vercel 28.6.0 → 28.7.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 +426 -17
- package/package.json +6 -6
package/dist/index.js
CHANGED
@@ -214464,17 +214464,10 @@ exports.frameworks = [
|
|
214464
214464
|
getOutputDirName: async () => 'dist',
|
214465
214465
|
defaultRoutes: [
|
214466
214466
|
{
|
214467
|
-
src: '^/
|
214467
|
+
src: '^/assets/(.*)$',
|
214468
214468
|
headers: { 'cache-control': 'public, max-age=31536000, immutable' },
|
214469
214469
|
continue: true,
|
214470
214470
|
},
|
214471
|
-
{
|
214472
|
-
handle: 'filesystem',
|
214473
|
-
},
|
214474
|
-
{
|
214475
|
-
src: '/(.*)',
|
214476
|
-
dest: '/index.html',
|
214477
|
-
},
|
214478
214471
|
],
|
214479
214472
|
},
|
214480
214473
|
{
|
@@ -234726,6 +234719,7 @@ const help = () => `
|
|
234726
234719
|
login [email] Logs into your account or creates a new one
|
234727
234720
|
logout Logs out of your account
|
234728
234721
|
pull [path] Pull your Project Settings from the cloud
|
234722
|
+
rollback [url|id] Quickly revert back to a previous deployment [beta]
|
234729
234723
|
switch [scope] Switches between teams and your personal account
|
234730
234724
|
|
234731
234725
|
${chalk_1.default.dim('Advanced')}
|
@@ -235432,6 +235426,7 @@ async function dev(client, opts, args) {
|
|
235432
235426
|
if (link.status === 'not_linked' && !process.env.__VERCEL_SKIP_DEV_CMD) {
|
235433
235427
|
link = await (0, setup_and_link_1.default)(client, cwd, {
|
235434
235428
|
autoConfirm: opts['--yes'],
|
235429
|
+
link,
|
235435
235430
|
successEmoji: 'link',
|
235436
235431
|
setupMsg: 'Set up and develop',
|
235437
235432
|
});
|
@@ -238028,6 +238023,7 @@ exports.default = new Map([
|
|
238028
238023
|
['pull', 'pull'],
|
238029
238024
|
['remove', 'remove'],
|
238030
238025
|
['rm', 'remove'],
|
238026
|
+
['rollback', 'rollback'],
|
238031
238027
|
['secret', 'secrets'],
|
238032
238028
|
['secrets', 'secrets'],
|
238033
238029
|
['switch', 'teams'],
|
@@ -238666,6 +238662,7 @@ async function main(client) {
|
|
238666
238662
|
if (status === 'not_linked' && !app) {
|
238667
238663
|
const linkedProject = await (0, ensure_link_1.ensureLink)('list', client, path, {
|
238668
238664
|
autoConfirm,
|
238665
|
+
link,
|
238669
238666
|
});
|
238670
238667
|
if (typeof linkedProject === 'number') {
|
238671
238668
|
return linkedProject;
|
@@ -239976,6 +239973,117 @@ function deploymentsAndProjects(deployments, projects, conjunction = 'and') {
|
|
239976
239973
|
}
|
239977
239974
|
|
239978
239975
|
|
239976
|
+
/***/ }),
|
239977
|
+
|
239978
|
+
/***/ 67121:
|
239979
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
239980
|
+
|
239981
|
+
"use strict";
|
239982
|
+
|
239983
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
239984
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
239985
|
+
};
|
239986
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
239987
|
+
const chalk_1 = __importDefault(__webpack_require__(961));
|
239988
|
+
const ensure_link_1 = __webpack_require__(3502);
|
239989
|
+
const get_args_1 = __importDefault(__webpack_require__(87612));
|
239990
|
+
const pkg_name_1 = __webpack_require__(98106);
|
239991
|
+
const handle_error_1 = __importDefault(__webpack_require__(70870));
|
239992
|
+
const logo_1 = __importDefault(__webpack_require__(9829));
|
239993
|
+
const ms_1 = __importDefault(__webpack_require__(80040));
|
239994
|
+
const request_rollback_1 = __importDefault(__webpack_require__(96011));
|
239995
|
+
const status_1 = __importDefault(__webpack_require__(76939));
|
239996
|
+
const validate_paths_1 = __importDefault(__webpack_require__(54579));
|
239997
|
+
const help = () => {
|
239998
|
+
console.log(`
|
239999
|
+
${chalk_1.default.bold(`${logo_1.default} ${(0, pkg_name_1.getPkgName)()} rollback`)} [deploymentId|deploymentName]
|
240000
|
+
|
240001
|
+
Quickly revert back to a previous deployment.
|
240002
|
+
|
240003
|
+
${chalk_1.default.dim('Options:')}
|
240004
|
+
|
240005
|
+
-h, --help Output usage information
|
240006
|
+
-A ${chalk_1.default.bold.underline('FILE')}, --local-config=${chalk_1.default.bold.underline('FILE')} Path to the local ${'`vercel.json`'} file
|
240007
|
+
-Q ${chalk_1.default.bold.underline('DIR')}, --global-config=${chalk_1.default.bold.underline('DIR')} Path to the global ${'`.vercel`'} directory
|
240008
|
+
-d, --debug Debug mode [off]
|
240009
|
+
-t ${chalk_1.default.bold.underline('TOKEN')}, --token=${chalk_1.default.bold.underline('TOKEN')} Login token
|
240010
|
+
--timeout=${chalk_1.default.bold.underline('TIME')} Time to wait for rollback completion [3m]
|
240011
|
+
-y, --yes Skip questions when setting up new project using default scope and settings
|
240012
|
+
|
240013
|
+
${chalk_1.default.dim('Examples:')}
|
240014
|
+
|
240015
|
+
${chalk_1.default.gray('–')} Show the status of any current pending rollbacks
|
240016
|
+
|
240017
|
+
${chalk_1.default.cyan(`$ ${(0, pkg_name_1.getPkgName)()} rollback`)}
|
240018
|
+
${chalk_1.default.cyan(`$ ${(0, pkg_name_1.getPkgName)()} rollback status`)}
|
240019
|
+
${chalk_1.default.cyan(`$ ${(0, pkg_name_1.getPkgName)()} rollback status --timeout 30s`)}
|
240020
|
+
|
240021
|
+
${chalk_1.default.gray('–')} Rollback a deployment using id or url
|
240022
|
+
|
240023
|
+
${chalk_1.default.cyan(`$ ${(0, pkg_name_1.getPkgName)()} rollback <deployment id/url>`)}
|
240024
|
+
`);
|
240025
|
+
};
|
240026
|
+
/**
|
240027
|
+
* `vc rollback` command
|
240028
|
+
* @param {Client} client
|
240029
|
+
* @returns {Promise<number>} Resolves an exit code; 0 on success
|
240030
|
+
*/
|
240031
|
+
exports.default = async (client) => {
|
240032
|
+
let argv;
|
240033
|
+
try {
|
240034
|
+
argv = (0, get_args_1.default)(client.argv.slice(2), {
|
240035
|
+
'--debug': Boolean,
|
240036
|
+
'-d': '--debug',
|
240037
|
+
'--timeout': String,
|
240038
|
+
'--yes': Boolean,
|
240039
|
+
'-y': '--yes',
|
240040
|
+
});
|
240041
|
+
}
|
240042
|
+
catch (err) {
|
240043
|
+
(0, handle_error_1.default)(err);
|
240044
|
+
return 1;
|
240045
|
+
}
|
240046
|
+
if (argv['--help'] || argv._[0] === 'help') {
|
240047
|
+
help();
|
240048
|
+
return 2;
|
240049
|
+
}
|
240050
|
+
// ensure the current directory is good
|
240051
|
+
const cwd = argv['--cwd'] || process.cwd();
|
240052
|
+
const pathValidation = await (0, validate_paths_1.default)(client, [cwd]);
|
240053
|
+
if (!pathValidation.valid) {
|
240054
|
+
return pathValidation.exitCode;
|
240055
|
+
}
|
240056
|
+
// ensure the current directory is a linked project
|
240057
|
+
const linkedProject = await (0, ensure_link_1.ensureLink)('rollback', client, pathValidation.path, {
|
240058
|
+
autoConfirm: Boolean(argv['--yes']),
|
240059
|
+
});
|
240060
|
+
if (typeof linkedProject === 'number') {
|
240061
|
+
return linkedProject;
|
240062
|
+
}
|
240063
|
+
// validate the timeout
|
240064
|
+
let timeout = argv['--timeout'];
|
240065
|
+
if (timeout && (0, ms_1.default)(timeout) === undefined) {
|
240066
|
+
client.output.error(`Invalid timeout "${timeout}"`);
|
240067
|
+
return 1;
|
240068
|
+
}
|
240069
|
+
const { project } = linkedProject;
|
240070
|
+
const actionOrDeployId = argv._[1] || 'status';
|
240071
|
+
if (actionOrDeployId === 'status') {
|
240072
|
+
return await (0, status_1.default)({
|
240073
|
+
client,
|
240074
|
+
project,
|
240075
|
+
timeout,
|
240076
|
+
});
|
240077
|
+
}
|
240078
|
+
return await (0, request_rollback_1.default)({
|
240079
|
+
client,
|
240080
|
+
deployId: actionOrDeployId,
|
240081
|
+
project,
|
240082
|
+
timeout,
|
240083
|
+
});
|
240084
|
+
};
|
240085
|
+
|
240086
|
+
|
239979
240087
|
/***/ }),
|
239980
240088
|
|
239981
240089
|
/***/ 23968:
|
@@ -240810,7 +240918,7 @@ const main = async () => {
|
|
240810
240918
|
// * a subcommand (as in: `vercel ls`)
|
240811
240919
|
const targetOrSubcommand = argv._[2];
|
240812
240920
|
// Currently no beta commands - add here as needed
|
240813
|
-
const betaCommands = [];
|
240921
|
+
const betaCommands = ['rollback'];
|
240814
240922
|
if (betaCommands.includes(targetOrSubcommand)) {
|
240815
240923
|
console.log(`${chalk_1.default.grey(`${(0, pkg_name_1.getTitleName)()} CLI ${pkg_1.default.version} ${targetOrSubcommand} (beta) — https://vercel.com/feedback`)}`);
|
240816
240924
|
}
|
@@ -241115,6 +241223,9 @@ const main = async () => {
|
|
241115
241223
|
case 'remove':
|
241116
241224
|
func = __webpack_require__(28709).default;
|
241117
241225
|
break;
|
241226
|
+
case 'rollback':
|
241227
|
+
func = __webpack_require__(67121).default;
|
241228
|
+
break;
|
241118
241229
|
case 'secrets':
|
241119
241230
|
func = __webpack_require__(37523)/* .default */ .Z;
|
241120
241231
|
break;
|
@@ -249370,7 +249481,7 @@ class DeploymentNotFound extends now_error_1.NowError {
|
|
249370
249481
|
super({
|
249371
249482
|
code: 'DEPLOYMENT_NOT_FOUND',
|
249372
249483
|
meta: { id, context },
|
249373
|
-
message: `Can't find the deployment ${id} under the context ${context}`,
|
249484
|
+
message: `Can't find the deployment "${id}" under the context "${context}"`,
|
249374
249485
|
});
|
249375
249486
|
}
|
249376
249487
|
}
|
@@ -252518,7 +252629,11 @@ const link_1 = __webpack_require__(67630);
|
|
252518
252629
|
* error, otherwise an object containing the org an project
|
252519
252630
|
*/
|
252520
252631
|
async function ensureLink(commandName, client, cwd, opts) {
|
252521
|
-
let link =
|
252632
|
+
let { link } = opts;
|
252633
|
+
if (!link) {
|
252634
|
+
link = await (0, link_1.getLinkedProject)(client, cwd);
|
252635
|
+
opts.link = link;
|
252636
|
+
}
|
252522
252637
|
if ((link.status === 'linked' && opts.forceDelete) ||
|
252523
252638
|
link.status === 'not_linked') {
|
252524
252639
|
link = await (0, setup_and_link_1.default)(client, cwd, opts);
|
@@ -252568,7 +252683,7 @@ const stamp_1 = __importDefault(__webpack_require__(92205));
|
|
252568
252683
|
const create_deploy_1 = __importDefault(__webpack_require__(80974));
|
252569
252684
|
const index_1 = __importDefault(__webpack_require__(60487));
|
252570
252685
|
const errors_ts_1 = __webpack_require__(60156);
|
252571
|
-
async function setupAndLink(client, path, {
|
252686
|
+
async function setupAndLink(client, path, { autoConfirm = false, forceDelete = false, link, successEmoji = 'link', setupMsg = 'Set up', projectName, }) {
|
252572
252687
|
const { localConfig, output, config } = client;
|
252573
252688
|
const debug = output.isDebugEnabled();
|
252574
252689
|
const isFile = !(0, global_path_1.isDirectory)(path);
|
@@ -252576,7 +252691,9 @@ async function setupAndLink(client, path, { forceDelete = false, autoConfirm = f
|
|
252576
252691
|
output.error(`Expected directory but found file: ${path}`);
|
252577
252692
|
return { status: 'error', exitCode: 1, reason: 'PATH_IS_FILE' };
|
252578
252693
|
}
|
252579
|
-
|
252694
|
+
if (!link) {
|
252695
|
+
link = await (0, link_1.getLinkedProject)(client, path);
|
252696
|
+
}
|
252580
252697
|
const isTTY = client.stdin.isTTY;
|
252581
252698
|
const quiet = !isTTY;
|
252582
252699
|
let rootDirectory = null;
|
@@ -254654,9 +254771,7 @@ async function getLinkedProject(client, path) {
|
|
254654
254771
|
})})\n`);
|
254655
254772
|
return { status: 'error', exitCode: 1 };
|
254656
254773
|
}
|
254657
|
-
|
254658
|
-
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')));
|
254659
|
-
}
|
254774
|
+
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')));
|
254660
254775
|
return { status: 'not_linked', org: null, project: null };
|
254661
254776
|
}
|
254662
254777
|
return { status: 'linked', org, project };
|
@@ -255063,6 +255178,300 @@ async function responseError(res, fallbackMessage = null, parsedBody = {}) {
|
|
255063
255178
|
exports.default = responseError;
|
255064
255179
|
|
255065
255180
|
|
255181
|
+
/***/ }),
|
255182
|
+
|
255183
|
+
/***/ 48752:
|
255184
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
255185
|
+
|
255186
|
+
"use strict";
|
255187
|
+
|
255188
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
255189
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
255190
|
+
};
|
255191
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
255192
|
+
const get_deployment_by_id_or_host_1 = __importDefault(__webpack_require__(71698));
|
255193
|
+
const handle_cert_error_1 = __importDefault(__webpack_require__(65214));
|
255194
|
+
/**
|
255195
|
+
* Attempts to find the deployment by name or id.
|
255196
|
+
* @param {Client} client - The Vercel client instance
|
255197
|
+
* @param {string} contextName - The scope name
|
255198
|
+
* @param {string} deployId - The deployment name or id to rollback
|
255199
|
+
* @returns {Promise<Deployment>} Resolves an exit code or deployment info
|
255200
|
+
*/
|
255201
|
+
async function getDeploymentInfo(client, contextName, deployId) {
|
255202
|
+
const deployment = (0, handle_cert_error_1.default)(client.output, await (0, get_deployment_by_id_or_host_1.default)(client, contextName, deployId));
|
255203
|
+
if (deployment === 1) {
|
255204
|
+
throw new Error(`Failed to get deployment "${deployId}" in scope "${contextName}"`);
|
255205
|
+
}
|
255206
|
+
if (deployment instanceof Error) {
|
255207
|
+
throw deployment;
|
255208
|
+
}
|
255209
|
+
if (!deployment) {
|
255210
|
+
throw new Error(`Couldn't find the deployment "${deployId}"`);
|
255211
|
+
}
|
255212
|
+
return deployment;
|
255213
|
+
}
|
255214
|
+
exports.default = getDeploymentInfo;
|
255215
|
+
|
255216
|
+
|
255217
|
+
/***/ }),
|
255218
|
+
|
255219
|
+
/***/ 85248:
|
255220
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
255221
|
+
|
255222
|
+
"use strict";
|
255223
|
+
|
255224
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
255225
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
255226
|
+
};
|
255227
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
255228
|
+
const chalk_1 = __importDefault(__webpack_require__(961));
|
255229
|
+
/**
|
255230
|
+
* Stylize the alias status label.
|
255231
|
+
* @param {AliasStatus} status - The status label
|
255232
|
+
* @returns {string}
|
255233
|
+
*/
|
255234
|
+
function renderAliasStatus(status) {
|
255235
|
+
if (status === 'completed') {
|
255236
|
+
return chalk_1.default.green(status);
|
255237
|
+
}
|
255238
|
+
if (status === 'failed') {
|
255239
|
+
return chalk_1.default.red(status);
|
255240
|
+
}
|
255241
|
+
if (status === 'skipped') {
|
255242
|
+
return chalk_1.default.gray(status);
|
255243
|
+
}
|
255244
|
+
return chalk_1.default.yellow(status);
|
255245
|
+
}
|
255246
|
+
exports.default = renderAliasStatus;
|
255247
|
+
|
255248
|
+
|
255249
|
+
/***/ }),
|
255250
|
+
|
255251
|
+
/***/ 96011:
|
255252
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
255253
|
+
|
255254
|
+
"use strict";
|
255255
|
+
|
255256
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
255257
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
255258
|
+
};
|
255259
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
255260
|
+
const chalk_1 = __importDefault(__webpack_require__(961));
|
255261
|
+
const pkg_name_1 = __webpack_require__(98106);
|
255262
|
+
const get_deployment_info_1 = __importDefault(__webpack_require__(48752));
|
255263
|
+
const get_scope_1 = __importDefault(__webpack_require__(73389));
|
255264
|
+
const is_valid_name_1 = __webpack_require__(31315);
|
255265
|
+
const ms_1 = __importDefault(__webpack_require__(80040));
|
255266
|
+
const status_1 = __importDefault(__webpack_require__(76939));
|
255267
|
+
/**
|
255268
|
+
* Requests a rollback and waits for it complete.
|
255269
|
+
* @param {Client} client - The Vercel client instance
|
255270
|
+
* @param {string} deployId - The deployment name or id to rollback
|
255271
|
+
* @param {Project} project - Project info instance
|
255272
|
+
* @param {string} [timeout] - Time to poll for succeeded/failed state
|
255273
|
+
* @returns {Promise<number>} Resolves an exit code; 0 on success
|
255274
|
+
*/
|
255275
|
+
async function requestRollback({ client, deployId, project, timeout, }) {
|
255276
|
+
const { output } = client;
|
255277
|
+
const { contextName } = await (0, get_scope_1.default)(client);
|
255278
|
+
if (!(0, is_valid_name_1.isValidName)(deployId)) {
|
255279
|
+
output.error(`The provided argument "${deployId}" is not a valid deployment or project`);
|
255280
|
+
return 1;
|
255281
|
+
}
|
255282
|
+
output.spinner(`Fetching deployment "${deployId}" in ${chalk_1.default.bold(contextName)}…`);
|
255283
|
+
let deployment;
|
255284
|
+
try {
|
255285
|
+
deployment = await (0, get_deployment_info_1.default)(client, contextName, deployId);
|
255286
|
+
}
|
255287
|
+
catch (err) {
|
255288
|
+
output.error(err?.toString() || err);
|
255289
|
+
return 1;
|
255290
|
+
}
|
255291
|
+
finally {
|
255292
|
+
output.stopSpinner();
|
255293
|
+
// re-render the spinner text because it goes so fast
|
255294
|
+
output.log(`Fetching deployment "${deployId}" in ${chalk_1.default.bold(contextName)}…`);
|
255295
|
+
}
|
255296
|
+
// create the rollback
|
255297
|
+
await client.fetch(`/v9/projects/${project.id}/rollback/${deployment.uid}`, {
|
255298
|
+
body: {},
|
255299
|
+
method: 'POST',
|
255300
|
+
});
|
255301
|
+
if (timeout !== undefined && (0, ms_1.default)(timeout) === 0) {
|
255302
|
+
output.log(`Successfully requested rollback of ${chalk_1.default.bold(project.name)} to ${deployment.url} (${deployment.uid})`);
|
255303
|
+
output.log(`To check rollback status, run ${(0, pkg_name_1.getCommandName)('rollback')}.`);
|
255304
|
+
return 0;
|
255305
|
+
}
|
255306
|
+
// check the status
|
255307
|
+
return await (0, status_1.default)({
|
255308
|
+
client,
|
255309
|
+
contextName,
|
255310
|
+
deployment,
|
255311
|
+
project,
|
255312
|
+
timeout,
|
255313
|
+
});
|
255314
|
+
}
|
255315
|
+
exports.default = requestRollback;
|
255316
|
+
|
255317
|
+
|
255318
|
+
/***/ }),
|
255319
|
+
|
255320
|
+
/***/ 76939:
|
255321
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
255322
|
+
|
255323
|
+
"use strict";
|
255324
|
+
|
255325
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
255326
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
255327
|
+
};
|
255328
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
255329
|
+
const chalk_1 = __importDefault(__webpack_require__(961));
|
255330
|
+
const elapsed_1 = __importDefault(__webpack_require__(65303));
|
255331
|
+
const format_date_1 = __importDefault(__webpack_require__(17215));
|
255332
|
+
const get_deployment_info_1 = __importDefault(__webpack_require__(48752));
|
255333
|
+
const get_scope_1 = __importDefault(__webpack_require__(73389));
|
255334
|
+
const ms_1 = __importDefault(__webpack_require__(80040));
|
255335
|
+
const render_alias_status_1 = __importDefault(__webpack_require__(85248));
|
255336
|
+
const sleep_1 = __importDefault(__webpack_require__(35873));
|
255337
|
+
/**
|
255338
|
+
* Continuously checks a deployment status until it has succeeded, failed, or
|
255339
|
+
* taken longer than the timeout (default 3 minutes).
|
255340
|
+
* @param {Client} client - The Vercel client instance
|
255341
|
+
* @param {string} [contextName] - The scope name; if not specified, it will be
|
255342
|
+
* extracted from the `client`
|
255343
|
+
* @param {Deployment} [deployment] - Info about the deployment which is used
|
255344
|
+
* to display different output following a rollback request
|
255345
|
+
* @param {Project} project - Project info instance
|
255346
|
+
* @param {string} [timeout] - Milliseconds to poll for succeeded/failed state
|
255347
|
+
* @returns {Promise<number>} Resolves an exit code; 0 on success
|
255348
|
+
*/
|
255349
|
+
async function rollbackStatus({ client, contextName, deployment, project, timeout = '3m', }) {
|
255350
|
+
const { output } = client;
|
255351
|
+
const recentThreshold = Date.now() - (0, ms_1.default)('3m');
|
255352
|
+
const rollbackTimeout = Date.now() + (0, ms_1.default)(timeout);
|
255353
|
+
let counter = 0;
|
255354
|
+
let spinnerMessage = deployment
|
255355
|
+
? 'Rollback in progress'
|
255356
|
+
: `Checking rollback status of ${project.name}`;
|
255357
|
+
const check = async () => {
|
255358
|
+
const { lastRollbackTarget } = await client.fetch(`/v9/projects/${project.id}?rollbackInfo=true`);
|
255359
|
+
return lastRollbackTarget;
|
255360
|
+
};
|
255361
|
+
if (!contextName) {
|
255362
|
+
({ contextName } = await (0, get_scope_1.default)(client));
|
255363
|
+
}
|
255364
|
+
try {
|
255365
|
+
output.spinner(`${spinnerMessage}…`);
|
255366
|
+
// continuously loop until the rollback has explicitly succeeded, failed,
|
255367
|
+
// or timed out
|
255368
|
+
for (;;) {
|
255369
|
+
const { jobStatus, requestedAt, toDeploymentId } = (await check()) ?? {};
|
255370
|
+
if (!jobStatus ||
|
255371
|
+
(jobStatus !== 'in-progress' && jobStatus !== 'pending')) {
|
255372
|
+
output.stopSpinner();
|
255373
|
+
output.log(`${spinnerMessage}…`);
|
255374
|
+
}
|
255375
|
+
if (!jobStatus || requestedAt < recentThreshold) {
|
255376
|
+
output.log('No deployment rollback in progress');
|
255377
|
+
return 0;
|
255378
|
+
}
|
255379
|
+
if (jobStatus === 'skipped') {
|
255380
|
+
output.log('Rollback was skipped');
|
255381
|
+
return 0;
|
255382
|
+
}
|
255383
|
+
if (jobStatus === 'succeeded') {
|
255384
|
+
return await renderJobSucceeded({
|
255385
|
+
client,
|
255386
|
+
contextName,
|
255387
|
+
performingRollback: !!deployment,
|
255388
|
+
requestedAt,
|
255389
|
+
project,
|
255390
|
+
toDeploymentId,
|
255391
|
+
});
|
255392
|
+
}
|
255393
|
+
if (jobStatus === 'failed') {
|
255394
|
+
return await renderJobFailed({
|
255395
|
+
client,
|
255396
|
+
contextName,
|
255397
|
+
deployment,
|
255398
|
+
project,
|
255399
|
+
toDeploymentId,
|
255400
|
+
});
|
255401
|
+
}
|
255402
|
+
// lastly, if we're not pending/in-progress, then we don't know what
|
255403
|
+
// the status is, so bail
|
255404
|
+
if (jobStatus !== 'pending' && jobStatus !== 'in-progress') {
|
255405
|
+
output.log(`Unknown rollback status "${jobStatus}"`);
|
255406
|
+
return 1;
|
255407
|
+
}
|
255408
|
+
// check if we have been running for too long
|
255409
|
+
if (requestedAt < recentThreshold || Date.now() >= rollbackTimeout) {
|
255410
|
+
output.log(`The rollback exceeded its deadline - rerun ${chalk_1.default.bold(`vercel rollback ${toDeploymentId}`)} to try again`);
|
255411
|
+
return 1;
|
255412
|
+
}
|
255413
|
+
// if we've done our first poll and not rolling back, then print the
|
255414
|
+
// requested at date/time
|
255415
|
+
if (counter++ === 0 && !deployment) {
|
255416
|
+
spinnerMessage += ` requested at ${(0, format_date_1.default)(requestedAt)}`;
|
255417
|
+
}
|
255418
|
+
output.spinner(`${spinnerMessage}…`);
|
255419
|
+
await (0, sleep_1.default)(250);
|
255420
|
+
}
|
255421
|
+
}
|
255422
|
+
finally {
|
255423
|
+
output.stopSpinner();
|
255424
|
+
}
|
255425
|
+
}
|
255426
|
+
exports.default = rollbackStatus;
|
255427
|
+
async function renderJobFailed({ client, contextName, deployment, project, toDeploymentId, }) {
|
255428
|
+
const { output } = client;
|
255429
|
+
try {
|
255430
|
+
const name = (deployment ||
|
255431
|
+
(await (0, get_deployment_info_1.default)(client, contextName, toDeploymentId)))?.url;
|
255432
|
+
output.error(`Failed to remap all aliases to the requested deployment ${name} (${toDeploymentId})`);
|
255433
|
+
}
|
255434
|
+
catch (e) {
|
255435
|
+
output.error(`Failed to remap all aliases to the requested deployment ${toDeploymentId}`);
|
255436
|
+
}
|
255437
|
+
// aliases are paginated, so continuously loop until all of them have been
|
255438
|
+
// fetched
|
255439
|
+
let nextTimestamp;
|
255440
|
+
for (;;) {
|
255441
|
+
let url = `/v9/projects/${project.id}/rollback/aliases?failedOnly=true&limit=20`;
|
255442
|
+
if (nextTimestamp) {
|
255443
|
+
url += `&until=${nextTimestamp}`;
|
255444
|
+
}
|
255445
|
+
const { aliases, pagination } = await client.fetch(url);
|
255446
|
+
for (const { alias, status } of aliases) {
|
255447
|
+
output.log(` ${(0, render_alias_status_1.default)(status).padEnd(11)} ${alias.alias} (${alias.deploymentId})`);
|
255448
|
+
}
|
255449
|
+
if (pagination?.next) {
|
255450
|
+
nextTimestamp = pagination.next;
|
255451
|
+
}
|
255452
|
+
else {
|
255453
|
+
break;
|
255454
|
+
}
|
255455
|
+
}
|
255456
|
+
return 1;
|
255457
|
+
}
|
255458
|
+
async function renderJobSucceeded({ client, contextName, performingRollback, project, requestedAt, toDeploymentId, }) {
|
255459
|
+
const { output } = client;
|
255460
|
+
let deploymentInfo = '';
|
255461
|
+
try {
|
255462
|
+
const deployment = await (0, get_deployment_info_1.default)(client, contextName, toDeploymentId);
|
255463
|
+
deploymentInfo = `${chalk_1.default.bold(deployment.url)} (${toDeploymentId})`;
|
255464
|
+
}
|
255465
|
+
catch (err) {
|
255466
|
+
output.debug(`Failed to get deployment url for ${toDeploymentId}: ${err?.toString() || err}`);
|
255467
|
+
deploymentInfo = chalk_1.default.bold(toDeploymentId);
|
255468
|
+
}
|
255469
|
+
const duration = performingRollback ? (0, elapsed_1.default)(Date.now() - requestedAt) : '';
|
255470
|
+
output.log(`Success! ${chalk_1.default.bold(project.name)} was rolled back to ${deploymentInfo} ${duration}`);
|
255471
|
+
return 0;
|
255472
|
+
}
|
255473
|
+
|
255474
|
+
|
255066
255475
|
/***/ }),
|
255067
255476
|
|
255068
255477
|
/***/ 35873:
|
@@ -255897,7 +256306,7 @@ module.exports = JSON.parse("{\"application/1d-interleaved-parityfec\":{\"source
|
|
255897
256306
|
/***/ ((module) => {
|
255898
256307
|
|
255899
256308
|
"use strict";
|
255900
|
-
module.exports = JSON.parse("{\"name\":\"vercel\",\"version\":\"28.
|
256309
|
+
module.exports = JSON.parse("{\"name\":\"vercel\",\"version\":\"28.7.0\",\"preferGlobal\":true,\"license\":\"Apache-2.0\",\"description\":\"The command-line interface for Vercel\",\"homepage\":\"https://vercel.com\",\"repository\":{\"type\":\"git\",\"url\":\"https://github.com/vercel/vercel.git\",\"directory\":\"packages/cli\"},\"scripts\":{\"preinstall\":\"node ./scripts/preinstall.js\",\"test\":\"jest --env node --verbose --bail\",\"test-unit\":\"yarn test test/unit/\",\"test-integration-cli\":\"rimraf test/fixtures/integration && ava test/integration.js --serial --fail-fast --verbose\",\"test-integration-dev\":\"yarn test test/dev/\",\"coverage\":\"codecov\",\"build\":\"ts-node ./scripts/build.ts\",\"dev\":\"ts-node ./src/index.ts\"},\"bin\":{\"vc\":\"./dist/index.js\",\"vercel\":\"./dist/index.js\"},\"files\":[\"dist\",\"scripts/preinstall.js\"],\"ava\":{\"extensions\":[\"ts\"],\"require\":[\"ts-node/register/transpile-only\",\"esm\"]},\"engines\":{\"node\":\">= 14\"},\"dependencies\":{\"@vercel/build-utils\":\"5.6.0\",\"@vercel/go\":\"2.2.18\",\"@vercel/hydrogen\":\"0.0.32\",\"@vercel/next\":\"3.3.1\",\"@vercel/node\":\"2.7.0\",\"@vercel/python\":\"3.1.28\",\"@vercel/redwood\":\"1.0.38\",\"@vercel/remix\":\"1.1.0\",\"@vercel/ruby\":\"1.3.44\",\"@vercel/static-build\":\"1.0.41\",\"update-notifier\":\"5.1.0\"},\"devDependencies\":{\"@alex_neo/jest-expect-message\":\"1.0.5\",\"@next/env\":\"11.1.2\",\"@sentry/node\":\"5.5.0\",\"@sindresorhus/slugify\":\"0.11.0\",\"@swc/core\":\"1.2.218\",\"@tootallnate/once\":\"1.1.2\",\"@types/ansi-escapes\":\"3.0.0\",\"@types/ansi-regex\":\"4.0.0\",\"@types/async-retry\":\"1.2.1\",\"@types/bytes\":\"3.0.0\",\"@types/chance\":\"1.1.3\",\"@types/debug\":\"0.0.31\",\"@types/dotenv\":\"6.1.1\",\"@types/escape-html\":\"0.0.20\",\"@types/express\":\"4.17.13\",\"@types/fs-extra\":\"9.0.13\",\"@types/glob\":\"7.1.1\",\"@types/http-proxy\":\"1.16.2\",\"@types/ini\":\"1.3.31\",\"@types/inquirer\":\"7.3.1\",\"@types/jest\":\"27.4.1\",\"@types/jest-expect-message\":\"1.0.3\",\"@types/load-json-file\":\"2.0.7\",\"@types/mime-types\":\"2.1.0\",\"@types/minimatch\":\"3.0.3\",\"@types/mri\":\"1.1.0\",\"@types/ms\":\"0.7.30\",\"@types/node\":\"14.18.33\",\"@types/node-fetch\":\"2.5.10\",\"@types/npm-package-arg\":\"6.1.0\",\"@types/pluralize\":\"0.0.29\",\"@types/psl\":\"1.1.0\",\"@types/semver\":\"6.0.1\",\"@types/tar-fs\":\"1.16.1\",\"@types/text-table\":\"0.2.0\",\"@types/title\":\"3.4.1\",\"@types/universal-analytics\":\"0.4.2\",\"@types/update-notifier\":\"5.1.0\",\"@types/which\":\"1.3.2\",\"@types/write-json-file\":\"2.2.1\",\"@types/yauzl-promise\":\"2.1.0\",\"@vercel/client\":\"12.2.20\",\"@vercel/error-utils\":\"1.0.3\",\"@vercel/frameworks\":\"1.1.14\",\"@vercel/fs-detectors\":\"3.5.4\",\"@vercel/fun\":\"1.0.4\",\"@vercel/ncc\":\"0.24.0\",\"@zeit/source-map-support\":\"0.6.2\",\"ajv\":\"6.12.2\",\"alpha-sort\":\"2.0.1\",\"ansi-escapes\":\"3.0.0\",\"ansi-regex\":\"3.0.0\",\"arg\":\"5.0.0\",\"async-listen\":\"1.2.0\",\"async-retry\":\"1.1.3\",\"async-sema\":\"2.1.4\",\"ava\":\"2.2.0\",\"boxen\":\"4.2.0\",\"bytes\":\"3.0.0\",\"chalk\":\"4.1.0\",\"chance\":\"1.1.7\",\"chokidar\":\"3.3.1\",\"codecov\":\"3.8.2\",\"cpy\":\"7.2.0\",\"date-fns\":\"1.29.0\",\"debug\":\"3.1.0\",\"dot\":\"1.1.3\",\"dotenv\":\"4.0.0\",\"email-prompt\":\"0.3.2\",\"email-validator\":\"1.1.1\",\"epipebomb\":\"1.0.0\",\"escape-html\":\"1.0.3\",\"esm\":\"3.1.4\",\"execa\":\"3.2.0\",\"express\":\"4.17.1\",\"fast-deep-equal\":\"3.1.3\",\"fs-extra\":\"10.0.0\",\"get-port\":\"5.1.1\",\"git-last-commit\":\"1.0.1\",\"glob\":\"7.1.2\",\"http-proxy\":\"1.18.1\",\"ini\":\"3.0.0\",\"inquirer\":\"7.0.4\",\"is-docker\":\"2.2.1\",\"is-port-reachable\":\"3.1.0\",\"is-url\":\"1.2.2\",\"jaro-winkler\":\"0.2.8\",\"json5\":\"2.2.1\",\"jsonlines\":\"0.1.1\",\"line-async-iterator\":\"3.0.0\",\"load-json-file\":\"3.0.0\",\"mime-types\":\"2.1.24\",\"minimatch\":\"3.0.4\",\"mri\":\"1.1.5\",\"ms\":\"2.1.2\",\"node-fetch\":\"2.6.7\",\"npm-package-arg\":\"6.1.0\",\"open\":\"8.4.0\",\"ora\":\"3.4.0\",\"pcre-to-regexp\":\"1.0.0\",\"pluralize\":\"7.0.0\",\"promisepipe\":\"3.0.0\",\"psl\":\"1.1.31\",\"qr-image\":\"3.2.0\",\"raw-body\":\"2.4.1\",\"rimraf\":\"3.0.2\",\"semver\":\"5.5.0\",\"serve-handler\":\"6.1.1\",\"strip-ansi\":\"5.2.0\",\"stripe\":\"5.1.0\",\"tar-fs\":\"1.16.3\",\"test-listen\":\"1.1.0\",\"text-table\":\"0.2.0\",\"title\":\"3.4.1\",\"tmp-promise\":\"1.0.3\",\"tree-kill\":\"1.2.2\",\"ts-node\":\"10.9.1\",\"typescript\":\"4.7.4\",\"universal-analytics\":\"0.4.20\",\"utility-types\":\"2.1.0\",\"write-json-file\":\"2.2.0\",\"xdg-app-paths\":\"5.1.0\",\"yauzl-promise\":\"2.1.3\"},\"jest\":{\"preset\":\"ts-jest\",\"globals\":{\"ts-jest\":{\"diagnostics\":false,\"isolatedModules\":true}},\"setupFilesAfterEnv\":[\"@alex_neo/jest-expect-message\"],\"verbose\":false,\"testEnvironment\":\"node\",\"testMatch\":[\"<rootDir>/test/**/*.test.ts\"]}}");
|
255901
256310
|
|
255902
256311
|
/***/ }),
|
255903
256312
|
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "vercel",
|
3
|
-
"version": "28.
|
3
|
+
"version": "28.7.0",
|
4
4
|
"preferGlobal": true,
|
5
5
|
"license": "Apache-2.0",
|
6
6
|
"description": "The command-line interface for Vercel",
|
@@ -44,13 +44,13 @@
|
|
44
44
|
"@vercel/build-utils": "5.6.0",
|
45
45
|
"@vercel/go": "2.2.18",
|
46
46
|
"@vercel/hydrogen": "0.0.32",
|
47
|
-
"@vercel/next": "3.3.
|
47
|
+
"@vercel/next": "3.3.1",
|
48
48
|
"@vercel/node": "2.7.0",
|
49
49
|
"@vercel/python": "3.1.28",
|
50
50
|
"@vercel/redwood": "1.0.38",
|
51
51
|
"@vercel/remix": "1.1.0",
|
52
52
|
"@vercel/ruby": "1.3.44",
|
53
|
-
"@vercel/static-build": "1.0.
|
53
|
+
"@vercel/static-build": "1.0.41",
|
54
54
|
"update-notifier": "5.1.0"
|
55
55
|
},
|
56
56
|
"devDependencies": {
|
@@ -97,8 +97,8 @@
|
|
97
97
|
"@types/yauzl-promise": "2.1.0",
|
98
98
|
"@vercel/client": "12.2.20",
|
99
99
|
"@vercel/error-utils": "1.0.3",
|
100
|
-
"@vercel/frameworks": "1.1.
|
101
|
-
"@vercel/fs-detectors": "3.5.
|
100
|
+
"@vercel/frameworks": "1.1.14",
|
101
|
+
"@vercel/fs-detectors": "3.5.4",
|
102
102
|
"@vercel/fun": "1.0.4",
|
103
103
|
"@vercel/ncc": "0.24.0",
|
104
104
|
"@zeit/source-map-support": "0.6.2",
|
@@ -195,5 +195,5 @@
|
|
195
195
|
"<rootDir>/test/**/*.test.ts"
|
196
196
|
]
|
197
197
|
},
|
198
|
-
"gitHead": "
|
198
|
+
"gitHead": "a036b033986a99061a9678efec033b9a7cbdfd4e"
|
199
199
|
}
|