Compare commits

...

15 Commits

Author SHA1 Message Date
Ethan Arrowood
114199a0b7 fix integration.test.ts 2023-03-24 13:53:52 -06:00
Ethan Arrowood
b5e3d4f166 run prettier 2023-03-24 13:45:24 -06:00
Ethan Arrowood
7ac796591f Merge branch 'main' into refactor/cli-utils 2023-03-24 13:39:40 -06:00
Ethan Arrowood
29585327e1 remove unused fixtures from packages/cli 2023-03-24 13:37:52 -06:00
Ethan Arrowood
a0917206e2 fix lint 2023-03-24 13:35:20 -06:00
Ethan Arrowood
f8d359b496 clean up 2023-03-24 13:34:01 -06:00
Ethan Arrowood
6c2c143c35 fix get-latest-version 2023-03-24 13:26:40 -06:00
Ethan Arrowood
de7e07a90b tests working except for one 2023-03-24 13:21:59 -06:00
Ethan Arrowood
9a672d3b31 Merge remote-tracking branch 'origin/main' into refactor/cli-utils 2023-03-24 13:03:44 -06:00
Ethan Arrowood
17627eee30 refactor cli util tests 2023-03-23 14:42:37 -06:00
Ethan Arrowood
cd6f7a0e6f temp commit of refactoring test files 2023-03-20 13:55:12 -06:00
Ethan Arrowood
07f37454c0 update deps. cli is building! 2023-03-10 14:59:58 -07:00
Ethan Arrowood
2df1ae5fe6 try to get cli to build 2023-03-10 14:41:58 -07:00
Ethan Arrowood
0b7b500eb7 Merge branch 'main' of github.com:vercel/vercel into refactor/cli-utils 2023-03-10 13:08:02 -07:00
Ethan Arrowood
11cc079b69 refactor all cli/src/util files and fix imports 2023-03-10 11:47:21 -07:00
549 changed files with 3084 additions and 1096 deletions

4
.gitignore vendored
View File

@@ -9,8 +9,8 @@ coverage.lcov
*.swp
*.bak
*.tgz
packages/cli/src/util/dev/templates/*.ts
packages/cli/src/util/constants.ts
internals/utils/src/dev/templates/*.ts
internals/utils/src/constants.ts
packages/cli/test/**/yarn.lock
!packages/cli/test/dev/**/yarn.lock
packages/cli/test/**/node_modules

View File

@@ -5,8 +5,11 @@
"allowJs": true,
"moduleResolution": "node",
"module": "commonjs",
"target": "ES2020",
"lib": ["ES2020"],
"resolveJsonModule": true,
"sourceMap": true
"sourceMap": true,
// style-guide enables this but our repo doesn't and it causes type issues
"noUncheckedIndexedAccess": false
}
}

View File

@@ -1,4 +1,4 @@
import type { BuilderFunctions } from '@vercel/build-utils';
import type { BuilderFunctions, Builder } from '@vercel/build-utils';
import type { Readable, Writable } from 'stream';
import type { Route } from '@vercel/routing-utils';
@@ -584,3 +584,21 @@ export interface Stdio {
stdout: WritableTTY;
stderr: WritableTTY;
}
export interface SerializedBuilder extends Builder {
error?: any;
require?: string;
requirePath?: string;
apiVersion: number;
}
/**
* Contents of the `builds.json` file.
*/
export interface BuildsManifest {
'//': string;
target: string;
argv: string[];
error?: any;
builds?: SerializedBuilder[];
}

View File

