Compare commits

..

21 Commits

Author SHA1 Message Date
Vercel Release Bot
5cca9b6c5c Version Packages (#10289)
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## vercel@31.2.2

### Patch Changes

- Migrate list command to new structure
([#10284](https://github.com/vercel/vercel/pull/10284))

- Migrate whoami command to new structure
([#10266](https://github.com/vercel/vercel/pull/10266))

- Migrate logs command to new structure
([#10281](https://github.com/vercel/vercel/pull/10281))

- Migrate login command to new structure
([#10283](https://github.com/vercel/vercel/pull/10283))

- Migrate pull command to new structure
([#10280](https://github.com/vercel/vercel/pull/10280))

- Migrate logout command to new structure
([#10282](https://github.com/vercel/vercel/pull/10282))

- Migrate build command to new structure
([#10286](https://github.com/vercel/vercel/pull/10286))

- Migrate inspect command to new structure
([#10277](https://github.com/vercel/vercel/pull/10277))

- Migrate redeploy command to new structure
([#10279](https://github.com/vercel/vercel/pull/10279))

- Migrate link command to new structure
([#10285](https://github.com/vercel/vercel/pull/10285))

- Update spacing of --help output for CLI
([#10287](https://github.com/vercel/vercel/pull/10287))

- Updated dependencies
\[[`4af242af8`](4af242af86),
[`0cbdae141`](0cbdae1411),
[`85dd66778`](85dd667781)]:
    -   @vercel/node@2.15.8
    -   @vercel/remix-builder@1.9.1
    -   @vercel/static-build@1.3.44

## @vercel/gatsby-plugin-vercel-builder@1.3.16

### Patch Changes

- Updated dependencies
\[[`4af242af8`](4af242af86),
[`85dd66778`](85dd667781)]:
    -   @vercel/node@2.15.8

## @vercel/node@2.15.8

### Patch Changes

- Move `@types/content-type` to dev dependency
([#10292](https://github.com/vercel/vercel/pull/10292))

- fix: compress condition
([#10288](https://github.com/vercel/vercel/pull/10288))

## @vercel/remix-builder@1.9.1

### Patch Changes

- Disable root workspace check in pnpm and yarn when adding deps
([#10291](https://github.com/vercel/vercel/pull/10291))

## @vercel/static-build@1.3.44

### Patch Changes

-   Updated dependencies \[]:
    -   @vercel/gatsby-plugin-vercel-builder@1.3.16

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-08-02 15:04:48 -05:00
Nathan Rajlich
4af242af86 [node] Move @types/content-type to dev dependency (#10292)
`@types/content-type` is only needed at build time.
2023-08-02 20:00:14 +00:00
Nathan Rajlich
0cbdae1411 [remix] Disable root workspace check in pnpm and yarn when adding deps (#10291)
The Remix application might _also_ be the root of a workspace, so check for that case and pass the appropriate flag to the package manager to make it not error.

See: https://github.com/orgs/vercel/discussions/3467
2023-08-02 18:36:38 +00:00
Kiko Beats
85dd667781 fix: compress condition (#10288)
I'm experiencing an issue due the condition is wrongly set.

When the response is buffered, it should be `compress: true` since we're acting as proxy, and we're going to recompress again.

When the response is streaming, then it should be `compress: false` since the response is going to be piped.
2023-08-02 18:15:16 +00:00
Trek Glowacki
7d3dda7341 [cli] Update spacing on --help output (#10287)
Indent more items rightwards to tidy up spacing.

Example of unmigrated `bisect` on current `main`:
<img width="561" alt="CleanShot 2023-07-31 at 14 47 38@2x" src="https://github.com/vercel/vercel/assets/9736/7474ac88-775c-43aa-937b-3f544c064c6d">

Migrated example (https://github.com/vercel/vercel/pull/10276) before changes in this PR:
<img width="661" alt="CleanShot 2023-07-31 at 15 07 26@2x" src="https://github.com/vercel/vercel/assets/9736/076b247c-35cf-45ea-8713-3c684b5063e4">


Migrated example after changes in this PR:
<img width="693" alt="CleanShot 2023-07-31 at 14 46 39@2x" src="https://github.com/vercel/vercel/assets/9736/f5f056a1-7f68-42e5-a724-79cf86031d09">
2023-08-02 17:33:59 +00:00
Vercel Release Bot
2144d0b2a9 [tests] Upgrade Turbo to version 1.10.12 (#10270)
This auto-generated PR updates Turbo to version 1.10.12
2023-08-02 17:12:33 +00:00
Trek Glowacki
976e6aedf9 [cli] Migrate link command to new structure (#10285)
Before:
<img width="785" alt="CleanShot 2023-07-31 at 09 55 03@2x" src="https://github.com/vercel/vercel/assets/9736/1f60cbcb-354f-4005-bb74-8ffd68a38fba">

After:
<img width="785" alt="CleanShot 2023-07-31 at 09 55 03@2x" src="https://github.com/vercel/vercel/assets/9736/4eea5e82-0304-4949-9e8f-aeaa1b2e74eb">
2023-08-02 16:48:24 +00:00
Trek Glowacki
6328751e14 [cli] Migrate whoami to new command structure (#10266)
Migrating `whoami` to the command structure created in #10090. Unsure about tests. This is technically a refactor so existing tests should suffice.
2023-08-02 14:21:57 +00:00
Trek Glowacki
8cb49a5136 [cli] Migrate logout command to new structure (#10282)
Co-authored-by: Trek Glowacki <trek.glowacki@vercel.com>
Co-authored-by: Chris Barber <chris.barber@vercel.com>
2023-08-02 08:59:49 -05:00
Trek Glowacki
3fa4f344cc [cli] Migrate pull command to new structure (#10280)
Before:
<img width="797" alt="CleanShot 2023-07-31 at 09 23 44@2x" src="https://github.com/vercel/vercel/assets/9736/88edd229-0aab-4155-9739-de64ad42e2f0">

After:
<img width="765" alt="CleanShot 2023-07-31 at 09 23 59@2x" src="https://github.com/vercel/vercel/assets/9736/574d0af0-5ce4-48dd-ad59-c4ca9893c147">
2023-08-01 20:24:25 +00:00
Trek Glowacki
27610896ed [cli] Migrate inspect command to new structure (#10277)
Before:
<img width="659" alt="CleanShot 2023-07-31 at 10 06 01@2x" src="https://github.com/vercel/vercel/assets/9736/32c91a94-9ae7-479c-8255-e4b554badd2f">


After:
<img width="664" alt="CleanShot 2023-07-31 at 10 06 11@2x" src="https://github.com/vercel/vercel/assets/9736/9237b42a-a015-4d58-8231-5e257342ac90">
2023-08-01 20:05:11 +00:00
Trek Glowacki
b9dae36e37 [cli] Migrate logs command to new structure (#10281)
Before:
<img width="669" alt="CleanShot 2023-07-31 at 09 36 25@2x" src="https://github.com/vercel/vercel/assets/9736/ee28d4b7-33eb-49cf-a565-fd4f56bf8bb6">

After:
<img width="693" alt="CleanShot 2023-07-31 at 09 36 46@2x" src="https://github.com/vercel/vercel/assets/9736/450d7c54-216f-4590-98b9-9f6b1a13d040">
2023-08-01 19:43:16 +00:00
Ilya Komichev
1537ff9c38 chore(README): set correct link to nuxt docs (#10265)
Co-authored-by: Chris Barber <chris.barber@vercel.com>
2023-08-01 13:46:39 -05:00
Trek Glowacki
7e0317775f [cli] Migrate build command to new structure (#10286)
Before:
<img width="854" alt="CleanShot 2023-07-31 at 09 59 18@2x" src="https://github.com/vercel/vercel/assets/9736/7a91572f-1481-4a2a-ac70-2384d6c30560">

After:
<img width="907" alt="CleanShot 2023-07-31 at 09 59 30@2x" src="https://github.com/vercel/vercel/assets/9736/ed358eae-9207-4ebe-ad41-865ce213560e">
2023-08-01 16:59:01 +00:00
Trek Glowacki
2dd27976b3 [cli] Migrate redeploy command to new structure (#10279)
Before:
<img width="816" alt="CleanShot 2023-07-31 at 09 19 16@2x" src="https://github.com/vercel/vercel/assets/9736/cf194706-8071-4f86-9a1c-896383a51a29">

After:
<img width="673" alt="CleanShot 2023-07-31 at 09 19 30@2x" src="https://github.com/vercel/vercel/assets/9736/d0f3faed-83e7-40b9-9252-c8b68855a7a3">
2023-08-01 16:37:32 +00:00
Trek Glowacki
25e2b7efba [cli] Migrate login command to new structure (#10283)
We currently incorrectly specify the argument is required with `<>`, but the examples show you can do `vercel login` without an argument, so I've corrected that as part of this migration.

Before:
<img width="549" alt="CleanShot 2023-07-31 at 09 44 28@2x" src="https://github.com/vercel/vercel/assets/9736/f1b1a328-69e0-4d61-b65c-d2739c81f61c">


After:
<img width="684" alt="CleanShot 2023-07-31 at 09 44 43@2x" src="https://github.com/vercel/vercel/assets/9736/e2bb28bf-e3d8-4d89-ad7e-864dd091ec3d">
2023-08-01 15:43:02 +00:00
Trek Glowacki
3d23d1270c [cli] Migrate list command to new structure (#10284)
Before:

<img width="809" alt="CleanShot 2023-07-31 at 09 51 37@2x" src="https://github.com/vercel/vercel/assets/9736/f5ac2ccc-3ff9-4a52-9c93-4a47fe479497">


After:
<img width="836" alt="CleanShot 2023-07-31 at 09 51 48@2x" src="https://github.com/vercel/vercel/assets/9736/48314715-132a-477a-8a66-a5d23c27ee50">
2023-07-31 22:21:11 +00:00
Vercel Release Bot
fde40e731a Version Packages (#10278)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-07-31 13:31:22 -05:00
Trek Glowacki
f353527421 [cli] Migrate bisect command to new structure (#10276)
Migrating `bisect` to the command structure created in https://github.com/vercel/vercel/pull/10090. Unsure about tests. This is technically a refactor so existing tests should suffice.

Before:
<img width="534" alt="CleanShot 2023-07-31 at 08 14 29@2x" src="https://github.com/vercel/vercel/assets/9736/8ae53672-9b1f-444a-94d3-296ac0fa8d30">

After:
<img width="674" alt="CleanShot 2023-07-31 at 08 15 02@2x" src="https://github.com/vercel/vercel/assets/9736/0ba12f19-fb34-41f3-84fb-0c1498d7a485">
2023-07-31 16:03:13 +00:00
Trek Glowacki
c1cdfb3e75 [cli] Migrate remove command to new structure (#10268)
Migrating `remove` to the command structure created in #10090. Unsure about tests. This is technically a refactor so existing tests should suffice.
2023-07-31 15:42:27 +00:00
Kiko Beats
fc413707d0 fix: move content-type as dependency (#10274)
It's required by `serverless-functions/helpers.js` causing unhandled
error because it's missing.

```
Error: Cannot find module 'content-type'
Require stack:
- /Users/kikobeats/Library/pnpm/global/5/.pnpm/@vercel+node@2.15.6/node_modules/@vercel/node/dist/serverless-functions/helpers.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:1077:15)
    at Function.Module._resolveFilename.sharedData.moduleResolveFilenameHook.installedValue [as _resolveFilename] (/Users/kikobeats/Library/pnpm/global/5/.pnpm/@cspotcode+source-map-support@0.8.1/node_modules/@cspotcode/source-map-support/source-map-support.js:811:30)
    at Function.Module._load (node:internal/modules/cjs/loader:922:27)
    at Module.require (node:internal/modules/cjs/loader:1143:19)
    at require (node:internal/modules/cjs/helpers:110:18)
    at Object.<anonymous> (/Users/kikobeats/Library/pnpm/global/5/.pnpm/@vercel+node@2.15.6/node_modules/@vercel/node/dist/serverless-functions/helpers.js:6:24)
    at Module._compile (node:internal/modules/cjs/loader:1256:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
    at Object.require.extensions.<computed> [as .js] (/Users/kikobeats/Library/pnpm/global/5/.pnpm/ts-node@10.9.1_@types+node@14.18.33_typescript@4.9.5/node_modules/ts-node/src/index.ts:1608:43)
    at Module.load (node:internal/modules/cjs/loader:1119:32) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/Users/kikobeats/Library/pnpm/global/5/.pnpm/@vercel+node@2.15.6/node_modules/@vercel/node/dist/serverless-functions/helpers.js'
  ]
}
```
2023-07-31 16:11:18 +02:00
44 changed files with 1165 additions and 893 deletions

View File

@@ -45,4 +45,4 @@ Locally preview production build:
npm run preview
```
Checkout the [deployment documentation](https://v3.nuxtjs.org/guide/deploy/presets) for more information.
Checkout the [deployment documentation](https://nuxt.com/docs/getting-started/deployment#presets) for more information.

View File

@@ -32,7 +32,7 @@
"source-map-support": "0.5.12",
"ts-eager": "2.0.2",
"ts-jest": "29.1.0",
"turbo": "1.10.9",
"turbo": "1.10.12",
"typescript": "4.9.5"
},
"scripts": {

View File

@@ -1,5 +1,48 @@
# vercel
## 31.2.2
### Patch Changes
- Migrate list command to new structure ([#10284](https://github.com/vercel/vercel/pull/10284))
- Migrate whoami command to new structure ([#10266](https://github.com/vercel/vercel/pull/10266))
- Migrate logs command to new structure ([#10281](https://github.com/vercel/vercel/pull/10281))
- Migrate login command to new structure ([#10283](https://github.com/vercel/vercel/pull/10283))
- Migrate pull command to new structure ([#10280](https://github.com/vercel/vercel/pull/10280))
- Migrate logout command to new structure ([#10282](https://github.com/vercel/vercel/pull/10282))
- Migrate build command to new structure ([#10286](https://github.com/vercel/vercel/pull/10286))
- Migrate inspect command to new structure ([#10277](https://github.com/vercel/vercel/pull/10277))
- Migrate redeploy command to new structure ([#10279](https://github.com/vercel/vercel/pull/10279))
- Migrate link command to new structure ([#10285](https://github.com/vercel/vercel/pull/10285))
- Update spacing of --help output for CLI ([#10287](https://github.com/vercel/vercel/pull/10287))
- Updated dependencies [[`4af242af8`](https://github.com/vercel/vercel/commit/4af242af8633e58b6a9bf920564416da3ef22ad4), [`0cbdae141`](https://github.com/vercel/vercel/commit/0cbdae1411aa7936ff7dfe551919ca5e56cd6e98), [`85dd66778`](https://github.com/vercel/vercel/commit/85dd667781693539d753d587566e53964bbe189d)]:
- @vercel/node@2.15.8
- @vercel/remix-builder@1.9.1
- @vercel/static-build@1.3.44
## 31.2.1
### Patch Changes
- Migrate bisect command to new structure ([#10276](https://github.com/vercel/vercel/pull/10276))
- Migrate remove command to new structure ([#10268](https://github.com/vercel/vercel/pull/10268))
- Updated dependencies [[`fc413707d`](https://github.com/vercel/vercel/commit/fc413707d017e234d5013b761d885f65f9b981bc)]:
- @vercel/node@2.15.7
- @vercel/static-build@1.3.43
## 31.2.0
### Minor Changes

View File

@@ -1,6 +1,6 @@
{
"name": "vercel",
"version": "31.2.0",
"version": "31.2.2",
"preferGlobal": true,
"license": "Apache-2.0",
"description": "The command-line interface for Vercel",
@@ -35,12 +35,12 @@
"@vercel/go": "2.5.1",
"@vercel/hydrogen": "0.0.64",
"@vercel/next": "3.9.3",
"@vercel/node": "2.15.6",
"@vercel/node": "2.15.8",
"@vercel/python": "3.1.60",
"@vercel/redwood": "1.1.15",
"@vercel/remix-builder": "1.9.0",
"@vercel/remix-builder": "1.9.1",
"@vercel/ruby": "1.3.76",
"@vercel/static-build": "1.3.42"
"@vercel/static-build": "1.3.44"
},
"devDependencies": {
"@alex_neo/jest-expect-message": "1.0.5",

View File

@@ -0,0 +1,69 @@
import { Command } from '../help';
import { getPkgName } from '../../util/pkg-name';
export const bisectCommand: Command = {
name: 'bisect',
description: 'Bisect the current project interactively.',
arguments: [],
options: [
{
name: 'bad',
description: 'Known bad URL',
argument: 'URL',
shorthand: 'b',
type: 'string',
deprecated: false,
multi: false,
},
{
name: 'good',
description: 'Known good URL',
argument: 'URL',
shorthand: 'g',
type: 'string',
deprecated: false,
multi: false,
},
{
name: 'open',
description: 'Automatically open each URL in the browser',
argument: 'URL',
shorthand: 'o',
type: 'string',
deprecated: false,
multi: false,
},
{
name: 'path',
description: 'Subpath of the deployment URL to test',
argument: 'URL',
shorthand: 'p',
type: 'string',
deprecated: false,
multi: false,
},
{
name: 'run',
description: 'Test script to run for each deployment',
argument: 'URL',
shorthand: 'r',
type: 'string',
deprecated: false,
multi: false,
},
],
examples: [
{
name: 'Bisect the current project interactively',
value: `${getPkgName()} bisect`,
},
{
name: 'Bisect with a known bad deployment',
value: `${getPkgName()} bisect --bad example-310pce9i0.vercel.app`,
},
{
name: 'Automated bisect with a run script',
value: `${getPkgName()} bisect --run ./test.sh`,
},
],
};

View File

@@ -8,53 +8,19 @@ import { URLSearchParams, parse } from 'url';
import box from '../../util/output/box';
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 } from '@vercel-internals/types';
import { normalizeURL } from '../../util/bisect/normalize-url';
import getScope from '../../util/get-scope';
import getDeployment from '../../util/get-deployment';
import { help } from '../help';
import { bisectCommand } from './command';
interface Deployments {
deployments: Deployment[];
}
const pkgName = getPkgName();
const help = () => {
console.log(`
${chalk.bold(`${logo} ${pkgName} bisect`)} [options]
${chalk.dim('Options:')}
-h, --help Output usage information
-d, --debug Debug mode [off]
--no-color No color mode [off]
-b, --bad Known bad URL
-g, --good Known good URL
-o, --open Automatically open each URL in the browser
-p, --path Subpath of the deployment URL to test
-r, --run Test script to run for each deployment
${chalk.dim('Examples:')}
${chalk.gray('')} Bisect the current project interactively
${chalk.cyan(`$ ${pkgName} bisect`)}
${chalk.gray('')} Bisect with a known bad deployment
${chalk.cyan(`$ ${pkgName} bisect --bad example-310pce9i0.vercel.app`)}
${chalk.gray('')} Automated bisect with a run script
${chalk.cyan(`$ ${pkgName} bisect --run ./test.sh`)}
`);
};
export default async function main(client: Client): Promise<number> {
export default async function bisect(client: Client): Promise<number> {
const { output } = client;
const scope = await getScope(client);
const { contextName } = scope;
@@ -73,7 +39,7 @@ export default async function main(client: Client): Promise<number> {
});
if (argv['--help']) {
help();
output.print(help(bisectCommand, { columns: client.stderr.columns }));
return 2;
}

View File

@@ -0,0 +1,46 @@
import { Command } from '../help';
import { getPkgName } from '../../util/pkg-name';
export const buildCommand: Command = {
name: 'build',
description: 'Build the project.',
arguments: [],
options: [
{
name: 'prod',
description: 'Build a production deployment',
shorthand: null,
type: 'string',
deprecated: false,
multi: false,
},
{
name: 'output',
description: 'Directory where built assets should be written to',
shorthand: null,
argument: 'PATH',
type: 'string',
deprecated: false,
multi: false,
},
{
name: 'yes',
description:
'Skip the confirmation prompt about pulling environment variables and project settings when not found locally',
shorthand: 'y',
type: 'boolean',
deprecated: false,
multi: false,
},
],
examples: [
{
name: 'Build the project',
value: `${getPkgName()} build`,
},
{
name: 'Build the project in a specific directory',
value: `${getPkgName()} build --cwd ./path-to-project`,
},
],
};

View File

@@ -38,35 +38,37 @@ import {
import { fileNameSymbol } from '@vercel/client';
import type { VercelConfig } from '@vercel/client';
import pull from './pull';
import { staticFiles as getFiles } from '../util/get-files';
import Client from '../util/client';
import getArgs from '../util/get-args';
import cmd from '../util/output/cmd';
import * as cli from '../util/pkg-name';
import cliPkg from '../util/pkg';
import readJSONFile from '../util/read-json-file';
import { CantParseJSONFile } from '../util/errors-ts';
import pull from '../pull';
import { staticFiles as getFiles } from '../../util/get-files';
import Client from '../../util/client';
import getArgs from '../../util/get-args';
import cmd from '../../util/output/cmd';
import * as cli from '../../util/pkg-name';
import cliPkg from '../../util/pkg';
import readJSONFile from '../../util/read-json-file';
import { CantParseJSONFile } from '../../util/errors-ts';
import {
pickOverrides,
ProjectLinkAndSettings,
readProjectSettings,
} from '../util/projects/project-settings';
import { getProjectLink, VERCEL_DIR } from '../util/projects/link';
import confirm from '../util/input/confirm';
import { emoji, prependEmoji } from '../util/emoji';
import stamp from '../util/output/stamp';
} from '../../util/projects/project-settings';
import { getProjectLink, VERCEL_DIR } from '../../util/projects/link';
import confirm from '../../util/input/confirm';
import { emoji, prependEmoji } from '../../util/emoji';
import stamp from '../../util/output/stamp';
import {
OUTPUT_DIR,
PathOverride,
writeBuildResult,
} from '../util/build/write-build-result';
import { importBuilders } from '../util/build/import-builders';
import { initCorepack, cleanupCorepack } from '../util/build/corepack';
import { sortBuilders } from '../util/build/sort-builders';
import { toEnumerableError } from '../util/error';
import { validateConfig } from '../util/validate-config';
import { setMonorepoDefaultSettings } from '../util/build/monorepo';
} from '../../util/build/write-build-result';
import { importBuilders } from '../../util/build/import-builders';
import { initCorepack, cleanupCorepack } from '../../util/build/corepack';
import { sortBuilders } from '../../util/build/sort-builders';
import { toEnumerableError } from '../../util/error';
import { validateConfig } from '../../util/validate-config';
import { setMonorepoDefaultSettings } from '../../util/build/monorepo';
import { help } from '../help';
import { buildCommand } from './command';
type BuildResult = BuildResultV2 | BuildResultV3;
@@ -103,35 +105,6 @@ export interface BuildsManifest {
builds?: SerializedBuilder[];
}
const help = () => {
return console.log(`
${chalk.bold(`${cli.logo} ${cli.name} build`)}
${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
--cwd [path] The current working directory
--output [path] Directory where built assets should be written to
--prod Build a production deployment
-d, --debug Debug mode [off]
--no-color No color mode [off]
-y, --yes Skip the confirmation prompt about pulling environment variables and project settings when not found locally
${chalk.dim('Examples:')}
${chalk.gray('-')} Build the project
${chalk.cyan(`$ ${cli.name} build`)}
${chalk.cyan(`$ ${cli.name} build --cwd ./path-to-project`)}
`);
};
export default async function main(client: Client): Promise<number> {
let { cwd } = client;
const { output } = client;
@@ -162,7 +135,7 @@ export default async function main(client: Client): Promise<number> {
});
if (argv['--help']) {
help();
output.print(help(buildCommand, { columns: client.stderr.columns }));
return 2;
}

View File

@@ -132,8 +132,8 @@ export function lineToString(line: string[]) {
return string;
}
export function outputArrayToString(outputArray: string[]) {
return outputArray.join(NEWLINE);
export function outputArrayToString(outputArray: (string | null)[]) {
return outputArray.filter(line => line !== null).join(NEWLINE);
}
/**
@@ -142,7 +142,12 @@ export function outputArrayToString(outputArray: string[]) {
* @returns
*/
export function buildCommandSynopsisLine(command: Command) {
const line: string[] = [LOGO, chalk.bold(NAME), chalk.bold(command.name)];
const line: string[] = [
INDENT,
LOGO,
chalk.bold(NAME),
chalk.bold(command.name),
];
if (command.arguments.length > 0) {
for (const argument of command.arguments) {
line.push(argument.required ? argument.name : `[${argument.name}]`);
@@ -151,6 +156,8 @@ export function buildCommandSynopsisLine(command: Command) {
if (command.options.length > 0) {
line.push('[options]');
}
line.push(NEWLINE);
return lineToString(line);
}
@@ -165,11 +172,11 @@ export function buildCommandOptionLines(
);
if (commandOptions.length === 0) {
return '';
return null;
}
// Initialize output array with header and empty line
const outputArray: string[] = [`${chalk.dim(sectionTitle)}:`, ''];
const outputArray: string[] = [`${INDENT}${chalk.dim(sectionTitle)}:`, ''];
// Start building option lines
const optionLines: string[][] = [];
@@ -181,7 +188,7 @@ export function buildCommandOptionLines(
let maxLineStartLength = 0;
// Iterate over options and create the "start" of each option (e.g. ` -b, --build-env <key=value>`)
for (const option of commandOptions) {
const startLine: string[] = [INDENT];
const startLine: string[] = [INDENT, INDENT, INDENT];
if (option.shorthand) {
startLine.push(`-${option.shorthand},`);
}
@@ -249,12 +256,11 @@ export function buildCommandOptionLines(
}
}
// return the entire list of options as a single string after delete the last '\n' added to the option list
return outputArrayToString(outputArray);
return `${outputArrayToString(outputArray)}${NEWLINE}`;
}
export function buildCommandExampleLines(command: Command) {
const outputArray: string[] = [chalk.dim(`Examples:`), ''];
const outputArray: string[] = [`${INDENT}${chalk.dim('Examples:')}`, ''];
for (const example of command.examples) {
const nameLine: string[] = [INDENT];
nameLine.push(chalk.gray('-'));
@@ -273,12 +279,15 @@ export function buildCommandExampleLines(command: Command) {
}
outputArray.push('');
}
// delete the last newline added after examples iteration
outputArray.splice(-1);
return outputArrayToString(outputArray);
}
function buildDescriptionLine(command: Command) {
const line: string[] = [INDENT, command.description, NEWLINE];
return lineToString(line);
}
interface BuildHelpOutputOptions {
columns: number;
}
@@ -287,15 +296,12 @@ export function buildHelpOutput(
command: Command,
options: BuildHelpOutputOptions
) {
const outputArray: string[] = [
const outputArray: (string | null)[] = [
'',
buildCommandSynopsisLine(command),
'',
command.description,
'',
buildDescriptionLine(command),
buildCommandOptionLines(command.options, options, 'Options'),
'',
buildCommandOptionLines(globalCommandOptions, options, 'Global Options'),
'',
buildCommandExampleLines(command),
'',
];

View File

@@ -0,0 +1,50 @@
import { Command } from '../help';
import { getPkgName } from '../../util/pkg-name';
export const inspectCommand: Command = {
name: 'inspect',
description: 'Show information about a deployment.',
arguments: [
{
name: 'url',
required: true,
},
],
options: [
{
name: 'timeout',
description: 'Time to wait for deployment completion [3m]',
argument: 'TIME',
shorthand: null,
type: 'string',
deprecated: false,
multi: false,
},
{
name: 'wait',
description: 'Blocks until deployment completes',
shorthand: null,
type: 'string',
deprecated: false,
multi: false,
},
],
examples: [
{
name: 'Get information about a deployment by its unique URL',
value: `${getPkgName()} inspect my-deployment-ji2fjij2.vercel.app`,
},
{
name: 'Get information about the deployment an alias points to',
value: `${getPkgName()} inspect my-deployment.vercel.app`,
},
{
name: 'Get information about a deployment by piping in the URL',
value: `echo my-deployment.vercel.app | ${getPkgName()} inspect`,
},
{
name: 'Wait up to 90 seconds for deployment to complete',
value: `${getPkgName()} inspect my-deployment.vercel.app --wait --timeout 90s`,
},
],
};

View File

@@ -1,71 +1,27 @@
import chalk from 'chalk';
import getArgs from '../util/get-args';
import buildsList from '../util/output/builds';
import routesList from '../util/output/routes';
import indent from '../util/output/indent';
import logo from '../util/output/logo';
import elapsed from '../util/output/elapsed';
import { handleError } from '../util/error';
import getScope from '../util/get-scope';
import { getPkgName, getCommandName } from '../util/pkg-name';
import Client from '../util/client';
import getDeployment from '../util/get-deployment';
import getArgs from '../../util/get-args';
import buildsList from '../../util/output/builds';
import routesList from '../../util/output/routes';
import indent from '../../util/output/indent';
import elapsed from '../../util/output/elapsed';
import { handleError } from '../../util/error';
import getScope from '../../util/get-scope';
import { getCommandName } from '../../util/pkg-name';
import Client from '../../util/client';
import getDeployment from '../../util/get-deployment';
import type { Build, Deployment } from '@vercel-internals/types';
import title from 'title';
import { isErrnoException } from '@vercel/error-utils';
import { URL } from 'url';
import readStandardInput from '../util/input/read-standard-input';
import sleep from '../util/sleep';
import readStandardInput from '../../util/input/read-standard-input';
import sleep from '../../util/sleep';
import ms from 'ms';
import { isDeploying } from '../util/deploy/is-deploying';
import { isDeploying } from '../../util/deploy/is-deploying';
import { help } from '../help';
import { inspectCommand } from './command';
const help = () => {
console.log(`
${chalk.bold(`${logo} ${getPkgName()} inspect`)} <url>
${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
-t ${chalk.bold.underline('TOKEN')}, --token=${chalk.bold.underline(
'TOKEN'
)} Login token
-d, --debug Debug mode [off]
--no-color No color mode [off]
-S, --scope Set a custom scope
--timeout=${chalk.bold.underline(
'TIME'
)} Time to wait for deployment completion [3m]
--wait Blocks until deployment completes
${chalk.dim('Examples:')}
${chalk.gray('')} Get information about a deployment by its unique URL
${chalk.cyan(`$ ${getPkgName()} inspect my-deployment-ji2fjij2.vercel.app`)}
${chalk.gray('-')} Get information about the deployment an alias points to
${chalk.cyan(`$ ${getPkgName()} inspect my-deployment.vercel.app`)}
${chalk.gray('-')} Get information about a deployment by piping in the URL
${chalk.cyan(`$ echo my-deployment.vercel.app | ${getPkgName()} inspect`)}
${chalk.gray('-')} Wait up to 90 seconds for deployment to complete
${chalk.cyan(
`$ ${getPkgName()} inspect my-deployment.vercel.app --wait --timeout 90s`
)}
`);
};
export default async function main(client: Client) {
export default async function inspect(client: Client) {
const { output } = client;
let argv;
try {
@@ -79,7 +35,7 @@ export default async function main(client: Client) {
}
if (argv['--help']) {
help();
output.print(help(inspectCommand, { columns: client.stderr.columns }));
return 2;
}
@@ -99,7 +55,7 @@ export default async function main(client: Client) {
if (!deploymentIdOrHost) {
error(`${getCommandName('inspect <url>')} expects exactly one argument`);
help();
output.print(help(inspectCommand, { columns: client.stderr.columns }));
return 1;
}

View File

@@ -0,0 +1,54 @@
import { Command } from '../help';
import { getPkgName } from '../../util/pkg-name';
export const linkCommand: Command = {
name: 'link',
description: 'Link a local directory to a Vercel Project.',
arguments: [],
options: [
{
name: 'repo',
description: 'Link multiple projects based on Git repository (alpha)',
shorthand: 'r',
type: 'string',
deprecated: false,
multi: false,
},
{
name: 'project',
description: 'Specify a project name',
shorthand: 'p',
argument: 'NAME',
type: 'string',
deprecated: false,
multi: false,
},
{
name: 'yes',
description:
'Skip questions when setting up new project using default scope and settings',
shorthand: 'y',
type: 'boolean',
deprecated: false,
multi: false,
},
],
examples: [
{
name: 'Link current directory to a Vercel Project',
value: `${getPkgName()} link`,
},
{
name: 'Link current directory with default options and skip questions',
value: `${getPkgName()} link --yes`,
},
{
name: 'Link a specific directory to a Vercel Project',
value: `${getPkgName()} link --cwd /path/to/project`,
},
{
name: 'Link to the current Git repository, allowing for multiple Vercel Projects to be linked simultaneously (useful for monorepos)',
value: `${getPkgName()} link --repo`,
},
],
};

View File

@@ -1,62 +1,12 @@
import chalk from 'chalk';
import Client from '../../util/client';
import getArgs from '../../util/get-args';
import logo from '../../util/output/logo';
import cmd from '../../util/output/cmd';
import { getPkgName } from '../../util/pkg-name';
import { ensureLink } from '../../util/link/ensure-link';
import { ensureRepoLink } from '../../util/link/repo';
import { help } from '../help';
import { linkCommand } from './command';
const help = () => {
console.log(`
${chalk.bold(`${logo} ${getPkgName()} link`)} [options]
${chalk.dim('Options:')}
-h, --help Output usage information
-r, --repo Link multiple projects based on Git repository (alpha)
-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
-p ${chalk.bold.underline('NAME')}, --project=${chalk.bold.underline(
'NAME'
)} Project name
-y, --yes Skip questions when setting up new project using default scope and settings
${chalk.dim('Examples:')}
${chalk.gray('')} Link current directory to a Vercel Project
${chalk.cyan(`$ ${getPkgName()} link`)}
${chalk.gray(
''
)} Link current directory with default options and skip questions
${chalk.cyan(`$ ${getPkgName()} link --yes`)}
${chalk.gray('')} Link a specific directory to a Vercel Project
${chalk.cyan(`$ ${getPkgName()} link --cwd /path/to/project`)}
${chalk.gray('')} ${chalk.yellow(
'(alpha)'
)} Link to the current Git repository, allowing for multiple
Vercel Projects to be linked simultaneously (useful for monorepos)
${chalk.cyan(`$ ${getPkgName()} link --repo`)}
`);
};
export default async function main(client: Client) {
export default async function link(client: Client) {
const argv = getArgs(client.argv.slice(2), {
'--yes': Boolean,
'-y': '--yes',
@@ -71,7 +21,7 @@ export default async function main(client: Client) {
});
if (argv['--help']) {
help();
client.output.print(help(linkCommand, { columns: client.stderr.columns }));
return 2;
}

View File

@@ -0,0 +1,61 @@
import { Command } from '../help';
import { getPkgName } from '../../util/pkg-name';
export const listCommand: Command = {
name: 'list',
description: 'List app deployments for an app.',
arguments: [
{
name: 'app',
required: false,
},
],
options: [
{
name: 'meta',
description:
'Filter deployments by metadata (e.g.: `-m KEY=value`). Can appear many times.',
argument: 'KEY=value',
shorthand: null,
type: 'string',
deprecated: false,
multi: true,
},
{
name: 'environment',
description: '',
argument: 'production|preview',
shorthand: null,
type: 'string',
deprecated: false,
multi: false,
},
{
name: 'next',
description: 'Show next page of results',
argument: 'MS',
shorthand: 'n',
type: 'string',
deprecated: false,
multi: false,
},
],
examples: [
{
name: 'List all deployments for the currently linked project',
value: `${getPkgName()} list`,
},
{
name: 'List all deployments for the project `my-app` in the team of the currently linked project',
value: `${getPkgName()} list my-app`,
},
{
name: 'Filter deployments by metadata',
value: `${getPkgName()} list -m key1=value1 -m key2=value2`,
},
{
name: 'Paginate deployments for a project, where `1584722256178` is the time in milliseconds since the UNIX epoch',
value: `${getPkgName()} list my-app --next 1584722256178`,
},
],
};

View File

@@ -2,78 +2,27 @@ import chalk from 'chalk';
import ms from 'ms';
import table from 'text-table';
import title from 'title';
import Now from '../util';
import getArgs from '../util/get-args';
import { handleError } from '../util/error';
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 Now from '../../util';
import getArgs from '../../util/get-args';
import { handleError } from '../../util/error';
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 { getCommandName } from '../../util/pkg-name';
import Client from '../../util/client';
import { Deployment } from '@vercel/client';
import { getLinkedProject } from '../util/projects/link';
import { ensureLink } from '../util/link/ensure-link';
import getScope from '../util/get-scope';
import { isAPIError } from '../util/errors-ts';
import { getLinkedProject } from '../../util/projects/link';
import { ensureLink } from '../../util/link/ensure-link';
import getScope from '../../util/get-scope';
import { isAPIError } from '../../util/errors-ts';
import { isErrnoException } from '@vercel/error-utils';
import { help } from '../help';
import { listCommand } from './command';
const help = () => {
console.log(`
${chalk.bold(`${logo} ${getPkgName()} list`)} [app]
${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]
-y, --yes Skip questions when setting up new project using default scope and settings
-t ${chalk.bold.underline('TOKEN')}, --token=${chalk.bold.underline(
'TOKEN'
)} Login token
-S, --scope Set a custom scope
-m, --meta Filter deployments by metadata (e.g.: ${chalk.dim(
'`-m KEY=value`'
)}). Can appear many times.
--environment=${chalk.bold.underline(
'ENVIRONMENT'
)} Filter by environment (production|preview)
-N, --next Show next page of results
${chalk.dim('Examples:')}
${chalk.gray('')} List all deployments for the currently linked project
${chalk.cyan(`$ ${getPkgName()} ls`)}
${chalk.gray('')} List all deployments for the project ${chalk.dim(
'`my-app`'
)} in the team of the currently linked project
${chalk.cyan(`$ ${getPkgName()} ls my-app`)}
${chalk.gray('')} Filter deployments by metadata
${chalk.cyan(`$ ${getPkgName()} ls -m key1=value1 -m key2=value2`)}
${chalk.gray('')} Paginate deployments for a project, where ${chalk.dim(
'`1584722256178`'
)} is the time in milliseconds since the UNIX epoch.
${chalk.cyan(`$ ${getPkgName()} ls my-app --next 1584722256178`)}
`);
};
export default async function main(client: Client) {
export default async function list(client: Client) {
let argv;
try {
@@ -111,7 +60,7 @@ export default async function main(client: Client) {
}
if (argv['--help']) {
help();
output.print(help(listCommand, { columns: client.stderr.columns }));
return 2;
}

View File

@@ -0,0 +1,49 @@
import { Command } from '../help';
import { getPkgName } from '../../util/pkg-name';
export const loginCommand: Command = {
name: 'login',
description: 'Authenticate using your email or team id.',
arguments: [
{
name: 'email or team id',
required: false,
},
],
options: [
{
name: 'github',
description: 'Log in with GitHub',
shorthand: null,
type: 'string',
deprecated: false,
multi: false,
},
{
name: 'oob',
description: 'Log in with "out of band" authentication',
shorthand: null,
type: 'string',
deprecated: false,
multi: false,
},
],
examples: [
{
name: 'Log into the Vercel platform',
value: `${getPkgName()} login`,
},
{
name: 'Log in using a specific email address',
value: `${getPkgName()} login username@example.com`,
},
{
name: 'Log in using a specific team "slug" for SAML Single Sign-On',
value: `${getPkgName()} login acme`,
},
{
name: 'Log in using GitHub in "out-of-band" mode',
value: `${getPkgName()} login --github --oob`,
},
],
};

View File

@@ -1,55 +1,24 @@
import { validate as validateEmail } from 'email-validator';
import chalk from 'chalk';
import hp from '../util/humanize-path';
import getArgs from '../util/get-args';
import logo from '../util/output/logo';
import prompt from '../util/login/prompt';
import doSamlLogin from '../util/login/saml';
import doEmailLogin from '../util/login/email';
import doGithubLogin from '../util/login/github';
import doGitlabLogin from '../util/login/gitlab';
import doBitbucketLogin from '../util/login/bitbucket';
import { prependEmoji, emoji } from '../util/emoji';
import { getCommandName, getPkgName } from '../util/pkg-name';
import getGlobalPathConfig from '../util/config/global-path';
import { writeToAuthConfigFile, writeToConfigFile } from '../util/config/files';
import Client from '../util/client';
import { LoginResult } from '../util/login/types';
const help = () => {
console.log(`
${chalk.bold(`${logo} ${getPkgName()} login`)} <email or team>
${chalk.dim('Options:')}
-h, --help Output usage information
--no-color No color mode [off]
-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
${chalk.dim('Examples:')}
${chalk.gray('')} Log into the Vercel platform
${chalk.cyan(`$ ${getPkgName()} login`)}
${chalk.gray('')} Log in using a specific email address
${chalk.cyan(`$ ${getPkgName()} login john@doe.com`)}
${chalk.gray('')} Log in using a specific team "slug" for SAML Single Sign-On
${chalk.cyan(`$ ${getPkgName()} login acme`)}
${chalk.gray('')} Log in using GitHub in "out-of-band" mode
${chalk.cyan(`$ ${getPkgName()} login --github --oob`)}
`);
};
import hp from '../../util/humanize-path';
import getArgs from '../../util/get-args';
import prompt from '../../util/login/prompt';
import doSamlLogin from '../../util/login/saml';
import doEmailLogin from '../../util/login/email';
import doGithubLogin from '../../util/login/github';
import doGitlabLogin from '../../util/login/gitlab';
import doBitbucketLogin from '../../util/login/bitbucket';
import { prependEmoji, emoji } from '../../util/emoji';
import { getCommandName } from '../../util/pkg-name';
import getGlobalPathConfig from '../../util/config/global-path';
import {
writeToAuthConfigFile,
writeToConfigFile,
} from '../../util/config/files';
import Client from '../../util/client';
import { LoginResult } from '../../util/login/types';
import { help } from '../help';
import { loginCommand } from './command';
export default async function login(client: Client): Promise<number> {
const { output } = client;
@@ -62,7 +31,7 @@ export default async function login(client: Client): Promise<number> {
});
if (argv['--help']) {
help();
output.print(help(loginCommand, { columns: client.stderr.columns }));
return 2;
}

View File

@@ -0,0 +1,15 @@
import { Command } from '../help';
import { getPkgName } from '../../util/pkg-name';
export const logoutCommand: Command = {
name: 'logout',
description: 'Logout the current authenticated user or team.',
arguments: [],
options: [],
examples: [
{
name: 'Logout from the CLI',
value: `${getPkgName()} logout`,
},
],
};

View File

@@ -1,37 +1,19 @@
import chalk from 'chalk';
import logo from '../util/output/logo';
import { handleError } from '../util/error';
import { writeToConfigFile, writeToAuthConfigFile } from '../util/config/files';
import getArgs from '../util/get-args';
import Client from '../util/client';
import { getCommandName, getPkgName } from '../util/pkg-name';
import { isAPIError } from '../util/errors-ts';
import { handleError } from '../../util/error';
import {
writeToConfigFile,
writeToAuthConfigFile,
} from '../../util/config/files';
import getArgs from '../../util/get-args';
import Client from '../../util/client';
import { getCommandName } from '../../util/pkg-name';
import { isAPIError } from '../../util/errors-ts';
import { errorToString } from '@vercel/error-utils';
const help = () => {
console.log(`
${chalk.bold(`${logo} ${getPkgName()} logout`)}
${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
${chalk.dim('Examples:')}
${chalk.gray('')} Logout from the CLI:
${chalk.cyan(`$ ${getPkgName()} logout`)}
`);
};
import { help } from '../help';
import { logoutCommand } from './command';
export default async function main(client: Client): Promise<number> {
let argv;
const { authConfig, config, output } = client;
try {
argv = getArgs(client.argv.slice(2), {
@@ -44,12 +26,10 @@ export default async function main(client: Client): Promise<number> {
}
if (argv['--help']) {
help();
output.print(help(logoutCommand, { columns: client.stderr.columns }));
return 2;
}
const { authConfig, config, output } = client;
if (!authConfig.token) {
output.note(
`Not currently logged in, so ${getCommandName('logout')} did nothing`

View File

@@ -0,0 +1,66 @@
import { Command } from '../help';
import { getPkgName } from '../../util/pkg-name';
export const logsCommand: Command = {
name: 'logs',
description: 'Display logs for a specific deployment.',
arguments: [
{
name: 'url|deploymentId',
required: true,
},
],
options: [
{
name: 'follow',
shorthand: 'f',
description: 'Wait for additional data [off]',
type: 'string',
deprecated: false,
multi: false,
},
{
name: 'limit',
shorthand: 'n',
description: 'Number of log entries [100]',
argument: 'NUMBER',
type: 'string',
deprecated: false,
multi: false,
},
{
name: 'since',
shorthand: null,
description: 'Only return logs after date (ISO 8601)',
argument: 'SINCE',
type: 'string',
deprecated: false,
multi: false,
},
{
name: 'until',
shorthand: null,
description:
'Only return logs before date (ISO 8601), ignored when used with --follow',
argument: 'UNTIL',
type: 'string',
deprecated: false,
multi: false,
},
{
name: 'output',
shorthand: 'o',
description: `Specify the output format (short|raw) [short]`,
argument: 'MODE',
type: 'string',
deprecated: false,
multi: false,
},
],
examples: [
{
name: 'Print the logs for the deployment DEPLOYMENT_ID',
value: `${getPkgName()} logs DEPLOYMENT_ID`,
},
],
};

View File

@@ -1,60 +1,15 @@
import chalk from 'chalk';
import logo from '../util/output/logo';
import elapsed from '../util/output/elapsed';
import { maybeURL, normalizeURL } from '../util/url';
import printEvents, { DeploymentEvent } from '../util/events';
import getScope from '../util/get-scope';
import { getPkgName } from '../util/pkg-name';
import getArgs from '../util/get-args';
import Client from '../util/client';
import getDeployment from '../util/get-deployment';
import elapsed from '../../util/output/elapsed';
import { maybeURL, normalizeURL } from '../../util/url';
import printEvents, { DeploymentEvent } from '../../util/events';
import getScope from '../../util/get-scope';
import getArgs from '../../util/get-args';
import Client from '../../util/client';
import getDeployment from '../../util/get-deployment';
import { help } from '../help';
import { logsCommand } from './command';
const help = () => {
console.log(`
${chalk.bold(`${logo} ${getPkgName()} logs`)} <url|deploymentId>
${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]
-f, --follow Wait for additional data [off]
-n ${chalk.bold.underline(
'NUMBER'
)} Number of logs [100]
-t ${chalk.bold.underline('TOKEN')}, --token=${chalk.bold.underline(
'TOKEN'
)} Login token
--since=${chalk.bold.underline(
'SINCE'
)} Only return logs after date (ISO 8601)
--until=${chalk.bold.underline(
'UNTIL'
)} Only return logs before date (ISO 8601), ignored for ${'`-f`'}
-S, --scope Set a custom scope
-o ${chalk.bold.underline('MODE')}, --output=${chalk.bold.underline(
'MODE'
)} Specify the output format (${Object.keys(logPrinters).join(
'|'
)}) [short]
${chalk.dim('Examples:')}
${chalk.gray('')} Print the logs for the deployment ${chalk.dim(
'`deploymentId`'
)}
${chalk.cyan(`$ ${getPkgName()} logs deploymentId`)}
`);
};
export default async function main(client: Client) {
export default async function logs(client: Client) {
let head;
let limit;
let follow;
@@ -76,14 +31,13 @@ export default async function main(client: Client) {
argv._ = argv._.slice(1);
deploymentIdOrURL = argv._[0];
const { output } = client;
if (argv['--help'] || !deploymentIdOrURL || deploymentIdOrURL === 'help') {
help();
output.print(help(logsCommand, { columns: client.stderr.columns }));
return 2;
}
const { output } = client;
try {
since = argv['--since'] ? toTimestamp(argv['--since']) : 0;
} catch (err) {

View File

@@ -0,0 +1,53 @@
import { Command } from '../help';
import { getPkgName } from '../../util/pkg-name';
import { getEnvTargetPlaceholder } from '../../util/env/env-target';
export const pullCommand: Command = {
name: 'pull',
description:
'Pull latest environment variables and project settings from Vercel. ',
arguments: [
{
name: 'project-path',
required: false,
},
],
options: [
{
name: 'environment',
description: 'Deployment environment [development]',
argument: 'environment',
shorthand: null,
type: 'string',
deprecated: false,
multi: false,
},
{
name: 'yes',
description:
'Skip questions when setting up new project using default scope and settings',
shorthand: 'y',
type: 'string',
deprecated: false,
multi: false,
},
],
examples: [
{
name: 'Pull the latest Environment Variables and Project Settings from the cloud',
value: `${getPkgName()} pull`,
},
{
name: 'Pull the latest Environment Variables and Project Settings from the cloud targeting a directory',
value: `${getPkgName()} pull ./path-to-project`,
},
{
name: 'Pull for a specific environment',
value: `${getPkgName()} pull --environment=${getEnvTargetPlaceholder()}`,
},
{
name: 'If you want to download environment variables to a specific file, use `vercel env pull` instead',
value: `${getPkgName()} env pull`,
},
],
};

View File

@@ -1,66 +1,26 @@
import chalk from 'chalk';
import { join } from 'path';
import Client from '../util/client';
import Client from '../../util/client';
import type {
Project,
ProjectEnvTarget,
ProjectLinked,
} from '@vercel-internals/types';
import { emoji, prependEmoji } from '../util/emoji';
import getArgs from '../util/get-args';
import logo from '../util/output/logo';
import stamp from '../util/output/stamp';
import { getPkgName } from '../util/pkg-name';
import { VERCEL_DIR, VERCEL_DIR_PROJECT } from '../util/projects/link';
import { writeProjectSettings } from '../util/projects/project-settings';
import envPull from './env/pull';
import { emoji, prependEmoji } from '../../util/emoji';
import getArgs from '../../util/get-args';
import stamp from '../../util/output/stamp';
import { VERCEL_DIR, VERCEL_DIR_PROJECT } from '../../util/projects/link';
import { writeProjectSettings } from '../../util/projects/project-settings';
import envPull from '../env/pull';
import {
isValidEnvTarget,
getEnvTargetPlaceholder,
} from '../util/env/env-target';
import { ensureLink } from '../util/link/ensure-link';
import humanizePath from '../util/humanize-path';
} from '../../util/env/env-target';
import { ensureLink } from '../../util/link/ensure-link';
import humanizePath from '../../util/humanize-path';
const help = () => {
return console.log(`
${chalk.bold(`${logo} ${getPkgName()} pull`)} [project-path]
${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]
--git-branch Specify the Git branch to pull specific Environment Variables for
--no-color No color mode [off]
--environment [environment] Deployment environment [development]
-y, --yes Skip questions when setting up new project using default scope and settings
${chalk.dim('Examples:')}
${chalk.gray(
''
)} Pull the latest Environment Variables and Project Settings from the cloud
and stores them in \`.vercel/.env.\${target}.local\` and \`.vercel/project.json\` respectively.
${chalk.cyan(`$ ${getPkgName()} pull`)}
${chalk.cyan(`$ ${getPkgName()} pull ./path-to-project`)}
${chalk.gray('')} Pull for a specific environment
${chalk.cyan(
`$ ${getPkgName()} pull --environment=${getEnvTargetPlaceholder()}`
)}
${chalk.gray(
'If you want to download environment variables to a specific file, use `vercel env pull` instead.'
)}
`);
};
import { help } from '../help';
import { pullCommand } from './command';
function processArgs(client: Client) {
return getArgs(client.argv.slice(2), {
@@ -77,7 +37,7 @@ function parseArgs(client: Client) {
const argv = processArgs(client);
if (argv['--help']) {
help();
client.output.print(help(pullCommand, { columns: client.stderr.columns }));
return 2;
}

View File

@@ -0,0 +1,33 @@
import { Command } from '../help';
import { getPkgName } from '../../util/pkg-name';
export const redeployCommand: Command = {
name: 'redeploy',
description: 'Rebuild and deploy a previous deployment.',
arguments: [
{
name: 'deploymentId|deploymentName',
required: false,
},
],
options: [
{
name: 'no-wait',
shorthand: null,
description: "Don't wait for the redeploy to finish",
type: 'boolean',
deprecated: false,
multi: false,
},
],
examples: [
{
name: 'Rebuild and deploy an existing deployment using id or url',
value: `${getPkgName()} redeploy my-deployment.vercel.app`,
},
{
name: 'Write Deployment URL to a file',
value: `${getPkgName()} redeploy my-deployment.vercel.app > deployment-url.txt`,
},
],
};

View File

@@ -1,66 +1,29 @@
import chalk from 'chalk';
import { checkDeploymentStatus } from '@vercel/client';
import type Client from '../util/client';
import { emoji, prependEmoji } from '../util/emoji';
import getArgs from '../util/get-args';
import { getCommandName, getPkgName } from '../util/pkg-name';
import { getDeploymentByIdOrURL } from '../util/deploy/get-deployment-by-id-or-url';
import getScope from '../util/get-scope';
import handleError from '../util/handle-error';
import type Client from '../../util/client';
import { emoji, prependEmoji } from '../../util/emoji';
import getArgs from '../../util/get-args';
import { getCommandName } from '../../util/pkg-name';
import { getDeploymentByIdOrURL } from '../../util/deploy/get-deployment-by-id-or-url';
import getScope from '../../util/get-scope';
import handleError from '../../util/handle-error';
import { isErrnoException } from '@vercel/error-utils';
import logo from '../util/output/logo';
import Now from '../util';
import { printDeploymentStatus } from '../util/deploy/print-deployment-status';
import stamp from '../util/output/stamp';
import ua from '../util/ua';
import Now from '../../util';
import { printDeploymentStatus } from '../../util/deploy/print-deployment-status';
import stamp from '../../util/output/stamp';
import ua from '../../util/ua';
import type { VercelClientOptions } from '@vercel/client';
const help = () => {
console.log(`
${chalk.bold(
`${logo} ${getPkgName()} redeploy`
)} [deploymentId|deploymentName]
Rebuild and deploy 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]
--no-wait Don't wait for the redeploy to finish
-t ${chalk.bold.underline('TOKEN')}, --token=${chalk.bold.underline(
'TOKEN'
)} Login token
-y, --yes Skip questions when setting up new project using default scope and settings
${chalk.dim('Examples:')}
${chalk.gray('')} Rebuild and deploy an existing deployment using id or url
${chalk.cyan(`$ ${getPkgName()} redeploy my-deployment.vercel.app`)}
${chalk.gray('')} Write Deployment URL to a file
${chalk.cyan(
`$ ${getPkgName()} redeploy my-deployment.vercel.app > deployment-url.txt`
)}
`);
};
import { help } from '../help';
import { redeployCommand } from './command';
/**
* `vc redeploy` command
* @param {Client} client
* @returns {Promise<number>} Resolves an exit code; 0 on success
*/
export default async (client: Client): Promise<number> => {
export default async function redeploy(client: Client): Promise<number> {
let argv;
const { output } = client;
try {
argv = getArgs(client.argv.slice(2), {
'--no-wait': Boolean,
@@ -73,11 +36,10 @@ export default async (client: Client): Promise<number> => {
}
if (argv['--help'] || argv._[0] === 'help') {
help();
output.print(help(redeployCommand, { columns: client.stderr.columns }));
return 2;
}
const { output } = client;
const deployIdOrUrl = argv._[1];
if (!deployIdOrUrl) {
output.error(
@@ -201,4 +163,4 @@ export default async (client: Client): Promise<number> => {
}
return 1;
}
};
}

View File

@@ -0,0 +1,45 @@
import { Command } from '../help';
import { getPkgName } from '../../util/pkg-name';
export const removeCommand: Command = {
name: 'remove',
description: 'Remove a deployment by name or id.',
arguments: [
{
name: '...deploymentId|deploymentName',
required: true,
},
],
options: [
{
name: 'yes',
shorthand: 'y',
type: 'boolean',
deprecated: false,
description: 'Skip confirmation',
multi: false,
},
{
name: 'safe',
shorthand: 's',
type: 'boolean',
deprecated: false,
description: 'Skip deployments with an active alias',
multi: false,
},
],
examples: [
{
name: 'Remove a deployment identified by `deploymentId`',
value: `${getPkgName()} remove my-app`,
},
{
name: 'Remove all deployments with name `my-app`',
value: `${getPkgName()} remove deploymentId`,
},
{
name: 'Remove two deployments with IDs `eyWt6zuSdeus` and `uWHoA9RQ1d1o`',
value: `${getPkgName()} remove eyWt6zuSdeus uWHoA9RQ1d1o`,
},
],
};

View File

@@ -2,74 +2,31 @@ import chalk from 'chalk';
import ms from 'ms';
import plural from 'pluralize';
import table from 'text-table';
import Now from '../util';
import getAliases from '../util/alias/get-aliases';
import logo from '../util/output/logo';
import elapsed from '../util/output/elapsed';
import { normalizeURL } from '../util/url';
import getScope from '../util/get-scope';
import { isValidName } from '../util/is-valid-name';
import removeProject from '../util/projects/remove-project';
import getProjectByIdOrName from '../util/projects/get-project-by-id-or-name';
import getDeployment from '../util/get-deployment';
import getDeploymentsByProjectId from '../util/deploy/get-deployments-by-project-id';
import { getPkgName, getCommandName } from '../util/pkg-name';
import getArgs from '../util/get-args';
import handleError from '../util/handle-error';
import type Client from '../util/client';
import { Output } from '../util/output';
import Now from '../../util';
import getAliases from '../../util/alias/get-aliases';
import elapsed from '../../util/output/elapsed';
import { normalizeURL } from '../../util/url';
import getScope from '../../util/get-scope';
import { isValidName } from '../../util/is-valid-name';
import removeProject from '../../util/projects/remove-project';
import getProjectByIdOrName from '../../util/projects/get-project-by-id-or-name';
import getDeployment from '../../util/get-deployment';
import getDeploymentsByProjectId from '../../util/deploy/get-deployments-by-project-id';
import { getCommandName } from '../../util/pkg-name';
import getArgs from '../../util/get-args';
import handleError from '../../util/handle-error';
import type Client from '../../util/client';
import { Output } from '../../util/output';
import { Alias, Deployment, Project } from '@vercel-internals/types';
import { NowError } from '../util/now-error';
import { NowError } from '../../util/now-error';
import { help } from '../help';
import { removeCommand } from './command';
type DeploymentWithAliases = Deployment & {
aliases: Alias[];
};
const help = () => {
console.log(`
${chalk.bold(
`${logo} ${getPkgName()} remove`
)} [...deploymentId|deploymentName]
${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
-y, --yes Skip confirmation
-s, --safe Skip deployments with an active alias
-S, --scope Set a custom scope
${chalk.dim('Examples:')}
${chalk.gray('')} Remove a deployment identified by ${chalk.dim(
'`deploymentId`'
)}
${chalk.cyan(`$ ${getPkgName()} rm deploymentId`)}
${chalk.gray('')} Remove all deployments with name ${chalk.dim('`my-app`')}
${chalk.cyan(`$ ${getPkgName()} rm my-app`)}
${chalk.gray('')} Remove two deployments with IDs ${chalk.dim(
'`eyWt6zuSdeus`'
)} and ${chalk.dim('`uWHoA9RQ1d1o`')}
${chalk.cyan(`$ ${getPkgName()} rm eyWt6zuSdeus uWHoA9RQ1d1o`)}
`);
};
export default async function main(client: Client) {
export default async function remove(client: Client) {
let argv;
try {
@@ -98,13 +55,13 @@ export default async function main(client: Client) {
const { success, error, log } = output;
if (argv['--help'] || ids[0] === 'help') {
help();
output.print(help(removeCommand, { columns: client.stderr.columns }));
return 2;
}
if (ids.length < 1) {
error(`${getCommandName('rm')} expects at least one argument`);
help();
output.print(help(removeCommand, { columns: client.stderr.columns }));
return 1;
}

View File

@@ -1,56 +0,0 @@
import chalk from 'chalk';
import logo from '../util/output/logo';
import getScope from '../util/get-scope';
import { getPkgName } from '../util/pkg-name';
import getArgs from '../util/get-args';
import Client from '../util/client';
const help = () => {
console.log(`
${chalk.bold(`${logo} ${getPkgName()} whoami`)}
${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
${chalk.dim('Examples:')}
${chalk.gray('')} Shows the username of the currently logged in user
${chalk.cyan(`$ ${getPkgName()} whoami`)}
`);
};
export default async (client: Client): Promise<number> => {
const { output } = client;
const argv = getArgs(client.argv.slice(2), {});
argv._ = argv._.slice(1);
if (argv['--help'] || argv._[0] === 'help') {
help();
return 2;
}
const { contextName } = await getScope(client, { getTeam: false });
if (client.stdout.isTTY) {
output.log(contextName);
} else {
// If stdout is not a TTY, then only print the username
// to support piping the output to another file / exe
client.stdout.write(`${contextName}\n`);
}
return 0;
};

View File

@@ -0,0 +1,15 @@
import { Command } from '../help';
import { getPkgName } from '../../util/pkg-name';
export const whoamiCommand: Command = {
name: 'whoami',
description: 'Shows the username of the currently logged in user.',
arguments: [],
options: [],
examples: [
{
name: 'Shows the username of the currently logged in user',
value: `${getPkgName()} whoami`,
},
],
};

View File

@@ -0,0 +1,29 @@
import { help } from '../help';
import { whoamiCommand } from './command';
import getScope from '../../util/get-scope';
import getArgs from '../../util/get-args';
import Client from '../../util/client';
export default async function whoami(client: Client): Promise<number> {
const { output } = client;
const argv = getArgs(client.argv.slice(2), {});
argv._ = argv._.slice(1);
if (argv['--help'] || argv._[0] === 'help') {
output.print(help(whoamiCommand, { columns: client.stderr.columns }));
return 2;
}
const { contextName } = await getScope(client, { getTeam: false });
if (client.stdout.isTTY) {
output.log(contextName);
} else {
// If stdout is not a TTY, then only print the username
// to support piping the output to another file / exe
client.stdout.write(`${contextName}\n`);
}
return 0;
}

View File

@@ -0,0 +1,9 @@
const { createGzip } = require('zlib');
module.exports = (_req, resp) => {
resp.setHeader('content-encoding', 'gzip');
const gzip = createGzip();
gzip.pipe(resp);
gzip.end('Hello World!');
};

View File

@@ -143,6 +143,13 @@ test(
})
);
test(
'[vercel dev] 43-compress-encoding',
testFixtureStdio('43-compress-encoding', async (testPath: any) => {
await testPath(200, '/api', 'Hello World!');
})
);
test(
'[vercel dev] Middleware that returns a 200 response',
testFixtureStdio('middleware-response', async (testPath: any) => {

View File

@@ -1,131 +1,164 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`help command help output snapshots column width 40 1`] = `
"vercel deploy [project-path] [options]
"
vercel deploy [project-path] [options]
Deploy your project to Vercel. The \`deploy\` command is the default command for the Vercel CLI, and can be omitted (\`vc deploy my-app\` equals \`vc my-app\`).
Deploy your project to Vercel. The \`deploy\` command is the default command for the Vercel CLI, and can be omitted (\`vc deploy my-app\` equals \`vc my-app\`).
Options:
Options:
--archive Compress
the
deployment
code into
a file
before
uploading
it
-b, --build-env <key=value> Specify
environment
variables
during
build-time
(e.g. \`-b
KEY1=value1
-b
KEY2=value2\`)
-e, --env <key=value> Specify
environment
variables
during
run-time
(e.g. \`-e
KEY1=value1
-e
KEY2=value2\`)
-f, --force Force a
new
deployment
even if
nothing
has
changed
-m, --meta <key=value> Specify
metadata
for the
deployment
(e.g. \`-m
KEY1=value1
-m
KEY2=value2\`)
--no-wait Don't
wait for
the
deployment
to finish
--prebuilt Use in
combination
with \`vc
build\`.
Deploy an
existing
build
--prod Create a
production
deployment
-p, --public
Deployment
is public
(\`/_src\`)
is
exposed)
--regions Set
default
regions
to enable
the
deployment
on
--with-cache Retain
build
cache
when
using
"--force"
-y, --yes Use
default
options
to skip
all
prompts
--archive
Compress
the
deployment
code
into
a
file
before
uploading
it
-b, --build-env <key=value>
Specify
environment
variables
during
build-time
(e.g.
\`-b
KEY1=value1
-b
KEY2=value2\`)
-e, --env <key=value>
Specify
environment
variables
during
run-time
(e.g.
\`-e
KEY1=value1
-e
KEY2=value2\`)
-f, --force
Force
a new
deployment
even
if
nothing
has
changed
-m, --meta <key=value>
Specify
metadata
for
the
deployment
(e.g.
\`-m
KEY1=value1
-m
KEY2=value2\`)
--no-wait
Don't
wait
for
the
deployment
to
finish
--prebuilt Use
in
combination
with
\`vc
build\`.
Deploy
an
existing
build
--prod
Create
a
production
deployment
-p, --public
Deployment
is
public
(\`/_src\`)
is
exposed)
--regions Set
default
regions
to
enable
the
deployment
on
--with-cache
Retain
build
cache
when
using
"--force"
-y, --yes Use
default
options
to
skip
all
prompts
Global Options:
Global Options:
--cwd <DIR> Sets the
current
working
directory
for a
single run
of a
command
-d, --debug Debug mode
(default
off)
-Q, --global-config <DIR> Path to the
global
\`.vercel\`
directory
-h, --help Output
usage
information
-A, --local-config <FILE> Path to the
local
\`vercel.json\`
file
--no-color No color
mode
(default
off)
-S, --scope Set a
custom
scope
-t, --token <TOKEN> Login token
-v, --version Output the
version
number
--cwd <DIR> Sets
the
current
working
directory
for a
single
run of
a
command
-d, --debug Debug
mode
(default
off)
-Q, --global-config <DIR> Path to
the
global
\`.vercel\`
directory
-h, --help Output
usage
information
-A, --local-config <FILE> Path to
the
local
\`vercel.json\`
file
--no-color No
color
mode
(default
off)
-S, --scope Set a
custom
scope
-t, --token <TOKEN> Login
token
-v, --version Output
the
version
number
Examples:
Examples:
- Deploy the current directory
@@ -147,49 +180,53 @@ Deploy your project to Vercel. The \`deploy\` command is the default command for
- Write Deployment URL to a file
$ vercel > deployment-url.txt
"
`;
exports[`help command help output snapshots column width 80 1`] = `
"vercel deploy [project-path] [options]
"
vercel deploy [project-path] [options]
Deploy your project to Vercel. The \`deploy\` command is the default command for the Vercel CLI, and can be omitted (\`vc deploy my-app\` equals \`vc my-app\`).
Deploy your project to Vercel. The \`deploy\` command is the default command for the Vercel CLI, and can be omitted (\`vc deploy my-app\` equals \`vc my-app\`).
Options:
Options:
--archive Compress the deployment code into a file before
uploading it
-b, --build-env <key=value> Specify environment variables during build-time
(e.g. \`-b KEY1=value1 -b KEY2=value2\`)
-e, --env <key=value> Specify environment variables during run-time
(e.g. \`-e KEY1=value1 -e KEY2=value2\`)
-f, --force Force a new deployment even if nothing has
changed
-m, --meta <key=value> Specify metadata for the deployment (e.g. \`-m
KEY1=value1 -m KEY2=value2\`)
--no-wait Don't wait for the deployment to finish
--prebuilt Use in combination with \`vc build\`. Deploy an
existing build
--prod Create a production deployment
-p, --public Deployment is public (\`/_src\`) is exposed)
--regions Set default regions to enable the deployment on
--with-cache Retain build cache when using "--force"
-y, --yes Use default options to skip all prompts
--archive Compress the deployment code into a file
before uploading it
-b, --build-env <key=value> Specify environment variables during
build-time (e.g. \`-b KEY1=value1 -b
KEY2=value2\`)
-e, --env <key=value> Specify environment variables during run-time
(e.g. \`-e KEY1=value1 -e KEY2=value2\`)
-f, --force Force a new deployment even if nothing has
changed
-m, --meta <key=value> Specify metadata for the deployment (e.g. \`-m
KEY1=value1 -m KEY2=value2\`)
--no-wait Don't wait for the deployment to finish
--prebuilt Use in combination with \`vc build\`. Deploy an
existing build
--prod Create a production deployment
-p, --public Deployment is public (\`/_src\`) is exposed)
--regions Set default regions to enable the deployment
on
--with-cache Retain build cache when using "--force"
-y, --yes Use default options to skip all prompts
Global Options:
Global Options:
--cwd <DIR> Sets the current working directory for a single run
of a command
-d, --debug Debug mode (default off)
-Q, --global-config <DIR> Path to the global \`.vercel\` directory
-h, --help Output usage information
-A, --local-config <FILE> Path to the local \`vercel.json\` file
--no-color No color mode (default off)
-S, --scope Set a custom scope
-t, --token <TOKEN> Login token
-v, --version Output the version number
--cwd <DIR> Sets the current working directory for a single
run of a command
-d, --debug Debug mode (default off)
-Q, --global-config <DIR> Path to the global \`.vercel\` directory
-h, --help Output usage information
-A, --local-config <FILE> Path to the local \`vercel.json\` file
--no-color No color mode (default off)
-S, --scope Set a custom scope
-t, --token <TOKEN> Login token
-v, --version Output the version number
Examples:
Examples:
- Deploy the current directory
@@ -211,42 +248,45 @@ Deploy your project to Vercel. The \`deploy\` command is the default command for
- Write Deployment URL to a file
$ vercel > deployment-url.txt
"
`;
exports[`help command help output snapshots column width 120 1`] = `
"vercel deploy [project-path] [options]
"
vercel deploy [project-path] [options]
Deploy your project to Vercel. The \`deploy\` command is the default command for the Vercel CLI, and can be omitted (\`vc deploy my-app\` equals \`vc my-app\`).
Deploy your project to Vercel. The \`deploy\` command is the default command for the Vercel CLI, and can be omitted (\`vc deploy my-app\` equals \`vc my-app\`).
Options:
Options:
--archive Compress the deployment code into a file before uploading it
-b, --build-env <key=value> Specify environment variables during build-time (e.g. \`-b KEY1=value1 -b KEY2=value2\`)
-e, --env <key=value> Specify environment variables during run-time (e.g. \`-e KEY1=value1 -e KEY2=value2\`)
-f, --force Force a new deployment even if nothing has changed
-m, --meta <key=value> Specify metadata for the deployment (e.g. \`-m KEY1=value1 -m KEY2=value2\`)
--no-wait Don't wait for the deployment to finish
--prebuilt Use in combination with \`vc build\`. Deploy an existing build
--prod Create a production deployment
-p, --public Deployment is public (\`/_src\`) is exposed)
--regions Set default regions to enable the deployment on
--with-cache Retain build cache when using "--force"
-y, --yes Use default options to skip all prompts
--archive Compress the deployment code into a file before uploading it
-b, --build-env <key=value> Specify environment variables during build-time (e.g. \`-b KEY1=value1 -b
KEY2=value2\`)
-e, --env <key=value> Specify environment variables during run-time (e.g. \`-e KEY1=value1 -e KEY2=value2\`)
-f, --force Force a new deployment even if nothing has changed
-m, --meta <key=value> Specify metadata for the deployment (e.g. \`-m KEY1=value1 -m KEY2=value2\`)
--no-wait Don't wait for the deployment to finish
--prebuilt Use in combination with \`vc build\`. Deploy an existing build
--prod Create a production deployment
-p, --public Deployment is public (\`/_src\`) is exposed)
--regions Set default regions to enable the deployment on
--with-cache Retain build cache when using "--force"
-y, --yes Use default options to skip all prompts
Global Options:
Global Options:
--cwd <DIR> Sets the current working directory for a single run of a command
-d, --debug Debug mode (default off)
-Q, --global-config <DIR> Path to the global \`.vercel\` directory
-h, --help Output usage information
-A, --local-config <FILE> Path to the local \`vercel.json\` file
--no-color No color mode (default off)
-S, --scope Set a custom scope
-t, --token <TOKEN> Login token
-v, --version Output the version number
--cwd <DIR> Sets the current working directory for a single run of a command
-d, --debug Debug mode (default off)
-Q, --global-config <DIR> Path to the global \`.vercel\` directory
-h, --help Output usage information
-A, --local-config <FILE> Path to the local \`vercel.json\` file
--no-color No color mode (default off)
-S, --scope Set a custom scope
-t, --token <TOKEN> Login token
-v, --version Output the version number
Examples:
Examples:
- Deploy the current directory
@@ -268,5 +308,6 @@ Deploy your project to Vercel. The \`deploy\` command is the default command for
- Write Deployment URL to a file
$ vercel > deployment-url.txt
"
`;

View File

@@ -1,5 +1,19 @@
# @vercel/gatsby-plugin-vercel-builder
## 1.3.16
### Patch Changes
- Updated dependencies [[`4af242af8`](https://github.com/vercel/vercel/commit/4af242af8633e58b6a9bf920564416da3ef22ad4), [`85dd66778`](https://github.com/vercel/vercel/commit/85dd667781693539d753d587566e53964bbe189d)]:
- @vercel/node@2.15.8
## 1.3.15
### Patch Changes
- Updated dependencies [[`fc413707d`](https://github.com/vercel/vercel/commit/fc413707d017e234d5013b761d885f65f9b981bc)]:
- @vercel/node@2.15.7
## 1.3.14
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@vercel/gatsby-plugin-vercel-builder",
"version": "1.3.14",
"version": "1.3.16",
"main": "dist/index.js",
"files": [
"dist",
@@ -21,7 +21,7 @@
"dependencies": {
"@sinclair/typebox": "0.25.24",
"@vercel/build-utils": "6.8.2",
"@vercel/node": "2.15.6",
"@vercel/node": "2.15.8",
"@vercel/routing-utils": "2.2.1",
"esbuild": "0.14.47",
"etag": "1.8.1",

View File

@@ -1,5 +1,19 @@
# @vercel/node
## 2.15.8
### Patch Changes
- Move `@types/content-type` to dev dependency ([#10292](https://github.com/vercel/vercel/pull/10292))
- fix: compress condition ([#10288](https://github.com/vercel/vercel/pull/10288))
## 2.15.7
### Patch Changes
- fix: move content-type as dependency ([#10274](https://github.com/vercel/vercel/pull/10274))
## 2.15.6
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@vercel/node",
"version": "2.15.6",
"version": "2.15.8",
"license": "Apache-2.0",
"main": "./dist/index",
"homepage": "https://vercel.com/docs/runtimes#official-runtimes/node-js",
@@ -28,6 +28,7 @@
"@vercel/error-utils": "1.0.10",
"@vercel/static-config": "2.0.17",
"async-listen": "3.0.0",
"content-type": "1.0.5",
"edge-runtime": "2.4.3",
"esbuild": "0.14.47",
"exit-hook": "2.2.1",
@@ -42,14 +43,13 @@
"@babel/plugin-transform-modules-commonjs": "7.5.0",
"@tootallnate/once": "1.1.2",
"@types/aws-lambda": "8.10.19",
"@types/content-type": "1.1.3",
"@types/content-type": "1.1.5",
"@types/cookie": "0.3.3",
"@types/etag": "1.8.0",
"@types/jest": "29.5.0",
"@types/test-listen": "1.1.0",
"@vercel/ncc": "0.24.0",
"@vercel/nft": "0.22.5",
"content-type": "1.0.4",
"cookie": "0.4.0",
"cross-env": "7.0.3",
"etag": "1.8.1",

View File

@@ -107,7 +107,7 @@ export async function createServerlessEventHandler(
// @ts-expect-error
const response = await fetch(url, {
body: await serializeBody(request),
compress: isStreaming,
compress: !isStreaming,
headers: {
...request.headers,
host: request.headers['x-forwarded-host'],

View File

@@ -1,5 +1,11 @@
# @vercel/remix-builder
## 1.9.1
### Patch Changes
- Disable root workspace check in pnpm and yarn when adding deps ([#10291](https://github.com/vercel/vercel/pull/10291))
## 1.9.0
### Minor Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@vercel/remix-builder",
"version": "1.9.0",
"version": "1.9.1",
"license": "Apache-2.0",
"main": "./dist/index.js",
"homepage": "https://vercel.com/docs",

View File

@@ -274,6 +274,7 @@ export function addDependencies(
debug(` - ${name}`);
}
const args: string[] = [];
if (cliType === 'npm' || cliType === 'pnpm') {
args.push('install');
if (opts.saveDev) {
@@ -281,11 +282,19 @@ export function addDependencies(
}
} else {
// 'yarn'
args.push('add');
args.push('add', '--ignore-workspace-root-check');
if (opts.saveDev) {
args.push('--dev');
}
}
// Don't fail if pnpm is being run at the workspace root
if (cliType === 'pnpm' && opts.cwd) {
if (existsSync(join(opts.cwd, 'pnpm-workspace.yaml'))) {
args.push('--workspace-root');
}
}
return spawnAsync(cliType, args.concat(names), opts);
}

View File

@@ -1,5 +1,19 @@
# @vercel/static-build
## 1.3.44
### Patch Changes
- Updated dependencies []:
- @vercel/gatsby-plugin-vercel-builder@1.3.16
## 1.3.43
### Patch Changes
- Updated dependencies []:
- @vercel/gatsby-plugin-vercel-builder@1.3.15
## 1.3.42
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@vercel/static-build",
"version": "1.3.42",
"version": "1.3.44",
"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": "1.3.14"
"@vercel/gatsby-plugin-vercel-builder": "1.3.16"
},
"devDependencies": {
"@types/aws-lambda": "8.10.64",

76
pnpm-lock.yaml generated
View File

@@ -86,8 +86,8 @@ importers:
specifier: 29.1.0
version: 29.1.0(@babel/core@7.5.0)(jest@29.5.0)(typescript@4.9.5)
turbo:
specifier: 1.10.9
version: 1.10.9
specifier: 1.10.12
version: 1.10.12
typescript:
specifier: 4.9.5
version: 4.9.5
@@ -319,7 +319,7 @@ importers:
specifier: 3.9.3
version: link:../next
'@vercel/node':
specifier: 2.15.6
specifier: 2.15.8
version: link:../node
'@vercel/python':
specifier: 3.1.60
@@ -328,13 +328,13 @@ importers:
specifier: 1.1.15
version: link:../redwood
'@vercel/remix-builder':
specifier: 1.9.0
specifier: 1.9.1
version: link:../remix
'@vercel/ruby':
specifier: 1.3.76
version: link:../ruby
'@vercel/static-build':
specifier: 1.3.42
specifier: 1.3.44
version: link:../static-build
devDependencies:
'@alex_neo/jest-expect-message':
@@ -948,7 +948,7 @@ importers:
specifier: 6.8.2
version: link:../build-utils
'@vercel/node':
specifier: 2.15.6
specifier: 2.15.8
version: link:../node
'@vercel/routing-utils':
specifier: 2.2.1
@@ -1209,6 +1209,9 @@ importers:
async-listen:
specifier: 3.0.0
version: 3.0.0
content-type:
specifier: 1.0.5
version: 1.0.5
edge-runtime:
specifier: 2.4.3
version: 2.4.3
@@ -1247,8 +1250,8 @@ importers:
specifier: 8.10.19
version: 8.10.19
'@types/content-type':
specifier: 1.1.3
version: 1.1.3
specifier: 1.1.5
version: 1.1.5
'@types/cookie':
specifier: 0.3.3
version: 0.3.3
@@ -1267,9 +1270,6 @@ importers:
'@vercel/nft':
specifier: 0.22.5
version: 0.22.5
content-type:
specifier: 1.0.4
version: 1.0.4
cookie:
specifier: 0.4.0
version: 0.4.0
@@ -1428,7 +1428,7 @@ importers:
specifier: 1.0.10
version: link:../gatsby-plugin-vercel-analytics
'@vercel/gatsby-plugin-vercel-builder':
specifier: 1.3.14
specifier: 1.3.16
version: link:../gatsby-plugin-vercel-builder
devDependencies:
'@types/aws-lambda':
@@ -4802,8 +4802,8 @@ packages:
'@types/node': 16.18.11
dev: true
/@types/content-type@1.1.3:
resolution: {integrity: sha512-pv8VcFrZ3fN93L4rTNIbbUzdkzjEyVMp5mPVjsFfOYTDOZMZiZ8P1dhu+kEv3faYyKzZgLlSvnyQNFg+p/v5ug==}
/@types/content-type@1.1.5:
resolution: {integrity: sha512-dgMN+syt1xb7Hk8LU6AODOfPlvz5z1CbXpPuJE5ZrX9STfBOIXF09pEB8N7a97WT9dbngt3ksDCm6GW6yMrxfQ==}
dev: true
/@types/convert-source-map@1.5.2:
@@ -6880,7 +6880,7 @@ packages:
engines: {node: '>= 0.8'}
dependencies:
bytes: 3.1.0
content-type: 1.0.4
content-type: 1.0.5
debug: 2.6.9
depd: 1.1.2
http-errors: 1.7.2
@@ -7557,6 +7557,10 @@ packages:
engines: {node: '>= 0.6'}
dev: true
/content-type@1.0.5:
resolution: {integrity: sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==}
engines: {node: '>= 0.6'}
/convert-hrtime@3.0.0:
resolution: {integrity: sha512-7V+KqSvMiHp8yWDuwfww06XleMWVVB9b9tURBx+G7UTADuo5hYPuowKloz4OzOqbPezxgo+fdQ1522WzPG4OeA==}
engines: {node: '>=8'}
@@ -9629,7 +9633,7 @@ packages:
array-flatten: 1.1.1
body-parser: 1.19.0
content-disposition: 0.5.3
content-type: 1.0.4
content-type: 1.0.5
cookie: 0.4.0
cookie-signature: 1.0.6
debug: 2.6.9
@@ -16375,65 +16379,65 @@ packages:
safe-buffer: 5.2.1
dev: true
/turbo-darwin-64@1.10.9:
resolution: {integrity: sha512-Avz3wsYYb8/vjyHPVRFbNbowIiaF33vcBRklIUkPchTLvZekrT5x3ltQBCflyoi2zJV9g08hK4xXTGuCxeVvPA==}
/turbo-darwin-64@1.10.12:
resolution: {integrity: sha512-vmDfGVPl5/aFenAbOj3eOx3ePNcWVUyZwYr7taRl0ZBbmv2TzjRiFotO4vrKCiTVnbqjQqAFQWY2ugbqCI1kOQ==}
cpu: [x64]
os: [darwin]
requiresBuild: true
dev: true
optional: true
/turbo-darwin-arm64@1.10.9:
resolution: {integrity: sha512-HyggdSPc/v2HuYrJF75smhIlurn8bY2cWpZYCjOL5Pj2DpLyhBs+nk+JirZl7XQiaUEVFj6eTbsejXyDP2Ritw==}
/turbo-darwin-arm64@1.10.12:
resolution: {integrity: sha512-3JliEESLNX2s7g54SOBqqkqJ7UhcOGkS0ywMr5SNuvF6kWVTbuUq7uBU/sVbGq8RwvK1ONlhPvJne5MUqBCTCQ==}
cpu: [arm64]
os: [darwin]
requiresBuild: true
dev: true
optional: true
/turbo-linux-64@1.10.9:
resolution: {integrity: sha512-qvdEgJKzDjOYY8o/HlnSwD+TIXiAML+3l6wUG4Ojuh/6cIhemLMRaHmEG+LygRW7GRw3dDv3hpp9OtiKmyxFdQ==}
/turbo-linux-64@1.10.12:
resolution: {integrity: sha512-siYhgeX0DidIfHSgCR95b8xPee9enKSOjCzx7EjTLmPqPaCiVebRYvbOIYdQWRqiaKh9yfhUtFmtMOMScUf1gg==}
cpu: [x64]
os: [linux]
requiresBuild: true
dev: true
optional: true
/turbo-linux-arm64@1.10.9:
resolution: {integrity: sha512-gva8H3CS8F6HlXL6YTDJAPrvPXVjBCxdd4DKABghjAxdknV5mZV1WWwMuGf0Z2W8qtmNG1XS0Dt2Wrb1ERFnLw==}
/turbo-linux-arm64@1.10.12:
resolution: {integrity: sha512-K/ZhvD9l4SslclaMkTiIrnfcACgos79YcAo4kwc8bnMQaKuUeRpM15sxLpZp3xDjDg8EY93vsKyjaOhdFG2UbA==}
cpu: [arm64]
os: [linux]
requiresBuild: true
dev: true
optional: true
/turbo-windows-64@1.10.9:
resolution: {integrity: sha512-OZ+bkSBJIkyl4JBDk8FX2/bOqtrElfXQV/KQ8/ibddB8Clzn/owx9FS1eXGdvttRZ9IJWzPrdFv+k4vbWQfE7w==}
/turbo-windows-64@1.10.12:
resolution: {integrity: sha512-7FSgSwvktWDNOqV65l9AbZwcoueAILeE4L7JvjauNASAjjbuzXGCEq5uN8AQU3U5BOFj4TdXrVmO2dX+lLu8Zg==}
cpu: [x64]
os: [win32]
requiresBuild: true
dev: true
optional: true
/turbo-windows-arm64@1.10.9:
resolution: {integrity: sha512-WhhhioGaePkGdGOIlrOB8LF8400FJUAQcVf8yCTvjzDB+OWn3dJQ3nalFjxH0PlZ17l6TPGt1WvWQiDVXUE4pw==}
/turbo-windows-arm64@1.10.12:
resolution: {integrity: sha512-gCNXF52dwom1HLY9ry/cneBPOKTBHhzpqhMylcyvJP0vp9zeMQQkt6yjYv+6QdnmELC92CtKNp2FsNZo+z0pyw==}
cpu: [arm64]
os: [win32]
requiresBuild: true
dev: true
optional: true
/turbo@1.10.9:
resolution: {integrity: sha512-s1ZRRD89NelCYHty1SpV1Elpv2LRrktgcddbZm9oTq1RPNpJFSrrEOAJhNz/w0fxTSjSN1Ey3TWZghjUjgKuzg==}
/turbo@1.10.12:
resolution: {integrity: sha512-WM3+jTfQWnB9W208pmP4oeehZcC6JQNlydb/ZHMRrhmQa+htGhWLCzd6Q9rLe0MwZLPpSPFV2/bN5egCLyoKjQ==}
hasBin: true
requiresBuild: true
optionalDependencies:
turbo-darwin-64: 1.10.9
turbo-darwin-arm64: 1.10.9
turbo-linux-64: 1.10.9
turbo-linux-arm64: 1.10.9
turbo-windows-64: 1.10.9
turbo-windows-arm64: 1.10.9
turbo-darwin-64: 1.10.12
turbo-darwin-arm64: 1.10.12
turbo-linux-64: 1.10.12
turbo-linux-arm64: 1.10.12
turbo-windows-64: 1.10.12
turbo-windows-arm64: 1.10.12
dev: true
/tweetnacl@0.14.5: