mirror of
https://github.com/LukeHagar/vercel.git
synced 2025-12-24 19:00:03 +00:00
Compare commits
5 Commits
@vercel/ru
...
update/cli
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0e9ab97a08 | ||
|
|
db0c480418 | ||
|
|
04aa077094 | ||
|
|
2288ec7268 | ||
|
|
b434b23bbc |
@@ -23,14 +23,14 @@
|
||||
"eslint-config-prettier": "8.5.0",
|
||||
"eslint-plugin-jest": "26.1.5",
|
||||
"husky": "7.0.4",
|
||||
"jest": "28.0.2",
|
||||
"jest": "28.1.3",
|
||||
"json5": "2.1.1",
|
||||
"lint-staged": "9.2.5",
|
||||
"node-fetch": "2.6.7",
|
||||
"npm-package-arg": "6.1.0",
|
||||
"prettier": "2.6.2",
|
||||
"ts-eager": "2.0.2",
|
||||
"ts-jest": "28.0.5",
|
||||
"ts-jest": "28.0.7",
|
||||
"turbo": "1.3.2-canary.1"
|
||||
},
|
||||
"scripts": {
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
"@types/node-fetch": "^2.1.6",
|
||||
"@types/semver": "6.0.0",
|
||||
"@types/yazl": "2.4.2",
|
||||
"@vercel/ncc": "0.24.0",
|
||||
"@vercel/ncc": "0.34.0",
|
||||
"aggregate-error": "3.0.1",
|
||||
"async-retry": "1.2.3",
|
||||
"async-sema": "2.1.4",
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
"version": "27.2.0",
|
||||
"preferGlobal": true,
|
||||
"license": "Apache-2.0",
|
||||
"type": "module",
|
||||
"description": "The command-line interface for Vercel",
|
||||
"homepage": "https://vercel.com",
|
||||
"repository": {
|
||||
@@ -11,7 +12,7 @@
|
||||
"directory": "packages/cli"
|
||||
},
|
||||
"scripts": {
|
||||
"preinstall": "node ./scripts/preinstall.js",
|
||||
"preinstall": "node ./scripts/preinstall.cjs",
|
||||
"test": "jest --env node --verbose --runInBand --bail --forceExit",
|
||||
"test-unit": "yarn test test/unit/",
|
||||
"test-integration-cli": "rimraf test/fixtures/integration && ava test/integration.js --serial --fail-fast --verbose",
|
||||
@@ -27,7 +28,7 @@
|
||||
},
|
||||
"files": [
|
||||
"dist",
|
||||
"scripts/preinstall.js"
|
||||
"scripts/preinstall.cjs"
|
||||
],
|
||||
"ava": {
|
||||
"extensions": [
|
||||
@@ -57,7 +58,7 @@
|
||||
"devDependencies": {
|
||||
"@alex_neo/jest-expect-message": "1.0.5",
|
||||
"@next/env": "11.1.2",
|
||||
"@sentry/node": "5.5.0",
|
||||
"@sentry/node": "7.7.0",
|
||||
"@sindresorhus/slugify": "0.11.0",
|
||||
"@swc/core": "1.2.218",
|
||||
"@tootallnate/once": "1.1.2",
|
||||
@@ -82,8 +83,7 @@
|
||||
"@types/minimatch": "3.0.3",
|
||||
"@types/mri": "1.1.0",
|
||||
"@types/ms": "0.7.30",
|
||||
"@types/node": "11.11.0",
|
||||
"@types/node-fetch": "2.5.10",
|
||||
"@types/node": "14",
|
||||
"@types/npm-package-arg": "6.1.0",
|
||||
"@types/pluralize": "0.0.29",
|
||||
"@types/progress": "2.0.3",
|
||||
@@ -95,18 +95,17 @@
|
||||
"@types/universal-analytics": "0.4.2",
|
||||
"@types/update-notifier": "5.1.0",
|
||||
"@types/which": "1.3.2",
|
||||
"@types/write-json-file": "2.2.1",
|
||||
"@types/yauzl-promise": "2.1.0",
|
||||
"@vercel/client": "12.1.3",
|
||||
"@vercel/frameworks": "1.1.1",
|
||||
"@vercel/fs-detectors": "2.0.1",
|
||||
"@vercel/fun": "1.0.4",
|
||||
"@vercel/ncc": "0.24.0",
|
||||
"@vercel/ncc": "0.34.0",
|
||||
"@zeit/source-map-support": "0.6.2",
|
||||
"ajv": "6.12.2",
|
||||
"alpha-sort": "2.0.1",
|
||||
"ansi-escapes": "3.0.0",
|
||||
"ansi-regex": "3.0.0",
|
||||
"ansi-regex": "6.0.1",
|
||||
"arg": "5.0.0",
|
||||
"async-listen": "1.2.0",
|
||||
"async-retry": "1.1.3",
|
||||
@@ -114,13 +113,13 @@
|
||||
"ava": "2.2.0",
|
||||
"boxen": "4.2.0",
|
||||
"bytes": "3.0.0",
|
||||
"chalk": "4.1.0",
|
||||
"chalk": "5.0.1",
|
||||
"chance": "1.1.7",
|
||||
"chokidar": "3.3.1",
|
||||
"codecov": "3.8.2",
|
||||
"cpy": "7.2.0",
|
||||
"credit-card": "3.0.1",
|
||||
"date-fns": "1.29.0",
|
||||
"date-fns": "2.29.1",
|
||||
"debug": "3.1.0",
|
||||
"dot": "1.1.3",
|
||||
"dotenv": "4.0.0",
|
||||
@@ -149,7 +148,7 @@
|
||||
"minimatch": "3.0.4",
|
||||
"mri": "1.1.5",
|
||||
"ms": "2.1.2",
|
||||
"node-fetch": "2.6.7",
|
||||
"node-fetch": "3.2.9",
|
||||
"npm-package-arg": "6.1.0",
|
||||
"open": "8.4.0",
|
||||
"ora": "3.4.0",
|
||||
@@ -163,7 +162,7 @@
|
||||
"rimraf": "3.0.2",
|
||||
"semver": "5.5.0",
|
||||
"serve-handler": "6.1.1",
|
||||
"strip-ansi": "5.2.0",
|
||||
"strip-ansi": "7.0.1",
|
||||
"stripe": "5.1.0",
|
||||
"tar-fs": "1.16.3",
|
||||
"test-listen": "1.1.0",
|
||||
@@ -176,23 +175,24 @@
|
||||
"universal-analytics": "0.4.20",
|
||||
"utility-types": "2.1.0",
|
||||
"which": "2.0.2",
|
||||
"write-json-file": "2.2.0",
|
||||
"xdg-app-paths": "5.1.0",
|
||||
"write-json-file": "5.0.0",
|
||||
"xdg-app-paths": "7.3.0",
|
||||
"yauzl-promise": "2.1.3"
|
||||
},
|
||||
"jest": {
|
||||
"preset": "ts-jest",
|
||||
"preset": "ts-jest/presets/default-esm",
|
||||
"globals": {
|
||||
"ts-jest": {
|
||||
"diagnostics": false,
|
||||
"isolatedModules": true
|
||||
"useESM": true
|
||||
}
|
||||
},
|
||||
"moduleNameMapper": {
|
||||
"^(\\.{1,2}/.*)\\.js$": "$1"
|
||||
},
|
||||
"setupFilesAfterEnv": [
|
||||
"@alex_neo/jest-expect-message"
|
||||
],
|
||||
"verbose": false,
|
||||
"testEnvironment": "node",
|
||||
"testMatch": [
|
||||
"<rootDir>/test/**/*.test.ts"
|
||||
]
|
||||
|
||||
@@ -1,8 +1,12 @@
|
||||
import cpy from 'cpy';
|
||||
import execa from 'execa';
|
||||
import fs from 'fs-extra';
|
||||
import { join } from 'path';
|
||||
import { remove, writeFile } from 'fs-extra';
|
||||
import { fileURLToPath } from 'url';
|
||||
|
||||
const { remove, writeFile } = fs;
|
||||
|
||||
const __dirname = fileURLToPath(new URL('.', import.meta.url));
|
||||
const dirRoot = join(__dirname, '..');
|
||||
const distRoot = join(dirRoot, 'dist');
|
||||
|
||||
@@ -38,10 +42,11 @@ async function main() {
|
||||
await remove(join(dirRoot, '../../node_modules/fsevents'));
|
||||
|
||||
// Compile the `doT.js` template files for `vercel dev`
|
||||
console.log();
|
||||
await execa(process.execPath, [join(__dirname, 'compile-templates.js')], {
|
||||
stdio: 'inherit',
|
||||
});
|
||||
// TODO
|
||||
//console.log();
|
||||
//await execa(process.execPath, [join(__dirname, 'compile-templates.cjs')], {
|
||||
// stdio: 'inherit',
|
||||
//});
|
||||
|
||||
// Do the initial `ncc` build
|
||||
console.log();
|
||||
|
||||
@@ -36,7 +36,7 @@ async function main() {
|
||||
const def = await readFile(fnPath.replace(/\.js$/, '.tsdef'), 'utf8');
|
||||
const interfaceName = def.match(/interface (\w+)/)[1];
|
||||
|
||||
const lines = require(fnPath)
|
||||
const lines = (await import(fnPath))
|
||||
.toString()
|
||||
.split('\n');
|
||||
let errorHtmlStart = -1;
|
||||
@@ -4,18 +4,18 @@ import execa from 'execa';
|
||||
import plural from 'pluralize';
|
||||
import inquirer from 'inquirer';
|
||||
import { resolve } from 'path';
|
||||
import chalk, { Chalk } from 'chalk';
|
||||
import chalk, { ChalkInstance } from 'chalk';
|
||||
import { URLSearchParams, parse } from 'url';
|
||||
|
||||
import sleep from '../../util/sleep';
|
||||
import formatDate from '../../util/format-date';
|
||||
import link from '../../util/output/link';
|
||||
import logo from '../../util/output/logo';
|
||||
import getArgs from '../../util/get-args';
|
||||
import Client from '../../util/client';
|
||||
import { getPkgName } from '../../util/pkg-name';
|
||||
import { Deployment, PaginationOptions } from '../../types';
|
||||
import { normalizeURL } from '../../util/bisect/normalize-url';
|
||||
import sleep from '../../util/sleep.js';
|
||||
import formatDate from '../../util/format-date.js';
|
||||
import link from '../../util/output/link.js';
|
||||
import logo from '../../util/output/logo.js';
|
||||
import getArgs from '../../util/get-args.js';
|
||||
import Client from '../../util/client.js';
|
||||
import { getPkgName } from '../../util/pkg-name.js';
|
||||
import { Deployment, PaginationOptions } from '../../types.js';
|
||||
import { normalizeURL } from '../../util/bisect/normalize-url.js';
|
||||
|
||||
interface DeploymentV6
|
||||
extends Pick<
|
||||
@@ -298,7 +298,7 @@ export default async function main(client: Client): Promise<number> {
|
||||
return 1;
|
||||
}
|
||||
const { exitCode } = proc;
|
||||
let color: Chalk;
|
||||
let color: ChalkInstance;
|
||||
if (exitCode === 0) {
|
||||
color = chalk.green;
|
||||
action = 'good';
|
||||
|
||||
28
packages/cli/src/commands/env/add.ts
vendored
28
packages/cli/src/commands/env/add.ts
vendored
@@ -1,21 +1,21 @@
|
||||
import chalk from 'chalk';
|
||||
import { ProjectEnvTarget, Project, ProjectEnvType } from '../../types';
|
||||
import { Output } from '../../util/output';
|
||||
import Client from '../../util/client';
|
||||
import stamp from '../../util/output/stamp';
|
||||
import addEnvRecord from '../../util/env/add-env-record';
|
||||
import getEnvRecords from '../../util/env/get-env-records';
|
||||
import { ProjectEnvTarget, Project, ProjectEnvType } from '../../types.js';
|
||||
import { Output } from '../../util/output/index.js';
|
||||
import Client from '../../util/client.js';
|
||||
import stamp from '../../util/output/stamp.js';
|
||||
import addEnvRecord from '../../util/env/add-env-record.js';
|
||||
import getEnvRecords from '../../util/env/get-env-records.js';
|
||||
import {
|
||||
isValidEnvTarget,
|
||||
getEnvTargetPlaceholder,
|
||||
getEnvTargetChoices,
|
||||
} from '../../util/env/env-target';
|
||||
import readStandardInput from '../../util/input/read-standard-input';
|
||||
import param from '../../util/output/param';
|
||||
import { emoji, prependEmoji } from '../../util/emoji';
|
||||
import { isKnownError } from '../../util/env/known-error';
|
||||
import { getCommandName } from '../../util/pkg-name';
|
||||
import { isAPIError } from '../../util/errors-ts';
|
||||
} from '../../util/env/env-target.js';
|
||||
import readStandardInput from '../../util/input/read-standard-input.js';
|
||||
import param from '../../util/output/param.js';
|
||||
import { emoji, prependEmoji } from '../../util/emoji.js';
|
||||
import { isKnownError } from '../../util/env/known-error.js';
|
||||
import { getCommandName } from '../../util/pkg-name.js';
|
||||
import { isAPIError } from '../../util/errors-ts.js';
|
||||
|
||||
type Options = {
|
||||
'--debug': boolean;
|
||||
@@ -29,7 +29,7 @@ export default async function add(
|
||||
output: Output
|
||||
) {
|
||||
// improve the way we show inquirer prompts
|
||||
require('../../util/input/patch-inquirer');
|
||||
await import('../../util/input/patch-inquirer.js');
|
||||
|
||||
const stdInput = await readStandardInput(client.stdin);
|
||||
let [envName, envTargetArg, envGitBranch] = args;
|
||||
|
||||
30
packages/cli/src/commands/env/rm.ts
vendored
30
packages/cli/src/commands/env/rm.ts
vendored
@@ -1,22 +1,22 @@
|
||||
import chalk from 'chalk';
|
||||
import inquirer from 'inquirer';
|
||||
import { Project } from '../../types';
|
||||
import { Output } from '../../util/output';
|
||||
import confirm from '../../util/input/confirm';
|
||||
import removeEnvRecord from '../../util/env/remove-env-record';
|
||||
import getEnvRecords from '../../util/env/get-env-records';
|
||||
import formatEnvTarget from '../../util/env/format-env-target';
|
||||
import { Project } from '../../types.js';
|
||||
import { Output } from '../../util/output/index.js';
|
||||
import confirm from '../../util/input/confirm.js';
|
||||
import removeEnvRecord from '../../util/env/remove-env-record.js';
|
||||
import getEnvRecords from '../../util/env/get-env-records.js';
|
||||
import formatEnvTarget from '../../util/env/format-env-target.js';
|
||||
import {
|
||||
isValidEnvTarget,
|
||||
getEnvTargetPlaceholder,
|
||||
} from '../../util/env/env-target';
|
||||
import Client from '../../util/client';
|
||||
import stamp from '../../util/output/stamp';
|
||||
import param from '../../util/output/param';
|
||||
import { emoji, prependEmoji } from '../../util/emoji';
|
||||
import { isKnownError } from '../../util/env/known-error';
|
||||
import { getCommandName } from '../../util/pkg-name';
|
||||
import { isAPIError } from '../../util/errors-ts';
|
||||
} from '../../util/env/env-target.js';
|
||||
import Client from '../../util/client.js';
|
||||
import stamp from '../../util/output/stamp.js';
|
||||
import param from '../../util/output/param.js';
|
||||
import { emoji, prependEmoji } from '../../util/emoji.js';
|
||||
import { isKnownError } from '../../util/env/known-error.js';
|
||||
import { getCommandName } from '../../util/pkg-name.js';
|
||||
import { isAPIError } from '../../util/errors-ts.js';
|
||||
|
||||
type Options = {
|
||||
'--debug': boolean;
|
||||
@@ -31,7 +31,7 @@ export default async function rm(
|
||||
output: Output
|
||||
) {
|
||||
// improve the way we show inquirer prompts
|
||||
require('../../util/input/patch-inquirer');
|
||||
await import('../../util/input/patch-inquirer.js');
|
||||
|
||||
if (args.length > 3) {
|
||||
output.error(
|
||||
|
||||
@@ -3,16 +3,15 @@ import path from 'path';
|
||||
import tar from 'tar-fs';
|
||||
import chalk from 'chalk';
|
||||
|
||||
// @ts-ignore
|
||||
import listInput from '../../util/input/list';
|
||||
import listItem from '../../util/output/list-item';
|
||||
import promptBool from '../../util/input/prompt-bool';
|
||||
import toHumanPath from '../../util/humanize-path';
|
||||
import Client from '../../util/client';
|
||||
import info from '../../util/output/info';
|
||||
import cmd from '../../util/output/cmd';
|
||||
import didYouMean from '../../util/init/did-you-mean';
|
||||
import { getCommandName } from '../../util/pkg-name';
|
||||
import listInput from '../../util/input/list.js';
|
||||
import listItem from '../../util/output/list-item.js';
|
||||
import promptBool from '../../util/input/prompt-bool.js';
|
||||
import toHumanPath from '../../util/humanize-path.js';
|
||||
import Client from '../../util/client.js';
|
||||
import info from '../../util/output/info.js';
|
||||
import cmd from '../../util/output/cmd.js';
|
||||
import didYouMean from '../../util/init/did-you-mean.js';
|
||||
import { getCommandName } from '../../util/pkg-name.js';
|
||||
|
||||
type Options = {
|
||||
'--debug': boolean;
|
||||
@@ -138,10 +137,14 @@ async function extractExample(
|
||||
|
||||
await new Promise((resolve, reject) => {
|
||||
const extractor = tar.extract(folder);
|
||||
res.body.on('error', reject);
|
||||
extractor.on('error', reject);
|
||||
extractor.on('finish', resolve);
|
||||
res.body.pipe(extractor);
|
||||
if (res.body) {
|
||||
res.body.on('error', reject);
|
||||
res.body.pipe(extractor);
|
||||
} else {
|
||||
reject(new Error(`res.body not defiled`));
|
||||
}
|
||||
});
|
||||
|
||||
const successLog = `Initialized "${chalk.bold(
|
||||
|
||||
@@ -1,25 +1,25 @@
|
||||
import chalk from 'chalk';
|
||||
import ms from 'ms';
|
||||
import table from 'text-table';
|
||||
import Now from '../util';
|
||||
import getArgs from '../util/get-args';
|
||||
import { handleError } from '../util/error';
|
||||
import cmd from '../util/output/cmd';
|
||||
import logo from '../util/output/logo';
|
||||
import elapsed from '../util/output/elapsed';
|
||||
import strlen from '../util/strlen';
|
||||
import toHost from '../util/to-host';
|
||||
import parseMeta from '../util/parse-meta';
|
||||
import { isValidName } from '../util/is-valid-name';
|
||||
import getCommandFlags from '../util/get-command-flags';
|
||||
import { getPkgName, getCommandName } from '../util/pkg-name';
|
||||
import Client from '../util/client';
|
||||
import { Deployment } from '../types';
|
||||
import validatePaths from '../util/validate-paths';
|
||||
import { getLinkedProject } from '../util/projects/link';
|
||||
import { ensureLink } from '../util/ensure-link';
|
||||
import getScope from '../util/get-scope';
|
||||
import { isAPIError } from '../util/errors-ts';
|
||||
import Now from '../util/index.js';
|
||||
import getArgs from '../util/get-args.js';
|
||||
import { handleError } from '../util/error.js';
|
||||
import cmd from '../util/output/cmd.js';
|
||||
import logo from '../util/output/logo.js';
|
||||
import elapsed from '../util/output/elapsed.js';
|
||||
import strlen from '../util/strlen.js';
|
||||
import toHost from '../util/to-host.js';
|
||||
import parseMeta from '../util/parse-meta.js';
|
||||
import { isValidName } from '../util/is-valid-name.js';
|
||||
import getCommandFlags from '../util/get-command-flags.js';
|
||||
import { getPkgName, getCommandName } from '../util/pkg-name.js';
|
||||
import Client from '../util/client.js';
|
||||
import { Deployment } from '../types.js';
|
||||
import validatePaths from '../util/validate-paths.js';
|
||||
import { getLinkedProject } from '../util/projects/link.js';
|
||||
import { ensureLink } from '../util/ensure-link.js';
|
||||
import getScope from '../util/get-scope.js';
|
||||
import { isAPIError } from '../util/errors-ts.js';
|
||||
|
||||
const help = () => {
|
||||
console.log(`
|
||||
@@ -204,6 +204,7 @@ export default async function main(client: Client) {
|
||||
nextTimestamp,
|
||||
});
|
||||
|
||||
// @ts-ignore
|
||||
let {
|
||||
deployments,
|
||||
pagination,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env node
|
||||
import { isErrnoException, isError, errorToString } from './util/is-error';
|
||||
import { isErrnoException, isError, errorToString } from './util/is-error.js';
|
||||
|
||||
try {
|
||||
// Test to see if cwd has been deleted before
|
||||
@@ -21,37 +21,37 @@ import epipebomb from 'epipebomb';
|
||||
import updateNotifier from 'update-notifier';
|
||||
import { URL } from 'url';
|
||||
import * as Sentry from '@sentry/node';
|
||||
import hp from './util/humanize-path';
|
||||
import commands from './commands';
|
||||
import pkg from './util/pkg';
|
||||
import { Output } from './util/output';
|
||||
import cmd from './util/output/cmd';
|
||||
import info from './util/output/info';
|
||||
import error from './util/output/error';
|
||||
import param from './util/output/param';
|
||||
import highlight from './util/output/highlight';
|
||||
import getArgs from './util/get-args';
|
||||
import getUser from './util/get-user';
|
||||
import getTeams from './util/teams/get-teams';
|
||||
import Client from './util/client';
|
||||
import { handleError } from './util/error';
|
||||
import reportError from './util/report-error';
|
||||
import getConfig from './util/get-config';
|
||||
import * as configFiles from './util/config/files';
|
||||
import getGlobalPathConfig from './util/config/global-path';
|
||||
import hp from './util/humanize-path.js';
|
||||
import commands from './commands/index.js';
|
||||
import pkg from './util/pkg.js';
|
||||
import { Output } from './util/output/index.js';
|
||||
import cmd from './util/output/cmd.js';
|
||||
import info from './util/output/info.js';
|
||||
import error from './util/output/error.js';
|
||||
import param from './util/output/param.js';
|
||||
import highlight from './util/output/highlight.js';
|
||||
import getArgs from './util/get-args.js';
|
||||
import getUser from './util/get-user.js';
|
||||
import getTeams from './util/teams/get-teams.js';
|
||||
import Client from './util/client.js';
|
||||
import { handleError } from './util/error.js';
|
||||
import reportError from './util/report-error.js';
|
||||
import getConfig from './util/get-config.js';
|
||||
import * as configFiles from './util/config/files.js';
|
||||
import getGlobalPathConfig from './util/config/global-path.js';
|
||||
import {
|
||||
getDefaultConfig,
|
||||
getDefaultAuthConfig,
|
||||
} from './util/config/get-default';
|
||||
import * as ERRORS from './util/errors-ts';
|
||||
import { APIError } from './util/errors-ts';
|
||||
import { SENTRY_DSN } from './util/constants';
|
||||
import getUpdateCommand from './util/get-update-command';
|
||||
import { metrics, shouldCollectMetrics } from './util/metrics';
|
||||
import { getCommandName, getTitleName } from './util/pkg-name';
|
||||
import doLoginPrompt from './util/login/prompt';
|
||||
import { GlobalConfig } from './types';
|
||||
import { VercelConfig } from '@vercel/client';
|
||||
} from './util/config/get-default.js';
|
||||
import * as ERRORS from './util/errors-ts.js';
|
||||
import { APIError } from './util/errors-ts.js';
|
||||
import { SENTRY_DSN } from './util/constants.js';
|
||||
import getUpdateCommand from './util/get-update-command.js';
|
||||
import { metrics, shouldCollectMetrics } from './util/metrics.js';
|
||||
import { getCommandName, getTitleName } from './util/pkg-name.js';
|
||||
import doLoginPrompt from './util/login/prompt.js';
|
||||
import type { GlobalConfig } from './types.js';
|
||||
import type { VercelConfig } from '@vercel/client';
|
||||
|
||||
const isCanary = pkg.version.includes('canary');
|
||||
|
||||
@@ -256,6 +256,7 @@ const main = async () => {
|
||||
config.user ||
|
||||
// @ts-ignore
|
||||
typeof config.user === 'object' ||
|
||||
// @ts-ignore
|
||||
typeof config.currentTeam === 'object'
|
||||
) {
|
||||
configExists = false;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Build } from '../types';
|
||||
import { Build } from '../types.js';
|
||||
|
||||
export const isReady = ({ readyState }: Pick<Build, 'readyState'>) =>
|
||||
readyState === 'READY';
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import frameworkList from '@vercel/frameworks';
|
||||
import { frameworks } from '@vercel/frameworks';
|
||||
|
||||
export function sortBuilders<B extends { use: string }>(builds: B[]): B[] {
|
||||
const frontendRuntimeSet = new Set(
|
||||
frameworkList.map(f => f.useRuntime?.use || '@vercel/static-build')
|
||||
frameworks.map(f => (f as any).useRuntime?.use || '@vercel/static-build')
|
||||
);
|
||||
const toNumber = (build: B) => (frontendRuntimeSet.has(build.use) ? 0 : 1);
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { bold } from 'chalk';
|
||||
import chalk from 'chalk';
|
||||
import inquirer from 'inquirer';
|
||||
import { EventEmitter } from 'events';
|
||||
import { URLSearchParams } from 'url';
|
||||
@@ -6,13 +6,13 @@ import { parse as parseUrl } from 'url';
|
||||
import { VercelConfig } from '@vercel/client';
|
||||
import retry, { RetryFunction, Options as RetryOptions } from 'async-retry';
|
||||
import fetch, { BodyInit, Headers, RequestInit, Response } from 'node-fetch';
|
||||
import ua from './ua';
|
||||
import { Output } from './output/create-output';
|
||||
import responseError from './response-error';
|
||||
import printIndications from './print-indications';
|
||||
import reauthenticate from './login/reauthenticate';
|
||||
import { SAMLError } from './login/types';
|
||||
import { writeToAuthConfigFile } from './config/files';
|
||||
import ua from './ua.js';
|
||||
import { Output } from './output/create-output.js';
|
||||
import responseError from './response-error.js';
|
||||
import printIndications from './print-indications.js';
|
||||
import reauthenticate from './login/reauthenticate.js';
|
||||
import { SAMLError } from './login/types.js';
|
||||
import { writeToAuthConfigFile } from './config/files.js';
|
||||
import type {
|
||||
AuthConfig,
|
||||
GlobalConfig,
|
||||
@@ -20,9 +20,11 @@ import type {
|
||||
Stdio,
|
||||
ReadableTTY,
|
||||
WritableTTY,
|
||||
} from '../types';
|
||||
import { sharedPromise } from './promise';
|
||||
import { APIError } from './errors-ts';
|
||||
} from '../types.js';
|
||||
import { sharedPromise } from './promise.js';
|
||||
import { APIError } from './errors-ts.js';
|
||||
|
||||
const { bold } = chalk;
|
||||
|
||||
const isSAMLError = (v: any): v is SAMLError => {
|
||||
return v && v.saml;
|
||||
@@ -92,7 +94,18 @@ export default class Client extends EventEmitter implements Stdio {
|
||||
: '';
|
||||
|
||||
if (opts.accountId || opts.useCurrentTeam !== false) {
|
||||
const query = new URLSearchParams(parsedUrl.query);
|
||||
//const query = new URLSearchParams(parsedUrl.query);
|
||||
// TODO: move this to a helper function?
|
||||
const query = new URLSearchParams();
|
||||
for (const [name, value] of Object.entries(parsedUrl.query)) {
|
||||
if (Array.isArray(value)) {
|
||||
for (const val of value) {
|
||||
query.append(name, val);
|
||||
}
|
||||
} else if (typeof value === 'string') {
|
||||
query.set(name, value);
|
||||
}
|
||||
}
|
||||
|
||||
if (opts.accountId) {
|
||||
if (opts.accountId.startsWith('team_')) {
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
import { join, basename } from 'path';
|
||||
import loadJSON from 'load-json-file';
|
||||
import writeJSON from 'write-json-file';
|
||||
import { writeJsonFileSync } from 'write-json-file';
|
||||
import { existsSync } from 'fs';
|
||||
import { fileNameSymbol } from '@vercel/client';
|
||||
import getGlobalPathConfig from './global-path';
|
||||
import getLocalPathConfig from './local-path';
|
||||
import { NowError } from '../now-error';
|
||||
import error from '../output/error';
|
||||
import highlight from '../output/highlight';
|
||||
import { VercelConfig } from '../dev/types';
|
||||
import { AuthConfig, GlobalConfig } from '../../types';
|
||||
import { isErrnoException, isError } from '../is-error';
|
||||
import getGlobalPathConfig from './global-path.js';
|
||||
import getLocalPathConfig from './local-path.js';
|
||||
import { NowError } from '../now-error.js';
|
||||
import error from '../output/error.js';
|
||||
import highlight from '../output/highlight.js';
|
||||
import { VercelConfig } from '../dev/types.js';
|
||||
import { AuthConfig, GlobalConfig } from '../../types.js';
|
||||
import { isErrnoException, isError } from '../is-error.js';
|
||||
|
||||
const VERCEL_DIR = getGlobalPathConfig();
|
||||
const CONFIG_FILE_PATH = join(VERCEL_DIR, 'config.json');
|
||||
@@ -25,7 +25,7 @@ export const readConfigFile = (): GlobalConfig => {
|
||||
// writes whatever's in `stuff` to "global config" file, atomically
|
||||
export const writeToConfigFile = (stuff: GlobalConfig): void => {
|
||||
try {
|
||||
return writeJSON.sync(CONFIG_FILE_PATH, stuff, { indent: 2 });
|
||||
return writeJsonFileSync(CONFIG_FILE_PATH, stuff, { indent: 2 });
|
||||
} catch (err: unknown) {
|
||||
if (isErrnoException(err)) {
|
||||
if (isErrnoException(err) && err.code === 'EPERM') {
|
||||
@@ -64,7 +64,7 @@ export const writeToAuthConfigFile = (authConfig: AuthConfig) => {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
return writeJSON.sync(AUTH_CONFIG_FILE_PATH, authConfig, {
|
||||
return writeJsonFileSync(AUTH_CONFIG_FILE_PATH, authConfig, {
|
||||
indent: 2,
|
||||
mode: 0o600,
|
||||
});
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { homedir } from 'os';
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import { homedir } from 'os';
|
||||
import XDGAppPaths from 'xdg-app-paths';
|
||||
import getArgs from '../../util/get-args';
|
||||
import getArgs from '../../util/get-args.js';
|
||||
|
||||
// Returns whether a directory exists
|
||||
export const isDirectory = (path: string): boolean => {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import path from 'path';
|
||||
import { existsSync } from 'fs';
|
||||
import { InvalidLocalConfig } from '../errors';
|
||||
import { ConflictingConfigFiles } from '../errors-ts';
|
||||
import getArgs from '../../util/get-args';
|
||||
import { InvalidLocalConfig } from '../errors.js';
|
||||
import { ConflictingConfigFiles } from '../errors-ts.js';
|
||||
import getArgs from '../../util/get-args.js';
|
||||
|
||||
export default function getLocalPathConfig(prefix: string) {
|
||||
let customPath: string | undefined;
|
||||
|
||||
@@ -18,14 +18,14 @@ import { isOfficialRuntime } from '@vercel/fs-detectors';
|
||||
import plural from 'pluralize';
|
||||
import minimatch from 'minimatch';
|
||||
|
||||
import { Output } from '../output';
|
||||
import highlight from '../output/highlight';
|
||||
import { treeKill } from '../tree-kill';
|
||||
import { relative } from '../path-helpers';
|
||||
import { LambdaSizeExceededError } from '../errors-ts';
|
||||
import { Output } from '../output/index.js';
|
||||
import highlight from '../output/highlight.js';
|
||||
import { treeKill } from '../tree-kill.js';
|
||||
import { relative } from '../path-helpers.js';
|
||||
import { LambdaSizeExceededError } from '../errors-ts.js';
|
||||
|
||||
import DevServer from './server';
|
||||
import { getBuilder } from './builder-cache';
|
||||
import DevServer from './server.js';
|
||||
import { getBuilder } from './builder-cache.js';
|
||||
import {
|
||||
VercelConfig,
|
||||
BuildMatch,
|
||||
@@ -36,10 +36,10 @@ import {
|
||||
BuilderOutputs,
|
||||
EnvConfigs,
|
||||
BuiltLambda,
|
||||
} from './types';
|
||||
} from './types.js';
|
||||
import { normalizeRoutes } from '@vercel/routing-utils';
|
||||
import getUpdateCommand from '../get-update-command';
|
||||
import { getTitleName } from '../pkg-name';
|
||||
import getUpdateCommand from '../get-update-command.js';
|
||||
import { getTitleName } from '../pkg-name.js';
|
||||
|
||||
interface BuildMessage {
|
||||
type: string;
|
||||
@@ -86,7 +86,7 @@ async function createBuildProcess(
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
// The first message that the builder process sends is the `ready` event
|
||||
buildProcess.once('message', ({ type }) => {
|
||||
buildProcess.once('message', ({ type }: { type?: string }) => {
|
||||
if (type !== 'ready') {
|
||||
reject(new Error('Did not get "ready" event from builder'));
|
||||
} else {
|
||||
|
||||
@@ -2,7 +2,7 @@ import {
|
||||
ProjectEnvType,
|
||||
ProjectEnvVariable,
|
||||
ProjectEnvTarget,
|
||||
} from '../../types';
|
||||
} from '../../types.js';
|
||||
import { Env } from '@vercel/build-utils';
|
||||
|
||||
function getSystemEnvValue(
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { parse } from 'url';
|
||||
import { ListenSpec } from './types';
|
||||
import { ListenSpec } from './types.js';
|
||||
|
||||
export default function parseListen(
|
||||
str: string,
|
||||
@@ -34,11 +34,11 @@ export default function parseListen(
|
||||
return [url.pathname];
|
||||
case 'tcp:':
|
||||
url.port = url.port || String(defaultPort);
|
||||
return [parseInt(url.port, 10), url.hostname];
|
||||
return [parseInt(url.port, 10), url.hostname ?? undefined];
|
||||
default:
|
||||
if (!url.slashes) {
|
||||
if (url.protocol === null) {
|
||||
return [defaultPort, url.pathname];
|
||||
return [defaultPort, url.pathname ?? undefined];
|
||||
}
|
||||
port = Number(url.hostname);
|
||||
if (url.protocol && !isNaN(port)) {
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import url from 'url';
|
||||
import PCRE from 'pcre-to-regexp';
|
||||
|
||||
import isURL from './is-url';
|
||||
import DevServer from './server';
|
||||
import isURL from './is-url.js';
|
||||
import DevServer from './server.js';
|
||||
|
||||
import { VercelConfig, HttpHeadersConfig, RouteResult } from './types';
|
||||
import { VercelConfig, HttpHeadersConfig, RouteResult } from './types.js';
|
||||
import { isHandler, Route, HandleValue } from '@vercel/routing-utils';
|
||||
|
||||
export function resolveRouteParameters(
|
||||
@@ -56,7 +56,8 @@ export async function devRouter(
|
||||
phase?: HandleValue | null
|
||||
): Promise<RouteResult> {
|
||||
let result: RouteResult | undefined;
|
||||
let { query, pathname: reqPathname = '/' } = url.parse(reqUrl, true);
|
||||
let { query, pathname: _reqPathname } = url.parse(reqUrl, true);
|
||||
let reqPathname = _reqPathname || '/';
|
||||
const combinedHeaders: HttpHeadersConfig = { ...previousHeaders };
|
||||
let status: number | undefined;
|
||||
let isContinue = false;
|
||||
@@ -128,9 +129,9 @@ export async function devRouter(
|
||||
phase !== 'hit' &&
|
||||
!isDestUrl
|
||||
) {
|
||||
const { pathname = '/' } = url.parse(destPath);
|
||||
const { pathname } = url.parse(destPath);
|
||||
const hasDestFile = await devServer.hasFilesystem(
|
||||
pathname,
|
||||
pathname || '/',
|
||||
vercelConfig
|
||||
);
|
||||
|
||||
|
||||
@@ -44,36 +44,39 @@ import {
|
||||
detectApiExtensions,
|
||||
isOfficialRuntime,
|
||||
} from '@vercel/fs-detectors';
|
||||
import frameworkList from '@vercel/frameworks';
|
||||
import frameworks from '@vercel/frameworks';
|
||||
|
||||
import cmd from '../output/cmd';
|
||||
import link from '../output/link';
|
||||
import sleep from '../sleep';
|
||||
import { Output } from '../output';
|
||||
import { relative } from '../path-helpers';
|
||||
import { getDistTag } from '../get-dist-tag';
|
||||
import getVercelConfigPath from '../config/local-path';
|
||||
import { MissingDotenvVarsError } from '../errors-ts';
|
||||
import cliPkg from '../pkg';
|
||||
import { getVercelDirectory } from '../projects/link';
|
||||
import { staticFiles as getFiles } from '../get-files';
|
||||
import { validateConfig } from './validate';
|
||||
import { devRouter, getRoutesTypes } from './router';
|
||||
import getMimeType from './mime-type';
|
||||
import { executeBuild, getBuildMatches, shutdownBuilder } from './builder';
|
||||
import { generateErrorMessage, generateHttpStatusDescription } from './errors';
|
||||
import cmd from '../output/cmd.js';
|
||||
import link from '../output/link.js';
|
||||
import sleep from '../sleep.js';
|
||||
import { Output } from '../output/index.js';
|
||||
import { relative } from '../path-helpers.js';
|
||||
import { getDistTag } from '../get-dist-tag.js';
|
||||
import getVercelConfigPath from '../config/local-path.js';
|
||||
import { MissingDotenvVarsError } from '../errors-ts.js';
|
||||
import cliPkg from '../pkg.js';
|
||||
import { getVercelDirectory } from '../projects/link.js';
|
||||
import { staticFiles as getFiles } from '../get-files.js';
|
||||
import { validateConfig } from './validate.js';
|
||||
import { devRouter, getRoutesTypes } from './router.js';
|
||||
import getMimeType from './mime-type.js';
|
||||
import { executeBuild, getBuildMatches, shutdownBuilder } from './builder.js';
|
||||
import {
|
||||
generateErrorMessage,
|
||||
generateHttpStatusDescription,
|
||||
} from './errors.js';
|
||||
import {
|
||||
installBuilders,
|
||||
updateBuilders,
|
||||
builderDirPromise,
|
||||
} from './builder-cache';
|
||||
} from './builder-cache.js';
|
||||
|
||||
// HTML templates
|
||||
import errorTemplate from './templates/error';
|
||||
import errorTemplateBase from './templates/error_base';
|
||||
import errorTemplate404 from './templates/error_404';
|
||||
import errorTemplate502 from './templates/error_502';
|
||||
import redirectTemplate from './templates/redirect';
|
||||
import errorTemplate from './templates/error.js';
|
||||
import errorTemplateBase from './templates/error_base.js';
|
||||
import errorTemplate404 from './templates/error_404.js';
|
||||
import errorTemplate502 from './templates/error_502.js';
|
||||
import redirectTemplate from './templates/redirect.js';
|
||||
|
||||
import {
|
||||
VercelConfig,
|
||||
@@ -89,20 +92,20 @@ import {
|
||||
RouteResult,
|
||||
HttpHeadersConfig,
|
||||
EnvConfigs,
|
||||
} from './types';
|
||||
import { ProjectEnvVariable, ProjectSettings } from '../../types';
|
||||
import exposeSystemEnvs from './expose-system-envs';
|
||||
import { treeKill } from '../tree-kill';
|
||||
import { nodeHeadersToFetchHeaders } from './headers';
|
||||
} from './types.js';
|
||||
import { ProjectEnvVariable, ProjectSettings } from '../../types.js';
|
||||
import exposeSystemEnvs from './expose-system-envs.js';
|
||||
import { treeKill } from '../tree-kill.js';
|
||||
import { nodeHeadersToFetchHeaders } from './headers.js';
|
||||
import {
|
||||
errorToString,
|
||||
isErrnoException,
|
||||
isError,
|
||||
isSpawnError,
|
||||
} from '../is-error';
|
||||
} from '../is-error.js';
|
||||
|
||||
const frontendRuntimeSet = new Set(
|
||||
frameworkList.map(f => f.useRuntime?.use || '@vercel/static-build')
|
||||
frameworks.default.map(f => f.useRuntime?.use || '@vercel/static-build')
|
||||
);
|
||||
|
||||
interface FSEvent {
|
||||
@@ -858,7 +861,7 @@ export default class DevServer {
|
||||
let address: string | null = null;
|
||||
while (typeof address !== 'string') {
|
||||
try {
|
||||
address = await listen(this.server, ...listenSpec);
|
||||
address = await listen.default(this.server, ...listenSpec);
|
||||
} catch (err: unknown) {
|
||||
if (isErrnoException(err)) {
|
||||
this.output.debug(`Got listen error: ${err.code}`);
|
||||
@@ -1536,7 +1539,7 @@ export default class DevServer {
|
||||
// Retain orginal pathname, but override query parameters from the rewrite
|
||||
const beforeRewriteUrl = req.url || '/';
|
||||
const rewriteUrlParsed = url.parse(beforeRewriteUrl, true);
|
||||
delete rewriteUrlParsed.search;
|
||||
rewriteUrlParsed.search = null;
|
||||
rewriteUrlParsed.query = url.parse(rewritePath, true).query;
|
||||
req.url = url.format(rewriteUrlParsed);
|
||||
debug(
|
||||
@@ -1595,7 +1598,7 @@ export default class DevServer {
|
||||
if (routeResult.isDestUrl) {
|
||||
// Mix the `routes` result dest query params into the req path
|
||||
const destParsed = url.parse(routeResult.dest, true);
|
||||
delete destParsed.search;
|
||||
destParsed.search = null;
|
||||
Object.assign(destParsed.query, routeResult.uri_args);
|
||||
const destUrl = url.format(destParsed);
|
||||
|
||||
@@ -1774,7 +1777,7 @@ export default class DevServer {
|
||||
|
||||
this.setResponseHeaders(res, requestId);
|
||||
const origUrl = url.parse(req.url || '/', true);
|
||||
delete origUrl.search;
|
||||
origUrl.search = null;
|
||||
origUrl.pathname = dest;
|
||||
Object.assign(origUrl.query, uri_args);
|
||||
req.url = url.format(origUrl);
|
||||
@@ -1799,7 +1802,7 @@ export default class DevServer {
|
||||
buildResult.routes.length > 0
|
||||
) {
|
||||
const origUrl = url.parse(req.url || '/', true);
|
||||
delete origUrl.search;
|
||||
origUrl.search = null;
|
||||
origUrl.pathname = dest;
|
||||
Object.assign(origUrl.query, uri_args);
|
||||
const newUrl = url.format(origUrl);
|
||||
|
||||
2
packages/cli/src/util/env/env-target.ts
vendored
2
packages/cli/src/util/env/env-target.ts
vendored
@@ -1,4 +1,4 @@
|
||||
import { ProjectEnvTarget } from '../../types';
|
||||
import { ProjectEnvTarget } from '../../types.js';
|
||||
|
||||
function envTargets(): string[] {
|
||||
return Object.values(ProjectEnvTarget);
|
||||
|
||||
6
packages/cli/src/util/env/get-env-records.ts
vendored
6
packages/cli/src/util/env/get-env-records.ts
vendored
@@ -1,6 +1,6 @@
|
||||
import { Output } from '../output';
|
||||
import Client from '../client';
|
||||
import { ProjectEnvVariable, ProjectEnvTarget } from '../../types';
|
||||
import { Output } from '../output/index.js';
|
||||
import Client from '../client.js';
|
||||
import { ProjectEnvVariable, ProjectEnvTarget } from '../../types.js';
|
||||
import { URLSearchParams } from 'url';
|
||||
|
||||
/** The CLI command that was used that needs the environment variables. */
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Response } from 'node-fetch';
|
||||
import errorOutput from './output/error';
|
||||
import errorOutput from './output/error.js';
|
||||
|
||||
export { default as handleError } from './handle-error';
|
||||
export { default as handleError } from './handle-error.js';
|
||||
export const error = errorOutput;
|
||||
|
||||
export interface ResponseError extends Error {
|
||||
@@ -20,7 +20,7 @@ export async function responseError(
|
||||
let bodyError;
|
||||
|
||||
if (res.status >= 400 && res.status < 500) {
|
||||
let body;
|
||||
let body: any;
|
||||
|
||||
try {
|
||||
body = await res.json();
|
||||
@@ -69,7 +69,7 @@ export async function responseErrorMessage(
|
||||
let message;
|
||||
|
||||
if (res.status >= 400 && res.status < 500) {
|
||||
let body;
|
||||
let body: any;
|
||||
|
||||
try {
|
||||
body = await res.json();
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import bytes from 'bytes';
|
||||
import { Response } from 'node-fetch';
|
||||
import { NowBuildError } from '@vercel/build-utils';
|
||||
import { NowError } from './now-error';
|
||||
import code from './output/code';
|
||||
import { getCommandName } from './pkg-name';
|
||||
import { NowError } from './now-error.js';
|
||||
import code from './output/code.js';
|
||||
import { getCommandName } from './pkg-name.js';
|
||||
import chalk from 'chalk';
|
||||
import { isError } from './is-error';
|
||||
import { isError } from './is-error.js';
|
||||
|
||||
/**
|
||||
* This error is thrown when there is an API error with a payload. The error
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { NowError } from './now-error';
|
||||
import { NowError } from './now-error.js';
|
||||
|
||||
interface SchemaValidationFailedMeta {
|
||||
message: string;
|
||||
|
||||
@@ -6,8 +6,8 @@ import retry from 'async-retry';
|
||||
import jsonlines from 'jsonlines';
|
||||
import { eraseLines } from 'ansi-escapes';
|
||||
|
||||
import Client from './client';
|
||||
import { getDeployment } from './get-deployment';
|
||||
import Client from './client.js';
|
||||
import { getDeployment } from './get-deployment.js';
|
||||
|
||||
export interface FindOpts {
|
||||
direction: 'forward' | 'backward';
|
||||
@@ -66,7 +66,7 @@ async function printEvents(
|
||||
// handle the event stream and make the promise get rejected
|
||||
// if errors occur so we can retry
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
const stream = readable.pipe(jsonlines.parse());
|
||||
const stream = readable!.pipe(jsonlines.parse());
|
||||
|
||||
let poller: ReturnType<typeof setTimeout>;
|
||||
|
||||
@@ -151,7 +151,7 @@ async function printEvents(
|
||||
stream.on('end', finish);
|
||||
stream.on('data', onData);
|
||||
stream.on('error', onError);
|
||||
readable.on('error', onError);
|
||||
readable!.on('error', onError);
|
||||
});
|
||||
}
|
||||
const err = new Error(`Deployment events status ${eventsRes.status}`);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import arg from 'arg';
|
||||
import getCommonArgs from './arg-common';
|
||||
import getCommonArgs from './arg-common.js';
|
||||
|
||||
type ArgOptions = {
|
||||
permissive?: boolean;
|
||||
|
||||
@@ -5,12 +5,12 @@ import {
|
||||
CantFindConfig,
|
||||
ConflictingConfigFiles,
|
||||
WorkingDirectoryDoesNotExist,
|
||||
} from './errors-ts';
|
||||
import humanizePath from './humanize-path';
|
||||
import readJSONFile from './read-json-file';
|
||||
import { VercelConfig } from './dev/types';
|
||||
import { Output } from './output';
|
||||
import { isErrnoException } from './is-error';
|
||||
} from './errors-ts.js';
|
||||
import humanizePath from './humanize-path.js';
|
||||
import readJSONFile from './read-json-file.js';
|
||||
import { VercelConfig } from './dev/types.js';
|
||||
import { Output } from './output/index.js';
|
||||
import { isErrnoException } from './is-error.js';
|
||||
|
||||
let config: VercelConfig;
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import Client from './client';
|
||||
import getUser from './get-user';
|
||||
import getTeamById from './teams/get-team-by-id';
|
||||
import { TeamDeleted } from './errors-ts';
|
||||
import { Team } from '../types';
|
||||
import Client from './client.js';
|
||||
import getUser from './get-user.js';
|
||||
import getTeamById from './teams/get-team-by-id.js';
|
||||
import { TeamDeleted } from './errors-ts.js';
|
||||
import type { Team } from '../types.js';
|
||||
|
||||
interface GetScopeOptions {
|
||||
getTeam?: boolean;
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
import { Stats } from 'fs';
|
||||
import fs from 'fs-extra';
|
||||
import { sep, dirname, join, resolve } from 'path';
|
||||
import { lstat, readlink, readFile, realpath } from 'fs-extra';
|
||||
import { isCanary } from './is-canary';
|
||||
import { getPkgName } from './pkg-name';
|
||||
import { isCanary } from './is-canary.js';
|
||||
import { getPkgName } from './pkg-name.js';
|
||||
|
||||
const { lstat, readlink, readFile, realpath } = fs;
|
||||
|
||||
async function isYarn(): Promise<boolean> {
|
||||
let s: Stats;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import Client from './client';
|
||||
import { User } from '../types';
|
||||
import { APIError, InvalidToken, MissingUser } from './errors-ts';
|
||||
import Client from './client.js';
|
||||
import { User } from '../types.js';
|
||||
import { APIError, InvalidToken, MissingUser } from './errors-ts.js';
|
||||
|
||||
export default async function getUser(client: Client) {
|
||||
try {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import bytes from 'bytes';
|
||||
import info from './output/info';
|
||||
import errorOutput from './output/error';
|
||||
import { APIError } from './errors-ts';
|
||||
import { getCommandName } from './pkg-name';
|
||||
import info from './output/info.js';
|
||||
import errorOutput from './output/error.js';
|
||||
import { APIError } from './errors-ts.js';
|
||||
import { getCommandName } from './pkg-name.js';
|
||||
|
||||
export default function handleError(error: unknown, { debug = false } = {}) {
|
||||
// Coerce Strings to Error instances
|
||||
|
||||
@@ -7,17 +7,17 @@ import fetch, { Headers } from 'node-fetch';
|
||||
import { URLSearchParams } from 'url';
|
||||
import bytes from 'bytes';
|
||||
import chalk from 'chalk';
|
||||
import ua from './ua';
|
||||
import processDeployment from './deploy/process-deployment';
|
||||
import highlight from './output/highlight';
|
||||
import { responseError } from './error';
|
||||
import stamp from './output/stamp';
|
||||
import { APIError, BuildError } from './errors-ts';
|
||||
import printIndications from './print-indications';
|
||||
import { GitMetadata, Org } from '../types';
|
||||
import { VercelConfig } from './dev/types';
|
||||
import Client, { FetchOptions, isJSONObject } from './client';
|
||||
import { Dictionary } from '@vercel/client';
|
||||
import ua from './ua.js';
|
||||
import processDeployment from './deploy/process-deployment.js';
|
||||
import highlight from './output/highlight.js';
|
||||
import { responseError } from './error.js';
|
||||
import stamp from './output/stamp.js';
|
||||
import { APIError, BuildError } from './errors-ts.js';
|
||||
import printIndications from './print-indications.js';
|
||||
import { GitMetadata, Org } from '../types.js';
|
||||
import { VercelConfig } from './dev/types.js';
|
||||
import Client, { FetchOptions, isJSONObject } from './client.js';
|
||||
import type { Dictionary } from '@vercel/client';
|
||||
|
||||
export interface NowOptions {
|
||||
client: Client;
|
||||
@@ -363,6 +363,7 @@ export default class Now extends EventEmitter {
|
||||
if (nextTimestamp) {
|
||||
query.set('until', String(nextTimestamp));
|
||||
}
|
||||
// @ts-ignore
|
||||
const { projects, pagination } = await fetchRetry(
|
||||
`/v4/projects/?${query}`
|
||||
);
|
||||
@@ -370,6 +371,7 @@ export default class Now extends EventEmitter {
|
||||
const deployments = await Promise.all(
|
||||
projects.map(async ({ id: projectId }: any) => {
|
||||
const query = new URLSearchParams({ limit: '1', projectId });
|
||||
// @ts-ignore
|
||||
const { deployments } = await fetchRetry(
|
||||
`/v${version}/now/deployments?${query}`
|
||||
);
|
||||
@@ -377,6 +379,7 @@ export default class Now extends EventEmitter {
|
||||
})
|
||||
);
|
||||
|
||||
// @ts-ignore
|
||||
return { deployments: deployments.filter(x => x), pagination };
|
||||
}
|
||||
|
||||
@@ -435,6 +438,7 @@ export default class Now extends EventEmitter {
|
||||
{ retries: 3, minTimeout: 2500, onRetry: this._onRetry }
|
||||
);
|
||||
|
||||
// @ts-ignore
|
||||
id = deployment.id;
|
||||
}
|
||||
|
||||
@@ -511,21 +515,23 @@ export default class Now extends EventEmitter {
|
||||
delete opts.useCurrentTeam;
|
||||
}
|
||||
|
||||
opts.headers = new Headers(opts.headers);
|
||||
opts.headers.set('accept', 'application/json');
|
||||
const headers = new Headers(opts.headers);
|
||||
headers.set('accept', 'application/json');
|
||||
if (this._token) {
|
||||
opts.headers.set('authorization', `Bearer ${this._token}`);
|
||||
headers.set('authorization', `Bearer ${this._token}`);
|
||||
}
|
||||
opts.headers.set('user-agent', ua);
|
||||
headers.set('user-agent', ua);
|
||||
|
||||
let body;
|
||||
if (isJSONObject(opts.body)) {
|
||||
body = JSON.stringify(opts.body);
|
||||
opts.headers.set('content-type', 'application/json; charset=utf8');
|
||||
headers.set('content-type', 'application/json; charset=utf8');
|
||||
} else {
|
||||
body = opts.body;
|
||||
}
|
||||
|
||||
opts.headers = headers;
|
||||
|
||||
const res = await this._output.time(
|
||||
`${opts.method || 'GET'} ${this._apiUrl}${_url} ${opts.body || ''}`,
|
||||
fetch(`${this._apiUrl}${_url}`, { ...opts, body })
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import Client from '../client';
|
||||
import Client from '../client.js';
|
||||
|
||||
export default async function confirm(
|
||||
client: Client,
|
||||
message: string,
|
||||
preferred: boolean
|
||||
): Promise<boolean> {
|
||||
require('./patch-inquirer');
|
||||
await import('./patch-inquirer.js');
|
||||
|
||||
const answers = await client.prompt({
|
||||
type: 'confirm',
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import inquirer from 'inquirer';
|
||||
import confirm from './confirm';
|
||||
import confirm from './confirm.js';
|
||||
import chalk from 'chalk';
|
||||
import frameworkList, { Framework } from '@vercel/frameworks';
|
||||
import Client from '../client';
|
||||
import { isSettingValue } from '../is-setting-value';
|
||||
import { ProjectSettings } from '../../types';
|
||||
import frameworks, { Framework } from '@vercel/frameworks';
|
||||
import Client from '../client.js';
|
||||
import { isSettingValue } from '../is-setting-value.js';
|
||||
import { ProjectSettings } from '../../types.js';
|
||||
|
||||
const settingMap = {
|
||||
buildCommand: 'Build Command',
|
||||
@@ -67,7 +67,7 @@ export default async function editProjectSettings(
|
||||
|
||||
// If framework is overridden, set it to the `framework` parameter and let the normal framework-flow occur
|
||||
if (localConfigurationOverrides.framework) {
|
||||
const overrideFramework = frameworkList.find(
|
||||
const overrideFramework = frameworks.default.find(
|
||||
f => f.slug === localConfigurationOverrides.framework
|
||||
);
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import inquirer from 'inquirer';
|
||||
import stripAnsi from 'strip-ansi';
|
||||
import Client from '../client';
|
||||
import eraseLines from '../output/erase-lines';
|
||||
import Client from '../client.js';
|
||||
import eraseLines from '../output/erase-lines.js';
|
||||
|
||||
interface ListEntry {
|
||||
name: string;
|
||||
@@ -54,7 +54,7 @@ export default async function list(
|
||||
eraseFinalAnswer = false, // If true, the line with the final answer that inquirer prints will be erased before returning
|
||||
}: ListOptions
|
||||
): Promise<string> {
|
||||
require('./patch-inquirer-legacy');
|
||||
await import('./patch-inquirer-legacy.js');
|
||||
|
||||
let biggestLength = 0;
|
||||
let selected: string | undefined;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import Client from '../client';
|
||||
import getUser from '../get-user';
|
||||
import getTeams from '../teams/get-teams';
|
||||
import { User, Team, Org } from '../../types';
|
||||
import Client from '../client.js';
|
||||
import getUser from '../get-user.js';
|
||||
import getTeams from '../teams/get-teams.js';
|
||||
import { User, Team, Org } from '../../types.js';
|
||||
|
||||
type Choice = { name: string; value: Org };
|
||||
|
||||
@@ -10,7 +10,8 @@ export default async function selectOrg(
|
||||
question: string,
|
||||
autoConfirm?: boolean
|
||||
): Promise<Org> {
|
||||
require('./patch-inquirer');
|
||||
await import('./patch-inquirer.js');
|
||||
|
||||
const {
|
||||
output,
|
||||
config: { currentTeam },
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
import chalk from 'chalk';
|
||||
import ansiEscapes from 'ansi-escapes';
|
||||
// @ts-ignore
|
||||
import ansiRegex from 'ansi-regex';
|
||||
// @ts-ignore
|
||||
import stripAnsi from 'strip-ansi';
|
||||
import eraseLines from '../output/erase-lines';
|
||||
import eraseLines from '../output/erase-lines.js';
|
||||
|
||||
const ESCAPES = {
|
||||
LEFT: '\u001B[D',
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import pkg from '../../package.json';
|
||||
import pkg from './pkg.js';
|
||||
|
||||
export function isCanary() {
|
||||
return pkg.version.includes('canary');
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { URL } from 'url';
|
||||
import Client from '../client';
|
||||
import doOauthLogin from './oauth';
|
||||
import Client from '../client.js';
|
||||
import doOauthLogin from './oauth.js';
|
||||
|
||||
export default function doBitbucketLogin(
|
||||
client: Client,
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import ms from 'ms';
|
||||
import sleep from '../sleep';
|
||||
import highlight from '../output/highlight';
|
||||
import eraseLines from '../output/erase-lines';
|
||||
import verify from './verify';
|
||||
import executeLogin from './login';
|
||||
import Client from '../client';
|
||||
import { LoginResult } from './types';
|
||||
import { isAPIError } from '../errors-ts';
|
||||
import { errorToString } from '../is-error';
|
||||
import sleep from '../sleep.js';
|
||||
import highlight from '../output/highlight.js';
|
||||
import eraseLines from '../output/erase-lines.js';
|
||||
import verify from './verify.js';
|
||||
import executeLogin from './login.js';
|
||||
import Client from '../client.js';
|
||||
import { LoginResult } from './types.js';
|
||||
import { isAPIError } from '../errors-ts.js';
|
||||
import { errorToString } from '../is-error.js';
|
||||
|
||||
export default async function doEmailLogin(
|
||||
client: Client,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { URL } from 'url';
|
||||
import Client from '../client';
|
||||
import doOauthLogin from './oauth';
|
||||
import Client from '../client.js';
|
||||
import doOauthLogin from './oauth.js';
|
||||
|
||||
export default function doGithubLogin(
|
||||
client: Client,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { URL } from 'url';
|
||||
import Client from '../client';
|
||||
import doOauthLogin from './oauth';
|
||||
import Client from '../client.js';
|
||||
import doOauthLogin from './oauth.js';
|
||||
|
||||
export default function doGitlabLogin(
|
||||
client: Client,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import Client from '../client';
|
||||
import { InvalidEmail, AccountNotFound, isAPIError } from '../errors-ts';
|
||||
import { errorToString } from '../is-error';
|
||||
import { LoginData } from './types';
|
||||
import Client from '../client.js';
|
||||
import { InvalidEmail, AccountNotFound, isAPIError } from '../errors-ts.js';
|
||||
import { errorToString } from '../is-error.js';
|
||||
import type { LoginData } from './types.js';
|
||||
|
||||
export default async function login(
|
||||
client: Client,
|
||||
|
||||
@@ -3,13 +3,13 @@ import open from 'open';
|
||||
import { URL } from 'url';
|
||||
import listen from 'async-listen';
|
||||
import isDocker from 'is-docker';
|
||||
import Client from '../client';
|
||||
import prompt, { readInput } from './prompt';
|
||||
import verify from './verify';
|
||||
import highlight from '../output/highlight';
|
||||
import link from '../output/link';
|
||||
import eraseLines from '../output/erase-lines';
|
||||
import { LoginResult } from './types';
|
||||
import Client from '../client.js';
|
||||
import prompt, { readInput } from './prompt.js';
|
||||
import verify from './verify.js';
|
||||
import highlight from '../output/highlight.js';
|
||||
import link from '../output/link.js';
|
||||
import eraseLines from '../output/erase-lines.js';
|
||||
import { LoginResult } from './types.js';
|
||||
|
||||
export default async function doOauthLogin(
|
||||
client: Client,
|
||||
@@ -64,7 +64,7 @@ async function getVerificationTokenInBand(
|
||||
) {
|
||||
const { output } = client;
|
||||
const server = http.createServer();
|
||||
const address = await listen(server, 0, '127.0.0.1');
|
||||
const address = await listen.default(server, 0, '127.0.0.1');
|
||||
const { port } = new URL(address);
|
||||
url.searchParams.set('next', `http://localhost:${port}`);
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import Client from '../client';
|
||||
import error from '../output/error';
|
||||
import listInput from '../input/list';
|
||||
import { getCommandName } from '../pkg-name';
|
||||
import { LoginResult, SAMLError } from './types';
|
||||
import doSamlLogin from './saml';
|
||||
import doEmailLogin from './email';
|
||||
import doGithubLogin from './github';
|
||||
import doGitlabLogin from './gitlab';
|
||||
import doBitbucketLogin from './bitbucket';
|
||||
import Client from '../client.js';
|
||||
import error from '../output/error.js';
|
||||
import listInput from '../input/list.js';
|
||||
import { getCommandName } from '../pkg-name.js';
|
||||
import { LoginResult, SAMLError } from './types.js';
|
||||
import doSamlLogin from './saml.js';
|
||||
import doEmailLogin from './email.js';
|
||||
import doGithubLogin from './github.js';
|
||||
import doGitlabLogin from './gitlab.js';
|
||||
import doBitbucketLogin from './bitbucket.js';
|
||||
|
||||
export default async function prompt(
|
||||
client: Client,
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
import { bold } from 'chalk';
|
||||
import doSamlLogin from './saml';
|
||||
import showLoginPrompt from './prompt';
|
||||
import { LoginResult, SAMLError } from './types';
|
||||
import confirm from '../input/confirm';
|
||||
import Client from '../client';
|
||||
import chalk from 'chalk';
|
||||
import doSamlLogin from './saml.js';
|
||||
import showLoginPrompt from './prompt.js';
|
||||
import { LoginResult, SAMLError } from './types.js';
|
||||
import confirm from '../input/confirm.js';
|
||||
import Client from '../client.js';
|
||||
|
||||
const { bold } = chalk;
|
||||
|
||||
export default async function reauthenticate(
|
||||
client: Client,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { URL } from 'url';
|
||||
import Client from '../client';
|
||||
import doOauthLogin from './oauth';
|
||||
import Client from '../client.js';
|
||||
import doOauthLogin from './oauth.js';
|
||||
|
||||
export default function doSamlLogin(
|
||||
client: Client,
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { URL } from 'url';
|
||||
import Client from '../client';
|
||||
import { hostname } from 'os';
|
||||
import { getTitleName } from '../pkg-name';
|
||||
import { LoginResultSuccess } from './types';
|
||||
import Client from '../client.js';
|
||||
import { getTitleName } from '../pkg-name.js';
|
||||
import type { LoginResultSuccess } from './types.js';
|
||||
|
||||
export default function verify(
|
||||
client: Client,
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
import crypto from 'crypto';
|
||||
import ua from 'universal-analytics';
|
||||
import { getPlatformEnv } from '@vercel/build-utils';
|
||||
import buildUtils from '@vercel/build-utils';
|
||||
|
||||
import userAgent from './ua-browser';
|
||||
import { GA_TRACKING_ID } from './constants';
|
||||
import * as configFiles from './config/files';
|
||||
import userAgent from './ua-browser.js';
|
||||
import { GA_TRACKING_ID } from './constants.js';
|
||||
import * as configFiles from './config/files.js';
|
||||
|
||||
const { getPlatformEnv } = buildUtils;
|
||||
|
||||
const config: any = configFiles.getConfigFilePath();
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import chalk from 'chalk';
|
||||
import chalk, { ChalkInstance } from 'chalk';
|
||||
|
||||
const colors = [
|
||||
chalk.cyan,
|
||||
@@ -9,7 +9,7 @@ const colors = [
|
||||
];
|
||||
|
||||
let childIndex = 0;
|
||||
const packageNameColorCache = new Map<string, chalk.Chalk>();
|
||||
const packageNameColorCache = new Map<string, ChalkInstance>();
|
||||
|
||||
/** Return a consistent (gradient) color for a given package name */
|
||||
export function getColorForPkgName(pkgName: string) {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import chalk from 'chalk';
|
||||
import renderLink from './link';
|
||||
import wait, { StopSpinner } from './wait';
|
||||
import type { WritableTTY } from '../../types';
|
||||
import { errorToString } from '../is-error';
|
||||
import renderLink from './link.js';
|
||||
import wait, { StopSpinner } from './wait.js';
|
||||
import type { WritableTTY } from '../../types.js';
|
||||
import { errorToString } from '../is-error.js';
|
||||
|
||||
export interface OutputOptions {
|
||||
debug?: boolean;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import chalk from 'chalk';
|
||||
import { metrics, shouldCollectMetrics } from '../metrics';
|
||||
import { APIError } from '../errors-ts';
|
||||
import renderLink from './link';
|
||||
import { metrics, shouldCollectMetrics } from '../metrics.js';
|
||||
import { APIError } from '../errors-ts.js';
|
||||
import renderLink from './link.js';
|
||||
|
||||
let metric: ReturnType<typeof metrics>;
|
||||
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
export { Output } from './create-output';
|
||||
export { StopSpinner } from './wait';
|
||||
export { Output } from './create-output.js';
|
||||
export type { StopSpinner } from './wait.js';
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
import { yellow } from 'chalk';
|
||||
import chalk from 'chalk';
|
||||
|
||||
export default (msg: string) => `${yellow('> NOTE:')} ${msg}`;
|
||||
export default (msg: string) => `${chalk.yellow('> NOTE:')} ${msg}`;
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
import { cyan } from 'chalk';
|
||||
import chalk from 'chalk';
|
||||
|
||||
export default (msg: string) => `${cyan('> Ready!')} ${msg}`;
|
||||
export default (msg: string) => `${chalk.cyan('> Ready!')} ${msg}`;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import ora from 'ora';
|
||||
import chalk from 'chalk';
|
||||
import eraseLines from './erase-lines';
|
||||
import eraseLines from './erase-lines.js';
|
||||
|
||||
export interface StopSpinner {
|
||||
(): void;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import title from 'title';
|
||||
import pkg from './pkg';
|
||||
import cmd from './output/cmd';
|
||||
import pkg from './pkg.js';
|
||||
import cmd from './output/cmd.js';
|
||||
|
||||
/**
|
||||
* The package name defined in the CLI's `package.json` file (`vercel`).
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
import fs from 'fs';
|
||||
import { join } from 'path';
|
||||
import { PackageJson } from '@vercel/build-utils';
|
||||
import { fileURLToPath, URL } from 'url';
|
||||
|
||||
const __dirname = fileURLToPath(new URL('.', import.meta.url));
|
||||
|
||||
let rootDir = __dirname;
|
||||
while (!fs.existsSync(join(rootDir, 'package.json'))) {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import chalk from 'chalk';
|
||||
import { Response } from 'node-fetch';
|
||||
import Client from './client';
|
||||
import linkStyle from './output/link';
|
||||
import { emoji, EmojiLabel, prependEmoji } from './emoji';
|
||||
import Client from './client.js';
|
||||
import linkStyle from './output/link.js';
|
||||
import { emoji, EmojiLabel, prependEmoji } from './emoji.js';
|
||||
|
||||
export default function printIndications(client: Client, res: Response) {
|
||||
const indications = new Set(['warning', 'notice', 'tip']);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import fs from 'fs-extra';
|
||||
import { CantParseJSONFile } from './errors-ts';
|
||||
import { CantParseJSONFile } from './errors-ts.js';
|
||||
|
||||
export default async function readJSONFile<T>(
|
||||
file: string
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import Client from './client';
|
||||
import getScope from './get-scope';
|
||||
import getArgs from './get-args';
|
||||
import { isError } from './is-error';
|
||||
import type { Team, User } from '../types';
|
||||
import Client from './client.js';
|
||||
import getScope from './get-scope.js';
|
||||
import getArgs from './get-args.js';
|
||||
import { isError } from './is-error.js';
|
||||
import type { Team, User } from '../types.js';
|
||||
|
||||
export default async function reportError(
|
||||
sentry: typeof import('@sentry/node'),
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Response } from 'node-fetch';
|
||||
import { APIError } from './errors-ts';
|
||||
import { APIError } from './errors-ts.js';
|
||||
|
||||
export default async function responseError(
|
||||
res: Response,
|
||||
@@ -9,7 +9,7 @@ export default async function responseError(
|
||||
let bodyError;
|
||||
|
||||
if (!res.ok) {
|
||||
let body;
|
||||
let body: any;
|
||||
|
||||
try {
|
||||
body = await res.json();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { URLSearchParams } from 'url';
|
||||
import Client from '../client';
|
||||
import { Team } from '../../types';
|
||||
import { APIError, InvalidToken } from '../errors-ts';
|
||||
import Client from '../client.js';
|
||||
import { Team } from '../../types.js';
|
||||
import { APIError, InvalidToken } from '../errors-ts.js';
|
||||
|
||||
export interface GetTeamsV1Options {
|
||||
apiVersion?: 1;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import os from 'os';
|
||||
import pkg from './pkg';
|
||||
import pkg from './pkg.js';
|
||||
|
||||
export default `${pkg.name} ${pkg.version} node-${
|
||||
process.version
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
// Register Jest matcher extensions for CLI unit tests
|
||||
import './matchers';
|
||||
import './matchers/index.js';
|
||||
|
||||
import chalk from 'chalk';
|
||||
import { PassThrough } from 'stream';
|
||||
import { createServer, Server } from 'http';
|
||||
import express, { Express, Router } from 'express';
|
||||
import listen from 'async-listen';
|
||||
import Client from '../../src/util/client';
|
||||
import { Output } from '../../src/util/output';
|
||||
import Client from '../../src/util/client.js';
|
||||
import { Output } from '../../src/util/output/index.js';
|
||||
|
||||
// Disable colors in `chalk` so that tests don't need
|
||||
// to worry about ANSI codes
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
/// <reference types="@types/jest" />
|
||||
|
||||
import * as matchers from './matchers';
|
||||
import * as matchers from './matchers.js';
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
type Tail<T extends unknown[]> = T extends [infer _Head, ...infer Tail]
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import fetch from 'node-fetch';
|
||||
import listen from 'async-listen';
|
||||
import { createServer, IncomingMessage, Server, ServerResponse } from 'http';
|
||||
import { JSONValue } from '../../../src/types';
|
||||
import { JSONValue } from '../../../src/types.js';
|
||||
import {
|
||||
responseError,
|
||||
responseErrorMessage,
|
||||
toEnumerableError,
|
||||
} from '../../../src/util/error';
|
||||
} from '../../../src/util/error.js';
|
||||
|
||||
const send = (res: ServerResponse, statusCode: number, body: JSONValue) => {
|
||||
res.statusCode = statusCode;
|
||||
@@ -22,7 +22,7 @@ describe('responseError()', () => {
|
||||
|
||||
beforeAll(async () => {
|
||||
server = createServer((req, res) => handler(req, res));
|
||||
url = await listen(server);
|
||||
url = await listen.default(server);
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import getProjectName from '../../../src/util/get-project-name';
|
||||
import getProjectName from '../../../src/util/get-project-name.js';
|
||||
|
||||
describe('getProjectName', () => {
|
||||
it('should work with argv', () => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Framework, frameworks } from '@vercel/frameworks';
|
||||
import editProjectSettings from '../../../../src/util/input/edit-project-settings';
|
||||
import { client } from '../../../mocks/client';
|
||||
import editProjectSettings from '../../../../src/util/input/edit-project-settings.js';
|
||||
import { client } from '../../../mocks/client.js';
|
||||
|
||||
const otherFramework = frameworks.find(
|
||||
fwk => fwk.name === 'Other'
|
||||
|
||||
@@ -3,12 +3,13 @@
|
||||
"strict": true,
|
||||
"noEmitOnError": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"moduleResolution": "node",
|
||||
"module": "commonjs",
|
||||
"moduleResolution": "Node16",
|
||||
"module": "Node16",
|
||||
"target": "ES2020",
|
||||
"esModuleInterop": true,
|
||||
"allowJs": true,
|
||||
"lib": ["ES2020"],
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"resolveJsonModule": true,
|
||||
"sourceMap": true,
|
||||
"outDir": "./dist",
|
||||
@@ -16,6 +17,7 @@
|
||||
},
|
||||
"include": ["./types", "src/**/*"],
|
||||
"ts-node": {
|
||||
"esm": true,
|
||||
"swc": true // https://typestrong.org/ts-node/docs/swc/
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
"@types/node-fetch": "^2.3.0",
|
||||
"@types/tar": "^4.0.0",
|
||||
"@vercel/build-utils": "5.0.4",
|
||||
"@vercel/ncc": "0.24.0",
|
||||
"@vercel/ncc": "0.34.0",
|
||||
"async-retry": "1.3.1",
|
||||
"execa": "^1.0.0",
|
||||
"fs-extra": "^7.0.0",
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
"@types/jest": "27.4.1",
|
||||
"@types/node-fetch": "^2.6.1",
|
||||
"@types/test-listen": "1.1.0",
|
||||
"@vercel/ncc": "0.24.0",
|
||||
"@vercel/ncc": "0.34.0",
|
||||
"@vercel/nft": "0.21.0",
|
||||
"content-type": "1.0.4",
|
||||
"cookie": "0.4.0",
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
"@types/execa": "^0.9.0",
|
||||
"@types/jest": "27.4.1",
|
||||
"@vercel/build-utils": "5.0.4",
|
||||
"@vercel/ncc": "0.24.0",
|
||||
"@vercel/ncc": "0.34.0",
|
||||
"execa": "^1.0.0",
|
||||
"typescript": "4.3.4"
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
"@types/fs-extra": "8.0.0",
|
||||
"@types/semver": "6.0.0",
|
||||
"@vercel/build-utils": "5.0.4",
|
||||
"@vercel/ncc": "0.24.0",
|
||||
"@vercel/ncc": "0.34.0",
|
||||
"execa": "2.0.4",
|
||||
"fs-extra": "^7.0.1",
|
||||
"semver": "6.1.1",
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
"@types/promise-timeout": "1.3.0",
|
||||
"@vercel/build-utils": "5.0.4",
|
||||
"@vercel/frameworks": "1.1.1",
|
||||
"@vercel/ncc": "0.24.0",
|
||||
"@vercel/ncc": "0.34.0",
|
||||
"@vercel/routing-utils": "2.0.0",
|
||||
"fs-extra": "10.0.0",
|
||||
"get-port": "5.0.0",
|
||||
|
||||
Reference in New Issue
Block a user