vercel 29.3.6 → 30.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +690 -169
  2. package/package.json +6 -6
package/dist/index.js CHANGED
@@ -218636,8 +218636,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
218636
218636
  return (mod && mod.__esModule) ? mod : { "default": mod };
218637
218637
  };
218638
218638
  Object.defineProperty(exports, "__esModule", ({ value: true }));
218639
- exports.createDeployment = exports.buildFileTree = exports.getVercelIgnore = void 0;
218639
+ exports.createDeployment = exports.buildFileTree = exports.getVercelIgnore = exports.checkDeploymentStatus = void 0;
218640
218640
  const create_deployment_1 = __importDefault(__webpack_require__(36371));
218641
+ var check_deployment_status_1 = __webpack_require__(83633);
218642
+ Object.defineProperty(exports, "checkDeploymentStatus", ({ enumerable: true, get: function () { return check_deployment_status_1.checkDeploymentStatus; } }));
218641
218643
  var index_1 = __webpack_require__(67110);
218642
218644
  Object.defineProperty(exports, "getVercelIgnore", ({ enumerable: true, get: function () { return index_1.getVercelIgnore; } }));
218643
218645
  Object.defineProperty(exports, "buildFileTree", ({ enumerable: true, get: function () { return index_1.buildFileTree; } }));
@@ -221772,7 +221774,7 @@ async function detectBuilders(files, pkg, options = {}) {
221772
221774
  apiBuilders.some(b => (0, is_official_runtime_1.isOfficialRuntime)('node', b.use))) {
221773
221775
  warnings.push({
221774
221776
  code: 'conflicting_files',
221775
- message: 'When using Next.js, it is recommended to place Node.js Serverless Functions inside of the `pages/api` (provided by Next.js) directory instead of `api` (provided by Vercel).',
221777
+ message: 'When using Next.js, it is recommended to place JavaScript Functions inside of the `pages/api` (provided by Next.js) directory instead of `api` (provided by Vercel). Other languages (Python, Go, etc) should still go in the `api` directory.',
221776
221778
  link: 'https://nextjs.org/docs/api-routes/introduction',
221777
221779
  action: 'Learn More',
221778
221780
  });
@@ -224853,6 +224855,7 @@ const help = () => `
224853
224855
  login [email] Logs into your account or creates a new one
224854
224856
  logout Logs out of your account
224855
224857
  pull [path] Pull your Project Settings from the cloud
224858
+ redeploy [url|id] Rebuild and deploy a previous deployment.
224856
224859
  rollback [url|id] Quickly revert back to a previous deployment
224857
224860
  switch [scope] Switches between teams and your personal account
224858
224861
 
@@ -226946,14 +226949,13 @@ const stamp_1 = __importDefault(__webpack_require__(49079));
226946
226949
  const create_deploy_1 = __importDefault(__webpack_require__(45303));
226947
226950
  const get_deployment_1 = __importDefault(__webpack_require__(84249));
226948
226951
  const parse_meta_1 = __importDefault(__webpack_require__(93983));
226949
- const link_1 = __importDefault(__webpack_require__(39302));
226950
226952
  const param_1 = __importDefault(__webpack_require__(20668));
226951
226953
  const errors_ts_1 = __webpack_require__(39240);
226952
226954
  const errors_1 = __webpack_require__(74148);
226953
226955
  const purchase_domain_if_available_1 = __importDefault(__webpack_require__(9696));
226954
226956
  const confirm_1 = __importDefault(__webpack_require__(59320));
226955
226957
  const edit_project_settings_1 = __importDefault(__webpack_require__(18279));
226956
- const link_2 = __webpack_require__(49347);
226958
+ const link_1 = __webpack_require__(49347);
226957
226959
  const get_project_name_1 = __importDefault(__webpack_require__(960));
226958
226960
  const select_org_1 = __importDefault(__webpack_require__(96339));
226959
226961
  const input_project_1 = __importDefault(__webpack_require__(38877));
@@ -226961,7 +226963,6 @@ const emoji_1 = __webpack_require__(35172);
226961
226963
  const input_root_directory_1 = __webpack_require__(70738);
226962
226964
  const validate_paths_1 = __importStar(__webpack_require__(33922));
226963
226965
  const pkg_name_1 = __webpack_require__(79000);
226964
- const get_preferred_preview_url_1 = __webpack_require__(62666);
226965
226966
  const args_1 = __webpack_require__(89097);
226966
226967
  const get_deployment_checks_1 = __webpack_require__(10559);
226967
226968
  const parse_target_1 = __importDefault(__webpack_require__(43667));
@@ -226971,7 +226972,7 @@ const validate_archive_format_1 = __webpack_require__(86974);
226971
226972
  const parse_env_1 = __webpack_require__(59818);
226972
226973
  const error_utils_1 = __webpack_require__(39799);
226973
226974
  const project_settings_1 = __webpack_require__(61440);
226974
- const is_deploying_1 = __webpack_require__(25307);
226975
+ const print_deployment_status_1 = __webpack_require__(27951);
226975
226976
  exports.default = async (client) => {
226976
226977
  const { output } = client;
226977
226978
  let argv = null;
@@ -226990,6 +226991,7 @@ exports.default = async (client) => {
226990
226991
  '--prod': Boolean,
226991
226992
  '--archive': String,
226992
226993
  '--no-wait': Boolean,
226994
+ '--skip-domain': Boolean,
226993
226995
  '--yes': Boolean,
226994
226996
  '-f': '--force',
226995
226997
  '-p': '--public',
@@ -227115,7 +227117,7 @@ exports.default = async (client) => {
227115
227117
  return 1;
227116
227118
  }
227117
227119
  // retrieve `project` and `org` from .vercel
227118
- const link = await (0, link_2.getLinkedProject)(client, path);
227120
+ const link = await (0, link_1.getLinkedProject)(client, path);
227119
227121
  if (link.status === 'error') {
227120
227122
  return link.exitCode;
227121
227123
  }
@@ -227161,7 +227163,7 @@ exports.default = async (client) => {
227161
227163
  rootDirectory = project.rootDirectory;
227162
227164
  sourceFilesOutsideRootDirectory = project.sourceFilesOutsideRootDirectory;
227163
227165
  // we can already link the project
227164
- await (0, link_2.linkFolderToProject)(output, path, {
227166
+ await (0, link_1.linkFolderToProject)(output, path, {
227165
227167
  projectId: project.id,
227166
227168
  orgId: org.id,
227167
227169
  }, project.name, org.slug);
@@ -227259,6 +227261,7 @@ exports.default = async (client) => {
227259
227261
  throw new Error('`name` not found on project or provided by existing project');
227260
227262
  }
227261
227263
  try {
227264
+ const autoAssignCustomDomains = !argv['--skip-domain'];
227262
227265
  const createArgs = {
227263
227266
  name,
227264
227267
  env: deploymentEnv,
@@ -227282,6 +227285,7 @@ exports.default = async (client) => {
227282
227285
  target,
227283
227286
  skipAutoDetectionConfirmation: autoConfirm,
227284
227287
  noWait,
227288
+ autoAssignCustomDomains,
227285
227289
  };
227286
227290
  if (!localConfig.builds || localConfig.builds.length === 0) {
227287
227291
  // Only add projectSettings for zero config deployments
@@ -227398,7 +227402,7 @@ exports.default = async (client) => {
227398
227402
  (0, error_1.handleError)(err);
227399
227403
  return 1;
227400
227404
  }
227401
- return printDeploymentStatus(output, client, deployment, deployStamp, noWait);
227405
+ return (0, print_deployment_status_1.printDeploymentStatus)(client, deployment, deployStamp, noWait);
227402
227406
  };
227403
227407
  function handleCreateDeployError(output, error, localConfig) {
227404
227408
  if (error instanceof errors_ts_1.InvalidDomain) {
@@ -227464,62 +227468,6 @@ const addProcessEnv = async (log, env) => {
227464
227468
  }
227465
227469
  }
227466
227470
  };
227467
- const printDeploymentStatus = async (output, client, { readyState, alias: aliasList, aliasError, target, indications, url: deploymentUrl, aliasWarning, }, deployStamp, noWait) => {
227468
- indications = indications || [];
227469
- const isProdDeployment = target === 'production';
227470
- let isStillBuilding = false;
227471
- if (noWait) {
227472
- if ((0, is_deploying_1.isDeploying)(readyState)) {
227473
- isStillBuilding = true;
227474
- output.print((0, emoji_1.prependEmoji)('Note: Deployment is still processing...', (0, emoji_1.emoji)('notice')) + '\n');
227475
- }
227476
- }
227477
- if (!isStillBuilding && readyState !== 'READY') {
227478
- output.error(`Your deployment failed. Please retry later. More: https://err.sh/vercel/deployment-error`);
227479
- return 1;
227480
- }
227481
- if (aliasError) {
227482
- output.warn(`Failed to assign aliases${aliasError.message ? `: ${aliasError.message}` : ''}`);
227483
- }
227484
- else {
227485
- // print preview/production url
227486
- let previewUrl;
227487
- // if `noWait` is true, then use the deployment url, not an alias
227488
- if (!noWait && Array.isArray(aliasList) && aliasList.length > 0) {
227489
- const previewUrlInfo = await (0, get_preferred_preview_url_1.getPreferredPreviewURL)(client, aliasList);
227490
- if (previewUrlInfo) {
227491
- previewUrl = previewUrlInfo.previewUrl;
227492
- }
227493
- else {
227494
- previewUrl = `https://${deploymentUrl}`;
227495
- }
227496
- }
227497
- else {
227498
- // fallback to deployment url
227499
- previewUrl = `https://${deploymentUrl}`;
227500
- }
227501
- output.print((0, emoji_1.prependEmoji)(`${isProdDeployment ? 'Production' : 'Preview'}: ${chalk_1.default.bold(previewUrl)} ${deployStamp()}`, (0, emoji_1.emoji)('success')) + `\n`);
227502
- }
227503
- if (aliasWarning?.message) {
227504
- indications.push({
227505
- type: 'warning',
227506
- payload: aliasWarning.message,
227507
- link: aliasWarning.link,
227508
- action: aliasWarning.action,
227509
- });
227510
- }
227511
- const newline = '\n';
227512
- for (let indication of indications) {
227513
- const message = (0, emoji_1.prependEmoji)(chalk_1.default.dim(indication.payload), (0, emoji_1.emoji)(indication.type)) +
227514
- newline;
227515
- let link = '';
227516
- if (indication.link)
227517
- link =
227518
- chalk_1.default.dim(`${indication.action || 'Learn More'}: ${(0, link_1.default)(indication.link)}`) + newline;
227519
- output.print(message + link);
227520
- }
227521
- return 0;
227522
- };
227523
227471
 
227524
227472
 
227525
227473
  /***/ }),
@@ -229312,7 +229260,7 @@ const help = () => {
229312
229260
  ls [environment] [gitbranch] List all variables for the specified Environment
229313
229261
  add [name] [environment] [gitbranch] Add an Environment Variable (see examples below)
229314
229262
  rm [name] [environment] [gitbranch] Remove an Environment Variable (see examples below)
229315
- pull [filename] Pull all Development Environment Variables from the cloud and write to a file [.env]
229263
+ pull [filename] Pull all Development Environment Variables from the cloud and write to a file [.env.local]
229316
229264
 
229317
229265
  ${chalk_1.default.dim('Options:')}
229318
229266
 
@@ -229565,7 +229513,7 @@ async function pull(client, project, environment, opts, args, output, cwd, sourc
229565
229513
  return 1;
229566
229514
  }
229567
229515
  // handle relative or absolute filename
229568
- const [filename = '.env'] = args;
229516
+ const [filename = '.env.local'] = args;
229569
229517
  const fullPath = (0, path_1.resolve)(cwd, filename);
229570
229518
  const skipConfirmation = opts['--yes'];
229571
229519
  const gitBranch = opts['--git-branch'];
@@ -229784,7 +229732,7 @@ async function connect(client, argv, args, project, org) {
229784
229732
  confirm,
229785
229733
  org,
229786
229734
  project,
229787
- repoInfo: repoArg,
229735
+ repoInfo: parsedUrlArg,
229788
229736
  });
229789
229737
  }