@@ -1,17 +1,134 @@
{
"private": true,
"name": "@vercel-internals/utils",
"types": "dist/index.d.ts",
"main": "dist/index.js",
"types": "dist/internals/utils/src/index.d.ts",
"main": "dist/internals/utils/src/index.js",
"files": [
"dist"
],
"scripts": {
"build": "tsc -p tsconfig.json"
"compile-templates": "node scripts/compile-templates.js",
"generate-constants": "ts-node scripts/generate-constants.ts",
"build": "pnpm generate-constants && pnpm compile-templates && tsc -p tsconfig.json",
"test": "jest --env node --verbose --bail tests"
},
"dependencies": {
"@sentry/node": "5.5.0",
"@sindresorhus/slugify": "0.11.0",
"@tootallnate/once": "1.1.2",
"@vercel-internals/types": "*",
"@vercel/build-utils": "*",
"@vercel/client": "*",
"@vercel/error-utils": "*",
"@vercel/frameworks": "*",
"@vercel/fs-detectors": "*",
"@vercel/fun": "1.0.4",
"@vercel/routing-utils": "*",
"ajv": "6.12.2",
"ansi-escapes": "4.3.2",
"arg": "5.0.0",
"async-listen": "1.2.0",
"async-retry": "1.1.3",
"bytes": "3.0.0",
"chalk": "4.1.0",
"chokidar": "3.3.1",
"date-fns": "1.29.0",
"dotenv": "4.0.0",
"escape-html": "1.0.3",
"fast-deep-equal": "3.1.3",
"fs-extra": "10.0.0",
"get-port": "5.1.1",
"git-last-commit": "1.0.1",
"http-proxy": "1.18.1",
"ini": "3.0.0",
"inquirer": "7.0.4",
"is-docker": "2.2.1",
"is-port-reachable": "3.1.0",
"jsonlines": "0.1.1",
"load-json-file": "3.0.0",
"mime-types": "2.1.24",
"minimatch": "3.0.4",
"ms": "2.1.2",
"node-fetch": "2.6.7",
"npm-package-arg": "6.1.0",
"open": "8.4.0",
"ora": "3.4.0",
"pcre-to-regexp": "1.0.0",
"pluralize": "7.0.0",
"promisepipe": "3.0.0",
"psl": "1.1.31",
"raw-body": "2.4.1",
"semver": "5.5.0",
"serve-handler": "6.1.1",
"strip-ansi": "6.0.1",
"supports-hyperlinks": "2.2.0",
"text-table": "0.2.0",
"title": "3.4.1",
"tree-kill": "1.2.2",
"universal-analytics": "0.4.20",
"write-json-file": "2.2.0",
"xdg-app-paths": "5.1.0",
"yauzl-promise": "2.1.3"
},
"devDependencies": {
"@types/async-retry": "1.2.1",
"@types/bytes": "3.0.0",
"@types/chance": "1.1.3",
"@types/dotenv": "6.1.1",
"@types/escape-html": "0.0.20",
"@types/express": "4.17.13",
"@types/fs-extra": "9.0.13",
"@types/http-proxy": "1.16.2",
"@types/ini": "1.3.31",
"@types/inquirer": "7.3.1",
"@types/jest": "27.4.1",
"@types/jsonlines": "0.1.2",
"@types/load-json-file": "2.0.7",
"@types/mime-types": "2.1.0",
"@types/minimatch": "3.0.3",
"@types/ms": "0.7.30",
"@types/node": "14.18.33",
"@types/node-fetch": "2.5.10",
"@types/npm-package-arg": "6.1.0",
"@types/pluralize": "0.0.29",
"@types/psl": "1.1.0",
"@types/semver": "6.0.1",
"@types/serve-handler": "6.1.1",
"@types/text-table": "0.2.0",
"@types/title": "3.4.1",
"@types/universal-analytics": "0.4.2",
"@types/write-json-file": "2.2.1",
"@types/yauzl-promise": "2.1.0",
"@vercel-internals/tsconfig": "*",
"@vercel/next": "*",
"@vercel/node": "*",
"@vercel/style-guide": "4.0.2",
"chance": "1.1.7",
"execa": "3.2.0",
"expect": "29.5.0",
"express": "4.17.1",
"find-up": "4.1.0",
"jest-matcher-utils": "29.3.1",
"line-async-iterator": "3.0.0",
"tmp-promise": "1.0.3",
"ts-node": "10.9.1",
"typescript": "4.9.4"
},
"jest": {
"preset": "ts-jest",
"globals": {
"ts-jest": {
"diagnostics": false,
"isolatedModules": true
}
},
"setupFilesAfterEnv": [
"@alex_neo/jest-expect-message"
],
"verbose": false,
"testEnvironment": "node",
"testMatch": [
"<rootDir>/tests/**/*.test.ts"
]
}
}

