vercel 59.3.0 → 59.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{add-4L46WVRT.js → add-73X2SKBH.js} +3 -3
- package/dist/chunks/{add-BBWVXE2R.js → add-FQMB3XPM.js} +3 -3
- package/dist/chunks/{add-KOD24LEM.js → add-QJ3WT4FW.js} +6 -6
- package/dist/chunks/{build-2SX3XIRI.js → build-YUYCLCXD.js} +3 -3
- package/dist/chunks/{chunk-YPPWGI3F.js → chunk-2PX6N4FE.js} +3 -3
- package/dist/chunks/{chunk-G55RLNFE.js → chunk-BLYBHFIE.js} +4 -4
- package/dist/chunks/{chunk-Q6QCRFTC.js → chunk-CHEZBD7H.js} +2 -2
- package/dist/chunks/{chunk-DAA5RXUK.js → chunk-DDIZGOCK.js} +1 -1
- package/dist/chunks/{chunk-NN2W7WFC.js → chunk-EB5NBVTV.js} +2 -2
- package/dist/chunks/{chunk-ANIKVXGZ.js → chunk-EB7NJKPL.js} +1 -1
- package/dist/chunks/{chunk-P3BFTZXW.js → chunk-HJVTLJHO.js} +2 -2
- package/dist/chunks/{chunk-KDL2L4KL.js → chunk-HMJVUXE6.js} +13577 -13772
- package/dist/chunks/{chunk-7GE2K2WR.js → chunk-HURL5EBN.js} +312 -23
- package/dist/chunks/{chunk-VTP6WIQA.js → chunk-J5Y2QGGU.js} +257 -4
- package/dist/chunks/{chunk-ZHRZMQGN.js → chunk-KSZ4MNHO.js} +1 -1
- package/dist/chunks/{chunk-WNS53IOA.js → chunk-LKTQR5JE.js} +1 -1
- package/dist/chunks/{chunk-D35JUCTC.js → chunk-NP6BQPCN.js} +3 -3
- package/dist/chunks/{chunk-WODLA275.js → chunk-O5DLWLT7.js} +1 -1
- package/dist/chunks/{chunk-QKO2DGWR.js → chunk-PD4DYNSB.js} +3 -3
- package/dist/chunks/{chunk-AAMJ4ZU4.js → chunk-RI7KKKII.js} +1 -1
- package/dist/chunks/{chunk-J5ZEHLFM.js → chunk-TH2XUVDP.js} +10 -1
- package/dist/chunks/{chunk-OISTYQGR.js → chunk-UV2ZMFVG.js} +1 -1
- package/dist/chunks/{chunk-6GWLC2IP.js → chunk-VCE6QKFE.js} +2 -2
- package/dist/chunks/{chunk-KBUCAAG6.js → chunk-X6O6XJEA.js} +5 -5
- package/dist/chunks/{chunk-7PEQVFHI.js → chunk-Y3J4VU2H.js} +1 -1
- package/dist/chunks/{chunk-CURHMEJX.js → chunk-Y42SPI2H.js} +2 -2
- package/dist/chunks/{chunk-Z2G6SO5B.js → chunk-ZFWNMVNR.js} +2 -2
- package/dist/chunks/{clear-2DMDKLWZ.js → clear-USQM5VW5.js} +3 -3
- package/dist/chunks/{compile-vercel-config-7HZ4UN6R.js → compile-vercel-config-2JNYMI6W.js} +2 -2
- package/dist/chunks/{config-CVZ25C54.js → config-VTRIDLY4.js} +3 -3
- package/dist/chunks/{delete-4LQKP5DG.js → delete-ILLSBCVQ.js} +3 -3
- package/dist/chunks/{delete-QNAGJM6C.js → delete-VTPHK3EB.js} +3 -3
- package/dist/chunks/{disable-2RBFIZUB.js → disable-VTOMO64V.js} +3 -3
- package/dist/chunks/{discard-UCOSPSUU.js → discard-ZIOZ34ZI.js} +3 -3
- package/dist/chunks/{edit-JX73BG3V.js → edit-E3AMR4KM.js} +4 -4
- package/dist/chunks/{edit-QSAO74S4.js → edit-JMZ5XWVW.js} +3 -3
- package/dist/chunks/{enable-NDSB4T26.js → enable-A4PMZ7QZ.js} +3 -3
- package/dist/chunks/{export-DB6BIYQJ.js → export-Y6AJ3WRZ.js} +3 -3
- package/dist/chunks/{image-MKB6II6L.js → image-26BKPAUB.js} +4 -4
- package/dist/chunks/{import-builders-FIQ7QTVG.js → import-builders-3H7J2SEK.js} +3 -3
- package/dist/chunks/{inspect-QWTWAYLS.js → inspect-7DGKYHKW.js} +4 -4
- package/dist/chunks/{inspect-NY6QRX5W.js → inspect-GJFVAZIJ.js} +3 -3
- package/dist/chunks/{inspect-IYRKEWTM.js → inspect-N3E2PO6K.js} +3 -3
- package/dist/chunks/{inspect-XS2TC7TC.js → inspect-OEY4DJRI.js} +3 -3
- package/dist/chunks/{inspect-REJXLWLL.js → inspect-ZW5N6O5P.js} +3 -3
- package/dist/chunks/{list-CDCITV4K.js → list-2VTCNQEB.js} +2 -2
- package/dist/chunks/{list-PXKVKXHG.js → list-DTJBW7OQ.js} +4 -4
- package/dist/chunks/{list-VQHBVY3Q.js → list-MIQ5D6PM.js} +3 -3
- package/dist/chunks/{login-PE4JK7A2.js → login-L34UHAU5.js} +3 -3
- package/dist/chunks/{ls-3GRHYFDM.js → ls-NCPQY4FV.js} +3 -3
- package/dist/chunks/{ls-SKOQOPK4.js → ls-OBUDC4SB.js} +3 -3
- package/dist/chunks/{ls-DL2POAY2.js → ls-OKO4IHWB.js} +4 -4
- package/dist/chunks/{ls-YHS5IEBJ.js → ls-SXJFBLUT.js} +3 -3
- package/dist/chunks/{ls-S67TNMEG.js → ls-VDYUFSSC.js} +3 -3
- package/dist/chunks/{open-DUN3BTDH.js → open-V5JDGXUP.js} +3 -3
- package/dist/chunks/{permissions-VLIZYINB.js → permissions-6CPRPPBY.js} +5 -5
- package/dist/chunks/{publish-36BIJPLN.js → publish-R27DPHFO.js} +3 -3
- package/dist/chunks/{push-5NTQV3EC.js → push-VLVTBS42.js} +3 -3
- package/dist/chunks/{query-ONR2W7HS.js → query-IVVRYMJN.js} +2 -2
- package/dist/chunks/{reorder-YKAT4XG3.js → reorder-LJ2RBZM2.js} +3 -3
- package/dist/chunks/{reply-DH4ZPEXT.js → reply-USAISZYC.js} +3 -3
- package/dist/chunks/{resolve-446IVH6V.js → resolve-CRCJYVS5.js} +3 -3
- package/dist/chunks/{restore-HA6TSOOE.js → restore-6PBPEAMU.js} +3 -3
- package/dist/chunks/{rm-EG35766L.js → rm-EOD7RDSO.js} +3 -3
- package/dist/chunks/{rm-BCPJUK2C.js → rm-HHELZB7R.js} +3 -3
- package/dist/chunks/{rm-COV73VE4.js → rm-KGOEOWVK.js} +4 -4
- package/dist/chunks/{rm-IKYJI7MP.js → rm-TWU3JR6Z.js} +3 -3
- package/dist/chunks/{rule-inspect-FQ2635LY.js → rule-inspect-WFTVRK6B.js} +4 -4
- package/dist/chunks/{rules-PBOQISWV.js → rules-AQYTFJI6.js} +7 -7
- package/dist/chunks/{schema-4CDJVH7T.js → schema-ZCDCJC7E.js} +2 -2
- package/dist/chunks/{tags-HNOL4JXL.js → tags-RCNRFX7U.js} +3 -3
- package/dist/chunks/{update-ZIGVLUYG.js → update-I7QGAOYF.js} +6 -6
- package/dist/commands/build/index.js +21 -17
- package/dist/commands/deploy/index.js +9 -9
- package/dist/commands/dev/index.js +70 -31
- package/dist/commands/env/index.js +146 -223
- package/dist/commands/link/index.js +4 -4
- package/dist/commands/list/index.js +3 -3
- package/dist/commands-bulk.js +3873 -1925
- package/dist/index.js +9 -9
- package/dist/version.mjs +1 -1
- package/package.json +49 -48
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
import {
|
|
27
27
|
formatEnvironment,
|
|
28
28
|
validateLsArgs
|
|
29
|
-
} from "../../chunks/chunk-
|
|
29
|
+
} from "../../chunks/chunk-RI7KKKII.js";
|
|
30
30
|
import {
|
|
31
31
|
validateJsonOutput
|
|
32
32
|
} from "../../chunks/chunk-KXDWXXJH.js";
|
|
@@ -35,7 +35,7 @@ import {
|
|
|
35
35
|
} from "../../chunks/chunk-YPQSDAEW.js";
|
|
36
36
|
import {
|
|
37
37
|
getCommandAliases
|
|
38
|
-
} from "../../chunks/chunk-
|
|
38
|
+
} from "../../chunks/chunk-HURL5EBN.js";
|
|
39
39
|
import "../../chunks/chunk-2MF3ZAVW.js";
|
|
40
40
|
import "../../chunks/chunk-WC7IINFV.js";
|
|
41
41
|
import "../../chunks/chunk-RIB4S2IB.js";
|
|
@@ -58,7 +58,7 @@ import {
|
|
|
58
58
|
stamp_default
|
|
59
59
|
} from "../../chunks/chunk-64IF634X.js";
|
|
60
60
|
import "../../chunks/chunk-VXYGCOKL.js";
|
|
61
|
-
import "../../chunks/chunk-
|
|
61
|
+
import "../../chunks/chunk-Y3J4VU2H.js";
|
|
62
62
|
import {
|
|
63
63
|
help
|
|
64
64
|
} from "../../chunks/chunk-XI6NJLI4.js";
|
|
@@ -85,7 +85,7 @@ import {
|
|
|
85
85
|
resolveProjectContext,
|
|
86
86
|
runSubcommand,
|
|
87
87
|
updateSubcommand
|
|
88
|
-
} from "../../chunks/chunk-
|
|
88
|
+
} from "../../chunks/chunk-HMJVUXE6.js";
|
|
89
89
|
import {
|
|
90
90
|
TelemetryClient,
|
|
91
91
|
require_dist as require_dist2
|
|
@@ -100,7 +100,7 @@ import {
|
|
|
100
100
|
getPreservedArgsForEnvUpdate,
|
|
101
101
|
outputActionRequired,
|
|
102
102
|
outputAgentError
|
|
103
|
-
} from "../../chunks/chunk-
|
|
103
|
+
} from "../../chunks/chunk-TH2XUVDP.js";
|
|
104
104
|
import {
|
|
105
105
|
require_ms
|
|
106
106
|
} from "../../chunks/chunk-GGP5R3FU.js";
|
|
@@ -460,13 +460,6 @@ var EnvAddTelemetryClient = class extends TelemetryClient {
|
|
|
460
460
|
import { determineAgent } from "@vercel/detect-agent";
|
|
461
461
|
|
|
462
462
|
// src/util/env/env-var-config-secret-ui.ts
|
|
463
|
-
function isEnvVarConfigSecretUiEnabled() {
|
|
464
|
-
const raw = process.env.VERCEL_ENV_VAR_CONFIG_SECRET_UI;
|
|
465
|
-
return raw === "1" || raw?.toLowerCase() === "true" || raw?.toLowerCase() === "on";
|
|
466
|
-
}
|
|
467
|
-
function shouldEnforceSensitiveEnvVarPolicy(policyOn) {
|
|
468
|
-
return policyOn && !isEnvVarConfigSecretUiEnabled();
|
|
469
|
-
}
|
|
470
463
|
function formatVisibilityLabel(visibility, type) {
|
|
471
464
|
const resolved = visibility ?? visibilityFromEnvType(type);
|
|
472
465
|
if (resolved === "config") {
|
|
@@ -504,23 +497,6 @@ function getPublicPrefixSecretVisibilityError(key, options) {
|
|
|
504
497
|
}
|
|
505
498
|
return `Environment variables with a public framework prefix (${prefixLabel}) cannot use secret visibility. Rename to remove the public prefix or use \`--visibility config\` with \`--no-sensitive\`.`;
|
|
506
499
|
}
|
|
507
|
-
function getDevelopmentSecretVisibilityError(envTargets, options) {
|
|
508
|
-
if (options.configSecretUiEnabled) {
|
|
509
|
-
return null;
|
|
510
|
-
}
|
|
511
|
-
if (!envTargets.includes("development")) {
|
|
512
|
-
return null;
|
|
513
|
-
}
|
|
514
|
-
const wouldBeSecret = options.type === "sensitive" || options.visibility === "secret";
|
|
515
|
-
if (!wouldBeSecret) {
|
|
516
|
-
return null;
|
|
517
|
-
}
|
|
518
|
-
const hasNonDevelopment = envTargets.some((target) => target !== "development");
|
|
519
|
-
if (hasNonDevelopment) {
|
|
520
|
-
return `Sensitive Environment Variables are not supported on the Development Environment. Add --no-sensitive to store a non-sensitive value for all selected Environments, or run \`vercel env add\` separately for Development.`;
|
|
521
|
-
}
|
|
522
|
-
return `--sensitive is not allowed with the Development Environment. Sensitive Environment Variables are only supported on Production and Preview.`;
|
|
523
|
-
}
|
|
524
500
|
function shouldOmitInferredVisibility(key, envTargets, teamSensitivePolicyOn) {
|
|
525
501
|
if (!getPublicPrefix(key)) {
|
|
526
502
|
return false;
|
|
@@ -531,9 +507,6 @@ function shouldOmitInferredVisibility(key, envTargets, teamSensitivePolicyOn) {
|
|
|
531
507
|
return teamSensitivePolicyOn;
|
|
532
508
|
}
|
|
533
509
|
function resolveEnvVarVisibility(options) {
|
|
534
|
-
if (!options.configSecretUiEnabled) {
|
|
535
|
-
return {};
|
|
536
|
-
}
|
|
537
510
|
if (options.explicitVisibility !== void 0) {
|
|
538
511
|
if (options.explicitVisibility !== "config" && options.explicitVisibility !== "secret") {
|
|
539
512
|
return {
|
|
@@ -551,34 +524,12 @@ function resolveEnvVarVisibility(options) {
|
|
|
551
524
|
if (publicPrefixError2) {
|
|
552
525
|
return { error: publicPrefixError2 };
|
|
553
526
|
}
|
|
554
|
-
const developmentError2 = getDevelopmentSecretVisibilityError(
|
|
555
|
-
options.envTargets,
|
|
556
|
-
{
|
|
557
|
-
type: options.type,
|
|
558
|
-
visibility: options.explicitVisibility,
|
|
559
|
-
configSecretUiEnabled: options.configSecretUiEnabled
|
|
560
|
-
}
|
|
561
|
-
);
|
|
562
|
-
if (developmentError2) {
|
|
563
|
-
return { error: developmentError2 };
|
|
564
|
-
}
|
|
565
527
|
return { visibility: options.explicitVisibility };
|
|
566
528
|
}
|
|
567
529
|
const inferred = visibilityFromEnvType(options.type);
|
|
568
530
|
if (inferred === void 0) {
|
|
569
531
|
return {};
|
|
570
532
|
}
|
|
571
|
-
const developmentError = getDevelopmentSecretVisibilityError(
|
|
572
|
-
options.envTargets,
|
|
573
|
-
{
|
|
574
|
-
type: options.type,
|
|
575
|
-
visibility: inferred,
|
|
576
|
-
configSecretUiEnabled: options.configSecretUiEnabled
|
|
577
|
-
}
|
|
578
|
-
);
|
|
579
|
-
if (developmentError) {
|
|
580
|
-
return { error: developmentError };
|
|
581
|
-
}
|
|
582
533
|
if (shouldOmitInferredVisibility(
|
|
583
534
|
options.key,
|
|
584
535
|
options.envTargets,
|
|
@@ -603,22 +554,13 @@ var SENSITIVE_SECRET_PROMPT = `Store as sensitive? ${import_chalk.default.dim(
|
|
|
603
554
|
SENSITIVE_VALUE_HINT
|
|
604
555
|
)}`;
|
|
605
556
|
function filterEnvChoicesForSensitivity(choices, opts) {
|
|
606
|
-
if (opts.isSensitive && !opts.configSecretUiEnabled) {
|
|
607
|
-
return choices.filter((c) => c.value !== "development");
|
|
608
|
-
}
|
|
609
557
|
if (opts.policyOn) {
|
|
610
558
|
return choices.filter((c) => c.value === "development");
|
|
611
559
|
}
|
|
612
560
|
return choices;
|
|
613
561
|
}
|
|
614
|
-
function getTargetCompatibilityError(envTargets, isSensitive, policyOn
|
|
615
|
-
const hasDevelopment = envTargets.includes("development");
|
|
562
|
+
function getTargetCompatibilityError(envTargets, isSensitive, policyOn) {
|
|
616
563
|
const hasSensitiveCapable = envTargets.some((t) => t !== "development");
|
|
617
|
-
if (isSensitive && hasDevelopment && !configSecretUiEnabled) {
|
|
618
|
-
return `Sensitive Environment Variables are not supported on the Development Environment. Add --no-sensitive to store a non-sensitive value for all selected Environments, or run ${getCommandName(
|
|
619
|
-
"env add"
|
|
620
|
-
)} separately for Development.`;
|
|
621
|
-
}
|
|
622
564
|
if (!isSensitive && policyOn && hasSensitiveCapable) {
|
|
623
565
|
return `Your team requires sensitive Environment Variables for Production and Preview. To add a non-sensitive value, target the Development Environment only. Run ${getCommandName(
|
|
624
566
|
"env add"
|
|
@@ -628,7 +570,7 @@ function getTargetCompatibilityError(envTargets, isSensitive, policyOn, configSe
|
|
|
628
570
|
}
|
|
629
571
|
function resolveFinalType(envTargets, isSensitive, opts) {
|
|
630
572
|
const hasDevelopment = envTargets.includes("development");
|
|
631
|
-
if (hasDevelopment && !
|
|
573
|
+
if (hasDevelopment && !isSensitive) {
|
|
632
574
|
return "encrypted";
|
|
633
575
|
}
|
|
634
576
|
if (opts.forceEncrypted && !opts.policyOn) {
|
|
@@ -641,8 +583,7 @@ function resolveFinalType(envTargets, isSensitive, opts) {
|
|
|
641
583
|
}
|
|
642
584
|
function fillEnvAddTemplate(template, opts) {
|
|
643
585
|
const targetPlaceholder = getEnvTargetPlaceholder();
|
|
644
|
-
|
|
645
|
-
return out.replace(/<value>/g, "<value>");
|
|
586
|
+
return template.replace(/<name>/g, opts.envName ?? "<name>").split(targetPlaceholder).join(opts.envTargetArg ?? targetPlaceholder).replace(/<git-branch>/g, opts.envGitBranch ?? "<git-branch>").replace(/<gitbranch>/g, opts.envGitBranch ?? "<gitbranch>").replace(/<value>/g, "<value>");
|
|
646
587
|
}
|
|
647
588
|
function redactEnvValueArgs(argv) {
|
|
648
589
|
const redacted = [...argv];
|
|
@@ -666,9 +607,8 @@ function multiTargetSuggestion(argv, envName, targets, addNoSensitive) {
|
|
|
666
607
|
when: addNoSensitive ? "Add one non-sensitive variable to all listed environments" : "Add one variable to multiple environments"
|
|
667
608
|
};
|
|
668
609
|
}
|
|
669
|
-
function filterSensitiveMultiTargetSuggestionTargets(targets,
|
|
670
|
-
|
|
671
|
-
return excludeDevelopment ? targets.filter((target) => target !== "development") : targets;
|
|
610
|
+
function filterSensitiveMultiTargetSuggestionTargets(targets, _opts) {
|
|
611
|
+
return targets;
|
|
672
612
|
}
|
|
673
613
|
function projectLabel(link) {
|
|
674
614
|
return `${link.org.slug}/${link.project.name}`;
|
|
@@ -703,11 +643,9 @@ function printEnvAddResult(link, envName, envTargets, envGitBranch, customEnviro
|
|
|
703
643
|
printAlignedLabel("Branch", envGitBranch);
|
|
704
644
|
}
|
|
705
645
|
printAlignedLabel("Type", typeLabel(finalType));
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
printAlignedLabel("Visibility", visibilityLabel);
|
|
710
|
-
}
|
|
646
|
+
const visibilityLabel = formatVisibilityLabel(visibility, finalType);
|
|
647
|
+
if (visibilityLabel) {
|
|
648
|
+
printAlignedLabel("Visibility", visibilityLabel);
|
|
711
649
|
}
|
|
712
650
|
}
|
|
713
651
|
function printEnvAddWarning(message) {
|
|
@@ -741,7 +679,6 @@ async function add(client, argv) {
|
|
|
741
679
|
return 1;
|
|
742
680
|
}
|
|
743
681
|
const { args, flags: opts } = parsedArgs;
|
|
744
|
-
const configSecretUiEnabled = isEnvVarConfigSecretUiEnabled();
|
|
745
682
|
const stdInput = await readStandardInput(client.stdin);
|
|
746
683
|
const valueFromFlag = typeof opts["--value"] === "string" ? opts["--value"] : void 0;
|
|
747
684
|
let [envName, envTargetArg] = args;
|
|
@@ -771,14 +708,14 @@ async function add(client, argv) {
|
|
|
771
708
|
telemetryClient.trackCliOptionProject(opts["--project"]);
|
|
772
709
|
if (positionalGitBranch && optionGitBranch) {
|
|
773
710
|
output_manager_default.error(
|
|
774
|
-
"Git branch was provided twice. Use either `--git-branch <
|
|
711
|
+
"Git branch was provided twice. Use either `--git-branch <git-branch>` or the legacy third argument."
|
|
775
712
|
);
|
|
776
713
|
return 1;
|
|
777
714
|
}
|
|
778
715
|
if (args.length > 3) {
|
|
779
716
|
output_manager_default.error(
|
|
780
717
|
`Invalid number of arguments. Usage: ${getCommandName(
|
|
781
|
-
`env add <name> ${getEnvTargetPlaceholder()} --git-branch <
|
|
718
|
+
`env add <name> ${getEnvTargetPlaceholder()} --git-branch <git-branch>`
|
|
782
719
|
)}`
|
|
783
720
|
);
|
|
784
721
|
return 1;
|
|
@@ -786,7 +723,7 @@ async function add(client, argv) {
|
|
|
786
723
|
if (stdInput && (!envName || !envTargetArg)) {
|
|
787
724
|
output_manager_default.error(
|
|
788
725
|
`Invalid number of arguments. Usage: ${getCommandName(
|
|
789
|
-
`env add <name> <target> --git-branch <
|
|
726
|
+
`env add <name> <target> --git-branch <git-branch> < <file>`
|
|
790
727
|
)}`
|
|
791
728
|
);
|
|
792
729
|
return 1;
|
|
@@ -818,7 +755,25 @@ async function add(client, argv) {
|
|
|
818
755
|
"<scope>",
|
|
819
756
|
...linkPreserved
|
|
820
757
|
];
|
|
821
|
-
|
|
758
|
+
let envAddRetryArgv = redactEnvValueArgs(client.argv);
|
|
759
|
+
if (envTargetArg === "preview" && envGitBranch === void 0) {
|
|
760
|
+
const argvArgs = client.argv.slice(2);
|
|
761
|
+
const addIdx = argvArgs.indexOf("add");
|
|
762
|
+
if (addIdx !== -1) {
|
|
763
|
+
let pos = addIdx + 1;
|
|
764
|
+
let positionals = 0;
|
|
765
|
+
while (pos < argvArgs.length && positionals < 3 && !argvArgs[pos].startsWith("-")) {
|
|
766
|
+
positionals++;
|
|
767
|
+
pos++;
|
|
768
|
+
}
|
|
769
|
+
const insertAt = 2 + pos;
|
|
770
|
+
envAddRetryArgv = redactEnvValueArgs([
|
|
771
|
+
...client.argv.slice(0, insertAt),
|
|
772
|
+
"<gitbranch>",
|
|
773
|
+
...client.argv.slice(insertAt)
|
|
774
|
+
]);
|
|
775
|
+
}
|
|
776
|
+
}
|
|
822
777
|
outputAgentError(
|
|
823
778
|
client,
|
|
824
779
|
{
|
|
@@ -875,6 +830,9 @@ async function add(client, argv) {
|
|
|
875
830
|
missing.push("missing_value");
|
|
876
831
|
if (!envTargetArg && choices2.length > 0)
|
|
877
832
|
missing.push("missing_environment");
|
|
833
|
+
if (envTargetArg === "preview" && envGitBranch === void 0 && !(client.nonInteractive && args.length === 2)) {
|
|
834
|
+
missing.push("git_branch_required");
|
|
835
|
+
}
|
|
878
836
|
if (missing.length > 0) {
|
|
879
837
|
const parts = missing.map((m) => {
|
|
880
838
|
if (m === "missing_name")
|
|
@@ -883,20 +841,52 @@ async function add(client, argv) {
|
|
|
883
841
|
return "--value or stdin";
|
|
884
842
|
if (m === "missing_environment")
|
|
885
843
|
return "environment (production, preview, development, or a comma-separated list)";
|
|
844
|
+
if (m === "git_branch_required")
|
|
845
|
+
return "`--git-branch <git-branch>` for Preview, or omit for all Preview branches";
|
|
886
846
|
return m;
|
|
887
847
|
});
|
|
888
848
|
const fullTemplate = `env add <name> ${getEnvTargetPlaceholder()} --value "<value>" --yes`;
|
|
889
849
|
const filledTemplate = fillEnvAddTemplate(fullTemplate, {
|
|
890
850
|
envName,
|
|
891
|
-
envTargetArg
|
|
851
|
+
envTargetArg,
|
|
852
|
+
envGitBranch
|
|
892
853
|
});
|
|
893
854
|
const next = [];
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
855
|
+
const onlyGitBranchMissing = missing.length === 1 && missing[0] === "git_branch_required";
|
|
856
|
+
if (!onlyGitBranchMissing) {
|
|
857
|
+
next.push({
|
|
858
|
+
command: buildEnvAddCommandWithPreservedArgs(
|
|
859
|
+
client.argv,
|
|
860
|
+
filledTemplate
|
|
861
|
+
)
|
|
862
|
+
});
|
|
863
|
+
}
|
|
864
|
+
if (missing.includes("git_branch_required") && envName && (valueFromFlag !== void 0 || stdInput)) {
|
|
865
|
+
const branchSpecific = fillEnvAddTemplate(
|
|
866
|
+
'env add <name> preview --git-branch <git-branch> --value "<value>" --yes',
|
|
867
|
+
{ envName, envTargetArg: "preview" }
|
|
868
|
+
);
|
|
869
|
+
const branchAll = fillEnvAddTemplate(
|
|
870
|
+
'env add <name> preview --value "<value>" --yes',
|
|
871
|
+
{ envName, envTargetArg: "preview" }
|
|
872
|
+
);
|
|
873
|
+
next.push(
|
|
874
|
+
{
|
|
875
|
+
command: buildEnvAddCommandWithPreservedArgs(
|
|
876
|
+
client.argv,
|
|
877
|
+
branchSpecific
|
|
878
|
+
),
|
|
879
|
+
when: "Add to a specific Git branch"
|
|
880
|
+
},
|
|
881
|
+
{
|
|
882
|
+
command: buildEnvAddCommandWithPreservedArgs(
|
|
883
|
+
client.argv,
|
|
884
|
+
branchAll
|
|
885
|
+
),
|
|
886
|
+
when: "Add to all Preview branches"
|
|
887
|
+
}
|
|
888
|
+
);
|
|
889
|
+
}
|
|
900
890
|
if (missing.includes("missing_environment")) {
|
|
901
891
|
const standardAvailable = choices2.map((c) => c.value).filter((v) => isValidEnvTarget(v));
|
|
902
892
|
const multiTargets = filterSensitiveMultiTargetSuggestionTargets(
|
|
@@ -1032,7 +1022,25 @@ async function add(client, argv) {
|
|
|
1032
1022
|
...link.status === "not_linked" ? ["--scope", "<scope>"] : [],
|
|
1033
1023
|
...linkPreserved
|
|
1034
1024
|
];
|
|
1035
|
-
|
|
1025
|
+
let envAddRetryArgv = redactEnvValueArgs(client.argv);
|
|
1026
|
+
if (envTargetArg === "preview" && envGitBranch === void 0) {
|
|
1027
|
+
const argvArgs = client.argv.slice(2);
|
|
1028
|
+
const addIdx = argvArgs.indexOf("add");
|
|
1029
|
+
if (addIdx !== -1) {
|
|
1030
|
+
let pos = addIdx + 1;
|
|
1031
|
+
let positionals = 0;
|
|
1032
|
+
while (pos < argvArgs.length && positionals < 3 && !argvArgs[pos].startsWith("-")) {
|
|
1033
|
+
positionals++;
|
|
1034
|
+
pos++;
|
|
1035
|
+
}
|
|
1036
|
+
const insertAt = 2 + pos;
|
|
1037
|
+
envAddRetryArgv = redactEnvValueArgs([
|
|
1038
|
+
...client.argv.slice(0, insertAt),
|
|
1039
|
+
"<gitbranch>",
|
|
1040
|
+
...client.argv.slice(insertAt)
|
|
1041
|
+
]);
|
|
1042
|
+
}
|
|
1043
|
+
}
|
|
1036
1044
|
outputAgentError(
|
|
1037
1045
|
client,
|
|
1038
1046
|
{
|
|
@@ -1167,13 +1175,12 @@ async function add(client, argv) {
|
|
|
1167
1175
|
);
|
|
1168
1176
|
return 1;
|
|
1169
1177
|
}
|
|
1170
|
-
|
|
1178
|
+
const policyOn = false;
|
|
1171
1179
|
let teamSensitivePolicyOn = false;
|
|
1172
1180
|
if (link.org.type === "team") {
|
|
1173
1181
|
try {
|
|
1174
1182
|
const team = await getTeamById(client, link.org.id);
|
|
1175
1183
|
teamSensitivePolicyOn = team?.sensitiveEnvironmentVariablePolicy === "on";
|
|
1176
|
-
policyOn = shouldEnforceSensitiveEnvVarPolicy(teamSensitivePolicyOn);
|
|
1177
1184
|
} catch {
|
|
1178
1185
|
}
|
|
1179
1186
|
}
|
|
@@ -1191,93 +1198,31 @@ async function add(client, argv) {
|
|
|
1191
1198
|
isSensitive = true;
|
|
1192
1199
|
} else {
|
|
1193
1200
|
isSensitive = await client.input.confirm(SENSITIVE_SECRET_PROMPT, true);
|
|
1194
|
-
if (policyOn && !isSensitive) {
|
|
1195
|
-
output_manager_default.print(
|
|
1196
|
-
` ${import_chalk.default.dim(
|
|
1197
|
-
"Team policy limits non-sensitive values to Development."
|
|
1198
|
-
)}
|
|
1199
|
-
`
|
|
1200
|
-
);
|
|
1201
|
-
}
|
|
1202
|
-
}
|
|
1203
|
-
if (!client.nonInteractive && skipSensitivePrompt && policyOn && !isSensitive && envTargets.length === 0) {
|
|
1204
|
-
output_manager_default.print(
|
|
1205
|
-
` ${import_chalk.default.dim(
|
|
1206
|
-
"Team policy limits non-sensitive values to Development."
|
|
1207
|
-
)}
|
|
1208
|
-
`
|
|
1209
|
-
);
|
|
1210
|
-
}
|
|
1211
|
-
if (forceSensitive && envTargets.includes("development") && !configSecretUiEnabled) {
|
|
1212
|
-
const msg = `--sensitive is not allowed with the Development Environment. Sensitive Environment Variables are only supported on Production and Preview.`;
|
|
1213
|
-
if (client.nonInteractive) {
|
|
1214
|
-
const nonDev = envTargets.filter((t) => t !== "development");
|
|
1215
|
-
outputAgentError(
|
|
1216
|
-
client,
|
|
1217
|
-
{
|
|
1218
|
-
status: "error",
|
|
1219
|
-
reason: "sensitive_not_allowed_on_development",
|
|
1220
|
-
message: msg,
|
|
1221
|
-
...nonDev.length > 0 ? {
|
|
1222
|
-
next: [
|
|
1223
|
-
{
|
|
1224
|
-
command: buildEnvAddCommandWithPreservedArgs(
|
|
1225
|
-
client.argv,
|
|
1226
|
-
`env add ${envName} ${nonDev.join(",")} --value "<value>" --yes`
|
|
1227
|
-
),
|
|
1228
|
-
when: "Keep sensitive and skip Development"
|
|
1229
|
-
}
|
|
1230
|
-
]
|
|
1231
|
-
} : {}
|
|
1232
|
-
},
|
|
1233
|
-
1
|
|
1234
|
-
);
|
|
1235
|
-
}
|
|
1236
|
-
output_manager_default.error(msg);
|
|
1237
|
-
return 1;
|
|
1238
1201
|
}
|
|
1239
1202
|
if (envTargets.length > 0) {
|
|
1240
1203
|
const compatibilityError = getTargetCompatibilityError(
|
|
1241
1204
|
envTargets,
|
|
1242
1205
|
isSensitive,
|
|
1243
|
-
policyOn
|
|
1244
|
-
configSecretUiEnabled
|
|
1206
|
+
policyOn
|
|
1245
1207
|
);
|
|
1246
1208
|
if (compatibilityError) {
|
|
1247
1209
|
if (client.nonInteractive) {
|
|
1248
|
-
const next = [
|
|
1249
|
-
|
|
1250
|
-
if (!policyOn) {
|
|
1251
|
-
next.push(
|
|
1252
|
-
multiTargetSuggestion(client.argv, envName, envTargets, true)
|
|
1253
|
-
);
|
|
1254
|
-
}
|
|
1255
|
-
const nonDev = envTargets.filter((t) => t !== "development");
|
|
1256
|
-
if (nonDev.length > 0) {
|
|
1257
|
-
next.push({
|
|
1258
|
-
command: buildEnvAddCommandWithPreservedArgs(
|
|
1259
|
-
client.argv,
|
|
1260
|
-
`env add ${envName} ${nonDev.join(",")} --value "<value>" --yes`
|
|
1261
|
-
),
|
|
1262
|
-
when: "Keep sensitive and skip Development"
|
|
1263
|
-
});
|
|
1264
|
-
}
|
|
1265
|
-
} else {
|
|
1266
|
-
next.push({
|
|
1210
|
+
const next = [
|
|
1211
|
+
{
|
|
1267
1212
|
command: buildEnvAddCommandWithPreservedArgs(
|
|
1268
1213
|
client.argv,
|
|
1269
1214
|
`env add ${envName} development --value "<value>" --yes`
|
|
1270
1215
|
),
|
|
1271
1216
|
when: "Add as non-sensitive to Development only"
|
|
1272
|
-
}
|
|
1273
|
-
|
|
1217
|
+
}
|
|
1218
|
+
];
|
|
1274
1219
|
outputAgentError(
|
|
1275
1220
|
client,
|
|
1276
1221
|
{
|
|
1277
1222
|
status: "error",
|
|
1278
|
-
reason:
|
|
1223
|
+
reason: "non_sensitive_not_allowed_on_production_preview",
|
|
1279
1224
|
message: compatibilityError,
|
|
1280
|
-
|
|
1225
|
+
next
|
|
1281
1226
|
},
|
|
1282
1227
|
1
|
|
1283
1228
|
);
|
|
@@ -1288,8 +1233,7 @@ async function add(client, argv) {
|
|
|
1288
1233
|
}
|
|
1289
1234
|
const envChoices = filterEnvChoicesForSensitivity(choices, {
|
|
1290
1235
|
isSensitive,
|
|
1291
|
-
policyOn
|
|
1292
|
-
configSecretUiEnabled
|
|
1236
|
+
policyOn
|
|
1293
1237
|
});
|
|
1294
1238
|
if (policyOn && isSensitive) {
|
|
1295
1239
|
for (const choice of envChoices) {
|
|
@@ -1302,7 +1246,7 @@ async function add(client, argv) {
|
|
|
1302
1246
|
}
|
|
1303
1247
|
if (!envGitBranch && envChoices.length === 0 && envTargets.length === 0 && !opts["--force"]) {
|
|
1304
1248
|
output_manager_default.error(
|
|
1305
|
-
`No Environments are available for this variable with the selected sensitivity.
|
|
1249
|
+
`No Environments are available for this variable with the selected sensitivity. Your team requires sensitive Environment Variables for Production and Preview.`
|
|
1306
1250
|
);
|
|
1307
1251
|
return 1;
|
|
1308
1252
|
}
|
|
@@ -1397,28 +1341,54 @@ async function add(client, argv) {
|
|
|
1397
1341
|
const postSelectionError = getTargetCompatibilityError(
|
|
1398
1342
|
envTargets,
|
|
1399
1343
|
isSensitive,
|
|
1400
|
-
policyOn
|
|
1401
|
-
configSecretUiEnabled
|
|
1344
|
+
policyOn
|
|
1402
1345
|
);
|
|
1403
1346
|
if (postSelectionError) {
|
|
1404
1347
|
output_manager_default.error(postSelectionError);
|
|
1405
1348
|
return 1;
|
|
1406
1349
|
}
|
|
1407
|
-
if (envGitBranch === void 0 && envTargets.length === 1 && envTargets[0] === "preview" && !
|
|
1408
|
-
|
|
1409
|
-
|
|
1350
|
+
if (envGitBranch === void 0 && envTargets.length === 1 && envTargets[0] === "preview" && !opts["--yes"] && !(client.nonInteractive && args.length === 2)) {
|
|
1351
|
+
if (client.nonInteractive) {
|
|
1352
|
+
outputActionRequired(
|
|
1353
|
+
client,
|
|
1354
|
+
{
|
|
1355
|
+
status: "action_required",
|
|
1356
|
+
reason: "git_branch_required",
|
|
1357
|
+
message: `Add ${envName} to which Git branch for Preview? Pass branch as third argument, or omit for all Preview branches.`,
|
|
1358
|
+
next: [
|
|
1359
|
+
{
|
|
1360
|
+
command: buildEnvAddCommandWithPreservedArgs(
|
|
1361
|
+
client.argv,
|
|
1362
|
+
`env add ${envName} preview --git-branch <git-branch> --value "<value>" --yes`
|
|
1363
|
+
),
|
|
1364
|
+
when: "Add to a specific Git branch"
|
|
1365
|
+
},
|
|
1366
|
+
{
|
|
1367
|
+
command: buildEnvAddCommandWithPreservedArgs(
|
|
1368
|
+
client.argv,
|
|
1369
|
+
`env add ${envName} preview --value "<value>" --yes`
|
|
1370
|
+
),
|
|
1371
|
+
when: "Add to all Preview branches"
|
|
1372
|
+
}
|
|
1373
|
+
]
|
|
1374
|
+
},
|
|
1375
|
+
1
|
|
1376
|
+
);
|
|
1377
|
+
} else {
|
|
1378
|
+
output_manager_default.print(
|
|
1379
|
+
` ${import_chalk.default.dim("Leave empty to apply to all Preview branches.")}
|
|
1410
1380
|
`
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1381
|
+
);
|
|
1382
|
+
envGitBranch = await client.input.text({
|
|
1383
|
+
message: `Git branch?`
|
|
1384
|
+
});
|
|
1385
|
+
}
|
|
1415
1386
|
}
|
|
1416
1387
|
const hasDevelopment = envTargets.includes("development");
|
|
1417
1388
|
let finalType = resolveFinalType(envTargets, isSensitive, {
|
|
1418
1389
|
forceSensitive,
|
|
1419
1390
|
forceEncrypted,
|
|
1420
|
-
policyOn
|
|
1421
|
-
configSecretUiEnabled
|
|
1391
|
+
policyOn
|
|
1422
1392
|
});
|
|
1423
1393
|
if (policyOn && !hasDevelopment) {
|
|
1424
1394
|
if (forceEncrypted) {
|
|
@@ -1430,7 +1400,6 @@ async function add(client, argv) {
|
|
|
1430
1400
|
}
|
|
1431
1401
|
const upsert = opts["--force"] ? "true" : "";
|
|
1432
1402
|
const { visibility, error: visibilityError } = resolveEnvVarVisibility({
|
|
1433
|
-
configSecretUiEnabled,
|
|
1434
1403
|
explicitVisibility,
|
|
1435
1404
|
type: finalType,
|
|
1436
1405
|
key: envName,
|
|
@@ -2184,13 +2153,6 @@ var EnvUpdateTelemetryClient = class extends TelemetryClient {
|
|
|
2184
2153
|
};
|
|
2185
2154
|
|
|
2186
2155
|
// src/commands/env/update.ts
|
|
2187
|
-
function selectedEnvTargetsDevelopment(env) {
|
|
2188
|
-
if (typeof env.target === "string")
|
|
2189
|
-
return env.target === "development";
|
|
2190
|
-
if (Array.isArray(env.target))
|
|
2191
|
-
return env.target.includes("development");
|
|
2192
|
-
return false;
|
|
2193
|
-
}
|
|
2194
2156
|
async function update(client, argv) {
|
|
2195
2157
|
let parsedArgs;
|
|
2196
2158
|
const flagsSpecification = getFlagsSpecification(updateSubcommand.options);
|
|
@@ -2489,50 +2451,14 @@ async function update(client, argv) {
|
|
|
2489
2451
|
});
|
|
2490
2452
|
selectedEnv = matchingEnvs[selectedIndex];
|
|
2491
2453
|
}
|
|
2492
|
-
const configSecretUiEnabled = isEnvVarConfigSecretUiEnabled();
|
|
2493
|
-
let policyOn = false;
|
|
2494
2454
|
let teamSensitivePolicyOn = false;
|
|
2495
2455
|
if (link.org.type === "team") {
|
|
2496
2456
|
try {
|
|
2497
2457
|
const team = await getTeamById(client, link.org.id);
|
|
2498
2458
|
teamSensitivePolicyOn = team?.sensitiveEnvironmentVariablePolicy === "on";
|
|
2499
|
-
policyOn = shouldEnforceSensitiveEnvVarPolicy(teamSensitivePolicyOn);
|
|
2500
2459
|
} catch {
|
|
2501
2460
|
}
|
|
2502
2461
|
}
|
|
2503
|
-
const selectedIsDevelopment = selectedEnvTargetsDevelopment(selectedEnv);
|
|
2504
|
-
if (policyOn && selectedIsDevelopment && !configSecretUiEnabled) {
|
|
2505
|
-
const msg = `Your team has enabled the Sensitive Environment Variables Policy and the Development Environment does not support sensitive values. https://vercel.com/docs/environment-variables/sensitive-environment-variables#environment-variables-policy`;
|
|
2506
|
-
if (client.nonInteractive) {
|
|
2507
|
-
outputAgentError(
|
|
2508
|
-
client,
|
|
2509
|
-
{
|
|
2510
|
-
status: "error",
|
|
2511
|
-
reason: "development_disallowed_by_team_policy",
|
|
2512
|
-
message: msg
|
|
2513
|
-
},
|
|
2514
|
-
1
|
|
2515
|
-
);
|
|
2516
|
-
}
|
|
2517
|
-
output_manager_default.error(msg);
|
|
2518
|
-
return 1;
|
|
2519
|
-
}
|
|
2520
|
-
if (opts["--sensitive"] && selectedIsDevelopment && !configSecretUiEnabled) {
|
|
2521
|
-
const msg = `--sensitive is not allowed with the Development Environment. Sensitive Environment Variables are only supported on Production and Preview.`;
|
|
2522
|
-
if (client.nonInteractive) {
|
|
2523
|
-
outputAgentError(
|
|
2524
|
-
client,
|
|
2525
|
-
{
|
|
2526
|
-
status: "error",
|
|
2527
|
-
reason: "sensitive_not_allowed_on_development",
|
|
2528
|
-
message: msg
|
|
2529
|
-
},
|
|
2530
|
-
1
|
|
2531
|
-
);
|
|
2532
|
-
}
|
|
2533
|
-
output_manager_default.error(msg);
|
|
2534
|
-
return 1;
|
|
2535
|
-
}
|
|
2536
2462
|
let envValue;
|
|
2537
2463
|
if (stdInput) {
|
|
2538
2464
|
const normalizedStdinValue = normalizeStdinEnvValue(stdInput);
|
|
@@ -2618,7 +2544,6 @@ async function update(client, argv) {
|
|
|
2618
2544
|
);
|
|
2619
2545
|
const allTargets = [...targets, ...selectedEnv.customEnvironmentIds || []];
|
|
2620
2546
|
const { visibility, error: visibilityError } = resolveEnvVarVisibility({
|
|
2621
|
-
configSecretUiEnabled,
|
|
2622
2547
|
explicitVisibility,
|
|
2623
2548
|
type,
|
|
2624
2549
|
key: envName,
|
|
@@ -2683,11 +2608,9 @@ async function update(client, argv) {
|
|
|
2683
2608
|
)}
|
|
2684
2609
|
`
|
|
2685
2610
|
);
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
printAlignedLabel("Visibility", visibilityLabel);
|
|
2690
|
-
}
|
|
2611
|
+
const visibilityLabel = formatVisibilityLabel(visibility, type);
|
|
2612
|
+
if (visibilityLabel) {
|
|
2613
|
+
printAlignedLabel("Visibility", visibilityLabel);
|
|
2691
2614
|
}
|
|
2692
2615
|
return 0;
|
|
2693
2616
|
}
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
addSubcommand8 as addSubcommand,
|
|
12
12
|
getCommandAliases,
|
|
13
13
|
linkCommand
|
|
14
|
-
} from "../../chunks/chunk-
|
|
14
|
+
} from "../../chunks/chunk-HURL5EBN.js";
|
|
15
15
|
import "../../chunks/chunk-2MF3ZAVW.js";
|
|
16
16
|
import "../../chunks/chunk-WC7IINFV.js";
|
|
17
17
|
import "../../chunks/chunk-RIB4S2IB.js";
|
|
@@ -24,7 +24,7 @@ import "../../chunks/chunk-3L2YLLHC.js";
|
|
|
24
24
|
import "../../chunks/chunk-UMA66MKW.js";
|
|
25
25
|
import "../../chunks/chunk-7QVJTI5H.js";
|
|
26
26
|
import "../../chunks/chunk-O5GNPPTU.js";
|
|
27
|
-
import "../../chunks/chunk-
|
|
27
|
+
import "../../chunks/chunk-Y3J4VU2H.js";
|
|
28
28
|
import {
|
|
29
29
|
help
|
|
30
30
|
} from "../../chunks/chunk-XI6NJLI4.js";
|
|
@@ -37,11 +37,11 @@ import {
|
|
|
37
37
|
isPromptCanceledError,
|
|
38
38
|
pull,
|
|
39
39
|
resolveProjectCwd
|
|
40
|
-
} from "../../chunks/chunk-
|
|
40
|
+
} from "../../chunks/chunk-HMJVUXE6.js";
|
|
41
41
|
import {
|
|
42
42
|
TelemetryClient
|
|
43
43
|
} from "../../chunks/chunk-CYNB6LL4.js";
|
|
44
|
-
import "../../chunks/chunk-
|
|
44
|
+
import "../../chunks/chunk-TH2XUVDP.js";
|
|
45
45
|
import "../../chunks/chunk-GGP5R3FU.js";
|
|
46
46
|
import {
|
|
47
47
|
printError
|