229790
229738
  if (!gitConfig) {
@@ -230170,6 +230118,7 @@ exports.default = new Map([
230170
230118
  ['project', 'project'],
230171
230119
  ['projects', 'project'],
230172
230120
  ['pull', 'pull'],
230121
+ ['redeploy', 'redeploy'],
230173
230122
  ['remove', 'remove'],
230174
230123
  ['rm', 'remove'],
230175
230124
  ['rollback', 'rollback'],
@@ -230640,8 +230589,10 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
230640
230589
  const chalk_1 = __importDefault(__webpack_require__(90877));
230641
230590
  const get_args_1 = __importDefault(__webpack_require__(2505));
230642
230591
  const logo_1 = __importDefault(__webpack_require__(66669));
230592
+ const cmd_1 = __importDefault(__webpack_require__(62422));
230643
230593
  const pkg_name_1 = __webpack_require__(79000);
230644
230594
  const ensure_link_1 = __webpack_require__(65382);
230595
+ const repo_1 = __webpack_require__(18726);
230645
230596
  const help = () => {
230646
230597
  console.log(`
230647
230598
  ${chalk_1.default.bold(`${logo_1.default} ${(0, pkg_name_1.getPkgName)()} link`)} [options]
@@ -230649,6 +230600,7 @@ const help = () => {
230649
230600
  ${chalk_1.default.dim('Options:')}
230650
230601
 
230651
230602
  -h, --help Output usage information
230603
+ -r, --repo Link multiple projects based on Git repository (alpha)
230652
230604
  -A ${chalk_1.default.bold.underline('FILE')}, --local-config=${chalk_1.default.bold.underline('FILE')} Path to the local ${'`vercel.json`'} file
230653
230605
  -Q ${chalk_1.default.bold.underline('DIR')}, --global-config=${chalk_1.default.bold.underline('DIR')} Path to the global ${'`.vercel`'} directory
230654
230606
  -d, --debug Debug mode [off]
@@ -230669,7 +230621,12 @@ const help = () => {
230669
230621
 
230670
230622
  ${chalk_1.default.gray('–')} Link a specific directory to a Vercel Project
230671
230623
 
230672
- ${chalk_1.default.cyan(`$ ${(0, pkg_name_1.getPkgName)()} link /usr/src/project`)}
230624
+ ${chalk_1.default.cyan(`$ ${(0, pkg_name_1.getPkgName)()} link --cwd /path/to/project`)}
230625
+
230626
+ ${chalk_1.default.gray('–')} ${chalk_1.default.yellow('(alpha)')} Link to the current Git repository, allowing for multiple
230627
+ Vercel Projects to be linked simultaneously (useful for monorepos)
230628
+
230629
+ ${chalk_1.default.cyan(`$ ${(0, pkg_name_1.getPkgName)()} link --repo`)}
230673
230630
  `);
230674
230631
  };
230675
230632
  async function main(client) {
@@ -230678,6 +230635,8 @@ async function main(client) {
230678
230635
  '-y': '--yes',
230679
230636
  '--project': String,
230680
230637
  '-p': '--project',
230638
+ '--repo': Boolean,
230639
+ '-r': '--repo',
230681
230640
  // deprecated
230682
230641
  '--confirm': Boolean,
230683
230642
  '-c': '--confirm',
@@ -230690,15 +230649,28 @@ async function main(client) {
230690
230649
  client.output.warn('`--confirm` is deprecated, please use `--yes` instead');
230691
230650
  argv['--yes'] = argv['--confirm'];
230692
230651
  }
230693
- const cwd = argv._[1] || process.cwd();
230694
- const link = await (0, ensure_link_1.ensureLink)('link', client, cwd, {
230695
- autoConfirm: !!argv['--yes'],
230696
- forceDelete: true,
230697
- projectName: argv['--project'],
230698
- successEmoji: 'success',
230699
- });
230700
- if (typeof link === 'number') {
230701
- return link;
230652
+ const yes = !!argv['--yes'];
230653
+ let cwd = argv._[1];
230654
+ if (cwd) {
230655
+ 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
+ }
230657
+ else {
230658
+ cwd = process.cwd();
230659
+ }
230660
+ if (argv['--repo']) {
230661
+ client.output.warn(`The ${(0, cmd_1.default)('--repo')} flag is in alpha, please report issues`);
230662
+ await (0, repo_1.ensureRepoLink)(client, cwd, yes);
230663
+ }
230664
+ else {
230665
+ const link = await (0, ensure_link_1.ensureLink)('link', client, cwd, {
230666
+ autoConfirm: yes,
230667
+ forceDelete: true,
230668
+ projectName: argv['--project'],
230669
+ successEmoji: 'success',
230670
+ });
230671
+ if (typeof link === 'number') {
230672
+ return link;
230673
+ }
230702
230674
  }
230703
230675
  return 0;
230704
230676
  }
@@ -231900,6 +231872,184 @@ async function main(client) {
231900
231872
  exports.default = main;
231901
231873
 
231902
231874
 
231875
+ /***/ }),
231876
+
231877
+ /***/ 29281:
231878
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
231879
+
231880
+ "use strict";
231881
+
231882
+ var __importDefault = (this && this.__importDefault) || function (mod) {
231883
+ return (mod && mod.__esModule) ? mod : { "default": mod };
231884
+ };
231885
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
231886
+ const chalk_1 = __importDefault(__webpack_require__(90877));
231887
+ const client_1 = __webpack_require__(40521);
231888
+ const emoji_1 = __webpack_require__(35172);
231889
+ const get_args_1 = __importDefault(__webpack_require__(2505));
231890
+ 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
+ const handle_error_1 = __importDefault(__webpack_require__(64377));
231894
+ const error_utils_1 = __webpack_require__(39799);
231895
+ 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));
231900
+ const help = () => {
231901
+ console.log(`
231902
+ ${chalk_1.default.bold(`${logo_1.default} ${(0, pkg_name_1.getPkgName)()} redeploy`)} [deploymentId|deploymentName]
231903
+
231904
+ Rebuild and deploy a previous deployment.
231905
+
231906
+ ${chalk_1.default.dim('Options:')}
231907
+
231908
+ -h, --help Output usage information
231909
+ -A ${chalk_1.default.bold.underline('FILE')}, --local-config=${chalk_1.default.bold.underline('FILE')} Path to the local ${'`vercel.json`'} file
231910
+ -Q ${chalk_1.default.bold.underline('DIR')}, --global-config=${chalk_1.default.bold.underline('DIR')} Path to the global ${'`.vercel`'} directory
231911
+ -d, --debug Debug mode [off]
231912
+ --no-color No color mode [off]
231913
+ --no-wait Don't wait for the redeploy to finish
231914
+ -t ${chalk_1.default.bold.underline('TOKEN')}, --token=${chalk_1.default.bold.underline('TOKEN')} Login token
231915
+ -y, --yes Skip questions when setting up new project using default scope and settings
231916
+
231917
+ ${chalk_1.default.dim('Examples:')}
231918
+
231919
+ ${chalk_1.default.gray('–')} Rebuild and deploy an existing deployment using id or url
231920
+
231921
+ ${chalk_1.default.cyan(`$ ${(0, pkg_name_1.getPkgName)()} redeploy my-deployment.vercel.app`)}
231922
+
231923
+ ${chalk_1.default.gray('–')} Write Deployment URL to a file
231924
+
231925
+ ${chalk_1.default.cyan(`$ ${(0, pkg_name_1.getPkgName)()} redeploy my-deployment.vercel.app > deployment-url.txt`)}
231926
+ `);
231927
+ };
231928
+ /**
231929
+ * `vc redeploy` command
231930
+ * @param {Client} client
231931
+ * @returns {Promise<number>} Resolves an exit code; 0 on success
231932
+ */
231933
+ exports.default = async (client) => {
231934
+ let argv;
231935
+ try {
231936
+ argv = (0, get_args_1.default)(client.argv.slice(2), {
231937
+ '--no-wait': Boolean,
231938
+ '--yes': Boolean,
231939
+ '-y': '--yes',
231940
+ });
231941
+ }
231942
+ catch (err) {
231943
+ (0, handle_error_1.default)(err);
231944
+ return 1;
231945
+ }
231946
+ if (argv['--help'] || argv._[0] === 'help') {
231947
+ help();
231948
+ return 2;
231949
+ }
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>`)}`);
231954
+ return 1;
231955
+ }
231956
+ const { contextName } = await (0, get_scope_1.default)(client);
231957
+ const noWait = !!argv['--no-wait'];
231958
+ try {
231959
+ const fromDeployment = await (0, get_deployment_by_id_or_url_1.getDeploymentByIdOrURL)({
231960
+ 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',
231976
+ });
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);
231986
+ }
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({
232025
+ client,
232026
+ currentTeam: fromDeployment.team?.id,
232027
+ });
232028
+ const error = await now.handleDeploymentError(event.payload, {
232029
+ env: {},
232030
+ });
232031
+ throw error;
232032
+ }
232033
+ }
232034
+ }
232035
+ catch (err) {
232036
+ output.prettyError(err);
232037
+ process.exit(1);
232038
+ }
232039
+ }
232040
+ }
232041
+ return (0, print_deployment_status_1.printDeploymentStatus)(client, deployment, deployStamp, noWait);
232042
+ }
232043
+ catch (err) {
232044
+ output.prettyError(err);
232045
+ if ((0, error_utils_1.isErrnoException)(err) && err.code === 'ERR_INVALID_TEAM') {
232046
+ output.error(`Use ${chalk_1.default.bold('vc switch')} to change your current team`);
232047
+ }
232048
+ return 1;
232049
+ }
232050
+ };
232051
+
232052
+
231903
232053
  /***/ }),
231904
232054
 
231905
232055
  /***/ 5445:
@@ -232250,7 +232400,7 @@ exports.default = async (client) => {
232250
232400
  }
232251
232401
  return await (0, request_rollback_1.default)({
232252
232402
  client,
232253
- deployId: actionOrDeployId,
232403
+ deployIdOrUrl: actionOrDeployId,
232254
232404
  project,
232255
232405
  timeout,
232256
232406
  });
