mirror of
https://github.com/LukeHagar/vercel.git
synced 2025-12-11 12:57:46 +00:00
Compare commits
43 Commits
api@0.0.1
...
esbuild-py
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9019810288 | ||
|
|
5e4a8aff34 | ||
|
|
55d574cd26 | ||
|
|
18cdcf35d3 | ||
|
|
d2ce05ba27 | ||
|
|
3f5f368b19 | ||
|
|
98ee6e4728 | ||
|
|
d7db0c5794 | ||
|
|
e90e922ee8 | ||
|
|
adb9ac87ce | ||
|
|
48520ff329 | ||
|
|
10c3251b95 | ||
|
|
e43191b186 | ||
|
|
bdd8958895 | ||
|
|
a962e84409 | ||
|
|
2d4d87e7dc | ||
|
|
7593e219fd | ||
|
|
a94450d78e | ||
|
|
ec95066689 | ||
|
|
52e0c01cf5 | ||
|
|
65ecb16b04 | ||
|
|
42a71416b9 | ||
|
|
6ce38c4cc8 | ||
|
|
a27cfd661b | ||
|
|
6523ab43b2 | ||
|
|
80af30ce60 | ||
|
|
102a83f1b5 | ||
|
|
93c5a2b182 | ||
|
|
323a8d7122 | ||
|
|
4ab1720df2 | ||
|
|
6495dd150e | ||
|
|
1d69870141 | ||
|
|
2eee17de24 | ||
|
|
e62b3da5a7 | ||
|
|
74a15b5f32 | ||
|
|
c0416f7e95 | ||
|
|
fc1e13c099 | ||
|
|
0e9ec194a3 | ||
|
|
5609a1187b | ||
|
|
cff72e3129 | ||
|
|
d3c84e5d2a | ||
|
|
9e3827c785 | ||
|
|
fb6d77afac |
5
.changeset/brown-wasps-exercise.md
Normal file
5
.changeset/brown-wasps-exercise.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@vercel/build-utils": patch
|
||||
---
|
||||
|
||||
add descriptions to NodeVersion properties
|
||||
2
.changeset/dry-masks-thank.md
Normal file
2
.changeset/dry-masks-thank.md
Normal file
@@ -0,0 +1,2 @@
|
||||
---
|
||||
---
|
||||
5
.changeset/eighty-rockets-help.md
Normal file
5
.changeset/eighty-rockets-help.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'vercel': patch
|
||||
---
|
||||
|
||||
Migrates the vc env command to the command data structure for use in the help output.
|
||||
5
.changeset/five-bananas-joke.md
Normal file
5
.changeset/five-bananas-joke.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'vercel': patch
|
||||
---
|
||||
|
||||
Update domains command to new structure
|
||||
5
.changeset/happy-rivers-rule.md
Normal file
5
.changeset/happy-rivers-rule.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"vercel": patch
|
||||
---
|
||||
|
||||
migrate `rollback` command structure for help output
|
||||
5
.changeset/lucky-roses-pump.md
Normal file
5
.changeset/lucky-roses-pump.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"vercel": patch
|
||||
---
|
||||
|
||||
migrate `inti` command structure for help output
|
||||
5
.changeset/metal-ties-shop.md
Normal file
5
.changeset/metal-ties-shop.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'vercel': patch
|
||||
---
|
||||
|
||||
Remove mri workaround
|
||||
5
.changeset/modern-avocados-double.md
Normal file
5
.changeset/modern-avocados-double.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"vercel": patch
|
||||
---
|
||||
|
||||
migrate dev command structure for help output
|
||||
2
.changeset/odd-olives-share.md
Normal file
2
.changeset/odd-olives-share.md
Normal file
@@ -0,0 +1,2 @@
|
||||
---
|
||||
---
|
||||
5
.changeset/pink-carpets-perform.md
Normal file
5
.changeset/pink-carpets-perform.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@vercel/next": patch
|
||||
---
|
||||
|
||||
fix 404 enoent for i18n
|
||||
5
.changeset/seven-waves-search.md
Normal file
5
.changeset/seven-waves-search.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'vercel': patch
|
||||
---
|
||||
|
||||
Migrate `vc secrets` to new help command structure
|
||||
5
.changeset/small-points-type.md
Normal file
5
.changeset/small-points-type.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"vercel": patch
|
||||
---
|
||||
|
||||
migrate `promote` command structure for help output
|
||||
5
.changeset/smooth-gifts-suffer.md
Normal file
5
.changeset/smooth-gifts-suffer.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@vercel/node": patch
|
||||
---
|
||||
|
||||
remove console.log
|
||||
5
.changeset/stupid-paws-press.md
Normal file
5
.changeset/stupid-paws-press.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"examples": patch
|
||||
---
|
||||
|
||||
update examples to use at least node@16
|
||||
5
.changeset/stupid-vans-leave.md
Normal file
5
.changeset/stupid-vans-leave.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"vercel": patch
|
||||
---
|
||||
|
||||
migrate `git` command structure for help output
|
||||
5
.changeset/tidy-ducks-dream.md
Normal file
5
.changeset/tidy-ducks-dream.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'vercel': patch
|
||||
---
|
||||
|
||||
Update project command to new data structure
|
||||
@@ -30,6 +30,6 @@
|
||||
"wct-browser-legacy": "^1.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8.0"
|
||||
"node": ">=16.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
"extends": "@redwoodjs/eslint-config"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12",
|
||||
"node": "16.x",
|
||||
"yarn": ">=1.15"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,6 +27,6 @@
|
||||
"typescript": "^5.1.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14"
|
||||
"node": ">=16"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,6 +46,6 @@
|
||||
]
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8.0.0 <17"
|
||||
"node": "16.x"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
"build": "vuepress build src"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14.0.0 <18.0.0"
|
||||
"node": ">=16.0.0 <18.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"vuepress": "1.9.7"
|
||||
|
||||
@@ -8,7 +8,9 @@
|
||||
"dist"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "tsc",
|
||||
"build": "run-p build:*",
|
||||
"build:js": "node ../../scripts/esbuild.mjs",
|
||||
"build:types": "tsc",
|
||||
"test": "jest --reporters=default --reporters=jest-junit --env node --verbose --runInBand --bail",
|
||||
"test-unit": "pnpm test tests/unit"
|
||||
},
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
{
|
||||
"extends": "@vercel-internals/tsconfig",
|
||||
"compilerOptions": {
|
||||
"outDir": "dist"
|
||||
"outDir": "dist",
|
||||
"declaration": true,
|
||||
"emitDeclarationOnly": true
|
||||
},
|
||||
"include": ["src/**/*"]
|
||||
}
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
# @vercel-internals/types
|
||||
|
||||
## 1.0.8
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`9e3827c78`](https://github.com/vercel/vercel/commit/9e3827c785e1bc45f2bed421132167381481770f)]:
|
||||
- @vercel/build-utils@7.1.0
|
||||
|
||||
## 1.0.7
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"private": true,
|
||||
"name": "@vercel-internals/types",
|
||||
"version": "1.0.7",
|
||||
"version": "1.0.8",
|
||||
"types": "index.d.ts",
|
||||
"main": "index.d.ts",
|
||||
"files": [
|
||||
@@ -10,7 +10,7 @@
|
||||
"dependencies": {
|
||||
"@types/node": "14.14.31",
|
||||
"@vercel-internals/constants": "1.0.4",
|
||||
"@vercel/build-utils": "7.0.0",
|
||||
"@vercel/build-utils": "7.1.0",
|
||||
"@vercel/routing-utils": "3.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
"buffer-replace": "1.0.0",
|
||||
"create-svelte": "2.0.1",
|
||||
"dot": "1.1.3",
|
||||
"esbuild": "0.19.2",
|
||||
"eslint": "8.14.0",
|
||||
"eslint-config-prettier": "8.5.0",
|
||||
"eslint-plugin-jest": "26.1.5",
|
||||
@@ -28,11 +29,12 @@
|
||||
"lint-staged": "9.2.5",
|
||||
"node-fetch": "2.6.7",
|
||||
"npm-package-arg": "6.1.0",
|
||||
"npm-run-all": "4.1.5",
|
||||
"prettier": "2.6.2",
|
||||
"source-map-support": "0.5.12",
|
||||
"ts-eager": "2.0.2",
|
||||
"ts-jest": "29.1.0",
|
||||
"turbo": "1.10.12",
|
||||
"turbo": "1.10.13",
|
||||
"typescript": "4.9.5"
|
||||
},
|
||||
"scripts": {
|
||||
@@ -49,7 +51,7 @@
|
||||
"prepare": "husky install",
|
||||
"pack": "cd utils && node -r ts-eager/register ./pack.ts",
|
||||
"ci:version": "changeset version && pnpm install --no-frozen-lockfile",
|
||||
"ci:publish": "pnpm publish -r && changeset tag"
|
||||
"ci:publish": "pnpm publish -r && node utils/update-canary-tags.mjs && changeset tag"
|
||||
},
|
||||
"lint-staged": {
|
||||
"./{*,{api,packages,test,utils}/**/*}.{js,ts}": [
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
# @vercel/build-utils
|
||||
|
||||
## 7.1.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- Support serverless function architecture ([#10392](https://github.com/vercel/vercel/pull/10392))
|
||||
|
||||
## 7.0.0
|
||||
|
||||
### Major Changes
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
const fs = require('fs-extra');
|
||||
const execa = require('execa');
|
||||
const { join } = require('path');
|
||||
|
||||
async function main() {
|
||||
const outDir = join(__dirname, 'dist');
|
||||
|
||||
// Start fresh
|
||||
await fs.remove(outDir);
|
||||
|
||||
// Compile TypeScript
|
||||
await execa('tsc', [], { stdio: 'inherit' });
|
||||
|
||||
// Run `ncc`
|
||||
const mainDir = join(outDir, 'main');
|
||||
await execa('ncc', ['build', 'src/index.ts', '-o', mainDir], {
|
||||
stdio: 'inherit',
|
||||
});
|
||||
// Move compiled ncc file to out dir
|
||||
await fs.rename(join(mainDir, 'index.js'), join(outDir, 'index.js'));
|
||||
|
||||
// Delete leftover "main" dir
|
||||
await fs.remove(mainDir);
|
||||
}
|
||||
|
||||
main().catch(err => {
|
||||
console.error(err);
|
||||
process.exit(1);
|
||||
});
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@vercel/build-utils",
|
||||
"version": "7.0.0",
|
||||
"version": "7.1.0",
|
||||
"license": "Apache-2.0",
|
||||
"main": "./dist/index.js",
|
||||
"types": "./dist/index.d.js",
|
||||
@@ -11,7 +11,11 @@
|
||||
"directory": "packages/now-build-utils"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "node build",
|
||||
"build": "run-p build:js build:types",
|
||||
"build:js": "run-s build:single build:bundle",
|
||||
"build:single": "node ../../scripts/esbuild.mjs",
|
||||
"build:bundle": "node ../../scripts/esbuild.mjs --bundle",
|
||||
"build:types": "tsc",
|
||||
"test": "jest --reporters=default --reporters=jest-junit --env node --verbose --runInBand --bail",
|
||||
"test-unit": "pnpm test test/unit.*test.*",
|
||||
"test-e2e": "pnpm test test/integration.test.ts"
|
||||
|
||||
@@ -13,9 +13,12 @@ interface Environment {
|
||||
|
||||
export type LambdaOptions = LambdaOptionsWithFiles | LambdaOptionsWithZipBuffer;
|
||||
|
||||
export type LambdaArchitecture = 'x86_64' | 'arm64';
|
||||
|
||||
export interface LambdaOptionsBase {
|
||||
handler: string;
|
||||
runtime: string;
|
||||
architecture?: LambdaArchitecture;
|
||||
memory?: number;
|
||||
maxDuration?: number;
|
||||
environment?: Environment;
|
||||
@@ -62,6 +65,7 @@ export class Lambda {
|
||||
files?: Files;
|
||||
handler: string;
|
||||
runtime: string;
|
||||
architecture?: LambdaArchitecture;
|
||||
memory?: number;
|
||||
maxDuration?: number;
|
||||
environment: Environment;
|
||||
@@ -81,6 +85,7 @@ export class Lambda {
|
||||
handler,
|
||||
runtime,
|
||||
maxDuration,
|
||||
architecture,
|
||||
memory,
|
||||
environment = {},
|
||||
allowQuery,
|
||||
@@ -102,6 +107,13 @@ export class Lambda {
|
||||
assert(typeof runtime === 'string', '"runtime" is not a string');
|
||||
assert(typeof environment === 'object', '"environment" is not an object');
|
||||
|
||||
if (architecture !== undefined) {
|
||||
assert(
|
||||
architecture === 'x86_64' || architecture === 'arm64',
|
||||
'"architecture" must be either "x86_64" or "arm64"'
|
||||
);
|
||||
}
|
||||
|
||||
if (memory !== undefined) {
|
||||
assert(typeof memory === 'number', '"memory" is not a number');
|
||||
}
|
||||
@@ -159,6 +171,7 @@ export class Lambda {
|
||||
this.files = 'files' in opts ? opts.files : undefined;
|
||||
this.handler = handler;
|
||||
this.runtime = runtime;
|
||||
this.architecture = architecture;
|
||||
this.memory = memory;
|
||||
this.maxDuration = maxDuration;
|
||||
this.environment = environment;
|
||||
|
||||
@@ -300,9 +300,13 @@ export interface PackageJson {
|
||||
}
|
||||
|
||||
export interface NodeVersion {
|
||||
/** major version number: 18 */
|
||||
major: number;
|
||||
/** major version range: "18.x" */
|
||||
range: string;
|
||||
/** runtime descriptor: "nodejs18.x" */
|
||||
runtime: string;
|
||||
/** date beyond which this version is discontinued: 2023-08-17T19:05:45.951Z */
|
||||
discontinueDate?: Date;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"declaration": true,
|
||||
"emitDeclarationOnly": true,
|
||||
"esModuleInterop": true,
|
||||
"lib": ["ES2021"],
|
||||
"module": "commonjs",
|
||||
|
||||
@@ -1,5 +1,19 @@
|
||||
# vercel
|
||||
|
||||
## 32.1.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- Improve error messages for JSON parse failures ([#10396](https://github.com/vercel/vercel/pull/10396))
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`9e3827c78`](https://github.com/vercel/vercel/commit/9e3827c785e1bc45f2bed421132167381481770f)]:
|
||||
- @vercel/build-utils@7.1.0
|
||||
- @vercel/node@3.0.3
|
||||
- @vercel/remix-builder@2.0.2
|
||||
- @vercel/static-build@2.0.3
|
||||
|
||||
## 32.0.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "vercel",
|
||||
"version": "32.0.2",
|
||||
"version": "32.1.0",
|
||||
"preferGlobal": true,
|
||||
"license": "Apache-2.0",
|
||||
"description": "The command-line interface for Vercel",
|
||||
@@ -31,16 +31,16 @@
|
||||
"node": ">= 16"
|
||||
},
|
||||
"dependencies": {
|
||||
"@vercel/build-utils": "7.0.0",
|
||||
"@vercel/build-utils": "7.1.0",
|
||||
"@vercel/go": "3.0.0",
|
||||
"@vercel/hydrogen": "1.0.0",
|
||||
"@vercel/next": "4.0.1",
|
||||
"@vercel/node": "3.0.2",
|
||||
"@vercel/node": "3.0.3",
|
||||
"@vercel/python": "4.0.0",
|
||||
"@vercel/redwood": "2.0.0",
|
||||
"@vercel/remix-builder": "2.0.1",
|
||||
"@vercel/remix-builder": "2.0.2",
|
||||
"@vercel/ruby": "2.0.0",
|
||||
"@vercel/static-build": "2.0.2"
|
||||
"@vercel/static-build": "2.0.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@alex_neo/jest-expect-message": "1.0.5",
|
||||
@@ -64,6 +64,7 @@
|
||||
"@types/inquirer": "7.3.1",
|
||||
"@types/jest": "27.4.1",
|
||||
"@types/jest-expect-message": "1.0.3",
|
||||
"@types/json-parse-better-errors": "1.0.0",
|
||||
"@types/load-json-file": "2.0.7",
|
||||
"@types/mime-types": "2.1.0",
|
||||
"@types/minimatch": "3.0.3",
|
||||
@@ -85,8 +86,8 @@
|
||||
"@types/yauzl-promise": "2.1.0",
|
||||
"@vercel-internals/constants": "1.0.4",
|
||||
"@vercel-internals/get-package-json": "1.0.0",
|
||||
"@vercel-internals/types": "1.0.7",
|
||||
"@vercel/client": "13.0.0",
|
||||
"@vercel-internals/types": "1.0.8",
|
||||
"@vercel/client": "13.0.1",
|
||||
"@vercel/error-utils": "2.0.1",
|
||||
"@vercel/frameworks": "2.0.1",
|
||||
"@vercel/fs-detectors": "5.0.1",
|
||||
@@ -135,6 +136,7 @@
|
||||
"jaro-winkler": "0.2.8",
|
||||
"jest-junit": "16.0.0",
|
||||
"jest-matcher-utils": "29.3.1",
|
||||
"json-parse-better-errors": "1.0.2",
|
||||
"jsonlines": "0.1.1",
|
||||
"line-async-iterator": "3.0.0",
|
||||
"load-json-file": "3.0.0",
|
||||
|
||||
34
packages/cli/src/commands/dev/command.ts
Normal file
34
packages/cli/src/commands/dev/command.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
import { Command } from '../help';
|
||||
import { packageName } from '../../util/pkg-name';
|
||||
|
||||
export const devCommand: Command = {
|
||||
name: 'dev',
|
||||
description: `Starts the \`${packageName} dev\` server.`,
|
||||
arguments: [
|
||||
{
|
||||
name: 'dir',
|
||||
required: false,
|
||||
},
|
||||
],
|
||||
options: [
|
||||
{
|
||||
name: 'listen',
|
||||
description: 'Specify a URI endpoint on which to listen [0.0.0.0:3000]',
|
||||
argument: 'uri',
|
||||
shorthand: null,
|
||||
type: 'string',
|
||||
deprecated: false,
|
||||
multi: false,
|
||||
},
|
||||
],
|
||||
examples: [
|
||||
{
|
||||
name: `Start the \`${packageName} dev\` server on port 8080`,
|
||||
value: `${packageName} dev --listen 8080`,
|
||||
},
|
||||
{
|
||||
name: 'Make the `vercel dev` server bind to localhost on port 5000',
|
||||
value: `${packageName} dev --listen 127.0.0.1:5000 `,
|
||||
},
|
||||
],
|
||||
};
|
||||
@@ -12,43 +12,16 @@ import highlight from '../../util/output/highlight';
|
||||
import dev from './dev';
|
||||
import readConfig from '../../util/config/read-config';
|
||||
import readJSONFile from '../../util/read-json-file';
|
||||
import { packageName, getCommandName, logo } from '../../util/pkg-name';
|
||||
import { packageName, getCommandName } from '../../util/pkg-name';
|
||||
import { CantParseJSONFile } from '../../util/errors-ts';
|
||||
import { isErrnoException } from '@vercel/error-utils';
|
||||
import { help } from '../help';
|
||||
import { devCommand } from './command';
|
||||
|
||||
const COMMAND_CONFIG = {
|
||||
dev: ['dev'],
|
||||
};
|
||||
|
||||
const help = () => {
|
||||
console.log(`
|
||||
${chalk.bold(`${logo} ${packageName} dev`)} [options] <dir>
|
||||
|
||||
Starts the \`${packageName} dev\` server.
|
||||
|
||||
${chalk.dim('Options:')}
|
||||
|
||||
-h, --help Output usage information
|
||||
-d, --debug Debug mode [off]
|
||||
--no-color No color mode [off]
|
||||
-l, --listen [uri] Specify a URI endpoint on which to listen [0.0.0.0:3000]
|
||||
-t, --token [token] Specify an Authorization Token
|
||||
-y, --yes Skip questions when setting up new project using default scope and settings
|
||||
|
||||
${chalk.dim('Examples:')}
|
||||
|
||||
${chalk.gray('–')} Start the \`${packageName} dev\` server on port 8080
|
||||
|
||||
${chalk.cyan(`$ ${packageName} dev --listen 8080`)}
|
||||
|
||||
${chalk.gray(
|
||||
'–'
|
||||
)} Make the \`vercel dev\` server bind to localhost on port 5000
|
||||
|
||||
${chalk.cyan(`$ ${packageName} dev --listen 127.0.0.1:5000`)}
|
||||
`);
|
||||
};
|
||||
|
||||
export default async function main(client: Client) {
|
||||
if (process.env.__VERCEL_DEV_RUNNING) {
|
||||
client.output.error(
|
||||
@@ -100,7 +73,7 @@ export default async function main(client: Client) {
|
||||
}
|
||||
|
||||
if (argv['--help']) {
|
||||
help();
|
||||
client.output.print(help(devCommand, { columns: client.stderr.columns }));
|
||||
return 2;
|
||||
}
|
||||
|
||||
@@ -118,7 +91,7 @@ export default async function main(client: Client) {
|
||||
const pkg = await readJSONFile<PackageJson>(path.join(dir, 'package.json'));
|
||||
|
||||
if (pkg instanceof CantParseJSONFile) {
|
||||
client.output.error('Could not parse package.json');
|
||||
client.output.error(pkg.message);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
153
packages/cli/src/commands/domains/command.ts
Normal file
153
packages/cli/src/commands/domains/command.ts
Normal file
@@ -0,0 +1,153 @@
|
||||
import { Command } from '../help';
|
||||
import { packageName } from '../../util/pkg-name';
|
||||
|
||||
export const domainsCommand: Command = {
|
||||
name: 'domains',
|
||||
description: 'Manage domains',
|
||||
arguments: [
|
||||
{
|
||||
name: 'command',
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
subcommands: [
|
||||
{
|
||||
name: 'ls',
|
||||
description: 'Show all domains in a list',
|
||||
arguments: [],
|
||||
options: [],
|
||||
examples: [],
|
||||
},
|
||||
{
|
||||
name: 'inspect',
|
||||
description: 'Displays information related to a domain',
|
||||
arguments: [
|
||||
{
|
||||
name: 'name',
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
options: [],
|
||||
examples: [],
|
||||
},
|
||||
{
|
||||
name: 'add',
|
||||
description: 'Add a new domain that you already own',
|
||||
arguments: [
|
||||
{
|
||||
name: 'name',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
name: 'project',
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
options: [],
|
||||
examples: [],
|
||||
},
|
||||
{
|
||||
name: 'rm',
|
||||
description: 'Remove a domain',
|
||||
arguments: [
|
||||
{
|
||||
name: 'name',
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
options: [],
|
||||
examples: [],
|
||||
},
|
||||
{
|
||||
name: 'buy',
|
||||
description: "Buy a domain that you don't yet own",
|
||||
arguments: [
|
||||
{
|
||||
name: 'name',
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
options: [],
|
||||
examples: [],
|
||||
},
|
||||
{
|
||||
name: 'move',
|
||||
description: 'Move a domain to another user or team',
|
||||
arguments: [
|
||||
{
|
||||
name: 'name',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
name: 'destination',
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
options: [],
|
||||
examples: [],
|
||||
},
|
||||
{
|
||||
name: 'transfer-in',
|
||||
description: 'Transfer in a domain to Vercel',
|
||||
arguments: [
|
||||
{
|
||||
name: 'name',
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
options: [],
|
||||
examples: [],
|
||||
},
|
||||
],
|
||||
options: [
|
||||
{
|
||||
name: 'next',
|
||||
description: 'Show next page of results',
|
||||
shorthand: 'N',
|
||||
type: 'string',
|
||||
deprecated: false,
|
||||
multi: false,
|
||||
},
|
||||
{
|
||||
name: 'yes',
|
||||
description: 'Skip the confirmation prompt when removing a domain',
|
||||
shorthand: 'y',
|
||||
type: 'boolean',
|
||||
deprecated: false,
|
||||
multi: false,
|
||||
},
|
||||
{
|
||||
name: 'limit',
|
||||
shorthand: 'n',
|
||||
description:
|
||||
'Number of results to return per page (default: 20, max: 100)',
|
||||
argument: 'NUMBER',
|
||||
type: 'string',
|
||||
deprecated: false,
|
||||
multi: false,
|
||||
},
|
||||
{
|
||||
name: 'force',
|
||||
shorthand: 'f',
|
||||
type: 'boolean',
|
||||
deprecated: false,
|
||||
description:
|
||||
'Force a domain on a project and remove it from an existing one',
|
||||
multi: false,
|
||||
},
|
||||
],
|
||||
examples: [
|
||||
{
|
||||
name: 'Add a domain that you already own',
|
||||
value: [
|
||||
`${packageName} domains add domain-name.com`,
|
||||
"Make sure the domain's DNS nameservers are at least 2 of the ones listed on https://vercel.com/edge-network",
|
||||
`NOTE: Running ${packageName} alias will automatically register your domain if it's configured with these nameservers (no need to 'domains add')`,
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'Paginate results, where `1584722256178` is the time in milliseconds since the UNIX epoch',
|
||||
value: `${packageName} domains ls--next 1584722256178`,
|
||||
},
|
||||
],
|
||||
};
|
||||
@@ -1,5 +1,3 @@
|
||||
import chalk from 'chalk';
|
||||
|
||||
import Client from '../../util/client';
|
||||
import getArgs from '../../util/get-args';
|
||||
import getSubcommand from '../../util/get-subcommand';
|
||||
@@ -11,69 +9,8 @@ import inspect from './inspect';
|
||||
import ls from './ls';
|
||||
import rm from './rm';
|
||||
import move from './move';
|
||||
import { packageName, logo } from '../../util/pkg-name';
|
||||
|
||||
const help = () => {
|
||||
console.log(`
|
||||
${chalk.bold(`${logo} ${packageName} domains`)} [options] <command>
|
||||
|
||||
${chalk.dim('Commands:')}
|
||||
|
||||
ls Show all domains in a list
|
||||
inspect [name] Displays information related to a domain
|
||||
add [name] [project] Add a new domain that you already own
|
||||
rm [name] Remove a domain
|
||||
buy [name] Buy a domain that you don't yet own
|
||||
move [name] [destination] Move a domain to another user or team.
|
||||
transfer-in [name] Transfer in a domain to Vercel
|
||||
|
||||
${chalk.dim('Options:')}
|
||||
|
||||
-h, --help Output usage information
|
||||
-d, --debug Debug mode [off]
|
||||
--no-color No color mode [off]
|
||||
-f, --force Force a domain on a project and remove it from an existing one
|
||||
-A ${chalk.bold.underline('FILE')}, --local-config=${chalk.bold.underline(
|
||||
'FILE'
|
||||
)} Path to the local ${'`vercel.json`'} file
|
||||
-Q ${chalk.bold.underline('DIR')}, --global-config=${chalk.bold.underline(
|
||||
'DIR'
|
||||
)} Path to the global ${'`.vercel`'} directory
|
||||
-t ${chalk.bold.underline('TOKEN')}, --token=${chalk.bold.underline(
|
||||
'TOKEN'
|
||||
)} Login token
|
||||
-S, --scope Set a custom scope
|
||||
-N, --next Show next page of results
|
||||
--limit=${chalk.bold.underline(
|
||||
'VALUE'
|
||||
)} Number of results to return per page (default: 20, max: 100)
|
||||
-y, --yes Skip the confirmation prompt when removing a domain
|
||||
|
||||
${chalk.dim('Examples:')}
|
||||
|
||||
${chalk.gray('–')} Add a domain that you already own
|
||||
|
||||
${chalk.cyan(
|
||||
`$ ${packageName} domains add ${chalk.underline('domain-name.com')}`
|
||||
)}
|
||||
|
||||
Make sure the domain's DNS nameservers are at least 2 of the
|
||||
ones listed on ${chalk.underline('https://vercel.com/edge-network')}.
|
||||
|
||||
${chalk.yellow('NOTE:')} Running ${chalk.dim(
|
||||
`${packageName} alias`
|
||||
)} will automatically register your domain
|
||||
if it's configured with these nameservers (no need to ${chalk.dim(
|
||||
'`domain add`'
|
||||
)}).
|
||||
|
||||
${chalk.gray('–')} Paginate results, where ${chalk.dim(
|
||||
'`1584722256178`'
|
||||
)} is the time in milliseconds since the UNIX epoch.
|
||||
|
||||
${chalk.cyan(`$ ${packageName} domains ls --next 1584722256178`)}
|
||||
`);
|
||||
};
|
||||
import { domainsCommand } from './command';
|
||||
import { help } from '../help';
|
||||
|
||||
const COMMAND_CONFIG = {
|
||||
add: ['add'],
|
||||
@@ -104,7 +41,9 @@ export default async function main(client: Client) {
|
||||
}
|
||||
|
||||
if (argv['--help']) {
|
||||
help();
|
||||
client.output.print(
|
||||
help(domainsCommand, { columns: client.stderr.columns })
|
||||
);
|
||||
return 2;
|
||||
}
|
||||
|
||||
|
||||
157
packages/cli/src/commands/env/command.ts
vendored
Normal file
157
packages/cli/src/commands/env/command.ts
vendored
Normal file
@@ -0,0 +1,157 @@
|
||||
import { Command } from '../help';
|
||||
import { packageName } from '../../util/pkg-name';
|
||||
import { getEnvTargetPlaceholder } from '../../util/env/env-target';
|
||||
|
||||
const targetPlaceholder = getEnvTargetPlaceholder();
|
||||
|
||||
export const envCommand: Command = {
|
||||
name: 'env',
|
||||
description: 'Interact with environment variables.',
|
||||
arguments: [
|
||||
{
|
||||
name: 'command',
|
||||
required: false,
|
||||
},
|
||||
],
|
||||
subcommands: [
|
||||
{
|
||||
name: 'ls',
|
||||
description: 'List all variables for the specified Environment',
|
||||
arguments: [],
|
||||
options: [],
|
||||
examples: [],
|
||||
},
|
||||
{
|
||||
name: 'add',
|
||||
description: 'Add an Environment Variable (see examples below)',
|
||||
arguments: [
|
||||
{
|
||||
name: 'name',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
name: 'environment',
|
||||
required: false,
|
||||
},
|
||||
],
|
||||
options: [],
|
||||
examples: [],
|
||||
},
|
||||
{
|
||||
name: 'rm',
|
||||
description: 'Remove an Environment Variable (see examples below)',
|
||||
arguments: [
|
||||
{
|
||||
name: 'name',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
name: 'environment',
|
||||
required: false,
|
||||
},
|
||||
],
|
||||
options: [],
|
||||
examples: [],
|
||||
},
|
||||
{
|
||||
name: 'pull',
|
||||
description:
|
||||
'Pull all Development Environment Variables from the cloud and write to a file [.env.local]',
|
||||
arguments: [
|
||||
{
|
||||
name: 'filename',
|
||||
required: false,
|
||||
},
|
||||
],
|
||||
options: [],
|
||||
examples: [],
|
||||
},
|
||||
],
|
||||
options: [
|
||||
{
|
||||
name: 'environment',
|
||||
description:
|
||||
'Set the Environment (development, preview, production) when pulling Environment Variables',
|
||||
shorthand: null,
|
||||
type: 'boolean',
|
||||
deprecated: false,
|
||||
multi: false,
|
||||
},
|
||||
{
|
||||
name: 'git-branch',
|
||||
description:
|
||||
'Specify the Git branch to pull specific Environment Variables for',
|
||||
shorthand: null,
|
||||
type: 'string',
|
||||
deprecated: false,
|
||||
multi: false,
|
||||
},
|
||||
{
|
||||
name: 'yes',
|
||||
description: 'Skip the confirmation prompt when removing an alias',
|
||||
shorthand: 'y',
|
||||
type: 'boolean',
|
||||
deprecated: false,
|
||||
multi: false,
|
||||
},
|
||||
],
|
||||
examples: [
|
||||
{
|
||||
name: 'Pull all Development Environment Variables down from the cloud',
|
||||
value: [
|
||||
`${packageName} env pull <file>`,
|
||||
`${packageName} env pull .env.development.local`,
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'Add a new variable to multiple Environments',
|
||||
value: [
|
||||
`${packageName} env add <name>`,
|
||||
`${packageName} env add API_TOKEN`,
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'Add a new variable for a specific Environment',
|
||||
value: [
|
||||
`${packageName} env add <name> ${targetPlaceholder}`,
|
||||
`${packageName} env add DB_PASS production`,
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'Add a new variable for a specific Environment and Git Branch',
|
||||
value: [
|
||||
`${packageName} env add <name> ${targetPlaceholder} <gitbranch>`,
|
||||
`${packageName} env add DB_PASS preview feat1`,
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'Add a new Environment Variable from stdin',
|
||||
value: [
|
||||
`cat <file> | ${packageName} env add <name> ${targetPlaceholder}`,
|
||||
`cat ~/.npmrc | ${packageName} env add NPM_RC preview`,
|
||||
`${packageName} env add API_URL production < url.txt`,
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'Remove a variable from multiple Environments',
|
||||
value: [
|
||||
`${packageName} env rm <name>`,
|
||||
`${packageName} env rm API_TOKEN`,
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'Remove a variable from a specific Environment',
|
||||
value: [
|
||||
`${packageName} env rm <name> ${targetPlaceholder}`,
|
||||
`${packageName} env rm NPM_RC preview`,
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'Remove a variable from a specific Environment and Git Branch',
|
||||
value: [
|
||||
`${packageName} env rm <name> ${targetPlaceholder} <gitbranch>`,
|
||||
`${packageName} env rm NPM_RC preview feat1`,
|
||||
],
|
||||
},
|
||||
],
|
||||
};
|
||||
98
packages/cli/src/commands/env/index.ts
vendored
98
packages/cli/src/commands/env/index.ts
vendored
@@ -8,99 +8,15 @@ import getArgs from '../../util/get-args';
|
||||
import getInvalidSubcommand from '../../util/get-invalid-subcommand';
|
||||
import getSubcommand from '../../util/get-subcommand';
|
||||
import handleError from '../../util/handle-error';
|
||||
import { getCommandName, packageName, logo } from '../../util/pkg-name';
|
||||
import { help } from '../help';
|
||||
import { getCommandName } from '../../util/pkg-name';
|
||||
import { getLinkedProject } from '../../util/projects/link';
|
||||
|
||||
import add from './add';
|
||||
import ls from './ls';
|
||||
import pull from './pull';
|
||||
import rm from './rm';
|
||||
|
||||
const help = () => {
|
||||
const targetPlaceholder = getEnvTargetPlaceholder();
|
||||
console.log(`
|
||||
${chalk.bold(`${logo} ${packageName} env`)} [options] <command>
|
||||
|
||||
${chalk.dim('Commands:')}
|
||||
|
||||
ls [environment] [gitbranch] List all variables for the specified Environment
|
||||
add [name] [environment] [gitbranch] Add an Environment Variable (see examples below)
|
||||
rm [name] [environment] [gitbranch] Remove an Environment Variable (see examples below)
|
||||
pull [filename] Pull all Development Environment Variables from the cloud and write to a file [.env.local]
|
||||
|
||||
${chalk.dim('Options:')}
|
||||
|
||||
-h, --help Output usage information
|
||||
--environment Set the Environment (development, preview, production) when pulling Environment Variables
|
||||
--git-branch Specify the Git branch to pull specific Environment Variables for
|
||||
-A ${chalk.bold.underline('FILE')}, --local-config=${chalk.bold.underline(
|
||||
'FILE'
|
||||
)} Path to the local ${'`vercel.json`'} file
|
||||
-Q ${chalk.bold.underline('DIR')}, --global-config=${chalk.bold.underline(
|
||||
'DIR'
|
||||
)} Path to the global ${'`.vercel`'} directory
|
||||
-d, --debug Debug mode [off]
|
||||
--no-color No color mode [off]
|
||||
-t ${chalk.bold.underline('TOKEN')}, --token=${chalk.bold.underline(
|
||||
'TOKEN'
|
||||
)} Login token
|
||||
-y, --yes Skip the confirmation prompt when overwriting env file on pull or removing an env variable
|
||||
|
||||
${chalk.dim('Examples:')}
|
||||
|
||||
${chalk.gray(
|
||||
'–'
|
||||
)} Pull all Development Environment Variables down from the cloud
|
||||
|
||||
${chalk.cyan(`$ ${packageName} env pull <file>`)}
|
||||
${chalk.cyan(`$ ${packageName} env pull .env.development.local`)}
|
||||
|
||||
${chalk.gray('–')} Add a new variable to multiple Environments
|
||||
|
||||
${chalk.cyan(`$ ${packageName} env add <name>`)}
|
||||
${chalk.cyan(`$ ${packageName} env add API_TOKEN`)}
|
||||
|
||||
${chalk.gray('–')} Add a new variable for a specific Environment
|
||||
|
||||
${chalk.cyan(`$ ${packageName} env add <name> ${targetPlaceholder}`)}
|
||||
${chalk.cyan(`$ ${packageName} env add DB_PASS production`)}
|
||||
|
||||
${chalk.gray(
|
||||
'–'
|
||||
)} Add a new variable for a specific Environment and Git Branch
|
||||
|
||||
${chalk.cyan(
|
||||
`$ ${packageName} env add <name> ${targetPlaceholder} <gitbranch>`
|
||||
)}
|
||||
${chalk.cyan(`$ ${packageName} env add DB_PASS preview feat1`)}
|
||||
|
||||
${chalk.gray('–')} Add a new Environment Variable from stdin
|
||||
|
||||
${chalk.cyan(
|
||||
`$ cat <file> | ${packageName} env add <name> ${targetPlaceholder}`
|
||||
)}
|
||||
${chalk.cyan(`$ cat ~/.npmrc | ${packageName} env add NPM_RC preview`)}
|
||||
${chalk.cyan(`$ ${packageName} env add API_URL production < url.txt`)}
|
||||
|
||||
${chalk.gray('–')} Remove a variable from multiple Environments
|
||||
|
||||
${chalk.cyan(`$ ${packageName} env rm <name>`)}
|
||||
${chalk.cyan(`$ ${packageName} env rm API_TOKEN`)}
|
||||
|
||||
${chalk.gray('–')} Remove a variable from a specific Environment
|
||||
|
||||
${chalk.cyan(`$ ${packageName} env rm <name> ${targetPlaceholder}`)}
|
||||
${chalk.cyan(`$ ${packageName} env rm NPM_RC preview`)}
|
||||
|
||||
${chalk.gray(
|
||||
'–'
|
||||
)} Remove a variable from a specific Environment and Git Branch
|
||||
|
||||
${chalk.cyan(
|
||||
`$ ${packageName} env rm <name> ${targetPlaceholder} <gitbranch>`
|
||||
)}
|
||||
${chalk.cyan(`$ ${packageName} env rm NPM_RC preview feat1`)}
|
||||
`);
|
||||
};
|
||||
import { envCommand } from './command';
|
||||
|
||||
const COMMAND_CONFIG = {
|
||||
ls: ['ls', 'list'],
|
||||
@@ -125,7 +41,7 @@ export default async function main(client: Client) {
|
||||
}
|
||||
|
||||
if (argv['--help']) {
|
||||
help();
|
||||
client.output.print(help(envCommand, { columns: client.stderr.columns }));
|
||||
return 2;
|
||||
}
|
||||
|
||||
@@ -177,7 +93,9 @@ export default async function main(client: Client) {
|
||||
);
|
||||
default:
|
||||
output.error(getInvalidSubcommand(COMMAND_CONFIG));
|
||||
help();
|
||||
client.output.print(
|
||||
help(envCommand, { columns: client.stderr.columns })
|
||||
);
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
|
||||
3
packages/cli/src/commands/env/pull.ts
vendored
3
packages/cli/src/commands/env/pull.ts
vendored
@@ -24,6 +24,7 @@ import {
|
||||
} from '../../util/env/diff-env-files';
|
||||
import { isErrnoException } from '@vercel/error-utils';
|
||||
import { addToGitIgnore } from '../../util/link/add-to-gitignore';
|
||||
import JSONparse from 'json-parse-better-errors';
|
||||
|
||||
const CONTENTS_PREFIX = '# Created by Vercel CLI\n';
|
||||
|
||||
@@ -121,7 +122,7 @@ export default async function pull(
|
||||
// We need this because double quotes are stripped from the local .env file,
|
||||
// but `records` is already in the form of a JSON object that doesn't filter
|
||||
// double quotes.
|
||||
const newEnv = JSON.parse(JSON.stringify(records).replace(/\\"/g, ''));
|
||||
const newEnv = JSONparse(JSON.stringify(records).replace(/\\"/g, ''));
|
||||
deltaString = buildDeltaString(oldEnv, newEnv);
|
||||
}
|
||||
}
|
||||
|
||||
50
packages/cli/src/commands/git/command.ts
Normal file
50
packages/cli/src/commands/git/command.ts
Normal file
@@ -0,0 +1,50 @@
|
||||
import { Command } from '../help';
|
||||
import { packageName } from '../../util/pkg-name';
|
||||
|
||||
export const gitCommand: Command = {
|
||||
name: 'git',
|
||||
description: 'Manage your Git provider connections.',
|
||||
arguments: [
|
||||
{
|
||||
name: 'command',
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
subcommands: [
|
||||
{
|
||||
name: 'connect',
|
||||
description:
|
||||
'Connect your Vercel Project to your Git repository or provide the remote URL to your Git repository',
|
||||
arguments: [
|
||||
{
|
||||
name: 'git url',
|
||||
required: false,
|
||||
},
|
||||
],
|
||||
options: [],
|
||||
examples: [],
|
||||
},
|
||||
{
|
||||
name: 'disconnect',
|
||||
description: 'Disconnect the Git provider repository from your project',
|
||||
arguments: [],
|
||||
options: [],
|
||||
examples: [],
|
||||
},
|
||||
],
|
||||
options: [],
|
||||
examples: [
|
||||
{
|
||||
name: 'Connect your Vercel Project to your Git repository defined in your local .git config',
|
||||
value: `${packageName} git connect`,
|
||||
},
|
||||
{
|
||||
name: 'Connect your Vercel Project to a Git repository using the remote URL',
|
||||
value: `${packageName} git connect https://github.com/user/repo.git`,
|
||||
},
|
||||
{
|
||||
name: 'Disconnect the Git provider repository',
|
||||
value: `${packageName} git disconnect`,
|
||||
},
|
||||
],
|
||||
};
|
||||
@@ -1,51 +1,12 @@
|
||||
import chalk from 'chalk';
|
||||
import Client from '../../util/client';
|
||||
import { ensureLink } from '../../util/link/ensure-link';
|
||||
import getArgs from '../../util/get-args';
|
||||
import getInvalidSubcommand from '../../util/get-invalid-subcommand';
|
||||
import handleError from '../../util/handle-error';
|
||||
import { packageName, logo } from '../../util/pkg-name';
|
||||
import connect from './connect';
|
||||
import disconnect from './disconnect';
|
||||
|
||||
const help = () => {
|
||||
console.log(`
|
||||
${chalk.bold(`${logo} ${packageName} git`)} <command>
|
||||
|
||||
${chalk.dim('Commands:')}
|
||||
|
||||
connect [url] Connect your Vercel Project to your Git repository or provide the remote URL to your Git repository
|
||||
disconnect Disconnect the Git provider repository from your project
|
||||
|
||||
${chalk.dim('Options:')}
|
||||
|
||||
-h, --help Output usage information
|
||||
-t ${chalk.bold.underline('TOKEN')}, --token=${chalk.bold.underline(
|
||||
'TOKEN'
|
||||
)} Login token
|
||||
-y, --yes Skip confirmation when connecting a Git provider
|
||||
|
||||
${chalk.dim('Examples:')}
|
||||
|
||||
${chalk.gray(
|
||||
'–'
|
||||
)} Connect your Vercel Project to your Git repository defined in your local .git config
|
||||
|
||||
${chalk.cyan(`$ ${packageName} git connect`)}
|
||||
|
||||
${chalk.gray(
|
||||
'–'
|
||||
)} Connect your Vercel Project to a Git repository using the remote URL
|
||||
|
||||
${chalk.cyan(
|
||||
`$ ${packageName} git connect https://github.com/user/repo.git`
|
||||
)}
|
||||
|
||||
${chalk.gray('–')} Disconnect the Git provider repository
|
||||
|
||||
${chalk.cyan(`$ ${packageName} git disconnect`)}
|
||||
`);
|
||||
};
|
||||
import { help } from '../help';
|
||||
import { gitCommand } from './command';
|
||||
|
||||
const COMMAND_CONFIG = {
|
||||
connect: ['connect'],
|
||||
@@ -71,7 +32,7 @@ export default async function main(client: Client) {
|
||||
}
|
||||
|
||||
if (argv['--help']) {
|
||||
help();
|
||||
client.output.print(help(gitCommand, { columns: client.stderr.columns }));
|
||||
return 2;
|
||||
}
|
||||
|
||||
@@ -96,7 +57,7 @@ export default async function main(client: Client) {
|
||||
return await disconnect(client, args, project, org);
|
||||
default:
|
||||
output.error(getInvalidSubcommand(COMMAND_CONFIG));
|
||||
help();
|
||||
client.output.print(help(gitCommand, { columns: client.stderr.columns }));
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ export interface CommandOption {
|
||||
argument?: string;
|
||||
deprecated: boolean;
|
||||
description?: string;
|
||||
/** supports multiple entries */
|
||||
multi: boolean;
|
||||
}
|
||||
export interface CommandArgument {
|
||||
@@ -322,7 +323,10 @@ export function buildSubcommandLines(
|
||||
]);
|
||||
}
|
||||
|
||||
const finalColumnWidth = options.columns - maxWidthOfUnwrappedColumns;
|
||||
// Really long descriptions go RIGHT up to the edge, which looks unpleasant.
|
||||
const rightMargin = INDENT.repeat(4).length;
|
||||
const finalColumnWidth =
|
||||
options.columns - maxWidthOfUnwrappedColumns - rightMargin;
|
||||
|
||||
const table = new Table(
|
||||
Object.assign({}, tableOptions, {
|
||||
|
||||
47
packages/cli/src/commands/init/command.ts
Normal file
47
packages/cli/src/commands/init/command.ts
Normal file
@@ -0,0 +1,47 @@
|
||||
import { Command } from '../help';
|
||||
import { packageName } from '../../util/pkg-name';
|
||||
|
||||
export const initCommand: Command = {
|
||||
name: 'init',
|
||||
description: 'Initialize example Vercel Projects',
|
||||
arguments: [
|
||||
{
|
||||
name: 'example',
|
||||
required: false,
|
||||
},
|
||||
{
|
||||
name: 'dir',
|
||||
required: false,
|
||||
},
|
||||
],
|
||||
subcommands: undefined,
|
||||
options: [
|
||||
{
|
||||
name: 'force',
|
||||
description: 'Overwrite destination directory if exists [off]',
|
||||
argument: undefined,
|
||||
shorthand: 'f',
|
||||
type: 'boolean',
|
||||
deprecated: false,
|
||||
multi: false,
|
||||
},
|
||||
],
|
||||
examples: [
|
||||
{
|
||||
name: 'Choose from all available examples',
|
||||
value: `${packageName} init`,
|
||||
},
|
||||
{
|
||||
name: 'Initialize example project into a new directory',
|
||||
value: `${packageName} init <example>`,
|
||||
},
|
||||
{
|
||||
name: 'Initialize example project into specified directory',
|
||||
value: `${packageName} <example> <dir>`,
|
||||
},
|
||||
{
|
||||
name: 'Initialize example project without checking',
|
||||
value: `${packageName} init <example> --force`,
|
||||
},
|
||||
],
|
||||
};
|
||||
@@ -1,48 +1,16 @@
|
||||
import chalk from 'chalk';
|
||||
|
||||
import getArgs from '../../util/get-args';
|
||||
import getSubcommand from '../../util/get-subcommand';
|
||||
import Client from '../../util/client';
|
||||
import handleError from '../../util/handle-error';
|
||||
import init from './init';
|
||||
import { packageName, logo } from '../../util/pkg-name';
|
||||
import { isError } from '@vercel/error-utils';
|
||||
import { help } from '../help';
|
||||
import { initCommand } from './command';
|
||||
|
||||
const COMMAND_CONFIG = {
|
||||
init: ['init'],
|
||||
};
|
||||
|
||||
const help = () => {
|
||||
console.log(`
|
||||
${chalk.bold(`${logo} ${packageName} init`)} [example] [dir] [-f | --force]
|
||||
|
||||
${chalk.dim('Options:')}
|
||||
|
||||
-h, --help Output usage information
|
||||
-d, --debug Debug mode [off]
|
||||
--no-color No color mode [off]
|
||||
-f, --force Overwrite destination directory if exists [off]
|
||||
|
||||
${chalk.dim('Examples:')}
|
||||
|
||||
${chalk.gray('–')} Choose from all available examples
|
||||
|
||||
${chalk.cyan(`$ ${packageName} init`)}
|
||||
|
||||
${chalk.gray('–')} Initialize example project into a new directory
|
||||
|
||||
${chalk.cyan(`$ ${packageName} init <example>`)}
|
||||
|
||||
${chalk.gray('–')} Initialize example project into specified directory
|
||||
|
||||
${chalk.cyan(`$ ${packageName} init <example> <dir>`)}
|
||||
|
||||
${chalk.gray('–')} Initialize example project without checking
|
||||
|
||||
${chalk.cyan(`$ ${packageName} init <example> --force`)}
|
||||
`);
|
||||
};
|
||||
|
||||
export default async function main(client: Client) {
|
||||
const { output } = client;
|
||||
let argv;
|
||||
@@ -60,7 +28,7 @@ export default async function main(client: Client) {
|
||||
}
|
||||
|
||||
if (argv['--help']) {
|
||||
help();
|
||||
client.output.print(help(initCommand, { columns: client.stderr.columns }));
|
||||
return 2;
|
||||
}
|
||||
|
||||
|
||||
67
packages/cli/src/commands/project/command.ts
Normal file
67
packages/cli/src/commands/project/command.ts
Normal file
@@ -0,0 +1,67 @@
|
||||
import { Command } from '../help';
|
||||
import { packageName } from '../../util/pkg-name';
|
||||
|
||||
export const projectCommand: Command = {
|
||||
name: 'project',
|
||||
description: 'Manage your Vercel Projects.',
|
||||
arguments: [
|
||||
{
|
||||
name: 'command',
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
subcommands: [
|
||||
{
|
||||
name: 'ls',
|
||||
description: 'Show all projects in the selected team/user',
|
||||
arguments: [],
|
||||
options: [],
|
||||
examples: [],
|
||||
},
|
||||
{
|
||||
name: 'add',
|
||||
description: 'Add a new project',
|
||||
arguments: [
|
||||
{
|
||||
name: 'name',
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
options: [],
|
||||
examples: [],
|
||||
},
|
||||
{
|
||||
name: 'rm',
|
||||
description: 'Remove a project',
|
||||
arguments: [
|
||||
{
|
||||
name: 'name',
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
options: [],
|
||||
examples: [],
|
||||
},
|
||||
],
|
||||
options: [
|
||||
{
|
||||
name: 'next',
|
||||
description: 'Show next page of results',
|
||||
argument: 'MS',
|
||||
shorthand: 'n',
|
||||
type: 'string',
|
||||
deprecated: false,
|
||||
multi: false,
|
||||
},
|
||||
],
|
||||
examples: [
|
||||
{
|
||||
name: 'Add a new project',
|
||||
value: `${packageName} project add my-project`,
|
||||
},
|
||||
{
|
||||
name: 'Paginate projects, where `1584722256178` is the time in milliseconds since the UNIX epoch',
|
||||
value: `${packageName} project ls --next 1584722256178`,
|
||||
},
|
||||
],
|
||||
};
|
||||
@@ -1,46 +1,13 @@
|
||||
import chalk from 'chalk';
|
||||
import Client from '../../util/client';
|
||||
import getArgs from '../../util/get-args';
|
||||
import getInvalidSubcommand from '../../util/get-invalid-subcommand';
|
||||
import getScope from '../../util/get-scope';
|
||||
import handleError from '../../util/handle-error';
|
||||
import { packageName, logo } from '../../util/pkg-name';
|
||||
import { help } from '../help';
|
||||
import add from './add';
|
||||
import list from './list';
|
||||
import rm from './rm';
|
||||
|
||||
const help = () => {
|
||||
console.log(`
|
||||
${chalk.bold(`${logo} ${packageName} project`)} [options] <command>
|
||||
|
||||
${chalk.dim('Commands:')}
|
||||
|
||||
ls Show all projects in the selected team/user
|
||||
add [name] Add a new project
|
||||
rm [name] Remove a project
|
||||
|
||||
${chalk.dim('Options:')}
|
||||
|
||||
-h, --help Output usage information
|
||||
-t ${chalk.bold.underline('TOKEN')}, --token=${chalk.bold.underline(
|
||||
'TOKEN'
|
||||
)} Login token
|
||||
-S, --scope Set a custom scope
|
||||
-N, --next Show next page of results
|
||||
|
||||
${chalk.dim('Examples:')}
|
||||
|
||||
${chalk.gray('–')} Add a new project
|
||||
|
||||
${chalk.cyan(`$ ${packageName} project add my-project`)}
|
||||
|
||||
${chalk.gray('–')} Paginate projects, where ${chalk.dim(
|
||||
'`1584722256178`'
|
||||
)} is the time in milliseconds since the UNIX epoch.
|
||||
|
||||
${chalk.cyan(`$ ${packageName} project ls --next 1584722256178`)}
|
||||
`);
|
||||
};
|
||||
import { projectCommand } from './command';
|
||||
|
||||
const COMMAND_CONFIG = {
|
||||
ls: ['ls', 'list'],
|
||||
@@ -63,7 +30,9 @@ export default async function main(client: Client) {
|
||||
}
|
||||
|
||||
if (argv['--help']) {
|
||||
help();
|
||||
client.output.print(
|
||||
help(projectCommand, { columns: client.stderr.columns })
|
||||
);
|
||||
return 2;
|
||||
}
|
||||
|
||||
@@ -84,7 +53,9 @@ export default async function main(client: Client) {
|
||||
return await rm(client, args);
|
||||
default:
|
||||
output.error(getInvalidSubcommand(COMMAND_CONFIG));
|
||||
help();
|
||||
client.output.print(
|
||||
help(projectCommand, { columns: client.stderr.columns })
|
||||
);
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
|
||||
53
packages/cli/src/commands/promote/command.ts
Normal file
53
packages/cli/src/commands/promote/command.ts
Normal file
@@ -0,0 +1,53 @@
|
||||
import { Command } from '../help';
|
||||
import { packageName } from '../../util/pkg-name';
|
||||
|
||||
export const promoteCommand: Command = {
|
||||
name: 'promote',
|
||||
description: 'Promote an existing deployment to current.',
|
||||
arguments: [
|
||||
{
|
||||
name: 'deployment id/url',
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
subcommands: [
|
||||
{
|
||||
name: 'status',
|
||||
description: 'Show the status of any current pending promotions',
|
||||
arguments: [
|
||||
{
|
||||
name: 'project',
|
||||
required: false,
|
||||
},
|
||||
],
|
||||
options: [],
|
||||
examples: [],
|
||||
},
|
||||
],
|
||||
options: [
|
||||
{
|
||||
name: 'timeout',
|
||||
description: 'Time to wait for promotion completion [3m]',
|
||||
argument: 'timeout',
|
||||
shorthand: null,
|
||||
type: 'string',
|
||||
deprecated: false,
|
||||
multi: false,
|
||||
},
|
||||
],
|
||||
examples: [
|
||||
{
|
||||
name: 'Show the status of any current pending promotions',
|
||||
value: [
|
||||
`${packageName} promote`,
|
||||
`${packageName} promote status`,
|
||||
`${packageName} promote status <project>`,
|
||||
`${packageName} promote status --timeout 30s`,
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'Promote a deployment using id or url',
|
||||
value: `${packageName} promote <deployment id/url>`,
|
||||
},
|
||||
],
|
||||
};
|
||||
@@ -1,53 +1,13 @@
|
||||
import chalk from 'chalk';
|
||||
import type Client from '../../util/client';
|
||||
import getArgs from '../../util/get-args';
|
||||
import getProjectByCwdOrLink from '../../util/projects/get-project-by-cwd-or-link';
|
||||
import { packageName, logo } from '../../util/pkg-name';
|
||||
import handleError from '../../util/handle-error';
|
||||
import { isErrnoException } from '@vercel/error-utils';
|
||||
import ms from 'ms';
|
||||
import requestPromote from './request-promote';
|
||||
import promoteStatus from './status';
|
||||
|
||||
const help = () => {
|
||||
console.log(`
|
||||
${chalk.bold(`${logo} ${packageName} promote`)} [deployment id/url]
|
||||
|
||||
Promote an existing deployment to current.
|
||||
|
||||
${chalk.dim('Options:')}
|
||||
|
||||
-h, --help Output usage information
|
||||
-A ${chalk.bold.underline('FILE')}, --local-config=${chalk.bold.underline(
|
||||
'FILE'
|
||||
)} Path to the local ${'`vercel.json`'} file
|
||||
-Q ${chalk.bold.underline('DIR')}, --global-config=${chalk.bold.underline(
|
||||
'DIR'
|
||||
)} Path to the global ${'`.vercel`'} directory
|
||||
-d, --debug Debug mode [off]
|
||||
--no-color No color mode [off]
|
||||
-t ${chalk.bold.underline('TOKEN')}, --token=${chalk.bold.underline(
|
||||
'TOKEN'
|
||||
)} Login token
|
||||
--timeout=${chalk.bold.underline(
|
||||
'TIME'
|
||||
)} Time to wait for promotion completion [3m]
|
||||
-y, --yes Skip questions when setting up new project using default scope and settings
|
||||
|
||||
${chalk.dim('Examples:')}
|
||||
|
||||
${chalk.gray('–')} Show the status of any current pending promotions
|
||||
|
||||
${chalk.cyan(`$ ${packageName} promote`)}
|
||||
${chalk.cyan(`$ ${packageName} promote status`)}
|
||||
${chalk.cyan(`$ ${packageName} promote status <project>`)}
|
||||
${chalk.cyan(`$ ${packageName} promote status --timeout 30s`)}
|
||||
|
||||
${chalk.gray('–')} Promote a deployment using id or url
|
||||
|
||||
${chalk.cyan(`$ ${packageName} promote <deployment id/url>`)}
|
||||
`);
|
||||
};
|
||||
import { promoteCommand } from './command';
|
||||
import { help } from '../help';
|
||||
|
||||
/**
|
||||
* `vc promote` command
|
||||
@@ -68,7 +28,9 @@ export default async (client: Client): Promise<number> => {
|
||||
}
|
||||
|
||||
if (argv['--help'] || argv._[0] === 'help') {
|
||||
help();
|
||||
client.output.print(
|
||||
help(promoteCommand, { columns: client.stderr.columns })
|
||||
);
|
||||
return 2;
|
||||
}
|
||||
|
||||
|
||||
53
packages/cli/src/commands/rollback/command.ts
Normal file
53
packages/cli/src/commands/rollback/command.ts
Normal file
@@ -0,0 +1,53 @@
|
||||
import { Command } from '../help';
|
||||
import { packageName } from '../../util/pkg-name';
|
||||
|
||||
export const rollbackCommand: Command = {
|
||||
name: 'rollback',
|
||||
description: 'Quickly revert back to a previous deployment.',
|
||||
arguments: [
|
||||
{
|
||||
name: 'deployment id/url',
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
subcommands: [
|
||||
{
|
||||
name: 'status',
|
||||
description: 'Show the status of any current pending rollbacks',
|
||||
arguments: [
|
||||
{
|
||||
name: 'project',
|
||||
required: false,
|
||||
},
|
||||
],
|
||||
options: [],
|
||||
examples: [],
|
||||
},
|
||||
],
|
||||
options: [
|
||||
{
|
||||
name: 'timeout',
|
||||
description: 'Time to wait for rollback completion [3m]',
|
||||
argument: 'timeout',
|
||||
shorthand: null,
|
||||
type: 'string',
|
||||
deprecated: false,
|
||||
multi: false,
|
||||
},
|
||||
],
|
||||
examples: [
|
||||
{
|
||||
name: 'Show the status of any current pending rollbacks',
|
||||
value: [
|
||||
`${packageName} rollback`,
|
||||
`${packageName} rollback status`,
|
||||
`${packageName} rollback status <project>`,
|
||||
`${packageName} rollback status --timeout 30s`,
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'Rollback a deployment using id or url',
|
||||
value: `${packageName} rollback <deployment id/url>`,
|
||||
},
|
||||
],
|
||||
};
|
||||
@@ -1,53 +1,13 @@
|
||||
import chalk from 'chalk';
|
||||
import type Client from '../../util/client';
|
||||
import getArgs from '../../util/get-args';
|
||||
import getProjectByCwdOrLink from '../../util/projects/get-project-by-cwd-or-link';
|
||||
import { packageName, logo } from '../../util/pkg-name';
|
||||
import handleError from '../../util/handle-error';
|
||||
import { isErrnoException } from '@vercel/error-utils';
|
||||
import ms from 'ms';
|
||||
import requestRollback from './request-rollback';
|
||||
import rollbackStatus from './status';
|
||||
|
||||
const help = () => {
|
||||
console.log(`
|
||||
${chalk.bold(`${logo} ${packageName} rollback`)} [deployment id/url]
|
||||
|
||||
Quickly revert back to a previous deployment.
|
||||
|
||||
${chalk.dim('Options:')}
|
||||
|
||||
-h, --help Output usage information
|
||||
-A ${chalk.bold.underline('FILE')}, --local-config=${chalk.bold.underline(
|
||||
'FILE'
|
||||
)} Path to the local ${'`vercel.json`'} file
|
||||
-Q ${chalk.bold.underline('DIR')}, --global-config=${chalk.bold.underline(
|
||||
'DIR'
|
||||
)} Path to the global ${'`.vercel`'} directory
|
||||
-d, --debug Debug mode [off]
|
||||
--no-color No color mode [off]
|
||||
-t ${chalk.bold.underline('TOKEN')}, --token=${chalk.bold.underline(
|
||||
'TOKEN'
|
||||
)} Login token
|
||||
--timeout=${chalk.bold.underline(
|
||||
'TIME'
|
||||
)} Time to wait for rollback completion [3m]
|
||||
-y, --yes Skip questions when setting up new project using default scope and settings
|
||||
|
||||
${chalk.dim('Examples:')}
|
||||
|
||||
${chalk.gray('–')} Show the status of any current pending rollbacks
|
||||
|
||||
${chalk.cyan(`$ ${packageName} rollback`)}
|
||||
${chalk.cyan(`$ ${packageName} rollback status`)}
|
||||
${chalk.cyan(`$ ${packageName} rollback status <project>`)}
|
||||
${chalk.cyan(`$ ${packageName} rollback status --timeout 30s`)}
|
||||
|
||||
${chalk.gray('–')} Rollback a deployment using id or url
|
||||
|
||||
${chalk.cyan(`$ ${packageName} rollback <deployment id/url>`)}
|
||||
`);
|
||||
};
|
||||
import { help } from '../help';
|
||||
import { rollbackCommand } from './command';
|
||||
|
||||
/**
|
||||
* `vc rollback` command
|
||||
@@ -68,7 +28,9 @@ export default async (client: Client): Promise<number> => {
|
||||
}
|
||||
|
||||
if (argv['--help'] || argv._[0] === 'help') {
|
||||
help();
|
||||
client.output.print(
|
||||
help(rollbackCommand, { columns: client.stderr.columns })
|
||||
);
|
||||
return 2;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,70 +8,103 @@ import exit from '../util/exit';
|
||||
import getScope from '../util/get-scope.ts';
|
||||
import confirm from '../util/input/confirm';
|
||||
import getCommandFlags from '../util/get-command-flags';
|
||||
import { packageName, getCommandName, logo } from '../util/pkg-name.ts';
|
||||
import { packageName, getCommandName } from '../util/pkg-name.ts';
|
||||
import getArgs from '../util/get-args';
|
||||
import { help } from './help';
|
||||
|
||||
const help = () => {
|
||||
console.log(`
|
||||
${chalk.yellow(
|
||||
`${chalk.bold('NOTE:')} The ${getCommandName(
|
||||
'env'
|
||||
)} command is recommended instead of ${getCommandName('secrets')}`
|
||||
)}
|
||||
export const secretsCommand = {
|
||||
name: 'secrets',
|
||||
description: `NOTE: The ${getCommandName(
|
||||
'env'
|
||||
)} command is recommended instead of ${getCommandName('secrets')}`,
|
||||
arguments: [
|
||||
{
|
||||
name: 'command',
|
||||
required: false,
|
||||
},
|
||||
],
|
||||
subcommands: [
|
||||
{
|
||||
name: 'ls',
|
||||
description: 'Show all secrets in a list',
|
||||
arguments: [],
|
||||
options: [],
|
||||
examples: [],
|
||||
},
|
||||
{
|
||||
name: 'add',
|
||||
description: 'Add a new secret',
|
||||
arguments: [
|
||||
{
|
||||
name: 'name',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
name: 'value',
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
options: [],
|
||||
examples: [],
|
||||
},
|
||||
{
|
||||
name: 'rename',
|
||||
description: 'Change the name of a secret',
|
||||
arguments: [
|
||||
{
|
||||
name: 'old-name',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
name: 'new-name',
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
options: [],
|
||||
examples: [],
|
||||
},
|
||||
{
|
||||
name: 'rm',
|
||||
description: 'Remove a secret',
|
||||
arguments: [
|
||||
{
|
||||
name: 'name',
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
options: [],
|
||||
examples: [],
|
||||
},
|
||||
],
|
||||
options: [
|
||||
{
|
||||
name: 'next',
|
||||
description: 'Show next page of results',
|
||||
argument: 'MS',
|
||||
shorthand: 'n',
|
||||
type: 'string',
|
||||
deprecated: false,
|
||||
multi: false,
|
||||
},
|
||||
],
|
||||
examples: [
|
||||
{
|
||||
name: 'Add a new secret',
|
||||
value: `${packageName} secrets add my-secret "my value"
|
||||
|
||||
${chalk.bold(`${logo} ${packageName} secrets`)} [options] <command>
|
||||
|
||||
${chalk.dim('Commands:')}
|
||||
|
||||
ls Show all secrets in a list
|
||||
add [name] [value] Add a new secret
|
||||
rename [old-name] [new-name] Change the name of a secret
|
||||
rm [name] Remove a secret
|
||||
|
||||
${chalk.dim('Options:')}
|
||||
|
||||
-h, --help Output usage information
|
||||
-A ${chalk.bold.underline('FILE')}, --local-config=${chalk.bold.underline(
|
||||
'FILE'
|
||||
)} Path to the local ${'`vercel.json`'} file
|
||||
-Q ${chalk.bold.underline('DIR')}, --global-config=${chalk.bold.underline(
|
||||
'DIR'
|
||||
)} Path to the global ${'`.vercel`'} directory
|
||||
-d, --debug Debug mode [off]
|
||||
-t ${chalk.bold.underline('TOKEN')}, --token=${chalk.bold.underline(
|
||||
'TOKEN'
|
||||
)} Login token
|
||||
-S, --scope Set a custom scope
|
||||
-N, --next Show next page of results
|
||||
|
||||
${chalk.dim('Examples:')}
|
||||
|
||||
${chalk.gray('–')} Add a new secret
|
||||
|
||||
${chalk.cyan(`$ ${packageName} secrets add my-secret "my value"`)}
|
||||
|
||||
${chalk.gray(
|
||||
'–'
|
||||
)} Once added, a secret's value can't be retrieved in plain text anymore
|
||||
${chalk.gray(
|
||||
'–'
|
||||
)} If the secret's value is more than one word, wrap it in quotes
|
||||
${chalk.gray('–')} When in doubt, always wrap your value in quotes
|
||||
|
||||
${chalk.gray(
|
||||
'–'
|
||||
)} Expose a secret as an environment variable (notice the ${chalk.cyan.bold(
|
||||
'`@`'
|
||||
)} symbol)
|
||||
|
||||
${chalk.cyan(`$ ${packageName} -e MY_SECRET=${chalk.bold('@my-secret')}`)}
|
||||
|
||||
${chalk.gray('–')} Paginate results, where ${chalk.dim(
|
||||
'`1584722256178`'
|
||||
)} is the time in milliseconds since the UNIX epoch
|
||||
|
||||
${chalk.cyan(`$ ${packageName} secrets ls --next 1584722256178`)}
|
||||
`);
|
||||
- Once added, a secret's value can't be retrieved in plain text anymore
|
||||
- If the secret's value is more than one word, wrap it in quotes
|
||||
- When in doubt, always wrap your value in quotes`,
|
||||
},
|
||||
{
|
||||
name: 'Expose a secret as an environment variable (notice the `@` symbol)',
|
||||
value: `${packageName} -e MY_SECRET=@my-secret`,
|
||||
},
|
||||
{
|
||||
name: 'Paginate results, where 1584722256178 is the time in milliseconds since the UNIX epoch',
|
||||
value: `$ ${packageName} secrets ls --next 1584722256178`,
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
// Options
|
||||
@@ -94,7 +127,9 @@ const main = async client => {
|
||||
nextTimestamp = argv.next;
|
||||
|
||||
if (argv.help || !subcommand) {
|
||||
help();
|
||||
client.output.print(
|
||||
help(secretsCommand, { columns: client.stderr.columns })
|
||||
);
|
||||
await exit(2);
|
||||
}
|
||||
|
||||
@@ -298,19 +333,7 @@ async function run({ output, contextName, currentTeam, client }) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
const [name, parsedValue] = args;
|
||||
const [originalName, originalValue] = client.argv.slice(-2);
|
||||
|
||||
let value = parsedValue;
|
||||
if (
|
||||
name === originalName &&
|
||||
typeof parsedValue === 'boolean' &&
|
||||
parsedValue !== originalValue
|
||||
) {
|
||||
// Corner case where `mri` transforms the secret value into a boolean because
|
||||
// it starts with a `-` so it thinks its a flag, so we use the original value instead.
|
||||
value = originalValue;
|
||||
}
|
||||
const [name, value] = args;
|
||||
|
||||
if (typeof value === 'boolean') {
|
||||
const example = chalk.cyan(
|
||||
@@ -340,7 +363,7 @@ async function run({ output, contextName, currentTeam, client }) {
|
||||
console.error(
|
||||
error('Please specify a valid subcommand: ls | add | rename | rm')
|
||||
);
|
||||
help();
|
||||
client.output.print(help(secretsCommand, { columns: client.stderr.columns }));
|
||||
return 2;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,8 @@ export async function initCorepack({
|
||||
);
|
||||
if (pkg instanceof CantParseJSONFile) {
|
||||
console.warn(
|
||||
'Warning: Could not enable corepack because package.json is invalid JSON'
|
||||
'Warning: Could not enable corepack because package.json is invalid JSON',
|
||||
pkg.meta.parseErrorLocation
|
||||
);
|
||||
} else if (!pkg?.packageManager) {
|
||||
console.warn(
|
||||
|
||||
@@ -20,6 +20,7 @@ import isPortReachable from 'is-port-reachable';
|
||||
import deepEqual from 'fast-deep-equal';
|
||||
import npa from 'npm-package-arg';
|
||||
import type { ChildProcess } from 'child_process';
|
||||
import JSONparse from 'json-parse-better-errors';
|
||||
|
||||
import { getVercelIgnore, fileNameSymbol } from '@vercel/client';
|
||||
import {
|
||||
@@ -726,7 +727,7 @@ export default class DevServer {
|
||||
|
||||
try {
|
||||
const raw = await fs.readFile(abs, 'utf8');
|
||||
const parsed: WithFileNameSymbol<T> = JSON.parse(raw);
|
||||
const parsed: WithFileNameSymbol<T> = JSONparse(raw);
|
||||
parsed[fileNameSymbol] = rel;
|
||||
return parsed;
|
||||
} catch (err: unknown) {
|
||||
|
||||
@@ -668,13 +668,14 @@ export class CertMissing extends NowError<'ALIAS_IN_USE', { domain: string }> {
|
||||
|
||||
export class CantParseJSONFile extends NowError<
|
||||
'CANT_PARSE_JSON_FILE',
|
||||
{ file: string }
|
||||
{ file: string; parseErrorLocation: string }
|
||||
> {
|
||||
constructor(file: string) {
|
||||
constructor(file: string, parseErrorLocation: string) {
|
||||
const message = `Can't parse json file ${file}: ${parseErrorLocation}`;
|
||||
super({
|
||||
code: 'CANT_PARSE_JSON_FILE',
|
||||
meta: { file },
|
||||
message: `Can't parse json file`,
|
||||
meta: { file, parseErrorLocation },
|
||||
message,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import fs from 'fs-extra';
|
||||
import { CantParseJSONFile } from './errors-ts';
|
||||
import JSONparse from 'json-parse-better-errors';
|
||||
import { errorToString } from '@vercel/error-utils';
|
||||
|
||||
export default async function readJSONFile<T>(
|
||||
file: string
|
||||
@@ -10,10 +12,10 @@ export default async function readJSONFile<T>(
|
||||
}
|
||||
|
||||
try {
|
||||
const json = JSON.parse(content);
|
||||
const json = JSONparse(content);
|
||||
return json;
|
||||
} catch (error) {
|
||||
return new CantParseJSONFile(file);
|
||||
return new CantParseJSONFile(file, errorToString(error));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
2
packages/cli/test/integration-1.test.ts
vendored
2
packages/cli/test/integration-1.test.ts
vendored
@@ -292,7 +292,7 @@ test('[vc dev] should print help from `vc develop --help`', async () => {
|
||||
);
|
||||
|
||||
expect(exitCode, formatOutput({ stdout, stderr })).toBe(2);
|
||||
expect(stdout).toMatch(/▲ vercel dev/gm);
|
||||
expect(stderr).toMatch(/▲ vercel dev/gm);
|
||||
});
|
||||
|
||||
test('default command should deploy directory', async () => {
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
# @vercel/client
|
||||
|
||||
## 13.0.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`9e3827c78`](https://github.com/vercel/vercel/commit/9e3827c785e1bc45f2bed421132167381481770f)]:
|
||||
- @vercel/build-utils@7.1.0
|
||||
|
||||
## 13.0.0
|
||||
|
||||
### Major Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@vercel/client",
|
||||
"version": "13.0.0",
|
||||
"version": "13.0.1",
|
||||
"main": "dist/index.js",
|
||||
"typings": "dist/index.d.ts",
|
||||
"homepage": "https://vercel.com",
|
||||
@@ -14,7 +14,9 @@
|
||||
"directory": "packages/client"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "tsc",
|
||||
"build": "run-p build:*",
|
||||
"build:js": "node ../../scripts/esbuild.mjs",
|
||||
"build:types": "tsc",
|
||||
"test-e2e": "pnpm test tests/create-deployment.test.ts tests/create-legacy-deployment.test.ts tests/paths.test.ts",
|
||||
"test": "jest --reporters=default --reporters=jest-junit --env node --verbose --runInBand --bail",
|
||||
"test-unit": "pnpm test tests/unit.*test.*"
|
||||
@@ -36,7 +38,7 @@
|
||||
"typescript": "4.9.5"
|
||||
},
|
||||
"dependencies": {
|
||||
"@vercel/build-utils": "7.0.0",
|
||||
"@vercel/build-utils": "7.1.0",
|
||||
"@vercel/routing-utils": "3.0.0",
|
||||
"@zeit/fetch": "5.2.0",
|
||||
"async-retry": "1.2.3",
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"declaration": true,
|
||||
"emitDeclarationOnly": true,
|
||||
"esModuleInterop": true,
|
||||
"lib": ["ES2021"],
|
||||
"module": "commonjs",
|
||||
|
||||
@@ -13,7 +13,9 @@
|
||||
"directory": "packages/error-utils"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "tsc",
|
||||
"build": "run-p build:*",
|
||||
"build:js": "node ../../scripts/esbuild.mjs",
|
||||
"build:types": "tsc",
|
||||
"test": "jest --reporters=default --reporters=jest-junit --coverage --env node --verbose",
|
||||
"test-unit": "pnpm test"
|
||||
},
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"declaration": true,
|
||||
"declarationMap": true,
|
||||
"emitDeclarationOnly": true,
|
||||
"esModuleInterop": true,
|
||||
"lib": ["ES2021"],
|
||||
"module": "commonjs",
|
||||
|
||||
@@ -13,7 +13,9 @@
|
||||
},
|
||||
"license": "Apache-2.0",
|
||||
"scripts": {
|
||||
"build": "tsc",
|
||||
"build": "run-p build:*",
|
||||
"build:src": "node ../../scripts/esbuild.mjs",
|
||||
"build:types": "tsc",
|
||||
"test": "jest --reporters=default --reporters=jest-junit --env node --verbose --runInBand --bail",
|
||||
"test-unit": "pnpm test"
|
||||
},
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"declaration": true,
|
||||
"emitDeclarationOnly": true,
|
||||
"esModuleInterop": true,
|
||||
"lib": ["ES2021"],
|
||||
"module": "commonjs",
|
||||
|
||||
@@ -14,7 +14,9 @@
|
||||
},
|
||||
"license": "Apache-2.0",
|
||||
"scripts": {
|
||||
"build": "tsc",
|
||||
"build": "run-p build:*",
|
||||
"build:js": "node ../../scripts/esbuild.mjs",
|
||||
"build:types": "tsc",
|
||||
"test": "jest --reporters=default --reporters=jest-junit --env node --verbose --runInBand --bail",
|
||||
"test-unit": "pnpm test test/unit.*test.*",
|
||||
"test-e2e": "pnpm test test/integration.test.ts"
|
||||
@@ -36,7 +38,7 @@
|
||||
"@types/minimatch": "3.0.5",
|
||||
"@types/node": "14.18.33",
|
||||
"@types/semver": "7.3.10",
|
||||
"@vercel/build-utils": "7.0.0",
|
||||
"@vercel/build-utils": "7.1.0",
|
||||
"jest-junit": "16.0.0",
|
||||
"typescript": "4.9.5"
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"declaration": true,
|
||||
"emitDeclarationOnly": true,
|
||||
"esModuleInterop": true,
|
||||
"lib": ["ES2021"],
|
||||
"module": "commonjs",
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
# @vercel/gatsby-plugin-vercel-builder
|
||||
|
||||
## 2.0.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`9e3827c78`](https://github.com/vercel/vercel/commit/9e3827c785e1bc45f2bed421132167381481770f)]:
|
||||
- @vercel/build-utils@7.1.0
|
||||
- @vercel/node@3.0.3
|
||||
|
||||
## 2.0.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@vercel/gatsby-plugin-vercel-builder",
|
||||
"version": "2.0.2",
|
||||
"version": "2.0.3",
|
||||
"main": "dist/index.js",
|
||||
"files": [
|
||||
"dist",
|
||||
@@ -20,8 +20,8 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@sinclair/typebox": "0.25.24",
|
||||
"@vercel/build-utils": "7.0.0",
|
||||
"@vercel/node": "3.0.2",
|
||||
"@vercel/build-utils": "7.1.0",
|
||||
"@vercel/node": "3.0.3",
|
||||
"@vercel/routing-utils": "3.0.0",
|
||||
"esbuild": "0.14.47",
|
||||
"etag": "1.8.1",
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
"@types/node-fetch": "^2.3.0",
|
||||
"@types/tar": "^4.0.0",
|
||||
"@types/yauzl-promise": "2.1.0",
|
||||
"@vercel/build-utils": "7.0.0",
|
||||
"@vercel/build-utils": "7.1.0",
|
||||
"@vercel/ncc": "0.24.0",
|
||||
"async-retry": "1.3.1",
|
||||
"execa": "^1.0.0",
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
const execa = require('execa');
|
||||
const { remove } = require('fs-extra');
|
||||
|
||||
async function main() {
|
||||
await remove('dist');
|
||||
await execa('tsc', [], { stdio: 'inherit' });
|
||||
}
|
||||
|
||||
main().catch(err => {
|
||||
console.error(err);
|
||||
process.exit(1);
|
||||
});
|
||||
@@ -10,7 +10,9 @@
|
||||
"directory": "packages/hydrogen"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "node build.js",
|
||||
"build": "run-p build:*",
|
||||
"build:js": "node ../../scripts/esbuild.mjs",
|
||||
"build:types": "tsc",
|
||||
"test-e2e": "pnpm test test/test.js",
|
||||
"test": "jest --reporters=default --reporters=jest-junit --env node --verbose --bail --runInBand"
|
||||
},
|
||||
@@ -21,7 +23,7 @@
|
||||
"devDependencies": {
|
||||
"@types/jest": "27.5.1",
|
||||
"@types/node": "14.18.33",
|
||||
"@vercel/build-utils": "7.0.0",
|
||||
"@vercel/build-utils": "7.1.0",
|
||||
"@vercel/static-config": "3.0.0",
|
||||
"execa": "3.2.0",
|
||||
"fs-extra": "11.1.0",
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"declaration": true,
|
||||
"emitDeclarationOnly": true,
|
||||
"esModuleInterop": true,
|
||||
"lib": ["ES2021"],
|
||||
"module": "commonjs",
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
"@types/semver": "6.0.0",
|
||||
"@types/text-table": "0.2.1",
|
||||
"@types/webpack-sources": "3.2.0",
|
||||
"@vercel/build-utils": "7.0.0",
|
||||
"@vercel/build-utils": "7.1.0",
|
||||
"@vercel/nft": "0.22.5",
|
||||
"@vercel/routing-utils": "3.0.0",
|
||||
"async-sema": "3.0.1",
|
||||
|
||||
@@ -437,11 +437,19 @@ export async function serverBuild({
|
||||
|
||||
if (i18n) {
|
||||
for (const locale of i18n.locales) {
|
||||
const static404File =
|
||||
staticPages[path.posix.join(entryDirectory, locale, '/404')] ||
|
||||
new FileFsRef({
|
||||
let static404File =
|
||||
staticPages[path.posix.join(entryDirectory, locale, '/404')];
|
||||
|
||||
if (!static404File) {
|
||||
static404File = new FileFsRef({
|
||||
fsPath: path.join(pagesDir, locale, '/404.html'),
|
||||
});
|
||||
if (!fs.existsSync(static404File.fsPath)) {
|
||||
static404File = new FileFsRef({
|
||||
fsPath: path.join(pagesDir, '/404.html'),
|
||||
});
|
||||
}
|
||||
}
|
||||
requiredFiles[path.relative(baseDir, static404File.fsPath)] =
|
||||
static404File;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
# @vercel/node
|
||||
|
||||
## 3.0.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`9e3827c78`](https://github.com/vercel/vercel/commit/9e3827c785e1bc45f2bed421132167381481770f)]:
|
||||
- @vercel/build-utils@7.1.0
|
||||
|
||||
## 3.0.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@vercel/node",
|
||||
"version": "3.0.2",
|
||||
"version": "3.0.3",
|
||||
"license": "Apache-2.0",
|
||||
"main": "./dist/index",
|
||||
"homepage": "https://vercel.com/docs/runtimes#official-runtimes/node-js",
|
||||
@@ -23,7 +23,7 @@
|
||||
"@edge-runtime/primitives": "3.1.0",
|
||||
"@edge-runtime/vm": "3.1.0",
|
||||
"@types/node": "14.18.33",
|
||||
"@vercel/build-utils": "7.0.0",
|
||||
"@vercel/build-utils": "7.1.0",
|
||||
"@vercel/error-utils": "2.0.1",
|
||||
"@vercel/static-config": "3.0.0",
|
||||
"async-listen": "3.0.0",
|
||||
|
||||
@@ -127,7 +127,6 @@ export async function createServerlessEventHandler(
|
||||
if (contentEncoding) {
|
||||
body = compress(body, contentEncoding);
|
||||
const clonedHeaders = [];
|
||||
console.log(response.headers.entries());
|
||||
for (const [key, value] of response.headers.entries()) {
|
||||
if (key !== 'transfer-encoding') {
|
||||
// transfer-encoding is only for streaming response
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
const fs = require('fs-extra');
|
||||
const execa = require('execa');
|
||||
const { join } = require('path');
|
||||
|
||||
async function main() {
|
||||
const outDir = join(__dirname, 'dist');
|
||||
|
||||
// Start fresh
|
||||
await fs.remove(outDir);
|
||||
|
||||
await execa(
|
||||
'ncc',
|
||||
[
|
||||
'build',
|
||||
join(__dirname, 'src/index.ts'),
|
||||
'-e',
|
||||
'@vercel/build-utils',
|
||||
'-o',
|
||||
outDir,
|
||||
],
|
||||
{ stdio: 'inherit' }
|
||||
);
|
||||
}
|
||||
|
||||
main().catch(err => {
|
||||
console.error(err);
|
||||
process.exit(1);
|
||||
});
|
||||
@@ -14,7 +14,9 @@
|
||||
"directory": "packages/python"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "node build",
|
||||
"build": "run-p build:*",
|
||||
"build:js": "node ../../scripts/esbuild.mjs --bundle",
|
||||
"build:types": "tsc",
|
||||
"test": "jest --reporters=default --reporters=jest-junit --env node --verbose --runInBand --bail",
|
||||
"test-unit": "pnpm test test/unit.test.ts",
|
||||
"test-e2e": "pnpm test test/integration-*"
|
||||
@@ -23,7 +25,7 @@
|
||||
"@types/execa": "^0.9.0",
|
||||
"@types/jest": "27.4.1",
|
||||
"@types/node": "14.18.33",
|
||||
"@vercel/build-utils": "7.0.0",
|
||||
"@vercel/build-utils": "7.1.0",
|
||||
"@vercel/ncc": "0.24.0",
|
||||
"execa": "^1.0.0",
|
||||
"jest-junit": "16.0.0"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"declaration": true,
|
||||
"emitDeclarationOnly": true,
|
||||
"esModuleInterop": true,
|
||||
"lib": ["ES2021"],
|
||||
"module": "commonjs",
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
"@types/aws-lambda": "8.10.19",
|
||||
"@types/node": "14.18.33",
|
||||
"@types/semver": "6.0.0",
|
||||
"@vercel/build-utils": "7.0.0",
|
||||
"@vercel/build-utils": "7.1.0",
|
||||
"execa": "3.2.0",
|
||||
"fs-extra": "11.1.0",
|
||||
"jest-junit": "16.0.0"
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
# @vercel/remix-builder
|
||||
|
||||
## 2.0.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`9e3827c78`](https://github.com/vercel/vercel/commit/9e3827c785e1bc45f2bed421132167381481770f)]:
|
||||
- @vercel/build-utils@7.1.0
|
||||
|
||||
## 2.0.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
const execa = require('execa');
|
||||
const { remove } = require('fs-extra');
|
||||
|
||||
async function main() {
|
||||
await remove('dist');
|
||||
await execa('tsc', [], { stdio: 'inherit' });
|
||||
}
|
||||
|
||||
main().catch(err => {
|
||||
console.error(err);
|
||||
process.exit(1);
|
||||
});
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@vercel/remix-builder",
|
||||
"version": "2.0.1",
|
||||
"version": "2.0.2",
|
||||
"license": "Apache-2.0",
|
||||
"main": "./dist/index.js",
|
||||
"homepage": "https://vercel.com/docs",
|
||||
@@ -10,7 +10,9 @@
|
||||
"directory": "packages/remix"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "node build.js",
|
||||
"build": "run-p build:*",
|
||||
"build:js": "node ../../scripts/esbuild.mjs",
|
||||
"build:types": "tsc",
|
||||
"test": "jest --reporters=default --reporters=jest-junit --env node --verbose --bail --runInBand",
|
||||
"test-unit": "pnpm test test/unit.*test.*",
|
||||
"test-e2e": "pnpm test test/integration.test.ts"
|
||||
@@ -20,7 +22,7 @@
|
||||
"defaults"
|
||||
],
|
||||
"dependencies": {
|
||||
"@vercel/build-utils": "7.0.0",
|
||||
"@vercel/build-utils": "7.1.0",
|
||||
"@vercel/nft": "0.22.5",
|
||||
"@vercel/static-config": "3.0.0",
|
||||
"path-to-regexp": "6.2.1",
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"declaration": true,
|
||||
"emitDeclarationOnly": true,
|
||||
"esModuleInterop": true,
|
||||
"lib": ["ES2021"],
|
||||
"module": "commonjs",
|
||||
|
||||
@@ -14,7 +14,9 @@
|
||||
},
|
||||
"license": "Apache-2.0",
|
||||
"scripts": {
|
||||
"build": "tsc",
|
||||
"build": "run-p build:*",
|
||||
"build:js": "node ../../scripts/esbuild.mjs",
|
||||
"build:types": "tsc",
|
||||
"test": "jest --reporters=default --reporters=jest-junit --env node --verbose --runInBand --bail",
|
||||
"test-unit": "pnpm test"
|
||||
},
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
"outDir": "dist",
|
||||
"sourceMap": false,
|
||||
"declaration": true,
|
||||
"emitDeclarationOnly": true,
|
||||
"typeRoots": ["./@types", "./node_modules/@types"]
|
||||
},
|
||||
"include": ["src/**/*"],
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
"devDependencies": {
|
||||
"@types/fs-extra": "8.0.0",
|
||||
"@types/semver": "6.0.0",
|
||||
"@vercel/build-utils": "7.0.0",
|
||||
"@vercel/build-utils": "7.1.0",
|
||||
"@vercel/ncc": "0.24.0",
|
||||
"execa": "2.0.4",
|
||||
"fs-extra": "^7.0.1",
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
# @vercel/static-build
|
||||
|
||||
## 2.0.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies []:
|
||||
- @vercel/gatsby-plugin-vercel-builder@2.0.3
|
||||
|
||||
## 2.0.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@vercel/static-build",
|
||||
"version": "2.0.2",
|
||||
"version": "2.0.3",
|
||||
"license": "Apache-2.0",
|
||||
"main": "./dist/index",
|
||||
"homepage": "https://vercel.com/docs/build-step",
|
||||
@@ -20,7 +20,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@vercel/gatsby-plugin-vercel-analytics": "1.0.10",
|
||||
"@vercel/gatsby-plugin-vercel-builder": "2.0.2"
|
||||
"@vercel/gatsby-plugin-vercel-builder": "2.0.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/aws-lambda": "8.10.64",
|
||||
@@ -32,7 +32,7 @@
|
||||
"@types/node-fetch": "2.5.4",
|
||||
"@types/promise-timeout": "1.3.0",
|
||||
"@types/semver": "7.3.13",
|
||||
"@vercel/build-utils": "7.0.0",
|
||||
"@vercel/build-utils": "7.1.0",
|
||||
"@vercel/error-utils": "2.0.1",
|
||||
"@vercel/frameworks": "2.0.1",
|
||||
"@vercel/fs-detectors": "5.0.1",
|
||||
|
||||
@@ -9,7 +9,9 @@
|
||||
"directory": "packages/static-config"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "tsc",
|
||||
"build": "run-p build:*",
|
||||
"build:js": "node ../../scripts/esbuild.mjs",
|
||||
"build:types": "tsc",
|
||||
"test-unit": "pnpm test",
|
||||
"test": "jest --reporters=default --reporters=jest-junit --env node --verbose --runInBand --bail"
|
||||
},
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
"outDir": "dist",
|
||||
"sourceMap": true,
|
||||
"declaration": true,
|
||||
"emitDeclarationOnly": true,
|
||||
"moduleResolution": "node",
|
||||
"typeRoots": ["./@types", "./node_modules/@types"]
|
||||
},
|
||||
|
||||
635
pnpm-lock.yaml
generated
635
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
45
scripts/esbuild.mjs
Normal file
45
scripts/esbuild.mjs
Normal file
@@ -0,0 +1,45 @@
|
||||
import ts from 'typescript';
|
||||
import * as path from 'path';
|
||||
import { build } from 'esbuild';
|
||||
|
||||
function parseTsConfig(tsconfigPath) {
|
||||
const parsedConfig = ts.readConfigFile(tsconfigPath, ts.sys.readFile);
|
||||
if (parsedConfig.error) {
|
||||
console.error(
|
||||
'Error parsing tsconfig:',
|
||||
ts.flattenDiagnosticMessageText(parsedConfig.error.messageText, '\n')
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
const result = ts.parseJsonConfigFileContent(
|
||||
parsedConfig.config,
|
||||
ts.sys,
|
||||
path.dirname(tsconfigPath)
|
||||
);
|
||||
if (result.errors && result.errors.length > 0) {
|
||||
for (const error of result.errors) {
|
||||
console.error(ts.flattenDiagnosticMessageText(error.messageText, '\n'));
|
||||
}
|
||||
return;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
const cwd = process.cwd();
|
||||
const configPath = path.join(cwd, 'tsconfig.json');
|
||||
const tsconfig = parseTsConfig(configPath);
|
||||
|
||||
if (!tsconfig) {
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
await build({
|
||||
entryPoints: tsconfig.fileNames,
|
||||
bundle: process.argv.includes('--bundle'),
|
||||
format: 'cjs',
|
||||
outdir: tsconfig.options.outDir,
|
||||
platform: 'node',
|
||||
target: ts.ScriptTarget[tsconfig.options.target],
|
||||
sourcemap: tsconfig.options.sourceMap,
|
||||
});
|
||||
@@ -1,6 +1,11 @@
|
||||
{
|
||||
"$schema": "https://turborepo.org/schema.json",
|
||||
"globalDependencies": ["turbo-cache-key.json", "package.json", "test/lib/**"],
|
||||
"globalDependencies": [
|
||||
"turbo-cache-key.json",
|
||||
"package.json",
|
||||
"test/lib/**",
|
||||
"scripts/esbuild.mjs"
|
||||
],
|
||||
"pipeline": {
|
||||
"build": {
|
||||
"dependsOn": ["^build"],
|
||||
|
||||
15
utils/update-canary-tags.mjs
vendored
Normal file
15
utils/update-canary-tags.mjs
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
import fs from 'fs';
|
||||
import { spawnSync } from 'child_process';
|
||||
|
||||
const packagesDir = new URL('../packages/', import.meta.url);
|
||||
|
||||
for (const name of fs.readdirSync(packagesDir)) {
|
||||
const pkg = JSON.parse(
|
||||
fs.readFileSync(new URL(`${name}/package.json`, packagesDir), 'utf8')
|
||||
);
|
||||
spawnSync(
|
||||
'npm',
|
||||
`dist-tag add ${pkg.name}@${pkg.version} canary`.split(' '),
|
||||
{ stdio: 'inherit' }
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user