Compare commits

..

3 Commits

Author SHA1 Message Date
chloetedder
59f51a1bb6 Update 2023-02-14 14:41:04 -07:00
chloetedder
494164a3a4 test 2023-02-14 14:18:11 -07:00
chloetedder
b45052adda Change tests 2023-02-14 13:27:47 -07:00
602 changed files with 58884 additions and 100193 deletions

View File

@@ -1,10 +0,0 @@
body:
- type: markdown
attributes:
value: |
> **Note**: For discussions not related to Vercel CLI or Runtimes, please visit the [Vercel Community](https://github.com/orgs/vercel/discussions)
- type: textarea
attributes:
label: Description
validations:
required: true

View File

@@ -1,10 +0,0 @@
body:
- type: markdown
attributes:
value: |
> **Note**: For discussions not related to Vercel CLI or Runtimes, please visit the [Vercel Community](https://github.com/orgs/vercel/discussions/categories/help)
- type: textarea
attributes:
label: Problem Description
validations:
required: true

View File

@@ -1,10 +0,0 @@
body:
- type: markdown
attributes:
value: |
> **Note**: For discussions not related to Vercel CLI or Runtimes, please visit the [Vercel Community](https://github.com/orgs/vercel/discussions/categories/ideas)
- type: textarea
attributes:
label: Idea
validations:
required: true

View File

@@ -1,10 +0,0 @@
body:
- type: markdown
attributes:
value: |
> **Note**: For discussions not related to Vercel CLI or Runtimes, please visit the [Vercel Community](https://github.com/orgs/vercel/discussions)
- type: textarea
attributes:
label: Description
validations:
required: true

View File

@@ -1,10 +0,0 @@
body:
- type: markdown
attributes:
value: |
> **Note**: For discussions not related to Vercel CLI or Runtimes, please visit the [Vercel Community](https://github.com/orgs/vercel/discussions)
- type: textarea
attributes:
label: Description
validations:
required: true

View File

@@ -1,5 +0,0 @@
body:
- type: markdown
attributes:
value: |
> **Note**: This category should not be used for new discussions. Please visit the [Vercel Community](https://github.com/orgs/vercel/discussions)

View File

@@ -4,8 +4,8 @@ contact_links:
url: https://vercel.com/support/request
about: Report a bug using the Vercel support form
- name: Feature Request
url: https://github.com/orgs/vercel/discussions/new?category=ideas
url: https://github.com/vercel/vercel/discussions/new?category=ideas
about: Share ideas for new features
- name: Ask a Question
url: https://github.com/orgs/vercel/discussions/new?category=help
url: https://github.com/vercel/vercel/discussions/new?category=help
about: Ask the community for help

View File

@@ -1,31 +0,0 @@
name: Cron Update Gatsby Fixtures
on:
# Allow manual runs
workflow_dispatch:
# Run once a week https://crontab.guru/once-a-week
schedule:
- cron: '0 0 * * 0'
jobs:
create-pull-request:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
# 0 means fetch all commits so we can commit and push in the script below
with:
fetch-depth: 0
- name: Enable corepack
run: corepack enable pnpm
- name: Create Pull Request
uses: actions/github-script@v6
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GH_TOKEN_PULL_REQUESTS }}
# See https://github.com/actions/github-script#run-a-separate-file-with-an-async-function
with:
github-token: ${{ secrets.GH_TOKEN_PULL_REQUESTS }}
script: |
const script = require('./utils/update-gatsby-fixtures.js')
await script({ github, context })

View File

@@ -16,16 +16,12 @@ jobs:
# 0 means fetch all commits so we can commit and push in the script below
with:
fetch-depth: 0
- name: Enable corepack
run: corepack enable pnpm
- name: Create Pull Request
uses: actions/github-script@v6
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GH_TOKEN_PULL_REQUESTS }}
# See https://github.com/actions/github-script#run-a-separate-file-with-an-async-function
with:
github-token: ${{ secrets.GH_TOKEN_PULL_REQUESTS }}
script: |
const script = require('./utils/update-next.js')
await script({ github, context })

View File

@@ -16,16 +16,14 @@ jobs:
# 0 means fetch all commits so we can commit and push in the script below
with:
fetch-depth: 0
- name: Enable corepack
run: corepack enable pnpm
- name: install pnpm@7.26.0
run: npm i -g pnpm@7.26.0
- name: Create Pull Request
uses: actions/github-script@v6
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GH_TOKEN_PULL_REQUESTS }}
# See https://github.com/actions/github-script#run-a-separate-file-with-an-async-function
with:
github-token: ${{ secrets.GH_TOKEN_PULL_REQUESTS }}
script: |
const script = require('./utils/update-turbo.js')
await script({ github, context })

View File

@@ -16,7 +16,7 @@ jobs:
issue-number: ${{ github.event.issue.number }}
body: |
Thank you for taking the time to created this request!
We added it to our backlog but need to discuss design/architecture before we can accept a PR.
Please let us know if you would be interested in sending a PR once we approve the design.

View File

@@ -16,9 +16,9 @@ jobs:
issue-number: ${{ github.event.issue.number }}
comment: |
Thank you so much for filing this issue.
We do try to keep issues in this repository focused on the vercel command line and related code.
At this point we think that this issue is best handled by our friendly Vercel support team. They can be found by contacting them at: https://vercel.com/help#issues
If you think closing of this is a mistake, then please re-open this issue and we'll take another look :bow:

View File

@@ -16,9 +16,9 @@ jobs:
issue-number: ${{ github.event.issue.number }}
body: |
Thank you for taking the time to file this issue!
We have confirmed this is a bug and added it to our backlog.
We don't have a timeline for when this issue will be fixed, but we will accept a Pull Request with a fix and a test.
See the [contributing guidelines](https://github.com/vercel/vercel/blob/main/.github/CONTRIBUTING.md) for more info.

View File

@@ -3,9 +3,9 @@ name: Publish
on:
push:
branches:
- main
- main
tags:
- '!*'
- '!*'
env:
TURBO_REMOTE_ONLY: 'true'
@@ -16,51 +16,46 @@ jobs:
publish:
name: Publish
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Check Release
id: check-release
run: |
tag="$(git describe --tags --exact-match 2> /dev/null || :)"
if [[ -z "$tag" ]];
then
echo "IS_RELEASE=false" >> $GITHUB_OUTPUT
else
echo "IS_RELEASE=true" >> $GITHUB_OUTPUT
fi
- name: Setup Go
if: ${{ steps.check-release.outputs.IS_RELEASE == 'true' }}
uses: actions/setup-go@v3
with:
go-version: '1.13.15'
- name: Setup Node
if: ${{ steps.check-release.outputs.IS_RELEASE == 'true' }}
uses: actions/setup-node@v3
with:
node-version: 16
- name: install npm@9
run: npm i -g npm@9
- name: install pnpm@7.24.2
run: npm i -g pnpm@7.24.2
- name: Install
if: ${{ steps.check-release.outputs.IS_RELEASE == 'true' }}
run: pnpm install
- name: Build
if: ${{ steps.check-release.outputs.IS_RELEASE == 'true' }}
run: pnpm build
env:
GA_TRACKING_ID: ${{ secrets.GA_TRACKING_ID }}
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
- name: Publish
if: ${{ steps.check-release.outputs.IS_RELEASE == 'true' }}
run: pnpm publish-from-github
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN_ELEVATED }}
GA_TRACKING_ID: ${{ secrets.GA_TRACKING_ID }}
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Check Release
id: check-release
run: |
tag="$(git describe --tags --exact-match 2> /dev/null || :)"
if [[ -z "$tag" ]];
then
echo "IS_RELEASE=false" >> $GITHUB_OUTPUT
else
echo "IS_RELEASE=true" >> $GITHUB_OUTPUT
fi
- name: Setup Go
if: ${{ steps.check-release.outputs.IS_RELEASE == 'true' }}
uses: actions/setup-go@v3
with:
go-version: '1.13.15'
- name: Setup Node
if: ${{ steps.check-release.outputs.IS_RELEASE == 'true' }}
uses: actions/setup-node@v3
with:
node-version: 16
- name: install pnpm@7.24.2
run: npm i -g pnpm@7.24.2
- name: Install
if: ${{ steps.check-release.outputs.IS_RELEASE == 'true' }}
run: pnpm install
- name: Build
if: ${{ steps.check-release.outputs.IS_RELEASE == 'true' }}
run: pnpm build
env:
GA_TRACKING_ID: ${{ secrets.GA_TRACKING_ID }}
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
- name: Publish
if: ${{ steps.check-release.outputs.IS_RELEASE == 'true' }}
run: pnpm publish-from-github
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN_ELEVATED }}
GA_TRACKING_ID: ${{ secrets.GA_TRACKING_ID }}
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}