@@ -233426,6 +233576,9 @@ const main = async () => {
233426
233576
  case 'pull':
233427
233577
  func = __webpack_require__(65158).default;
233428
233578
  break;
233579
+ case 'redeploy':
233580
+ func = __webpack_require__(29281).default;
233581
+ break;
233429
233582
  case 'remove':
233430
233583
  func = __webpack_require__(5445).default;
233431
233584
  break;
@@ -233912,9 +234065,6 @@ const ARG_COMMON = {
233912
234065
  '-Q': '--global-config',
233913
234066
  '--api': String,
233914
234067
  '--cwd': String,
233915
- // Deprecated
233916
- '--platform-version': Number,
233917
- '-V': '--platform-version',
233918
234068
  };
233919
234069
  exports.default = () => ARG_COMMON;
233920
234070
 
@@ -236049,8 +236199,8 @@ exports.default = readConfig;
236049
236199
  Object.defineProperty(exports, "__esModule", ({ value: true }));
236050
236200
  exports.SENTRY_DSN = exports.GA_TRACKING_ID = void 0;
236051
236201
  // This file is auto-generated
236052
- exports.GA_TRACKING_ID = undefined;
236053
- exports.SENTRY_DSN = undefined;
236202
+ exports.GA_TRACKING_ID = "UA-117491914-3";
236203
+ exports.SENTRY_DSN = "https://26a24e59ba954011919a524b341b6ab5@sentry.io/1323225";
236054
236204
 
236055
236205
 
236056
236206
  /***/ }),
@@ -236354,6 +236504,77 @@ async function generateCertForDeploy(client, contextName, deployURL) {
236354
236504
  exports.default = generateCertForDeploy;
236355
236505
 
236356
236506
 
236507
+ /***/ }),
236508
+
236509
+ /***/ 47662:
236510
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
236511
+
236512
+ "use strict";
236513
+
236514
+ var __importDefault = (this && this.__importDefault) || function (mod) {
236515
+ return (mod && mod.__esModule) ? mod : { "default": mod };
236516
+ };
236517
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
236518
+ exports.getDeploymentByIdOrURL = void 0;
236519
+ const chalk_1 = __importDefault(__webpack_require__(90877));
236520
+ const get_deployment_1 = __importDefault(__webpack_require__(84249));
236521
+ const get_team_by_id_1 = __importDefault(__webpack_require__(94949));
236522
+ const is_valid_name_1 = __webpack_require__(64476);
236523
+ /**
236524
+ * Renders feedback while retrieving a deployment, then validates the
236525
+ * deployment belongs to the current team.
236526
+ *
236527
+ * @param client - The CLI client instance.
236528
+ * @param contextName - The context/team name.
236529
+ * @param deployIdOrUrl - The deployment id or URL.
236530
+ * @returns The deployment info.
236531
+ */
236532
+ async function getDeploymentByIdOrURL({ client, contextName, deployIdOrUrl, }) {
236533
+ const { config, output } = client;
236534
+ if (!(0, is_valid_name_1.isValidName)(deployIdOrUrl)) {
236535
+ throw new Error(`The provided argument "${deployIdOrUrl}" is not a valid deployment ID or URL`);
236536
+ }
236537
+ let deployment;
236538
+ let team;
236539
+ try {
236540
+ output.spinner(`Fetching deployment "${deployIdOrUrl}" in ${chalk_1.default.bold(contextName)}…`);
236541
+ const [teamResult, deploymentResult] = await Promise.allSettled([
236542
+ config.currentTeam ? (0, get_team_by_id_1.default)(client, config.currentTeam) : undefined,
236543
+ (0, get_deployment_1.default)(client, contextName, deployIdOrUrl),
236544
+ ]);
236545
+ if (teamResult.status === 'rejected') {
236546
+ throw new Error(`Failed to retrieve team information: ${teamResult.reason}`);
236547
+ }
236548
+ if (deploymentResult.status === 'rejected') {
236549
+ throw new Error(deploymentResult.reason.message);
236550
+ }
236551
+ team = teamResult.value;
236552
+ deployment = deploymentResult.value;
236553
+ // re-render the spinner text because it goes so fast
236554
+ output.log(`Fetching deployment "${deployIdOrUrl}" in ${chalk_1.default.bold(contextName)}…`);
236555
+ }
236556
+ finally {
236557
+ output.stopSpinner();
236558
+ }
236559
+ if (deployment.team?.id) {
236560
+ if (!team || deployment.team.id !== team.id) {
236561
+ const err = new Error(team
236562
+ ? `Deployment doesn't belong to current team ${chalk_1.default.bold(contextName)}`
236563
+ : `Deployment belongs to a different team`);
236564
+ err.code = 'ERR_INVALID_TEAM';
236565
+ throw err;
236566
+ }
236567
+ }
236568
+ else if (team) {
236569
+ const err = new Error(`Deployment doesn't belong to current team ${chalk_1.default.bold(contextName)}`);
236570
+ err.code = 'ERR_INVALID_TEAM';
236571
+ throw err;
236572
+ }
236573
+ return deployment;
236574
+ }
236575
+ exports.getDeploymentByIdOrURL = getDeploymentByIdOrURL;
236576
+
236577
+
236357
236578
  /***/ }),
236358
236579
 
236359
236580
  /***/ 10559:
@@ -236591,6 +236812,83 @@ function parseTarget(output, targetArg, prodArg) {
236591
236812
  exports.default = parseTarget;
236592
236813
 
236593
236814
 
236815
+ /***/ }),
236816
+
236817
+ /***/ 27951:
236818
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
236819
+
236820
+ "use strict";
236821
+
236822
+ var __importDefault = (this && this.__importDefault) || function (mod) {
236823
+ return (mod && mod.__esModule) ? mod : { "default": mod };
236824
+ };
236825
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
236826
+ exports.printDeploymentStatus = void 0;
236827
+ const chalk_1 = __importDefault(__webpack_require__(90877));
236828
+ const get_preferred_preview_url_1 = __webpack_require__(62666);
236829
+ const is_deploying_1 = __webpack_require__(25307);
236830
+ const link_1 = __importDefault(__webpack_require__(39302));
236831
+ const emoji_1 = __webpack_require__(35172);
236832
+ async function printDeploymentStatus(client, { readyState, alias: aliasList, aliasError, target, indications, url: deploymentUrl, aliasWarning, }, deployStamp, noWait) {
236833
+ const { output } = client;
236834
+ indications = indications || [];
236835
+ const isProdDeployment = target === 'production';
236836
+ let isStillBuilding = false;
236837
+ if (noWait) {
236838
+ if ((0, is_deploying_1.isDeploying)(readyState)) {
236839
+ isStillBuilding = true;
236840
+ output.print((0, emoji_1.prependEmoji)('Note: Deployment is still processing...', (0, emoji_1.emoji)('notice')) + '\n');
236841
+ }
236842
+ }
236843
+ if (!isStillBuilding && readyState !== 'READY') {
236844
+ output.error(`Your deployment failed. Please retry later. More: https://err.sh/vercel/deployment-error`);
236845
+ return 1;
236846
+ }
236847
+ if (aliasError) {
236848
+ output.warn(`Failed to assign aliases${aliasError.message ? `: ${aliasError.message}` : ''}`);
236849
+ }
236850
+ else {
236851
+ // print preview/production url
236852
+ let previewUrl;
236853
+ // if `noWait` is true, then use the deployment url, not an alias
236854
+ if (!noWait && Array.isArray(aliasList) && aliasList.length > 0) {
236855
+ const previewUrlInfo = await (0, get_preferred_preview_url_1.getPreferredPreviewURL)(client, aliasList);
236856
+ if (previewUrlInfo) {
236857
+ previewUrl = previewUrlInfo.previewUrl;
236858
+ }
236859
+ else {
236860
+ previewUrl = `https://${deploymentUrl}`;
236861
+ }
236862
+ }
236863
+ else {
236864
+ // fallback to deployment url
236865
+ previewUrl = `https://${deploymentUrl}`;
236866
+ }
236867
+ output.print((0, emoji_1.prependEmoji)(`${isProdDeployment ? 'Production' : 'Preview'}: ${chalk_1.default.bold(previewUrl)} ${deployStamp()}`, (0, emoji_1.emoji)('success')) + `\n`);
236868
+ }
236869
+ if (aliasWarning?.message) {
236870
+ indications.push({
236871
+ type: 'warning',
236872
+ payload: aliasWarning.message,
236873
+ link: aliasWarning.link,
236874
+ action: aliasWarning.action,
236875
+ });
236876
+ }
236877
+ const newline = '\n';
236878
+ for (let indication of indications) {
236879
+ const message = (0, emoji_1.prependEmoji)(chalk_1.default.dim(indication.payload), (0, emoji_1.emoji)(indication.type)) +
236880
+ newline;
236881
+ let link = '';
236882
+ if (indication.link)
236883
+ link =
236884
+ chalk_1.default.dim(`${indication.action || 'Learn More'}: ${(0, link_1.default)(indication.link)}`) + newline;
236885
+ output.print(message + link);
236886
+ }
236887
+ return 0;
236888
+ }
236889
+ exports.printDeploymentStatus = printDeploymentStatus;
236890
+
236891
+
236594
236892
  /***/ }),
236595
236893
 
236596
236894
  /***/ 54944:
@@ -242775,7 +243073,7 @@ const errors_ts_1 = __webpack_require__(39240);
242775
243073
  const map_cert_error_1 = __importDefault(__webpack_require__(72812));
242776
243074
  const to_host_1 = __importDefault(__webpack_require__(47914));
242777
243075
  /**
242778
- * Retrieves a v13 deployment.
243076
+ * Retrieves a deployment by id or URL.
242779
243077
  *
242780
243078
  * @param client - The Vercel CLI client instance.
242781
243079
  * @param contextName - The scope context/team name.
@@ -243603,7 +243901,7 @@ class Now extends events_1.default {
243603
243901
  // Legacy
243604
243902
  nowConfig: nowConfig = {},
243605
243903
  // Latest
243606
- name, project, prebuilt = false, rootDirectory, wantsPublic, meta, gitMetadata, regions, quiet = false, env, build, forceNew = false, withCache = false, target = null, deployStamp, projectSettings, skipAutoDetectionConfirmation, noWait, }, org, isSettingUpProject, archive, cwd) {
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) {
243607
243905
  let hashes = {};
243608
243906
  const uploadStamp = (0, stamp_1.default)();
243609
243907
  let requestBody = {
@@ -243619,6 +243917,7 @@ class Now extends events_1.default {
243619
243917
  target: target || undefined,
243620
243918
  projectSettings,
243621
243919
  source: 'cli',
243920
+ autoAssignCustomDomains,
243622
243921
  };
243623
243922
  // Ignore specific items from vercel.json
243624
243923
  delete requestBody.scope;
@@ -245059,6 +245358,46 @@ function isValidName(name = '') {
245059
245358
  exports.isValidName = isValidName;
245060
245359
 
245061
245360
 
245361
+ /***/ }),
245362
+
245363
+ /***/ 19159:
245364
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
245365
+
245366
+ "use strict";
245367
+
245368
+ var __importDefault = (this && this.__importDefault) || function (mod) {
245369
+ return (mod && mod.__esModule) ? mod : { "default": mod };
245370
+ };
245371
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
245372
+ exports.addToGitIgnore = void 0;
245373
+ const os_1 = __importDefault(__webpack_require__(12087));
245374
+ const path_1 = __webpack_require__(85622);
245375
+ const fs_extra_1 = __webpack_require__(36365);
245376
+ const link_1 = __webpack_require__(49347);
245377
+ async function addToGitIgnore(path, ignore = link_1.VERCEL_DIR) {
245378
+ let isGitIgnoreUpdated = false;
245379
+ try {
245380
+ const gitIgnorePath = (0, path_1.join)(path, '.gitignore');
245381
+ let gitIgnore = (await (0, fs_extra_1.readFile)(gitIgnorePath, 'utf8').catch(() => null)) ?? '';
245382
+ const EOL = gitIgnore.includes('\r\n') ? '\r\n' : os_1.default.EOL;
245383
+ let contentModified = false;
245384
+ if (!gitIgnore.split(EOL).includes(ignore)) {
245385
+ gitIgnore += `${gitIgnore.endsWith(EOL) || gitIgnore.length === 0 ? '' : EOL}${ignore}${EOL}`;
245386
+ contentModified = true;
245387
+ }
245388
+ if (contentModified) {
245389
+ await (0, fs_extra_1.writeFile)(gitIgnorePath, gitIgnore);
245390
+ isGitIgnoreUpdated = true;
245391
+ }
245392
+ }
245393
+ catch (error) {
245394
+ // ignore errors since this is non-critical
245395
+ }
245396
+ return isGitIgnoreUpdated;
245397
+ }
245398
+ exports.addToGitIgnore = addToGitIgnore;
245399
+
245400
+
245062
245401
  /***/ }),
245063
245402
 
245064
245403
  /***/ 65382:
@@ -245115,6 +245454,204 @@ async function ensureLink(commandName, client, cwd, opts) {
245115
245454
  exports.ensureLink = ensureLink;
245116
245455
 
245117
245456
 
245457
+ /***/ }),
245458
+
245459
+ /***/ 18726:
245460
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
245461
+
245462
+ "use strict";
245463
+
245464
+ var __importDefault = (this && this.__importDefault) || function (mod) {
245465
+ return (mod && mod.__esModule) ? mod : { "default": mod };
245466
+ };
245467
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
245468
+ exports.findProjectFromPath = exports.traverseUpDirectories = exports.findRepoRoot = exports.ensureRepoLink = exports.getRepoLink = void 0;
245469
+ const chalk_1 = __importDefault(__webpack_require__(90877));
245470
+ const pluralize_1 = __importDefault(__webpack_require__(43669));
245471
+ const os_1 = __webpack_require__(12087);
245472
+ const path_1 = __webpack_require__(85622);
245473
+ const build_utils_1 = __webpack_require__(63445);
245474
+ const fs_extra_1 = __webpack_require__(36365);
245475
+ const confirm_1 = __importDefault(__webpack_require__(59320));
245476
+ const humanize_path_1 = __importDefault(__webpack_require__(33234));
245477
+ const link_1 = __webpack_require__(49347);
245478
+ const create_git_meta_1 = __webpack_require__(30019);
245479
+ const link_2 = __importDefault(__webpack_require__(39302));
245480
+ const emoji_1 = __webpack_require__(35172);
245481
+ const select_org_1 = __importDefault(__webpack_require__(96339));
245482
+ const add_to_gitignore_1 = __webpack_require__(19159);
245483
+ const home = (0, os_1.homedir)();
245484
+ /**
245485
+ * Given a directory path `cwd`, finds the root of the Git repository
245486
+ * and returns the parsed `.vercel/repo.json` file if the repository
245487
+ * has already been linked.
245488
+ */
245489
+ async function getRepoLink(cwd) {
245490
+ // Determine where the root of the repo is
245491
+ const rootPath = await findRepoRoot(cwd);
245492
+ if (!rootPath)
245493
+ return undefined;
245494
+ // Read the `repo.json`, if this repo has already been linked
245495
+ const repoConfigPath = (0, path_1.join)(rootPath, link_1.VERCEL_DIR, link_1.VERCEL_DIR_REPO);
245496
+ const repoConfig = await (0, fs_extra_1.readJSON)(repoConfigPath).catch(err => {
245497
+ if (err.code !== 'ENOENT')
245498
+ throw err;
245499
+ });
245500
+ return { rootPath, repoConfig, repoConfigPath };
245501
+ }
245502
+ exports.getRepoLink = getRepoLink;
245503
+ async function ensureRepoLink(client, cwd, yes = false) {
245504
+ const { output } = client;
245505
+ const repoLink = await getRepoLink(cwd);
245506
+ if (repoLink) {
245507
+ output.debug(`Found Git repository root directory: ${repoLink.rootPath}`);
245508
+ }
245509
+ else {
245510
+ throw new Error('Could not determine Git repository root directory');
245511
+ }
245512
+ let { rootPath, repoConfig, repoConfigPath } = repoLink;
245513
+ if (!repoConfig) {
245514
+ // Not yet linked, so prompt user to begin linking
245515
+ let shouldLink = yes ||
245516
+ (await (0, confirm_1.default)(client, `Link Git repository at ${chalk_1.default.cyan(`“${(0, humanize_path_1.default)(rootPath)}”`)} to your Project(s)?`, true));
245517
+ if (!shouldLink) {
245518
+ output.print(`Canceled. Repository not linked.\n`);
245519
+ return;
245520
+ }
245521
+ const org = await (0, select_org_1.default)(client, 'Which scope should contain your Project(s)?', yes);
245522
+ client.config.currentTeam = org.type === 'team' ? org.id : undefined;
245523
+ const remoteUrls = await (0, create_git_meta_1.getRemoteUrls)((0, path_1.join)(rootPath, '.git/config'), output);
245524
+ if (!remoteUrls) {
245525
+ throw new Error('Could not determine Git remote URLs');
245526
+ }
245527
+ const remoteNames = Object.keys(remoteUrls);
245528
+ let remoteName;
245529
+ if (remoteNames.length === 1) {
245530
+ remoteName = remoteNames[0];
245531
+ }
245532
+ else {
245533
+ // Prompt user to select which remote to use
245534
+ const originIndex = remoteNames.indexOf('origin');
245535
+ const answer = await client.prompt({
245536
+ type: 'list',
245537
+ name: 'value',
245538
+ message: 'Which Git remote should be used?',
245539
+ choices: remoteNames.map(name => {
245540
+ return { name: name, value: name };
245541
+ }),
245542
+ default: originIndex === -1 ? 0 : originIndex,
245543
+ });
245544
+ remoteName = answer.value;
245545
+ }
245546
+ const repoUrl = remoteUrls[remoteName];
245547
+ output.spinner(`Fetching Projects for ${(0, link_2.default)(repoUrl)} under ${chalk_1.default.bold(org.slug)}…`);
245548
+ // TODO: Add pagination to fetch all Projects
245549
+ const query = new URLSearchParams({ repoUrl, limit: '100' });
245550
+ const projects = await client.fetch(`/v2/projects?${query}`);
245551
+ if (projects.length === 0) {
245552
+ output.log(`No Projects are linked to ${(0, link_2.default)(repoUrl)} under ${chalk_1.default.bold(org.slug)}.`);
245553
+ // TODO: run detection logic to find potential projects.
245554
+ // then prompt user to select valid projects.
245555
+ // then create new Projects
245556
+ }
245557
+ else {
245558
+ output.log(`Found ${chalk_1.default.bold(projects.length)} ${(0, pluralize_1.default)('Project', projects.length)} linked to ${(0, link_2.default)(repoUrl)} under ${chalk_1.default.bold(org.slug)}:`);
245559
+ }
245560
+ for (const project of projects) {
245561
+ output.print(` * ${chalk_1.default.cyan(`${org.slug}/${project.name}\n`)}`);
245562
+ }
245563
+ shouldLink =
245564
+ yes ||
245565
+ (await (0, confirm_1.default)(client, `Link to ${projects.length === 1 ? 'it' : 'them'}?`, true));
245566
+ if (!shouldLink) {
245567
+ output.print(`Canceled. Repository not linked.\n`);
245568
+ return;
245569
+ }
245570
+ repoConfig = {
245571
+ orgId: org.id,
245572
+ remoteName,
245573
+ projects: projects.map(project => {
245574
+ return {
245575
+ id: project.id,
245576
+ name: project.name,
245577
+ directory: (0, path_1.normalize)(project.rootDirectory || ''),
245578
+ };
245579
+ }),
245580
+ };
245581
+ await (0, fs_extra_1.outputJSON)(repoConfigPath, repoConfig, { spaces: 2 });
245582
+ await (0, fs_extra_1.writeFile)((0, path_1.join)(rootPath, link_1.VERCEL_DIR, link_1.VERCEL_DIR_README), await (0, fs_extra_1.readFile)((0, path_1.join)(__dirname, 'VERCEL_DIR_README.txt'), 'utf8'));
245583
+ // update .gitignore
245584
+ const isGitIgnoreUpdated = await (0, add_to_gitignore_1.addToGitIgnore)(rootPath);
245585
+ output.print((0, emoji_1.prependEmoji)(`Linked to ${(0, link_2.default)(repoUrl)} under ${chalk_1.default.bold(org.slug)} (created ${link_1.VERCEL_DIR}${isGitIgnoreUpdated ? ' and added it to .gitignore' : ''})`, (0, emoji_1.emoji)('link')) + '\n');
245586
+ }
245587
+ return {
245588
+ repoConfig,
245589
+ repoConfigPath,
245590
+ rootPath,
245591
+ };
245592
+ }
245593
+ exports.ensureRepoLink = ensureRepoLink;
245594
+ /**
245595
+ * Given a `start` directory, traverses up the directory hierarchy until
245596
+ * the nearest `.git/config` file is found. Returns the directory where
245597
+ * the Git config was found, or `undefined` when no Git repo was found.
245598
+ */
245599
+ async function findRepoRoot(start) {
245600
+ for (const current of traverseUpDirectories(start)) {
245601
+ if (current === home) {
245602
+ // Sometimes the $HOME directory is set up as a Git repo
245603
+ // (for dotfiles, etc.). In this case it's safe to say that
245604
+ // this isn't the repo we're looking for. Bail.
245605
+ break;
245606
+ }
245607
+ const gitConfigPath = (0, path_1.join)(current, '.git/config');
245608
+ const stat = await (0, fs_extra_1.lstat)(gitConfigPath).catch(err => {
245609
+ if (err.code !== 'ENOENT')
245610
+ throw err;
245611
+ });
245612
+ if (stat) {
245613
+ return current;
245614
+ }
245615
+ }
245616
+ }
245617
+ exports.findRepoRoot = findRepoRoot;
245618
+ function* traverseUpDirectories(start) {
245619
+ let current = (0, path_1.normalize)(start);
245620
+ while (current) {
245621
+ yield current;
245622
+ // Go up one directory
245623
+ const next = (0, path_1.join)(current, '..');
245624
+ current = next === current ? undefined : next;
245625
+ }
245626
+ }
245627
+ exports.traverseUpDirectories = traverseUpDirectories;
245628
+ function sortByDirectory(a, b) {
245629
+ const aParts = a.directory.split('/');
245630
+ const bParts = b.directory.split('/');
245631
+ return bParts.length - aParts.length;
245632
+ }
245633
+ /**
245634
+ * Finds the matching Project from an array of Project links
245635
+ * where the provided relative path is within the Project's
245636
+ * root directory.
245637
+ */
245638
+ function findProjectFromPath(projects, path) {
245639
+ const normalizedPath = (0, build_utils_1.normalizePath)(path);
245640
+ return projects
245641
+ .slice()
245642
+ .sort(sortByDirectory)
245643
+ .find(project => {
245644
+ if (project.directory === '.') {
245645
+ // Project has no "Root Directory" setting, so any path is valid
245646
+ return true;
245647
+ }
245648
+ return (normalizedPath === project.directory ||
245649
+ normalizedPath.startsWith(`${project.directory}/`));
245650
+ });
245651
+ }
245652
+ exports.findProjectFromPath = findProjectFromPath;
245653
+
245654
+
245118
245655
  /***/ }),
