vercel 30.2.1 → 30.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +147 -82
- package/package.json +6 -6
package/dist/index.js
CHANGED
@@ -80,7 +80,7 @@ exports.getPackageJSON = getPackageJSON;
|
|
80
80
|
|
81
81
|
/***/ }),
|
82
82
|
|
83
|
-
/***/
|
83
|
+
/***/ 42100:
|
84
84
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
85
85
|
|
86
86
|
"use strict";
|
@@ -174,6 +174,7 @@ function buildToRequest(dependencies) {
|
|
174
174
|
const toReadableStream = buildToReadableStream(dependencies);
|
175
175
|
const { Request } = dependencies;
|
176
176
|
return function toRequest(request, options) {
|
177
|
+
var _a;
|
177
178
|
return new Request(
|
178
179
|
String(
|
179
180
|
new URL(
|
@@ -184,7 +185,7 @@ function buildToRequest(dependencies) {
|
|
184
185
|
{
|
185
186
|
method: request.method,
|
186
187
|
headers: toHeaders(request.headers),
|
187
|
-
body: !["HEAD", "GET"].includes(request.method
|
188
|
+
body: !["HEAD", "GET"].includes((_a = request.method) != null ? _a : "") ? toReadableStream(request) : null
|
188
189
|
}
|
189
190
|
);
|
190
191
|
};
|
@@ -200,13 +201,13 @@ function computeOrigin({ headers }, defaultOrigin) {
|
|
200
201
|
|
201
202
|
// src/edge-to-node/headers.ts
|
202
203
|
function toOutgoingHeaders(headers) {
|
203
|
-
var _a;
|
204
|
+
var _a, _b;
|
204
205
|
const outputHeaders = {};
|
205
206
|
if (headers) {
|
206
207
|
for (const [name, value] of typeof headers.raw !== "undefined" ? Object.entries(headers.raw()) : headers.entries()) {
|
207
208
|
outputHeaders[name] = value;
|
208
209
|
if (name.toLowerCase() === "set-cookie") {
|
209
|
-
outputHeaders[name] = ((_a = headers.getAll) == null ? void 0 : _a.call(headers, "set-cookie"))
|
210
|
+
outputHeaders[name] = (_b = (_a = headers.getAll) == null ? void 0 : _a.call(headers, "set-cookie")) != null ? _b : splitCookiesString(value);
|
210
211
|
}
|
211
212
|
}
|
212
213
|
}
|
@@ -279,6 +280,7 @@ function toToReadable(webStream, options = {}) {
|
|
279
280
|
objectMode,
|
280
281
|
highWaterMark,
|
281
282
|
encoding,
|
283
|
+
// @ts-ignore signal exist only since Node@17
|
282
284
|
signal,
|
283
285
|
read() {
|
284
286
|
reader.read().then(
|
@@ -345,6 +347,7 @@ function toServerResponse(webResponse, serverResponse) {
|
|
345
347
|
return;
|
346
348
|
}
|
347
349
|
mergeIntoServerResponse(
|
350
|
+
// @ts-ignore getAll() is not standard https://fetch.spec.whatwg.org/#headers-class
|
348
351
|
toOutgoingHeaders(webResponse.headers),
|
349
352
|
serverResponse
|
350
353
|
);
|
@@ -222855,15 +222858,20 @@ class LocalFileSystemDetector extends filesystem_1.DetectorFilesystem {
|
|
222855
222858
|
};
|
222856
222859
|
return dir.map(dirent => ({
|
222857
222860
|
name: dirent.name,
|
222858
|
-
path: path_1.default.join(
|
222861
|
+
path: path_1.default.join(this.getRelativeFilePath(name), dirent.name),
|
222859
222862
|
type: getType(dirent),
|
222860
222863
|
}));
|
222861
222864
|
}
|
222862
222865
|
_chdir(name) {
|
222863
222866
|
return new LocalFileSystemDetector(this.getFilePath(name));
|
222864
222867
|
}
|
222868
|
+
getRelativeFilePath(name) {
|
222869
|
+
return name.startsWith(this.rootPath)
|
222870
|
+
? path_1.default.relative(this.rootPath, name)
|
222871
|
+
: name;
|
222872
|
+
}
|
222865
222873
|
getFilePath(name) {
|
222866
|
-
return path_1.default.join(this.rootPath, name);
|
222874
|
+
return path_1.default.join(this.rootPath, this.getRelativeFilePath(name));
|
222867
222875
|
}
|
222868
222876
|
}
|
222869
222877
|
exports.LocalFileSystemDetector = LocalFileSystemDetector;
|
@@ -225731,10 +225739,12 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
225731
225739
|
const fs_extra_1 = __importDefault(__webpack_require__(36365));
|
225732
225740
|
const chalk_1 = __importDefault(__webpack_require__(90877));
|
225733
225741
|
const dotenv_1 = __importDefault(__webpack_require__(9116));
|
225742
|
+
const semver_1 = __importDefault(__webpack_require__(54373));
|
225743
|
+
const minimatch_1 = __importDefault(__webpack_require__(47345));
|
225734
225744
|
const path_1 = __webpack_require__(85622);
|
225745
|
+
const frameworks_1 = __importDefault(__webpack_require__(36678));
|
225735
225746
|
const build_utils_1 = __webpack_require__(63445);
|
225736
225747
|
const fs_detectors_1 = __webpack_require__(88995);
|
225737
|
-
const minimatch_1 = __importDefault(__webpack_require__(47345));
|
225738
225748
|
const routing_utils_1 = __webpack_require__(679);
|
225739
225749
|
const client_1 = __webpack_require__(40521);
|
225740
225750
|
const pull_1 = __importDefault(__webpack_require__(65158));
|
@@ -225757,9 +225767,6 @@ const sort_builders_1 = __webpack_require__(84701);
|
|
225757
225767
|
const error_1 = __webpack_require__(4400);
|
225758
225768
|
const validate_config_1 = __webpack_require__(21144);
|
225759
225769
|
const monorepo_1 = __webpack_require__(21481);
|
225760
|
-
const frameworks_1 = __importDefault(__webpack_require__(36678));
|
225761
|
-
const fs_detectors_2 = __webpack_require__(88995);
|
225762
|
-
const semver_1 = __importDefault(__webpack_require__(54373));
|
225763
225770
|
const help = () => {
|
225764
225771
|
return console.log(`
|
225765
225772
|
${chalk_1.default.bold(`${cli.logo} ${cli.name} build`)}
|
@@ -225785,7 +225792,8 @@ const help = () => {
|
|
225785
225792
|
`);
|
225786
225793
|
};
|
225787
225794
|
async function main(client) {
|
225788
|
-
|
225795
|
+
let { cwd } = client;
|
225796
|
+
const { output } = client;
|
225789
225797
|
// Ensure that `vc build` is not being invoked recursively
|
225790
225798
|
if (process.env.__VERCEL_BUILD_RUNNING) {
|
225791
225799
|
output.error(`${(0, cmd_1.default)(`${cli.name} build`)} must not recursively invoke itself. Check the Build Command in the Project Settings or the ${(0, cmd_1.default)('build')} script in ${(0, cmd_1.default)('package.json')}`);
|
@@ -225816,9 +225824,16 @@ async function main(client) {
|
|
225816
225824
|
output.prettyError(err);
|
225817
225825
|
return 1;
|
225818
225826
|
}
|
225827
|
+
// If repo linked, update `cwd` to the repo root
|
225828
|
+
const link = await (0, link_1.getProjectLink)(client, cwd);
|
225829
|
+
const projectRootDirectory = link?.projectRootDirectory ?? '';
|
225830
|
+
if (link?.repoRoot) {
|
225831
|
+
cwd = client.cwd = link.repoRoot;
|
225832
|
+
}
|
225819
225833
|
// TODO: read project settings from the API, fall back to local `project.json` if that fails
|
225820
225834
|
// Read project settings, and pull them from Vercel if necessary
|
225821
|
-
|
225835
|
+
const vercelDir = (0, path_1.join)(cwd, projectRootDirectory, link_1.VERCEL_DIR);
|
225836
|
+
let project = await (0, project_settings_1.readProjectSettings)(vercelDir);
|
225822
225837
|
const isTTY = process.stdin.isTTY;
|
225823
225838
|
while (!project?.settings) {
|
225824
225839
|
let confirmed = yes;
|
@@ -225834,6 +225849,7 @@ async function main(client) {
|
|
225834
225849
|
return 0;
|
225835
225850
|
}
|
225836
225851
|
const { argv: originalArgv } = client;
|
225852
|
+
client.cwd = (0, path_1.join)(cwd, projectRootDirectory);
|
225837
225853
|
client.argv = [
|
225838
225854
|
...originalArgv.slice(0, 2),
|
225839
225855
|
'pull',
|
@@ -225844,11 +225860,12 @@ async function main(client) {
|
|
225844
225860
|
if (result !== 0) {
|
225845
225861
|
return result;
|
225846
225862
|
}
|
225863
|
+
client.cwd = cwd;
|
225847
225864
|
client.argv = originalArgv;
|
225848
|
-
project = await (0, project_settings_1.readProjectSettings)(
|
225865
|
+
project = await (0, project_settings_1.readProjectSettings)(vercelDir);
|
225849
225866
|
}
|
225850
225867
|
// Delete output directory from potential previous build
|
225851
|
-
const defaultOutputDir = (0, path_1.join)(cwd, write_build_result_1.OUTPUT_DIR);
|
225868
|
+
const defaultOutputDir = (0, path_1.join)(cwd, projectRootDirectory, write_build_result_1.OUTPUT_DIR);
|
225852
225869
|
const outputDir = argv['--output']
|
225853
225870
|
? (0, path_1.resolve)(argv['--output'])
|
225854
225871
|
: defaultOutputDir;
|
@@ -225864,7 +225881,7 @@ async function main(client) {
|
|
225864
225881
|
};
|
225865
225882
|
const envToUnset = new Set(['VERCEL', 'NOW_BUILDER']);
|
225866
225883
|
try {
|
225867
|
-
const envPath = (0, path_1.join)(cwd, link_1.VERCEL_DIR, `.env.${target}.local`);
|
225884
|
+
const envPath = (0, path_1.join)(cwd, projectRootDirectory, link_1.VERCEL_DIR, `.env.${target}.local`);
|
225868
225885
|
// TODO (maybe?): load env vars from the API, fall back to the local file if that fails
|
225869
225886
|
const dotenvResult = dotenv_1.default.config({
|
225870
225887
|
path: envPath,
|
@@ -226226,7 +226243,7 @@ async function getFramework(cwd, buildResults) {
|
|
226226
226243
|
}
|
226227
226244
|
}
|
226228
226245
|
// determine framework version with runtime lookup
|
226229
|
-
const frameworkVersion = (0,
|
226246
|
+
const frameworkVersion = (0, fs_detectors_1.detectFrameworkVersion)(detectedFramework);
|
226230
226247
|
if (frameworkVersion) {
|
226231
226248
|
return {
|
226232
226249
|
version: frameworkVersion,
|
@@ -227067,36 +227084,6 @@ exports.default = async (client) => {
|
|
227067
227084
|
if (typeof target === 'number') {
|
227068
227085
|
return target;
|
227069
227086
|
}
|
227070
|
-
// build `--prebuilt`
|
227071
|
-
if (argv['--prebuilt']) {
|
227072
|
-
const prebuiltExists = await fs_extra_1.default.pathExists((0, path_1.join)(cwd, '.vercel/output'));
|
227073
|
-
if (!prebuiltExists) {
|
227074
|
-
error(`The ${(0, param_1.default)('--prebuilt')} option was used, but no prebuilt output found in ".vercel/output". Run ${(0, pkg_name_1.getCommandName)('build')} to generate a local build.`);
|
227075
|
-
return 1;
|
227076
|
-
}
|
227077
|
-
const prebuiltBuild = await (0, get_prebuilt_json_1.default)(cwd);
|
227078
|
-
// Ensure that there was not a build error
|
227079
|
-
const prebuiltError = prebuiltBuild?.error ||
|
227080
|
-
prebuiltBuild?.builds?.find(build => 'error' in build)?.error;
|
227081
|
-
if (prebuiltError) {
|
227082
|
-
output.log(`Prebuilt deployment cannot be created because ${(0, pkg_name_1.getCommandName)('build')} failed with error:\n`);
|
227083
|
-
prettyError(prebuiltError);
|
227084
|
-
return 1;
|
227085
|
-
}
|
227086
|
-
// Ensure that the deploy target matches the build target
|
227087
|
-
const assumedTarget = target || 'preview';
|
227088
|
-
if (prebuiltBuild?.target && prebuiltBuild.target !== assumedTarget) {
|
227089
|
-
let specifyTarget = '';
|
227090
|
-
if (prebuiltBuild.target === 'production') {
|
227091
|
-
specifyTarget = ` --prod`;
|
227092
|
-
}
|
227093
|
-
prettyError({
|
227094
|
-
message: `The ${(0, param_1.default)('--prebuilt')} option was used with the target environment "${assumedTarget}", but the prebuilt output found in ".vercel/output" was built with target environment "${prebuiltBuild.target}". Please run ${(0, pkg_name_1.getCommandName)(`--prebuilt${specifyTarget}`)}.`,
|
227095
|
-
link: 'https://vercel.link/prebuilt-environment-mismatch',
|
227096
|
-
});
|
227097
|
-
return 1;
|
227098
|
-
}
|
227099
|
-
}
|
227100
227087
|
const archive = argv['--archive'];
|
227101
227088
|
if (typeof archive === 'string' && !(0, validate_archive_format_1.isValidArchive)(archive)) {
|
227102
227089
|
output.error(`Format must be one of: ${client_1.VALID_ARCHIVE_FORMATS.join(', ')}`);
|
@@ -227164,6 +227151,43 @@ exports.default = async (client) => {
|
|
227164
227151
|
if (!org) {
|
227165
227152
|
throw new Error(`"org" is not defined`);
|
227166
227153
|
}
|
227154
|
+
// build `--prebuilt`
|
227155
|
+
if (argv['--prebuilt']) {
|
227156
|
+
// For repo-style linking, update `cwd` to be the Project
|
227157
|
+
// subdirectory when `rootDirectory` setting is defined
|
227158
|
+
if (link.status === 'linked' &&
|
227159
|
+
link.repoRoot &&
|
227160
|
+
link.project.rootDirectory) {
|
227161
|
+
cwd = (0, path_1.join)(cwd, link.project.rootDirectory);
|
227162
|
+
}
|
227163
|
+
const prebuiltExists = await fs_extra_1.default.pathExists((0, path_1.join)(cwd, '.vercel/output'));
|
227164
|
+
if (!prebuiltExists) {
|
227165
|
+
error(`The ${(0, param_1.default)('--prebuilt')} option was used, but no prebuilt output found in ".vercel/output". Run ${(0, pkg_name_1.getCommandName)('build')} to generate a local build.`);
|
227166
|
+
return 1;
|
227167
|
+
}
|
227168
|
+
const prebuiltBuild = await (0, get_prebuilt_json_1.default)(cwd);
|
227169
|
+
// Ensure that there was not a build error
|
227170
|
+
const prebuiltError = prebuiltBuild?.error ||
|
227171
|
+
prebuiltBuild?.builds?.find(build => 'error' in build)?.error;
|
227172
|
+
if (prebuiltError) {
|
227173
|
+
output.log(`Prebuilt deployment cannot be created because ${(0, pkg_name_1.getCommandName)('build')} failed with error:\n`);
|
227174
|
+
prettyError(prebuiltError);
|
227175
|
+
return 1;
|
227176
|
+
}
|
227177
|
+
// Ensure that the deploy target matches the build target
|
227178
|
+
const assumedTarget = target || 'preview';
|
227179
|
+
if (prebuiltBuild?.target && prebuiltBuild.target !== assumedTarget) {
|
227180
|
+
let specifyTarget = '';
|
227181
|
+
if (prebuiltBuild.target === 'production') {
|
227182
|
+
specifyTarget = ` --prod`;
|
227183
|
+
}
|
227184
|
+
prettyError({
|
227185
|
+
message: `The ${(0, param_1.default)('--prebuilt')} option was used with the target environment "${assumedTarget}", but the prebuilt output found in ".vercel/output" was built with target environment "${prebuiltBuild.target}". Please run ${(0, pkg_name_1.getCommandName)(`--prebuilt${specifyTarget}`)}.`,
|
227186
|
+
link: 'https://vercel.link/prebuilt-environment-mismatch',
|
227187
|
+
});
|
227188
|
+
return 1;
|
227189
|
+
}
|
227190
|
+
}
|
227167
227191
|
// Set the `contextName` and `currentTeam` as specified by the
|
227168
227192
|
// Project Settings, so that API calls happen with the proper scope
|
227169
227193
|
const contextName = org.slug;
|
@@ -227251,7 +227275,8 @@ exports.default = async (client) => {
|
|
227251
227275
|
throw new Error('`name` not found on project or provided by existing project');
|
227252
227276
|
}
|
227253
227277
|
try {
|
227254
|
-
|
227278
|
+
// if this flag is not set, use `undefined` to allow the project setting to be used
|
227279
|
+
const autoAssignCustomDomains = argv['--skip-domain'] ? false : undefined;
|
227255
227280
|
const createArgs = {
|
227256
227281
|
name,
|
227257
227282
|
env: deploymentEnv,
|
@@ -227509,7 +227534,11 @@ async function dev(client, opts, args) {
|
|
227509
227534
|
let projectSettings;
|
227510
227535
|
let envValues = {};
|
227511
227536
|
if (link.status === 'linked') {
|
227512
|
-
const { project, org } = link;
|
227537
|
+
const { project, org, repoRoot } = link;
|
227538
|
+
// If repo linked, update `cwd` to the repo root
|
227539
|
+
if (repoRoot) {
|
227540
|
+
cwd = repoRoot;
|
227541
|
+
}
|
227513
227542
|
client.config.currentTeam = org.type === 'team' ? org.id : undefined;
|
227514
227543
|
projectSettings = project;
|
227515
227544
|
if (project.rootDirectory) {
|
@@ -229359,7 +229388,7 @@ async function main(client) {
|
|
229359
229388
|
case 'rm':
|
229360
229389
|
return (0, rm_1.default)(client, project, argv, args, output);
|
229361
229390
|
case 'pull':
|
229362
|
-
return (0, pull_1.default)(client, project, target, argv, args, output, cwd, 'vercel-cli:env:pull');
|
229391
|
+
return (0, pull_1.default)(client, link, project, target, argv, args, output, cwd, 'vercel-cli:env:pull');
|
229363
229392
|
default:
|
229364
229393
|
output.error((0, get_invalid_subcommand_1.default)(COMMAND_CONFIG));
|
229365
229394
|
help();
|
@@ -229474,6 +229503,7 @@ const pkg_name_1 = __webpack_require__(79000);
|
|
229474
229503
|
const get_env_records_1 = __webpack_require__(72913);
|
229475
229504
|
const diff_env_files_1 = __webpack_require__(65117);
|
229476
229505
|
const error_utils_1 = __webpack_require__(39799);
|
229506
|
+
const add_to_gitignore_1 = __webpack_require__(19159);
|
229477
229507
|
const CONTENTS_PREFIX = '# Created by Vercel CLI\n';
|
229478
229508
|
function readHeadSync(path, length) {
|
229479
229509
|
const buffer = Buffer.alloc(length);
|
@@ -229496,7 +229526,7 @@ function tryReadHeadSync(path, length) {
|
|
229496
229526
|
}
|
229497
229527
|
}
|
229498
229528
|
}
|
229499
|
-
async function pull(client, project, environment, opts, args, output, cwd, source) {
|
229529
|
+
async function pull(client, link, project, environment, opts, args, output, cwd, source) {
|
229500
229530
|
if (args.length > 1) {
|
229501
229531
|
output.error(`Invalid number of arguments. Usage: ${(0, pkg_name_1.getCommandName)(`env pull <file>`)}`);
|
229502
229532
|
return 1;
|
@@ -229550,7 +229580,17 @@ async function pull(client, project, environment, opts, args, output, cwd, sourc
|
|
229550
229580
|
else if (oldEnv && exists) {
|
229551
229581
|
output.log('No changes found.');
|
229552
229582
|
}
|
229553
|
-
|
229583
|
+
let isGitIgnoreUpdated = false;
|
229584
|
+
if (filename === '.env.local') {
|
229585
|
+
// When the file is `.env.local`, we also add it to `.gitignore`
|
229586
|
+
// to avoid accidentally committing it to git.
|
229587
|
+
// We use '.env*.local' to match the default .gitignore from
|
229588
|
+
// create-next-app template. See:
|
229589
|
+
// https://github.com/vercel/next.js/blob/06abd634899095b6cc28e6e8315b1e8b9c8df939/packages/create-next-app/templates/app/js/gitignore#L28
|
229590
|
+
const rootPath = link.repoRoot ?? cwd;
|
229591
|
+
isGitIgnoreUpdated = await (0, add_to_gitignore_1.addToGitIgnore)(rootPath, '.env*.local');
|
229592
|
+
}
|
229593
|
+
output.print(`${(0, emoji_1.prependEmoji)(`${exists ? 'Updated' : 'Created'} ${chalk_1.default.bold(filename)} file ${isGitIgnoreUpdated ? 'and added it to .gitignore' : ''} ${chalk_1.default.gray(pullStamp())}`, (0, emoji_1.emoji)('success'))}\n`);
|
229554
229594
|
return 0;
|
229555
229595
|
}
|
229556
229596
|
exports.default = pull;
|
@@ -232090,6 +232130,7 @@ const project_settings_1 = __webpack_require__(61440);
|
|
232090
232130
|
const pull_1 = __importDefault(__webpack_require__(80800));
|
232091
232131
|
const env_target_1 = __webpack_require__(20229);
|
232092
232132
|
const ensure_link_1 = __webpack_require__(65382);
|
232133
|
+
const humanize_path_1 = __importDefault(__webpack_require__(33234));
|
232093
232134
|
const help = () => {
|
232094
232135
|
return console.log(`
|
232095
232136
|
${chalk_1.default.bold(`${logo_1.default} ${(0, pkg_name_1.getPkgName)()} pull`)} [project-path]
|
@@ -232137,9 +232178,9 @@ function parseArgs(client) {
|
|
232137
232178
|
}
|
232138
232179
|
return argv;
|
232139
232180
|
}
|
232140
|
-
async function pullAllEnvFiles(environment, client, project, argv, cwd) {
|
232181
|
+
async function pullAllEnvFiles(environment, client, link, project, argv, cwd) {
|
232141
232182
|
const environmentFile = `.env.${environment}.local`;
|
232142
|
-
return (0, pull_1.default)(client, project, environment, argv, [(0, path_1.join)('.vercel', environmentFile)], client.output, cwd, 'vercel-cli:pull');
|
232183
|
+
return (0, pull_1.default)(client, link, project, environment, argv, [(0, path_1.join)('.vercel', environmentFile)], client.output, cwd, 'vercel-cli:pull');
|
232143
232184
|
}
|
232144
232185
|
function parseEnvironment(environment = 'development') {
|
232145
232186
|
if (!(0, env_target_1.isValidEnvTarget)(environment)) {
|
@@ -232153,24 +232194,28 @@ async function main(client) {
|
|
232153
232194
|
if (typeof argv === 'number') {
|
232154
232195
|
return argv;
|
232155
232196
|
}
|
232156
|
-
|
232197
|
+
let cwd = argv._[1] || client.cwd;
|
232157
232198
|
const autoConfirm = Boolean(argv['--yes']);
|
232158
232199
|
const environment = parseEnvironment(argv['--environment'] || undefined);
|
232159
232200
|
const link = await (0, ensure_link_1.ensureLink)('pull', client, cwd, { autoConfirm });
|
232160
232201
|
if (typeof link === 'number') {
|
232161
232202
|
return link;
|
232162
232203
|
}
|
232163
|
-
const { project, org } = link;
|
232204
|
+
const { project, org, repoRoot } = link;
|
232205
|
+
if (repoRoot) {
|
232206
|
+
cwd = (0, path_1.join)(repoRoot, project.rootDirectory || '');
|
232207
|
+
}
|
232164
232208
|
client.config.currentTeam = org.type === 'team' ? org.id : undefined;
|
232165
|
-
const pullResultCode = await pullAllEnvFiles(environment, client, project, argv, cwd);
|
232209
|
+
const pullResultCode = await pullAllEnvFiles(environment, client, link, project, argv, cwd);
|
232166
232210
|
if (pullResultCode !== 0) {
|
232167
232211
|
return pullResultCode;
|
232168
232212
|
}
|
232169
232213
|
client.output.print('\n');
|
232170
232214
|
client.output.log('Downloading project settings');
|
232171
|
-
|
232215
|
+
const isRepoLinked = typeof repoRoot === 'string';
|
232216
|
+
await (0, project_settings_1.writeProjectSettings)(cwd, project, org, isRepoLinked);
|
232172
232217
|
const settingsStamp = (0, stamp_1.default)();
|
232173
|
-
client.output.print(`${(0, emoji_1.prependEmoji)(`Downloaded project settings to ${chalk_1.default.bold((0, path_1.join)(link_1.VERCEL_DIR, link_1.VERCEL_DIR_PROJECT))} ${chalk_1.default.gray(settingsStamp())}`, (0, emoji_1.emoji)('success'))}\n`);
|
232218
|
+
client.output.print(`${(0, emoji_1.prependEmoji)(`Downloaded project settings to ${chalk_1.default.bold((0, humanize_path_1.default)((0, path_1.join)(cwd, link_1.VERCEL_DIR, link_1.VERCEL_DIR_PROJECT)))} ${chalk_1.default.gray(settingsStamp())}`, (0, emoji_1.emoji)('success'))}\n`);
|
232174
232219
|
return 0;
|
232175
232220
|
}
|
232176
232221
|
exports.default = main;
|
@@ -243306,7 +243351,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
243306
243351
|
exports.createProxy = void 0;
|
243307
243352
|
const http_1 = __webpack_require__(98605);
|
243308
243353
|
const node_fetch_1 = __webpack_require__(91596);
|
243309
|
-
const node_utils_1 = __webpack_require__(
|
243354
|
+
const node_utils_1 = __webpack_require__(42100);
|
243310
243355
|
const toHeaders = (0, node_utils_1.buildToHeaders)({ Headers: node_fetch_1.Headers });
|
243311
243356
|
function createProxy(client) {
|
243312
243357
|
return (0, http_1.createServer)(async (req, res) => {
|
@@ -246010,10 +246055,10 @@ const link_1 = __webpack_require__(49347);
|
|
246010
246055
|
* directory
|
246011
246056
|
* @param opts.projectName - The project name to use when linking, otherwise
|
246012
246057
|
* the current directory
|
246013
|
-
* @returns {Promise<
|
246058
|
+
* @returns {Promise<ProjectLinked|number>} Returns a numeric exit code when aborted or
|
246014
246059
|
* error, otherwise an object containing the org an project
|
246015
246060
|
*/
|
246016
|
-
async function ensureLink(commandName, client, cwd, opts) {
|
246061
|
+
async function ensureLink(commandName, client, cwd, opts = {}) {
|
246017
246062
|
let { link } = opts;
|
246018
246063
|
if (!link) {
|
246019
246064
|
link = await (0, link_1.getLinkedProject)(client, cwd);
|
@@ -246033,7 +246078,7 @@ async function ensureLink(commandName, client, cwd, opts) {
|
|
246033
246078
|
}
|
246034
246079
|
return link.exitCode;
|
246035
246080
|
}
|
246036
|
-
return
|
246081
|
+
return link;
|
246037
246082
|
}
|
246038
246083
|
exports.ensureLink = ensureLink;
|
246039
246084
|
|
@@ -246049,7 +246094,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
246049
246094
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
246050
246095
|
};
|
246051
246096
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
246052
|
-
exports.
|
246097
|
+
exports.findProjectsFromPath = exports.traverseUpDirectories = exports.findRepoRoot = exports.ensureRepoLink = exports.getRepoLink = void 0;
|
246053
246098
|
const chalk_1 = __importDefault(__webpack_require__(90877));
|
246054
246099
|
const pluralize_1 = __importDefault(__webpack_require__(43669));
|
246055
246100
|
const os_1 = __webpack_require__(12087);
|
@@ -246173,7 +246218,7 @@ async function ensureRepoLink(client, cwd, yes = false) {
|
|
246173
246218
|
}),
|
246174
246219
|
};
|
246175
246220
|
await (0, fs_extra_1.outputJSON)(repoConfigPath, repoConfig, { spaces: 2 });
|
246176
|
-
await (0,
|
246221
|
+
await (0, link_1.writeReadme)(rootPath);
|
246177
246222
|
// update .gitignore
|
246178
246223
|
const isGitIgnoreUpdated = await (0, add_to_gitignore_1.addToGitIgnore)(rootPath);
|
246179
246224
|
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');
|
@@ -246243,7 +246288,7 @@ function sortByDirectory(a, b) {
|
|
246243
246288
|
*/
|
246244
246289
|
function findProjectsFromPath(projects, path) {
|
246245
246290
|
const normalizedPath = (0, build_utils_1.normalizePath)(path);
|
246246
|
-
|
246291
|
+
const matches = projects
|
246247
246292
|
.slice()
|
246248
246293
|
.sort(sortByDirectory)
|
246249
246294
|
.filter(project => {
|
@@ -246254,15 +246299,13 @@ function findProjectsFromPath(projects, path) {
|
|
246254
246299
|
return (normalizedPath === project.directory ||
|
246255
246300
|
normalizedPath.startsWith(`${project.directory}/`));
|
246256
246301
|
});
|
246302
|
+
// If there are multiple matches, we only want the most relevant
|
246303
|
+
// selections (with the deepest directory depth), so pick the first
|
246304
|
+
// one and filter on those matches.
|
246305
|
+
const firstMatch = matches[0];
|
246306
|
+
return matches.filter(match => match.directory === firstMatch.directory);
|
246257
246307
|
}
|
246258
246308
|
exports.findProjectsFromPath = findProjectsFromPath;
|
246259
|
-
/**
|
246260
|
-
* TODO: remove
|
246261
|
-
*/
|
246262
|
-
function findProjectFromPath(projects, path) {
|
246263
|
-
return findProjectsFromPath(projects, path)[0];
|
246264
|
-
}
|
246265
|
-
exports.findProjectFromPath = findProjectFromPath;
|
246266
246309
|
|
246267
246310
|
|
246268
246311
|
/***/ }),
|
@@ -248429,7 +248472,7 @@ async function getProjectByDeployment({ client, deployId, output, }) {
|
|
248429
248472
|
throw err;
|
248430
248473
|
}
|
248431
248474
|
}
|
248432
|
-
if (team) {
|
248475
|
+
else if (team) {
|
248433
248476
|
const err = new Error(`Deployment doesn't belong to current team ${chalk_1.default.bold(contextName)}`);
|
248434
248477
|
err.code = 'ERR_INVALID_TEAM';
|
248435
248478
|
throw err;
|
@@ -248490,7 +248533,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
248490
248533
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
248491
248534
|
};
|
248492
248535
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
248493
|
-
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;
|
248536
|
+
exports.linkFolderToProject = exports.writeReadme = exports.getLinkedProject = exports.getLinkFromDir = exports.getProjectLink = exports.getVercelDirectory = exports.VERCEL_DIR_REPO = exports.VERCEL_DIR_PROJECT = exports.VERCEL_DIR_README = exports.VERCEL_DIR_FALLBACK = exports.VERCEL_DIR = void 0;
|
248494
248537
|
const fs_1 = __importDefault(__webpack_require__(35747));
|
248495
248538
|
const ajv_1 = __importDefault(__webpack_require__(35669));
|
248496
248539
|
const chalk_1 = __importDefault(__webpack_require__(90877));
|
@@ -248552,6 +248595,7 @@ async function getProjectLink(client, path) {
|
|
248552
248595
|
return ((await getProjectLinkFromRepoLink(client, path)) ||
|
248553
248596
|
(await getLinkFromDir(getVercelDirectory(path))));
|
248554
248597
|
}
|
248598
|
+
exports.getProjectLink = getProjectLink;
|
248555
248599
|
async function getProjectLinkFromRepoLink(client, path) {
|
248556
248600
|
const repoLink = await (0, repo_1.getRepoLink)(path);
|
248557
248601
|
if (!repoLink?.repoConfig) {
|
@@ -248576,9 +248620,10 @@ async function getProjectLinkFromRepoLink(client, path) {
|
|
248576
248620
|
}
|
248577
248621
|
if (project) {
|
248578
248622
|
return {
|
248623
|
+
repoRoot: repoLink.rootPath,
|
248579
248624
|
orgId: repoLink.repoConfig.orgId,
|
248580
248625
|
projectId: project.id,
|
248581
|
-
|
248626
|
+
projectRootDirectory: project.directory,
|
248582
248627
|
};
|
248583
248628
|
}
|
248584
248629
|
return null;
|
@@ -248701,6 +248746,10 @@ async function getLinkedProject(client, path = client.cwd) {
|
|
248701
248746
|
return { status: 'linked', org, project, repoRoot: link.repoRoot };
|
248702
248747
|
}
|
248703
248748
|
exports.getLinkedProject = getLinkedProject;
|
248749
|
+
async function writeReadme(path) {
|
248750
|
+
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'));
|
248751
|
+
}
|
248752
|
+
exports.writeReadme = writeReadme;
|
248704
248753
|
async function linkFolderToProject(client, path, projectLink, projectName, orgSlug, successEmoji = 'link') {
|
248705
248754
|
// if the project is already linked, we skip linking
|
248706
248755
|
if (await hasProjectLink(projectLink, path)) {
|
@@ -248718,7 +248767,7 @@ async function linkFolderToProject(client, path, projectLink, projectName, orgSl
|
|
248718
248767
|
throw err;
|
248719
248768
|
}
|
248720
248769
|
await writeFile((0, path_1.join)(path, exports.VERCEL_DIR, exports.VERCEL_DIR_PROJECT), JSON.stringify(projectLink));
|
248721
|
-
await
|
248770
|
+
await writeReadme(path);
|
248722
248771
|
// update .gitignore
|
248723
248772
|
const isGitIgnoreUpdated = await (0, add_to_gitignore_1.addToGitIgnore)(path);
|
248724
248773
|
client.output.print((0, emoji_1.prependEmoji)(`Linked to ${chalk_1.default.bold(`${orgSlug}/${projectName}`)} (created ${exports.VERCEL_DIR}${isGitIgnoreUpdated ? ' and added it to .gitignore' : ''})`, (0, emoji_1.emoji)(successEmoji)) + '\n');
|
@@ -248735,13 +248784,14 @@ exports.linkFolderToProject = linkFolderToProject;
|
|
248735
248784
|
|
248736
248785
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
248737
248786
|
exports.pickOverrides = exports.readProjectSettings = exports.writeProjectSettings = void 0;
|
248787
|
+
const path_1 = __webpack_require__(85622);
|
248738
248788
|
const fs_extra_1 = __webpack_require__(36365);
|
248739
248789
|
const link_1 = __webpack_require__(49347);
|
248740
|
-
const
|
248790
|
+
const error_utils_1 = __webpack_require__(39799);
|
248741
248791
|
// writeProjectSettings writes the project configuration to `vercel/project.json`
|
248742
248792
|
// Write the project configuration to `.vercel/project.json`
|
248743
248793
|
// that is needed for `vercel build` and `vercel dev` commands
|
248744
|
-
async function writeProjectSettings(cwd, project, org) {
|
248794
|
+
async function writeProjectSettings(cwd, project, org, isRepoLinked) {
|
248745
248795
|
let analyticsId;
|
248746
248796
|
if (project.analytics?.id &&
|
248747
248797
|
(!project.analytics.disabledAt ||
|
@@ -248750,8 +248800,8 @@ async function writeProjectSettings(cwd, project, org) {
|
|
248750
248800
|
analyticsId = project.analytics.id;
|
248751
248801
|
}
|
248752
248802
|
const projectLinkAndSettings = {
|
248753
|
-
projectId: project.id,
|
248754
|
-
orgId: org.id,
|
248803
|
+
projectId: isRepoLinked ? undefined : project.id,
|
248804
|
+
orgId: isRepoLinked ? undefined : org.id,
|
248755
248805
|
settings: {
|
248756
248806
|
createdAt: project.createdAt,
|
248757
248807
|
framework: project.framework,
|
@@ -248771,8 +248821,23 @@ async function writeProjectSettings(cwd, project, org) {
|
|
248771
248821
|
});
|
248772
248822
|
}
|
248773
248823
|
exports.writeProjectSettings = writeProjectSettings;
|
248774
|
-
async function readProjectSettings(
|
248775
|
-
|
248824
|
+
async function readProjectSettings(vercelDir) {
|
248825
|
+
try {
|
248826
|
+
return JSON.parse(await (0, fs_extra_1.readFile)((0, path_1.join)(vercelDir, link_1.VERCEL_DIR_PROJECT), 'utf8'));
|
248827
|
+
}
|
248828
|
+
catch (err) {
|
248829
|
+
// `project.json` file does not exists, so project settings have not been pulled
|
248830
|
+
if ((0, error_utils_1.isErrnoException)(err) &&
|
248831
|
+
err.code &&
|
248832
|
+
['ENOENT', 'ENOTDIR'].includes(err.code)) {
|
248833
|
+
return null;
|
248834
|
+
}
|
248835
|
+
// failed to parse JSON, treat the same as if project settings have not been pulled
|
248836
|
+
if ((0, error_utils_1.isError)(err) && err.name === 'SyntaxError') {
|
248837
|
+
return null;
|
248838
|
+
}
|
248839
|
+
throw err;
|
248840
|
+
}
|
248776
248841
|
}
|
248777
248842
|
exports.readProjectSettings = readProjectSettings;
|
248778
248843
|
function pickOverrides(vercelConfig) {
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "vercel",
|
3
|
-
"version": "30.2.
|
3
|
+
"version": "30.2.3",
|
4
4
|
"preferGlobal": true,
|
5
5
|
"license": "Apache-2.0",
|
6
6
|
"description": "The command-line interface for Vercel",
|
@@ -26,16 +26,16 @@
|
|
26
26
|
"@vercel/go": "2.5.1",
|
27
27
|
"@vercel/hydrogen": "0.0.64",
|
28
28
|
"@vercel/next": "3.8.6",
|
29
|
-
"@vercel/node": "2.15.
|
29
|
+
"@vercel/node": "2.15.2",
|
30
30
|
"@vercel/python": "3.1.60",
|
31
31
|
"@vercel/redwood": "1.1.15",
|
32
|
-
"@vercel/remix-builder": "1.8.
|
32
|
+
"@vercel/remix-builder": "1.8.14",
|
33
33
|
"@vercel/ruby": "1.3.76",
|
34
|
-
"@vercel/static-build": "1.3.
|
34
|
+
"@vercel/static-build": "1.3.37"
|
35
35
|
},
|
36
36
|
"devDependencies": {
|
37
37
|
"@alex_neo/jest-expect-message": "1.0.5",
|
38
|
-
"@edge-runtime/node-utils": "2.0
|
38
|
+
"@edge-runtime/node-utils": "2.1.0",
|
39
39
|
"@next/env": "11.1.2",
|
40
40
|
"@sentry/node": "5.5.0",
|
41
41
|
"@sindresorhus/slugify": "0.11.0",
|
@@ -81,7 +81,7 @@
|
|
81
81
|
"@vercel/client": "12.6.2",
|
82
82
|
"@vercel/error-utils": "1.0.10",
|
83
83
|
"@vercel/frameworks": "1.4.2",
|
84
|
-
"@vercel/fs-detectors": "
|
84
|
+
"@vercel/fs-detectors": "4.0.0",
|
85
85
|
"@vercel/fun": "1.0.4",
|
86
86
|
"@vercel/ncc": "0.24.0",
|
87
87
|
"@vercel/routing-utils": "2.2.1",
|