mirror of
https://github.com/LukeHagar/vercel.git
synced 2025-12-11 21:07:47 +00:00
Compare commits
10 Commits
create-inp
...
@vercel/cl
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c6d588201b | ||
|
|
0b1ff4bf62 | ||
|
|
14102ddf56 | ||
|
|
49f88975b9 | ||
|
|
13f3db06a8 | ||
|
|
78e2c012f9 | ||
|
|
f707f13821 | ||
|
|
9ed967034d | ||
|
|
1825b58df8 | ||
|
|
c82a55c460 |
@@ -1,2 +0,0 @@
|
|||||||
---
|
|
||||||
---
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
---
|
|
||||||
---
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
---
|
|
||||||
---
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
---
|
|
||||||
---
|
|
||||||
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
---
|
|
||||||
"@vercel/remix-builder": patch
|
|
||||||
---
|
|
||||||
|
|
||||||
Add `mjs` and `mts` extensions to vite detection
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
---
|
|
||||||
---
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
---
|
|
||||||
---
|
|
||||||
|
|
||||||
Update CODEOWNERS
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
---
|
|
||||||
---
|
|
||||||
@@ -4,7 +4,7 @@ import { lstatSync, readdirSync } from 'fs';
|
|||||||
export async function deployExample(filename: string) {
|
export async function deployExample(filename: string) {
|
||||||
const { testDeployment } = require('../../test/lib/deployment/test-deployment.js');
|
const { testDeployment } = require('../../test/lib/deployment/test-deployment.js');
|
||||||
const example = basename(filename).replace(/\.test\.ts$/, '');
|
const example = basename(filename).replace(/\.test\.ts$/, '');
|
||||||
await testDeployment(join(filename, '..', '..', '..', example));
|
await testDeployment(join(process.cwd(), example));
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getExamples() {
|
export function getExamples() {
|
||||||
|
|||||||
@@ -8,6 +8,6 @@ menu:
|
|||||||
main: {}
|
main: {}
|
||||||
---
|
---
|
||||||
|
|
||||||
This is an example of a custom shortcode that you can put right into your content. You will need to add a form action to the the shortcode to make it work. Check out [Formspree](https://formspree.io/) for a simple, free form service.
|
This is an example of a custom shortcode that you can put right into your content. You will need to add a form action to the shortcode to make it work. Check out [Formspree](https://formspree.io/) for a simple, free form service.
|
||||||
|
|
||||||
{{< form-contact action="https://example.com" >}}
|
{{< form-contact action="https://example.com" >}}
|
||||||
|
|||||||
3
examples/package.json
vendored
3
examples/package.json
vendored
@@ -9,7 +9,8 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/jest": "27.4.1",
|
"@types/jest": "27.4.1",
|
||||||
"@vercel/frameworks": "3.0.0"
|
"@vercel/build-utils": "7.10.0",
|
||||||
|
"@vercel/frameworks": "3.0.1"
|
||||||
},
|
},
|
||||||
"version": null
|
"version": null
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,12 @@
|
|||||||
# @vercel-internals/types
|
# @vercel-internals/types
|
||||||
|
|
||||||
|
## 1.0.28
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [[`1825b58df`](https://github.com/vercel/vercel/commit/1825b58df8d783e79f0addf262618f422246f4b3)]:
|
||||||
|
- @vercel/build-utils@7.10.0
|
||||||
|
|
||||||
## 1.0.27
|
## 1.0.27
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"private": true,
|
"private": true,
|
||||||
"name": "@vercel-internals/types",
|
"name": "@vercel-internals/types",
|
||||||
"version": "1.0.27",
|
"version": "1.0.28",
|
||||||
"types": "index.d.ts",
|
"types": "index.d.ts",
|
||||||
"main": "index.d.ts",
|
"main": "index.d.ts",
|
||||||
"files": [
|
"files": [
|
||||||
@@ -10,7 +10,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/node": "14.14.31",
|
"@types/node": "14.14.31",
|
||||||
"@vercel-internals/constants": "1.0.4",
|
"@vercel-internals/constants": "1.0.4",
|
||||||
"@vercel/build-utils": "7.9.1",
|
"@vercel/build-utils": "7.10.0",
|
||||||
"@vercel/routing-utils": "3.1.0"
|
"@vercel/routing-utils": "3.1.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|||||||
@@ -33,7 +33,7 @@
|
|||||||
"source-map-support": "0.5.12",
|
"source-map-support": "0.5.12",
|
||||||
"ts-eager": "2.0.2",
|
"ts-eager": "2.0.2",
|
||||||
"ts-jest": "29.1.0",
|
"ts-jest": "29.1.0",
|
||||||
"turbo": "1.12.5",
|
"turbo": "1.13.0",
|
||||||
"typescript": "4.9.5"
|
"typescript": "4.9.5"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -1,5 +1,11 @@
|
|||||||
# @vercel/build-utils
|
# @vercel/build-utils
|
||||||
|
|
||||||
|
## 7.10.0
|
||||||
|
|
||||||
|
### Minor Changes
|
||||||
|
|
||||||
|
- Allow environment variables to be specified for `EdgeFunction` ([#11029](https://github.com/vercel/vercel/pull/11029))
|
||||||
|
|
||||||
## 7.9.1
|
## 7.9.1
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@vercel/build-utils",
|
"name": "@vercel/build-utils",
|
||||||
"version": "7.9.1",
|
"version": "7.10.0",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"main": "./dist/index.js",
|
"main": "./dist/index.js",
|
||||||
"types": "./dist/index.d.js",
|
"types": "./dist/index.d.js",
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { Files, FunctionFramework } from './types';
|
import type { Env, Files, FunctionFramework } from './types';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An Edge Functions output
|
* An Edge Functions output
|
||||||
@@ -23,6 +23,11 @@ export class EdgeFunction {
|
|||||||
*/
|
*/
|
||||||
entrypoint: string;
|
entrypoint: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Environment variables for the edge function to use at runtime.
|
||||||
|
*/
|
||||||
|
environment?: Env;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The list of files to be included in the edge function bundle.
|
* The list of files to be included in the edge function bundle.
|
||||||
*/
|
*/
|
||||||
@@ -48,5 +53,6 @@ export class EdgeFunction {
|
|||||||
this.assets = params.assets;
|
this.assets = params.assets;
|
||||||
this.regions = params.regions;
|
this.regions = params.regions;
|
||||||
this.framework = params.framework;
|
this.framework = params.framework;
|
||||||
|
this.environment = params.environment;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,11 +5,7 @@ import minimatch from 'minimatch';
|
|||||||
import { readlink } from 'fs-extra';
|
import { readlink } from 'fs-extra';
|
||||||
import { isSymbolicLink, isDirectory } from './fs/download';
|
import { isSymbolicLink, isDirectory } from './fs/download';
|
||||||
import streamToBuffer from './fs/stream-to-buffer';
|
import streamToBuffer from './fs/stream-to-buffer';
|
||||||
import type { Files, Config, FunctionFramework } from './types';
|
import type { Config, Env, Files, FunctionFramework } from './types';
|
||||||
|
|
||||||
interface Environment {
|
|
||||||
[key: string]: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export type LambdaOptions = LambdaOptionsWithFiles | LambdaOptionsWithZipBuffer;
|
export type LambdaOptions = LambdaOptionsWithFiles | LambdaOptionsWithZipBuffer;
|
||||||
|
|
||||||
@@ -21,7 +17,7 @@ export interface LambdaOptionsBase {
|
|||||||
architecture?: LambdaArchitecture;
|
architecture?: LambdaArchitecture;
|
||||||
memory?: number;
|
memory?: number;
|
||||||
maxDuration?: number;
|
maxDuration?: number;
|
||||||
environment?: Environment;
|
environment?: Env;
|
||||||
allowQuery?: string[];
|
allowQuery?: string[];
|
||||||
regions?: string[];
|
regions?: string[];
|
||||||
supportsMultiPayloads?: boolean;
|
supportsMultiPayloads?: boolean;
|
||||||
@@ -69,7 +65,7 @@ export class Lambda {
|
|||||||
architecture?: LambdaArchitecture;
|
architecture?: LambdaArchitecture;
|
||||||
memory?: number;
|
memory?: number;
|
||||||
maxDuration?: number;
|
maxDuration?: number;
|
||||||
environment: Environment;
|
environment: Env;
|
||||||
allowQuery?: string[];
|
allowQuery?: string[];
|
||||||
regions?: string[];
|
regions?: string[];
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -3,5 +3,8 @@
|
|||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "mkdir -p public && (printf \"npm version: \" && npm -v) > public/index.txt"
|
"build": "mkdir -p public && (printf \"npm version: \" && npm -v) > public/index.txt"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": "16.x"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,5 +5,8 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"once": "^1.4.0"
|
"once": "^1.4.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": "16.x"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,5 +6,8 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"exeggcute": "^1.0.0",
|
"exeggcute": "^1.0.0",
|
||||||
"once": "^1.4.0"
|
"once": "^1.4.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": "16.x"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,5 +5,8 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"sharp": "0.33.2"
|
"sharp": "0.33.2"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": "16.x"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,19 @@
|
|||||||
# vercel
|
# vercel
|
||||||
|
|
||||||
|
## 33.6.2
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Added sunset warning to secrets command. ([#11333](https://github.com/vercel/vercel/pull/11333))
|
||||||
|
|
||||||
|
- Swap jest for vitest in CLI unit tests ([#11302](https://github.com/vercel/vercel/pull/11302))
|
||||||
|
|
||||||
|
- Updated dependencies [[`988f7b75a`](https://github.com/vercel/vercel/commit/988f7b75a27387e84fce541b844f984d2c151980), [`1825b58df`](https://github.com/vercel/vercel/commit/1825b58df8d783e79f0addf262618f422246f4b3)]:
|
||||||
|
- @vercel/remix-builder@2.1.5
|
||||||
|
- @vercel/build-utils@7.10.0
|
||||||
|
- @vercel/node@3.0.25
|
||||||
|
- @vercel/static-build@2.4.5
|
||||||
|
|
||||||
## 33.6.1
|
## 33.6.1
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "vercel",
|
"name": "vercel",
|
||||||
"version": "33.6.1",
|
"version": "33.6.2",
|
||||||
"preferGlobal": true,
|
"preferGlobal": true,
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"description": "The command-line interface for Vercel",
|
"description": "The command-line interface for Vercel",
|
||||||
@@ -12,7 +12,7 @@
|
|||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "jest --reporters=default --reporters=jest-junit --env node --verbose --bail",
|
"test": "jest --reporters=default --reporters=jest-junit --env node --verbose --bail",
|
||||||
"test-unit": "pnpm test test/unit/",
|
"test-unit": "pnpm vitest test/unit/",
|
||||||
"test-e2e": "rimraf test/fixtures/integration && pnpm test test/integration-1.test.ts test/integration-2.test.ts test/integration-3.test.ts",
|
"test-e2e": "rimraf test/fixtures/integration && pnpm test test/integration-1.test.ts test/integration-2.test.ts test/integration-3.test.ts",
|
||||||
"test-dev": "pnpm test test/dev/",
|
"test-dev": "pnpm test test/dev/",
|
||||||
"coverage": "codecov",
|
"coverage": "codecov",
|
||||||
@@ -31,17 +31,17 @@
|
|||||||
"node": ">= 16"
|
"node": ">= 16"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@vercel/build-utils": "7.9.1",
|
"@vercel/build-utils": "7.10.0",
|
||||||
"@vercel/fun": "1.1.0",
|
"@vercel/fun": "1.1.0",
|
||||||
"@vercel/go": "3.0.5",
|
"@vercel/go": "3.0.5",
|
||||||
"@vercel/hydrogen": "1.0.2",
|
"@vercel/hydrogen": "1.0.2",
|
||||||
"@vercel/next": "4.1.6",
|
"@vercel/next": "4.1.6",
|
||||||
"@vercel/node": "3.0.24",
|
"@vercel/node": "3.0.25",
|
||||||
"@vercel/python": "4.1.1",
|
"@vercel/python": "4.1.1",
|
||||||
"@vercel/redwood": "2.0.8",
|
"@vercel/redwood": "2.0.8",
|
||||||
"@vercel/remix-builder": "2.1.4",
|
"@vercel/remix-builder": "2.1.5",
|
||||||
"@vercel/ruby": "2.0.5",
|
"@vercel/ruby": "2.0.5",
|
||||||
"@vercel/static-build": "2.4.4",
|
"@vercel/static-build": "2.4.5",
|
||||||
"chokidar": "3.3.1"
|
"chokidar": "3.3.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
@@ -88,12 +88,13 @@
|
|||||||
"@types/yauzl-promise": "2.1.0",
|
"@types/yauzl-promise": "2.1.0",
|
||||||
"@vercel-internals/constants": "1.0.4",
|
"@vercel-internals/constants": "1.0.4",
|
||||||
"@vercel-internals/get-package-json": "1.0.0",
|
"@vercel-internals/get-package-json": "1.0.0",
|
||||||
"@vercel-internals/types": "1.0.27",
|
"@vercel-internals/types": "1.0.28",
|
||||||
"@vercel/client": "13.1.7",
|
"@vercel/client": "13.1.8",
|
||||||
"@vercel/error-utils": "2.0.2",
|
"@vercel/error-utils": "2.0.2",
|
||||||
"@vercel/frameworks": "3.0.0",
|
"@vercel/frameworks": "3.0.1",
|
||||||
"@vercel/fs-detectors": "5.2.1",
|
"@vercel/fs-detectors": "5.2.2",
|
||||||
"@vercel/routing-utils": "3.1.0",
|
"@vercel/routing-utils": "3.1.0",
|
||||||
|
"@vitest/expect": "1.4.0",
|
||||||
"ajv": "6.12.2",
|
"ajv": "6.12.2",
|
||||||
"alpha-sort": "2.0.1",
|
"alpha-sort": "2.0.1",
|
||||||
"ansi-escapes": "4.3.2",
|
"ansi-escapes": "4.3.2",
|
||||||
@@ -165,6 +166,8 @@
|
|||||||
"ts-node": "10.9.1",
|
"ts-node": "10.9.1",
|
||||||
"universal-analytics": "0.4.20",
|
"universal-analytics": "0.4.20",
|
||||||
"utility-types": "2.1.0",
|
"utility-types": "2.1.0",
|
||||||
|
"vite": "5.1.6",
|
||||||
|
"vitest": "1.3.1",
|
||||||
"which": "3.0.0",
|
"which": "3.0.0",
|
||||||
"write-json-file": "2.2.0",
|
"write-json-file": "2.2.0",
|
||||||
"xdg-app-paths": "5.1.0",
|
"xdg-app-paths": "5.1.0",
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import dotenv from 'dotenv';
|
|||||||
import semver from 'semver';
|
import semver from 'semver';
|
||||||
import minimatch from 'minimatch';
|
import minimatch from 'minimatch';
|
||||||
import { join, normalize, relative, resolve, sep } from 'path';
|
import { join, normalize, relative, resolve, sep } from 'path';
|
||||||
import frameworks from '@vercel/frameworks';
|
import { frameworkList } from '@vercel/frameworks';
|
||||||
import {
|
import {
|
||||||
getDiscontinuedNodeVersions,
|
getDiscontinuedNodeVersions,
|
||||||
normalizePath,
|
normalizePath,
|
||||||
@@ -695,7 +695,7 @@ async function getFramework(
|
|||||||
): Promise<{ version: string } | undefined> {
|
): Promise<{ version: string } | undefined> {
|
||||||
const detectedFramework = await detectFrameworkRecord({
|
const detectedFramework = await detectFrameworkRecord({
|
||||||
fs: new LocalFileSystemDetector(cwd),
|
fs: new LocalFileSystemDetector(cwd),
|
||||||
frameworkList: frameworks,
|
frameworkList,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!detectedFramework) {
|
if (!detectedFramework) {
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import {
|
|||||||
getSupportedNodeVersion,
|
getSupportedNodeVersion,
|
||||||
scanParentDirs,
|
scanParentDirs,
|
||||||
} from '@vercel/build-utils';
|
} from '@vercel/build-utils';
|
||||||
|
import { isZeroConfigBuild } from '../../util/is-zero-config-build';
|
||||||
import {
|
import {
|
||||||
fileNameSymbol,
|
fileNameSymbol,
|
||||||
VALID_ARCHIVE_FORMATS,
|
VALID_ARCHIVE_FORMATS,
|
||||||
@@ -564,7 +565,7 @@ export default async (client: Client): Promise<number> => {
|
|||||||
autoAssignCustomDomains,
|
autoAssignCustomDomains,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!localConfig.builds || localConfig.builds.length === 0) {
|
if (isZeroConfigBuild(localConfig.builds)) {
|
||||||
// Only add projectSettings for zero config deployments
|
// Only add projectSettings for zero config deployments
|
||||||
createArgs.projectSettings = {
|
createArgs.projectSettings = {
|
||||||
sourceFilesOutsideRootDirectory,
|
sourceFilesOutsideRootDirectory,
|
||||||
|
|||||||
2
packages/cli/src/commands/env/add.ts
vendored
2
packages/cli/src/commands/env/add.ts
vendored
@@ -30,7 +30,7 @@ export default async function add(
|
|||||||
output: Output
|
output: Output
|
||||||
) {
|
) {
|
||||||
// improve the way we show inquirer prompts
|
// improve the way we show inquirer prompts
|
||||||
require('../../util/input/patch-inquirer');
|
await import('../../util/input/patch-inquirer');
|
||||||
|
|
||||||
const stdInput = await readStandardInput(client.stdin);
|
const stdInput = await readStandardInput(client.stdin);
|
||||||
let [envName, envTargetArg, envGitBranch] = args;
|
let [envName, envTargetArg, envGitBranch] = args;
|
||||||
|
|||||||
2
packages/cli/src/commands/env/rm.ts
vendored
2
packages/cli/src/commands/env/rm.ts
vendored
@@ -30,7 +30,7 @@ export default async function rm(
|
|||||||
output: Output
|
output: Output
|
||||||
) {
|
) {
|
||||||
// improve the way we show inquirer prompts
|
// improve the way we show inquirer prompts
|
||||||
require('../../util/input/patch-inquirer');
|
await import('../../util/input/patch-inquirer');
|
||||||
|
|
||||||
if (args.length > 3) {
|
if (args.length > 3) {
|
||||||
output.error(
|
output.error(
|
||||||
|
|||||||
@@ -2,9 +2,14 @@ import { packageName, getCommandName } from '../../util/pkg-name';
|
|||||||
|
|
||||||
export const secretsCommand = {
|
export const secretsCommand = {
|
||||||
name: 'secrets',
|
name: 'secrets',
|
||||||
description: `NOTE: The ${getCommandName(
|
description:
|
||||||
|
'WARNING: On May 1st, 2024 secrets will be automatically converted to sensitive Environment Variables for Preview and Production environments. Secrets attached to Development environments will not be migrated.\n' +
|
||||||
|
`The ${getCommandName(
|
||||||
|
'secrets'
|
||||||
|
)} command will be deprecated at this time, please use the ${getCommandName(
|
||||||
'env'
|
'env'
|
||||||
)} command is recommended instead of ${getCommandName('secrets')}`,
|
)} command instead.\n` +
|
||||||
|
'See https://vercel.com/changelog/legacy-environment-variable-secrets-are-being-sunset for more information.',
|
||||||
arguments: [
|
arguments: [
|
||||||
{
|
{
|
||||||
name: 'command',
|
name: 'command',
|
||||||
|
|||||||
@@ -78,6 +78,12 @@ async function run({ output, contextName, currentTeam, client }) {
|
|||||||
|
|
||||||
const commandName = getCommandName('secret ' + subcommand);
|
const commandName = getCommandName('secret ' + subcommand);
|
||||||
|
|
||||||
|
output.warn(
|
||||||
|
'On May 1st, 2024 secrets will be automatically converted to sensitive Environment Variables for Preview and Production environments.\n' +
|
||||||
|
'Secrets attached to Development environments will not be migrated.' +
|
||||||
|
'See https://vercel.com/changelog/legacy-environment-variable-secrets-are-being-sunset for more information.'
|
||||||
|
);
|
||||||
|
|
||||||
if (subcommand === 'ls' || subcommand === 'list') {
|
if (subcommand === 'ls' || subcommand === 'list') {
|
||||||
output.note(
|
output.note(
|
||||||
`The ${getCommandName(
|
`The ${getCommandName(
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
import frameworkList from '@vercel/frameworks';
|
import { frameworkList } from '@vercel/frameworks';
|
||||||
|
|
||||||
export function sortBuilders<B extends { use: string }>(builds: B[]): B[] {
|
export function sortBuilders<B extends { use: string }>(builds: B[]): B[] {
|
||||||
const frontendRuntimeSet = new Set(
|
const frontendRuntimeSet = new Set(
|
||||||
frameworkList.map(f => f.useRuntime?.use || '@vercel/static-build')
|
frameworkList.map(f => f.useRuntime?.use || '@vercel/static-build')
|
||||||
);
|
);
|
||||||
const toNumber = (build: B) => (frontendRuntimeSet.has(build.use) ? 0 : 1);
|
const toNumber = (build: B) => (frontendRuntimeSet.has(build.use) ? 0 : 1);
|
||||||
|
|
||||||
return builds.sort((build1, build2) => {
|
return builds.sort((build1, build2) => {
|
||||||
return toNumber(build1) - toNumber(build2);
|
return toNumber(build1) - toNumber(build2);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ const getGlobalPathConfig = (): string => {
|
|||||||
];
|
];
|
||||||
|
|
||||||
// The customPath flag is the preferred location,
|
// The customPath flag is the preferred location,
|
||||||
// followed by the the vercel directory,
|
// followed by the vercel directory,
|
||||||
// followed by the now directory.
|
// followed by the now directory.
|
||||||
// If none of those exist, use the vercel directory.
|
// If none of those exist, use the vercel directory.
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ import {
|
|||||||
detectApiExtensions,
|
detectApiExtensions,
|
||||||
isOfficialRuntime,
|
isOfficialRuntime,
|
||||||
} from '@vercel/fs-detectors';
|
} from '@vercel/fs-detectors';
|
||||||
import frameworkList from '@vercel/frameworks';
|
import { frameworkList } from '@vercel/frameworks';
|
||||||
|
|
||||||
import cmd from '../output/cmd';
|
import cmd from '../output/cmd';
|
||||||
import link from '../output/link';
|
import link from '../output/link';
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ export default async function confirm(
|
|||||||
message: string,
|
message: string,
|
||||||
preferred: boolean
|
preferred: boolean
|
||||||
): Promise<boolean> {
|
): Promise<boolean> {
|
||||||
require('./patch-inquirer');
|
await import('./patch-inquirer');
|
||||||
|
|
||||||
const answers = await client.prompt({
|
const answers = await client.prompt({
|
||||||
type: 'confirm',
|
type: 'confirm',
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import inquirer from 'inquirer';
|
import inquirer from 'inquirer';
|
||||||
import confirm from './confirm';
|
import confirm from './confirm';
|
||||||
import chalk from 'chalk';
|
import chalk from 'chalk';
|
||||||
import frameworkList, { Framework } from '@vercel/frameworks';
|
import { frameworkList, Framework } from '@vercel/frameworks';
|
||||||
import Client from '../client';
|
import Client from '../client';
|
||||||
import { isSettingValue } from '../is-setting-value';
|
import { isSettingValue } from '../is-setting-value';
|
||||||
import type { ProjectSettings } from '@vercel-internals/types';
|
import type { ProjectSettings } from '@vercel-internals/types';
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ export default async function list(
|
|||||||
eraseFinalAnswer = false, // If true, the line with the final answer that inquirer prints will be erased before returning
|
eraseFinalAnswer = false, // If true, the line with the final answer that inquirer prints will be erased before returning
|
||||||
}: ListOptions
|
}: ListOptions
|
||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
require('./patch-inquirer');
|
await import('./patch-inquirer');
|
||||||
|
|
||||||
let biggestLength = 0;
|
let biggestLength = 0;
|
||||||
let selected: string | undefined;
|
let selected: string | undefined;
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ export default async function selectOrg(
|
|||||||
question: string,
|
question: string,
|
||||||
autoConfirm?: boolean
|
autoConfirm?: boolean
|
||||||
): Promise<Org> {
|
): Promise<Org> {
|
||||||
require('./patch-inquirer');
|
await import('./patch-inquirer');
|
||||||
const {
|
const {
|
||||||
output,
|
output,
|
||||||
config: { currentTeam },
|
config: { currentTeam },
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ export default function text({
|
|||||||
// Tab
|
// Tab
|
||||||
// Right arrow
|
// Right arrow
|
||||||
autoCompleteChars = new Set(['\t', '\x1b[C']),
|
autoCompleteChars = new Set(['\t', '\x1b[C']),
|
||||||
// If true, converts everything the user types to to lowercase
|
// If true, converts everything the user types to lowercase
|
||||||
forceLowerCase = false,
|
forceLowerCase = false,
|
||||||
}: TextParams = {}): Promise<string> {
|
}: TextParams = {}): Promise<string> {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
|
|||||||
11
packages/cli/src/util/is-zero-config-build.ts
Normal file
11
packages/cli/src/util/is-zero-config-build.ts
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
import { Builder } from '@vercel/build-utils';
|
||||||
|
|
||||||
|
export function isZeroConfigBuild(builds?: Builder[]): boolean {
|
||||||
|
return (
|
||||||
|
!builds ||
|
||||||
|
builds.length === 0 ||
|
||||||
|
// If the zeroConfig property is set on all builds, still consider it as
|
||||||
|
// zero config deployment
|
||||||
|
builds.every(buildConfig => buildConfig.config?.zeroConfig)
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -2,6 +2,7 @@ import { join, basename } from 'path';
|
|||||||
import chalk from 'chalk';
|
import chalk from 'chalk';
|
||||||
import { remove } from 'fs-extra';
|
import { remove } from 'fs-extra';
|
||||||
import { ProjectLinkResult, ProjectSettings } from '@vercel-internals/types';
|
import { ProjectLinkResult, ProjectSettings } from '@vercel-internals/types';
|
||||||
|
import { isZeroConfigBuild } from '../is-zero-config-build';
|
||||||
import {
|
import {
|
||||||
getLinkedProject,
|
getLinkedProject,
|
||||||
linkFolderToProject,
|
linkFolderToProject,
|
||||||
@@ -160,8 +161,7 @@ export default async function setupAndLink(
|
|||||||
}
|
}
|
||||||
|
|
||||||
config.currentTeam = org.type === 'team' ? org.id : undefined;
|
config.currentTeam = org.type === 'team' ? org.id : undefined;
|
||||||
const isZeroConfig =
|
const isZeroConfig = !localConfig || isZeroConfigBuild(localConfig.builds);
|
||||||
!localConfig || !localConfig.builds || localConfig.builds.length === 0;
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
let settings: ProjectSettings = {};
|
let settings: ProjectSettings = {};
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { join } from 'path';
|
import { join } from 'path';
|
||||||
import frameworkList, { Framework } from '@vercel/frameworks';
|
import { frameworkList, Framework } from '@vercel/frameworks';
|
||||||
import {
|
import {
|
||||||
detectFrameworks,
|
detectFrameworks,
|
||||||
getWorkspacePackagePaths,
|
getWorkspacePackagePaths,
|
||||||
|
|||||||
6
packages/cli/test/dev/fixtures/08-hugo/package.json
Normal file
6
packages/cli/test/dev/fixtures/08-hugo/package.json
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"private": true,
|
||||||
|
"engines": {
|
||||||
|
"node": "16.x"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -10,6 +10,6 @@ menu:
|
|||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
This is an example of a custom shortcode that you can put right into your content. You will need to add a form action to the the shortcode to make it work. Check out [Formspree](https://formspree.io/) for a simple, free form service.
|
This is an example of a custom shortcode that you can put right into your content. You will need to add a form action to the shortcode to make it work. Check out [Formspree](https://formspree.io/) for a simple, free form service.
|
||||||
|
|
||||||
{{< form-contact action="https://example.com" >}}
|
{{< form-contact action="https://example.com" >}}
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"private": true,
|
||||||
|
"engines": {
|
||||||
|
"node": "16.x"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"private": true,
|
||||||
|
"engines": {
|
||||||
|
"node": "16.x"
|
||||||
|
}
|
||||||
|
}
|
||||||
6
packages/cli/test/dev/fixtures/go/package.json
Normal file
6
packages/cli/test/dev/fixtures/go/package.json
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"private": true,
|
||||||
|
"engines": {
|
||||||
|
"node": "16.x"
|
||||||
|
}
|
||||||
|
}
|
||||||
6
packages/cli/test/dev/fixtures/python-flask/package.json
Normal file
6
packages/cli/test/dev/fixtures/python-flask/package.json
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"private": true,
|
||||||
|
"engines": {
|
||||||
|
"node": "16.x"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -119,7 +119,6 @@ test(
|
|||||||
await testPath(200, `/api/date`, new RegExp(`Current date is ${year}`));
|
await testPath(200, `/api/date`, new RegExp(`Current date is ${year}`));
|
||||||
await testPath(200, `/api/date.py`, new RegExp(`Current date is ${year}`));
|
await testPath(200, `/api/date.py`, new RegExp(`Current date is ${year}`));
|
||||||
await testPath(200, `/api/headers`, (body: any, res: any) => {
|
await testPath(200, `/api/headers`, (body: any, res: any) => {
|
||||||
// @ts-ignore
|
|
||||||
const { host } = new URL(res.url);
|
const { host } = new URL(res.url);
|
||||||
expect(body).toBe(host);
|
expect(body).toBe(host);
|
||||||
});
|
});
|
||||||
@@ -198,7 +197,6 @@ test(
|
|||||||
);
|
);
|
||||||
|
|
||||||
await testPath(200, `/api/dump`, (body: any, res: any, isDev: any) => {
|
await testPath(200, `/api/dump`, (body: any, res: any, isDev: any) => {
|
||||||
// @ts-ignore
|
|
||||||
const { host } = new URL(res.url);
|
const { host } = new URL(res.url);
|
||||||
const { env, headers } = JSON.parse(body);
|
const { env, headers } = JSON.parse(body);
|
||||||
|
|
||||||
|
|||||||
@@ -7,5 +7,8 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"exeggcute": "^1.0.0",
|
"exeggcute": "^1.0.0",
|
||||||
"once": "^1.4.0"
|
"once": "^1.4.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": "18.x"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -348,6 +348,9 @@ module.exports = async function prepare(session, binaryPath, tmpFixturesDir) {
|
|||||||
},
|
},
|
||||||
'lambda-with-php-runtime': {
|
'lambda-with-php-runtime': {
|
||||||
'api/test.php': `<?php echo 'Hello from PHP'; ?>`,
|
'api/test.php': `<?php echo 'Hello from PHP'; ?>`,
|
||||||
|
'package.json': JSON.stringify({
|
||||||
|
engines: { node: '18.x' },
|
||||||
|
}),
|
||||||
'vercel.json': JSON.stringify({
|
'vercel.json': JSON.stringify({
|
||||||
functions: {
|
functions: {
|
||||||
'api/**/*.php': {
|
'api/**/*.php': {
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { afterAll } from 'vitest';
|
||||||
import findUp from 'find-up';
|
import findUp from 'find-up';
|
||||||
import fs from 'fs-extra';
|
import fs from 'fs-extra';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
const originalCwd = process.cwd();
|
const originalCwd = process.cwd();
|
||||||
|
import { afterAll, beforeAll, afterEach } from 'vitest';
|
||||||
|
|
||||||
// Register Jest matcher extensions for CLI unit tests
|
// Register Jest matcher extensions for CLI unit tests
|
||||||
import './matchers';
|
import './matchers';
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { beforeEach } from 'vitest';
|
||||||
import { URL } from 'url';
|
import { URL } from 'url';
|
||||||
import chance from 'chance';
|
import chance from 'chance';
|
||||||
import { client } from './client';
|
import { client } from './client';
|
||||||
|
|||||||
@@ -1,63 +1,13 @@
|
|||||||
/**
|
import { expect } from 'vitest';
|
||||||
* This file registers the custom Jest "matchers" that are useful for
|
import { toOutput } from './matchers';
|
||||||
* writing CLI unit tests, and sets them up to be recognized by TypeScript.
|
|
||||||
*
|
|
||||||
* References:
|
|
||||||
* - https://haspar.us/notes/adding-jest-custom-matchers-in-typescript
|
|
||||||
* - https://gist.github.com/hasparus/4ebaa17ec5d3d44607f522bcb1cda9fb
|
|
||||||
*/
|
|
||||||
|
|
||||||
/// <reference types="@types/jest" />
|
interface ToOutputMatchers<R = unknown> {
|
||||||
|
toOutput: (test: string, timeout?: number) => Promise<R>;
|
||||||
|
}
|
||||||
|
|
||||||
import * as matchers from './matchers';
|
declare module 'vitest' {
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
||||||
type Tail<T extends unknown[]> = T extends [infer _Head, ...infer Tail]
|
|
||||||
? Tail
|
|
||||||
: never;
|
|
||||||
|
|
||||||
type AnyFunction = (...args: any[]) => any;
|
|
||||||
type PromiseFunction = (...args: any[]) => Promise<any>;
|
|
||||||
|
|
||||||
type GetMatcherType<TP, TResult> = TP extends PromiseFunction
|
|
||||||
? (...args: Tail<Parameters<TP>>) => Promise<TResult>
|
|
||||||
: TP extends AnyFunction
|
|
||||||
? (...args: Tail<Parameters<TP>>) => TResult
|
|
||||||
: TP;
|
|
||||||
|
|
||||||
type GetMatchersType<TMatchers, TResult> = {
|
|
||||||
[P in keyof TMatchers]: GetMatcherType<TMatchers[P], TResult>;
|
|
||||||
};
|
|
||||||
|
|
||||||
type FirstParam<T extends AnyFunction> = Parameters<T>[0];
|
|
||||||
|
|
||||||
type OnlyMethodsWhereFirstArgIsOfType<TObject, TWantedFirstArg> = {
|
|
||||||
[P in keyof TObject]: TObject[P] extends AnyFunction
|
|
||||||
? TWantedFirstArg extends FirstParam<TObject[P]>
|
|
||||||
? TObject[P]
|
|
||||||
: [
|
|
||||||
`Error: this function is present only when received is:`,
|
|
||||||
FirstParam<TObject[P]>
|
|
||||||
]
|
|
||||||
: TObject[P];
|
|
||||||
};
|
|
||||||
|
|
||||||
declare global {
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-namespace
|
|
||||||
namespace jest {
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
||||||
interface Matchers<R, T = {}>
|
interface Assertion<T = any> extends ToOutputMatchers<T> {}
|
||||||
extends GetMatchersType<
|
|
||||||
OnlyMethodsWhereFirstArgIsOfType<typeof matchers, T>,
|
|
||||||
R
|
|
||||||
> {}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const jestExpect = (global as any).expect;
|
expect.extend({ toOutput });
|
||||||
|
|
||||||
if (jestExpect !== undefined) {
|
|
||||||
jestExpect.extend(matchers);
|
|
||||||
} else {
|
|
||||||
console.error("Couldn't find Jest's global expect.");
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import {
|
|||||||
printReceived,
|
printReceived,
|
||||||
} from 'jest-matcher-utils';
|
} from 'jest-matcher-utils';
|
||||||
import type { Readable } from 'stream';
|
import type { Readable } from 'stream';
|
||||||
import type { MatcherState } from 'expect';
|
import type { MatcherState } from '@vitest/expect';
|
||||||
import type { MatcherHintOptions } from 'jest-matcher-utils';
|
import type { MatcherHintOptions } from 'jest-matcher-utils';
|
||||||
|
|
||||||
export async function toOutput(
|
export async function toOutput(
|
||||||
@@ -13,7 +13,10 @@ export async function toOutput(
|
|||||||
stream: Readable,
|
stream: Readable,
|
||||||
test: string,
|
test: string,
|
||||||
timeout = 3000
|
timeout = 3000
|
||||||
) {
|
): Promise<{
|
||||||
|
pass: boolean;
|
||||||
|
message: () => string;
|
||||||
|
}> {
|
||||||
const { isNot } = this;
|
const { isNot } = this;
|
||||||
const matcherName = 'toOutput';
|
const matcherName = 'toOutput';
|
||||||
const matcherHintOptions: MatcherHintOptions = {
|
const matcherHintOptions: MatcherHintOptions = {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
||||||
|
|
||||||
exports[`help command help output snapshots column width 40 1`] = `
|
exports[`help command > help output snapshots > column width 40 1`] = `
|
||||||
"
|
"
|
||||||
▲ [1mvercel[22m [1mdeploy[22m [project-path] [options]
|
▲ [1mvercel[22m [1mdeploy[22m [project-path] [options]
|
||||||
|
|
||||||
@@ -186,7 +186,7 @@ exports[`help command help output snapshots column width 40 1`] = `
|
|||||||
"
|
"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`help command help output snapshots column width 80 1`] = `
|
exports[`help command > help output snapshots > column width 80 1`] = `
|
||||||
"
|
"
|
||||||
▲ [1mvercel[22m [1mdeploy[22m [project-path] [options]
|
▲ [1mvercel[22m [1mdeploy[22m [project-path] [options]
|
||||||
|
|
||||||
@@ -260,7 +260,7 @@ exports[`help command help output snapshots column width 80 1`] = `
|
|||||||
"
|
"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`help command help output snapshots column width 120 1`] = `
|
exports[`help command > help output snapshots > column width 120 1`] = `
|
||||||
"
|
"
|
||||||
▲ [1mvercel[22m [1mdeploy[22m [project-path] [options]
|
▲ [1mvercel[22m [1mdeploy[22m [project-path] [options]
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { describe, expect, it } from 'vitest';
|
||||||
import { client } from '../../mocks/client';
|
import { client } from '../../mocks/client';
|
||||||
import alias from '../../../src/commands/alias';
|
import alias from '../../../src/commands/alias';
|
||||||
import { useUser } from '../../mocks/user';
|
import { useUser } from '../../mocks/user';
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { describe, expect, it } from 'vitest';
|
||||||
import { client } from '../../mocks/client';
|
import { client } from '../../mocks/client';
|
||||||
import { useUser } from '../../mocks/user';
|
import { useUser } from '../../mocks/user';
|
||||||
import bisect from '../../../src/commands/bisect';
|
import bisect from '../../../src/commands/bisect';
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { beforeAll, beforeEach, describe, expect, it } from 'vitest';
|
||||||
import fs from 'fs-extra';
|
import fs from 'fs-extra';
|
||||||
import { join } from 'path';
|
import { join } from 'path';
|
||||||
import { getWriteableDirectory } from '@vercel/build-utils';
|
import { getWriteableDirectory } from '@vercel/build-utils';
|
||||||
@@ -7,8 +8,9 @@ import { defaultProject, useProject } from '../../../mocks/project';
|
|||||||
import { useTeams } from '../../../mocks/team';
|
import { useTeams } from '../../../mocks/team';
|
||||||
import { useUser } from '../../../mocks/user';
|
import { useUser } from '../../../mocks/user';
|
||||||
import { execSync } from 'child_process';
|
import { execSync } from 'child_process';
|
||||||
|
import { vi } from 'vitest';
|
||||||
|
|
||||||
jest.setTimeout(6 * 60 * 1000);
|
vi.setConfig({ testTimeout: 6 * 60 * 1000 });
|
||||||
|
|
||||||
const fixture = (name: string) =>
|
const fixture = (name: string) =>
|
||||||
join(__dirname, '../../../fixtures/unit/commands/build', name);
|
join(__dirname, '../../../fixtures/unit/commands/build', name);
|
||||||
@@ -932,7 +934,7 @@ describe('build', () => {
|
|||||||
name: 'Error',
|
name: 'Error',
|
||||||
message:
|
message:
|
||||||
'Invalid vercel.json - `rewrites[2]` should NOT have additional property `src`. Did you mean `source`?',
|
'Invalid vercel.json - `rewrites[2]` should NOT have additional property `src`. Did you mean `source`?',
|
||||||
stack: expect.stringContaining('at validateConfig'),
|
stack: expect.stringContaining('at Module.validateConfig'),
|
||||||
hideStackTrace: true,
|
hideStackTrace: true,
|
||||||
code: 'INVALID_VERCEL_CONFIG',
|
code: 'INVALID_VERCEL_CONFIG',
|
||||||
link: 'https://vercel.com/docs/concepts/projects/project-configuration#rewrites',
|
link: 'https://vercel.com/docs/concepts/projects/project-configuration#rewrites',
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { describe, expect, it } from 'vitest';
|
||||||
import { client } from '../../mocks/client';
|
import { client } from '../../mocks/client';
|
||||||
import certs from '../../../src/commands/certs';
|
import certs from '../../../src/commands/certs';
|
||||||
import { useUser } from '../../mocks/user';
|
import { useUser } from '../../mocks/user';
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { describe, expect, it } from 'vitest';
|
||||||
import bytes from 'bytes';
|
import bytes from 'bytes';
|
||||||
import fs from 'fs-extra';
|
import fs from 'fs-extra';
|
||||||
import { join } from 'path';
|
import { join } from 'path';
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { describe, expect, it } from 'vitest';
|
||||||
import { client } from '../../mocks/client';
|
import { client } from '../../mocks/client';
|
||||||
import dns from '../../../src/commands/dns';
|
import dns from '../../../src/commands/dns';
|
||||||
import { useUser } from '../../mocks/user';
|
import { useUser } from '../../mocks/user';
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { describe, expect, it } from 'vitest';
|
||||||
import { client } from '../../mocks/client';
|
import { client } from '../../mocks/client';
|
||||||
import domains from '../../../src/commands/domains';
|
import domains from '../../../src/commands/domains';
|
||||||
import { useUser } from '../../mocks/user';
|
import { useUser } from '../../mocks/user';
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { describe, expect, it } from 'vitest';
|
||||||
import fs from 'fs-extra';
|
import fs from 'fs-extra';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import { parse } from 'dotenv';
|
import { parse } from 'dotenv';
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { describe, expect, it } from 'vitest';
|
||||||
import { join } from 'path';
|
import { join } from 'path';
|
||||||
import fs from 'fs-extra';
|
import fs from 'fs-extra';
|
||||||
import { useUser } from '../../mocks/user';
|
import { useUser } from '../../mocks/user';
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { describe, expect, test } from 'vitest';
|
||||||
import {
|
import {
|
||||||
help,
|
help,
|
||||||
lineToString,
|
lineToString,
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { describe, expect, it } from 'vitest';
|
||||||
import { client } from '../../mocks/client';
|
import { client } from '../../mocks/client';
|
||||||
import { useUser } from '../../mocks/user';
|
import { useUser } from '../../mocks/user';
|
||||||
import { useDeployment } from '../../mocks/deployment';
|
import { useDeployment } from '../../mocks/deployment';
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { describe, it, expect } from 'vitest';
|
||||||
import { basename, join } from 'path';
|
import { basename, join } from 'path';
|
||||||
import { readJSON } from 'fs-extra';
|
import { readJSON } from 'fs-extra';
|
||||||
import link from '../../../src/commands/link';
|
import link from '../../../src/commands/link';
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { describe, it, expect } from 'vitest';
|
||||||
import createLineIterator from 'line-async-iterator';
|
import createLineIterator from 'line-async-iterator';
|
||||||
import { client } from '../../mocks/client';
|
import { client } from '../../mocks/client';
|
||||||
import { useUser } from '../../mocks/user';
|
import { useUser } from '../../mocks/user';
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
|
import { afterEach, beforeEach, describe, expect, it } from 'vitest';
|
||||||
import login from '../../../src/commands/login';
|
import login from '../../../src/commands/login';
|
||||||
import { emoji } from '../../../src/util/emoji';
|
import { emoji } from '../../../src/util/emoji';
|
||||||
import { client } from '../../mocks/client';
|
import { client } from '../../mocks/client';
|
||||||
import { useUser } from '../../mocks/user';
|
import { useUser } from '../../mocks/user';
|
||||||
|
import { vi } from 'vitest';
|
||||||
|
|
||||||
jest.setTimeout(10000);
|
vi.setConfig({ testTimeout: 10000 });
|
||||||
|
|
||||||
describe('login', () => {
|
describe('login', () => {
|
||||||
it('should not allow the `--token` flag', async () => {
|
it('should not allow the `--token` flag', async () => {
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { describe, it, expect } from 'vitest';
|
||||||
import createLineIterator from 'line-async-iterator';
|
import createLineIterator from 'line-async-iterator';
|
||||||
import projects from '../../../src/commands/project';
|
import projects from '../../../src/commands/project';
|
||||||
import { useUser } from '../../mocks/user';
|
import { useUser } from '../../mocks/user';
|
||||||
@@ -6,6 +7,7 @@ import { defaultProject, useProject } from '../../mocks/project';
|
|||||||
import { client } from '../../mocks/client';
|
import { client } from '../../mocks/client';
|
||||||
import type { Project } from '@vercel-internals/types';
|
import type { Project } from '@vercel-internals/types';
|
||||||
import { parseSpacedTableRow } from '../../helpers/parse-table';
|
import { parseSpacedTableRow } from '../../helpers/parse-table';
|
||||||
|
import { vi } from 'vitest';
|
||||||
|
|
||||||
describe('project', () => {
|
describe('project', () => {
|
||||||
describe('list', () => {
|
describe('list', () => {
|
||||||
@@ -46,7 +48,7 @@ describe('project', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should list projects running on an soon-to-be-deprecated Node.js version', async () => {
|
it('should list projects running on an soon-to-be-deprecated Node.js version', async () => {
|
||||||
jest.useFakeTimers().setSystemTime(new Date('2023-12-08'));
|
vi.useFakeTimers().setSystemTime(new Date('2023-12-08'));
|
||||||
|
|
||||||
const user = useUser();
|
const user = useUser();
|
||||||
useTeams('team_dummy');
|
useTeams('team_dummy');
|
||||||
@@ -91,7 +93,7 @@ describe('project', () => {
|
|||||||
data.pop();
|
data.pop();
|
||||||
expect(data).toEqual([project.project.name, 'https://foobar.com']);
|
expect(data).toEqual([project.project.name, 'https://foobar.com']);
|
||||||
|
|
||||||
jest.clearAllTimers();
|
vi.clearAllTimers();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should list projects when there is no production deployment', async () => {
|
it('should list projects when there is no production deployment', async () => {
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { describe, expect, it } from 'vitest';
|
||||||
import chalk from 'chalk';
|
import chalk from 'chalk';
|
||||||
import { client } from '../../mocks/client';
|
import { client } from '../../mocks/client';
|
||||||
import { defaultProject, useProject } from '../../mocks/project';
|
import { defaultProject, useProject } from '../../mocks/project';
|
||||||
@@ -9,8 +10,9 @@ import { useDeployment } from '../../mocks/deployment';
|
|||||||
import { useTeams } from '../../mocks/team';
|
import { useTeams } from '../../mocks/team';
|
||||||
import { useUser } from '../../mocks/user';
|
import { useUser } from '../../mocks/user';
|
||||||
import sleep from '../../../src/util/sleep';
|
import sleep from '../../../src/util/sleep';
|
||||||
|
import { vi } from 'vitest';
|
||||||
|
|
||||||
jest.setTimeout(60000);
|
vi.setConfig({ testTimeout: 60000 });
|
||||||
|
|
||||||
describe('promote', () => {
|
describe('promote', () => {
|
||||||
it('should error if timeout is invalid', async () => {
|
it('should error if timeout is invalid', async () => {
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { describe, expect, it } from 'vitest';
|
||||||
import fs from 'fs-extra';
|
import fs from 'fs-extra';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import pull from '../../../src/commands/pull';
|
import pull from '../../../src/commands/pull';
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { describe, expect, it } from 'vitest';
|
||||||
import { client } from '../../mocks/client';
|
import { client } from '../../mocks/client';
|
||||||
import { defaultProject, useProject } from '../../mocks/project';
|
import { defaultProject, useProject } from '../../mocks/project';
|
||||||
import redeploy from '../../../src/commands/redeploy';
|
import redeploy from '../../../src/commands/redeploy';
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { describe, expect, it } from 'vitest';
|
||||||
import { client } from '../../mocks/client';
|
import { client } from '../../mocks/client';
|
||||||
import {
|
import {
|
||||||
defaultProject,
|
defaultProject,
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { describe, expect, it } from 'vitest';
|
||||||
import chalk from 'chalk';
|
import chalk from 'chalk';
|
||||||
import { client } from '../../mocks/client';
|
import { client } from '../../mocks/client';
|
||||||
import { defaultProject, useProject } from '../../mocks/project';
|
import { defaultProject, useProject } from '../../mocks/project';
|
||||||
@@ -9,8 +10,9 @@ import { useDeployment } from '../../mocks/deployment';
|
|||||||
import { useTeams } from '../../mocks/team';
|
import { useTeams } from '../../mocks/team';
|
||||||
import { useUser } from '../../mocks/user';
|
import { useUser } from '../../mocks/user';
|
||||||
import sleep from '../../../src/util/sleep';
|
import sleep from '../../../src/util/sleep';
|
||||||
|
import { vi } from 'vitest';
|
||||||
|
|
||||||
jest.setTimeout(60000);
|
vi.setConfig({ testTimeout: 60000 });
|
||||||
|
|
||||||
describe('rollback', () => {
|
describe('rollback', () => {
|
||||||
it('should error if timeout is invalid', async () => {
|
it('should error if timeout is invalid', async () => {
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { describe, expect, it } from 'vitest';
|
||||||
import { client } from '../../mocks/client';
|
import { client } from '../../mocks/client';
|
||||||
import secrets from '../../../src/commands/secrets';
|
import secrets from '../../../src/commands/secrets';
|
||||||
import { useSecrets } from '../../mocks/secrets';
|
import { useSecrets } from '../../mocks/secrets';
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { describe, expect, it } from 'vitest';
|
||||||
import { client } from '../../mocks/client';
|
import { client } from '../../mocks/client';
|
||||||
import teamsSwitch from '../../../src/commands/teams/switch';
|
import teamsSwitch from '../../../src/commands/teams/switch';
|
||||||
import { useUser } from '../../mocks/user';
|
import { useUser } from '../../mocks/user';
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { describe, expect, it } from 'vitest';
|
||||||
import { client } from '../../mocks/client';
|
import { client } from '../../mocks/client';
|
||||||
import teamsList from '../../../src/commands/teams/list';
|
import teamsList from '../../../src/commands/teams/list';
|
||||||
import { useUser } from '../../mocks/user';
|
import { useUser } from '../../mocks/user';
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { describe, expect, it } from 'vitest';
|
||||||
import { client } from '../../mocks/client';
|
import { client } from '../../mocks/client';
|
||||||
import { useUser } from '../../mocks/user';
|
import { useUser } from '../../mocks/user';
|
||||||
import whoami from '../../../src/commands/whoami';
|
import whoami from '../../../src/commands/whoami';
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { describe, expect, it } from 'vitest';
|
||||||
import { normalizeURL } from '../../../../src/util/bisect/normalize-url';
|
import { normalizeURL } from '../../../../src/util/bisect/normalize-url';
|
||||||
|
|
||||||
describe('normalize-url', () => {
|
describe('normalize-url', () => {
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { describe, it, expect } from 'vitest';
|
||||||
import { join } from 'path';
|
import { join } from 'path';
|
||||||
import { remove } from 'fs-extra';
|
import { remove } from 'fs-extra';
|
||||||
import { getWriteableDirectory } from '@vercel/build-utils';
|
import { getWriteableDirectory } from '@vercel/build-utils';
|
||||||
@@ -8,9 +9,10 @@ import {
|
|||||||
} from '../../../../src/util/build/import-builders';
|
} from '../../../../src/util/build/import-builders';
|
||||||
import vercelNextPkg from '@vercel/next/package.json';
|
import vercelNextPkg from '@vercel/next/package.json';
|
||||||
import vercelNodePkg from '@vercel/node/package.json';
|
import vercelNodePkg from '@vercel/node/package.json';
|
||||||
|
import { vi } from 'vitest';
|
||||||
|
|
||||||
// these tests can take upwards of 190s on macos-latest
|
// these tests can take upwards of 190s on macos-latest
|
||||||
jest.setTimeout(4 * 60 * 1000);
|
vi.setConfig({ testTimeout: 4 * 60 * 1000 });
|
||||||
|
|
||||||
const repoRoot = join(__dirname, '../../../../../..');
|
const repoRoot = join(__dirname, '../../../../../..');
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { describe, expect, it } from 'vitest';
|
||||||
import { tmpdir } from 'os';
|
import { tmpdir } from 'os';
|
||||||
import { join } from 'path';
|
import { join } from 'path';
|
||||||
import { writeFile, readdir, mkdirp, stat, remove, readFile } from 'fs-extra';
|
import { writeFile, readdir, mkdirp, stat, remove, readFile } from 'fs-extra';
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { describe, expect, it } from 'vitest';
|
||||||
import { scrubArgv } from '../../../../src/util/build/scrub-argv';
|
import { scrubArgv } from '../../../../src/util/build/scrub-argv';
|
||||||
|
|
||||||
describe('scrubArgv()', () => {
|
describe('scrubArgv()', () => {
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { describe, expect, test } from 'vitest';
|
||||||
import { sortBuilders } from '../../../../src/util/build/sort-builders';
|
import { sortBuilders } from '../../../../src/util/build/sort-builders';
|
||||||
|
|
||||||
describe('sortBuilders()', () => {
|
describe('sortBuilders()', () => {
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { beforeEach, describe, expect, it } from 'vitest';
|
||||||
import { listen } from 'async-listen';
|
import { listen } from 'async-listen';
|
||||||
import { createProxy } from 'proxy';
|
import { createProxy } from 'proxy';
|
||||||
import { ProxyAgent } from 'proxy-agent';
|
import { ProxyAgent } from 'proxy-agent';
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { describe, expect, it } from 'vitest';
|
||||||
import confirm from '../../../src/util/input/confirm';
|
import confirm from '../../../src/util/input/confirm';
|
||||||
import { client } from '../../mocks/client';
|
import { client } from '../../mocks/client';
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { describe, it, expect } from 'vitest';
|
||||||
import { join } from 'path';
|
import { join } from 'path';
|
||||||
import fs from 'fs-extra';
|
import fs from 'fs-extra';
|
||||||
import os from 'os';
|
import os from 'os';
|
||||||
@@ -14,8 +15,9 @@ import { parseRepoUrl } from '../../../../src/util/git/connect-git-provider';
|
|||||||
import { useUser } from '../../../mocks/user';
|
import { useUser } from '../../../mocks/user';
|
||||||
import { defaultProject, useProject } from '../../../mocks/project';
|
import { defaultProject, useProject } from '../../../mocks/project';
|
||||||
import type { Project } from '@vercel-internals/types';
|
import type { Project } from '@vercel-internals/types';
|
||||||
|
import { vi } from 'vitest';
|
||||||
|
|
||||||
jest.setTimeout(10 * 1000);
|
vi.setConfig({ testTimeout: 10 * 1000 });
|
||||||
|
|
||||||
const fixture = (name: string) =>
|
const fixture = (name: string) =>
|
||||||
join(__dirname, '../../../fixtures/unit/create-git-meta', name);
|
join(__dirname, '../../../fixtures/unit/create-git-meta', name);
|
||||||
|
|||||||
@@ -1,13 +1,15 @@
|
|||||||
|
import { describe, beforeEach, it, expect } from 'vitest';
|
||||||
import parseTarget from '../../../../src/util/deploy/parse-target';
|
import parseTarget from '../../../../src/util/deploy/parse-target';
|
||||||
import { Output } from '../../../../src/util/output';
|
import { Output } from '../../../../src/util/output';
|
||||||
|
import { Mock, vi } from 'vitest';
|
||||||
|
|
||||||
describe('parseTarget', () => {
|
describe('parseTarget', () => {
|
||||||
let output: Output;
|
let output: Output;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
output = new Output();
|
output = new Output();
|
||||||
output.warn = jest.fn();
|
output.warn = vi.fn();
|
||||||
output.error = jest.fn();
|
output.error = vi.fn();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('defaults to `undefined`', () => {
|
it('defaults to `undefined`', () => {
|
||||||
@@ -19,7 +21,7 @@ describe('parseTarget', () => {
|
|||||||
const result = parseTarget(output, 'not-a-real-environment');
|
const result = parseTarget(output, 'not-a-real-environment');
|
||||||
expect(result).toEqual(1);
|
expect(result).toEqual(1);
|
||||||
|
|
||||||
const errorMock = (output.error as jest.Mock<any, any>).mock;
|
const errorMock = (output.error as Mock<any, any>).mock;
|
||||||
expect(errorMock.calls[0][0]).toMatch(
|
expect(errorMock.calls[0][0]).toMatch(
|
||||||
/not-a-real-environment.+is not valid/g
|
/not-a-real-environment.+is not valid/g
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { describe, expect, it } from 'vitest';
|
||||||
import { Headers } from 'node-fetch';
|
import { Headers } from 'node-fetch';
|
||||||
import { applyOverriddenHeaders } from '../../../../src/util/dev/headers';
|
import { applyOverriddenHeaders } from '../../../../src/util/dev/headers';
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { describe, expect, it } from 'vitest';
|
||||||
import getMimeType from '../../../../src/util/dev/mime-type';
|
import getMimeType from '../../../../src/util/dev/mime-type';
|
||||||
|
|
||||||
describe('mime-type', () => {
|
describe('mime-type', () => {
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { describe, expect, it, test } from 'vitest';
|
||||||
import {
|
import {
|
||||||
parseListen,
|
parseListen,
|
||||||
replaceLocalhost,
|
replaceLocalhost,
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { describe, expect, it } from 'vitest';
|
||||||
import {
|
import {
|
||||||
parseQueryString,
|
parseQueryString,
|
||||||
formatQueryString,
|
formatQueryString,
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { describe, expect, it } from 'vitest';
|
||||||
import { devRouter } from '../../../../src/util/dev/router';
|
import { devRouter } from '../../../../src/util/dev/router';
|
||||||
|
|
||||||
describe('devRouter', () => {
|
describe('devRouter', () => {
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { describe, it, expect } from 'vitest';
|
||||||
import { validateConfig } from '../../../../src/util/validate-config';
|
import { validateConfig } from '../../../../src/util/validate-config';
|
||||||
|
|
||||||
describe('validateConfig', () => {
|
describe('validateConfig', () => {
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { afterAll, beforeAll, describe, expect, it } from 'vitest';
|
||||||
import fetch from 'node-fetch';
|
import fetch from 'node-fetch';
|
||||||
import { listen } from 'async-listen';
|
import { listen } from 'async-listen';
|
||||||
import { createServer, IncomingMessage, Server, ServerResponse } from 'http';
|
import { createServer, IncomingMessage, Server, ServerResponse } from 'http';
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { describe, expect, it } from 'vitest';
|
||||||
import { join, sep } from 'path';
|
import { join, sep } from 'path';
|
||||||
// @ts-ignore - Missing types for "alpha-sort"
|
// @ts-ignore - Missing types for "alpha-sort"
|
||||||
import { asc as alpha } from 'alpha-sort';
|
import { asc as alpha } from 'alpha-sort';
|
||||||
|
|||||||
@@ -1,12 +1,14 @@
|
|||||||
|
import { describe, it, expect, afterEach } from 'vitest';
|
||||||
import fs from 'fs-extra';
|
import fs from 'fs-extra';
|
||||||
import sleep from '../../../src/util/sleep';
|
import sleep from '../../../src/util/sleep';
|
||||||
import tmp from 'tmp-promise';
|
import tmp from 'tmp-promise';
|
||||||
import getLatestVersion from '../../../src/util/get-latest-version';
|
import getLatestVersion from '../../../src/util/get-latest-version';
|
||||||
import { join } from 'path';
|
import { join } from 'path';
|
||||||
|
import { vi } from 'vitest';
|
||||||
|
|
||||||
tmp.setGracefulCleanup();
|
tmp.setGracefulCleanup();
|
||||||
|
|
||||||
jest.setTimeout(25000);
|
vi.setConfig({ testTimeout: 25000 });
|
||||||
|
|
||||||
const cacheDir = tmp.tmpNameSync({
|
const cacheDir = tmp.tmpNameSync({
|
||||||
prefix: 'test-vercel-cli-get-latest-version-',
|
prefix: 'test-vercel-cli-get-latest-version-',
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { describe, expect, it } from 'vitest';
|
||||||
import { getPaginationOpts } from '../../../src/util/get-pagination-opts';
|
import { getPaginationOpts } from '../../../src/util/get-pagination-opts';
|
||||||
import getArgs from '../../../src/util/get-args';
|
import getArgs from '../../../src/util/get-args';
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { describe, expect, it } from 'vitest';
|
||||||
import getProjectName from '../../../src/util/get-project-name';
|
import getProjectName from '../../../src/util/get-project-name';
|
||||||
|
|
||||||
describe('getProjectName', () => {
|
describe('getProjectName', () => {
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user