245119
245656
 
245120
245657
  /***/ 71225:
@@ -245253,6 +245790,7 @@ async function setupAndLink(client, path, { autoConfirm = false, forceDelete = f
245253
245790
  ...localConfigurationOverrides,
245254
245791
  sourceFilesOutsideRootDirectory,
245255
245792
  },
245793
+ autoAssignCustomDomains: true,
245256
245794
  };
245257
245795
  const deployment = await (0, create_deploy_1.default)(client, now, config.currentTeam || 'current user', [sourcePath], createArgs, org, true, path);
245258
245796
  if (!deployment ||
@@ -247226,9 +247764,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
247226
247764
  return (mod && mod.__esModule) ? mod : { "default": mod };
247227
247765
  };
247228
247766
  Object.defineProperty(exports, "__esModule", ({ value: true }));
247229
- exports.linkFolderToProject = exports.getLinkedProject = exports.getLinkFromDir = exports.getVercelDirectory = exports.VERCEL_DIR_PROJECT = exports.VERCEL_DIR_README = exports.VERCEL_DIR_FALLBACK = exports.VERCEL_DIR = void 0;
247767
+ exports.linkFolderToProject = exports.getLinkedProject = exports.getLinkFromDir = exports.getVercelDirectory = exports.VERCEL_DIR_REPO = exports.VERCEL_DIR_PROJECT = exports.VERCEL_DIR_README = exports.VERCEL_DIR_FALLBACK = exports.VERCEL_DIR = void 0;
247230
247768
  const fs_1 = __importDefault(__webpack_require__(35747));
247231
- const os_1 = __importDefault(__webpack_require__(12087));
247232
247769
  const ajv_1 = __importDefault(__webpack_require__(35669));
247233
247770
  const chalk_1 = __importDefault(__webpack_require__(90877));
247234
247771
  const path_1 = __webpack_require__(85622);
@@ -247243,12 +247780,15 @@ const global_path_1 = __webpack_require__(88976);
247243
247780
  const build_utils_1 = __webpack_require__(63445);
247244
247781
  const code_1 = __importDefault(__webpack_require__(94542));
247245
247782
  const error_utils_1 = __webpack_require__(39799);
247783
+ const repo_1 = __webpack_require__(18726);
247784
+ const add_to_gitignore_1 = __webpack_require__(19159);
247246
247785
  const readFile = (0, util_1.promisify)(fs_1.default.readFile);
247247
247786
  const writeFile = (0, util_1.promisify)(fs_1.default.writeFile);
247248
247787
  exports.VERCEL_DIR = '.vercel';
247249
247788
  exports.VERCEL_DIR_FALLBACK = '.now';
247250
247789
  exports.VERCEL_DIR_README = 'README.txt';
247251
247790
  exports.VERCEL_DIR_PROJECT = 'project.json';
