vercel 30.0.0 → 30.1.1

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.
Files changed (2) hide show
  1. package/dist/index.js +1110 -635
  2. package/package.json +10 -9
package/dist/index.js CHANGED
@@ -224854,6 +224854,7 @@ const help = () => `
224854
224854
  ls | list [app] Lists deployments
224855
224855
  login [email] Logs into your account or creates a new one
224856
224856
  logout Logs out of your account
224857
+ promote [url|id] Promote an existing deployment to current
224857
224858
  pull [path] Pull your Project Settings from the cloud
224858
224859
  redeploy [url|id] Rebuild and deploy a previous deployment.
224859
224860
  rollback [url|id] Quickly revert back to a previous deployment
@@ -225796,7 +225797,7 @@ const help = () => {
225796
225797
  `);
225797
225798
  };
225798
225799
  async function main(client) {
225799
- const { output } = client;
225800
+ const { cwd, output } = client;
225800
225801
  // Ensure that `vc build` is not being invoked recursively
225801
225802
  if (process.env.__VERCEL_BUILD_RUNNING) {
225802
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')}`);
@@ -225817,10 +225818,16 @@ async function main(client) {
225817
225818
  help();
225818
225819
  return 2;
225819
225820
  }
225820
- const cwd = process.cwd();
225821
225821
  // Build `target` influences which environment variables will be used
225822
225822
  const target = argv['--prod'] ? 'production' : 'preview';
225823
225823
  const yes = Boolean(argv['--yes']);
225824
+ try {
225825
+ await (0, build_utils_1.validateNpmrc)(cwd);
225826
+ }
225827
+ catch (err) {
225828
+ output.prettyError(err);
225829
+ return 1;
225830
+ }
225824
225831
  // TODO: read project settings from the API, fall back to local `project.json` if that fails
225825
225832
  // Read project settings, and pull them from Vercel if necessary
225826
225833
  let project = await (0, project_settings_1.readProjectSettings)((0, path_1.join)(cwd, link_1.VERCEL_DIR));
@@ -227027,21 +227034,17 @@ exports.default = async (client) => {
227027
227034
  if (argv._.length > 0) {
227028
227035
  // If path is relative: resolve
227029
227036
  // if path is absolute: clear up strange `/` etc
227030
- paths = argv._.map(item => (0, path_1.resolve)(process.cwd(), item));
227037
+ paths = argv._.map(item => (0, path_1.resolve)(client.cwd, item));
227031
227038
  }
227032
227039
  else {
227033
- paths = [process.cwd()];
227040
+ paths = [client.cwd];
227034
227041
  }
227035
- let localConfig = client.localConfig || (0, files_1.readLocalConfig)(paths[0]);
227036
- for (const path of paths) {
227037
- try {
227038
- await fs_extra_1.default.stat(path);
227039
- }
227040
- catch (err) {
227041
- output.error(`The specified file or directory "${(0, path_1.basename)(path)}" does not exist.`);
227042
- return 1;
227043
- }
227042
+ // check paths
227043
+ const pathValidation = await (0, validate_paths_1.default)(client, paths);
227044
+ if (!pathValidation.valid) {
227045
+ return pathValidation.exitCode;
227044
227046
  }
227047
+ let localConfig = client.localConfig || (0, files_1.readLocalConfig)(paths[0]);
227045
227048
  if (localConfig) {
227046
227049
  const { version } = localConfig;
227047
227050
  const file = (0, highlight_1.default)(localConfig[client_1.fileNameSymbol]);
@@ -227062,12 +227065,7 @@ exports.default = async (client) => {
227062
227065
  }
227063
227066
  const { log, debug, error, prettyError } = output;
227064
227067
  const quiet = !client.stdout.isTTY;
227065
- // check paths
227066
- const pathValidation = await (0, validate_paths_1.default)(client, paths);
227067
- if (!pathValidation.valid) {
227068
- return pathValidation.exitCode;
227069
- }
227070
- const { path } = pathValidation;
227068
+ let { path: cwd } = pathValidation;
227071
227069
  const autoConfirm = argv['--yes'];
227072
227070
  // deprecate --name
227073
227071
  if (argv['--name']) {
@@ -227083,12 +227081,12 @@ exports.default = async (client) => {
227083
227081
  }
227084
227082
  // build `--prebuilt`
227085
227083
  if (argv['--prebuilt']) {
227086
- const prebuiltExists = await fs_extra_1.default.pathExists((0, path_1.join)(path, '.vercel/output'));
227084
+ const prebuiltExists = await fs_extra_1.default.pathExists((0, path_1.join)(cwd, '.vercel/output'));
227087
227085
  if (!prebuiltExists) {
227088
227086
  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.`);
227089
227087
  return 1;
227090
227088
  }
227091
- const prebuiltBuild = await (0, get_prebuilt_json_1.default)(path);
227089
+ const prebuiltBuild = await (0, get_prebuilt_json_1.default)(cwd);
227092
227090
  // Ensure that there was not a build error
227093
227091
  const prebuiltError = prebuiltBuild?.error ||
227094
227092
  prebuiltBuild?.builds?.find(build => 'error' in build)?.error;
@@ -227117,7 +227115,7 @@ exports.default = async (client) => {
227117
227115
  return 1;
227118
227116
  }
227119
227117
  // retrieve `project` and `org` from .vercel
227120
- const link = await (0, link_1.getLinkedProject)(client, path);
227118
+ const link = await (0, link_1.getLinkedProject)(client, cwd);
227121
227119
  if (link.status === 'error') {
227122
227120
  return link.exitCode;
227123
227121
  }
@@ -227127,7 +227125,7 @@ exports.default = async (client) => {
227127
227125
  let sourceFilesOutsideRootDirectory = true;
227128
227126
  if (status === 'not_linked') {
227129
227127
  const shouldStartSetup = autoConfirm ||
227130
- (await (0, confirm_1.default)(client, `Set up and deploy ${chalk_1.default.cyan(`“${(0, humanize_path_1.default)(path)}”`)}?`, true));
227128
+ (await (0, confirm_1.default)(client, `Set up and deploy ${chalk_1.default.cyan(`“${(0, humanize_path_1.default)(cwd)}”`)}?`, true));
227131
227129
  if (!shouldStartSetup) {
227132
227130
  output.print(`Canceled. Project not set up.\n`);
227133
227131
  return 0;
@@ -227156,20 +227154,24 @@ exports.default = async (client) => {
227156
227154
  const projectOrNewProjectName = await (0, input_project_1.default)(client, org, detectedProjectName, autoConfirm);
227157
227155
  if (typeof projectOrNewProjectName === 'string') {
227158
227156
  newProjectName = projectOrNewProjectName;
227159
- rootDirectory = await (0, input_root_directory_1.inputRootDirectory)(client, path, autoConfirm);
227157
+ rootDirectory = await (0, input_root_directory_1.inputRootDirectory)(client, cwd, autoConfirm);
227160
227158
  }
227161
227159
  else {
227162
227160
  project = projectOrNewProjectName;
227163
227161
  rootDirectory = project.rootDirectory;
227164
227162
  sourceFilesOutsideRootDirectory = project.sourceFilesOutsideRootDirectory;
227165
227163
  // we can already link the project
227166
- await (0, link_1.linkFolderToProject)(output, path, {
227164
+ await (0, link_1.linkFolderToProject)(client, cwd, {
227167
227165
  projectId: project.id,
227168
227166
  orgId: org.id,
227169
227167
  }, project.name, org.slug);
227170
227168
  status = 'linked';
227171
227169
  }
227172
227170
  }
227171
+ // For repo-style linking, reset the path to the root of the repository
227172
+ if (link.status === 'linked' && link.repoRoot) {
227173
+ cwd = link.repoRoot;
227174
+ }
227173
227175
  // At this point `org` should be populated
227174
227176
  if (!org) {
227175
227177
  throw new Error(`"org" is not defined`);
@@ -227181,10 +227183,10 @@ exports.default = async (client) => {
227181
227183
  // if we have `sourceFilesOutsideRootDirectory` set to `true`, we use the current path
227182
227184
  // and upload the entire directory.
227183
227185
  const sourcePath = rootDirectory && !sourceFilesOutsideRootDirectory
227184
- ? (0, path_1.join)(path, rootDirectory)
227185
- : path;
227186
+ ? (0, path_1.join)(cwd, rootDirectory)
227187
+ : cwd;
227186
227188
  if (rootDirectory &&
227187
- (await (0, validate_paths_1.validateRootDirectory)(output, path, sourcePath, project
227189
+ (await (0, validate_paths_1.validateRootDirectory)(output, cwd, sourcePath, project
227188
227190
  ? `To change your Project Settings, go to https://vercel.com/${org?.slug}/${project.name}/settings`
227189
227191
  : '')) === false) {
227190
227192
  return 1;
@@ -227192,7 +227194,7 @@ exports.default = async (client) => {
227192
227194
  // If Root Directory is used we'll try to read the config
227193
227195
  // from there instead and use it if it exists.
227194
227196
  if (rootDirectory) {
227195
- const rootDirectoryConfig = (0, files_1.readLocalConfig)((0, path_1.join)(path, rootDirectory));
227197
+ const rootDirectoryConfig = (0, files_1.readLocalConfig)((0, path_1.join)(cwd, rootDirectory));
227196
227198
  if (rootDirectoryConfig) {
227197
227199
  debug(`Read local config from root directory (${rootDirectory})`);
227198
227200
  localConfig = rootDirectoryConfig;
@@ -227227,7 +227229,7 @@ exports.default = async (client) => {
227227
227229
  }
227228
227230
  // build `meta`
227229
227231
  const meta = Object.assign({}, (0, parse_meta_1.default)(localConfig.meta), (0, parse_meta_1.default)(argv['--meta']));
227230
- const gitMetadata = await (0, create_git_meta_1.createGitMeta)(path, output, project);
227232
+ const gitMetadata = await (0, create_git_meta_1.createGitMeta)(cwd, output, project);
227231
227233
  // Merge dotenv config, `env` from vercel.json, and `--env` / `-e` arguments
227232
227234
  const deploymentEnv = Object.assign({}, (0, parse_env_1.parseEnv)(localConfig.env), (0, parse_env_1.parseEnv)(argv['--env']));
227233
227235
  // Merge build env out of `build.env` from vercel.json, and `--build-env` args
@@ -227296,7 +227298,7 @@ exports.default = async (client) => {
227296
227298
  }
227297
227299
  : { ...localConfigurationOverrides, sourceFilesOutsideRootDirectory };
227298
227300
  }
227299
- deployment = await (0, create_deploy_1.default)(client, now, contextName, [sourcePath], createArgs, org, !project, path, archive);
227301
+ deployment = await (0, create_deploy_1.default)(client, now, contextName, sourcePath, createArgs, org, !project, cwd, archive);
227300
227302
  if (deployment.code === 'missing_project_settings') {
227301
227303
  let { projectSettings, framework } = deployment;
227302
227304
  if (rootDirectory) {
@@ -227311,7 +227313,7 @@ exports.default = async (client) => {
227311
227313
  createArgs.projectSettings = settings;
227312
227314
  deployStamp = (0, stamp_1.default)();
227313
227315
  createArgs.deployStamp = deployStamp;
227314
- deployment = await (0, create_deploy_1.default)(client, now, contextName, [sourcePath], createArgs, org, false, path);
227316
+ deployment = await (0, create_deploy_1.default)(client, now, contextName, sourcePath, createArgs, org, false, cwd);
227315
227317
  }
227316
227318
  if (deployment instanceof errors_ts_1.NotDomainOwner) {
227317
227319
  output.error(deployment.message);
@@ -229342,10 +229344,9 @@ async function main(client) {
229342
229344
  help();
229343
229345
  return 2;
229344
229346
  }
229345
- const cwd = argv['--cwd'] || process.cwd();
229346
229347
  const subArgs = argv._.slice(1);
229347
229348
  const { subcommand, args } = (0, get_subcommand_1.default)(subArgs, COMMAND_CONFIG);
229348
- const { output, config } = client;
229349
+ const { cwd, output, config } = client;
229349
229350
  const target = argv['--environment']?.toLowerCase() || 'development';
229350
229351
  if (!(0, env_target_1.isValidEnvTarget)(target)) {
229351
229352
  output.error(`Invalid environment \`${chalk_1.default.cyan(target)}\`. Valid options: ${(0, env_target_1.getEnvTargetPlaceholder)()}`);
@@ -229686,9 +229687,8 @@ const list_1 = __importDefault(__webpack_require__(48778));
229686
229687
  const link_1 = __importDefault(__webpack_require__(39302));
229687
229688
  const pkg_name_1 = __webpack_require__(79000);
229688
229689
  const connect_git_provider_1 = __webpack_require__(82748);
229689
- const validate_paths_1 = __importDefault(__webpack_require__(33922));
229690
229690
  async function connect(client, argv, args, project, org) {
229691
- const { output } = client;
229691
+ const { cwd, output } = client;
229692
229692
  const confirm = Boolean(argv['--yes']);
229693
229693
  const repoArg = argv._[1];
229694
229694
  if (args.length > 1) {
@@ -229699,16 +229699,10 @@ async function connect(client, argv, args, project, org) {
229699
229699
  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')}.`);
229700
229700
  return 1;
229701
229701
  }
229702
- let paths = [process.cwd()];
229703
- const validate = await (0, validate_paths_1.default)(client, paths);
229704
- if (!validate.valid) {
229705
- return validate.exitCode;
229706
- }
229707
- const { path } = validate;
229708
229702
  const gitProviderLink = project.link;
229709
229703
  client.config.currentTeam = org.type === 'team' ? org.id : undefined;
229710
229704
  // get project from .git
229711
- const gitConfigPath = (0, path_1.join)(path, '.git/config');
229705
+ const gitConfigPath = (0, path_1.join)(cwd, '.git/config');
229712
229706
  const gitConfig = await (0, create_git_meta_1.parseGitConfig)(gitConfigPath, output);
229713
229707
  if (repoArg) {
229714
229708
  // parse repo arg
@@ -229993,7 +229987,6 @@ const get_invalid_subcommand_1 = __importDefault(__webpack_require__(6479));
229993
229987
  const handle_error_1 = __importDefault(__webpack_require__(64377));
229994
229988
  const logo_1 = __importDefault(__webpack_require__(66669));
229995
229989
  const pkg_name_1 = __webpack_require__(79000);
229996
- const validate_paths_1 = __importDefault(__webpack_require__(33922));
229997
229990
  const connect_1 = __importDefault(__webpack_require__(44813));
229998
229991
  const disconnect_1 = __importDefault(__webpack_require__(47108));
229999
229992
  const help = () => {
@@ -230054,14 +230047,8 @@ async function main(client) {
230054
230047
  subcommand = argv._[0];
230055
230048
  const args = argv._.slice(1);
230056
230049
  const autoConfirm = Boolean(argv['--yes']);
230057
- const { output } = client;
230058
- let paths = [process.cwd()];
230059
- const pathValidation = await (0, validate_paths_1.default)(client, paths);
230060
- if (!pathValidation.valid) {
230061
- return pathValidation.exitCode;
230062
- }
230063
- const { path } = pathValidation;
230064
- const linkedProject = await (0, ensure_link_1.ensureLink)('git', client, path, { autoConfirm });
230050
+ const { cwd, output } = client;
230051
+ const linkedProject = await (0, ensure_link_1.ensureLink)('git', client, cwd, { autoConfirm });
230065
230052
  if (typeof linkedProject === 'number') {
230066
230053
  return linkedProject;
230067
230054
  }
@@ -230117,6 +230104,7 @@ exports.default = new Map([
230117
230104
  ['ls', 'list'],
230118
230105
  ['project', 'project'],
230119
230106
  ['projects', 'project'],
230107
+ ['promote', 'promote'],
230120
230108
  ['pull', 'pull'],
230121
230109
  ['redeploy', 'redeploy'],
230122
230110
  ['remove', 'remove'],
@@ -230655,7 +230643,7 @@ async function main(client) {
230655
230643
  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`);
230656
230644
  }
230657
230645
  else {
230658
- cwd = process.cwd();
230646
+ cwd = client.cwd;
230659
230647
  }
230660
230648
  if (argv['--repo']) {
230661
230649
  client.output.warn(`The ${(0, cmd_1.default)('--repo')} flag is in alpha, please report issues`);
@@ -230704,7 +230692,6 @@ const parse_meta_1 = __importDefault(__webpack_require__(93983));
230704
230692
  const is_valid_name_1 = __webpack_require__(64476);
230705
230693
  const get_command_flags_1 = __importDefault(__webpack_require__(98395));
230706
230694
  const pkg_name_1 = __webpack_require__(79000);
230707
- const validate_paths_1 = __importDefault(__webpack_require__(33922));
230708
230695
  const link_1 = __webpack_require__(49347);
230709
230696
  const ensure_link_1 = __webpack_require__(65382);
230710
230697
  const get_scope_1 = __importDefault(__webpack_require__(60324));
@@ -230767,7 +230754,7 @@ async function main(client) {
230767
230754
  (0, error_1.handleError)(err);
230768
230755
  return 1;
230769
230756
  }
230770
- const { output, config } = client;
230757
+ const { cwd, output, config } = client;
230771
230758
  if ('--confirm' in argv) {
230772
230759
  output.warn('`--confirm` is deprecated, please use `--yes` instead');
230773
230760
  argv['--yes'] = argv['--confirm'];
@@ -230784,14 +230771,8 @@ async function main(client) {
230784
230771
  const autoConfirm = !!argv['--yes'];
230785
230772
  const prod = argv['--prod'] || false;
230786
230773
  const meta = (0, parse_meta_1.default)(argv['--meta']);
230787
- let paths = [process.cwd()];
230788
- const pathValidation = await (0, validate_paths_1.default)(client, paths);
230789
- if (!pathValidation.valid) {
230790
- return pathValidation.exitCode;
230791
- }
230792
- const { path } = pathValidation;
230793
230774
  // retrieve `project` and `org` from .vercel
230794
- let link = await (0, link_1.getLinkedProject)(client, path);
230775
+ let link = await (0, link_1.getLinkedProject)(client, cwd);
230795
230776
  if (link.status === 'error') {
230796
230777
  return link.exitCode;
230797
230778
  }
@@ -230806,7 +230787,7 @@ async function main(client) {
230806
230787
  // If there's no linked project and user doesn't pass `app` arg,
230807
230788
  // prompt to link their current directory.
230808
230789
  if (status === 'not_linked' && !app) {
230809
- const linkedProject = await (0, ensure_link_1.ensureLink)('list', client, path, {
230790
+ const linkedProject = await (0, ensure_link_1.ensureLink)('list', client, cwd, {
230810
230791
  autoConfirm,
230811
230792
  link,
230812
230793
  });
@@ -231764,117 +231745,7 @@ async function readConfirmation(client, projectName) {
231764
231745
 
231765
231746
  /***/ }),
231766
231747
 
231767
- /***/ 65158:
231768
- /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
231769
-
231770
- "use strict";
231771
-
231772
- var __importDefault = (this && this.__importDefault) || function (mod) {
231773
- return (mod && mod.__esModule) ? mod : { "default": mod };
231774
- };
231775
- Object.defineProperty(exports, "__esModule", ({ value: true }));
231776
- exports.parseEnvironment = void 0;
231777
- const chalk_1 = __importDefault(__webpack_require__(90877));
231778
- const path_1 = __webpack_require__(85622);
231779
- const emoji_1 = __webpack_require__(35172);
231780
- const get_args_1 = __importDefault(__webpack_require__(2505));
231781
- const logo_1 = __importDefault(__webpack_require__(66669));
231782
- const stamp_1 = __importDefault(__webpack_require__(49079));
231783
- const pkg_name_1 = __webpack_require__(79000);
231784
- const link_1 = __webpack_require__(49347);
231785
- const project_settings_1 = __webpack_require__(61440);
231786
- const pull_1 = __importDefault(__webpack_require__(80800));
231787
- const env_target_1 = __webpack_require__(20229);
231788
- const ensure_link_1 = __webpack_require__(65382);
231789
- const help = () => {
231790
- return console.log(`
231791
- ${chalk_1.default.bold(`${logo_1.default} ${(0, pkg_name_1.getPkgName)()} pull`)} [project-path]
231792
-
231793
- ${chalk_1.default.dim('Options:')}
231794
-
231795
- -h, --help Output usage information
231796
- -A ${chalk_1.default.bold.underline('FILE')}, --local-config=${chalk_1.default.bold.underline('FILE')} Path to the local ${'`vercel.json`'} file
231797
- -Q ${chalk_1.default.bold.underline('DIR')}, --global-config=${chalk_1.default.bold.underline('DIR')} Path to the global ${'`.vercel`'} directory
231798
- -d, --debug Debug mode [off]
231799
- --no-color No color mode [off]
231800
- --environment [environment] Deployment environment [development]
231801
- -y, --yes Skip questions when setting up new project using default scope and settings
231802
-
231803
- ${chalk_1.default.dim('Examples:')}
231804
-
231805
- ${chalk_1.default.gray('–')} Pull the latest Environment Variables and Project Settings from the cloud
231806
- and stores them in \`.vercel/.env.\${target}.local\` and \`.vercel/project.json\` respectively.
231807
-
231808
- ${chalk_1.default.cyan(`$ ${(0, pkg_name_1.getPkgName)()} pull`)}
231809
- ${chalk_1.default.cyan(`$ ${(0, pkg_name_1.getPkgName)()} pull ./path-to-project`)}
231810
-
231811
- ${chalk_1.default.gray('–')} Pull for a specific environment
231812
-
231813
- ${chalk_1.default.cyan(`$ ${(0, pkg_name_1.getPkgName)()} pull --environment=${(0, env_target_1.getEnvTargetPlaceholder)()}`)}
231814
-
231815
- ${chalk_1.default.gray('If you want to download environment variables to a specific file, use `vercel env pull` instead.')}
231816
- `);
231817
- };
231818
- function processArgs(client) {
231819
- return (0, get_args_1.default)(client.argv.slice(2), {
231820
- '--yes': Boolean,
231821
- '--environment': String,
231822
- '--git-branch': String,
231823
- '--debug': Boolean,
231824
- '-d': '--debug',
231825
- '-y': '--yes',
231826
- });
231827
- }
231828
- function parseArgs(client) {
231829
- const argv = processArgs(client);
231830
- if (argv['--help']) {
231831
- help();
231832
- return 2;
231833
- }
231834
- return argv;
231835
- }
231836
- async function pullAllEnvFiles(environment, client, project, argv, cwd) {
231837
- const environmentFile = `.env.${environment}.local`;
231838
- return (0, pull_1.default)(client, project, environment, argv, [(0, path_1.join)('.vercel', environmentFile)], client.output, cwd, 'vercel-cli:pull');
231839
- }
231840
- function parseEnvironment(environment = 'development') {
231841
- if (!(0, env_target_1.isValidEnvTarget)(environment)) {
231842
- throw new Error(`environment "${environment}" not supported; must be one of ${(0, env_target_1.getEnvTargetPlaceholder)()}`);
231843
- }
231844
- return environment;
231845
- }
231846
- exports.parseEnvironment = parseEnvironment;
231847
- async function main(client) {
231848
- const argv = parseArgs(client);
231849
- if (typeof argv === 'number') {
231850
- return argv;
231851
- }
231852
- const cwd = argv._[1] || process.cwd();
231853
- const autoConfirm = Boolean(argv['--yes']);
231854
- const environment = parseEnvironment(argv['--environment'] || undefined);
231855
- const link = await (0, ensure_link_1.ensureLink)('pull', client, cwd, { autoConfirm });
231856
- if (typeof link === 'number') {
231857
- return link;
231858
- }
231859
- const { project, org } = link;
231860
- client.config.currentTeam = org.type === 'team' ? org.id : undefined;
231861
- const pullResultCode = await pullAllEnvFiles(environment, client, project, argv, cwd);
231862
- if (pullResultCode !== 0) {
231863
- return pullResultCode;
231864
- }
231865
- client.output.print('\n');
231866
- client.output.log('Downloading project settings');
231867
- await (0, project_settings_1.writeProjectSettings)(cwd, project, org);
231868
- const settingsStamp = (0, stamp_1.default)();
231869
- 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`);
231870
- return 0;
231871
- }
231872
- exports.default = main;
231873
-
231874
-
231875
- /***/ }),
231876
-
231877
- /***/ 29281:
231748
+ /***/ 62435:
231878
231749
  /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
231879
231750
 
231880
231751
  "use strict";
@@ -231884,24 +231755,20 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
231884
231755
  };
231885
231756
  Object.defineProperty(exports, "__esModule", ({ value: true }));
231886
231757
  const chalk_1 = __importDefault(__webpack_require__(90877));
231887
- const client_1 = __webpack_require__(40521);
231888
- const emoji_1 = __webpack_require__(35172);
231889
231758
  const get_args_1 = __importDefault(__webpack_require__(2505));
231759
+ const get_project_by_cwd_or_link_1 = __importDefault(__webpack_require__(90675));
231890
231760
  const pkg_name_1 = __webpack_require__(79000);
231891
- const get_deployment_by_id_or_url_1 = __webpack_require__(47662);
231892
- const get_scope_1 = __importDefault(__webpack_require__(60324));
231893
231761
  const handle_error_1 = __importDefault(__webpack_require__(64377));
231894
231762
  const error_utils_1 = __webpack_require__(39799);
231895
231763
  const logo_1 = __importDefault(__webpack_require__(66669));
231896
- const util_1 = __importDefault(__webpack_require__(4058));
231897
- const print_deployment_status_1 = __webpack_require__(27951);
231898
- const stamp_1 = __importDefault(__webpack_require__(49079));
231899
- const ua_1 = __importDefault(__webpack_require__(36308));
231764
+ const ms_1 = __importDefault(__webpack_require__(21378));
231765
+ const request_promote_1 = __importDefault(__webpack_require__(73455));
231766
+ const status_1 = __importDefault(__webpack_require__(48821));
231900
231767
  const help = () => {
231901
231768
  console.log(`
231902
- ${chalk_1.default.bold(`${logo_1.default} ${(0, pkg_name_1.getPkgName)()} redeploy`)} [deploymentId|deploymentName]
231769
+ ${chalk_1.default.bold(`${logo_1.default} ${(0, pkg_name_1.getPkgName)()} promote`)} [deployment id/url]
231903
231770
 
231904
- Rebuild and deploy a previous deployment.
231771
+ Promote an existing deployment to current.
231905
231772
 
231906
231773
  ${chalk_1.default.dim('Options:')}
231907
231774
 
@@ -231910,23 +231777,26 @@ const help = () => {
231910
231777
  -Q ${chalk_1.default.bold.underline('DIR')}, --global-config=${chalk_1.default.bold.underline('DIR')} Path to the global ${'`.vercel`'} directory
231911
231778
  -d, --debug Debug mode [off]
231912
231779
  --no-color No color mode [off]
231913
- --no-wait Don't wait for the redeploy to finish
231914
231780
  -t ${chalk_1.default.bold.underline('TOKEN')}, --token=${chalk_1.default.bold.underline('TOKEN')} Login token
231781
+ --timeout=${chalk_1.default.bold.underline('TIME')} Time to wait for promotion completion [3m]
231915
231782
  -y, --yes Skip questions when setting up new project using default scope and settings
231916
231783
 
231917
231784
  ${chalk_1.default.dim('Examples:')}
231918
231785
 
231919
- ${chalk_1.default.gray('–')} Rebuild and deploy an existing deployment using id or url
231786
+ ${chalk_1.default.gray('–')} Show the status of any current pending promotions
231920
231787
 
231921
- ${chalk_1.default.cyan(`$ ${(0, pkg_name_1.getPkgName)()} redeploy my-deployment.vercel.app`)}
231788
+ ${chalk_1.default.cyan(`$ ${(0, pkg_name_1.getPkgName)()} promote`)}
231789
+ ${chalk_1.default.cyan(`$ ${(0, pkg_name_1.getPkgName)()} promote status`)}
231790
+ ${chalk_1.default.cyan(`$ ${(0, pkg_name_1.getPkgName)()} promote status <project>`)}
231791
+ ${chalk_1.default.cyan(`$ ${(0, pkg_name_1.getPkgName)()} promote status --timeout 30s`)}
231922
231792
 
231923
- ${chalk_1.default.gray('–')} Write Deployment URL to a file
231793
+ ${chalk_1.default.gray('–')} Promote a deployment using id or url
231924
231794
 
231925
- ${chalk_1.default.cyan(`$ ${(0, pkg_name_1.getPkgName)()} redeploy my-deployment.vercel.app > deployment-url.txt`)}
231795
+ ${chalk_1.default.cyan(`$ ${(0, pkg_name_1.getPkgName)()} promote <deployment id/url>`)}
231926
231796
  `);
231927
231797
  };
231928
231798
  /**
231929
- * `vc redeploy` command
231799
+ * `vc promote` command
231930
231800
  * @param {Client} client
231931
231801
  * @returns {Promise<number>} Resolves an exit code; 0 on success
231932
231802
  */
@@ -231934,7 +231804,7 @@ exports.default = async (client) => {
231934
231804
  let argv;
231935
231805
  try {
231936
231806
  argv = (0, get_args_1.default)(client.argv.slice(2), {
231937
- '--no-wait': Boolean,
231807
+ '--timeout': String,
231938
231808
  '--yes': Boolean,
231939
231809
  '-y': '--yes',
231940
231810
  });
@@ -231947,81 +231817,527 @@ exports.default = async (client) => {
231947
231817
  help();
231948
231818
  return 2;
231949
231819
  }
231950
- const { output } = client;
231951
- const deployIdOrUrl = argv._[1];
231952
- if (!deployIdOrUrl) {
231953
- output.error(`Missing required deployment id or url: ${(0, pkg_name_1.getCommandName)(`redeploy <deployment-id-or-url>`)}`);
231820
+ // validate the timeout
231821
+ let timeout = argv['--timeout'];
231822
+ if (timeout && (0, ms_1.default)(timeout) === undefined) {
231823
+ client.output.error(`Invalid timeout "${timeout}"`);
231954
231824
  return 1;
231955
231825
  }
231956
- const { contextName } = await (0, get_scope_1.default)(client);
231957
- const noWait = !!argv['--no-wait'];
231826
+ const actionOrDeployId = argv._[1] || 'status';
231958
231827
  try {
231959
- const fromDeployment = await (0, get_deployment_by_id_or_url_1.getDeploymentByIdOrURL)({
231828
+ if (actionOrDeployId === 'status') {
231829
+ const project = await (0, get_project_by_cwd_or_link_1.default)({
231830
+ autoConfirm: Boolean(argv['--yes']),
231831
+ client,
231832
+ commandName: 'promote',
231833
+ cwd: client.cwd,
231834
+ projectNameOrId: argv._[2],
231835
+ });
231836
+ return await (0, status_1.default)({
231837
+ client,
231838
+ project,
231839
+ timeout,
231840
+ });
231841
+ }
231842
+ return await (0, request_promote_1.default)({
231960
231843
  client,
231961
- contextName,
231962
- deployIdOrUrl,
231963
- });
231964
- const deployStamp = (0, stamp_1.default)();
231965
- output.spinner(`Redeploying project ${fromDeployment.id}`, 0);
231966
- let deployment = await client.fetch(`/v13/deployments?forceNew=1`, {
231967
- body: {
231968
- deploymentId: fromDeployment.id,
231969
- meta: {
231970
- action: 'redeploy',
231971
- },
231972
- name: fromDeployment.name,
231973
- target: fromDeployment.target || 'production',
231974
- },
231975
- method: 'POST',
231844
+ deployId: actionOrDeployId,
231845
+ timeout,
231976
231846
  });
231977
- output.stopSpinner();
231978
- output.print(`${(0, emoji_1.prependEmoji)(`Inspect: ${chalk_1.default.bold(deployment.inspectorUrl)} ${deployStamp()}`, (0, emoji_1.emoji)('inspect'))}\n`);
231979
- if (!client.stdout.isTTY) {
231980
- client.stdout.write(`https://${deployment.url}`);
231981
- }
231982
- if (!noWait) {
231983
- output.spinner(deployment.readyState === 'QUEUED' ? 'Queued' : 'Building', 0);
231984
- if (deployment.readyState === 'READY' && deployment.aliasAssigned) {
231985
- output.spinner('Completing', 0);
231847
+ }
231848
+ catch (err) {
231849
+ if ((0, error_utils_1.isErrnoException)(err)) {
231850
+ if (err.code === 'ERR_CANCELED') {
231851
+ return 0;
231986
231852
  }
231987
- else {
231988
- try {
231989
- const clientOptions = {
231990
- agent: client.agent,
231991
- apiUrl: client.apiUrl,
231992
- debug: client.output.debugEnabled,
231993
- path: '',
231994
- teamId: fromDeployment.team?.id,
231995
- token: client.authConfig.token,
231996
- userAgent: ua_1.default,
231997
- };
231998
- for await (const event of (0, client_1.checkDeploymentStatus)(deployment, clientOptions)) {
231999
- if (event.type === 'building') {
232000
- output.spinner('Building', 0);
232001
- }
232002
- else if (event.type === 'ready' &&
232003
- (event.payload.checksState
232004
- ? event.payload.checksState === 'completed'
232005
- : true)) {
232006
- output.spinner('Completing', 0);
232007
- }
232008
- else if (event.type === 'checks-running') {
232009
- output.spinner('Running Checks', 0);
232010
- }
232011
- else if (event.type === 'alias-assigned' ||
232012
- event.type === 'checks-conclusion-failed') {
232013
- output.stopSpinner();
232014
- deployment = event.payload;
232015
- break;
232016
- }
232017
- else if (event.type === 'canceled') {
232018
- output.stopSpinner();
232019
- output.print('The deployment has been canceled.\n');
232020
- return 1;
232021
- }
232022
- else if (event.type === 'error') {
232023
- output.stopSpinner();
232024
- const now = new util_1.default({
231853
+ if (err.code === 'ERR_INVALID_CWD' || err.code === 'ERR_LINK_PROJECT') {
231854
+ // do not show the message
231855
+ return 1;
231856
+ }
231857
+ }
231858
+ client.output.prettyError(err);
231859
+ return 1;
231860
+ }
231861
+ };
231862
+
231863
+
231864
+ /***/ }),
231865
+
231866
+ /***/ 73455:
231867
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
231868
+
231869
+ "use strict";
231870
+
231871
+ var __importDefault = (this && this.__importDefault) || function (mod) {
231872
+ return (mod && mod.__esModule) ? mod : { "default": mod };
231873
+ };
231874
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
231875
+ const chalk_1 = __importDefault(__webpack_require__(90877));
231876
+ const pkg_name_1 = __webpack_require__(79000);
231877
+ const get_project_by_deployment_1 = __importDefault(__webpack_require__(67231));
231878
+ const ms_1 = __importDefault(__webpack_require__(21378));
231879
+ const status_1 = __importDefault(__webpack_require__(48821));
231880
+ /**
231881
+ * Requests a promotion and waits for it complete.
231882
+ * @param {Client} client - The Vercel client instance
231883
+ * @param {string} deployId - The deployment name or id to promote
231884
+ * @param {string} [timeout] - Time to poll for succeeded/failed state
231885
+ * @returns {Promise<number>} Resolves an exit code; 0 on success
231886
+ */
231887
+ async function requestPromote({ client, deployId, timeout, }) {
231888
+ const { output } = client;
231889
+ const { contextName, deployment, project } = await (0, get_project_by_deployment_1.default)({
231890
+ client,
231891
+ deployId,
231892
+ output: client.output,
231893
+ });
231894
+ // request the promotion
231895
+ await client.fetch(`/v9/projects/${project.id}/promote/${deployment.id}`, {
231896
+ body: {},
231897
+ json: false,
231898
+ method: 'POST',
231899
+ });
231900
+ if (timeout !== undefined && (0, ms_1.default)(timeout) === 0) {
231901
+ output.log(`Successfully requested promote of ${chalk_1.default.bold(project.name)} to ${deployment.url} (${deployment.id})`);
231902
+ output.log(`To check promote status, run ${(0, pkg_name_1.getCommandName)('promote')}.`);
231903
+ return 0;
231904
+ }
231905
+ // check the status
231906
+ return await (0, status_1.default)({
231907
+ client,
231908
+ contextName,
231909
+ deployment,
231910
+ project,
231911
+ timeout,
231912
+ });
231913
+ }
231914
+ exports.default = requestPromote;
231915
+
231916
+
231917
+ /***/ }),
231918
+
231919
+ /***/ 48821:
231920
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
231921
+
231922
+ "use strict";
231923
+
231924
+ var __importDefault = (this && this.__importDefault) || function (mod) {
231925
+ return (mod && mod.__esModule) ? mod : { "default": mod };
231926
+ };
231927
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
231928
+ const chalk_1 = __importDefault(__webpack_require__(90877));
231929
+ const elapsed_1 = __importDefault(__webpack_require__(14099));
231930
+ const format_date_1 = __importDefault(__webpack_require__(738));
231931
+ const get_deployment_1 = __importDefault(__webpack_require__(84249));
231932
+ const pkg_name_1 = __webpack_require__(79000);
231933
+ const get_project_by_id_or_name_1 = __importDefault(__webpack_require__(6729));
231934
+ const get_scope_1 = __importDefault(__webpack_require__(60324));
231935
+ const ms_1 = __importDefault(__webpack_require__(21378));
231936
+ const errors_ts_1 = __webpack_require__(39240);
231937
+ const render_alias_status_1 = __importDefault(__webpack_require__(33688));
231938
+ const sleep_1 = __importDefault(__webpack_require__(89507));
231939
+ /**
231940
+ * Continuously checks a deployment status until it has succeeded, failed, or
231941
+ * taken longer than the timeout (default 3 minutes).
231942
+ *
231943
+ * @param {Client} client - The Vercel client instance
231944
+ * @param {string} [contextName] - The scope name; if not specified, it will be
231945
+ * extracted from the `client`
231946
+ * @param {Deployment} [deployment] - Info about the deployment which is used
231947
+ * to display different output following a promotion request
231948
+ * @param {Project} project - Project info instance
231949
+ * @param {string} [timeout] - Milliseconds to poll for succeeded/failed state
231950
+ * @returns {Promise<number>} Resolves an exit code; 0 on success
231951
+ */
231952
+ async function promoteStatus({ client, contextName, deployment, project, timeout = '3m', }) {
231953
+ const { output } = client;
231954
+ const recentThreshold = Date.now() - (0, ms_1.default)('3m');
231955
+ const promoteTimeout = Date.now() + (0, ms_1.default)(timeout);
231956
+ let counter = 0;
231957
+ let spinnerMessage = deployment
231958
+ ? 'Promote in progress'
231959
+ : `Checking promotion status of ${project.name}`;
231960
+ if (!contextName) {
231961
+ ({ contextName } = await (0, get_scope_1.default)(client));
231962
+ }
231963
+ try {
231964
+ output.spinner(`${spinnerMessage}…`);
231965
+ // continuously loop until the promotion has explicitly succeeded, failed,
231966
+ // or timed out
231967
+ for (;;) {
231968
+ const projectCheck = await (0, get_project_by_id_or_name_1.default)(client, project.id, project.accountId, true);
231969
+ if (projectCheck instanceof errors_ts_1.ProjectNotFound) {
231970
+ throw projectCheck;
231971
+ }
231972
+ const { jobStatus, requestedAt, toDeploymentId, type, } = projectCheck.lastAliasRequest ?? {};
231973
+ if (!jobStatus ||
231974
+ (jobStatus !== 'in-progress' && jobStatus !== 'pending')) {
231975
+ output.stopSpinner();
231976
+ output.log(`${spinnerMessage}…`);
231977
+ }
231978
+ if (!jobStatus ||
231979
+ !requestedAt ||
231980
+ !toDeploymentId ||
231981
+ requestedAt < recentThreshold) {
231982
+ output.log('No deployment promotion in progress');
231983
+ return 0;
231984
+ }
231985
+ if (jobStatus === 'skipped' && type === 'promote') {
231986
+ output.log('Promote deployment was skipped');
231987
+ return 0;
231988
+ }
231989
+ if (jobStatus === 'succeeded') {
231990
+ return await renderJobSucceeded({
231991
+ client,
231992
+ contextName,
231993
+ performingPromote: !!deployment,
231994
+ requestedAt,
231995
+ project,
231996
+ toDeploymentId,
231997
+ });
231998
+ }
231999
+ if (jobStatus === 'failed') {
232000
+ return await renderJobFailed({
232001
+ client,
232002
+ contextName,
232003
+ deployment,
232004
+ project,
232005
+ toDeploymentId,
232006
+ });
232007
+ }
232008
+ // lastly, if we're not pending/in-progress, then we don't know what
232009
+ // the status is, so bail
232010
+ if (jobStatus !== 'pending' && jobStatus !== 'in-progress') {
232011
+ output.log(`Unknown promote deployment status "${jobStatus}"`);
232012
+ return 1;
232013
+ }
232014
+ // check if we have been running for too long
232015
+ if (requestedAt < recentThreshold || Date.now() >= promoteTimeout) {
232016
+ output.log(`The promotion exceeded its deadline - rerun ${chalk_1.default.bold(`${(0, pkg_name_1.getPkgName)()} promote ${toDeploymentId}`)} to try again`);
232017
+ return 1;
232018
+ }
232019
+ // if we've done our first poll and not rolling back, then print the
232020
+ // requested at date/time
232021
+ if (counter++ === 0 && !deployment) {
232022
+ spinnerMessage += ` requested at ${(0, format_date_1.default)(requestedAt)}`;
232023
+ }
232024
+ output.spinner(`${spinnerMessage}…`);
232025
+ await (0, sleep_1.default)(250);
232026
+ }
232027
+ }
232028
+ finally {
232029
+ output.stopSpinner();
232030
+ }
232031
+ }
232032
+ exports.default = promoteStatus;
232033
+ async function renderJobFailed({ client, contextName, deployment, project, toDeploymentId, }) {
232034
+ const { output } = client;
232035
+ try {
232036
+ const name = (deployment || (await (0, get_deployment_1.default)(client, contextName, toDeploymentId)))?.url;
232037
+ output.error(`Failed to remap all aliases to the requested deployment ${name} (${toDeploymentId})`);
232038
+ }
232039
+ catch (e) {
232040
+ output.error(`Failed to remap all aliases to the requested deployment ${toDeploymentId}`);
232041
+ }
232042
+ // aliases are paginated, so continuously loop until all of them have been
232043
+ // fetched
232044
+ let nextTimestamp;
232045
+ for (;;) {
232046
+ let url = `/v9/projects/${project.id}/promote/aliases?failedOnly=true&limit=20`;
232047
+ if (nextTimestamp) {
232048
+ url += `&until=${nextTimestamp}`;
232049
+ }
232050
+ const { aliases, pagination } = await client.fetch(url);
232051
+ for (const { alias, status } of aliases) {
232052
+ output.log(` ${(0, render_alias_status_1.default)(status).padEnd(11)} ${alias.alias} (${alias.deploymentId})`);
232053
+ }
232054
+ if (pagination?.next) {
232055
+ nextTimestamp = pagination.next;
232056
+ }
232057
+ else {
232058
+ break;
232059
+ }
232060
+ }
232061
+ return 1;
232062
+ }
232063
+ async function renderJobSucceeded({ client, contextName, performingPromote, project, requestedAt, toDeploymentId, }) {
232064
+ const { output } = client;
232065
+ // attempt to get the new deployment url
232066
+ let deploymentInfo = '';
232067
+ try {
232068
+ const deployment = await (0, get_deployment_1.default)(client, contextName, toDeploymentId);
232069
+ deploymentInfo = `${chalk_1.default.bold(deployment.url)} (${toDeploymentId})`;
232070
+ }
232071
+ catch (err) {
232072
+ output.debug(`Failed to get deployment url for ${toDeploymentId}: ${err?.toString() || err}`);
232073
+ deploymentInfo = chalk_1.default.bold(toDeploymentId);
232074
+ }
232075
+ const duration = performingPromote ? (0, elapsed_1.default)(Date.now() - requestedAt) : '';
232076
+ output.log(`Success! ${chalk_1.default.bold(project.name)} was promoted to ${deploymentInfo} ${duration}`);
232077
+ return 0;
232078
+ }
232079
+
232080
+
232081
+ /***/ }),
232082
+
232083
+ /***/ 65158:
232084
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
232085
+
232086
+ "use strict";
232087
+
232088
+ var __importDefault = (this && this.__importDefault) || function (mod) {
232089
+ return (mod && mod.__esModule) ? mod : { "default": mod };
232090
+ };
232091
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
232092
+ exports.parseEnvironment = void 0;
232093
+ const chalk_1 = __importDefault(__webpack_require__(90877));
232094
+ const path_1 = __webpack_require__(85622);
232095
+ const emoji_1 = __webpack_require__(35172);
232096
+ const get_args_1 = __importDefault(__webpack_require__(2505));
232097
+ const logo_1 = __importDefault(__webpack_require__(66669));
232098
+ const stamp_1 = __importDefault(__webpack_require__(49079));
232099
+ const pkg_name_1 = __webpack_require__(79000);
232100
+ const link_1 = __webpack_require__(49347);
232101
+ const project_settings_1 = __webpack_require__(61440);
232102
+ const pull_1 = __importDefault(__webpack_require__(80800));
232103
+ const env_target_1 = __webpack_require__(20229);
232104
+ const ensure_link_1 = __webpack_require__(65382);
232105
+ const help = () => {
232106
+ return console.log(`
232107
+ ${chalk_1.default.bold(`${logo_1.default} ${(0, pkg_name_1.getPkgName)()} pull`)} [project-path]
232108
+
232109
+ ${chalk_1.default.dim('Options:')}
232110
+
232111
+ -h, --help Output usage information
232112
+ -A ${chalk_1.default.bold.underline('FILE')}, --local-config=${chalk_1.default.bold.underline('FILE')} Path to the local ${'`vercel.json`'} file
232113
+ -Q ${chalk_1.default.bold.underline('DIR')}, --global-config=${chalk_1.default.bold.underline('DIR')} Path to the global ${'`.vercel`'} directory
232114
+ -d, --debug Debug mode [off]
232115
+ --no-color No color mode [off]
232116
+ --environment [environment] Deployment environment [development]
232117
+ -y, --yes Skip questions when setting up new project using default scope and settings
232118
+
232119
+ ${chalk_1.default.dim('Examples:')}
232120
+
232121
+ ${chalk_1.default.gray('–')} Pull the latest Environment Variables and Project Settings from the cloud
232122
+ and stores them in \`.vercel/.env.\${target}.local\` and \`.vercel/project.json\` respectively.
232123
+
232124
+ ${chalk_1.default.cyan(`$ ${(0, pkg_name_1.getPkgName)()} pull`)}
232125
+ ${chalk_1.default.cyan(`$ ${(0, pkg_name_1.getPkgName)()} pull ./path-to-project`)}
232126
+
232127
+ ${chalk_1.default.gray('–')} Pull for a specific environment
232128
+
232129
+ ${chalk_1.default.cyan(`$ ${(0, pkg_name_1.getPkgName)()} pull --environment=${(0, env_target_1.getEnvTargetPlaceholder)()}`)}
232130
+
232131
+ ${chalk_1.default.gray('If you want to download environment variables to a specific file, use `vercel env pull` instead.')}
232132
+ `);
232133
+ };
232134
+ function processArgs(client) {
232135
+ return (0, get_args_1.default)(client.argv.slice(2), {
232136
+ '--yes': Boolean,
232137
+ '--environment': String,
232138
+ '--git-branch': String,
232139
+ '--debug': Boolean,
232140
+ '-d': '--debug',
232141
+ '-y': '--yes',
232142
+ });
232143
+ }
232144
+ function parseArgs(client) {
232145
+ const argv = processArgs(client);
232146
+ if (argv['--help']) {
232147
+ help();
232148
+ return 2;
232149
+ }
232150
+ return argv;
232151
+ }
232152
+ async function pullAllEnvFiles(environment, client, project, argv, cwd) {
232153
+ const environmentFile = `.env.${environment}.local`;
232154
+ return (0, pull_1.default)(client, project, environment, argv, [(0, path_1.join)('.vercel', environmentFile)], client.output, cwd, 'vercel-cli:pull');
232155
+ }
232156
+ function parseEnvironment(environment = 'development') {
232157
+ if (!(0, env_target_1.isValidEnvTarget)(environment)) {
232158
+ throw new Error(`environment "${environment}" not supported; must be one of ${(0, env_target_1.getEnvTargetPlaceholder)()}`);
232159
+ }
232160
+ return environment;
232161
+ }
232162
+ exports.parseEnvironment = parseEnvironment;
232163
+ async function main(client) {
232164
+ const argv = parseArgs(client);
232165
+ if (typeof argv === 'number') {
232166
+ return argv;
232167
+ }
232168
+ const cwd = argv._[1] || process.cwd();
232169
+ const autoConfirm = Boolean(argv['--yes']);
232170
+ const environment = parseEnvironment(argv['--environment'] || undefined);
232171
+ const link = await (0, ensure_link_1.ensureLink)('pull', client, cwd, { autoConfirm });
232172
+ if (typeof link === 'number') {
232173
+ return link;
232174
+ }
232175
+ const { project, org } = link;
232176
+ client.config.currentTeam = org.type === 'team' ? org.id : undefined;
232177
+ const pullResultCode = await pullAllEnvFiles(environment, client, project, argv, cwd);
232178
+ if (pullResultCode !== 0) {
232179
+ return pullResultCode;
232180
+ }
232181
+ client.output.print('\n');
232182
+ client.output.log('Downloading project settings');
232183
+ await (0, project_settings_1.writeProjectSettings)(cwd, project, org);
232184
+ const settingsStamp = (0, stamp_1.default)();
232185
+ 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`);
232186
+ return 0;
232187
+ }
232188
+ exports.default = main;
232189
+
232190
+
232191
+ /***/ }),
232192
+
232193
+ /***/ 29281:
232194
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
232195
+
232196
+ "use strict";
232197
+
232198
+ var __importDefault = (this && this.__importDefault) || function (mod) {
232199
+ return (mod && mod.__esModule) ? mod : { "default": mod };
232200
+ };
232201
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
232202
+ const chalk_1 = __importDefault(__webpack_require__(90877));
232203
+ const client_1 = __webpack_require__(40521);
232204
+ const emoji_1 = __webpack_require__(35172);
232205
+ const get_args_1 = __importDefault(__webpack_require__(2505));
232206
+ const pkg_name_1 = __webpack_require__(79000);
232207
+ const get_deployment_by_id_or_url_1 = __webpack_require__(47662);
232208
+ const get_scope_1 = __importDefault(__webpack_require__(60324));
232209
+ const handle_error_1 = __importDefault(__webpack_require__(64377));
232210
+ const error_utils_1 = __webpack_require__(39799);
232211
+ const logo_1 = __importDefault(__webpack_require__(66669));
232212
+ const util_1 = __importDefault(__webpack_require__(4058));
232213
+ const print_deployment_status_1 = __webpack_require__(27951);
232214
+ const stamp_1 = __importDefault(__webpack_require__(49079));
232215
+ const ua_1 = __importDefault(__webpack_require__(36308));
232216
+ const help = () => {
232217
+ console.log(`
232218
+ ${chalk_1.default.bold(`${logo_1.default} ${(0, pkg_name_1.getPkgName)()} redeploy`)} [deploymentId|deploymentName]
232219
+
232220
+ Rebuild and deploy a previous deployment.
232221
+
232222
+ ${chalk_1.default.dim('Options:')}
232223
+
232224
+ -h, --help Output usage information
232225
+ -A ${chalk_1.default.bold.underline('FILE')}, --local-config=${chalk_1.default.bold.underline('FILE')} Path to the local ${'`vercel.json`'} file
232226
+ -Q ${chalk_1.default.bold.underline('DIR')}, --global-config=${chalk_1.default.bold.underline('DIR')} Path to the global ${'`.vercel`'} directory
232227
+ -d, --debug Debug mode [off]
232228
+ --no-color No color mode [off]
232229
+ --no-wait Don't wait for the redeploy to finish
232230
+ -t ${chalk_1.default.bold.underline('TOKEN')}, --token=${chalk_1.default.bold.underline('TOKEN')} Login token
232231
+ -y, --yes Skip questions when setting up new project using default scope and settings
232232
+
232233
+ ${chalk_1.default.dim('Examples:')}
232234
+
232235
+ ${chalk_1.default.gray('–')} Rebuild and deploy an existing deployment using id or url
232236
+
232237
+ ${chalk_1.default.cyan(`$ ${(0, pkg_name_1.getPkgName)()} redeploy my-deployment.vercel.app`)}
232238
+
232239
+ ${chalk_1.default.gray('–')} Write Deployment URL to a file
232240
+
232241
+ ${chalk_1.default.cyan(`$ ${(0, pkg_name_1.getPkgName)()} redeploy my-deployment.vercel.app > deployment-url.txt`)}
232242
+ `);
232243
+ };
232244
+ /**
232245
+ * `vc redeploy` command
232246
+ * @param {Client} client
232247
+ * @returns {Promise<number>} Resolves an exit code; 0 on success
232248
+ */
232249
+ exports.default = async (client) => {
232250
+ let argv;
232251
+ try {
232252
+ argv = (0, get_args_1.default)(client.argv.slice(2), {
232253
+ '--no-wait': Boolean,
232254
+ '--yes': Boolean,
232255
+ '-y': '--yes',
232256
+ });
232257
+ }
232258
+ catch (err) {
232259
+ (0, handle_error_1.default)(err);
232260
+ return 1;
232261
+ }
232262
+ if (argv['--help'] || argv._[0] === 'help') {
232263
+ help();
232264
+ return 2;
232265
+ }
232266
+ const { output } = client;
232267
+ const deployIdOrUrl = argv._[1];
232268
+ if (!deployIdOrUrl) {
232269
+ output.error(`Missing required deployment id or url: ${(0, pkg_name_1.getCommandName)(`redeploy <deployment-id-or-url>`)}`);
232270
+ return 1;
232271
+ }
232272
+ const { contextName } = await (0, get_scope_1.default)(client);
232273
+ const noWait = !!argv['--no-wait'];
232274
+ try {
232275
+ const fromDeployment = await (0, get_deployment_by_id_or_url_1.getDeploymentByIdOrURL)({
232276
+ client,
232277
+ contextName,
232278
+ deployIdOrUrl,
232279
+ });
232280
+ const deployStamp = (0, stamp_1.default)();
232281
+ output.spinner(`Redeploying project ${fromDeployment.id}`, 0);
232282
+ let deployment = await client.fetch(`/v13/deployments?forceNew=1`, {
232283
+ body: {
232284
+ deploymentId: fromDeployment.id,
232285
+ meta: {
232286
+ action: 'redeploy',
232287
+ },
232288
+ name: fromDeployment.name,
232289
+ target: fromDeployment.target || 'production',
232290
+ },
232291
+ method: 'POST',
232292
+ });
232293
+ output.stopSpinner();
232294
+ output.print(`${(0, emoji_1.prependEmoji)(`Inspect: ${chalk_1.default.bold(deployment.inspectorUrl)} ${deployStamp()}`, (0, emoji_1.emoji)('inspect'))}\n`);
232295
+ if (!client.stdout.isTTY) {
232296
+ client.stdout.write(`https://${deployment.url}`);
232297
+ }
232298
+ if (!noWait) {
232299
+ output.spinner(deployment.readyState === 'QUEUED' ? 'Queued' : 'Building', 0);
232300
+ if (deployment.readyState === 'READY' && deployment.aliasAssigned) {
232301
+ output.spinner('Completing', 0);
232302
+ }
232303
+ else {
232304
+ try {
232305
+ const clientOptions = {
232306
+ agent: client.agent,
232307
+ apiUrl: client.apiUrl,
232308
+ debug: client.output.debugEnabled,
232309
+ path: '',
232310
+ teamId: fromDeployment.team?.id,
232311
+ token: client.authConfig.token,
232312
+ userAgent: ua_1.default,
232313
+ };
232314
+ for await (const event of (0, client_1.checkDeploymentStatus)(deployment, clientOptions)) {
232315
+ if (event.type === 'building') {
232316
+ output.spinner('Building', 0);
232317
+ }
232318
+ else if (event.type === 'ready' &&
232319
+ (event.payload.checksState
232320
+ ? event.payload.checksState === 'completed'
232321
+ : true)) {
232322
+ output.spinner('Completing', 0);
232323
+ }
232324
+ else if (event.type === 'checks-running') {
232325
+ output.spinner('Running Checks', 0);
232326
+ }
232327
+ else if (event.type === 'alias-assigned' ||
232328
+ event.type === 'checks-conclusion-failed') {
232329
+ output.stopSpinner();
232330
+ deployment = event.payload;
232331
+ break;
232332
+ }
232333
+ else if (event.type === 'canceled') {
232334
+ output.stopSpinner();
232335
+ output.print('The deployment has been canceled.\n');
232336
+ return 1;
232337
+ }
232338
+ else if (event.type === 'error') {
232339
+ output.stopSpinner();
232340
+ const now = new util_1.default({
232025
232341
  client,
232026
232342
  currentTeam: fromDeployment.team?.id,
232027
232343
  });
@@ -232297,7 +232613,7 @@ function deploymentsAndProjects(deployments, projects, conjunction = 'and') {
232297
232613
 
232298
232614
  /***/ }),
232299
232615
 
232300
- /***/ 79627:
232616
+ /***/ 78339:
232301
232617
  /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
232302
232618
 
232303
232619
  "use strict";
@@ -232307,18 +232623,18 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
232307
232623
  };
232308
232624
  Object.defineProperty(exports, "__esModule", ({ value: true }));
232309
232625
  const chalk_1 = __importDefault(__webpack_require__(90877));
232310
- const ensure_link_1 = __webpack_require__(65382);
232311
232626
  const get_args_1 = __importDefault(__webpack_require__(2505));
232627
+ const get_project_by_cwd_or_link_1 = __importDefault(__webpack_require__(90675));
232312
232628
  const pkg_name_1 = __webpack_require__(79000);
232313
232629
  const handle_error_1 = __importDefault(__webpack_require__(64377));
232630
+ const error_utils_1 = __webpack_require__(39799);
232314
232631
  const logo_1 = __importDefault(__webpack_require__(66669));
232315
232632
  const ms_1 = __importDefault(__webpack_require__(21378));
232316
- const request_rollback_1 = __importDefault(__webpack_require__(58601));
232317
- const status_1 = __importDefault(__webpack_require__(87181));
232318
- const validate_paths_1 = __importDefault(__webpack_require__(33922));
232633
+ const request_rollback_1 = __importDefault(__webpack_require__(30964));
232634
+ const status_1 = __importDefault(__webpack_require__(16097));
232319
232635
  const help = () => {
232320
232636
  console.log(`
232321
- ${chalk_1.default.bold(`${logo_1.default} ${(0, pkg_name_1.getPkgName)()} rollback`)} [deploymentId|deploymentName]
232637
+ ${chalk_1.default.bold(`${logo_1.default} ${(0, pkg_name_1.getPkgName)()} rollback`)} [deployment id/url]
232322
232638
 
232323
232639
  Quickly revert back to a previous deployment.
232324
232640
 
@@ -232339,6 +232655,7 @@ const help = () => {
232339
232655
 
232340
232656
  ${chalk_1.default.cyan(`$ ${(0, pkg_name_1.getPkgName)()} rollback`)}
232341
232657
  ${chalk_1.default.cyan(`$ ${(0, pkg_name_1.getPkgName)()} rollback status`)}
232658
+ ${chalk_1.default.cyan(`$ ${(0, pkg_name_1.getPkgName)()} rollback status <project>`)}
232342
232659
  ${chalk_1.default.cyan(`$ ${(0, pkg_name_1.getPkgName)()} rollback status --timeout 30s`)}
232343
232660
 
232344
232661
  ${chalk_1.default.gray('–')} Rollback a deployment using id or url
@@ -232355,56 +232672,276 @@ exports.default = async (client) => {
232355
232672
  let argv;
232356
232673
  try {
232357
232674
  argv = (0, get_args_1.default)(client.argv.slice(2), {
232358
- '--debug': Boolean,
232359
- '-d': '--debug',
232360
232675
  '--timeout': String,
232361
232676
  '--yes': Boolean,
232362
232677
  '-y': '--yes',
232363
232678
  });
232364
232679
  }
232365
- catch (err) {
232366
- (0, handle_error_1.default)(err);
232367
- return 1;
232680
+ catch (err) {
232681
+ (0, handle_error_1.default)(err);
232682
+ return 1;
232683
+ }
232684
+ if (argv['--help'] || argv._[0] === 'help') {
232685
+ help();
232686
+ return 2;
232687
+ }
232688
+ // validate the timeout
232689
+ let timeout = argv['--timeout'];
232690
+ if (timeout && (0, ms_1.default)(timeout) === undefined) {
232691
+ client.output.error(`Invalid timeout "${timeout}"`);
232692
+ return 1;
232693
+ }
232694
+ const actionOrDeployId = argv._[1] || 'status';
232695
+ try {
232696
+ if (actionOrDeployId === 'status') {
232697
+ const project = await (0, get_project_by_cwd_or_link_1.default)({
232698
+ autoConfirm: Boolean(argv['--yes']),
232699
+ client,
232700
+ commandName: 'promote',
232701
+ cwd: client.cwd,
232702
+ projectNameOrId: argv._[2],
232703
+ });
232704
+ return await (0, status_1.default)({
232705
+ client,
232706
+ project,
232707
+ timeout,
232708
+ });
232709
+ }
232710
+ return await (0, request_rollback_1.default)({
232711
+ client,
232712
+ deployId: actionOrDeployId,
232713
+ timeout,
232714
+ });
232715
+ }
232716
+ catch (err) {
232717
+ if ((0, error_utils_1.isErrnoException)(err)) {
232718
+ if (err.code === 'ERR_CANCELED') {
232719
+ return 0;
232720
+ }
232721
+ if (err.code === 'ERR_INVALID_CWD' || err.code === 'ERR_LINK_PROJECT') {
232722
+ // do not show the message
232723
+ return 1;
232724
+ }
232725
+ }
232726
+ client.output.prettyError(err);
232727
+ return 1;
232728
+ }
232729
+ };
232730
+
232731
+
232732
+ /***/ }),
232733
+
232734
+ /***/ 30964:
232735
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
232736
+
232737
+ "use strict";
232738
+
232739
+ var __importDefault = (this && this.__importDefault) || function (mod) {
232740
+ return (mod && mod.__esModule) ? mod : { "default": mod };
232741
+ };
232742
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
232743
+ const chalk_1 = __importDefault(__webpack_require__(90877));
232744
+ const pkg_name_1 = __webpack_require__(79000);
232745
+ const get_project_by_deployment_1 = __importDefault(__webpack_require__(67231));
232746
+ const ms_1 = __importDefault(__webpack_require__(21378));
232747
+ const status_1 = __importDefault(__webpack_require__(16097));
232748
+ /**
232749
+ * Requests a rollback and waits for it complete.
232750
+ * @param {Client} client - The Vercel client instance
232751
+ * @param {string} deployIdOrUrl - The deployment name or id to rollback
232752
+ * @param {string} [timeout] - Time to poll for succeeded/failed state
232753
+ * @returns {Promise<number>} Resolves an exit code; 0 on success
232754
+ */
232755
+ async function requestRollback({ client, deployId, timeout, }) {
232756
+ const { output } = client;
232757
+ const { contextName, deployment, project } = await (0, get_project_by_deployment_1.default)({
232758
+ client,
232759
+ deployId,
232760
+ output: client.output,
232761
+ });
232762
+ // create the rollback
232763
+ await client.fetch(`/v9/projects/${project.id}/rollback/${deployment.id}`, {
232764
+ body: {},
232765
+ method: 'POST',
232766
+ });
232767
+ if (timeout !== undefined && (0, ms_1.default)(timeout) === 0) {
232768
+ output.log(`Successfully requested rollback of ${chalk_1.default.bold(project.name)} to ${deployment.url} (${deployment.id})`);
232769
+ output.log(`To check rollback status, run ${(0, pkg_name_1.getCommandName)('rollback')}.`);
232770
+ return 0;
232771
+ }
232772
+ // check the status
232773
+ return await (0, status_1.default)({
232774
+ client,
232775
+ contextName,
232776
+ deployment,
232777
+ project,
232778
+ timeout,
232779
+ });
232780
+ }
232781
+ exports.default = requestRollback;
232782
+
232783
+
232784
+ /***/ }),
232785
+
232786
+ /***/ 16097:
232787
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
232788
+
232789
+ "use strict";
232790
+
232791
+ var __importDefault = (this && this.__importDefault) || function (mod) {
232792
+ return (mod && mod.__esModule) ? mod : { "default": mod };
232793
+ };
232794
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
232795
+ const chalk_1 = __importDefault(__webpack_require__(90877));
232796
+ const elapsed_1 = __importDefault(__webpack_require__(14099));
232797
+ const format_date_1 = __importDefault(__webpack_require__(738));
232798
+ const get_deployment_1 = __importDefault(__webpack_require__(84249));
232799
+ const pkg_name_1 = __webpack_require__(79000);
232800
+ const get_project_by_id_or_name_1 = __importDefault(__webpack_require__(6729));
232801
+ const get_scope_1 = __importDefault(__webpack_require__(60324));
232802
+ const ms_1 = __importDefault(__webpack_require__(21378));
232803
+ const errors_ts_1 = __webpack_require__(39240);
232804
+ const render_alias_status_1 = __importDefault(__webpack_require__(33688));
232805
+ const sleep_1 = __importDefault(__webpack_require__(89507));
232806
+ /**
232807
+ * Continuously checks a deployment status until it has succeeded, failed, or
232808
+ * taken longer than the timeout (default 3 minutes).
232809
+ * @param {Client} client - The Vercel client instance
232810
+ * @param {string} [contextName] - The scope name; if not specified, it will be
232811
+ * extracted from the `client`
232812
+ * @param {Deployment} [deployment] - Info about the deployment which is used
232813
+ * to display different output following a rollback request
232814
+ * @param {Project} project - Project info instance
232815
+ * @param {string} [timeout] - Milliseconds to poll for succeeded/failed state
232816
+ * @returns {Promise<number>} Resolves an exit code; 0 on success
232817
+ */
232818
+ async function rollbackStatus({ client, contextName, deployment, project, timeout = '3m', }) {
232819
+ const { output } = client;
232820
+ const recentThreshold = Date.now() - (0, ms_1.default)('3m');
232821
+ const rollbackTimeout = Date.now() + (0, ms_1.default)(timeout);
232822
+ let counter = 0;
232823
+ let spinnerMessage = deployment
232824
+ ? 'Rollback in progress'
232825
+ : `Checking rollback status of ${project.name}`;
232826
+ if (!contextName) {
232827
+ ({ contextName } = await (0, get_scope_1.default)(client));
232828
+ }
232829
+ try {
232830
+ output.spinner(`${spinnerMessage}…`);
232831
+ // continuously loop until the rollback has explicitly succeeded, failed,
232832
+ // or timed out
232833
+ for (;;) {
232834
+ const projectCheck = await (0, get_project_by_id_or_name_1.default)(client, project.id, project.accountId, true);
232835
+ if (projectCheck instanceof errors_ts_1.ProjectNotFound) {
232836
+ throw projectCheck;
232837
+ }
232838
+ const { jobStatus, requestedAt, toDeploymentId, type, } = projectCheck.lastAliasRequest ?? {};
232839
+ if (!jobStatus ||
232840
+ (jobStatus !== 'in-progress' && jobStatus !== 'pending')) {
232841
+ output.stopSpinner();
232842
+ output.log(`${spinnerMessage}…`);
232843
+ }
232844
+ if (!jobStatus ||
232845
+ !requestedAt ||
232846
+ !toDeploymentId ||
232847
+ requestedAt < recentThreshold) {
232848
+ output.log('No deployment rollback in progress');
232849
+ return 0;
232850
+ }
232851
+ if (jobStatus === 'skipped' && type === 'rollback') {
232852
+ output.log('Rollback was skipped');
232853
+ return 0;
232854
+ }
232855
+ if (jobStatus === 'succeeded') {
232856
+ return await renderJobSucceeded({
232857
+ client,
232858
+ contextName,
232859
+ performingRollback: !!deployment,
232860
+ requestedAt,
232861
+ project,
232862
+ toDeploymentId,
232863
+ });
232864
+ }
232865
+ if (jobStatus === 'failed') {
232866
+ return await renderJobFailed({
232867
+ client,
232868
+ contextName,
232869
+ deployment,
232870
+ project,
232871
+ toDeploymentId,
232872
+ });
232873
+ }
232874
+ // lastly, if we're not pending/in-progress, then we don't know what
232875
+ // the status is, so bail
232876
+ if (jobStatus !== 'pending' && jobStatus !== 'in-progress') {
232877
+ output.log(`Unknown rollback status "${jobStatus}"`);
232878
+ return 1;
232879
+ }
232880
+ // check if we have been running for too long
232881
+ if (requestedAt < recentThreshold || Date.now() >= rollbackTimeout) {
232882
+ output.log(`The rollback exceeded its deadline - rerun ${chalk_1.default.bold(`${(0, pkg_name_1.getPkgName)()} rollback ${toDeploymentId}`)} to try again`);
232883
+ return 1;
232884
+ }
232885
+ // if we've done our first poll and not rolling back, then print the
232886
+ // requested at date/time
232887
+ if (counter++ === 0 && !deployment) {
232888
+ spinnerMessage += ` requested at ${(0, format_date_1.default)(requestedAt)}`;
232889
+ }
232890
+ output.spinner(`${spinnerMessage}…`);
232891
+ await (0, sleep_1.default)(250);
232892
+ }
232893
+ }
232894
+ finally {
232895
+ output.stopSpinner();
232368
232896
  }
232369
- if (argv['--help'] || argv._[0] === 'help') {
232370
- help();
232371
- return 2;
232897
+ }
232898
+ exports.default = rollbackStatus;
232899
+ async function renderJobFailed({ client, contextName, deployment, project, toDeploymentId, }) {
232900
+ const { output } = client;
232901
+ try {
232902
+ const name = (deployment || (await (0, get_deployment_1.default)(client, contextName, toDeploymentId)))?.url;
232903
+ output.error(`Failed to remap all aliases to the requested deployment ${name} (${toDeploymentId})`);
232372
232904
  }
232373
- // ensure the current directory is good
232374
- const cwd = argv['--cwd'] || process.cwd();
232375
- const pathValidation = await (0, validate_paths_1.default)(client, [cwd]);
232376
- if (!pathValidation.valid) {
232377
- return pathValidation.exitCode;
232905
+ catch (e) {
232906
+ output.error(`Failed to remap all aliases to the requested deployment ${toDeploymentId}`);
232378
232907
  }
232379
- // ensure the current directory is a linked project
232380
- const linkedProject = await (0, ensure_link_1.ensureLink)('rollback', client, pathValidation.path, {
232381
- autoConfirm: Boolean(argv['--yes']),
232382
- });
232383
- if (typeof linkedProject === 'number') {
232384
- return linkedProject;
232908
+ // aliases are paginated, so continuously loop until all of them have been
232909
+ // fetched
232910
+ let nextTimestamp;
232911
+ for (;;) {
232912
+ let url = `/v9/projects/${project.id}/rollback/aliases?failedOnly=true&limit=20`;
232913
+ if (nextTimestamp) {
232914
+ url += `&until=${nextTimestamp}`;
232915
+ }
232916
+ const { aliases, pagination } = await client.fetch(url);
232917
+ for (const { alias, status } of aliases) {
232918
+ output.log(` ${(0, render_alias_status_1.default)(status).padEnd(11)} ${alias.alias} (${alias.deploymentId})`);
232919
+ }
232920
+ if (pagination?.next) {
232921
+ nextTimestamp = pagination.next;
232922
+ }
232923
+ else {
232924
+ break;
232925
+ }
232385
232926
  }
232386
- // validate the timeout
232387
- let timeout = argv['--timeout'];
232388
- if (timeout && (0, ms_1.default)(timeout) === undefined) {
232389
- client.output.error(`Invalid timeout "${timeout}"`);
232390
- return 1;
232927
+ return 1;
232928
+ }
232929
+ async function renderJobSucceeded({ client, contextName, performingRollback, project, requestedAt, toDeploymentId, }) {
232930
+ const { output } = client;
232931
+ // attempt to get the new deployment url
232932
+ let deploymentInfo = '';
232933
+ try {
232934
+ const deployment = await (0, get_deployment_1.default)(client, contextName, toDeploymentId);
232935
+ deploymentInfo = `${chalk_1.default.bold(deployment.url)} (${toDeploymentId})`;
232391
232936
  }
232392
- const { project } = linkedProject;
232393
- const actionOrDeployId = argv._[1] || 'status';
232394
- if (actionOrDeployId === 'status') {
232395
- return await (0, status_1.default)({
232396
- client,
232397
- project,
232398
- timeout,
232399
- });
232937
+ catch (err) {
232938
+ output.debug(`Failed to get deployment url for ${toDeploymentId}: ${err?.toString() || err}`);
232939
+ deploymentInfo = chalk_1.default.bold(toDeploymentId);
232400
232940
  }
232401
- return await (0, request_rollback_1.default)({
232402
- client,
232403
- deployIdOrUrl: actionOrDeployId,
232404
- project,
232405
- timeout,
232406
- });
232407
- };
232941
+ const duration = performingRollback ? (0, elapsed_1.default)(Date.now() - requestedAt) : '';
232942
+ output.log(`Success! ${chalk_1.default.bold(project.name)} was rolled back to ${deploymentInfo} ${duration}`);
232943
+ return 0;
232944
+ }
232408
232945
 
232409
232946
 
232410
232947
  /***/ }),
@@ -233228,11 +233765,6 @@ const main = async () => {
233228
233765
  output.prettyError(localConfig);
233229
233766
  return 1;
233230
233767
  }
233231
- let cwd = argv['--cwd'];
233232
- if (cwd) {
233233
- process.chdir(cwd);
233234
- }
233235
- cwd = process.cwd();
233236
233768
  // The second argument to the command can be:
233237
233769
  //
233238
233770
  // * a path to deploy (as in: `vercel path/`)
@@ -233334,6 +233866,11 @@ const main = async () => {
233334
233866
  localConfigPath,
233335
233867
  argv: process.argv,
233336
233868
  });
233869
+ // The `--cwd` flag is respected for all sub-commands
233870
+ if (argv['--cwd']) {
233871
+ client.cwd = argv['--cwd'];
233872
+ }
233873
+ const { cwd } = client;
233337
233874
  // Gets populated to the subcommand name when a built-in is
233338
233875
  // provided, otherwise it remains undefined for an extension
233339
233876
  let subcommand = undefined;
@@ -233573,6 +234110,9 @@ const main = async () => {
233573
234110
  case 'project':
233574
234111
  func = __webpack_require__(80860).default;
233575
234112
  break;
234113
+ case 'promote':
234114
+ func = __webpack_require__(62435).default;
234115
+ break;
233576
234116
  case 'pull':
233577
234117
  func = __webpack_require__(65158).default;
233578
234118
  break;
@@ -233583,7 +234123,7 @@ const main = async () => {
233583
234123
  func = __webpack_require__(5445).default;
233584
234124
  break;
233585
234125
  case 'rollback':
233586
- func = __webpack_require__(79627).default;
234126
+ func = __webpack_require__(78339).default;
233587
234127
  break;
233588
234128
  case 'secrets':
233589
234129
  func = __webpack_require__(5200)/* .default */ .Z;
@@ -234039,6 +234579,38 @@ async function removeAliasById(client, id) {
234039
234579
  exports.default = removeAliasById;
234040
234580
 
234041
234581
 
234582
+ /***/ }),
234583
+
234584
+ /***/ 33688:
234585
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
234586
+
234587
+ "use strict";
234588
+
234589
+ var __importDefault = (this && this.__importDefault) || function (mod) {
234590
+ return (mod && mod.__esModule) ? mod : { "default": mod };
234591
+ };
234592
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
234593
+ const chalk_1 = __importDefault(__webpack_require__(90877));
234594
+ /**
234595
+ * Stylize the alias status label.
234596
+ * @param {AliasStatus} status - The status label
234597
+ * @returns {string}
234598
+ */
234599
+ function renderAliasStatus(status) {
234600
+ if (status === 'completed') {
234601
+ return chalk_1.default.green(status);
234602
+ }
234603
+ if (status === 'failed') {
234604
+ return chalk_1.default.red(status);
234605
+ }
234606
+ if (status === 'skipped') {
234607
+ return chalk_1.default.gray(status);
234608
+ }
234609
+ return chalk_1.default.yellow(status);
234610
+ }
234611
+ exports.default = renderAliasStatus;
234612
+
234613
+
234042
234614
  /***/ }),
234043
234615
 
234044
234616
  /***/ 73396:
@@ -234583,7 +235155,10 @@ const build = async ({ entrypoint, files, config }) => {
234583
235155
  for (let [filename, fileFsRef] of Object.entries(files)) {
234584
235156
  if (filename.startsWith('.git/') ||
234585
235157
  filename === 'vercel.json' ||
234586
- filename === 'now.json') {
235158
+ filename === '.vercelignore' ||
235159
+ filename === 'now.json' ||
235160
+ filename === '.nowignore' ||
235161
+ filename.startsWith('.env')) {
234587
235162
  continue;
234588
235163
  }
234589
235164
  if (entrypoint &&
@@ -235906,6 +236481,12 @@ class Client extends events_1.EventEmitter {
235906
236481
  output: this.stderr,
235907
236482
  });
235908
236483
  }
236484
+ get cwd() {
236485
+ return process.cwd();
236486
+ }
236487
+ set cwd(v) {
236488
+ process.chdir(v);
236489
+ }
235909
236490
  }
235910
236491
  exports.default = Client;
235911
236492
 
@@ -236387,9 +236968,9 @@ const ERRORS_TS = __importStar(__webpack_require__(39240));
236387
236968
  const ERRORS = __importStar(__webpack_require__(74148));
236388
236969
  const now_error_1 = __webpack_require__(22216);
236389
236970
  const map_cert_error_1 = __importDefault(__webpack_require__(72812));
236390
- async function createDeploy(client, now, contextName, paths, createArgs, org, isSettingUpProject, cwd, archive) {
236971
+ async function createDeploy(client, now, contextName, path, createArgs, org, isSettingUpProject, cwd, archive) {
236391
236972
  try {
236392
- return await now.create(paths, createArgs, org, isSettingUpProject, archive, cwd);
236973
+ return await now.create(path, createArgs, org, isSettingUpProject, cwd, archive);
236393
236974
  }
236394
236975
  catch (err) {
236395
236976
  if (ERRORS_TS.isAPIError(err)) {
@@ -236444,7 +237025,7 @@ async function createDeploy(client, now, contextName, paths, createArgs, org, is
236444
237025
  if (result instanceof now_error_1.NowError) {
236445
237026
  return result;
236446
237027
  }
236447
- return createDeploy(client, now, contextName, paths, createArgs, org, isSettingUpProject);
237028
+ return createDeploy(client, now, contextName, path, createArgs, org, isSettingUpProject, cwd);
236448
237029
  }
236449
237030
  if (err.code === 'not_found') {
236450
237031
  throw new ERRORS_TS.DeploymentNotFound({ context: contextName });
@@ -236911,8 +237492,9 @@ function printInspectUrl(output, inspectorUrl, deployStamp) {
236911
237492
  output.print((0, emoji_1.prependEmoji)(`Inspect: ${chalk_1.default.bold(inspectorUrl)} ${deployStamp()}`, (0, emoji_1.emoji)('inspect')) + `\n`);
236912
237493
  }
236913
237494
  async function processDeployment({ org, cwd, projectName, isSettingUpProject, archive, skipAutoDetectionConfirmation, noWait, agent, ...args }) {
236914
- let { now, output, paths, requestBody, deployStamp, force, withCache, quiet, prebuilt, rootDirectory, } = args;
236915
- const { debug } = output;
237495
+ let { now, path, requestBody, deployStamp, force, withCache, quiet, prebuilt, rootDirectory, } = args;
237496
+ const client = now._client;
237497
+ const { output } = client;
236916
237498
  const { env = {} } = requestBody;
236917
237499
  const token = now._token;
236918
237500
  if (!token) {
@@ -236924,7 +237506,7 @@ async function processDeployment({ org, cwd, projectName, isSettingUpProject, ar
236924
237506
  token,
236925
237507
  debug: now._debug,
236926
237508
  userAgent: ua_1.default,
236927
- path: paths[0],
237509
+ path,
236928
237510
  force,
236929
237511
  withCache,
236930
237512
  prebuilt,
@@ -236947,7 +237529,7 @@ async function processDeployment({ org, cwd, projectName, isSettingUpProject, ar
236947
237529
  }
236948
237530
  if (event.type === 'file-count') {
236949
237531
  const { total, missing, uploads } = event.payload;
236950
- debug(`Total files ${total.size}, ${missing.length} changed`);
237532
+ output.debug(`Total files ${total.size}, ${missing.length} changed`);
236951
237533
  const missingSize = missing
236952
237534
  .map((sha) => total.get(sha).data.length)
236953
237535
  .reduce((a, b) => a + b, 0);
@@ -236980,10 +237562,10 @@ async function processDeployment({ org, cwd, projectName, isSettingUpProject, ar
236980
237562
  updateProgress();
236981
237563
  }
236982
237564
  if (event.type === 'file-uploaded') {
236983
- debug(`Uploaded: ${event.payload.file.names.join(' ')} (${(0, bytes_1.default)(event.payload.file.data.length)})`);
237565
+ output.debug(`Uploaded: ${event.payload.file.names.join(' ')} (${(0, bytes_1.default)(event.payload.file.data.length)})`);
236984
237566
  }
236985
237567
  if (event.type === 'created') {
236986
- await (0, link_1.linkFolderToProject)(output, cwd || paths[0], {
237568
+ await (0, link_1.linkFolderToProject)(client, cwd, {
236987
237569
  orgId: org.id,
236988
237570
  projectId: event.payload.projectId,
236989
237571
  }, projectName, org.slug);
@@ -243897,11 +244479,11 @@ class Now extends events_1.default {
243897
244479
  get _debug() {
243898
244480
  return this._client.output.isDebugEnabled();
243899
244481
  }
243900
- async create(paths, {
244482
+ async create(path, {
243901
244483
  // Legacy
243902
244484
  nowConfig: nowConfig = {},
243903
244485
  // Latest
243904
- 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, archive, cwd) {
244486
+ 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) {
243905
244487
  let hashes = {};
243906
244488
  const uploadStamp = (0, stamp_1.default)();
243907
244489
  let requestBody = {
@@ -243924,9 +244506,8 @@ class Now extends events_1.default {
243924
244506
  delete requestBody.github;
243925
244507
  const deployment = await (0, process_deployment_1.default)({
243926
244508
  now: this,
243927
- output: this._output,
243928
244509
  agent: this._client.agent,
243929
- paths,
244510
+ path,
243930
244511
  requestBody,
243931
244512
  uploadStamp,
243932
244513
  deployStamp,
@@ -245465,7 +246046,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
245465
246046
  return (mod && mod.__esModule) ? mod : { "default": mod };
245466
246047
  };
245467
246048
  Object.defineProperty(exports, "__esModule", ({ value: true }));
245468
- exports.findProjectFromPath = exports.traverseUpDirectories = exports.findRepoRoot = exports.ensureRepoLink = exports.getRepoLink = void 0;
246049
+ exports.findProjectFromPath = exports.findProjectsFromPath = exports.traverseUpDirectories = exports.findRepoRoot = exports.ensureRepoLink = exports.getRepoLink = void 0;
245469
246050
  const chalk_1 = __importDefault(__webpack_require__(90877));
245470
246051
  const pluralize_1 = __importDefault(__webpack_require__(43669));
245471
246052
  const os_1 = __webpack_require__(12087);
@@ -245604,8 +246185,20 @@ async function findRepoRoot(start) {
245604
246185
  // this isn't the repo we're looking for. Bail.
245605
246186
  break;
245606
246187
  }
246188
+ // if `.vercel/repo.json` exists (already linked),
246189
+ // then consider this the repo root
246190
+ const repoConfigPath = (0, path_1.join)(current, link_1.VERCEL_DIR, link_1.VERCEL_DIR_REPO);
246191
+ let stat = await (0, fs_extra_1.lstat)(repoConfigPath).catch(err => {
246192
+ if (err.code !== 'ENOENT')
246193
+ throw err;
246194
+ });
246195
+ if (stat) {
246196
+ return current;
246197
+ }
246198
+ // if `.git/config` exists (unlinked),
246199
+ // then consider this the repo root
245607
246200
  const gitConfigPath = (0, path_1.join)(current, '.git/config');
245608
- const stat = await (0, fs_extra_1.lstat)(gitConfigPath).catch(err => {
246201
+ stat = await (0, fs_extra_1.lstat)(gitConfigPath).catch(err => {
245609
246202
  if (err.code !== 'ENOENT')
245610
246203
  throw err;
245611
246204
  });
@@ -245631,16 +246224,16 @@ function sortByDirectory(a, b) {
245631
246224
  return bParts.length - aParts.length;
245632
246225
  }
245633
246226
  /**
245634
- * Finds the matching Project from an array of Project links
246227
+ * Finds the matching Projects from an array of Project links
245635
246228
  * where the provided relative path is within the Project's
245636
246229
  * root directory.
245637
246230
  */
245638
- function findProjectFromPath(projects, path) {
246231
+ function findProjectsFromPath(projects, path) {
245639
246232
  const normalizedPath = (0, build_utils_1.normalizePath)(path);
245640
246233
  return projects
245641
246234
  .slice()
245642
246235
  .sort(sortByDirectory)
245643
- .find(project => {
246236
+ .filter(project => {
245644
246237
  if (project.directory === '.') {
245645
246238
  // Project has no "Root Directory" setting, so any path is valid
245646
246239
  return true;
@@ -245649,6 +246242,13 @@ function findProjectFromPath(projects, path) {
245649
246242
  normalizedPath.startsWith(`${project.directory}/`));
245650
246243
  });
245651
246244
  }
246245
+ exports.findProjectsFromPath = findProjectsFromPath;
246246
+ /**
246247
+ * TODO: remove
246248
+ */
246249
+ function findProjectFromPath(projects, path) {
246250
+ return findProjectsFromPath(projects, path)[0];
246251
+ }
245652
246252
  exports.findProjectFromPath = findProjectFromPath;
245653
246253
 
245654
246254
 
@@ -245740,7 +246340,7 @@ async function setupAndLink(client, path, { autoConfirm = false, forceDelete = f
245740
246340
  }
245741
246341
  else {
245742
246342
  const project = projectOrNewProjectName;
245743
- await (0, link_1.linkFolderToProject)(output, path, {
246343
+ await (0, link_1.linkFolderToProject)(client, path, {
245744
246344
  projectId: project.id,
245745
246345
  orgId: org.id,
245746
246346
  }, project.name, org.slug, successEmoji);
@@ -245792,7 +246392,7 @@ async function setupAndLink(client, path, { autoConfirm = false, forceDelete = f
245792
246392
  },
245793
246393
  autoAssignCustomDomains: true,
245794
246394
  };
245795
- const deployment = await (0, create_deploy_1.default)(client, now, config.currentTeam || 'current user', [sourcePath], createArgs, org, true, path);
246395
+ const deployment = await (0, create_deploy_1.default)(client, now, config.currentTeam || 'current user', sourcePath, createArgs, org, true, path);
245796
246396
  if (!deployment ||
245797
246397
  !('code' in deployment) ||
245798
246398
  deployment.code !== 'missing_project_settings') {
@@ -245815,7 +246415,7 @@ async function setupAndLink(client, path, { autoConfirm = false, forceDelete = f
245815
246415
  const project = await (0, create_project_1.default)(client, newProjectName);
245816
246416
  await (0, update_project_1.default)(client, project.id, settings);
245817
246417
  Object.assign(project, settings);
245818
- await (0, link_1.linkFolderToProject)(output, path, {
246418
+ await (0, link_1.linkFolderToProject)(client, path, {
245819
246419
  projectId: project.id,
245820
246420
  orgId: org.id,
245821
246421
  }, project.name, org.slug, successEmoji);
@@ -247729,6 +248329,118 @@ async function findProjectsForDomain(client, domainName) {
247729
248329
  exports.findProjectsForDomain = findProjectsForDomain;
247730
248330
 
247731
248331
 
248332
+ /***/ }),
248333
+
248334
+ /***/ 90675:
248335
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
248336
+
248337
+ "use strict";
248338
+
248339
+ var __importDefault = (this && this.__importDefault) || function (mod) {
248340
+ return (mod && mod.__esModule) ? mod : { "default": mod };
248341
+ };
248342
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
248343
+ const errors_ts_1 = __webpack_require__(39240);
248344
+ const ensure_link_1 = __webpack_require__(65382);
248345
+ const get_project_by_id_or_name_1 = __importDefault(__webpack_require__(6729));
248346
+ async function getProjectByCwdOrLink({ autoConfirm, client, commandName, cwd, projectNameOrId, }) {
248347
+ if (projectNameOrId) {
248348
+ const project = await (0, get_project_by_id_or_name_1.default)(client, projectNameOrId);
248349
+ if (project instanceof errors_ts_1.ProjectNotFound) {
248350
+ throw project;
248351
+ }
248352
+ return project;
248353
+ }
248354
+ // ensure the current directory is a linked project
248355
+ const linkedProject = await (0, ensure_link_1.ensureLink)(commandName, client, cwd, {
248356
+ autoConfirm,
248357
+ });
248358
+ if (typeof linkedProject === 'number') {
248359
+ const err = new Error('Link project error');
248360
+ err.code = 'ERR_LINK_PROJECT';
248361
+ throw err;
248362
+ }
248363
+ return linkedProject.project;
248364
+ }
248365
+ exports.default = getProjectByCwdOrLink;
248366
+
248367
+
248368
+ /***/ }),
248369
+
248370
+ /***/ 67231:
248371
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
248372
+
248373
+ "use strict";
248374
+
248375
+ var __importDefault = (this && this.__importDefault) || function (mod) {
248376
+ return (mod && mod.__esModule) ? mod : { "default": mod };
248377
+ };
248378
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
248379
+ const chalk_1 = __importDefault(__webpack_require__(90877));
248380
+ const get_deployment_1 = __importDefault(__webpack_require__(84249));
248381
+ const get_project_by_id_or_name_1 = __importDefault(__webpack_require__(6729));
248382
+ const get_scope_1 = __importDefault(__webpack_require__(60324));
248383
+ const get_team_by_id_1 = __importDefault(__webpack_require__(94949));
248384
+ const is_valid_name_1 = __webpack_require__(64476);
248385
+ const errors_ts_1 = __webpack_require__(39240);
248386
+ async function getProjectByDeployment({ client, deployId, output, }) {
248387
+ const { config } = client;
248388
+ const { contextName } = await (0, get_scope_1.default)(client);
248389
+ if (!(0, is_valid_name_1.isValidName)(deployId)) {
248390
+ throw new Error(`The provided argument "${deployId}" is not a valid deployment ID or URL`);
248391
+ }
248392
+ let deployment;
248393
+ let team;
248394
+ try {
248395
+ output?.spinner(`Fetching deployment "${deployId}" in ${chalk_1.default.bold(contextName)}…`);
248396
+ const [teamResult, deploymentResult] = await Promise.allSettled([
248397
+ config.currentTeam ? (0, get_team_by_id_1.default)(client, config.currentTeam) : undefined,
248398
+ (0, get_deployment_1.default)(client, contextName, deployId),
248399
+ ]);
248400
+ if (teamResult.status === 'rejected') {
248401
+ throw new Error(`Failed to retrieve team information: ${teamResult.reason}`);
248402
+ }
248403
+ if (deploymentResult.status === 'rejected') {
248404
+ throw new Error(deploymentResult.reason);
248405
+ }
248406
+ team = teamResult.value;
248407
+ deployment = deploymentResult.value;
248408
+ // re-render the spinner text
248409
+ output?.log(`Fetching deployment "${deployId}" in ${chalk_1.default.bold(contextName)}…`);
248410
+ if (deployment.team?.id) {
248411
+ if (!team || deployment.team.id !== team.id) {
248412
+ const err = new Error(team
248413
+ ? `Deployment doesn't belong to current team ${chalk_1.default.bold(contextName)}`
248414
+ : `Deployment belongs to a different team`);
248415
+ err.code = 'ERR_INVALID_TEAM';
248416
+ throw err;
248417
+ }
248418
+ }
248419
+ if (team) {
248420
+ const err = new Error(`Deployment doesn't belong to current team ${chalk_1.default.bold(contextName)}`);
248421
+ err.code = 'ERR_INVALID_TEAM';
248422
+ throw err;
248423
+ }
248424
+ if (!deployment.projectId) {
248425
+ throw new Error('Deployment is not associated to a project');
248426
+ }
248427
+ const project = await (0, get_project_by_id_or_name_1.default)(client, deployment.projectId);
248428
+ if (project instanceof errors_ts_1.ProjectNotFound) {
248429
+ throw project;
248430
+ }
248431
+ return {
248432
+ contextName,
248433
+ deployment,
248434
+ project,
248435
+ };
248436
+ }
248437
+ finally {
248438
+ output?.stopSpinner();
248439
+ }
248440
+ }
248441
+ exports.default = getProjectByDeployment;
248442
+
248443
+
247732
248444
  /***/ }),
247733
248445
 
247734
248446
  /***/ 6729:
@@ -247738,9 +248450,10 @@ exports.findProjectsForDomain = findProjectsForDomain;
247738
248450
 
247739
248451
  Object.defineProperty(exports, "__esModule", ({ value: true }));
247740
248452
  const errors_ts_1 = __webpack_require__(39240);
247741
- async function getProjectByNameOrId(client, projectNameOrId, accountId) {
248453
+ async function getProjectByNameOrId(client, projectNameOrId, accountId, includeRollbackInfo) {
247742
248454
  try {
247743
- const project = await client.fetch(`/v8/projects/${encodeURIComponent(projectNameOrId)}`, { accountId });
248455
+ const qs = includeRollbackInfo ? '?rollbackInfo=true' : '';
248456
+ const project = await client.fetch(`/v9/projects/${encodeURIComponent(projectNameOrId)}${qs}`, { accountId });
247744
248457
  return project;
247745
248458
  }
247746
248459
  catch (err) {
@@ -247822,34 +248535,38 @@ function getVercelDirectory(cwd) {
247822
248535
  return existingDirs[0] || possibleDirs[0];
247823
248536
  }
247824
248537
  exports.getVercelDirectory = getVercelDirectory;
247825
- async function getLink(path) {
247826
- // Try the individual project linking style (`${cwd}/.vercel/project.json`)
247827
- const dir = getVercelDirectory(path);
247828
- const linkFromProject = await getLinkFromDir(dir);
247829
- if (linkFromProject) {
247830
- return linkFromProject;
247831
- }
247832
- // Try the repo linking style (`${repoRoot}/.vercel/repo.json`)
247833
- return getLinkFromRepo(path);
247834
- }
247835
- async function getLinkFromRepo(path) {
247836
- const repoRoot = await (0, repo_1.findRepoRoot)(path);
247837
- if (!repoRoot) {
248538
+ async function getProjectLink(client, path) {
248539
+ return ((await getProjectLinkFromRepoLink(client, path)) ||
248540
+ (await getLinkFromDir(getVercelDirectory(path))));
248541
+ }
248542
+ async function getProjectLinkFromRepoLink(client, path) {
248543
+ const repoLink = await (0, repo_1.getRepoLink)(path);
248544
+ if (!repoLink?.repoConfig) {
247838
248545
  return null;
247839
248546
  }
247840
- try {
247841
- const vercelDir = (0, path_1.join)(repoRoot, exports.VERCEL_DIR);
247842
- const repoJsonPath = (0, path_1.join)(vercelDir, exports.VERCEL_DIR_REPO);
247843
- const repoJson = await (0, fs_extra_1.readJSON)(repoJsonPath);
247844
- const project = (0, repo_1.findProjectFromPath)(repoJson.projects, (0, path_1.relative)(repoRoot, path));
247845
- if (project) {
247846
- return { orgId: repoJson.orgId, projectId: project.id };
247847
- }
248547
+ const projects = (0, repo_1.findProjectsFromPath)(repoLink.repoConfig.projects, (0, path_1.relative)(repoLink.rootPath, path));
248548
+ let project;
248549
+ if (projects.length === 1) {
248550
+ project = projects[0];
247848
248551
  }
247849
- catch (err) {
247850
- if (!(0, error_utils_1.isErrnoException)(err) || err.code !== 'ENOENT') {
247851
- throw err;
247852
- }
248552
+ else {
248553
+ const { p } = await client.prompt({
248554
+ name: 'p',
248555
+ type: 'list',
248556
+ message: `Please select a Project:`,
248557
+ choices: repoLink.repoConfig.projects.map(p => ({
248558
+ value: p,
248559
+ name: p.name,
248560
+ })),
248561
+ });
248562
+ project = p;
248563
+ }
248564
+ if (project) {
248565
+ return {
248566
+ orgId: repoLink.repoConfig.orgId,
248567
+ projectId: project.id,
248568
+ repoRoot: repoLink.rootPath,
248569
+ };
247853
248570
  }
247854
248571
  return null;
247855
248572
  }
@@ -247890,7 +248607,30 @@ async function getOrgById(client, orgId) {
247890
248607
  return null;
247891
248608
  return { type: 'user', id: orgId, slug: user.username };
247892
248609
  }
247893
- async function getLinkedProject(client, path = process.cwd()) {
248610
+ async function hasProjectLink(projectLink, path) {
248611
+ // "linked" via env vars?
248612
+ const VERCEL_ORG_ID = (0, build_utils_1.getPlatformEnv)('ORG_ID');
248613
+ const VERCEL_PROJECT_ID = (0, build_utils_1.getPlatformEnv)('PROJECT_ID');
248614
+ if (VERCEL_ORG_ID === projectLink.orgId &&
248615
+ VERCEL_PROJECT_ID === projectLink.projectId) {
248616
+ return true;
248617
+ }
248618
+ // linked via `repo.json`?
248619
+ const repoLink = await (0, repo_1.getRepoLink)(path);
248620
+ if (repoLink?.repoConfig?.orgId === projectLink.orgId &&
248621
+ repoLink.repoConfig.projects.find(p => p.id === projectLink.projectId)) {
248622
+ return true;
248623
+ }
248624
+ // if the project is already linked, we skip linking
248625
+ const link = await getLinkFromDir(getVercelDirectory(path));
248626
+ if (link &&
248627
+ link.orgId === projectLink.orgId &&
248628
+ link.projectId === projectLink.projectId) {
248629
+ return true;
248630
+ }
248631
+ return false;
248632
+ }
248633
+ async function getLinkedProject(client, path = client.cwd) {
247894
248634
  const { output } = client;
247895
248635
  const VERCEL_ORG_ID = (0, build_utils_1.getPlatformEnv)('ORG_ID');
247896
248636
  const VERCEL_PROJECT_ID = (0, build_utils_1.getPlatformEnv)('PROJECT_ID');
@@ -247901,7 +248641,7 @@ async function getLinkedProject(client, path = process.cwd()) {
247901
248641
  }
247902
248642
  const link = VERCEL_ORG_ID && VERCEL_PROJECT_ID
247903
248643
  ? { orgId: VERCEL_ORG_ID, projectId: VERCEL_PROJECT_ID }
247904
- : await getLink(path);
248644
+ : await getProjectLink(client, path);
247905
248645
  if (!link) {
247906
248646
  return { status: 'not_linked', org: null, project: null };
247907
248647
  }
@@ -247945,21 +248685,12 @@ async function getLinkedProject(client, path = process.cwd()) {
247945
248685
  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')));
247946
248686
  return { status: 'not_linked', org: null, project: null };
247947
248687
  }
247948
- return { status: 'linked', org, project };
248688
+ return { status: 'linked', org, project, repoRoot: link.repoRoot };
247949
248689
  }
247950
248690
  exports.getLinkedProject = getLinkedProject;
247951
- async function linkFolderToProject(output, path, projectLink, projectName, orgSlug, successEmoji = 'link') {
247952
- const VERCEL_ORG_ID = (0, build_utils_1.getPlatformEnv)('ORG_ID');
247953
- const VERCEL_PROJECT_ID = (0, build_utils_1.getPlatformEnv)('PROJECT_ID');
247954
- // if defined, skip linking
247955
- if (VERCEL_ORG_ID || VERCEL_PROJECT_ID) {
247956
- return;
247957
- }
248691
+ async function linkFolderToProject(client, path, projectLink, projectName, orgSlug, successEmoji = 'link') {
247958
248692
  // if the project is already linked, we skip linking
247959
- const link = await getLink(path);
247960
- if (link &&
247961
- link.orgId === projectLink.orgId &&
247962
- link.projectId === projectLink.projectId) {
248693
+ if (await hasProjectLink(projectLink, path)) {
247963
248694
  return;
247964
248695
  }
247965
248696
  try {
@@ -247977,7 +248708,7 @@ async function linkFolderToProject(output, path, projectLink, projectName, orgSl
247977
248708
  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'));
247978
248709
  // update .gitignore
247979
248710
  const isGitIgnoreUpdated = await (0, add_to_gitignore_1.addToGitIgnore)(path);
247980
- 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');
248711
+ 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');
247981
248712
  }
247982
248713
  exports.linkFolderToProject = linkFolderToProject;
247983
248714
 
@@ -248332,260 +249063,6 @@ async function responseError(res, fallbackMessage = null, parsedBody = {}) {
248332
249063
  exports.default = responseError;
248333
249064
 
248334
249065
 
248335
- /***/ }),
248336
-
248337
- /***/ 8644:
248338
- /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
248339
-
248340
- "use strict";
248341
-
248342
- var __importDefault = (this && this.__importDefault) || function (mod) {
248343
- return (mod && mod.__esModule) ? mod : { "default": mod };
248344
- };
248345
- Object.defineProperty(exports, "__esModule", ({ value: true }));
248346
- const chalk_1 = __importDefault(__webpack_require__(90877));
248347
- /**
248348
- * Stylize the alias status label.
248349
- * @param {AliasStatus} status - The status label
248350
- * @returns {string}
248351
- */
248352
- function renderAliasStatus(status) {
248353
- if (status === 'completed') {
248354
- return chalk_1.default.green(status);
248355
- }
248356
- if (status === 'failed') {
248357
- return chalk_1.default.red(status);
248358
- }
248359
- if (status === 'skipped') {
248360
- return chalk_1.default.gray(status);
248361
- }
248362
- return chalk_1.default.yellow(status);
248363
- }
248364
- exports.default = renderAliasStatus;
248365
-
248366
-
248367
- /***/ }),
248368
-
248369
- /***/ 58601:
248370
- /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
248371
-
248372
- "use strict";
248373
-
248374
- var __importDefault = (this && this.__importDefault) || function (mod) {
248375
- return (mod && mod.__esModule) ? mod : { "default": mod };
248376
- };
248377
- Object.defineProperty(exports, "__esModule", ({ value: true }));
248378
- const chalk_1 = __importDefault(__webpack_require__(90877));
248379
- const pkg_name_1 = __webpack_require__(79000);
248380
- const get_deployment_by_id_or_url_1 = __webpack_require__(47662);
248381
- const get_scope_1 = __importDefault(__webpack_require__(60324));
248382
- const error_utils_1 = __webpack_require__(39799);
248383
- const ms_1 = __importDefault(__webpack_require__(21378));
248384
- const status_1 = __importDefault(__webpack_require__(87181));
248385
- /**
248386
- * Requests a rollback and waits for it complete.
248387
- * @param {Client} client - The Vercel client instance
248388
- * @param {string} deployIdOrUrl - The deployment name or id to rollback
248389
- * @param {Project} project - Project info instance
248390
- * @param {string} [timeout] - Time to poll for succeeded/failed state
248391
- * @returns {Promise<number>} Resolves an exit code; 0 on success
248392
- */
248393
- async function requestRollback({ client, deployIdOrUrl, project, timeout, }) {
248394
- const { output } = client;
248395
- const { contextName } = await (0, get_scope_1.default)(client);
248396
- try {
248397
- const deployment = await (0, get_deployment_by_id_or_url_1.getDeploymentByIdOrURL)({
248398
- client,
248399
- contextName,
248400
- deployIdOrUrl,
248401
- });
248402
- // create the rollback
248403
- await client.fetch(`/v9/projects/${project.id}/rollback/${deployment.id}`, {
248404
- body: {},
248405
- method: 'POST',
248406
- });
248407
- if (timeout !== undefined && (0, ms_1.default)(timeout) === 0) {
248408
- output.log(`Successfully requested rollback of ${chalk_1.default.bold(project.name)} to ${deployment.url} (${deployment.id})`);
248409
- output.log(`To check rollback status, run ${(0, pkg_name_1.getCommandName)('rollback')}.`);
248410
- return 0;
248411
- }
248412
- // check the status
248413
- return await (0, status_1.default)({
248414
- client,
248415
- contextName,
248416
- deployment,
248417
- project,
248418
- timeout,
248419
- });
248420
- }
248421
- catch (err) {
248422
- output.prettyError(err);
248423
- if ((0, error_utils_1.isErrnoException)(err) && err.code === 'ERR_INVALID_TEAM') {
248424
- output.error(`Use ${chalk_1.default.bold('vc switch')} to change your current team`);
248425
- }
248426
- return 1;
248427
- }
248428
- }
248429
- exports.default = requestRollback;
248430
-
248431
-
248432
- /***/ }),
248433
-
248434
- /***/ 87181:
248435
- /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
248436
-
248437
- "use strict";
248438
-
248439
- var __importDefault = (this && this.__importDefault) || function (mod) {
248440
- return (mod && mod.__esModule) ? mod : { "default": mod };
248441
- };
248442
- Object.defineProperty(exports, "__esModule", ({ value: true }));
248443
- const chalk_1 = __importDefault(__webpack_require__(90877));
248444
- const elapsed_1 = __importDefault(__webpack_require__(14099));
248445
- const format_date_1 = __importDefault(__webpack_require__(738));
248446
- const get_deployment_1 = __importDefault(__webpack_require__(84249));
248447
- const get_scope_1 = __importDefault(__webpack_require__(60324));
248448
- const ms_1 = __importDefault(__webpack_require__(21378));
248449
- const render_alias_status_1 = __importDefault(__webpack_require__(8644));
248450
- const sleep_1 = __importDefault(__webpack_require__(89507));
248451
- /**
248452
- * Continuously checks a deployment status until it has succeeded, failed, or
248453
- * taken longer than the timeout (default 3 minutes).
248454
- * @param {Client} client - The Vercel client instance
248455
- * @param {string} [contextName] - The scope name; if not specified, it will be
248456
- * extracted from the `client`
248457
- * @param {Deployment} [deployment] - Info about the deployment which is used
248458
- * to display different output following a rollback request
248459
- * @param {Project} project - Project info instance
248460
- * @param {string} [timeout] - Milliseconds to poll for succeeded/failed state
248461
- * @returns {Promise<number>} Resolves an exit code; 0 on success
248462
- */
248463
- async function rollbackStatus({ client, contextName, deployment, project, timeout = '3m', }) {
248464
- const { output } = client;
248465
- const recentThreshold = Date.now() - (0, ms_1.default)('3m');
248466
- const rollbackTimeout = Date.now() + (0, ms_1.default)(timeout);
248467
- let counter = 0;
248468
- let spinnerMessage = deployment
248469
- ? 'Rollback in progress'
248470
- : `Checking rollback status of ${project.name}`;
248471
- const check = async () => {
248472
- const { lastRollbackTarget } = await client.fetch(`/v9/projects/${project.id}?rollbackInfo=true`);
248473
- return lastRollbackTarget;
248474
- };
248475
- if (!contextName) {
248476
- ({ contextName } = await (0, get_scope_1.default)(client));
248477
- }
248478
- try {
248479
- output.spinner(`${spinnerMessage}…`);
248480
- // continuously loop until the rollback has explicitly succeeded, failed,
248481
- // or timed out
248482
- for (;;) {
248483
- const { jobStatus, requestedAt, toDeploymentId } = (await check()) ?? {};
248484
- if (!jobStatus ||
248485
- (jobStatus !== 'in-progress' && jobStatus !== 'pending')) {
248486
- output.stopSpinner();
248487
- output.log(`${spinnerMessage}…`);
248488
- }
248489
- if (!jobStatus || requestedAt < recentThreshold) {
248490
- output.log('No deployment rollback in progress');
248491
- return 0;
248492
- }
248493
- if (jobStatus === 'skipped') {
248494
- output.log('Rollback was skipped');
248495
- return 0;
248496
- }
248497
- if (jobStatus === 'succeeded') {
248498
- return await renderJobSucceeded({
248499
- client,
248500
- contextName,
248501
- performingRollback: !!deployment,
248502
- requestedAt,
248503
- project,
248504
- toDeploymentId,
248505
- });
248506
- }
248507
- if (jobStatus === 'failed') {
248508
- return await renderJobFailed({
248509
- client,
248510
- contextName,
248511
- deployment,
248512
- project,
248513
- toDeploymentId,
248514
- });
248515
- }
248516
- // lastly, if we're not pending/in-progress, then we don't know what
248517
- // the status is, so bail
248518
- if (jobStatus !== 'pending' && jobStatus !== 'in-progress') {
248519
- output.log(`Unknown rollback status "${jobStatus}"`);
248520
- return 1;
248521
- }
248522
- // check if we have been running for too long
248523
- if (requestedAt < recentThreshold || Date.now() >= rollbackTimeout) {
248524
- output.log(`The rollback exceeded its deadline - rerun ${chalk_1.default.bold(`vercel rollback ${toDeploymentId}`)} to try again`);
248525
- return 1;
248526
- }
248527
- // if we've done our first poll and not rolling back, then print the
248528
- // requested at date/time
248529
- if (counter++ === 0 && !deployment) {
248530
- spinnerMessage += ` requested at ${(0, format_date_1.default)(requestedAt)}`;
248531
- }
248532
- output.spinner(`${spinnerMessage}…`);
248533
- await (0, sleep_1.default)(250);
248534
- }
248535
- }
248536
- finally {
248537
- output.stopSpinner();
248538
- }
248539
- }
248540
- exports.default = rollbackStatus;
248541
- async function renderJobFailed({ client, contextName, deployment, project, toDeploymentId, }) {
248542
- const { output } = client;
248543
- try {
248544
- const name = (deployment || (await (0, get_deployment_1.default)(client, contextName, toDeploymentId)))?.url;
248545
- output.error(`Failed to remap all aliases to the requested deployment ${name} (${toDeploymentId})`);
248546
- }
248547
- catch (e) {
248548
- output.error(`Failed to remap all aliases to the requested deployment ${toDeploymentId}`);
248549
- }
248550
- // aliases are paginated, so continuously loop until all of them have been
248551
- // fetched
248552
- let nextTimestamp;
248553
- for (;;) {
248554
- let url = `/v9/projects/${project.id}/rollback/aliases?failedOnly=true&limit=20`;
248555
- if (nextTimestamp) {
248556
- url += `&until=${nextTimestamp}`;
248557
- }
248558
- const { aliases, pagination } = await client.fetch(url);
248559
- for (const { alias, status } of aliases) {
248560
- output.log(` ${(0, render_alias_status_1.default)(status).padEnd(11)} ${alias.alias} (${alias.deploymentId})`);
248561
- }
248562
- if (pagination?.next) {
248563
- nextTimestamp = pagination.next;
248564
- }
248565
- else {
248566
- break;
248567
- }
248568
- }
248569
- return 1;
248570
- }
248571
- async function renderJobSucceeded({ client, contextName, performingRollback, project, requestedAt, toDeploymentId, }) {
248572
- const { output } = client;
248573
- // attempt to get the new deployment url
248574
- let deploymentInfo = '';
248575
- try {
248576
- const deployment = await (0, get_deployment_1.default)(client, contextName, toDeploymentId);
248577
- deploymentInfo = `${chalk_1.default.bold(deployment.url)} (${toDeploymentId})`;
248578
- }
248579
- catch (err) {
248580
- output.debug(`Failed to get deployment url for ${toDeploymentId}: ${err?.toString() || err}`);
248581
- deploymentInfo = chalk_1.default.bold(toDeploymentId);
248582
- }
248583
- const duration = performingRollback ? (0, elapsed_1.default)(Date.now() - requestedAt) : '';
248584
- output.log(`Success! ${chalk_1.default.bold(project.name)} was rolled back to ${deploymentInfo} ${duration}`);
248585
- return 0;
248586
- }
248587
-
248588
-
248589
249066
  /***/ }),
248590
249067
 
248591
249068
  /***/ 89507:
@@ -249035,18 +249512,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
249035
249512
  };
249036
249513
  Object.defineProperty(exports, "__esModule", ({ value: true }));
249037
249514
  exports.validateRootDirectory = void 0;
249038
- const fs_1 = __webpack_require__(35747);
249039
- const util_1 = __webpack_require__(31669);
249515
+ const fs_extra_1 = __webpack_require__(36365);
249040
249516
  const chalk_1 = __importDefault(__webpack_require__(90877));
249041
249517
  const os_1 = __webpack_require__(12087);
249042
249518
  const confirm_1 = __importDefault(__webpack_require__(59320));
249043
249519
  const humanize_path_1 = __importDefault(__webpack_require__(33234));
249044
- const stat = (0, util_1.promisify)(fs_1.lstat);
249045
249520
  /**
249046
249521
  * A helper function to validate the `rootDirectory` input.
249047
249522
  */
249048
249523
  async function validateRootDirectory(output, cwd, path, errorSuffix) {
249049
- const pathStat = await stat(path).catch(() => null);
249524
+ const pathStat = await (0, fs_extra_1.lstat)(path).catch(() => null);
249050
249525
  const suffix = errorSuffix ? ` ${errorSuffix}` : '';
249051
249526
  if (!pathStat) {
249052
249527
  output.error(`The provided path ${chalk_1.default.cyan(`“${(0, humanize_path_1.default)(path)}”`)} does not exist.${suffix}`);
@@ -249072,7 +249547,7 @@ async function validatePaths(client, paths) {
249072
249547
  }
249073
249548
  const path = paths[0];
249074
249549
  // can only deploy a directory
249075
- const pathStat = await stat(path).catch(() => null);
249550
+ const pathStat = await (0, fs_extra_1.lstat)(path).catch(() => null);
249076
249551
  if (!pathStat) {
249077
249552
  output.error(`Could not find ${chalk_1.default.cyan(`“${(0, humanize_path_1.default)(path)}”`)}`);
249078
249553
  return { valid: false, exitCode: 1 };
@@ -249455,7 +249930,7 @@ module.exports = JSON.parse("[[[0,44],\"disallowed_STD3_valid\"],[[45,46],\"vali
249455
249930
  /***/ ((module) => {
249456
249931
 
249457
249932
  "use strict";
249458
- module.exports = JSON.parse("{\"name\":\"@vercel/client\",\"version\":\"12.6.0\",\"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.3\",\"@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\"}}");
249933
+ 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\"}}");
249459
249934
 
249460
249935
  /***/ }),
249461
249936