View File

@@ -3,9 +3,9 @@ name: CLI
on:
push:
branches:
- main
- main
tags:
- '!*'
- '!*'
pull_request:
env:
@@ -31,6 +31,9 @@ jobs:
- uses: actions/checkout@v3
with:
fetch-depth: 2
- uses: actions/setup-go@v3
with:
go-version: '1.18'
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}

View File

@@ -1,35 +0,0 @@
name: Lint
on:
push:
branches:
- main
tags:
- '!*'
pull_request:
env:
TURBO_REMOTE_ONLY: 'true'
TURBO_TEAM: 'vercel'
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
NODE_VERSION: '16'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
jobs:
test:
name: Lint
timeout-minutes: 10
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
- name: install pnpm@7.24.2
run: npm i -g pnpm@7.24.2
- run: pnpm install
- run: pnpm run lint
- run: pnpm run prettier-check

50
.github/workflows/test-unit.yml vendored Normal file
View File

@@ -0,0 +1,50 @@
name: Unit
on:
push:
branches:
- main
tags:
- '!*'
pull_request:
env:
TURBO_REMOTE_ONLY: 'true'
TURBO_TEAM: 'vercel'
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
jobs:
test:
name: Unit
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
node: [16]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/setup-go@v3
with:
go-version: '1.13.15'
- uses: actions/checkout@v3
with:
fetch-depth: 2
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
- name: install pnpm@7.24.2
run: npm i -g pnpm@7.24.2
- run: pnpm install
- run: pnpm run build
- run: pnpm run lint
if: matrix.os == 'ubuntu-latest' && matrix.node == 14 # only run lint once
- run: pnpm run test-unit
- run: pnpm -C packages/cli run coverage
if: matrix.os == 'ubuntu-latest' && matrix.node == 14 # only run coverage once
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

View File

@@ -3,9 +3,9 @@ name: Tests
on:
push:
branches:
- main
- main
tags:
- '!*'
- '!*'
pull_request:
env:
@@ -29,6 +29,9 @@ jobs:
- uses: actions/checkout@v3
with:
fetch-depth: 2
- uses: actions/setup-go@v3
with:
go-version: '1.13.15'
- uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
@@ -63,6 +66,9 @@ jobs:
- uses: actions/checkout@v3
with:
fetch-depth: 2
- uses: actions/setup-go@v3
with:
go-version: '1.13.15'
- uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}

View File

@@ -1,28 +0,0 @@
name: Update @remix-run/dev
on:
workflow_dispatch:
inputs:
new-version:
type: string
description: 'Optional version to update @remix-run/dev to inside of @vercel/remix-builder'
jobs:
update-remix-run-dev:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup node
uses: actions/setup-node@v3
- name: Enable corepack
run: corepack enable pnpm
- name: Update @remix-run/dev
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GH_TOKEN_PULL_REQUESTS }}
script: |
const script = require('./utils/update-remix-run-dev.js')
await script({ github, context }, "${{ inputs.new-version }}")

1
.npmrc
View File

@@ -1,4 +1,3 @@
provenance=true
save-exact=true
hoist-pattern[]=!"**/@types/**"
hoist-pattern[]=!"**/typedoc"

View File

@@ -7,28 +7,3 @@ examples/sveltekit-1
# gatsby-plugin-vercel-analytics
packages/gatsby-plugin-vercel-analytics
# ignore directories that are not source code
node_modules
dist
pnpm-lock.yaml
.vscode
.DS_Store
.next
.vercel
.turbo
.eslintcache
.output
.vercel_build_output
.vercel
coverage
turbo-cache-key.json
/examples
/public
packages/*/dist
packages/*/node_modules
packages/**/test/fixtures
packages/**/test/dev/fixtures
packages/**/test/build-fixtures
packages/**/test/cache-fixtures

View File

@@ -79,23 +79,18 @@ project. An example use-case is that `@vercel/node` uses this function to cache
the `node_modules` directory, making it faster to install npm dependencies for
future builds.
> Note: Only files within the repo root directory can be cached.
**Example:**
```typescript
import { relative } from 'path';
import { glob, PrepareCache } from '@vercel/build-utils';
import { PrepareCacheOptions } from '@vercel/build-utils';
export const prepareCache: PrepareCache = async ({
workPath,
repoRootPath,
}) => {
export async function prepareCache(options: PrepareCacheOptions) {
// Create a mapping of file names and `File` object instances to cache here…
const rootDirectory = relative(repoRootPath, workPath);
const cache = await glob(`${rootDirectory}/some/dir/**`, repoRootPath);
return cache;
};
return {
'path-to-file': File,
};
}
```
### `shouldServe()`

View File

@@ -51,11 +51,8 @@ export async function getGitHubRepoInfo(repo: Repo) {
data.subdir = repo.path.slice(subdirPath.length).split('/');
}
if (
data.id === 'vercel/vercel' &&
data.subdir &&
data.subdir[0] === 'examples'
) {
if (data.id === 'vercel/vercel' && data.subdir && data.subdir[0] === 'examples') {
// from our examples, add `homepage` and `description` fields
const example = data.subdir[1];
const exampleList = await getExampleList();

View File

@@ -33,12 +33,7 @@ async function main() {
});
const existingExamples = exampleDirs
.filter(
dir =>
dir.isDirectory() &&
dir.name !== 'node_modules' &&
dir.name !== '__tests__'
)
.filter(dir => dir.isDirectory())
.map(dir => ({
name: dir.name,
visible: true,

10
codecov.yml Normal file
View File

@@ -0,0 +1,10 @@
codecov:
require_ci_to_pass: yes
coverage:
status:
project: off
patch: off
fixes:
- "::packages/cli/" # move root e.g., "path/" => "after/path/"

View File

@@ -14,9 +14,7 @@ In order to create the smallest possible lambdas Next.js has to be configured to
npm install next --save
```
2. Check [Node.js Version](https://vercel.link/node-version) in your Project Settings. Using an old or incompatible version of Node.js can cause the Build Step to fail with this error message.
3. Add the `now-build` script to your `package.json` [deprecated]
2. Add the `now-build` script to your `package.json`
```json
{
@@ -26,7 +24,7 @@ npm install next --save
}
```
4. Add `target: 'serverless'` to `next.config.js` [deprecated]
3. Add `target: 'serverless'` to `next.config.js` [deprecated]
```js
module.exports = {
@@ -35,9 +33,9 @@ module.exports = {
};
```
5. Remove `distDir` from `next.config.js` as `@vercel/next` can't parse this file and expects your build output at `/.next`
4. Remove `distDir` from `next.config.js` as `@vercel/next` can't parse this file and expects your build output at `/.next`
6. Optionally make sure the `"src"` in `"builds"` points to your application `package.json`
5. Optionally make sure the `"src"` in `"builds"` points to your application `package.json`
```js
{

View File

@@ -2,15 +2,15 @@
#### Why This Error Occurred
This error is often caused by a misconfigured "Build Command" or "Output Directory" for your Next.js project.
This could be caused by a misconfigured "Build Command" or "Output Directory" for your Next.js project.
#### Possible Ways to Fix It
In the Vercel dashboard, open your "Project Settings" and draw attention to "Build & Development Settings":
1. Ensure that the "Build Command" setting is not overridden, or that it calls `next build`. If this command is not overridden but you are seeing this error, double check that your `build` script in `package.json` calls `next build`. If `buildCommand` exists in `vercel.json`, make sure it calls `next build`.
2. Ensure that the "Output Directory" setting is not overridden. This value almost never needs to be configured, and is only necessary if you override `distDir` in `next.config.js`. If `outputDirectory` exists in `vercel.json`, remove that property.
3. For `next export` users: **do not override the "Output Directory"**, even if you customized the `next export` output directory. It will automatically detects the correct output.
1. Ensure that the "Build Command" setting is not changed, or that it calls `next build`. If this command is not changed but you are seeing this error, double check that your `build` script in `package.json` calls `next build`.
2. Ensure that the "Output Directory" setting is not changed. This value almost never needs to be configured, and is only necessary if you override `distDir` in `next.config.js`.
3. For `next export` users: **do not override the "Output Directory"**. Next.js automatically detects what folder you outputted `next export` to.
In rare scenarios, this error message can also be caused by a Next.js build failure (if your "Build Command" accidentally returns an exit code that is not 0).
Double check for any error messages above the Routes Manifest error, which may provide additional details.

View File

@@ -38,9 +38,9 @@ All commands are run from the root of the project, from a terminal:
| Command | Action |
| :--------------------- | :------------------------------------------------- |
| `pnpm install` | Installs dependencies |
| `pnpm run dev` | Starts local dev server at `localhost:3000` |
| `pnpm run build` | Build your production site to `./dist/` |
| `pnpm run preview` | Preview your build locally, before deploying |
| `pnpm run astro ...` | Run CLI commands like `astro add`, `astro preview` |
| `pnpm run astro --help` | Get help using the Astro CLI |
| `npm install` | Installs dependencies |
| `npm run dev` | Starts local dev server at `localhost:3000` |
| `npm run build` | Build your production site to `./dist/` |
| `npm run preview` | Preview your build locally, before deploying |
| `npm run astro ...` | Run CLI commands like `astro add`, `astro preview` |
| `npm run astro --help` | Get help using the Astro CLI |

View File

@@ -1,5 +1,6 @@
{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@/*": ["./*"]
}

File diff suppressed because it is too large Load Diff

View File

@@ -9,9 +9,10 @@
"lint": "next lint"
},
"dependencies": {
"eslint": "8.35.0",
"eslint-config-next": "13.2.4",
"next": "13.2.4",
"@next/font": "13.1.6",
"eslint": "8.32.0",
"eslint-config-next": "13.1.6",
"next": "13.1.6",
"react": "18.2.0",
"react-dom": "18.2.0"
}

View File

@@ -1,6 +1,6 @@
import Head from 'next/head'
import Image from 'next/image'
import { Inter } from 'next/font/google'
import { Inter } from '@next/font/google'
import styles from '@/styles/Home.module.css'
const inter = Inter({ subsets: ['latin'] })

View File

@@ -13,10 +13,10 @@ function hydrate() {
});
}
if (typeof requestIdleCallback === "function") {
requestIdleCallback(hydrate);
if (window.requestIdleCallback) {
window.requestIdleCallback(hydrate);
} else {
// Safari doesn't support requestIdleCallback
// https://caniuse.com/requestidlecallback
setTimeout(hydrate, 1);
window.setTimeout(hydrate, 1);
}

View File

@@ -1,18 +1,21 @@
import handleRequest from "@vercel/remix-entry-server";
import type { EntryContext } from "@remix-run/node";
import { RemixServer } from "@remix-run/react";
import type { EntryContext } from "@remix-run/server-runtime";
import { renderToString } from "react-dom/server";
export default function (
export default function handleRequest(
request: Request,
responseStatusCode: number,
responseHeaders: Headers,
remixContext: EntryContext
) {
const remixServer = <RemixServer context={remixContext} url={request.url} />;
return handleRequest(
request,
responseStatusCode,
responseHeaders,
remixServer
const markup = renderToString(
<RemixServer context={remixContext} url={request.url} />
);
responseHeaders.set("Content-Type", "text/html");
return new Response("<!DOCTYPE html>" + markup, {
headers: responseHeaders,
status: responseStatusCode,
});
}

View File

@@ -7,7 +7,7 @@ import {
Scripts,
ScrollRestoration,
} from "@remix-run/react";
import { Analytics } from "@vercel/analytics/react";
import { Analytics } from '@vercel/analytics/react';
export const meta: MetaFunction = () => ({
charset: "utf-8",

View File

@@ -1,9 +0,0 @@
export const config = { runtime: "edge" };
export default function Edge() {
return (
<div style={{ fontFamily: "system-ui, sans-serif", lineHeight: "1.4" }}>
<h1>Welcome to Remix@Edge</h1>
</div>
);
}

View File

@@ -6,20 +6,20 @@
"dev": "remix dev"
},
"dependencies": {
"@remix-run/node": "^1.13.0",
"@remix-run/react": "^1.13.0",
"@remix-run/serve": "^1.13.0",
"@remix-run/server-runtime": "^1.13.0",
"@vercel/analytics": "^0.1.10",
"@vercel/remix-entry-server": "^0.1.0",
"@remix-run/node": "^1.7.6",
"@remix-run/react": "^1.7.6",
"@remix-run/vercel": "^1.7.6",
"@vercel/analytics": "^0.1.5",
"@vercel/node": "^2.7.0",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"devDependencies": {
"@remix-run/dev": "^1.13.0",
"@remix-run/eslint-config": "^1.13.0",
"@remix-run/dev": "^1.7.6",
"@remix-run/eslint-config": "^1.7.6",
"@remix-run/serve": "^1.7.6",
"@types/react": "^18.0.25",
"@types/react-dom": "^18.0.11",
"@types/react-dom": "^18.0.9",
"eslint": "^8.28.0",
"typescript": "^4.9.3"
},

File diff suppressed because it is too large Load Diff

View File

@@ -1,10 +1,13 @@
/**
* @type {import('@remix-run/dev').AppConfig}
*/
/** @type {import('@remix-run/dev').AppConfig} */
module.exports = {
ignoredRouteFiles: ['**/.*'],
serverBuildTarget: "vercel",
// When running locally in development mode, we use the built in remix
// server. This does not understand the vercel lambda module format,
// so we default back to the standard build output.
server: process.env.NODE_ENV === "development" ? undefined : "./server.js",
ignoredRouteFiles: ["**/.*"],
// appDirectory: "app",
// assetsBuildDirectory: "public/build",
// serverBuildPath: "build/index.js",
// serverBuildPath: "api/index.js",
// publicPath: "/build/",
};

View File

@@ -1,11 +0,0 @@
{
"private": true,
"name": "@vercel-internals/tsconfig",
"description": "Node.js tsconfig file based on `@vercel/style-guide`",
"files": [
"tsconfig.json"
],
"devDependencies": {
"@vercel/style-guide": "4.0.2"
}
}

View File

@@ -1,12 +0,0 @@
{
"extends": "@vercel/style-guide/typescript",
"compilerOptions": {
"declaration": true,
"allowJs": true,
"moduleResolution": "node",
"module": "commonjs",
"lib": ["ES2020"],
"resolveJsonModule": true,
"sourceMap": true
}
}

View File

@@ -1,21 +0,0 @@
{
"private": true,
"name": "@vercel-internals/types",
"types": "dist/index.d.ts",
"main": "dist/index.js",
"files": [
"dist"
],
"scripts": {
"build": "tsc -p tsconfig.json"
},
"dependencies": {
"@vercel/build-utils": "6.3.2",
"@vercel/routing-utils": "2.1.10"
},
"devDependencies": {
"@vercel-internals/tsconfig": "*",
"@vercel/style-guide": "4.0.2",
"typescript": "4.9.4"
}
}

View File

@@ -1,7 +0,0 @@
{
"extends": "@vercel-internals/tsconfig",
"compilerOptions": {
"outDir": "./dist"
},
"include": ["index.ts"]
}

View File

@@ -1,17 +0,0 @@
{
"private": true,
"name": "@vercel-internals/utils",
"types": "dist/index.d.ts",
"main": "dist/index.js",
"files": [
"dist"
],
"scripts": {
"build": "tsc -p tsconfig.json"
},
"devDependencies": {
"@vercel-internals/tsconfig": "*",
"@vercel/style-guide": "4.0.2",
"typescript": "4.9.4"
}
}

View File

@@ -1,7 +0,0 @@
{
"extends": "@vercel-internals/tsconfig",
"compilerOptions": {
"outDir": "dist"
},
"include": ["src/**/*"]
}

View File

@@ -32,7 +32,7 @@
"source-map-support": "0.5.12",
"ts-eager": "2.0.2",
"ts-jest": "28.0.5",
"turbo": "1.8.3"
"turbo": "1.7.4"
},
"scripts": {
"lerna": "lerna",
@@ -51,7 +51,6 @@
"test-e2e": "node utils/gen.js && turbo run test-e2e",
"test-dev": "node utils/gen.js && turbo run test-dev",
"lint": "eslint . --cache --ext .ts,.js",
"prettier-check": "prettier --check .",
"prepare": "husky install",
"pack": "cd utils && node -r ts-eager/register ./pack.ts"
},

View File

@@ -1,6 +1,6 @@
{
"name": "@vercel/build-utils",
"version": "6.4.0",
"version": "6.2.2",
"license": "MIT",
"main": "./dist/index.js",
"types": "./dist/index.d.js",

View File

@@ -1,4 +1,4 @@
import type { Files, FunctionFramework } from './types';
import type { Cron, Files } from './types';
/**
* An Edge Functions output
@@ -41,8 +41,8 @@ export class EdgeFunction {
/** The regions where the edge function will be executed on */
regions?: string | string[];
/** The framework */
framework?: FunctionFramework;
/** Cronjob definition for the edge function */
cron?: Cron;
constructor(params: Omit<EdgeFunction, 'type'>) {
this.type = 'EdgeFunction';
@@ -53,6 +53,6 @@ export class EdgeFunction {
this.envVarsInUse = params.envVarsInUse;
this.assets = params.assets;
this.regions = params.regions;
this.framework = params.framework;
this.cron = params.cron;
}
}

View File

@@ -25,16 +25,12 @@ export async function readConfigFile<T>(
if (data) {
const str = data.toString('utf8');
try {
if (name.endsWith('.json')) {
return JSON.parse(str) as T;
} else if (name.endsWith('.toml')) {
return toml.parse(str) as unknown as T;
} else if (name.endsWith('.yaml') || name.endsWith('.yml')) {
return yaml.safeLoad(str, { filename: name }) as T;
}
} catch (error: unknown) {
console.log(`Error while parsing config file: "${name}"`);
if (name.endsWith('.json')) {
return JSON.parse(str) as T;
} else if (name.endsWith('.toml')) {
return (toml.parse(str) as unknown) as T;
} else if (name.endsWith('.yaml') || name.endsWith('.yml')) {
return yaml.safeLoad(str, { filename: name }) as T;
}
}
}

View File

@@ -1,79 +0,0 @@
// Source: https://github.com/pnpm/pnpm/blob/b38d711f3892a473e20e69dd32ca7e1b439efaec/fs/hard-link-dir/src/index.ts#L4
// LICENSE (MIT): https://github.com/pnpm/pnpm/blob/b38d711f3892a473e20e69dd32ca7e1b439efaec/LICENSE
import path from 'path';
import { promises as fs } from 'fs';
export async function hardLinkDir(src: string, destDirs: string[]) {
if (destDirs.length === 0) return;
// Don't try to hard link the source directory to itself
destDirs = destDirs.filter(destDir => path.relative(destDir, src) !== '');
const files = await fs.readdir(src);
await Promise.all(
files.map(async file => {
if (file === 'node_modules') return;
const srcFile = path.join(src, file);
if ((await fs.lstat(srcFile)).isDirectory()) {
const destSubdirs = await Promise.all(
destDirs.map(async destDir => {
const destSubdir = path.join(destDir, file);
try {
await fs.mkdir(destSubdir, { recursive: true });
} catch (err: any) {
// eslint-disable-line
if (err.code !== 'EEXIST') throw err;
}
return destSubdir;
})
);
await hardLinkDir(srcFile, destSubdirs);
return;
}
await Promise.all(
destDirs.map(async destDir => {
const destFile = path.join(destDir, file);
try {
await linkOrCopyFile(srcFile, destFile);
} catch (err: any) {
// eslint-disable-line
if (err.code === 'ENOENT') {
// Ignore broken symlinks
return;
}
throw err;
}
})
);
})
);
}
async function linkOrCopyFile(srcFile: string, destFile: string) {
try {
await linkOrCopy(srcFile, destFile);
} catch (err: any) {
// eslint-disable-line
if (err.code === 'ENOENT') {
await fs.mkdir(path.dirname(destFile), { recursive: true });
await linkOrCopy(srcFile, destFile);
return;
}
if (err.code !== 'EEXIST') {
throw err;
}
}
}
/*
* This function could be optimized because we don't really need to try linking again
* if linking failed once.
*/
async function linkOrCopy(srcFile: string, destFile: string) {
try {
await fs.link(srcFile, destFile);
} catch (err: any) {
// eslint-disable-line
if (err.code !== 'EXDEV') throw err;
await fs.copyFile(srcFile, destFile);
}
}

View File

@@ -42,7 +42,6 @@ import getIgnoreFilter from './get-ignore-filter';
import { getPlatformEnv } from './get-platform-env';
import { getPrefixedEnvVars } from './get-prefixed-env-vars';
import { cloneEnv } from './clone-env';
import { hardLinkDir } from './hard-link-dir';
export {
FileBlob,
@@ -87,7 +86,6 @@ export {
scanParentDirs,
getIgnoreFilter,
cloneEnv,
hardLinkDir,
};
export { EdgeFunction } from './edge-function';

View File

@@ -5,7 +5,7 @@ import minimatch from 'minimatch';
import { readlink } from 'fs-extra';
import { isSymbolicLink, isDirectory } from './fs/download';
import streamToBuffer from './fs/stream-to-buffer';
import type { Files, Config, FunctionFramework } from './types';
import type { Files, Config, Cron } from './types';
interface Environment {
[key: string]: string;
@@ -25,7 +25,7 @@ export interface LambdaOptionsBase {
supportsWrapper?: boolean;
experimentalResponseStreaming?: boolean;
operationType?: string;
framework?: FunctionFramework;
cron?: Cron;
}
export interface LambdaOptionsWithFiles extends LambdaOptionsBase {
@@ -63,6 +63,7 @@ export class Lambda {
environment: Environment;
allowQuery?: string[];
regions?: string[];
cron?: Cron;
/**
* @deprecated Use `await lambda.createZip()` instead.
*/
@@ -70,7 +71,6 @@ export class Lambda {
supportsMultiPayloads?: boolean;
supportsWrapper?: boolean;
experimentalResponseStreaming?: boolean;
framework?: FunctionFramework;
constructor(opts: LambdaOptions) {
const {
@@ -81,11 +81,11 @@ export class Lambda {
environment = {},
allowQuery,
regions,
cron,
supportsMultiPayloads,
supportsWrapper,
experimentalResponseStreaming,
operationType,
framework,
} = opts;
if ('files' in opts) {
assert(typeof opts.files === 'object', '"files" must be an object');
@@ -135,18 +135,8 @@ export class Lambda {
);
}
if (framework !== undefined) {
assert(typeof framework === 'object', '"framework" is not an object');
assert(
typeof framework.slug === 'string',
'"framework.slug" is not a string'
);
if (framework.version !== undefined) {
assert(
typeof framework.version === 'string',
'"framework.version" is not a string'
);
}
if (cron !== undefined) {
assert(typeof cron === 'string', '"cron" is not a string');
}
this.type = 'Lambda';
@@ -159,11 +149,11 @@ export class Lambda {
this.environment = environment;
this.allowQuery = allowQuery;
this.regions = regions;
this.cron = cron;
this.zipBuffer = 'zipBuffer' in opts ? opts.zipBuffer : undefined;
this.supportsMultiPayloads = supportsMultiPayloads;
this.supportsWrapper = supportsWrapper;
this.experimentalResponseStreaming = experimentalResponseStreaming;
this.framework = framework;
}
async createZip(): Promise<Buffer> {
@@ -238,7 +228,7 @@ export async function getLambdaOptionsFromFunction({
sourceFile,
config,
}: GetLambdaOptionsFromFunctionOptions): Promise<
Pick<LambdaOptions, 'memory' | 'maxDuration'>
Pick<LambdaOptions, 'memory' | 'maxDuration' | 'cron'>
> {
if (config?.functions) {
for (const [pattern, fn] of Object.entries(config.functions)) {
@@ -246,6 +236,7 @@ export async function getLambdaOptionsFromFunction({
return {
memory: fn.memory,
maxDuration: fn.maxDuration,
cron: fn.cron,
};
}
}

View File

@@ -29,6 +29,11 @@ export const functionsSchema = {
type: 'string',
maxLength: 256,
},
cron: {
type: 'string',
minLength: 9,
maxLength: 256,
},
},
},
},

View File

@@ -319,6 +319,7 @@ export interface BuilderFunctions {
runtime?: string;
includeFiles?: string;
excludeFiles?: string;
cron?: Cron;
};
}
@@ -355,8 +356,6 @@ export interface BuilderV3 {
type ImageFormat = 'image/avif' | 'image/webp';
type ImageContentDispositionType = 'inline' | 'attachment';
export type RemotePattern = {
/**
* Must be `http` or `https`.
@@ -392,7 +391,6 @@ export interface Images {
formats?: ImageFormat[];
dangerouslyAllowSVG?: boolean;
contentSecurityPolicy?: string;
contentDispositionType?: ImageContentDispositionType;
}
/**
@@ -413,16 +411,7 @@ export interface BuildResultBuildOutput {
buildOutputPath: string;
}
export interface Cron {
path: string;
schedule: string;
}
/** The framework which created the function */
export interface FunctionFramework {
slug: string;
version?: string;
}
export type Cron = string;
/**
* When a Builder implements `version: 2`, the `build()` function is expected

View File

@@ -1,77 +0,0 @@
import { join } from 'path';
import { writeFile, rm } from 'fs/promises';
import { readConfigFile } from '../src';
describe('Test `readConfigFile()`', () => {
let logMessages: string[];
const originalConsoleLog = console.log;
beforeEach(() => {
logMessages = [];
console.log = m => {
logMessages.push(m);
};
});
afterEach(() => {
console.log = originalConsoleLog;
});
const doesnotexist = join(__dirname, 'does-not-exist.json');
const tsconfig = join(__dirname, '../tsconfig.json');
const invalid = join(__dirname, 'invalid.json');
it('should return null when file does not exist', async () => {
expect(await readConfigFile(doesnotexist)).toBeNull();
expect(logMessages).toEqual([]);
});
it('should return parsed object when file exists', async () => {
expect(await readConfigFile(tsconfig)).toMatchObject({
compilerOptions: {
strict: true,
},
});
expect(logMessages).toEqual([]);
});
it('should return parsed object when at least one file exists', async () => {
const files = [doesnotexist, tsconfig];
expect(await readConfigFile(files)).toMatchObject({
compilerOptions: {
strict: true,
},
});
expect(logMessages).toEqual([]);
});
it('should return null when parse fails', async () => {
try {
await writeFile(invalid, 'borked');
expect(await readConfigFile(invalid)).toBeNull();
} finally {
await rm(invalid);
}
expect(logMessages.length).toBe(1);
expect(logMessages[0]).toMatch(
/^Error while parsing config file.+invalid.json/
);
});
it('should return parsed object when at least one file is valid', async () => {
try {
await writeFile(invalid, 'borked');
expect(await readConfigFile([invalid, tsconfig])).toMatchObject({
compilerOptions: {
strict: true,
},
});
} finally {
await rm(invalid);
}
expect(logMessages.length).toBe(1);
expect(logMessages[0]).toMatch(
/^Error while parsing config file.+invalid.json/
);
});
});

View File

@@ -506,11 +506,6 @@ it('should retry npm install when peer deps invalid and npm@8 on node@16', async
console.log('Skipping test on windows');
return;
}
if (process.platform === 'darwin') {
console.log('Skipping test on mac');
return;
}
const fixture = path.join(__dirname, 'fixtures', '15-npm-8-legacy-peer-deps');
const nodeVersion = { major: nodeMajor } as any;
await runNpmInstall(fixture, [], {}, {}, nodeVersion);

View File

@@ -1,6 +1,6 @@
{
"name": "vercel",
"version": "28.17.0",
"version": "28.15.4",
"preferGlobal": true,
"license": "Apache-2.0",
"description": "The command-line interface for Vercel",
@@ -14,7 +14,7 @@
"preinstall": "node ./scripts/preinstall.js",
"test": "jest --env node --verbose --bail",
"test-unit": "pnpm test test/unit/",
"test-cli": "rimraf test/fixtures/integration && pnpm test test/integration.test.ts",
"test-cli": "rimraf test/fixtures/integration && ava test/integration.js --serial --fail-fast --verbose",
"test-dev": "pnpm test test/dev/",
"coverage": "codecov",
"build": "ts-node ./scripts/build.ts",
@@ -28,20 +28,29 @@
"dist",
"scripts/preinstall.js"
],
"ava": {
"extensions": [
"ts"
],
"require": [
"ts-node/register/transpile-only",
"esm"
]
},
"engines": {
"node": ">= 14"
},
"dependencies": {
"@vercel/build-utils": "6.4.0",
"@vercel/go": "2.4.0",
"@vercel/hydrogen": "0.0.58",
"@vercel/next": "3.6.7",
"@vercel/node": "2.9.13",
"@vercel/python": "3.1.54",
"@vercel/redwood": "1.1.10",
"@vercel/remix-builder": "1.7.0",
"@vercel/ruby": "1.3.71",
"@vercel/static-build": "1.3.17"
"@vercel/build-utils": "6.2.2",
"@vercel/go": "2.3.4",
"@vercel/hydrogen": "0.0.50",
"@vercel/next": "3.4.3",
"@vercel/node": "2.9.3",
"@vercel/python": "3.1.46",
"@vercel/redwood": "1.1.2",
"@vercel/remix": "1.2.13",
"@vercel/ruby": "1.3.62",
"@vercel/static-build": "1.3.6"
},
"devDependencies": {
"@alex_neo/jest-expect-message": "1.0.5",
@@ -84,14 +93,13 @@
"@types/which": "1.3.2",
"@types/write-json-file": "2.2.1",
"@types/yauzl-promise": "2.1.0",
"@vercel-internals/types": "*",
"@vercel/client": "12.4.5",
"@vercel/client": "12.3.8",
"@vercel/error-utils": "1.0.8",
"@vercel/frameworks": "1.3.3",
"@vercel/fs-detectors": "3.8.5",
"@vercel/frameworks": "1.3.0",
"@vercel/fs-detectors": "3.7.11",
"@vercel/fun": "1.0.4",
"@vercel/ncc": "0.24.0",
"@vercel/routing-utils": "2.1.11",
"@vercel/routing-utils": "2.1.8",
"@zeit/source-map-support": "0.6.2",
"ajv": "6.12.2",
"alpha-sort": "2.0.1",
@@ -101,6 +109,7 @@
"async-listen": "1.2.0",
"async-retry": "1.1.3",
"async-sema": "2.1.4",
"ava": "2.2.0",
"bytes": "3.0.0",
"chalk": "4.1.0",
"chance": "1.1.7",
@@ -131,6 +140,7 @@
"is-url": "1.2.2",
"jaro-winkler": "0.2.8",
"jest-matcher-utils": "29.3.1",
"json5": "2.2.1",
"jsonlines": "0.1.1",
"line-async-iterator": "3.0.0",
"load-json-file": "3.0.0",

View File

@@ -36,7 +36,9 @@ async function main() {
const def = await readFile(fnPath.replace(/\.js$/, '.tsdef'), 'utf8');
const interfaceName = def.match(/interface (\w+)/)[1];
const lines = require(fnPath).toString().split('\n');
const lines = require(fnPath)
.toString()
.split('\n');
let errorHtmlStart = -1;
let errorHtmlEnd = -1;
for (let i = 0; i < lines.length; i++) {

View File

@@ -12,7 +12,7 @@ import stamp from '../../util/output/stamp';
import strlen from '../../util/strlen';
import getCommandFlags from '../../util/get-command-flags';
import { getCommandName } from '../../util/pkg-name';
import { Alias } from '@vercel-internals/types';
import { Alias } from '../../types';
export default async function ls(
client: Client,

View File

@@ -9,7 +9,7 @@ import strlen from '../../util/strlen';
import confirm from '../../util/input/confirm';
import findAliasByAliasOrId from '../../util/alias/find-alias-by-alias-or-id';
import { Alias } from '@vercel-internals/types';
import { Alias } from '../../types';
import { isValidName } from '../../util/is-valid-name';
import { getCommandName } from '../../util/pkg-name';

View File

@@ -1,7 +1,7 @@
import chalk from 'chalk';
import { SetDifference } from 'utility-types';
import { AliasRecord } from '../../util/alias/create-alias';
import { Domain } from '@vercel-internals/types';
import { Domain } from '../../types';
import { Output } from '../../util/output';
import * as ERRORS from '../../util/errors-ts';
import assignAlias from '../../util/alias/assign-alias';

View File

@@ -13,7 +13,7 @@ import logo from '../../util/output/logo';
import getArgs from '../../util/get-args';
import Client from '../../util/client';
import { getPkgName } from '../../util/pkg-name';
import { Deployment, PaginationOptions } from '@vercel-internals/types';
import { Deployment, PaginationOptions } from '../../types';
import { normalizeURL } from '../../util/bisect/normalize-url';
import getScope from '../../util/get-scope';
import getDeployment from '../../util/get-deployment';

View File

@@ -1,7 +1,7 @@
import fs from 'fs-extra';
import chalk from 'chalk';
import dotenv from 'dotenv';
import { join, normalize, relative, resolve, sep } from 'path';
import { join, normalize, relative, resolve } from 'path';
import {
getDiscontinuedNodeVersions,
normalizePath,
@@ -16,7 +16,6 @@ import {
BuildResultV2Typical,
BuildResultV3,
NowBuildError,
Cron,
} from '@vercel/build-utils';
import {
detectBuilders,
@@ -89,7 +88,6 @@ interface BuildOutputConfig {
framework?: {
version: string;
};
crons?: Cron[];
}
/**
@@ -296,15 +294,13 @@ async function doBuild(
cwd: string,
outputDir: string
): Promise<void> {
const { localConfigPath, output } = client;
const { output } = client;
const workPath = join(cwd, project.settings.rootDirectory || '.');
const [pkg, vercelConfig, nowConfig] = await Promise.all([
readJSONFile<PackageJson>(join(workPath, 'package.json')),
readJSONFile<VercelConfig>(
localConfigPath || join(workPath, 'vercel.json')
),
readJSONFile<VercelConfig>(join(workPath, 'vercel.json')),
readJSONFile<VercelConfig>(join(workPath, 'now.json')),
]);
@@ -627,7 +623,6 @@ async function doBuild(
});
const mergedImages = mergeImages(localConfig.images, buildResults.values());
const mergedCrons = mergeCrons(localConfig.crons, buildResults.values());
const mergedWildcard = mergeWildcard(buildResults.values());
const mergedOverrides: Record<string, PathOverride> =
overrides.length > 0 ? Object.assign({}, ...overrides) : undefined;
@@ -643,7 +638,6 @@ async function doBuild(
wildcard: mergedWildcard,
overrides: mergedOverrides,
framework,
crons: mergedCrons,
};
await fs.writeJSON(join(outputDir, 'config.json'), config, { spaces: 2 });
@@ -712,9 +706,7 @@ function expandBuild(files: string[], build: Builder): Builder[] {
});
}
let src = normalize(build.src || '**')
.split(sep)
.join('/');
let src = normalize(build.src || '**');
if (src === '.' || src === './') {
throw new NowBuildError({
code: `invalid_build_specification`,
@@ -754,18 +746,6 @@ function mergeImages(
return images;
}
function mergeCrons(
crons: BuildOutputConfig['crons'] = [],
buildResults: Iterable<BuildResult | BuildOutputConfig>
): BuildOutputConfig['crons'] {
for (const result of buildResults) {
if ('crons' in result && result.crons) {
crons = crons.concat(result.crons);
}
}
return crons;
}
function mergeWildcard(
buildResults: Iterable<BuildResult | BuildOutputConfig>
): BuildResultV2Typical['wildcard'] {

View File

@@ -5,7 +5,7 @@ import stamp from '../../util/output/stamp';
import createCertFromFile from '../../util/certs/create-cert-from-file';
import createCertForCns from '../../util/certs/create-cert-for-cns';
import { getCommandName } from '../../util/pkg-name';
import { Cert } from '@vercel-internals/types';
import { Cert } from '../../types';
interface Options {
'--overwrite'?: boolean;

View File

@@ -10,7 +10,7 @@ import {
import stamp from '../../util/output/stamp';
import getCerts from '../../util/certs/get-certs';
import strlen from '../../util/strlen';
import { Cert } from '@vercel-internals/types';
import { Cert } from '../../types';
import getCommandFlags from '../../util/get-command-flags';
import { getCommandName } from '../../util/pkg-name';

View File

@@ -2,7 +2,7 @@ import chalk from 'chalk';
import ms from 'ms';
import plural from 'pluralize';
import table from 'text-table';
import { Cert } from '@vercel-internals/types';
import { Cert } from '../../types';
import * as ERRORS from '../../util/errors-ts';
import { Output } from '../../util/output';
import deleteCertById from '../../util/certs/delete-cert-by-id';

View File

@@ -5,7 +5,7 @@ import DevServer from '../../util/dev/server';
import { parseListen } from '../../util/dev/parse-listen';
import Client from '../../util/client';
import { getLinkedProject } from '../../util/projects/link';
import { ProjectSettings } from '@vercel-internals/types';
import { ProjectSettings } from '../../types';
import setupAndLink from '../../util/link/setup-and-link';
import { getCommandName } from '../../util/pkg-name';
import param from '../../util/output/param';

View File

@@ -1,7 +1,7 @@
import chalk from 'chalk';
import ms from 'ms';
import { DomainNotFound } from '../../util/errors-ts';
import { DNSRecord } from '@vercel-internals/types';
import { DNSRecord } from '../../types';
import Client from '../../util/client';
import formatTable from '../../util/format-table';
import getDNSRecords, {

View File

@@ -1,7 +1,7 @@
import chalk from 'chalk';
import ms from 'ms';
import table from 'text-table';
import { DNSRecord } from '@vercel-internals/types';
import { DNSRecord } from '../../types';
import { Output } from '../../util/output';
import Client from '../../util/client';
import deleteDNSRecordById from '../../util/dns/delete-dns-record-by-id';

View File

@@ -8,7 +8,7 @@ import getScope from '../../util/get-scope';
import stamp from '../../util/output/stamp';
import formatTable from '../../util/format-table';
import { formatDateWithoutTime } from '../../util/format-date';
import { Domain } from '@vercel-internals/types';
import { Domain } from '../../types';
import getCommandFlags from '../../util/get-command-flags';
import {
PaginationOptions,

View File

@@ -1,7 +1,7 @@
import chalk from 'chalk';
import plural from 'pluralize';
import { User, Team } from '@vercel-internals/types';
import { User, Team } from '../../types';
import * as ERRORS from '../../util/errors-ts';
import Client from '../../util/client';
import getScope from '../../util/get-scope';

View File

@@ -2,7 +2,7 @@ import chalk from 'chalk';
import plural from 'pluralize';
import { DomainNotFound, DomainPermissionDenied } from '../../util/errors-ts';
import { Domain } from '@vercel-internals/types';
import { Domain } from '../../types';
import { Output } from '../../util/output';
import Client from '../../util/client';
import deleteCertById from '../../util/certs/delete-cert-by-id';

View File

@@ -1,9 +1,5 @@
import chalk from 'chalk';
import {
ProjectEnvTarget,
Project,
ProjectEnvType,
} from '@vercel-internals/types';
import { ProjectEnvTarget, Project, ProjectEnvType } from '../../types';
import { Output } from '../../util/output';
import Client from '../../util/client';
import stamp from '../../util/output/stamp';

View File

@@ -1,11 +1,7 @@
import chalk from 'chalk';
import ms from 'ms';
import { Output } from '../../util/output';
import {
Project,
ProjectEnvVariable,
ProjectEnvType,
} from '@vercel-internals/types';
import { Project, ProjectEnvVariable, ProjectEnvType } from '../../types';
import Client from '../../util/client';
import formatTable from '../../util/format-table';
import getEnvRecords from '../../util/env/get-env-records';

View File

@@ -2,7 +2,7 @@ import chalk from 'chalk';
import { outputFile } from 'fs-extra';
import { closeSync, openSync, readSync } from 'fs';
import { resolve } from 'path';
import { Project, ProjectEnvTarget } from '@vercel-internals/types';
import { Project, ProjectEnvTarget } from '../../types';
import Client from '../../util/client';
import { emoji, prependEmoji } from '../../util/emoji';
import confirm from '../../util/input/confirm';

View File

@@ -1,5 +1,5 @@
import chalk from 'chalk';
import { Project } from '@vercel-internals/types';
import { Project } from '../../types';
import { Output } from '../../util/output';
import confirm from '../../util/input/confirm';
import removeEnvRecord from '../../util/env/remove-env-record';

View File

@@ -1,7 +1,7 @@
import { Dictionary } from '@vercel/client';
import chalk from 'chalk';
import { join } from 'path';
import { Org, Project, ProjectLinkData } from '@vercel-internals/types';
import { Org, Project, ProjectLinkData } from '../../types';
import Client from '../../util/client';
import { parseGitConfig, pluckRemoteUrls } from '../../util/create-git-meta';
import confirm from '../../util/input/confirm';

View File

@@ -1,5 +1,5 @@
import chalk from 'chalk';
import { Org, Project } from '@vercel-internals/types';
import { Org, Project } from '../../types';
import Client from '../../util/client';
import confirm from '../../util/input/confirm';
import { getCommandName } from '../../util/pkg-name';

View File

@@ -10,7 +10,7 @@ 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 { Build, Deployment } from '@vercel-internals/types';
import { Build, Deployment } from '../types';
import title from 'title';
import { isErrnoException } from '@vercel/error-utils';
import { URL } from 'url';

View File

@@ -1,7 +1,7 @@
import chalk from 'chalk';
import ms from 'ms';
import table from 'text-table';
import { Project } from '@vercel-internals/types';
import { Project } from '../../types';
import Client from '../../util/client';
import getCommandFlags from '../../util/get-command-flags';
import { getCommandName } from '../../util/pkg-name';

View File

@@ -1,7 +1,7 @@
import chalk from 'chalk';
import { join } from 'path';
import Client from '../util/client';
import type { Project, ProjectEnvTarget } from '@vercel-internals/types';
import { ProjectEnvTarget } from '../types';
import { emoji, prependEmoji } from '../util/emoji';
import getArgs from '../util/get-args';
import logo from '../util/output/logo';
@@ -10,6 +10,7 @@ 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 type { Project } from '../types';
import {
isValidEnvTarget,
getEnvTargetPlaceholder,

View File

@@ -12,19 +12,17 @@ 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 getDeploymentsByProjectId, {
DeploymentPartial,
} 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 { Alias, Deployment, Project } from '@vercel-internals/types';
import { Alias, Project } from '../types';
import { NowError } from '../util/now-error';
type DeploymentWithAliases = Deployment & {
aliases: Alias[];
};
const help = () => {
console.log(`
${chalk.bold(
@@ -127,11 +125,11 @@ export default async function main(client: Client) {
let aliases: Alias[][];
let projects: Project[];
let deployments: DeploymentWithAliases[];
let deployments: DeploymentPartial[];
const findStart = Date.now();
try {
const searchFilter = (d: Deployment) =>
const searchFilter = (d: DeploymentPartial) =>
ids.some(
id =>
d &&
@@ -169,15 +167,9 @@ export default async function main(client: Client) {
})
);
// only process the first 201 projects
const to = Math.min(projectDeployments.length, 201);
for (let i = 0; i < to; i++) {
for (const pDepl of projectDeployments[i]) {
const depl = pDepl as DeploymentWithAliases;
depl.aliases = [];
deployments.push(depl);
}
}
projectDeployments
.slice(0, 201)
.map(pDeployments => deployments.push(...pDeployments));
projects = [];
} else {
@@ -268,7 +260,7 @@ export default async function main(client: Client) {
}
function readConfirmation(
deployments: DeploymentWithAliases[],
deployments: DeploymentPartial[],
projects: Project[],
output: Output
): Promise<string> {
@@ -333,7 +325,7 @@ function readConfirmation(
}
function deploymentsAndProjects(
deployments: DeploymentWithAliases[],
deployments: DeploymentPartial[],
projects: Project[],
conjunction = 'and'
) {

View File

@@ -7,7 +7,7 @@ import { emoji } from '../../util/emoji';
import getUser from '../../util/get-user';
import getTeams from '../../util/teams/get-teams';
import listInput from '../../util/input/list';
import { Team, GlobalConfig } from '@vercel-internals/types';
import { Team, GlobalConfig } from '../../types';
import { writeToConfigFile } from '../../util/config/files';
const updateCurrentTeam = (config: GlobalConfig, team?: Team) => {

View File

@@ -50,7 +50,7 @@ import getUpdateCommand from './util/get-update-command';
import { metrics, shouldCollectMetrics } from './util/metrics';
import { getCommandName, getTitleName } from './util/pkg-name';
import doLoginPrompt from './util/login/prompt';
import { AuthConfig, GlobalConfig } from '@vercel-internals/types';
import { AuthConfig, GlobalConfig } from './types';
import { VercelConfig } from '@vercel/client';
import box from './util/output/box';
@@ -267,7 +267,6 @@ const main = async () => {
config,
authConfig,
localConfig,
localConfigPath,
argv: process.argv,
});

View File

@@ -300,7 +300,6 @@ export interface Secret {
createdAt: number;
}
// TODO (Ethan-Arrowood) - Replace enums
export enum ProjectEnvTarget {
Production = 'production',
Preview = 'preview',

View File

@@ -1,4 +1,4 @@
import type { Deployment } from '@vercel-internals/types';
import type { Deployment } from '../../types';
import { Output } from '../output';
import Client from '../client';
import createAlias from './create-alias';

View File

@@ -1,4 +1,4 @@
import type { Deployment } from '@vercel-internals/types';
import type { Deployment } from '../../types';
import { Output } from '../output';
import * as ERRORS from '../errors-ts';
import Client from '../client';

View File

@@ -1,5 +1,5 @@
import { Output } from '../output';
import { Alias } from '@vercel-internals/types';
import { Alias } from '../../types';
import Client from '../client';

View File

@@ -1,4 +1,4 @@
import { Alias, PaginationOptions } from '@vercel-internals/types';
import { Alias, PaginationOptions } from '../../types';
import Client from '../client';
type Response = {

View File

@@ -2,7 +2,7 @@ import path from 'path';
import chalk from 'chalk';
import Client from '../client';
import { Output } from '../output';
import { User } from '@vercel-internals/types';
import { User } from '../../types';
import { VercelConfig } from '../dev/types';
import getDeploymentsByAppName from '../deploy/get-deployments-by-appname';
import getDeployment from '../get-deployment';

View File

@@ -1,6 +1,6 @@
import Client from '../client';
import getAliases from './get-aliases';
import { Alias } from '@vercel-internals/types';
import { Alias } from '../../types';
export default async function getDomainAliases(client: Client, domain: string) {
const { aliases } = await getAliases(client);

View File

@@ -1,4 +1,4 @@
import { Build } from '@vercel-internals/types';
import { Build } from '../types';
export const isReady = ({ readyState }: Pick<Build, 'readyState'>) =>
readyState === 'READY';

View File

@@ -9,7 +9,6 @@ import { ProjectLinkAndSettings } from '../projects/project-settings';
import { Output } from '../output';
import title from 'title';
import { PartialProjectSettings } from '../input/edit-project-settings';
import { debug } from '@vercel/build-utils';
export async function setMonorepoDefaultSettings(
cwd: string,
@@ -27,8 +26,8 @@ export async function setMonorepoDefaultSettings(
value: string
) => {
if (projectSettings[command]) {
debug(
`Skipping auto-assignment of ${command} as it is already set via project settings or configuration overrides.`
output.warn(
`Cannot automatically assign ${command} as it is already set via project settings or configuration overrides.`
);
} else {
projectSettings[command] = value;
@@ -50,7 +49,9 @@ export async function setMonorepoDefaultSettings(
const { monorepoManager, ...commands } = result;
output.log(
`Detected ${title(monorepoManager)}. Adjusting default settings...`
`Automatically detected ${title(
monorepoManager
)} monorepo manager. Attempting to assign default settings.`
);
if (commands.buildCommand) {

View File

@@ -13,6 +13,7 @@ import {
Builder,
BuildResultV2,
BuildResultV3,
Cron,
File,
FileFsRef,
BuilderV2,
@@ -40,6 +41,7 @@ export const OUTPUT_DIR = join(VERCEL_DIR, 'output');
* An entry in the "functions" object in `vercel.json`.
*/
interface FunctionConfiguration {
cron?: Cron;
memory?: number;
maxDuration?: number;
}
@@ -370,12 +372,14 @@ async function writeLambda(
throw new Error('Malformed `Lambda` - no "files" present');
}
const cron = functionConfiguration?.cron ?? lambda.cron;
const memory = functionConfiguration?.memory ?? lambda.memory;
const maxDuration = functionConfiguration?.maxDuration ?? lambda.maxDuration;
const config = {
...lambda,
handler: normalizePath(lambda.handler),
cron,
memory,
maxDuration,
type: undefined,

View File

@@ -1,7 +1,7 @@
import { readFileSync } from 'fs';
import { resolve } from 'path';
import Client from '../client';
import { Cert } from '@vercel-internals/types';
import { Cert } from '../../types';
import { isErrnoException } from '@vercel/error-utils';
import { isAPIError } from '../errors-ts';

View File

@@ -1,6 +1,6 @@
import chalk from 'chalk';
import { Cert } from '@vercel-internals/types';
import { Cert } from '../../types';
import * as ERRORS from '../errors-ts';
import Client from '../client';
import mapCertError from './map-cert-error';

View File

@@ -1,4 +1,4 @@
import { Cert } from '@vercel-internals/types';
import { Cert } from '../../types';
import Client from '../client';
import * as ERRORS from '../errors-ts';

View File

@@ -1,5 +1,5 @@
import { stringify } from 'querystring';
import { Cert } from '@vercel-internals/types';
import { Cert } from '../../types';
import Client from '../client';
/**

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