247791
+ exports.VERCEL_DIR_REPO = 'repo.json';
247252
247792
  const linkSchema = {
247253
247793
  type: 'object',
247254
247794
  required: ['projectId', 'orgId'],
@@ -247269,7 +247809,7 @@ const linkSchema = {
247269
247809
  *
247270
247810
  * Throws an error if *both* `.vercel` and `.now` directories exist.
247271
247811
  */
247272
- function getVercelDirectory(cwd = process.cwd()) {
247812
+ function getVercelDirectory(cwd) {
247273
247813
  const possibleDirs = [(0, path_1.join)(cwd, exports.VERCEL_DIR), (0, path_1.join)(cwd, exports.VERCEL_DIR_FALLBACK)];
247274
247814
  const existingDirs = possibleDirs.filter(d => (0, global_path_1.isDirectory)(d));
247275
247815
  if (existingDirs.length > 1) {
@@ -247283,8 +247823,35 @@ function getVercelDirectory(cwd = process.cwd()) {
247283
247823
  }
247284
247824
  exports.getVercelDirectory = getVercelDirectory;
247285
247825
  async function getLink(path) {
247826
+ // Try the individual project linking style (`${cwd}/.vercel/project.json`)
247286
247827
  const dir = getVercelDirectory(path);
247287
- return getLinkFromDir(dir);
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) {
247838
+ return null;
247839
+ }
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
+ }
247848
+ }
247849
+ catch (err) {
247850
+ if (!(0, error_utils_1.isErrnoException)(err) || err.code !== 'ENOENT') {
247851
+ throw err;
247852
+ }
247853
+ }
247854
+ return null;
247288
247855
  }
247289
247856
  async function getLinkFromDir(dir) {
247290
247857
  try {
@@ -247323,7 +247890,7 @@ async function getOrgById(client, orgId) {
247323
247890
  return null;
247324
247891
  return { type: 'user', id: orgId, slug: user.username };
247325
247892
  }
247326
- async function getLinkedProject(client, path) {
247893
+ async function getLinkedProject(client, path = process.cwd()) {
247327
247894
  const { output } = client;
247328
247895
  const VERCEL_ORG_ID = (0, build_utils_1.getPlatformEnv)('ORG_ID');
247329
247896
  const VERCEL_PROJECT_ID = (0, build_utils_1.getPlatformEnv)('PROJECT_ID');
@@ -247409,24 +247976,7 @@ async function linkFolderToProject(output, path, projectLink, projectName, orgSl
247409
247976
  await writeFile((0, path_1.join)(path, exports.VERCEL_DIR, exports.VERCEL_DIR_PROJECT), JSON.stringify(projectLink));
247410
247977
  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'));
247411
247978
  // update .gitignore
247412
- let isGitIgnoreUpdated = false;
247413
- try {
247414
- const gitIgnorePath = (0, path_1.join)(path, '.gitignore');
247415
- let gitIgnore = (await readFile(gitIgnorePath, 'utf8').catch(() => null)) ?? '';
247416
- const EOL = gitIgnore.includes('\r\n') ? '\r\n' : os_1.default.EOL;
247417
- let contentModified = false;
247418
- if (!gitIgnore.split(EOL).includes(exports.VERCEL_DIR)) {
247419
- gitIgnore += `${gitIgnore.endsWith(EOL) || gitIgnore.length === 0 ? '' : EOL}${exports.VERCEL_DIR}${EOL}`;
247420
- contentModified = true;
247421
- }
247422
- if (contentModified) {
247423
- await writeFile(gitIgnorePath, gitIgnore);
247424
- isGitIgnoreUpdated = true;
247425
- }
247426
- }
247427
- catch (error) {
247428
- // ignore errors since this is non-critical
247429
- }
247979
+ const isGitIgnoreUpdated = await (0, add_to_gitignore_1.addToGitIgnore)(path);
247430
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');
247431
247981
  }
247432
247982
  exports.linkFolderToProject = linkFolderToProject;
@@ -247827,83 +248377,54 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
247827
248377
  Object.defineProperty(exports, "__esModule", ({ value: true }));
247828
248378
  const chalk_1 = __importDefault(__webpack_require__(90877));
247829
248379
  const pkg_name_1 = __webpack_require__(79000);
247830
- const get_deployment_1 = __importDefault(__webpack_require__(84249));
248380
+ const get_deployment_by_id_or_url_1 = __webpack_require__(47662);
247831
248381
  const get_scope_1 = __importDefault(__webpack_require__(60324));
247832
- const get_team_by_id_1 = __importDefault(__webpack_require__(94949));
247833
- const is_valid_name_1 = __webpack_require__(64476);
248382
+ const error_utils_1 = __webpack_require__(39799);
247834
248383
  const ms_1 = __importDefault(__webpack_require__(21378));
247835
248384
  const status_1 = __importDefault(__webpack_require__(87181));
247836
248385
  /**
247837
248386
  * Requests a rollback and waits for it complete.
247838
248387
  * @param {Client} client - The Vercel client instance
247839
- * @param {string} deployId - The deployment name or id to rollback
248388
+ * @param {string} deployIdOrUrl - The deployment name or id to rollback
247840
248389
  * @param {Project} project - Project info instance
247841
248390
  * @param {string} [timeout] - Time to poll for succeeded/failed state
247842
248391
  * @returns {Promise<number>} Resolves an exit code; 0 on success
247843
248392
  */
247844
- async function requestRollback({ client, deployId, project, timeout, }) {
247845
- const { config, output } = client;
248393
+ async function requestRollback({ client, deployIdOrUrl, project, timeout, }) {
248394
+ const { output } = client;
247846
248395
  const { contextName } = await (0, get_scope_1.default)(client);
247847
- if (!(0, is_valid_name_1.isValidName)(deployId)) {
247848
- output.error(`The provided argument "${deployId}" is not a valid deployment or project`);
247849
- return 1;
247850
- }
247851
- let deployment;
247852
- let team;
247853
248396
  try {
247854
- output.spinner(`Fetching deployment "${deployId}" in ${chalk_1.default.bold(contextName)}…`);
247855
- const [teamResult, deploymentResult] = await Promise.allSettled([
247856
- config.currentTeam ? (0, get_team_by_id_1.default)(client, config.currentTeam) : undefined,
247857
- (0, get_deployment_1.default)(client, contextName, deployId),
247858
- ]);
247859
- if (teamResult.status === 'rejected') {
247860
- output.error(`Failed to retrieve team information: ${teamResult.reason}`);
247861
- return 1;
247862
- }
247863
- if (deploymentResult.status === 'rejected') {
247864
- output.error(deploymentResult.reason);
247865
- return 1;
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;
247866
248411
  }
247867
- team = teamResult.value;
247868
- deployment = deploymentResult.value;
247869
- // re-render the spinner text because it goes so fast
247870
- output.log(`Fetching deployment "${deployId}" in ${chalk_1.default.bold(contextName)}…`);
247871
- }
247872
- finally {
247873
- output.stopSpinner();
248412
+ // check the status
248413
+ return await (0, status_1.default)({
248414
+ client,
248415
+ contextName,
248416
+ deployment,
248417
+ project,
248418
+ timeout,
248419
+ });
247874
248420
  }
247875
- if (deployment.team?.id) {
247876
- if (!team || deployment.team.id !== team.id) {
247877
- output.error(team
247878
- ? `Deployment doesn't belong to current team ${chalk_1.default.bold(contextName)}`
247879
- : `Deployment belongs to a different team`);
248421
+ catch (err) {
248422
+ output.prettyError(err);
248423
+ if ((0, error_utils_1.isErrnoException)(err) && err.code === 'ERR_INVALID_TEAM') {
247880
248424
  output.error(`Use ${chalk_1.default.bold('vc switch')} to change your current team`);
247881
- return 1;
247882
248425
  }
247883
- }
247884
- else if (team) {
247885
- output.error(`Deployment doesn't belong to current team ${chalk_1.default.bold(contextName)}`);
247886
- output.error(`Use ${chalk_1.default.bold('vc switch')} to change your current team`);
247887
248426
  return 1;
247888
248427
  }
247889
- // create the rollback
247890
- await client.fetch(`/v9/projects/${project.id}/rollback/${deployment.id}`, {
247891
- body: {},
247892
- method: 'POST',
247893
- });
247894
- if (timeout !== undefined && (0, ms_1.default)(timeout) === 0) {
247895
- output.log(`Successfully requested rollback of ${chalk_1.default.bold(project.name)} to ${deployment.url} (${deployment.id})`);
247896
- output.log(`To check rollback status, run ${(0, pkg_name_1.getCommandName)('rollback')}.`);
247897
- return 0;
247898
- }
247899
- // check the status
247900
- return await (0, status_1.default)({
247901
- client,
247902
- contextName,
247903
- deployment,
247904
- project,
247905
- timeout,
247906
- });
247907
248428
  }
247908
248429
  exports.default = requestRollback;
247909
248430
 
@@ -248934,7 +249455,7 @@ module.exports = JSON.parse("[[[0,44],\"disallowed_STD3_valid\"],[[45,46],\"vali
248934
249455
  /***/ ((module) => {
248935
249456
 
248936
249457
  "use strict";
248937
- module.exports = JSON.parse("{\"name\":\"@vercel/client\",\"version\":\"12.5.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.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\"}}");
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\"}}");
248938
249459
 
248939
249460
  /***/ }),
248940
249461
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vercel",
3
- "version": "29.3.6",
3
+ "version": "30.0.0",
4
4
  "preferGlobal": true,
5
5
  "license": "Apache-2.0",
6
6
  "description": "The command-line interface for Vercel",
@@ -75,13 +75,13 @@
75
75
  "@types/which": "3.0.0",
76
76
  "@types/write-json-file": "2.2.1",
77
77
  "@types/yauzl-promise": "2.1.0",
78
- "@vercel-internals/constants": "*",
79
- "@vercel-internals/get-package-json": "*",
80
- "@vercel-internals/types": "*",
81
- "@vercel/client": "12.5.1",
78
+ "@vercel-internals/constants": "1.0.0",
79
+ "@vercel-internals/get-package-json": "1.0.0",
80
+ "@vercel-internals/types": "1.0.0",
81
+ "@vercel/client": "12.6.0",
82
82
  "@vercel/error-utils": "1.0.10",
83
83
  "@vercel/frameworks": "1.4.2",
84
- "@vercel/fs-detectors": "3.9.2",
84
+ "@vercel/fs-detectors": "3.9.3",
85
85
  "@vercel/fun": "1.0.4",
86
86
  "@vercel/ncc": "0.24.0",
87
87
  "@vercel/routing-utils": "2.2.1",