View File

@@ -6,7 +6,7 @@ async function main() {
const dirRoot = join(__dirname, '..');
// Compile the `doT.js` template files for `vercel dev`
const templatesDir = join(dirRoot, 'src/util/dev/templates');
const templatesDir = join(dirRoot, 'src/dev/templates');
const dotPacker = join(dirRoot, '../../node_modules/dot/bin/dot-packer');
await execa(process.execPath, [dotPacker], {
cwd: templatesDir,

View File

@@ -0,0 +1,23 @@
import { join } from 'path';
import { writeFileSync } from 'fs';
const dirRoot = join(__dirname, '..');
function envToString(key: string) {
const value = process.env[key];
if (!value) {
console.log(`- Constant ${key} is not assigned`);
}
return JSON.stringify(value);
}
console.log('Creating constants.ts');
const filename = join(dirRoot, 'src/constants.ts');
const contents = `// This file is auto-generated
export const GA_TRACKING_ID: string | undefined = ${envToString(
'GA_TRACKING_ID'
)};
export const SENTRY_DSN: string | undefined = ${envToString('SENTRY_DSN')};
`;
writeFileSync(filename, contents, 'utf8');

View File

@@ -0,0 +1,4 @@
{
"extends": "../tsconfig.json",
"include": ["./**/*"]
}

View File

@@ -2,7 +2,7 @@ import { homedir } from 'os';
import fs from 'fs';
import path from 'path';
import XDGAppPaths from 'xdg-app-paths';
import getArgs from '../../util/get-args';
import getArgs from '../get-args';
// Returns whether a directory exists
export const isDirectory = (path: string): boolean => {

View File

@@ -2,7 +2,7 @@ import path from 'path';
import { existsSync } from 'fs';
import { InvalidLocalConfig } from '../errors';
import { ConflictingConfigFiles } from '../errors-ts';
import getArgs from '../../util/get-args';
import getArgs from '../get-args';
export default function getLocalPathConfig(prefix: string) {
let customPath: string | undefined;

View File

@@ -1,5 +1,5 @@
import stripeFactory from 'stripe';
import Now from '.';
import Now from './now';
const stripe = stripeFactory('pk_live_alyEi3lN0kSwbdevK0nrGwTw');

View File

@@ -4,7 +4,7 @@ import * as ERRORS from '../errors';
import { NowError } from '../now-error';
import mapCertError from '../certs/map-cert-error';
import { Org } from '@vercel-internals/types';
import Now, { CreateOptions } from '..';
import Now, { CreateOptions } from '../now';
import Client from '../client';
import { ArchiveFormat, DeploymentError } from '@vercel/client';

View File

@@ -1,6 +1,6 @@
import fs from 'fs-extra';
import { join } from 'path';
import { BuildsManifest } from '../../commands/build';
import { BuildsManifest } from '@vercel-internals/types';
export default async function getPrebuiltJson(
directory: string

View File

@@ -1,6 +1,6 @@
import { Output } from '../../util/output';
import param from '../../util/output/param';
import code from '../../util/output/code';
import { Output } from '../output';
import param from '../output/param';
import code from '../output/code';
/**
* Parses the environment target from the `--target` and `--prod` flags.

View File

@@ -8,7 +8,7 @@ import {
} from '@vercel/client';
import { Output } from '../output';
import { progress } from '../output/progress';
import Now from '../../util';
import Now from '../now';
import { Org } from '@vercel-internals/types';
import ua from '../ua';
import { linkFolderToProject } from '../projects/link';

Some files were not shown because too many files have changed in this diff Show More