mirror of
https://github.com/LukeHagar/vercel.git
synced 2025-12-11 12:57:46 +00:00
Compare commits
139 Commits
@vercel/bu
...
@vercel/py
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
25f6595d36 | ||
|
|
e8385566fa | ||
|
|
52ca35252a | ||
|
|
2004e3d734 | ||
|
|
49b4394c44 | ||
|
|
08cdfa2a05 | ||
|
|
f18fa8546f | ||
|
|
025344c4a7 | ||
|
|
8b036e97ea | ||
|
|
a4240e89e1 | ||
|
|
0863ae0c6f | ||
|
|
e09d3d5928 | ||
|
|
f5f544ffd2 | ||
|
|
4eb1ff8730 | ||
|
|
d4b604f05c | ||
|
|
a3cf05af06 | ||
|
|
df2bcec830 | ||
|
|
f5e81273af | ||
|
|
e75d900eaf | ||
|
|
1a4f185045 | ||
|
|
35cc7db1a7 | ||
|
|
f535a20aad | ||
|
|
fcea36bf04 | ||
|
|
93f5a4438b | ||
|
|
72265aa9a1 | ||
|
|
6ee5eb137b | ||
|
|
c4f1c2f5ed | ||
|
|
f35a77c292 | ||
|
|
4bf3c237ee | ||
|
|
62c991f25e | ||
|
|
6ea2db4ae9 | ||
|
|
1943b1ecc0 | ||
|
|
92f5b6e0c9 | ||
|
|
ed6ce1149a | ||
|
|
fc3611fb80 | ||
|
|
ed33c2b27c | ||
|
|
a7a5bf1a12 | ||
|
|
cc687b3880 | ||
|
|
053ec92d5f | ||
|
|
4838dc336a | ||
|
|
eae45f4019 | ||
|
|
02feb564a7 | ||
|
|
e174a06673 | ||
|
|
de034943af | ||
|
|
b3862271a5 | ||
|
|
aaceeef604 | ||
|
|
ad107ecf79 | ||
|
|
79ef5c3724 | ||
|
|
02ff265074 | ||
|
|
ae89b8b8be | ||
|
|
4ccdcde463 | ||
|
|
22d3ee160b | ||
|
|
6d97e1673e | ||
|
|
522565f6e5 | ||
|
|
07bf81ab10 | ||
|
|
35024a4e3a | ||
|
|
c1df9bca19 | ||
|
|
4c1cdd1f0f | ||
|
|
b5cdc82a1c | ||
|
|
c7851404b3 | ||
|
|
e54da8a2e5 | ||
|
|
a066bedf95 | ||
|
|
09b23e53ba | ||
|
|
b793a67588 | ||
|
|
31dd354b3a | ||
|
|
529ff3b2d7 | ||
|
|
e71d5638ee | ||
|
|
8c16e765ee | ||
|
|
a008c9c7fe | ||
|
|
62b28ad0b4 | ||
|
|
7c50f2916e | ||
|
|
a521dadafb | ||
|
|
1efb5d6c0d | ||
|
|
72df5ce8f6 | ||
|
|
e20b74687f | ||
|
|
8f1358bd15 | ||
|
|
74c0b3e1bb | ||
|
|
eb0a031aeb | ||
|
|
f327be2d1f | ||
|
|
16a5867f6b | ||
|
|
90cbd675fa | ||
|
|
9c768b98b7 | ||
|
|
4c3bc05322 | ||
|
|
3f47587a8b | ||
|
|
84f93d8af4 | ||
|
|
e1aaf8080b | ||
|
|
0857352967 | ||
|
|
f92d229a63 | ||
|
|
427a2a58cf | ||
|
|
ccb5f301ad | ||
|
|
721cd3afcb | ||
|
|
3c8f20047f | ||
|
|
f15988418d | ||
|
|
5b88f673f8 | ||
|
|
e28c5f9733 | ||
|
|
afa64cb208 | ||
|
|
8572cc653a | ||
|
|
10841e8b06 | ||
|
|
1e13a6ca48 | ||
|
|
976e082c44 | ||
|
|
82d21f2ac8 | ||
|
|
f145540fe6 | ||
|
|
02d15eb0c4 | ||
|
|
0088873a6e | ||
|
|
fc0e6872e5 | ||
|
|
d800d9cd68 | ||
|
|
9c8f6aa70f | ||
|
|
feceeef7b7 | ||
|
|
6215c516e7 | ||
|
|
ada1ad3840 | ||
|
|
fe184618f4 | ||
|
|
de21cf9b62 | ||
|
|
c9c5e148f7 | ||
|
|
8115582e25 | ||
|
|
3e3f92e6d3 | ||
|
|
d6cccd70f2 | ||
|
|
3a68c73496 | ||
|
|
1c21ba52ce | ||
|
|
6e55e72498 | ||
|
|
b69196ab38 | ||
|
|
109b676fdd | ||
|
|
4685d8f8eb | ||
|
|
c854cd923c | ||
|
|
5a5b76e94a | ||
|
|
9d89ce7dc2 | ||
|
|
47ea7b4063 | ||
|
|
be7a40231b | ||
|
|
03d424dc12 | ||
|
|
2f65e9fd45 | ||
|
|
9ad6d46628 | ||
|
|
9b0b84ed8a | ||
|
|
3bb4d28e8d | ||
|
|
88de719932 | ||
|
|
9d0868a0b9 | ||
|
|
3e40438c81 | ||
|
|
ecb5455dba | ||
|
|
a5f53466ea | ||
|
|
d3fbddeae7 | ||
|
|
0ef9278785 |
@@ -42,3 +42,9 @@ packages/static-build/test/cache-fixtures
|
||||
|
||||
# redwood
|
||||
packages/redwood/test/fixtures
|
||||
|
||||
# remix
|
||||
packages/remix/test/fixtures
|
||||
|
||||
# gatsby-plugin-vercel-analytics
|
||||
packages/gatsby-plugin-vercel-analytics
|
||||
|
||||
3
.github/CODEOWNERS
vendored
3
.github/CODEOWNERS
vendored
@@ -3,9 +3,6 @@
|
||||
|
||||
* @TooTallNate @EndangeredMassa @styfle @cb1kenobi @Ethan-Arrowood
|
||||
/.github/workflows @TooTallNate @EndangeredMassa @styfle @cb1kenobi @Ethan-Arrowood @ijjk
|
||||
/packages/cli/src/commands/domains @mglagola @anatrajkovska
|
||||
/packages/cli/src/commands/certs @mglagola @anatrajkovska
|
||||
/packages/cli/src/commands/env @TooTallNate @EndangeredMassa @styfle @cb1kenobi @Ethan-Arrowood
|
||||
/packages/fs-detectors @TooTallNate @EndangeredMassa @styfle @cb1kenobi @Ethan-Arrowood @agadzik @chloetedder
|
||||
/packages/node-bridge @TooTallNate @EndangeredMassa @styfle @cb1kenobi @Ethan-Arrowood @ijjk
|
||||
/packages/next @TooTallNate @EndangeredMassa @styfle @cb1kenobi @Ethan-Arrowood @ijjk
|
||||
|
||||
20
.github/CONTRIBUTING.md
vendored
20
.github/CONTRIBUTING.md
vendored
@@ -6,7 +6,7 @@ Please read our [Code of Conduct](CODE_OF_CONDUCT.md) and follow it in all your
|
||||
|
||||
## Local development
|
||||
|
||||
This project is configured in a monorepo, where one repository contains multiple npm packages. Dependencies are installed and managed with `yarn`, not `npm` CLI.
|
||||
This project is configured in a monorepo, where one repository contains multiple npm packages. Dependencies are installed and managed with `pnpm`, not `npm` CLI.
|
||||
|
||||
To get started, execute the following:
|
||||
|
||||
@@ -14,22 +14,22 @@ To get started, execute the following:
|
||||
git clone https://github.com/vercel/vercel
|
||||
cd vercel
|
||||
corepack enable
|
||||
yarn install
|
||||
yarn bootstrap
|
||||
yarn build
|
||||
yarn lint
|
||||
yarn test-unit
|
||||
pnpm install
|
||||
pnpm bootstrap
|
||||
pnpm build
|
||||
pnpm lint
|
||||
pnpm test-unit
|
||||
```
|
||||
|
||||
Make sure all the tests pass before making changes.
|
||||
|
||||
### Running Vercel CLI Changes
|
||||
|
||||
You can use `yarn dev` from the `cli` package to invoke Vercel CLI with local changes:
|
||||
You can use `pnpm dev` from the `cli` package to invoke Vercel CLI with local changes:
|
||||
|
||||
```
|
||||
cd ./packages/cli
|
||||
yarn dev <cli-commands...>
|
||||
pnpm dev <cli-commands...>
|
||||
```
|
||||
|
||||
See [CLI Local Development](../packages/cli#local-development) for more details.
|
||||
@@ -39,7 +39,7 @@ See [CLI Local Development](../packages/cli#local-development) for more details.
|
||||
Once you are done with your changes (we even suggest doing it along the way), make sure all the tests still pass by running:
|
||||
|
||||
```
|
||||
yarn test-unit
|
||||
pnpm test-unit
|
||||
```
|
||||
|
||||
from the root of the project.
|
||||
@@ -102,7 +102,7 @@ When you run this script, you'll see all the imported files. If anything file is
|
||||
Sometimes you want to test changes to a Builder against an existing project, maybe with `vercel dev` or actual deployment. You can avoid publishing every Builder change to npm by uploading the Builder as a tarball.
|
||||
|
||||
1. Change directory to the desired Builder `cd ./packages/node`
|
||||
2. Run `yarn build` to compile typescript and other build steps
|
||||
2. Run `pnpm build` to compile typescript and other build steps
|
||||
3. Run `npm pack` to create a tarball file
|
||||
4. Run `vercel *.tgz` to upload the tarball file and get a URL
|
||||
5. Edit any existing `vercel.json` project and replace `use` with the URL
|
||||
|
||||
27
.github/workflows/cron-update-turbo.yml
vendored
Normal file
27
.github/workflows/cron-update-turbo.yml
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
name: Cron Update Turbo
|
||||
|
||||
on:
|
||||
# Run every week https://crontab.guru/every-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: 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 }}
|
||||
# See https://github.com/actions/github-script#run-a-separate-file-with-an-async-function
|
||||
with:
|
||||
script: |
|
||||
const script = require('./utils/update-turbo.js')
|
||||
await script({ github, context })
|
||||
16
.github/workflows/publish.yml
vendored
16
.github/workflows/publish.yml
vendored
@@ -27,9 +27,9 @@ jobs:
|
||||
tag="$(git describe --tags --exact-match 2> /dev/null || :)"
|
||||
if [[ -z "$tag" ]];
|
||||
then
|
||||
echo "::set-output name=IS_RELEASE::false"
|
||||
echo "IS_RELEASE=false" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "::set-output name=IS_RELEASE::true"
|
||||
echo "IS_RELEASE=true" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
- name: Setup Go
|
||||
if: ${{ steps.check-release.outputs.IS_RELEASE == 'true' }}
|
||||
@@ -47,20 +47,22 @@ jobs:
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: '**/node_modules'
|
||||
key: yarn-${{ matrix.os }}-${{ matrix.node }}-${{ hashFiles('yarn.lock') }}
|
||||
restore-keys: yarn-${{ matrix.os }}-${{ matrix.node }}
|
||||
key: pnpm-${{ matrix.os }}-${{ matrix.node }}-${{ hashFiles('pnpm-lock.yaml') }}
|
||||
restore-keys: pnpm-${{ matrix.os }}-${{ matrix.node }}
|
||||
- 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: yarn install --check-files --frozen-lockfile --network-timeout 1000000
|
||||
run: pnpm install
|
||||
- name: Build
|
||||
if: ${{ steps.check-release.outputs.IS_RELEASE == 'true' }}
|
||||
run: yarn build
|
||||
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: yarn publish-from-github
|
||||
run: pnpm publish-from-github
|
||||
env:
|
||||
NPM_TOKEN: ${{ secrets.NPM_TOKEN_ELEVATED }}
|
||||
GA_TRACKING_ID: ${{ secrets.GA_TRACKING_ID }}
|
||||
|
||||
12
.github/workflows/test-integration-cli.yml
vendored
12
.github/workflows/test-integration-cli.yml
vendored
@@ -41,11 +41,13 @@ jobs:
|
||||
- uses: actions/cache@v3
|
||||
with:
|
||||
path: '**/node_modules'
|
||||
key: yarn-${{ matrix.os }}-${{ matrix.node }}-${{ hashFiles('yarn.lock') }}
|
||||
restore-keys: yarn-${{ matrix.os }}-${{ matrix.node }}
|
||||
- run: yarn install --network-timeout 1000000 --frozen-lockfile
|
||||
- run: yarn run build
|
||||
- run: yarn test-integration-cli
|
||||
key: pnpm-${{ matrix.os }}-${{ matrix.node }}-${{ hashFiles('pnpm-lock.yaml') }}
|
||||
restore-keys: pnpm-${{ matrix.os }}-${{ 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 test-integration-cli
|
||||
env:
|
||||
VERCEL_TEST_TOKEN: ${{ secrets.VERCEL_TEST_TOKEN }}
|
||||
VERCEL_TEST_REGISTRATION_URL: ${{ secrets.VERCEL_TEST_REGISTRATION_URL }}
|
||||
|
||||
16
.github/workflows/test-unit.yml
vendored
16
.github/workflows/test-unit.yml
vendored
@@ -41,14 +41,16 @@ jobs:
|
||||
- uses: actions/cache@v3
|
||||
with:
|
||||
path: '**/node_modules'
|
||||
key: yarn-${{ matrix.os }}-${{ matrix.node }}-${{ hashFiles('yarn.lock') }}
|
||||
restore-keys: yarn-${{ matrix.os }}-${{ matrix.node }}
|
||||
- run: yarn install --network-timeout 1000000 --frozen-lockfile
|
||||
- run: yarn run build
|
||||
- run: yarn run lint
|
||||
key: pnpm-${{ matrix.os }}-${{ matrix.node }}-${{ hashFiles('pnpm-lock.yaml') }}
|
||||
restore-keys: pnpm-${{ matrix.os }}-${{ 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: yarn run test-unit
|
||||
- run: yarn workspace vercel run coverage
|
||||
- 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 }}
|
||||
|
||||
19
.github/workflows/test.yml
vendored
19
.github/workflows/test.yml
vendored
@@ -39,15 +39,17 @@ jobs:
|
||||
- uses: actions/cache@v3
|
||||
with:
|
||||
path: '**/node_modules'
|
||||
key: yarn-${{ matrix.os }}-${{ matrix.node }}-${{ hashFiles('yarn.lock') }}
|
||||
restore-keys: yarn-${{ matrix.os }}-${{ matrix.node }}
|
||||
- run: yarn install --network-timeout 1000000 --frozen-lockfile
|
||||
key: pnpm-${{ matrix.os }}-${{ matrix.node }}-${{ hashFiles('pnpm-lock.yaml') }}
|
||||
restore-keys: pnpm-${{ matrix.os }}-${{ matrix.node }}
|
||||
- name: install pnpm@7.24.2
|
||||
run: npm i -g pnpm@7.24.2
|
||||
- run: pnpm install
|
||||
- id: set-tests
|
||||
run: |
|
||||
TESTS_ARRAY=$(node utils/chunk-tests.js $SCRIPT_NAME)
|
||||
echo "Files to test:"
|
||||
echo "$TESTS_ARRAY"
|
||||
echo "::set-output name=tests::$TESTS_ARRAY"
|
||||
echo "tests=$TESTS_ARRAY" >> $GITHUB_OUTPUT
|
||||
- uses: patrickedqvist/wait-for-vercel-preview@ae34b392ef30297f2b672f9afb3c329bde9bd487
|
||||
id: waitForTarball
|
||||
with:
|
||||
@@ -80,14 +82,17 @@ jobs:
|
||||
- uses: actions/cache@v3
|
||||
with:
|
||||
path: '**/node_modules'
|
||||
key: yarn-${{ matrix.os }}-${{ matrix.node }}-${{ hashFiles('yarn.lock') }}
|
||||
restore-keys: yarn-${{ matrix.os }}-${{ matrix.node }}
|
||||
key: pnpm-${{ matrix.os }}-${{ matrix.node }}-${{ hashFiles('pnpm-lock.yaml') }}
|
||||
restore-keys: pnpm-${{ matrix.os }}-${{ matrix.node }}
|
||||
|
||||
- name: Install Hugo
|
||||
if: matrix.runner == 'macos-latest'
|
||||
run: curl -L -O https://github.com/gohugoio/hugo/releases/download/v0.56.0/hugo_0.56.0_macOS-64bit.tar.gz && tar -xzf hugo_0.56.0_macOS-64bit.tar.gz && mv ./hugo packages/cli/test/dev/fixtures/08-hugo/
|
||||
|
||||
- run: yarn install --network-timeout 1000000
|
||||
- name: install pnpm@7.24.2
|
||||
run: npm i -g pnpm@7.24.2
|
||||
|
||||
- run: pnpm install
|
||||
|
||||
- name: Build ${{matrix.packageName}} and all its dependencies
|
||||
run: node utils/gen.js && node_modules/.bin/turbo run build --cache-dir=".turbo" --scope=${{matrix.packageName}} --include-dependencies --no-deps
|
||||
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -19,6 +19,7 @@ packages/cli/test/dev/fixtures/**/dist
|
||||
packages/cli/test/dev/fixtures/**/public
|
||||
packages/cli/test/dev/fixtures/**/.now
|
||||
packages/cli/test/dev/fixtures/**/.vercel
|
||||
!packages/cli/test/fixtures/unit/commands/build/monorepo-detection/**/yarn.lock
|
||||
packages/cli/test/fixtures/integration
|
||||
test/lib/deployment/failed-page.txt
|
||||
.DS_Store
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/bin/sh
|
||||
. "$(dirname "$0")/_/husky.sh"
|
||||
|
||||
yarn pre-commit
|
||||
pnpm pre-commit
|
||||
|
||||
5
.npmrc
Normal file
5
.npmrc
Normal file
@@ -0,0 +1,5 @@
|
||||
save-exact=true
|
||||
hoist-pattern[]=!"**/@types/**"
|
||||
hoist-pattern[]=!"**/typedoc"
|
||||
hoist-pattern[]=!"**/typedoc-plugin-markdown"
|
||||
hoist-pattern[]=!"**/typedoc-plugin-mdn-links"
|
||||
@@ -4,3 +4,6 @@
|
||||
packages/cli/test/dev/fixtures/edge-function-error/api/edge-error-syntax.js
|
||||
packages/cli/test/fixtures/unit/commands/build/node-error/api/typescript.ts
|
||||
examples/sveltekit-1
|
||||
|
||||
# gatsby-plugin-vercel-analytics
|
||||
packages/gatsby-plugin-vercel-analytics
|
||||
|
||||
@@ -28,7 +28,7 @@ Official Runtimes are published to [the npm registry](https://npmjs.com) as a pa
|
||||
> **Note:** The `use` property in the `builds` array will work with any [npm
|
||||
> install argument](https://docs.npmjs.com/cli/install) such as a git repo URL,
|
||||
> which is useful for testing your Runtime. Alternatively, the `functions` property
|
||||
> requires that you specify a specifc tag published to npm, for stability purposes.
|
||||
> requires that you specify a specific tag published to npm, for stability purposes.
|
||||
|
||||
See the [Runtimes Documentation](https://vercel.com/docs/runtimes) to view example usage.
|
||||
|
||||
|
||||
@@ -33,9 +33,9 @@ For details on how to use Vercel, check out our [documentation](https://vercel.c
|
||||
|
||||
## Contributing
|
||||
|
||||
This project uses [yarn](https://yarnpkg.com/) to install dependencies and run scripts.
|
||||
This project uses [pnpm](https://pnpm.io/) to install dependencies and run scripts.
|
||||
|
||||
You can use the `dev` script to run local changes as if you were invoking Vercel CLI. For example, `vercel deploy --cwd=/path/to/project` could be run with local changes with `yarn dev deploy --cwd=/path/to/project`.
|
||||
You can use the `dev` script to run local changes as if you were invoking Vercel CLI. For example, `vercel deploy --cwd=/path/to/project` could be run with local changes with `pnpm dev deploy --cwd=/path/to/project`.
|
||||
|
||||
See the [Contributing Guidelines](./.github/CONTRIBUTING.md) for more details.
|
||||
|
||||
|
||||
@@ -13,6 +13,8 @@ function initSentry() {
|
||||
sentryInitDone = true;
|
||||
|
||||
init({
|
||||
// Cannot figure out whats going wrong here. VSCode resolves this fine. But when we build it blows up.
|
||||
// @ts-ignore
|
||||
dsn: assertEnv('SENTRY_DSN'),
|
||||
environment: process.env.NODE_ENV || 'production',
|
||||
release: `${serviceName}`,
|
||||
|
||||
@@ -4,9 +4,7 @@
|
||||
"version": "0.0.0",
|
||||
"description": "API for the vercel/vercel repo",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"//TODO": "We should add this pkg to yarn workspaces"
|
||||
},
|
||||
"scripts": {},
|
||||
"dependencies": {
|
||||
"@sentry/node": "5.11.1",
|
||||
"got": "10.2.1",
|
||||
@@ -16,9 +14,9 @@
|
||||
"unzip-stream": "0.3.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "14.18.33",
|
||||
"@types/node": "16.18.11",
|
||||
"@types/node-fetch": "2.5.4",
|
||||
"@vercel/node": "1.9.0",
|
||||
"typescript": "3.9.6"
|
||||
"@vercel/node": "*",
|
||||
"typescript": "4.3.4"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,5 +12,5 @@
|
||||
"resolveJsonModule": true,
|
||||
"isolatedModules": true
|
||||
},
|
||||
"include": ["examples", "frameworks.ts"]
|
||||
"include": ["examples", "frameworks.ts", "_lib"]
|
||||
}
|
||||
|
||||
524
api/yarn.lock
524
api/yarn.lock
@@ -1,524 +0,0 @@
|
||||
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
||||
# yarn lockfile v1
|
||||
|
||||
|
||||
"@sentry/apm@5.11.1":
|
||||
version "5.11.1"
|
||||
resolved "https://registry.yarnpkg.com/@sentry/apm/-/apm-5.11.1.tgz#cc89fa4150056fbf009f92eca94fccc3980db34e"
|
||||
integrity sha512-4iZH11p/7w9IMLT9hqNY1+EqLESltiIoF6/YsbpK93sXWGEs8VQ83IuvGuKWxajvHgDmj4ND0TxIliTsYqTqFw==
|
||||
dependencies:
|
||||
"@sentry/browser" "5.11.1"
|
||||
"@sentry/hub" "5.11.1"
|
||||
"@sentry/minimal" "5.11.1"
|
||||
"@sentry/types" "5.11.0"
|
||||
"@sentry/utils" "5.11.1"
|
||||
tslib "^1.9.3"
|
||||
|
||||
"@sentry/browser@5.11.1":
|
||||
version "5.11.1"
|
||||
resolved "https://registry.yarnpkg.com/@sentry/browser/-/browser-5.11.1.tgz#337ffcb52711b23064c847a07629e966f54a5ebb"
|
||||
integrity sha512-oqOX/otmuP92DEGRyZeBuQokXdeT9HQRxH73oqIURXXNLMP3PWJALSb4HtT4AftEt/2ROGobZLuA4TaID6My/Q==
|
||||
dependencies:
|
||||
"@sentry/core" "5.11.1"
|
||||
"@sentry/types" "5.11.0"
|
||||
"@sentry/utils" "5.11.1"
|
||||
tslib "^1.9.3"
|
||||
|
||||
"@sentry/core@5.11.1":
|
||||
version "5.11.1"
|
||||
resolved "https://registry.yarnpkg.com/@sentry/core/-/core-5.11.1.tgz#9e2da485e196ae32971545c1c49ee6fe719930e2"
|
||||
integrity sha512-BpvPosVNT20Xso4gAV54Lu3KqDmD20vO63HYwbNdST5LUi8oYV4JhvOkoBraPEM2cbBwQvwVcFdeEYKk4tin9A==
|
||||
dependencies:
|
||||
"@sentry/hub" "5.11.1"
|
||||
"@sentry/minimal" "5.11.1"
|
||||
"@sentry/types" "5.11.0"
|
||||
"@sentry/utils" "5.11.1"
|
||||
tslib "^1.9.3"
|
||||
|
||||
"@sentry/hub@5.11.1":
|
||||
version "5.11.1"
|
||||
resolved "https://registry.yarnpkg.com/@sentry/hub/-/hub-5.11.1.tgz#ddcb865563fae53852d405885c46b4c6de68a91b"
|
||||
integrity sha512-ucKprYCbGGLLjVz4hWUqHN9KH0WKUkGf5ZYfD8LUhksuobRkYVyig0ZGbshECZxW5jcDTzip4Q9Qimq/PkkXBg==
|
||||
dependencies:
|
||||
"@sentry/types" "5.11.0"
|
||||
"@sentry/utils" "5.11.1"
|
||||
tslib "^1.9.3"
|
||||
|
||||
"@sentry/minimal@5.11.1":
|
||||
version "5.11.1"
|
||||
resolved "https://registry.yarnpkg.com/@sentry/minimal/-/minimal-5.11.1.tgz#0e705d01a567282d8fbbda2aed848b4974cc3cec"
|
||||
integrity sha512-HK8zs7Pgdq7DsbZQTThrhQPrJsVWzz7MaluAbQA0rTIAJ3TvHKQpsVRu17xDpjZXypqWcKCRsthDrC4LxDM1Bg==
|
||||
dependencies:
|
||||
"@sentry/hub" "5.11.1"
|
||||
"@sentry/types" "5.11.0"
|
||||
tslib "^1.9.3"
|
||||
|
||||
"@sentry/node@5.11.1":
|
||||
version "5.11.1"
|
||||
resolved "https://registry.yarnpkg.com/@sentry/node/-/node-5.11.1.tgz#2a9c18cd1209cfdf7a69b9d91303413149d2c910"
|
||||
integrity sha512-FbJs0blJ36gEzE0rc2yBfA/KE+kXOLl8MUfFTcyJCBdCGF8XMETDCmgINnJ4TyBUJviwKoPw2TCk9TL2pa/A1w==
|
||||
dependencies:
|
||||
"@sentry/apm" "5.11.1"
|
||||
"@sentry/core" "5.11.1"
|
||||
"@sentry/hub" "5.11.1"
|
||||
"@sentry/types" "5.11.0"
|
||||
"@sentry/utils" "5.11.1"
|
||||
cookie "^0.3.1"
|
||||
https-proxy-agent "^4.0.0"
|
||||
lru_map "^0.3.3"
|
||||
tslib "^1.9.3"
|
||||
|
||||
"@sentry/types@5.11.0":
|
||||
version "5.11.0"
|
||||
resolved "https://registry.yarnpkg.com/@sentry/types/-/types-5.11.0.tgz#40f0f3174362928e033ddd9725d55e7c5cb7c5b6"
|
||||
integrity sha512-1Uhycpmeo1ZK2GLvrtwZhTwIodJHcyIS6bn+t4IMkN9MFoo6ktbAfhvexBDW/IDtdLlCGJbfm8nIZerxy0QUpg==
|
||||
|
||||
"@sentry/utils@5.11.1":
|
||||
version "5.11.1"
|
||||
resolved "https://registry.yarnpkg.com/@sentry/utils/-/utils-5.11.1.tgz#aa19fcc234cf632257b2281261651d2fac967607"
|
||||
integrity sha512-O0Zl4R2JJh8cTkQ8ZL2cDqGCmQdpA5VeXpuBbEl1v78LQPkBDISi35wH4mKmLwMsLBtTVpx2UeUHBj0KO5aLlA==
|
||||
dependencies:
|
||||
"@sentry/types" "5.11.0"
|
||||
tslib "^1.9.3"
|
||||
|
||||
"@sindresorhus/is@^1.0.0":
|
||||
version "1.2.0"
|
||||
resolved "https://registry.yarnpkg.com/@sindresorhus/is/-/is-1.2.0.tgz#63ce3638cb85231f3704164c90a18ef816da3fb7"
|
||||
integrity sha512-mwhXGkRV5dlvQc4EgPDxDxO6WuMBVymGFd1CA+2Y+z5dG9MNspoQ+AWjl/Ld1MnpCL8AKbosZlDVohqcIwuWsw==
|
||||
|
||||
"@szmarczak/http-timer@^4.0.0":
|
||||
version "4.0.0"
|
||||
resolved "https://registry.yarnpkg.com/@szmarczak/http-timer/-/http-timer-4.0.0.tgz#309789ccb7842ff1e41848cf43da587f78068836"
|
||||
integrity sha512-3yoXv8OtGr/r3R5gaWWNQ3VUoQ5G3Gmo8DXX95V14ZVvE2b7Pj6Ide9uIDON8ym4D/ItyfL9ejohYUPqOyvRXw==
|
||||
dependencies:
|
||||
defer-to-connect "^1.1.1"
|
||||
|
||||
"@types/cacheable-request@^6.0.1":
|
||||
version "6.0.1"
|
||||
resolved "https://registry.yarnpkg.com/@types/cacheable-request/-/cacheable-request-6.0.1.tgz#5d22f3dded1fd3a84c0bbeb5039a7419c2c91976"
|
||||
integrity sha512-ykFq2zmBGOCbpIXtoVbz4SKY5QriWPh3AjyU4G74RYbtt5yOc5OfaY75ftjg7mikMOla1CTGpX3lLbuJh8DTrQ==
|
||||
dependencies:
|
||||
"@types/http-cache-semantics" "*"
|
||||
"@types/keyv" "*"
|
||||
"@types/node" "*"
|
||||
"@types/responselike" "*"
|
||||
|
||||
"@types/http-cache-semantics@*":
|
||||
version "4.0.0"
|
||||
resolved "https://registry.yarnpkg.com/@types/http-cache-semantics/-/http-cache-semantics-4.0.0.tgz#9140779736aa2655635ee756e2467d787cfe8a2a"
|
||||
integrity sha512-c3Xy026kOF7QOTn00hbIllV1dLR9hG9NkSrLQgCVs8NF6sBU+VGWjD3wLPhmh1TYAc7ugCFsvHYMN4VcBN1U1A==
|
||||
|
||||
"@types/keyv@*":
|
||||
version "3.1.1"
|
||||
resolved "https://registry.yarnpkg.com/@types/keyv/-/keyv-3.1.1.tgz#e45a45324fca9dab716ab1230ee249c9fb52cfa7"
|
||||
integrity sha512-MPtoySlAZQ37VoLaPcTHCu1RWJ4llDkULYZIzOYxlhxBqYPB0RsRlmMU0R6tahtFe27mIdkHV+551ZWV4PLmVw==
|
||||
dependencies:
|
||||
"@types/node" "*"
|
||||
|
||||
"@types/node-fetch@2.5.4":
|
||||
version "2.5.4"
|
||||
resolved "https://registry.yarnpkg.com/@types/node-fetch/-/node-fetch-2.5.4.tgz#5245b6d8841fc3a6208b82291119bc11c4e0ce44"
|
||||
integrity sha512-Oz6id++2qAOFuOlE1j0ouk1dzl3mmI1+qINPNBhi9nt/gVOz0G+13Ao6qjhdF0Ys+eOkhu6JnFmt38bR3H0POQ==
|
||||
dependencies:
|
||||
"@types/node" "*"
|
||||
|
||||
"@types/node@*", "@types/node@13.1.4":
|
||||
version "13.1.4"
|
||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-13.1.4.tgz#4cfd90175a200ee9b02bd6b1cd19bc349741607e"
|
||||
integrity sha512-Lue/mlp2egZJoHXZr4LndxDAd7i/7SQYhV0EjWfb/a4/OZ6tuVwMCVPiwkU5nsEipxEf7hmkSU7Em5VQ8P5NGA==
|
||||
|
||||
"@types/responselike@*":
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/@types/responselike/-/responselike-1.0.0.tgz#251f4fe7d154d2bad125abe1b429b23afd262e29"
|
||||
integrity sha512-85Y2BjiufFzaMIlvJDvTTB8Fxl2xfLo4HgmHzVBz08w4wDePCTjYw66PdrolO0kzli3yam/YCgRufyo1DdQVTA==
|
||||
dependencies:
|
||||
"@types/node" "*"
|
||||
|
||||
"@vercel/node@1.9.0":
|
||||
version "1.9.0"
|
||||
resolved "https://registry.yarnpkg.com/@vercel/node/-/node-1.9.0.tgz#6b64f3b9a962ddb1089276fad00f441a1f4b9cf0"
|
||||
integrity sha512-Vk/ZpuY4Cdc8oUwBi/kf8qETRaJb/KYdFddVkLuS10QwA0yJx+RQ11trhZ1KFUdc27aBr5S2k8/dDxK8sLr+IA==
|
||||
dependencies:
|
||||
"@types/node" "*"
|
||||
ts-node "8.9.1"
|
||||
typescript "3.9.3"
|
||||
|
||||
agent-base@5:
|
||||
version "5.1.1"
|
||||
resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-5.1.1.tgz#e8fb3f242959db44d63be665db7a8e739537a32c"
|
||||
integrity sha512-TMeqbNl2fMW0nMjTEPOwe3J/PRFP4vqeoNuQMG0HlMrtm5QxKqdvAkZ1pRBQ/ulIyDD5Yq0nJ7YbdD8ey0TO3g==
|
||||
|
||||
arg@^4.1.0:
|
||||
version "4.1.3"
|
||||
resolved "https://registry.yarnpkg.com/arg/-/arg-4.1.3.tgz#269fc7ad5b8e42cb63c896d5666017261c144089"
|
||||
integrity sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==
|
||||
|
||||
binary@^0.3.0:
|
||||
version "0.3.0"
|
||||
resolved "https://registry.yarnpkg.com/binary/-/binary-0.3.0.tgz#9f60553bc5ce8c3386f3b553cff47462adecaa79"
|
||||
integrity sha1-n2BVO8XOjDOG87VTz/R0Yq3sqnk=
|
||||
dependencies:
|
||||
buffers "~0.1.1"
|
||||
chainsaw "~0.1.0"
|
||||
|
||||
bl@^3.0.0:
|
||||
version "3.0.0"
|
||||
resolved "https://registry.yarnpkg.com/bl/-/bl-3.0.0.tgz#3611ec00579fd18561754360b21e9f784500ff88"
|
||||
integrity sha512-EUAyP5UHU5hxF8BPT0LKW8gjYLhq1DQIcneOX/pL/m2Alo+OYDQAJlHq+yseMP50Os2nHXOSic6Ss3vSQeyf4A==
|
||||
dependencies:
|
||||
readable-stream "^3.0.1"
|
||||
|
||||
buffer-from@^1.0.0:
|
||||
version "1.1.1"
|
||||
resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.1.tgz#32713bc028f75c02fdb710d7c7bcec1f2c6070ef"
|
||||
integrity sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==
|
||||
|
||||
buffers@~0.1.1:
|
||||
version "0.1.1"
|
||||
resolved "https://registry.yarnpkg.com/buffers/-/buffers-0.1.1.tgz#b24579c3bed4d6d396aeee6d9a8ae7f5482ab7bb"
|
||||
integrity sha1-skV5w77U1tOWru5tmorn9Ugqt7s=
|
||||
|
||||
cacheable-lookup@^0.2.1:
|
||||
version "0.2.1"
|
||||
resolved "https://registry.yarnpkg.com/cacheable-lookup/-/cacheable-lookup-0.2.1.tgz#f474ae2c686667d7ea08c43409ad31b2b31b26c2"
|
||||
integrity sha512-BQ8MRjxJASEq2q+w0SusPU3B054gS278K8sj58QCLMZIso5qG05+MdCdmXxuyVlfvI8h4bPsNOavVUauVCGxrg==
|
||||
dependencies:
|
||||
keyv "^3.1.0"
|
||||
|
||||
cacheable-request@^7.0.0:
|
||||
version "7.0.0"
|
||||
resolved "https://registry.yarnpkg.com/cacheable-request/-/cacheable-request-7.0.0.tgz#12421aa084e943ec81eac8c93e56af90c624788a"
|
||||
integrity sha512-UVG4gMn3WjnAeFBBx7RFoprgOANIAkMwN5Dta6ONmfSwrCxfm0Ip7g0mIBxIRJZX9aDsoID0Ry3dU5Pr0csKKA==
|
||||
dependencies:
|
||||
clone-response "^1.0.2"
|
||||
get-stream "^5.1.0"
|
||||
http-cache-semantics "^4.0.0"
|
||||
keyv "^3.0.0"
|
||||
lowercase-keys "^2.0.0"
|
||||
normalize-url "^4.1.0"
|
||||
responselike "^2.0.0"
|
||||
|
||||
chainsaw@~0.1.0:
|
||||
version "0.1.0"
|
||||
resolved "https://registry.yarnpkg.com/chainsaw/-/chainsaw-0.1.0.tgz#5eab50b28afe58074d0d58291388828b5e5fbc98"
|
||||
integrity sha1-XqtQsor+WAdNDVgpE4iCi15fvJg=
|
||||
dependencies:
|
||||
traverse ">=0.3.0 <0.4"
|
||||
|
||||
chownr@^1.1.1:
|
||||
version "1.1.3"
|
||||
resolved "https://registry.yarnpkg.com/chownr/-/chownr-1.1.3.tgz#42d837d5239688d55f303003a508230fa6727142"
|
||||
integrity sha512-i70fVHhmV3DtTl6nqvZOnIjbY0Pe4kAUjwHj8z0zAdgBtYrJyYwLKCCuRBQ5ppkyL0AkN7HKRnETdmdp1zqNXw==
|
||||
|
||||
clone-response@^1.0.2:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.yarnpkg.com/clone-response/-/clone-response-1.0.2.tgz#d1dc973920314df67fbeb94223b4ee350239e96b"
|
||||
integrity sha1-0dyXOSAxTfZ/vrlCI7TuNQI56Ws=
|
||||
dependencies:
|
||||
mimic-response "^1.0.0"
|
||||
|
||||
cookie@^0.3.1:
|
||||
version "0.3.1"
|
||||
resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.3.1.tgz#e7e0a1f9ef43b4c8ba925c5c5a96e806d16873bb"
|
||||
integrity sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s=
|
||||
|
||||
debug@4:
|
||||
version "4.1.1"
|
||||
resolved "https://registry.yarnpkg.com/debug/-/debug-4.1.1.tgz#3b72260255109c6b589cee050f1d516139664791"
|
||||
integrity sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==
|
||||
dependencies:
|
||||
ms "^2.1.1"
|
||||
|
||||
decompress-response@^5.0.0:
|
||||
version "5.0.0"
|
||||
resolved "https://registry.yarnpkg.com/decompress-response/-/decompress-response-5.0.0.tgz#7849396e80e3d1eba8cb2f75ef4930f76461cb0f"
|
||||
integrity sha512-TLZWWybuxWgoW7Lykv+gq9xvzOsUjQ9tF09Tj6NSTYGMTCHNXzrPnD6Hi+TgZq19PyTAGH4Ll/NIM/eTGglnMw==
|
||||
dependencies:
|
||||
mimic-response "^2.0.0"
|
||||
|
||||
defer-to-connect@^1.1.1:
|
||||
version "1.1.1"
|
||||
resolved "https://registry.yarnpkg.com/defer-to-connect/-/defer-to-connect-1.1.1.tgz#88ae694b93f67b81815a2c8c769aef6574ac8f2f"
|
||||
integrity sha512-J7thop4u3mRTkYRQ+Vpfwy2G5Ehoy82I14+14W4YMDLKdWloI9gSzRbV30s/NckQGVJtPkWNcW4oMAUigTdqiQ==
|
||||
|
||||
diff@^4.0.1:
|
||||
version "4.0.2"
|
||||
resolved "https://registry.yarnpkg.com/diff/-/diff-4.0.2.tgz#60f3aecb89d5fae520c11aa19efc2bb982aade7d"
|
||||
integrity sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==
|
||||
|
||||
duplexer3@^0.1.4:
|
||||
version "0.1.4"
|
||||
resolved "https://registry.yarnpkg.com/duplexer3/-/duplexer3-0.1.4.tgz#ee01dd1cac0ed3cbc7fdbea37dc0a8f1ce002ce2"
|
||||
integrity sha1-7gHdHKwO08vH/b6jfcCo8c4ALOI=
|
||||
|
||||
end-of-stream@^1.1.0, end-of-stream@^1.4.1:
|
||||
version "1.4.4"
|
||||
resolved "https://registry.yarnpkg.com/end-of-stream/-/end-of-stream-1.4.4.tgz#5ae64a5f45057baf3626ec14da0ca5e4b2431eb0"
|
||||
integrity sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==
|
||||
dependencies:
|
||||
once "^1.4.0"
|
||||
|
||||
fs-constants@^1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/fs-constants/-/fs-constants-1.0.0.tgz#6be0de9be998ce16af8afc24497b9ee9b7ccd9ad"
|
||||
integrity sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==
|
||||
|
||||
get-stream@^5.0.0, get-stream@^5.1.0:
|
||||
version "5.1.0"
|
||||
resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-5.1.0.tgz#01203cdc92597f9b909067c3e656cc1f4d3c4dc9"
|
||||
integrity sha512-EXr1FOzrzTfGeL0gQdeFEvOMm2mzMOglyiOXSTpPC+iAjAKftbr3jpCMWynogwYnM+eSj9sHGc6wjIcDvYiygw==
|
||||
dependencies:
|
||||
pump "^3.0.0"
|
||||
|
||||
got@10.2.1:
|
||||
version "10.2.1"
|
||||
resolved "https://registry.yarnpkg.com/got/-/got-10.2.1.tgz#7087485482fb31aa6e6399fd493dd04639da117b"
|
||||
integrity sha512-IQX//hGm5oLjUj743GJG30U2RzjS58ZlhQQjwQXjsyR50TTD+etVMHlMEbNxYJGWVFa0ASgDVhRkAvQPe6M9iQ==
|
||||
dependencies:
|
||||
"@sindresorhus/is" "^1.0.0"
|
||||
"@szmarczak/http-timer" "^4.0.0"
|
||||
"@types/cacheable-request" "^6.0.1"
|
||||
cacheable-lookup "^0.2.1"
|
||||
cacheable-request "^7.0.0"
|
||||
decompress-response "^5.0.0"
|
||||
duplexer3 "^0.1.4"
|
||||
get-stream "^5.0.0"
|
||||
lowercase-keys "^2.0.0"
|
||||
mimic-response "^2.0.0"
|
||||
p-cancelable "^2.0.0"
|
||||
responselike "^2.0.0"
|
||||
to-readable-stream "^2.0.0"
|
||||
type-fest "^0.8.0"
|
||||
|
||||
http-cache-semantics@^4.0.0:
|
||||
version "4.0.3"
|
||||
resolved "https://registry.yarnpkg.com/http-cache-semantics/-/http-cache-semantics-4.0.3.tgz#495704773277eeef6e43f9ab2c2c7d259dda25c5"
|
||||
integrity sha512-TcIMG3qeVLgDr1TEd2XvHaTnMPwYQUQMIBLy+5pLSDKYFc7UIqj39w8EGzZkaxoLv/l2K8HaI0t5AVA+YYgUew==
|
||||
|
||||
https-proxy-agent@^4.0.0:
|
||||
version "4.0.0"
|
||||
resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-4.0.0.tgz#702b71fb5520a132a66de1f67541d9e62154d82b"
|
||||
integrity sha512-zoDhWrkR3of1l9QAL8/scJZyLu8j/gBkcwcaQOZh7Gyh/+uJQzGVETdgT30akuwkpL8HTRfssqI3BZuV18teDg==
|
||||
dependencies:
|
||||
agent-base "5"
|
||||
debug "4"
|
||||
|
||||
inherits@^2.0.3:
|
||||
version "2.0.4"
|
||||
resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c"
|
||||
integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==
|
||||
|
||||
json-buffer@3.0.0:
|
||||
version "3.0.0"
|
||||
resolved "https://registry.yarnpkg.com/json-buffer/-/json-buffer-3.0.0.tgz#5b1f397afc75d677bde8bcfc0e47e1f9a3d9a898"
|
||||
integrity sha1-Wx85evx11ne96Lz8Dkfh+aPZqJg=
|
||||
|
||||
keyv@^3.0.0, keyv@^3.1.0:
|
||||
version "3.1.0"
|
||||
resolved "https://registry.yarnpkg.com/keyv/-/keyv-3.1.0.tgz#ecc228486f69991e49e9476485a5be1e8fc5c4d9"
|
||||
integrity sha512-9ykJ/46SN/9KPM/sichzQ7OvXyGDYKGTaDlKMGCAlg2UK8KRy4jb0d8sFc+0Tt0YYnThq8X2RZgCg74RPxgcVA==
|
||||
dependencies:
|
||||
json-buffer "3.0.0"
|
||||
|
||||
lowercase-keys@^2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/lowercase-keys/-/lowercase-keys-2.0.0.tgz#2603e78b7b4b0006cbca2fbcc8a3202558ac9479"
|
||||
integrity sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA==
|
||||
|
||||
lru_map@^0.3.3:
|
||||
version "0.3.3"
|
||||
resolved "https://registry.yarnpkg.com/lru_map/-/lru_map-0.3.3.tgz#b5c8351b9464cbd750335a79650a0ec0e56118dd"
|
||||
integrity sha1-tcg1G5Rky9dQM1p5ZQoOwOVhGN0=
|
||||
|
||||
make-error@^1.1.1:
|
||||
version "1.3.6"
|
||||
resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.6.tgz#2eb2e37ea9b67c4891f684a1394799af484cf7a2"
|
||||
integrity sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==
|
||||
|
||||
mimic-response@^1.0.0:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/mimic-response/-/mimic-response-1.0.1.tgz#4923538878eef42063cb8a3e3b0798781487ab1b"
|
||||
integrity sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==
|
||||
|
||||
mimic-response@^2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/mimic-response/-/mimic-response-2.0.0.tgz#996a51c60adf12cb8a87d7fb8ef24c2f3d5ebb46"
|
||||
integrity sha512-8ilDoEapqA4uQ3TwS0jakGONKXVJqpy+RpM+3b7pLdOjghCrEiGp9SRkFbUHAmZW9vdnrENWHjaweIoTIJExSQ==
|
||||
|
||||
minimist@0.0.8:
|
||||
version "0.0.8"
|
||||
resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d"
|
||||
integrity sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=
|
||||
|
||||
mkdirp@^0.5.1:
|
||||
version "0.5.1"
|
||||
resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903"
|
||||
integrity sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=
|
||||
dependencies:
|
||||
minimist "0.0.8"
|
||||
|
||||
ms@^2.1.1:
|
||||
version "2.1.2"
|
||||
resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009"
|
||||
integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==
|
||||
|
||||
node-fetch@2.6.1:
|
||||
version "2.6.1"
|
||||
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.1.tgz#045bd323631f76ed2e2b55573394416b639a0052"
|
||||
integrity sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==
|
||||
|
||||
normalize-url@^4.1.0:
|
||||
version "4.5.0"
|
||||
resolved "https://registry.yarnpkg.com/normalize-url/-/normalize-url-4.5.0.tgz#453354087e6ca96957bd8f5baf753f5982142129"
|
||||
integrity sha512-2s47yzUxdexf1OhyRi4Em83iQk0aPvwTddtFz4hnSSw9dCEsLEGf6SwIO8ss/19S9iBb5sJaOuTvTGDeZI00BQ==
|
||||
|
||||
once@^1.3.1, once@^1.4.0:
|
||||
version "1.4.0"
|
||||
resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1"
|
||||
integrity sha1-WDsap3WWHUsROsF9nFC6753Xa9E=
|
||||
dependencies:
|
||||
wrappy "1"
|
||||
|
||||
p-cancelable@^2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/p-cancelable/-/p-cancelable-2.0.0.tgz#4a3740f5bdaf5ed5d7c3e34882c6fb5d6b266a6e"
|
||||
integrity sha512-wvPXDmbMmu2ksjkB4Z3nZWTSkJEb9lqVdMaCKpZUGJG9TMiNp9XcbG3fn9fPKjem04fJMJnXoyFPk2FmgiaiNg==
|
||||
|
||||
parse-github-url@1.0.2:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.yarnpkg.com/parse-github-url/-/parse-github-url-1.0.2.tgz#242d3b65cbcdda14bb50439e3242acf6971db395"
|
||||
integrity sha512-kgBf6avCbO3Cn6+RnzRGLkUsv4ZVqv/VfAYkRsyBcgkshNvVBkRn1FEZcW0Jb+npXQWm2vHPnnOqFteZxRRGNw==
|
||||
|
||||
pump@^3.0.0:
|
||||
version "3.0.0"
|
||||
resolved "https://registry.yarnpkg.com/pump/-/pump-3.0.0.tgz#b4a2116815bde2f4e1ea602354e8c75565107a64"
|
||||
integrity sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==
|
||||
dependencies:
|
||||
end-of-stream "^1.1.0"
|
||||
once "^1.3.1"
|
||||
|
||||
readable-stream@^3.0.1, readable-stream@^3.1.1:
|
||||
version "3.4.0"
|
||||
resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.4.0.tgz#a51c26754658e0a3c21dbf59163bd45ba6f447fc"
|
||||
integrity sha512-jItXPLmrSR8jmTRmRWJXCnGJsfy85mB3Wd/uINMXA65yrnFo0cPClFIUWzo2najVNSl+mx7/4W8ttlLWJe99pQ==
|
||||
dependencies:
|
||||
inherits "^2.0.3"
|
||||
string_decoder "^1.1.1"
|
||||
util-deprecate "^1.0.1"
|
||||
|
||||
responselike@^2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/responselike/-/responselike-2.0.0.tgz#26391bcc3174f750f9a79eacc40a12a5c42d7723"
|
||||
integrity sha512-xH48u3FTB9VsZw7R+vvgaKeLKzT6jOogbQhEe/jewwnZgzPcnyWui2Av6JpoYZF/91uueC+lqhWqeURw5/qhCw==
|
||||
dependencies:
|
||||
lowercase-keys "^2.0.0"
|
||||
|
||||
safe-buffer@~5.2.0:
|
||||
version "5.2.0"
|
||||
resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.0.tgz#b74daec49b1148f88c64b68d49b1e815c1f2f519"
|
||||
integrity sha512-fZEwUGbVl7kouZs1jCdMLdt95hdIv0ZeHg6L7qPeciMZhZ+/gdesW4wgTARkrFWEpspjEATAzUGPG8N2jJiwbg==
|
||||
|
||||
source-map-support@^0.5.17:
|
||||
version "0.5.19"
|
||||
resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.19.tgz#a98b62f86dcaf4f67399648c085291ab9e8fed61"
|
||||
integrity sha512-Wonm7zOCIJzBGQdB+thsPar0kYuCIzYvxZwlBa87yi/Mdjv7Tip2cyVbLj5o0cFPN4EVkuTwb3GDDyUx2DGnGw==
|
||||
dependencies:
|
||||
buffer-from "^1.0.0"
|
||||
source-map "^0.6.0"
|
||||
|
||||
source-map@^0.6.0:
|
||||
version "0.6.1"
|
||||
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263"
|
||||
integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==
|
||||
|
||||
string_decoder@^1.1.1:
|
||||
version "1.3.0"
|
||||
resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.3.0.tgz#42f114594a46cf1a8e30b0a84f56c78c3edac21e"
|
||||
integrity sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==
|
||||
dependencies:
|
||||
safe-buffer "~5.2.0"
|
||||
|
||||
tar-fs@2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/tar-fs/-/tar-fs-2.0.0.tgz#677700fc0c8b337a78bee3623fdc235f21d7afad"
|
||||
integrity sha512-vaY0obB6Om/fso8a8vakQBzwholQ7v5+uy+tF3Ozvxv1KNezmVQAiWtcNmMHFSFPqL3dJA8ha6gdtFbfX9mcxA==
|
||||
dependencies:
|
||||
chownr "^1.1.1"
|
||||
mkdirp "^0.5.1"
|
||||
pump "^3.0.0"
|
||||
tar-stream "^2.0.0"
|
||||
|
||||
tar-stream@^2.0.0:
|
||||
version "2.1.0"
|
||||
resolved "https://registry.yarnpkg.com/tar-stream/-/tar-stream-2.1.0.tgz#d1aaa3661f05b38b5acc9b7020efdca5179a2cc3"
|
||||
integrity sha512-+DAn4Nb4+gz6WZigRzKEZl1QuJVOLtAwwF+WUxy1fJ6X63CaGaUAxJRD2KEn1OMfcbCjySTYpNC6WmfQoIEOdw==
|
||||
dependencies:
|
||||
bl "^3.0.0"
|
||||
end-of-stream "^1.4.1"
|
||||
fs-constants "^1.0.0"
|
||||
inherits "^2.0.3"
|
||||
readable-stream "^3.1.1"
|
||||
|
||||
to-readable-stream@^2.0.0:
|
||||
version "2.1.0"
|
||||
resolved "https://registry.yarnpkg.com/to-readable-stream/-/to-readable-stream-2.1.0.tgz#82880316121bea662cdc226adb30addb50cb06e8"
|
||||
integrity sha512-o3Qa6DGg1CEXshSdvWNX2sN4QHqg03SPq7U6jPXRahlQdl5dK8oXjkU/2/sGrnOZKeGV1zLSO8qPwyKklPPE7w==
|
||||
|
||||
"traverse@>=0.3.0 <0.4":
|
||||
version "0.3.9"
|
||||
resolved "https://registry.yarnpkg.com/traverse/-/traverse-0.3.9.tgz#717b8f220cc0bb7b44e40514c22b2e8bbc70d8b9"
|
||||
integrity sha1-cXuPIgzAu3tE5AUUwisui7xw2Lk=
|
||||
|
||||
ts-node@8.9.1:
|
||||
version "8.9.1"
|
||||
resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-8.9.1.tgz#2f857f46c47e91dcd28a14e052482eb14cfd65a5"
|
||||
integrity sha512-yrq6ODsxEFTLz0R3BX2myf0WBCSQh9A+py8PBo1dCzWIOcvisbyH6akNKqDHMgXePF2kir5mm5JXJTH3OUJYOQ==
|
||||
dependencies:
|
||||
arg "^4.1.0"
|
||||
diff "^4.0.1"
|
||||
make-error "^1.1.1"
|
||||
source-map-support "^0.5.17"
|
||||
yn "3.1.1"
|
||||
|
||||
tslib@^1.9.3:
|
||||
version "1.10.0"
|
||||
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.10.0.tgz#c3c19f95973fb0a62973fb09d90d961ee43e5c8a"
|
||||
integrity sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==
|
||||
|
||||
type-fest@^0.8.0:
|
||||
version "0.8.1"
|
||||
resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.8.1.tgz#09e249ebde851d3b1e48d27c105444667f17b83d"
|
||||
integrity sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==
|
||||
|
||||
typescript@3.9.3:
|
||||
version "3.9.3"
|
||||
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.9.3.tgz#d3ac8883a97c26139e42df5e93eeece33d610b8a"
|
||||
integrity sha512-D/wqnB2xzNFIcoBG9FG8cXRDjiqSTbG2wd8DMZeQyJlP1vfTkIxH4GKveWaEBYySKIg+USu+E+EDIR47SqnaMQ==
|
||||
|
||||
typescript@3.9.6:
|
||||
version "3.9.6"
|
||||
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.9.6.tgz#8f3e0198a34c3ae17091b35571d3afd31999365a"
|
||||
integrity sha512-Pspx3oKAPJtjNwE92YS05HQoY7z2SFyOpHo9MqJor3BXAGNaPUs83CuVp9VISFkSjyRfiTpmKuAYGJB7S7hOxw==
|
||||
|
||||
unzip-stream@0.3.0:
|
||||
version "0.3.0"
|
||||
resolved "https://registry.yarnpkg.com/unzip-stream/-/unzip-stream-0.3.0.tgz#c30c054cd6b0d64b13a23cd3ece911eb0b2b52d8"
|
||||
integrity sha512-NG1h/MdGIX3HzyqMjyj1laBCmlPYhcO4xEy7gEqqzGiSLw7XqDQCnY4nYSn5XSaH8mQ6TFkaujrO8d/PIZN85A==
|
||||
dependencies:
|
||||
binary "^0.3.0"
|
||||
mkdirp "^0.5.1"
|
||||
|
||||
util-deprecate@^1.0.1:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf"
|
||||
integrity sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=
|
||||
|
||||
wrappy@1:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f"
|
||||
integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=
|
||||
|
||||
yn@3.1.1:
|
||||
version "3.1.1"
|
||||
resolved "https://registry.yarnpkg.com/yn/-/yn-3.1.1.tgz#1e87401a09d767c1d5eab26a6e4c185182d2eb50"
|
||||
integrity sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
This directory is a brief example of a [Gatsby](https://www.gatsbyjs.org/) app that can be deployed to Vercel with zero configuration.
|
||||
|
||||
> **Note:** We do not currently support some Gatsby v5 features, including API Routes and DSG. We are actively working on adding support for these features.
|
||||
> **Note:** SSR, DSG, and API Routes [are now supported](https://vercel.com/changelog/improved-support-for-gatsby-sites). We do not currently support some Gatsby v5 features, including Partial Hydration and the Slice API.
|
||||
|
||||
## Deploy Your Own
|
||||
|
||||
|
||||
@@ -9,5 +9,8 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"gridsome": "0.7.23"
|
||||
},
|
||||
"engines": {
|
||||
"node": "<17"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,8 @@ First, run the development server:
|
||||
npm run dev
|
||||
# or
|
||||
yarn dev
|
||||
# or
|
||||
pnpm dev
|
||||
```
|
||||
|
||||
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
|
||||
|
||||
8
examples/nextjs/jsconfig.json
Normal file
8
examples/nextjs/jsconfig.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"@/*": ["./*"]
|
||||
}
|
||||
}
|
||||
}
|
||||
1287
examples/nextjs/package-lock.json
generated
1287
examples/nextjs/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -9,10 +9,10 @@
|
||||
"lint": "next lint"
|
||||
},
|
||||
"dependencies": {
|
||||
"@next/font": "13.1.0",
|
||||
"eslint": "8.30.0",
|
||||
"eslint-config-next": "13.1.0",
|
||||
"next": "13.1.0",
|
||||
"@next/font": "13.1.5",
|
||||
"eslint": "8.32.0",
|
||||
"eslint-config-next": "13.1.5",
|
||||
"next": "13.1.5",
|
||||
"react": "18.2.0",
|
||||
"react-dom": "18.2.0"
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import '../styles/globals.css'
|
||||
import '@/styles/globals.css'
|
||||
|
||||
export default function App({ Component, pageProps }) {
|
||||
return <Component {...pageProps} />
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import Head from 'next/head'
|
||||
import Image from 'next/image'
|
||||
import { Inter } from '@next/font/google'
|
||||
import styles from '../styles/Home.module.css'
|
||||
import styles from '@/styles/Home.module.css'
|
||||
|
||||
const inter = Inter({ subsets: ['latin'] })
|
||||
|
||||
|
||||
@@ -7,6 +7,6 @@
|
||||
"build": "parcel build"
|
||||
},
|
||||
"devDependencies": {
|
||||
"parcel": "^2.0.0"
|
||||
"parcel": "^2.8.3"
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -10,7 +10,7 @@
|
||||
"@remix-run/react": "^1.7.6",
|
||||
"@remix-run/vercel": "^1.7.6",
|
||||
"@vercel/analytics": "^0.1.5",
|
||||
"@vercel/node": "^2.6.3",
|
||||
"@vercel/node": "^2.7.0",
|
||||
"react": "^18.2.0",
|
||||
"react-dom": "^18.2.0"
|
||||
},
|
||||
@@ -20,7 +20,7 @@
|
||||
"@remix-run/serve": "^1.7.6",
|
||||
"@types/react": "^18.0.25",
|
||||
"@types/react-dom": "^18.0.9",
|
||||
"eslint": "^8.27.0",
|
||||
"eslint": "^8.28.0",
|
||||
"typescript": "^4.9.3"
|
||||
},
|
||||
"engines": {
|
||||
|
||||
1867
examples/remix/pnpm-lock.yaml
generated
1867
examples/remix/pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@@ -12,7 +12,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@sveltejs/adapter-auto": "next",
|
||||
"@sveltejs/kit": "next",
|
||||
"@sveltejs/kit": "1.0.0-next.589",
|
||||
"@types/cookie": "^0.5.1",
|
||||
"prettier": "^2.6.2",
|
||||
"prettier-plugin-svelte": "^2.7.0",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"npmClient": "yarn",
|
||||
"npmClient": "pnpm",
|
||||
"useWorkspaces": true,
|
||||
"packages": ["packages/*"],
|
||||
"command": {
|
||||
|
||||
31
package.json
31
package.json
@@ -3,30 +3,25 @@
|
||||
"version": "0.0.0",
|
||||
"private": true,
|
||||
"license": "Apache-2.0",
|
||||
"packageManager": "yarn@1.22.19",
|
||||
"workspaces": {
|
||||
"packages": [
|
||||
"packages/*"
|
||||
],
|
||||
"nohoist": [
|
||||
"**/@types/**",
|
||||
"**/typedoc",
|
||||
"**/typedoc-plugin-markdown",
|
||||
"**/typedoc-plugin-mdn-links"
|
||||
]
|
||||
},
|
||||
"packageManager": "pnpm@7.24.2",
|
||||
"dependencies": {
|
||||
"lerna": "3.16.4"
|
||||
"lerna": "5.6.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "14.18.33",
|
||||
"@typescript-eslint/eslint-plugin": "5.21.0",
|
||||
"@typescript-eslint/parser": "5.21.0",
|
||||
"@vercel/build-utils": "*",
|
||||
"@vercel/ncc": "0.24.0",
|
||||
"async-retry": "1.2.3",
|
||||
"buffer-replace": "1.0.0",
|
||||
"create-svelte": "2.0.1",
|
||||
"dot": "1.1.3",
|
||||
"eslint": "8.14.0",
|
||||
"eslint-config-prettier": "8.5.0",
|
||||
"eslint-plugin-jest": "26.1.5",
|
||||
"execa": "3.2.0",
|
||||
"fs-extra": "11.1.0",
|
||||
"husky": "7.0.4",
|
||||
"jest": "28.0.2",
|
||||
"json5": "2.1.1",
|
||||
@@ -34,22 +29,24 @@
|
||||
"node-fetch": "2.6.7",
|
||||
"npm-package-arg": "6.1.0",
|
||||
"prettier": "2.6.2",
|
||||
"source-map-support": "0.5.12",
|
||||
"ts-eager": "2.0.2",
|
||||
"ts-jest": "28.0.5",
|
||||
"turbo": "1.4.7"
|
||||
"turbo": "1.7.0"
|
||||
},
|
||||
"scripts": {
|
||||
"lerna": "lerna",
|
||||
"version": "pnpm install && git add pnpm-lock.yaml",
|
||||
"bootstrap": "lerna bootstrap",
|
||||
"publish-stable": "echo 'Run `yarn changelog` for instructions'",
|
||||
"publish-stable": "echo 'Run `pnpm changelog` for instructions'",
|
||||
"publish-canary": "git checkout main && git pull && lerna version prerelease --preid canary --message \"Publish Canary\" --exact",
|
||||
"publish-from-github": "./utils/publish.sh",
|
||||
"changelog": "node utils/changelog.js",
|
||||
"build": "node utils/gen.js && turbo run build",
|
||||
"vercel-build": "yarn build && yarn run pack && cd api && node -r ts-eager/register ./_lib/script/build.ts",
|
||||
"vercel-build": "pnpm build && pnpm run pack && cd api && node -r ts-eager/register ./_lib/script/build.ts",
|
||||
"pre-commit": "lint-staged",
|
||||
"test": "jest --rootDir=\"test\" --testPathPattern=\"\\.test.js\"",
|
||||
"test-unit": "yarn test && node utils/gen.js && turbo run test-unit",
|
||||
"test-unit": "pnpm test && node utils/gen.js && turbo run test-unit",
|
||||
"test-integration-cli": "node utils/gen.js && turbo run test-integration-cli",
|
||||
"test-integration-once": "node utils/gen.js && turbo run test-integration-once",
|
||||
"test-integration-dev": "node utils/gen.js && turbo run test-integration-dev",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@vercel/build-utils",
|
||||
"version": "5.7.2",
|
||||
"version": "6.0.0",
|
||||
"license": "MIT",
|
||||
"main": "./dist/index.js",
|
||||
"types": "./dist/index.d.js",
|
||||
@@ -13,8 +13,8 @@
|
||||
"scripts": {
|
||||
"build": "node build",
|
||||
"test": "jest --env node --verbose --runInBand --bail",
|
||||
"test-unit": "yarn test test/unit.*test.*",
|
||||
"test-integration-once": "yarn test test/integration.test.ts"
|
||||
"test-unit": "pnpm test test/unit.*test.*",
|
||||
"test-integration-once": "pnpm test test/integration.test.ts"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@iarna/toml": "2.2.3",
|
||||
@@ -25,8 +25,10 @@
|
||||
"@types/glob": "7.2.0",
|
||||
"@types/jest": "27.4.1",
|
||||
"@types/js-yaml": "3.12.1",
|
||||
"@types/minimatch": "^5.1.2",
|
||||
"@types/ms": "0.7.31",
|
||||
"@types/multistream": "2.1.1",
|
||||
"@types/node": "14.18.33",
|
||||
"@types/node-fetch": "^2.1.6",
|
||||
"@types/semver": "6.0.0",
|
||||
"@types/yazl": "2.4.2",
|
||||
@@ -36,8 +38,10 @@
|
||||
"async-sema": "2.1.4",
|
||||
"cross-spawn": "6.0.5",
|
||||
"end-of-stream": "1.4.1",
|
||||
"execa": "3.2.0",
|
||||
"fs-extra": "10.0.0",
|
||||
"glob": "8.0.3",
|
||||
"ignore": "4.0.6",
|
||||
"into-stream": "5.0.0",
|
||||
"js-yaml": "3.13.1",
|
||||
"minimatch": "3.0.4",
|
||||
|
||||
@@ -25,7 +25,11 @@ export function cloneEnv(...envs: (Env | undefined)[]): Env {
|
||||
// however we lose this proxied value when we destructure and
|
||||
// thus we must explicitly copy it, but we must also remove the
|
||||
// `Path` property since we can't have both a `PATH` and `Path`
|
||||
obj.PATH = obj.Path;
|
||||
|
||||
if (obj.Path !== undefined) {
|
||||
obj.PATH = obj.Path;
|
||||
}
|
||||
|
||||
delete obj.Path;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,23 +2,23 @@ import path from 'path';
|
||||
import debug from '../debug';
|
||||
import FileFsRef from '../file-fs-ref';
|
||||
import { File, Files, Meta } from '../types';
|
||||
import { remove, mkdirp, readlink, symlink, Stats } from 'fs-extra';
|
||||
import { remove, mkdirp, readlink, symlink, chmod } from 'fs-extra';
|
||||
import streamToBuffer from './stream-to-buffer';
|
||||
|
||||
export interface DownloadedFiles {
|
||||
[filePath: string]: FileFsRef;
|
||||
}
|
||||
|
||||
const STAT = new Stats();
|
||||
|
||||
export function isSymbolicLink(mode: number): boolean {
|
||||
STAT.mode = mode;
|
||||
return STAT.isSymbolicLink();
|
||||
}
|
||||
const S_IFDIR = 16384; /* 0040000 directory */
|
||||
const S_IFLNK = 40960; /* 0120000 symbolic link */
|
||||
const S_IFMT = 61440; /* 0170000 type of file */
|
||||
|
||||
export function isDirectory(mode: number): boolean {
|
||||
STAT.mode = mode;
|
||||
return STAT.isDirectory();
|
||||
return (mode & S_IFMT) === S_IFDIR;
|
||||
}
|
||||
|
||||
export function isSymbolicLink(mode: number): boolean {
|
||||
return (mode & S_IFMT) === S_IFLNK;
|
||||
}
|
||||
|
||||
async function prepareSymlinkTarget(
|
||||
@@ -53,6 +53,7 @@ export async function downloadFile(
|
||||
|
||||
if (isDirectory(mode)) {
|
||||
await mkdirp(fsPath);
|
||||
await chmod(fsPath, mode);
|
||||
return FileFsRef.fromFsPath({ mode, fsPath });
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,9 @@ import { lstat, Stats } from 'fs-extra';
|
||||
import { normalizePath } from './normalize-path';
|
||||
import FileFsRef from '../file-fs-ref';
|
||||
|
||||
export type GlobOptions = vanillaGlob_.IOptions;
|
||||
export interface GlobOptions extends vanillaGlob_.IOptions {
|
||||
includeDirectories?: boolean;
|
||||
}
|
||||
|
||||
const vanillaGlob = promisify(vanillaGlob_);
|
||||
|
||||
@@ -15,7 +17,7 @@ export default async function glob(
|
||||
opts: GlobOptions | string,
|
||||
mountpoint?: string
|
||||
): Promise<Record<string, FileFsRef>> {
|
||||
const options: GlobOptions = typeof opts === 'string' ? { cwd: opts } : opts;
|
||||
const options = typeof opts === 'string' ? { cwd: opts } : opts;
|
||||
|
||||
if (!options.cwd) {
|
||||
throw new Error(
|
||||
@@ -73,18 +75,20 @@ export default async function glob(
|
||||
}
|
||||
|
||||
// Add empty directory entries
|
||||
for (const relativePath of dirs) {
|
||||
if (dirsWithEntries.has(relativePath)) continue;
|
||||
if (options.includeDirectories) {
|
||||
for (const relativePath of dirs) {
|
||||
if (dirsWithEntries.has(relativePath)) continue;
|
||||
|
||||
let finalPath = relativePath;
|
||||
if (mountpoint) {
|
||||
finalPath = path.join(mountpoint, finalPath);
|
||||
let finalPath = relativePath;
|
||||
if (mountpoint) {
|
||||
finalPath = path.join(mountpoint, finalPath);
|
||||
}
|
||||
|
||||
const fsPath = normalizePath(path.join(options.cwd, relativePath));
|
||||
const stat = statCache[fsPath];
|
||||
|
||||
results[finalPath] = new FileFsRef({ mode: stat.mode, fsPath });
|
||||
}
|
||||
|
||||
const fsPath = normalizePath(path.join(options.cwd, relativePath));
|
||||
const stat = statCache[fsPath];
|
||||
|
||||
results[finalPath] = new FileFsRef({ mode: stat.mode, fsPath });
|
||||
}
|
||||
|
||||
return results;
|
||||
|
||||
@@ -111,53 +111,6 @@ export function spawnAsync(
|
||||
});
|
||||
}
|
||||
|
||||
export function execAsync(
|
||||
command: string,
|
||||
args: string[],
|
||||
opts: SpawnOptionsExtended = {}
|
||||
) {
|
||||
return new Promise<{ stdout: string; stderr: string; code: number }>(
|
||||
(resolve, reject) => {
|
||||
opts.stdio = 'pipe';
|
||||
|
||||
const stdoutList: Buffer[] = [];
|
||||
const stderrList: Buffer[] = [];
|
||||
|
||||
const child = spawn(command, args, opts);
|
||||
|
||||
child.stderr!.on('data', data => {
|
||||
stderrList.push(data);
|
||||
});
|
||||
|
||||
child.stdout!.on('data', data => {
|
||||
stdoutList.push(data);
|
||||
});
|
||||
|
||||
child.on('error', reject);
|
||||
child.on('close', (code, signal) => {
|
||||
if (code === 0 || opts.ignoreNon0Exit) {
|
||||
return resolve({
|
||||
code,
|
||||
stdout: Buffer.concat(stdoutList).toString(),
|
||||
stderr: Buffer.concat(stderrList).toString(),
|
||||
});
|
||||
}
|
||||
|
||||
const cmd = opts.prettyCommand
|
||||
? `Command "${opts.prettyCommand}"`
|
||||
: 'Command';
|
||||
|
||||
return reject(
|
||||
new NowBuildError({
|
||||
code: `BUILD_UTILS_EXEC_${code || signal}`,
|
||||
message: `${cmd} exited with ${code || signal}`,
|
||||
})
|
||||
);
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
export function spawnCommand(command: string, options: SpawnOptions = {}) {
|
||||
const opts = { ...options, prettyCommand: command };
|
||||
if (process.platform === 'win32') {
|
||||
|
||||
@@ -8,12 +8,12 @@ import download, {
|
||||
downloadFile,
|
||||
DownloadedFiles,
|
||||
isSymbolicLink,
|
||||
isDirectory,
|
||||
} from './fs/download';
|
||||
import getWriteableDirectory from './fs/get-writable-directory';
|
||||
import glob, { GlobOptions } from './fs/glob';
|
||||
import rename from './fs/rename';
|
||||
import {
|
||||
execAsync,
|
||||
spawnAsync,
|
||||
execCommand,
|
||||
spawnCommand,
|
||||
@@ -58,7 +58,6 @@ export {
|
||||
glob,
|
||||
GlobOptions,
|
||||
rename,
|
||||
execAsync,
|
||||
spawnAsync,
|
||||
getScriptName,
|
||||
installDependencies,
|
||||
@@ -82,6 +81,7 @@ export {
|
||||
streamToBuffer,
|
||||
debug,
|
||||
isSymbolicLink,
|
||||
isDirectory,
|
||||
getLambdaOptionsFromFunction,
|
||||
scanParentDirs,
|
||||
getIgnoreFilter,
|
||||
|
||||
@@ -3,7 +3,7 @@ import Sema from 'async-sema';
|
||||
import { ZipFile } from 'yazl';
|
||||
import minimatch from 'minimatch';
|
||||
import { readlink } from 'fs-extra';
|
||||
import { isSymbolicLink } from './fs/download';
|
||||
import { isSymbolicLink, isDirectory } from './fs/download';
|
||||
import streamToBuffer from './fs/stream-to-buffer';
|
||||
import type { Files, Config } from './types';
|
||||
|
||||
@@ -200,6 +200,8 @@ export async function createZip(files: Files): Promise<Buffer> {
|
||||
const symlinkTarget = symlinkTargets.get(name);
|
||||
if (typeof symlinkTarget === 'string') {
|
||||
zipFile.addBuffer(Buffer.from(symlinkTarget, 'utf8'), name, opts);
|
||||
} else if (file.mode && isDirectory(file.mode)) {
|
||||
zipFile.addEmptyDirectory(name, opts);
|
||||
} else {
|
||||
const stream = file.toStream();
|
||||
stream.on('error', reject);
|
||||
|
||||
3
packages/build-utils/test/fixtures/15-npm-8-legacy-peer-deps/package-lock.json
generated
vendored
3
packages/build-utils/test/fixtures/15-npm-8-legacy-peer-deps/package-lock.json
generated
vendored
@@ -7,6 +7,9 @@
|
||||
"dependencies": {
|
||||
"react": "16.8.0",
|
||||
"swr": "1.3.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "16.x"
|
||||
}
|
||||
},
|
||||
"node_modules/js-tokens": {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "a",
|
||||
"name": "a21",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "b",
|
||||
"name": "b21",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "21-npm-workspaces",
|
||||
"private": true,
|
||||
"version": "1.0.0",
|
||||
"workspaces": [
|
||||
"a",
|
||||
|
||||
@@ -1,14 +1,8 @@
|
||||
{
|
||||
"name": "22-pnpm",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"build": "mkdir -p public && (printf \"pnpm version: \" && pnpm -v) > public/index.txt"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"once": "^1.4.0"
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "c",
|
||||
"name": "build-c23",
|
||||
"license": "MIT",
|
||||
"version": "0.1.0"
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "d",
|
||||
"name": "build-d23",
|
||||
"license": "MIT",
|
||||
"version": "0.1.0",
|
||||
"devDependencies": {
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
{
|
||||
"private": "true",
|
||||
"name": "24-pnpm-hoisted",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"build": "ls -Al node_modules && node index.js"
|
||||
},
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "a",
|
||||
"name": "build-a25",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "b",
|
||||
"name": "build-b25",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
{
|
||||
"private": "true",
|
||||
"name": "25-multiple-lock-files-yarn",
|
||||
"private": true,
|
||||
"workspaces": [
|
||||
"a",
|
||||
"b"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "a",
|
||||
"name": "build-a26",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "b",
|
||||
"name": "build-b26",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
{
|
||||
"private": "true",
|
||||
"name": "26-multiple-lock-files-pnpm",
|
||||
"private": true,
|
||||
"workspaces": [
|
||||
"a",
|
||||
"b"
|
||||
|
||||
25
packages/build-utils/test/unit.clone-env.test.ts
vendored
25
packages/build-utils/test/unit.clone-env.test.ts
vendored
@@ -36,6 +36,31 @@ it('should clone env with PATH', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('should not overwrite PATH when path is undefined', () => {
|
||||
expect(
|
||||
cloneEnv(
|
||||
{
|
||||
PATH: 'baz',
|
||||
},
|
||||
new Proxy(
|
||||
{
|
||||
Path: undefined,
|
||||
},
|
||||
{
|
||||
get(target: typeof process.env, prop: string) {
|
||||
if (prop === 'PATH') {
|
||||
return target.PATH ?? target.Path;
|
||||
}
|
||||
return target[prop];
|
||||
},
|
||||
}
|
||||
)
|
||||
)
|
||||
).toEqual({
|
||||
PATH: 'baz',
|
||||
});
|
||||
});
|
||||
|
||||
it('should clone and merge multiple env objects', () => {
|
||||
// note: this also tests the last object doesn't overwrite `PATH` with
|
||||
// `undefined`
|
||||
|
||||
18
packages/build-utils/test/unit.download.test.ts
vendored
18
packages/build-utils/test/unit.download.test.ts
vendored
@@ -159,7 +159,7 @@ describe('download()', () => {
|
||||
await fs.remove(outDir);
|
||||
const files = {
|
||||
'empty-dir': new FileBlob({
|
||||
mode: 16877,
|
||||
mode: 16877, // drwxr-xr-x
|
||||
contentType: undefined,
|
||||
data: '',
|
||||
}),
|
||||
@@ -174,7 +174,7 @@ describe('download()', () => {
|
||||
data: '',
|
||||
}),
|
||||
'another/subdir': new FileBlob({
|
||||
mode: 16877,
|
||||
mode: 16895, // drwxrwxrwx
|
||||
contentType: undefined,
|
||||
data: '',
|
||||
}),
|
||||
@@ -182,14 +182,14 @@ describe('download()', () => {
|
||||
|
||||
await download(files, outDir);
|
||||
|
||||
const stats = await Promise.all([
|
||||
fs.lstat(path.join(outDir, 'empty-dir')),
|
||||
fs.lstat(path.join(outDir, 'dir')),
|
||||
fs.lstat(path.join(outDir, 'dir/subdir')),
|
||||
fs.lstat(path.join(outDir, 'another/subdir')),
|
||||
]);
|
||||
for (const stat of stats) {
|
||||
for (const [p, f] of Object.entries(files)) {
|
||||
const stat = await fs.lstat(path.join(outDir, p));
|
||||
expect(stat.isDirectory()).toEqual(true);
|
||||
|
||||
if (process.platform !== 'win32') {
|
||||
// Don't test Windows since it doesn't support the same permissions
|
||||
expect(stat.mode).toEqual(f.mode);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
import { execAsync, NowBuildError } from '../src';
|
||||
|
||||
it('should execute a command', async () => {
|
||||
const { code, stdout, stderr } = await execAsync('echo', ['hello']);
|
||||
|
||||
expect(code).toBe(0);
|
||||
expect(stdout).toContain('hello');
|
||||
expect(stderr).toBe('');
|
||||
});
|
||||
|
||||
it('should throw if the command exits with non-0 code', async () => {
|
||||
await expect(execAsync('find', ['unknown-file'])).rejects.toBeInstanceOf(
|
||||
NowBuildError
|
||||
);
|
||||
});
|
||||
|
||||
it('should return if the command exits with non-0 code and ignoreNon0Exit=true', async () => {
|
||||
const { code, stdout, stderr } = await execAsync('find', ['unknown-file'], {
|
||||
ignoreNon0Exit: true,
|
||||
});
|
||||
|
||||
expect(code).toBe(process.platform === 'win32' ? 2 : 1);
|
||||
expect(stdout).toBe('');
|
||||
expect(stderr).toContain(
|
||||
process.platform === 'win32'
|
||||
? 'Parameter format not correct'
|
||||
: 'No such file or directory'
|
||||
);
|
||||
});
|
||||
38
packages/build-utils/test/unit.glob.test.ts
vendored
38
packages/build-utils/test/unit.glob.test.ts
vendored
@@ -1,16 +1,10 @@
|
||||
import fs from 'fs-extra';
|
||||
import { join } from 'path';
|
||||
import { tmpdir } from 'os';
|
||||
import { glob } from '../src';
|
||||
|
||||
function isDirectory(mode: number): boolean {
|
||||
const stat = new fs.Stats();
|
||||
stat.mode = mode;
|
||||
return stat.isDirectory();
|
||||
}
|
||||
import { glob, isDirectory } from '../src';
|
||||
|
||||
describe('glob()', () => {
|
||||
it('should return entries for empty directories', async () => {
|
||||
it('should not return entries for empty directories by default', async () => {
|
||||
const dir = await fs.mkdtemp(join(tmpdir(), 'build-utils-test'));
|
||||
try {
|
||||
await Promise.all([
|
||||
@@ -25,6 +19,33 @@ describe('glob()', () => {
|
||||
]);
|
||||
const files = await glob('**', dir);
|
||||
const fileNames = Object.keys(files).sort();
|
||||
expect(fileNames).toHaveLength(2);
|
||||
expect(fileNames).toEqual(['dir-with-file/data.json', 'root.txt']);
|
||||
expect(isDirectory(files['dir-with-file/data.json'].mode)).toEqual(false);
|
||||
expect(isDirectory(files['root.txt'].mode)).toEqual(false);
|
||||
expect(files['dir-with-file']).toBeUndefined();
|
||||
expect(files['another/subdir']).toBeUndefined();
|
||||
expect(files['empty-dir']).toBeUndefined();
|
||||
} finally {
|
||||
await fs.remove(dir);
|
||||
}
|
||||
});
|
||||
|
||||
it('should return entries for empty directories with `includeDirectories: true`', async () => {
|
||||
const dir = await fs.mkdtemp(join(tmpdir(), 'build-utils-test'));
|
||||
try {
|
||||
await Promise.all([
|
||||
fs.writeFile(join(dir, 'root.txt'), 'file at the root'),
|
||||
fs.mkdirp(join(dir, 'empty-dir')),
|
||||
fs
|
||||
.mkdirp(join(dir, 'dir-with-file'))
|
||||
.then(() =>
|
||||
fs.writeFile(join(dir, 'dir-with-file/data.json'), '{"a":"b"}')
|
||||
),
|
||||
fs.mkdirp(join(dir, 'another/subdir')),
|
||||
]);
|
||||
const files = await glob('**', { cwd: dir, includeDirectories: true });
|
||||
const fileNames = Object.keys(files).sort();
|
||||
expect(fileNames).toHaveLength(4);
|
||||
expect(fileNames).toEqual([
|
||||
'another/subdir',
|
||||
@@ -36,6 +57,7 @@ describe('glob()', () => {
|
||||
expect(isDirectory(files['empty-dir'].mode)).toEqual(true);
|
||||
expect(isDirectory(files['dir-with-file/data.json'].mode)).toEqual(false);
|
||||
expect(isDirectory(files['root.txt'].mode)).toEqual(false);
|
||||
expect(files['dir-with-file']).toBeUndefined();
|
||||
} finally {
|
||||
await fs.remove(dir);
|
||||
}
|
||||
|
||||
97
packages/build-utils/test/unit.lambda.test.ts
vendored
Normal file
97
packages/build-utils/test/unit.lambda.test.ts
vendored
Normal file
@@ -0,0 +1,97 @@
|
||||
import path from 'path';
|
||||
import { tmpdir } from 'os';
|
||||
import fs from 'fs-extra';
|
||||
import { createZip } from '../src/lambda';
|
||||
import { FileBlob, glob, spawnAsync } from '../src';
|
||||
|
||||
const MODE_DIRECTORY = 16877; /* drwxr-xr-x */
|
||||
const MODE_FILE = 33188; /* -rw-r--r-- */
|
||||
|
||||
describe('Lambda', () => {
|
||||
it('should create zip file with symlinks', async () => {
|
||||
if (process.platform === 'win32') {
|
||||
console.log('Skipping test on windows');
|
||||
return;
|
||||
}
|
||||
const files = await glob('**', path.join(__dirname, 'symlinks'));
|
||||
expect(Object.keys(files)).toHaveLength(4);
|
||||
|
||||
const outFile = path.join(__dirname, 'symlinks.zip');
|
||||
await fs.remove(outFile);
|
||||
|
||||
const outDir = path.join(__dirname, 'symlinks-out');
|
||||
await fs.remove(outDir);
|
||||
await fs.mkdirp(outDir);
|
||||
|
||||
await fs.writeFile(outFile, await createZip(files));
|
||||
await spawnAsync('unzip', [outFile], { cwd: outDir });
|
||||
|
||||
const [linkStat, linkDirStat, aStat] = await Promise.all([
|
||||
fs.lstat(path.join(outDir, 'link.txt')),
|
||||
fs.lstat(path.join(outDir, 'link-dir')),
|
||||
fs.lstat(path.join(outDir, 'a.txt')),
|
||||
]);
|
||||
expect(linkStat.isSymbolicLink()).toEqual(true);
|
||||
expect(linkDirStat.isSymbolicLink()).toEqual(true);
|
||||
expect(aStat.isFile()).toEqual(true);
|
||||
});
|
||||
|
||||
it('should create zip file with empty directory', async () => {
|
||||
if (process.platform === 'win32') {
|
||||
console.log('Skipping test on windows');
|
||||
return;
|
||||
}
|
||||
|
||||
const dir = await fs.mkdtemp(path.join(tmpdir(), 'create-zip-empty-dir'));
|
||||
try {
|
||||
const files = {
|
||||
a: new FileBlob({
|
||||
data: 'contents',
|
||||
mode: MODE_FILE,
|
||||
}),
|
||||
empty: new FileBlob({
|
||||
data: '',
|
||||
mode: MODE_DIRECTORY,
|
||||
}),
|
||||
'b/a': new FileBlob({
|
||||
data: 'inside dir b',
|
||||
mode: MODE_FILE,
|
||||
}),
|
||||
c: new FileBlob({
|
||||
data: '',
|
||||
mode: MODE_DIRECTORY,
|
||||
}),
|
||||
'c/a': new FileBlob({
|
||||
data: 'inside dir c',
|
||||
mode: MODE_FILE,
|
||||
}),
|
||||
};
|
||||
|
||||
const outFile = path.join(dir, 'lambda.zip');
|
||||
|
||||
const outDir = path.join(dir, 'out');
|
||||
await fs.mkdirp(outDir);
|
||||
|
||||
await fs.writeFile(outFile, await createZip(files));
|
||||
await spawnAsync('unzip', [outFile], { cwd: outDir });
|
||||
|
||||
expect(fs.statSync(path.join(outDir, 'empty')).isDirectory()).toEqual(
|
||||
true
|
||||
);
|
||||
expect(fs.statSync(path.join(outDir, 'b')).isDirectory()).toEqual(true);
|
||||
expect(fs.statSync(path.join(outDir, 'c')).isDirectory()).toEqual(true);
|
||||
expect(fs.readFileSync(path.join(outDir, 'a'), 'utf8')).toEqual(
|
||||
'contents'
|
||||
);
|
||||
expect(fs.readFileSync(path.join(outDir, 'b/a'), 'utf8')).toEqual(
|
||||
'inside dir b'
|
||||
);
|
||||
expect(fs.readFileSync(path.join(outDir, 'c/a'), 'utf8')).toEqual(
|
||||
'inside dir c'
|
||||
);
|
||||
expect(fs.readdirSync(path.join(outDir, 'empty'))).toHaveLength(0);
|
||||
} finally {
|
||||
await fs.remove(dir);
|
||||
}
|
||||
});
|
||||
});
|
||||
65
packages/build-utils/test/unit.test.ts
vendored
65
packages/build-utils/test/unit.test.ts
vendored
@@ -2,11 +2,8 @@ import ms from 'ms';
|
||||
import path from 'path';
|
||||
import fs from 'fs-extra';
|
||||
import { strict as assert } from 'assert';
|
||||
import { createZip } from '../src/lambda';
|
||||
import { getSupportedNodeVersion } from '../src/fs/node-version';
|
||||
import {
|
||||
glob,
|
||||
spawnAsync,
|
||||
getNodeVersion,
|
||||
getLatestNodeVersion,
|
||||
getDiscontinuedNodeVersions,
|
||||
@@ -49,34 +46,6 @@ afterEach(() => {
|
||||
console.warn = originalConsoleWarn;
|
||||
});
|
||||
|
||||
it('should create zip files with symlinks properly', async () => {
|
||||
if (process.platform === 'win32') {
|
||||
console.log('Skipping test on windows');
|
||||
return;
|
||||
}
|
||||
const files = await glob('**', path.join(__dirname, 'symlinks'));
|
||||
assert.equal(Object.keys(files).length, 4);
|
||||
|
||||
const outFile = path.join(__dirname, 'symlinks.zip');
|
||||
await fs.remove(outFile);
|
||||
|
||||
const outDir = path.join(__dirname, 'symlinks-out');
|
||||
await fs.remove(outDir);
|
||||
await fs.mkdirp(outDir);
|
||||
|
||||
await fs.writeFile(outFile, await createZip(files));
|
||||
await spawnAsync('unzip', [outFile], { cwd: outDir });
|
||||
|
||||
const [linkStat, linkDirStat, aStat] = await Promise.all([
|
||||
fs.lstat(path.join(outDir, 'link.txt')),
|
||||
fs.lstat(path.join(outDir, 'link-dir')),
|
||||
fs.lstat(path.join(outDir, 'a.txt')),
|
||||
]);
|
||||
assert(linkStat.isSymbolicLink());
|
||||
assert(linkDirStat.isSymbolicLink());
|
||||
assert(aStat.isFile());
|
||||
});
|
||||
|
||||
it('should only match supported node versions, otherwise throw an error', async () => {
|
||||
expect(await getSupportedNodeVersion('14.x', false)).toHaveProperty(
|
||||
'major',
|
||||
@@ -335,21 +304,21 @@ it('should support initialHeaders and initialStatus correctly', async () => {
|
||||
});
|
||||
|
||||
it('should support require by path for legacy builders', () => {
|
||||
const index = require('@vercel/build-utils');
|
||||
const index = require('../');
|
||||
|
||||
const download2 = require('@vercel/build-utils/fs/download.js');
|
||||
const getWriteableDirectory2 = require('@vercel/build-utils/fs/get-writable-directory.js');
|
||||
const glob2 = require('@vercel/build-utils/fs/glob.js');
|
||||
const rename2 = require('@vercel/build-utils/fs/rename.js');
|
||||
const download2 = require('../fs/download.js');
|
||||
const getWriteableDirectory2 = require('../fs/get-writable-directory.js');
|
||||
const glob2 = require('../fs/glob.js');
|
||||
const rename2 = require('../fs/rename.js');
|
||||
const {
|
||||
runNpmInstall: runNpmInstall2,
|
||||
} = require('@vercel/build-utils/fs/run-user-scripts.js');
|
||||
const streamToBuffer2 = require('@vercel/build-utils/fs/stream-to-buffer.js');
|
||||
} = require('../fs/run-user-scripts.js');
|
||||
const streamToBuffer2 = require('../fs/stream-to-buffer.js');
|
||||
|
||||
const FileBlob2 = require('@vercel/build-utils/file-blob.js');
|
||||
const FileFsRef2 = require('@vercel/build-utils/file-fs-ref.js');
|
||||
const FileRef2 = require('@vercel/build-utils/file-ref.js');
|
||||
const { Lambda: Lambda2 } = require('@vercel/build-utils/lambda.js');
|
||||
const FileBlob2 = require('../file-blob.js');
|
||||
const FileFsRef2 = require('../file-fs-ref.js');
|
||||
const FileRef2 = require('../file-ref.js');
|
||||
const { Lambda: Lambda2 } = require('../lambda.js');
|
||||
|
||||
expect(download2).toBe(index.download);
|
||||
expect(getWriteableDirectory2).toBe(index.getWriteableDirectory);
|
||||
@@ -451,9 +420,9 @@ it('should detect package.json in nested backend', async () => {
|
||||
'../../node/test/fixtures/18.1-nested-packagejson/backend'
|
||||
);
|
||||
const result = await scanParentDirs(fixture);
|
||||
expect(result.cliType).toEqual('yarn');
|
||||
expect(result.lockfileVersion).toEqual(undefined);
|
||||
// There is no lockfile but this test will pick up vercel/vercel/yarn.lock
|
||||
expect(result.cliType).toEqual('pnpm');
|
||||
// There is no lockfile but this test will pick up vercel/vercel/pnpm-lock.yaml
|
||||
expect(result.lockfileVersion).toEqual(5.4);
|
||||
expect(result.packageJsonPath).toEqual(path.join(fixture, 'package.json'));
|
||||
});
|
||||
|
||||
@@ -463,9 +432,9 @@ it('should detect package.json in nested frontend', async () => {
|
||||
'../../node/test/fixtures/18.1-nested-packagejson/frontend'
|
||||
);
|
||||
const result = await scanParentDirs(fixture);
|
||||
expect(result.cliType).toEqual('yarn');
|
||||
expect(result.lockfileVersion).toEqual(undefined);
|
||||
// There is no lockfile but this test will pick up vercel/vercel/yarn.lock
|
||||
expect(result.cliType).toEqual('pnpm');
|
||||
// There is no lockfile but this test will pick up vercel/vercel/pnpm-lock.yaml
|
||||
expect(result.lockfileVersion).toEqual(5.4);
|
||||
expect(result.packageJsonPath).toEqual(path.join(fixture, 'package.json'));
|
||||
});
|
||||
|
||||
|
||||
14
packages/build-utils/test/unit.walk.test.ts
vendored
14
packages/build-utils/test/unit.walk.test.ts
vendored
@@ -2,7 +2,7 @@ import { walkParentDirs } from '../src';
|
||||
import { strict } from 'assert';
|
||||
import { join } from 'path';
|
||||
import { promises } from 'fs';
|
||||
const { deepEqual, notDeepEqual, fail } = strict;
|
||||
const { notDeepEqual, fail } = strict;
|
||||
const { readFile } = promises;
|
||||
const fixture = (name: string) => join(__dirname, 'walk', name);
|
||||
const filename = 'file.txt';
|
||||
@@ -10,7 +10,7 @@ const filename = 'file.txt';
|
||||
async function assertContent(target: string | null, contents: string) {
|
||||
notDeepEqual(target, null);
|
||||
const actual = await readFile(target!, 'utf8');
|
||||
deepEqual(actual.trim(), contents.trim());
|
||||
strict.deepEqual(actual.trim(), contents.trim());
|
||||
}
|
||||
|
||||
describe('Test `walkParentDirs`', () => {
|
||||
@@ -21,7 +21,7 @@ describe('Test `walkParentDirs`', () => {
|
||||
await walkParentDirs({ base, start, filename });
|
||||
fail('Expected error');
|
||||
} catch (error) {
|
||||
deepEqual(
|
||||
strict.deepEqual(
|
||||
(error as Error).message,
|
||||
'Expected "base" to be absolute path'
|
||||
);
|
||||
@@ -35,7 +35,7 @@ describe('Test `walkParentDirs`', () => {
|
||||
await walkParentDirs({ base, start, filename });
|
||||
fail('Expected error');
|
||||
} catch (error) {
|
||||
deepEqual(
|
||||
strict.deepEqual(
|
||||
(error as Error).message,
|
||||
'Expected "start" to be absolute path'
|
||||
);
|
||||
@@ -67,21 +67,21 @@ describe('Test `walkParentDirs`', () => {
|
||||
const base = fixture('not-found');
|
||||
const start = base;
|
||||
const target = await walkParentDirs({ base, start, filename });
|
||||
deepEqual(target, null);
|
||||
strict.deepEqual(target, null);
|
||||
});
|
||||
|
||||
it('should not find nested two', async () => {
|
||||
const base = fixture('not-found');
|
||||
const start = join(base, 'two');
|
||||
const target = await walkParentDirs({ base, start, filename });
|
||||
deepEqual(target, null);
|
||||
strict.deepEqual(target, null);
|
||||
});
|
||||
|
||||
it('should not find nested three', async () => {
|
||||
const base = fixture('not-found');
|
||||
const start = join(base, 'two', 'three');
|
||||
const target = await walkParentDirs({ base, start, filename });
|
||||
deepEqual(target, null);
|
||||
strict.deepEqual(target, null);
|
||||
});
|
||||
|
||||
it('should find only one', async () => {
|
||||
|
||||
@@ -41,8 +41,8 @@ To develop Vercel CLI, first check out the source code, install dependencies, an
|
||||
```bash
|
||||
git clone https://github.com/vercel/vercel.git
|
||||
cd vercel
|
||||
yarn
|
||||
yarn build
|
||||
pnpm install
|
||||
pnpm build
|
||||
```
|
||||
|
||||
At this point you can make modifications to the CLI source code and test them out locally. The CLI source code is located in the `packages/cli` directory.
|
||||
@@ -51,15 +51,15 @@ At this point you can make modifications to the CLI source code and test them ou
|
||||
cd packages/cli
|
||||
```
|
||||
|
||||
### `yarn dev <cli-commands...>`
|
||||
### `pnpm dev <cli-commands...>`
|
||||
|
||||
From within the `packages/cli` directory, you can use the "dev" script to quickly execute Vercel CLI from its TypeScript source code directly (without having to manually compile first). For example:
|
||||
|
||||
```bash
|
||||
yarn dev deploy
|
||||
yarn dev whoami
|
||||
yarn dev login
|
||||
yarn dev switch --debug
|
||||
pnpm dev deploy
|
||||
pnpm dev whoami
|
||||
pnpm dev login
|
||||
pnpm dev switch --debug
|
||||
```
|
||||
|
||||
When you are satisfied with your changes, make a commit and create a pull request!
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "vercel",
|
||||
"version": "28.10.1",
|
||||
"version": "28.13.2",
|
||||
"preferGlobal": true,
|
||||
"license": "Apache-2.0",
|
||||
"description": "The command-line interface for Vercel",
|
||||
@@ -13,9 +13,9 @@
|
||||
"scripts": {
|
||||
"preinstall": "node ./scripts/preinstall.js",
|
||||
"test": "jest --env node --verbose --bail",
|
||||
"test-unit": "yarn test test/unit/",
|
||||
"test-unit": "pnpm test test/unit/",
|
||||
"test-integration-cli": "rimraf test/fixtures/integration && ava test/integration.js --serial --fail-fast --verbose",
|
||||
"test-integration-dev": "yarn test test/dev/",
|
||||
"test-integration-dev": "pnpm test test/dev/",
|
||||
"coverage": "codecov",
|
||||
"build": "ts-node ./scripts/build.ts",
|
||||
"dev": "ts-node ./src/index.ts"
|
||||
@@ -41,17 +41,16 @@
|
||||
"node": ">= 14"
|
||||
},
|
||||
"dependencies": {
|
||||
"@vercel/build-utils": "5.7.2",
|
||||
"@vercel/go": "2.2.21",
|
||||
"@vercel/hydrogen": "0.0.35",
|
||||
"@vercel/next": "3.3.5",
|
||||
"@vercel/node": "2.8.2",
|
||||
"@vercel/python": "3.1.31",
|
||||
"@vercel/redwood": "1.0.41",
|
||||
"@vercel/remix": "1.1.3",
|
||||
"@vercel/ruby": "1.3.47",
|
||||
"@vercel/static-build": "1.0.44",
|
||||
"update-notifier": "5.1.0"
|
||||
"@vercel/build-utils": "6.0.0",
|
||||
"@vercel/go": "2.2.31",
|
||||
"@vercel/hydrogen": "0.0.45",
|
||||
"@vercel/next": "3.3.19",
|
||||
"@vercel/node": "2.8.16",
|
||||
"@vercel/python": "3.1.41",
|
||||
"@vercel/redwood": "1.0.52",
|
||||
"@vercel/remix": "1.2.8",
|
||||
"@vercel/ruby": "1.3.57",
|
||||
"@vercel/static-build": "1.2.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@alex_neo/jest-expect-message": "1.0.5",
|
||||
@@ -84,6 +83,7 @@
|
||||
"@types/npm-package-arg": "6.1.0",
|
||||
"@types/pluralize": "0.0.29",
|
||||
"@types/psl": "1.1.0",
|
||||
"@types/qs": "6.9.7",
|
||||
"@types/semver": "6.0.1",
|
||||
"@types/tar-fs": "1.16.1",
|
||||
"@types/text-table": "0.2.0",
|
||||
@@ -93,12 +93,13 @@
|
||||
"@types/which": "1.3.2",
|
||||
"@types/write-json-file": "2.2.1",
|
||||
"@types/yauzl-promise": "2.1.0",
|
||||
"@vercel/client": "12.2.23",
|
||||
"@vercel/error-utils": "1.0.3",
|
||||
"@vercel/frameworks": "1.1.16",
|
||||
"@vercel/fs-detectors": "3.5.6",
|
||||
"@vercel/client": "12.3.3",
|
||||
"@vercel/error-utils": "1.0.8",
|
||||
"@vercel/frameworks": "1.3.0",
|
||||
"@vercel/fs-detectors": "3.7.6",
|
||||
"@vercel/fun": "1.0.4",
|
||||
"@vercel/ncc": "0.24.0",
|
||||
"@vercel/routing-utils": "2.1.8",
|
||||
"@zeit/source-map-support": "0.6.2",
|
||||
"ajv": "6.12.2",
|
||||
"alpha-sort": "2.0.1",
|
||||
@@ -138,6 +139,7 @@
|
||||
"is-port-reachable": "3.1.0",
|
||||
"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",
|
||||
@@ -169,7 +171,7 @@
|
||||
"tmp-promise": "1.0.3",
|
||||
"tree-kill": "1.2.2",
|
||||
"ts-node": "10.9.1",
|
||||
"typescript": "4.7.4",
|
||||
"typescript": "4.9.4",
|
||||
"universal-analytics": "0.4.20",
|
||||
"utility-types": "2.1.0",
|
||||
"write-json-file": "2.2.0",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import cpy from 'cpy';
|
||||
import execa from 'execa';
|
||||
import { join } from 'path';
|
||||
import { remove, writeFile } from 'fs-extra';
|
||||
import { remove, readJSON, writeFile } from 'fs-extra';
|
||||
|
||||
const dirRoot = join(__dirname, '..');
|
||||
const distRoot = join(dirRoot, 'dist');
|
||||
@@ -43,16 +43,16 @@ async function main() {
|
||||
stdio: 'inherit',
|
||||
});
|
||||
|
||||
const pkg = await readJSON(join(dirRoot, 'package.json'));
|
||||
const dependencies = Object.keys(pkg?.dependencies ?? {});
|
||||
// Do the initial `ncc` build
|
||||
console.log();
|
||||
const args = [
|
||||
'ncc',
|
||||
'build',
|
||||
'--external',
|
||||
'update-notifier',
|
||||
'src/index.ts',
|
||||
];
|
||||
await execa('yarn', args, { stdio: 'inherit', cwd: dirRoot });
|
||||
console.log('Dependencies:', dependencies);
|
||||
const externs: Array<string> = [];
|
||||
for (const dep of dependencies) {
|
||||
externs.push('--external', dep);
|
||||
}
|
||||
const args = ['ncc', 'build', 'src/index.ts', ...externs];
|
||||
await execa('pnpm', args, { stdio: 'inherit', cwd: dirRoot });
|
||||
|
||||
// `ncc` has some issues with `@vercel/fun`'s runtime files:
|
||||
// - Executable bits on the `bootstrap` files appear to be lost:
|
||||
@@ -66,10 +66,7 @@ async function main() {
|
||||
// get compiled into the final ncc bundle file, however, we want them to be
|
||||
// present in the npm package because the contents of those files are involved
|
||||
// with `fun`'s cache invalidation mechanism and they need to be shasum'd.
|
||||
const runtimes = join(
|
||||
dirRoot,
|
||||
'../../node_modules/@vercel/fun/dist/src/runtimes'
|
||||
);
|
||||
const runtimes = join(dirRoot, 'node_modules/@vercel/fun/dist/src/runtimes');
|
||||
await cpy('**/*', join(distRoot, 'runtimes'), {
|
||||
parents: true,
|
||||
cwd: runtimes,
|
||||
@@ -78,6 +75,10 @@ async function main() {
|
||||
// Band-aid to bundle stuff that `ncc` neglects to bundle
|
||||
await cpy(join(dirRoot, 'src/util/projects/VERCEL_DIR_README.txt'), distRoot);
|
||||
await cpy(join(dirRoot, 'src/util/dev/builder-worker.js'), distRoot);
|
||||
await cpy(
|
||||
join(dirRoot, 'src/util/get-latest-version/get-latest-worker.js'),
|
||||
distRoot
|
||||
);
|
||||
|
||||
console.log('Finished building Vercel CLI');
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ export default async function ls(
|
||||
...paginationOptions
|
||||
);
|
||||
output.log(`aliases found under ${chalk.bold(contextName)} ${lsStamp()}`);
|
||||
output.log(printAliasTable(aliases));
|
||||
client.stdout.write(printAliasTable(aliases));
|
||||
|
||||
if (pagination && pagination.count === 20) {
|
||||
const flags = getCommandFlags(opts, ['_', '--next']);
|
||||
|
||||
@@ -6,7 +6,7 @@ import { Output } from '../../util/output';
|
||||
import * as ERRORS from '../../util/errors-ts';
|
||||
import assignAlias from '../../util/alias/assign-alias';
|
||||
import Client from '../../util/client';
|
||||
import getDeploymentByIdOrHost from '../../util/deploy/get-deployment-by-id-or-host';
|
||||
import getDeployment from '../../util/get-deployment';
|
||||
import { getDeploymentForAlias } from '../../util/alias/get-deployment-by-alias';
|
||||
import getScope from '../../util/get-scope';
|
||||
import setupDomain from '../../util/domains/setup-domain';
|
||||
@@ -136,36 +136,13 @@ export default async function set(
|
||||
const [deploymentIdOrHost, aliasTarget] = args;
|
||||
const deployment = handleCertError(
|
||||
output,
|
||||
await getDeploymentByIdOrHost(client, contextName, deploymentIdOrHost)
|
||||
await getDeployment(client, contextName, deploymentIdOrHost)
|
||||
);
|
||||
|
||||
if (deployment === 1) {
|
||||
return deployment;
|
||||
}
|
||||
|
||||
if (deployment instanceof ERRORS.DeploymentNotFound) {
|
||||
output.error(
|
||||
`Failed to find deployment "${deployment.meta.id}" under ${chalk.bold(
|
||||
contextName
|
||||
)}`
|
||||
);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (deployment instanceof ERRORS.DeploymentPermissionDenied) {
|
||||
output.error(
|
||||
`No permission to access deployment "${
|
||||
deployment.meta.id
|
||||
}" under ${chalk.bold(deployment.meta.context)}`
|
||||
);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (deployment instanceof ERRORS.InvalidDeploymentId) {
|
||||
output.error(deployment.message);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (deployment === null) {
|
||||
output.error(
|
||||
`Couldn't find a deployment to alias. Please provide one as an argument.`
|
||||
|
||||
@@ -15,17 +15,11 @@ import Client from '../../util/client';
|
||||
import { getPkgName } from '../../util/pkg-name';
|
||||
import { Deployment, PaginationOptions } from '../../types';
|
||||
import { normalizeURL } from '../../util/bisect/normalize-url';
|
||||
|
||||
interface DeploymentV6
|
||||
extends Pick<
|
||||
Deployment,
|
||||
'url' | 'target' | 'projectId' | 'ownerId' | 'meta' | 'inspectorUrl'
|
||||
> {
|
||||
createdAt: number;
|
||||
}
|
||||
import getScope from '../../util/get-scope';
|
||||
import getDeployment from '../../util/get-deployment';
|
||||
|
||||
interface Deployments {
|
||||
deployments: DeploymentV6[];
|
||||
deployments: Deployment[];
|
||||
pagination: PaginationOptions;
|
||||
}
|
||||
|
||||
@@ -63,6 +57,8 @@ const help = () => {
|
||||
|
||||
export default async function main(client: Client): Promise<number> {
|
||||
const { output } = client;
|
||||
const scope = await getScope(client);
|
||||
const { contextName } = scope;
|
||||
|
||||
const argv = getArgs(client.argv.slice(2), {
|
||||
'--bad': String,
|
||||
@@ -145,7 +141,9 @@ export default async function main(client: Client): Promise<number> {
|
||||
output.spinner('Retrieving deployments…');
|
||||
|
||||
// `getDeployment` cannot be parallelized because it might prompt for login
|
||||
const badDeployment = await getDeployment(client, bad).catch(err => err);
|
||||
const badDeployment = await getDeployment(client, contextName, bad).catch(
|
||||
err => err
|
||||
);
|
||||
|
||||
if (badDeployment) {
|
||||
if (badDeployment instanceof Error) {
|
||||
@@ -162,7 +160,9 @@ export default async function main(client: Client): Promise<number> {
|
||||
}
|
||||
|
||||
// `getDeployment` cannot be parallelized because it might prompt for login
|
||||
const goodDeployment = await getDeployment(client, good).catch(err => err);
|
||||
const goodDeployment = await getDeployment(client, contextName, good).catch(
|
||||
err => err
|
||||
);
|
||||
|
||||
if (goodDeployment) {
|
||||
if (goodDeployment instanceof Error) {
|
||||
@@ -204,7 +204,7 @@ export default async function main(client: Client): Promise<number> {
|
||||
}
|
||||
|
||||
// Fetch all the project's "READY" deployments with the pagination API
|
||||
let deployments: DeploymentV6[] = [];
|
||||
let deployments: Deployment[] = [];
|
||||
let next: number | undefined = badDeployment.createdAt + 1;
|
||||
do {
|
||||
const query = new URLSearchParams();
|
||||
@@ -279,7 +279,7 @@ export default async function main(client: Client): Promise<number> {
|
||||
const commit = getCommit(deployment);
|
||||
if (commit) {
|
||||
const shortSha = commit.sha.substring(0, 7);
|
||||
const firstLine = commit.message.split('\n')[0];
|
||||
const firstLine = commit.message?.split('\n')[0];
|
||||
output.log(`${chalk.bold('Commit:')} [${shortSha}] ${firstLine}`);
|
||||
}
|
||||
|
||||
@@ -356,7 +356,7 @@ export default async function main(client: Client): Promise<number> {
|
||||
const commit = getCommit(lastBad);
|
||||
if (commit) {
|
||||
const shortSha = commit.sha.substring(0, 7);
|
||||
const firstLine = commit.message.split('\n')[0];
|
||||
const firstLine = commit.message?.split('\n')[0];
|
||||
result.push(` ${chalk.bold('Commit:')} [${shortSha}] ${firstLine}`);
|
||||
}
|
||||
|
||||
@@ -368,18 +368,7 @@ export default async function main(client: Client): Promise<number> {
|
||||
return 0;
|
||||
}
|
||||
|
||||
function getDeployment(
|
||||
client: Client,
|
||||
hostname: string
|
||||
): Promise<DeploymentV6> {
|
||||
const query = new URLSearchParams();
|
||||
query.set('url', hostname);
|
||||
query.set('resolve', '1');
|
||||
query.set('noState', '1');
|
||||
return client.fetch<DeploymentV6>(`/v10/deployments/get?${query}`);
|
||||
}
|
||||
|
||||
function getCommit(deployment: DeploymentV6) {
|
||||
function getCommit(deployment: Deployment) {
|
||||
const sha =
|
||||
deployment.meta?.githubCommitSha ||
|
||||
deployment.meta?.gitlabCommitSha ||
|
||||
|
||||
@@ -17,7 +17,11 @@ import {
|
||||
BuildResultV3,
|
||||
NowBuildError,
|
||||
} from '@vercel/build-utils';
|
||||
import { detectBuilders } from '@vercel/fs-detectors';
|
||||
import {
|
||||
detectBuilders,
|
||||
detectFrameworkRecord,
|
||||
LocalFileSystemDetector,
|
||||
} from '@vercel/fs-detectors';
|
||||
import minimatch from 'minimatch';
|
||||
import {
|
||||
appendRoutesToPhase,
|
||||
@@ -59,6 +63,9 @@ import { toEnumerableError } from '../util/error';
|
||||
import { validateConfig } from '../util/validate-config';
|
||||
|
||||
import { setMonorepoDefaultSettings } from '../util/build/monorepo';
|
||||
import frameworks from '@vercel/frameworks';
|
||||
import { detectFrameworkVersion } from '@vercel/fs-detectors';
|
||||
import semver from 'semver';
|
||||
|
||||
type BuildResult = BuildResultV2 | BuildResultV3;
|
||||
|
||||
@@ -69,6 +76,20 @@ interface SerializedBuilder extends Builder {
|
||||
apiVersion: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build Output API `config.json` file interface.
|
||||
*/
|
||||
interface BuildOutputConfig {
|
||||
version?: 3;
|
||||
wildcard?: BuildResultV2Typical['wildcard'];
|
||||
images?: BuildResultV2Typical['images'];
|
||||
routes?: BuildResultV2Typical['routes'];
|
||||
overrides?: Record<string, PathOverride>;
|
||||
framework?: {
|
||||
version: string;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Contents of the `builds.json` file.
|
||||
*/
|
||||
@@ -434,7 +455,7 @@ async function doBuild(
|
||||
// Execute Builders for detected entrypoints
|
||||
// TODO: parallelize builds (except for frontend)
|
||||
const sortedBuilders = sortBuilders(builds);
|
||||
const buildResults: Map<Builder, BuildResult> = new Map();
|
||||
const buildResults: Map<Builder, BuildResult | BuildOutputConfig> = new Map();
|
||||
const overrides: PathOverride[] = [];
|
||||
const repoRootPath = cwd;
|
||||
const corepackShimDir = await initCorepack({ repoRootPath });
|
||||
@@ -538,8 +559,7 @@ async function doBuild(
|
||||
|
||||
// Merge existing `config.json` file into the one that will be produced
|
||||
const configPath = join(outputDir, 'config.json');
|
||||
// TODO: properly type
|
||||
const existingConfig = await readJSONFile<any>(configPath);
|
||||
const existingConfig = await readJSONFile<BuildOutputConfig>(configPath);
|
||||
if (existingConfig instanceof CantParseJSONFile) {
|
||||
throw existingConfig;
|
||||
}
|
||||
@@ -585,15 +605,17 @@ async function doBuild(
|
||||
const mergedOverrides: Record<string, PathOverride> =
|
||||
overrides.length > 0 ? Object.assign({}, ...overrides) : undefined;
|
||||
|
||||
const framework = await getFramework(cwd, buildResults);
|
||||
|
||||
// Write out the final `config.json` file based on the
|
||||
// user configuration and Builder build results
|
||||
// TODO: properly type
|
||||
const config = {
|
||||
const config: BuildOutputConfig = {
|
||||
version: 3,
|
||||
routes: mergedRoutes,
|
||||
images: mergedImages,
|
||||
wildcard: mergedWildcard,
|
||||
overrides: mergedOverrides,
|
||||
framework,
|
||||
};
|
||||
await fs.writeJSON(join(outputDir, 'config.json'), config, { spaces: 2 });
|
||||
|
||||
@@ -608,6 +630,50 @@ async function doBuild(
|
||||
);
|
||||
}
|
||||
|
||||
async function getFramework(
|
||||
cwd: string,
|
||||
buildResults: Map<Builder, BuildResult | BuildOutputConfig>
|
||||
): Promise<{ version: string } | undefined> {
|
||||
const detectedFramework = await detectFrameworkRecord({
|
||||
fs: new LocalFileSystemDetector(cwd),
|
||||
frameworkList: frameworks,
|
||||
});
|
||||
|
||||
if (!detectedFramework) {
|
||||
return;
|
||||
}
|
||||
|
||||
// determine framework version from build result
|
||||
if (detectedFramework.useRuntime) {
|
||||
for (const [build, buildResult] of buildResults.entries()) {
|
||||
if (
|
||||
'framework' in buildResult &&
|
||||
build.use === detectedFramework.useRuntime.use
|
||||
) {
|
||||
return buildResult.framework;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// determine framework version from listed package.json version
|
||||
if (detectedFramework.detectedVersion) {
|
||||
// check for a valid, explicit version, not a range
|
||||
if (semver.valid(detectedFramework.detectedVersion)) {
|
||||
return {
|
||||
version: detectedFramework.detectedVersion,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// determine framework version with runtime lookup
|
||||
const frameworkVersion = detectFrameworkVersion(detectedFramework);
|
||||
if (frameworkVersion) {
|
||||
return {
|
||||
version: frameworkVersion,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
function expandBuild(files: string[], build: Builder): Builder[] {
|
||||
if (!build.use) {
|
||||
throw new NowBuildError({
|
||||
@@ -648,7 +714,7 @@ function expandBuild(files: string[], build: Builder): Builder[] {
|
||||
|
||||
function mergeImages(
|
||||
images: BuildResultV2Typical['images'],
|
||||
buildResults: Iterable<BuildResult>
|
||||
buildResults: Iterable<BuildResult | BuildOutputConfig>
|
||||
): BuildResultV2Typical['images'] {
|
||||
for (const result of buildResults) {
|
||||
if ('images' in result && result.images) {
|
||||
@@ -659,7 +725,7 @@ function mergeImages(
|
||||
}
|
||||
|
||||
function mergeWildcard(
|
||||
buildResults: Iterable<BuildResult>
|
||||
buildResults: Iterable<BuildResult | BuildOutputConfig>
|
||||
): BuildResultV2Typical['wildcard'] {
|
||||
let wildcard: BuildResultV2Typical['wildcard'] = undefined;
|
||||
for (const result of buildResults) {
|
||||
|
||||
@@ -55,7 +55,7 @@ async function ls(
|
||||
);
|
||||
|
||||
if (certs.length > 0) {
|
||||
output.log(formatCertsTable(certs));
|
||||
client.stdout.write(formatCertsTable(certs));
|
||||
}
|
||||
|
||||
if (pagination && pagination.count === 20) {
|
||||
|
||||
@@ -19,15 +19,13 @@ import toHumanPath from '../../util/humanize-path';
|
||||
import Now from '../../util';
|
||||
import stamp from '../../util/output/stamp';
|
||||
import createDeploy from '../../util/deploy/create-deploy';
|
||||
import getDeploymentByIdOrHost from '../../util/deploy/get-deployment-by-id-or-host';
|
||||
import getDeployment from '../../util/get-deployment';
|
||||
import parseMeta from '../../util/parse-meta';
|
||||
import linkStyle from '../../util/output/link';
|
||||
import param from '../../util/output/param';
|
||||
import {
|
||||
BuildsRateLimited,
|
||||
DeploymentNotFound,
|
||||
DeploymentPermissionDenied,
|
||||
InvalidDeploymentId,
|
||||
DomainNotFound,
|
||||
DomainNotVerified,
|
||||
DomainPermissionDenied,
|
||||
@@ -629,21 +627,8 @@ export default async (client: Client): Promise<number> => {
|
||||
return 1;
|
||||
}
|
||||
|
||||
const deploymentResponse = await getDeploymentByIdOrHost(
|
||||
client,
|
||||
contextName,
|
||||
deployment.id,
|
||||
'v10'
|
||||
);
|
||||
|
||||
if (
|
||||
deploymentResponse instanceof DeploymentNotFound ||
|
||||
deploymentResponse instanceof DeploymentPermissionDenied ||
|
||||
deploymentResponse instanceof InvalidDeploymentId
|
||||
) {
|
||||
output.error(deploymentResponse.message);
|
||||
return 1;
|
||||
}
|
||||
// get the deployment just to double check that it actually deployed
|
||||
await getDeployment(client, contextName, deployment.id);
|
||||
|
||||
if (deployment === null) {
|
||||
error('Uploading failed. Please try again.');
|
||||
|
||||
@@ -70,7 +70,7 @@ export default async function ls(
|
||||
records.length > 0 ? 'Records' : 'No records'
|
||||
} found under ${chalk.bold(contextName)} ${chalk.gray(lsStamp())}`
|
||||
);
|
||||
output.log(getDNSRecordsTable([{ domainName, records }]));
|
||||
client.stdout.write(getDNSRecordsTable([{ domainName, records }]));
|
||||
|
||||
if (pagination && pagination.count === 20) {
|
||||
const flags = getCommandFlags(opts, ['_', '--next']);
|
||||
|
||||
@@ -34,7 +34,7 @@ const help = () => {
|
||||
)} Connect your Vercel Project to your Git repository defined in your local .git config
|
||||
|
||||
${chalk.cyan(`$ ${getPkgName()} git connect`)}
|
||||
|
||||
|
||||
${chalk.gray(
|
||||
'–'
|
||||
)} Connect your Vercel Project to a Git repository using the remote URL
|
||||
@@ -96,6 +96,7 @@ export default async function main(client: Client) {
|
||||
}
|
||||
|
||||
const { org, project } = linkedProject;
|
||||
client.config.currentTeam = org.type === 'team' ? org.id : undefined;
|
||||
|
||||
switch (subcommand) {
|
||||
case 'connect':
|
||||
|
||||
@@ -9,12 +9,10 @@ import { handleError } from '../util/error';
|
||||
import getScope from '../util/get-scope';
|
||||
import { getPkgName, getCommandName } from '../util/pkg-name';
|
||||
import Client from '../util/client';
|
||||
import { getDeployment } from '../util/get-deployment';
|
||||
import { Deployment } from '@vercel/client';
|
||||
import { Build } from '../types';
|
||||
import getDeployment from '../util/get-deployment';
|
||||
import { Build, Deployment } from '../types';
|
||||
import title from 'title';
|
||||
import { isErrnoException } from '@vercel/error-utils';
|
||||
import { isAPIError } from '../util/errors-ts';
|
||||
import { URL } from 'url';
|
||||
|
||||
const help = () => {
|
||||
@@ -49,7 +47,6 @@ const help = () => {
|
||||
};
|
||||
|
||||
export default async function main(client: Client) {
|
||||
let deployment;
|
||||
let argv;
|
||||
|
||||
try {
|
||||
@@ -101,30 +98,11 @@ export default async function main(client: Client) {
|
||||
);
|
||||
|
||||
// resolve the deployment, since we might have been given an alias
|
||||
try {
|
||||
deployment = await getDeployment(client, deploymentIdOrHost);
|
||||
} catch (err: unknown) {
|
||||
if (isAPIError(err)) {
|
||||
if (err.status === 404) {
|
||||
error(
|
||||
`Failed to find deployment "${deploymentIdOrHost}" in ${chalk.bold(
|
||||
contextName
|
||||
)}`
|
||||
);
|
||||
return 1;
|
||||
}
|
||||
if (err.status === 403) {
|
||||
error(
|
||||
`No permission to access deployment "${deploymentIdOrHost}" in ${chalk.bold(
|
||||
contextName
|
||||
)}`
|
||||
);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
// unexpected
|
||||
throw err;
|
||||
}
|
||||
const deployment = await getDeployment(
|
||||
client,
|
||||
contextName,
|
||||
deploymentIdOrHost
|
||||
);
|
||||
|
||||
const {
|
||||
id,
|
||||
@@ -138,11 +116,11 @@ export default async function main(client: Client) {
|
||||
|
||||
const { builds } =
|
||||
deployment.version === 2
|
||||
? await client.fetch<{ builds: Build[] }>(`/v1/deployments/${id}/builds`)
|
||||
? await client.fetch<{ builds: Build[] }>(`/v11/deployments/${id}/builds`)
|
||||
: { builds: [] };
|
||||
|
||||
log(
|
||||
`Fetched deployment ${chalk.bold(url)} in ${chalk.bold(
|
||||
`Fetched deployment "${chalk.bold(url)}" in ${chalk.bold(
|
||||
contextName
|
||||
)} ${elapsed(Date.now() - depFetchStart)}`
|
||||
);
|
||||
@@ -163,7 +141,7 @@ export default async function main(client: Client) {
|
||||
}
|
||||
print('\n\n');
|
||||
|
||||
if (aliases.length > 0) {
|
||||
if (aliases !== undefined && aliases.length > 0) {
|
||||
print(chalk.bold(' Aliases\n\n'));
|
||||
let aliasList = '';
|
||||
for (const alias of aliases) {
|
||||
@@ -202,8 +180,6 @@ function stateString(s: Deployment['readyState']) {
|
||||
switch (s) {
|
||||
case 'INITIALIZING':
|
||||
case 'BUILDING':
|
||||
case 'DEPLOYING':
|
||||
case 'ANALYZING':
|
||||
return chalk.yellow(CIRCLE) + sTitle;
|
||||
case 'ERROR':
|
||||
return chalk.red(CIRCLE) + sTitle;
|
||||
|
||||
@@ -7,8 +7,7 @@ import getScope from '../util/get-scope';
|
||||
import { getPkgName } from '../util/pkg-name';
|
||||
import getArgs from '../util/get-args';
|
||||
import Client from '../util/client';
|
||||
import { getDeployment } from '../util/get-deployment';
|
||||
import { isAPIError } from '../util/errors-ts';
|
||||
import getDeployment from '../util/get-deployment';
|
||||
|
||||
const help = () => {
|
||||
console.log(`
|
||||
@@ -125,28 +124,9 @@ export default async function main(client: Client) {
|
||||
|
||||
let deployment;
|
||||
try {
|
||||
deployment = await getDeployment(client, id);
|
||||
} catch (err: unknown) {
|
||||
deployment = await getDeployment(client, contextName, id);
|
||||
} finally {
|
||||
output.stopSpinner();
|
||||
|
||||
if (isAPIError(err)) {
|
||||
if (err.status === 404) {
|
||||
output.error(
|
||||
`Failed to find deployment "${id}" in ${chalk.bold(contextName)}`
|
||||
);
|
||||
return 1;
|
||||
}
|
||||
if (err.status === 403) {
|
||||
output.error(
|
||||
`No permission to access deployment "${id}" in ${chalk.bold(
|
||||
contextName
|
||||
)}`
|
||||
);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
// unexpected
|
||||
throw err;
|
||||
}
|
||||
|
||||
output.log(
|
||||
|
||||
@@ -11,7 +11,7 @@ import getScope from '../util/get-scope';
|
||||
import { isValidName } from '../util/is-valid-name';
|
||||
import removeProject from '../util/projects/remove-project';
|
||||
import getProjectByIdOrName from '../util/projects/get-project-by-id-or-name';
|
||||
import getDeploymentByIdOrHost from '../util/deploy/get-deployment-by-id-or-host';
|
||||
import getDeployment from '../util/get-deployment';
|
||||
import getDeploymentsByProjectId, {
|
||||
DeploymentPartial,
|
||||
} from '../util/deploy/get-deployments-by-project-id';
|
||||
@@ -133,7 +133,7 @@ export default async function main(client: Client) {
|
||||
id =>
|
||||
d &&
|
||||
!(d instanceof NowError) &&
|
||||
(d.uid === id || d.name === id || d.url === normalizeURL(id))
|
||||
(d.id === id || d.name === id || d.url === normalizeURL(id))
|
||||
);
|
||||
|
||||
const [deploymentList, projectList] = await Promise.all<any>([
|
||||
@@ -142,7 +142,7 @@ export default async function main(client: Client) {
|
||||
if (!contextName) {
|
||||
throw new Error('Context name is not defined');
|
||||
}
|
||||
return getDeploymentByIdOrHost(client, contextName, idOrHost);
|
||||
return getDeployment(client, contextName, idOrHost).catch(err => err);
|
||||
})
|
||||
),
|
||||
Promise.all(
|
||||
@@ -180,7 +180,7 @@ export default async function main(client: Client) {
|
||||
|
||||
aliases = await Promise.all(
|
||||
deployments.map(async depl => {
|
||||
const { aliases } = await getAliases(client, depl.uid);
|
||||
const { aliases } = await getAliases(client, depl.id);
|
||||
return aliases;
|
||||
})
|
||||
);
|
||||
@@ -238,7 +238,7 @@ export default async function main(client: Client) {
|
||||
const start = Date.now();
|
||||
|
||||
await Promise.all<any>([
|
||||
...deployments.map(depl => now.remove(depl.uid, { hard })),
|
||||
...deployments.map(depl => now.remove(depl.id, { hard })),
|
||||
...projects.map(project => removeProject(client, project.id)),
|
||||
]);
|
||||
|
||||
@@ -275,9 +275,9 @@ function readConfirmation(
|
||||
|
||||
const deploymentTable = table(
|
||||
deployments.map(depl => {
|
||||
const time = chalk.gray(`${ms(Date.now() - depl.created)} ago`);
|
||||
const time = chalk.gray(`${ms(Date.now() - depl.createdAt)} ago`);
|
||||
const url = depl.url ? chalk.underline(`https://${depl.url}`) : '';
|
||||
return [` ${depl.uid}`, url, time];
|
||||
return [` ${depl.id}`, url, time];
|
||||
}),
|
||||
{ align: ['l', 'r', 'l'], hsep: ' '.repeat(6) }
|
||||
);
|
||||
|
||||
@@ -18,7 +18,7 @@ import sourceMap from '@zeit/source-map-support';
|
||||
import { mkdirp } from 'fs-extra';
|
||||
import chalk from 'chalk';
|
||||
import epipebomb from 'epipebomb';
|
||||
import updateNotifier from 'update-notifier';
|
||||
import getLatestVersion from './util/get-latest-version';
|
||||
import { URL } from 'url';
|
||||
import * as Sentry from '@sentry/node';
|
||||
import hp from './util/humanize-path';
|
||||
@@ -55,13 +55,6 @@ import { VercelConfig } from '@vercel/client';
|
||||
|
||||
const isCanary = pkg.version.includes('canary');
|
||||
|
||||
// Checks for available update and returns an instance
|
||||
const notifier = updateNotifier({
|
||||
pkg,
|
||||
distTag: isCanary ? 'canary' : 'latest',
|
||||
updateCheckInterval: 1000 * 60 * 60 * 24 * 7, // 1 week
|
||||
});
|
||||
|
||||
const VERCEL_DIR = getGlobalPathConfig();
|
||||
const VERCEL_CONFIG_PATH = configFiles.getConfigFilePath();
|
||||
const VERCEL_AUTH_CONFIG_PATH = configFiles.getAuthConfigFilePath();
|
||||
@@ -149,22 +142,26 @@ const main = async () => {
|
||||
}
|
||||
|
||||
// Print update information, if available
|
||||
if (notifier.update && notifier.update.latest !== pkg.version && isTTY) {
|
||||
const { latest } = notifier.update;
|
||||
console.log(
|
||||
info(
|
||||
if (isTTY && !process.env.NO_UPDATE_NOTIFIER) {
|
||||
// Check if an update is available. If so, `latest` will contain a string
|
||||
// of the latest version, otherwise `undefined`.
|
||||
const latest = getLatestVersion({
|
||||
distTag: isCanary ? 'canary' : 'latest',
|
||||
output,
|
||||
pkg,
|
||||
});
|
||||
if (latest) {
|
||||
output.log(
|
||||
`${chalk.black.bgCyan('UPDATE AVAILABLE')} ` +
|
||||
`Run ${cmd(
|
||||
await getUpdateCommand()
|
||||
)} to install ${getTitleName()} CLI ${latest}`
|
||||
)
|
||||
);
|
||||
);
|
||||
|
||||
console.log(
|
||||
info(
|
||||
`Changelog: https://github.com/vercel/vercel/releases/tag/vercel@${latest}`
|
||||
)
|
||||
);
|
||||
output.log(
|
||||
`Changelog: https://github.com/vercel/vercel/releases/tag/vercel@${latest}\n`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// The second argument to the command can be:
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
import type { BuilderFunctions } from '@vercel/build-utils';
|
||||
import type { Readable, Writable } from 'stream';
|
||||
import type { Route } from '@vercel/routing-utils';
|
||||
|
||||
export type ProjectSettings = import('@vercel/build-utils').ProjectSettings;
|
||||
|
||||
@@ -116,32 +118,105 @@ export type Cert = {
|
||||
expiration: string;
|
||||
};
|
||||
|
||||
type RouteOrMiddleware =
|
||||
| Route
|
||||
| {
|
||||
src: string;
|
||||
continue: boolean;
|
||||
middleware: 0;
|
||||
};
|
||||
|
||||
export type Deployment = {
|
||||
uid: string;
|
||||
url: string;
|
||||
alias?: string[];
|
||||
aliasAssigned?: boolean | null | number;
|
||||
aliasError?: null | { code: string; message: string };
|
||||
aliasFinal?: string | null;
|
||||
aliasWarning?: null | {
|
||||
code: string;
|
||||
message: string;
|
||||
link?: string;
|
||||
action?: string;
|
||||
};
|
||||
bootedAt?: number;
|
||||
build?: { env: string[] };
|
||||
builds?: { use: string; src?: string; config?: { [key: string]: any } };
|
||||
buildErrorAt?: number;
|
||||
buildingAt: number;
|
||||
canceledAt?: number;
|
||||
checksState?: 'completed' | 'registered' | 'running';
|
||||
checksConclusion?: 'canceled' | 'failed' | 'skipped' | 'succeeded';
|
||||
createdAt: number;
|
||||
createdIn?: string;
|
||||
creator: { uid: string; username?: string };
|
||||
env?: string[];
|
||||
errorCode?: string;
|
||||
errorLink?: string;
|
||||
errorMessage?: string | null;
|
||||
errorStep?: string;
|
||||
functions?: BuilderFunctions | null;
|
||||
gitSource?: {
|
||||
org?: string;
|
||||
owner?: string;
|
||||
prId?: number | null;
|
||||
projectId: number;
|
||||
ref?: string | null;
|
||||
repoId?: number;
|
||||
repoUuid: string;
|
||||
sha?: string;
|
||||
slug?: string;
|
||||
type: string;
|
||||
workspaceUuid: string;
|
||||
};
|
||||
id: string;
|
||||
initReadyAt?: number;
|
||||
inspectorUrl?: string | null;
|
||||
lambdas?: Build[];
|
||||
meta?: {
|
||||
[key: string]: string | undefined;
|
||||
};
|
||||
monorepoManager?: string | null;
|
||||
name: string;
|
||||
type: 'LAMBDAS';
|
||||
state:
|
||||
ownerId?: string;
|
||||
plan?: 'enterprise' | 'hobby' | 'oss' | 'pro';
|
||||
previewCommentsEnabled?: boolean;
|
||||
projectId?: string;
|
||||
projectSettings?: {
|
||||
buildCommand?: string | null;
|
||||
devCommand?: string | null;
|
||||
framework?: string;
|
||||
installCommand?: string | null;
|
||||
outputDirectory?: string | null;
|
||||
};
|
||||
public: boolean;
|
||||
ready?: number;
|
||||
readyState:
|
||||
| 'BUILDING'
|
||||
| 'ERROR'
|
||||
| 'INITIALIZING'
|
||||
| 'QUEUED'
|
||||
| 'READY'
|
||||
| 'CANCELED';
|
||||
version?: number;
|
||||
created: number;
|
||||
createdAt: number;
|
||||
ready?: number;
|
||||
buildingAt?: number;
|
||||
creator: { uid: string; username: string };
|
||||
target: string | null;
|
||||
ownerId: string;
|
||||
projectId: string;
|
||||
inspectorUrl: string;
|
||||
meta: {
|
||||
[key: string]: any;
|
||||
regions: string[];
|
||||
routes?: RouteOrMiddleware[] | null;
|
||||
source?: 'cli' | 'git' | 'import' | 'import/repo' | 'clone/repo';
|
||||
status:
|
||||
| 'BUILDING'
|
||||
| 'ERROR'
|
||||
| 'INITIALIZING'
|
||||
| 'QUEUED'
|
||||
| 'READY'
|
||||
| 'CANCELED';
|
||||
target?: 'staging' | 'production' | null;
|
||||
team?: {
|
||||
id: string;
|
||||
name: string;
|
||||
slug: string;
|
||||
};
|
||||
alias?: string[];
|
||||
ttyBuildLogs?: boolean;
|
||||
type: 'LAMBDAS';
|
||||
url: string;
|
||||
userAliases?: string[];
|
||||
version: 2;
|
||||
};
|
||||
|
||||
export type Alias = {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Deployment } from '../../types';
|
||||
import type { Deployment } from '../../types';
|
||||
import { Output } from '../output';
|
||||
import Client from '../client';
|
||||
import createAlias from './create-alias';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Deployment } from '../../types';
|
||||
import type { Deployment } from '../../types';
|
||||
import { Output } from '../output';
|
||||
import * as ERRORS from '../errors-ts';
|
||||
import Client from '../client';
|
||||
@@ -62,7 +62,7 @@ async function performCreateAlias(
|
||||
) {
|
||||
try {
|
||||
return await client.fetch<AliasRecord>(
|
||||
`/now/deployments/${deployment.uid}/aliases`,
|
||||
`/now/deployments/${deployment.id}/aliases`,
|
||||
{
|
||||
method: 'POST',
|
||||
body: { alias },
|
||||
@@ -79,7 +79,7 @@ async function performCreateAlias(
|
||||
if (err.code === 'deployment_not_found') {
|
||||
return new ERRORS.DeploymentNotFound({
|
||||
context: contextName,
|
||||
id: deployment.uid,
|
||||
id: deployment.id,
|
||||
});
|
||||
}
|
||||
if (err.code === 'gone') {
|
||||
|
||||
@@ -5,7 +5,7 @@ import { Output } from '../output';
|
||||
import { User } from '../../types';
|
||||
import { VercelConfig } from '../dev/types';
|
||||
import getDeploymentsByAppName from '../deploy/get-deployments-by-appname';
|
||||
import getDeploymentByIdOrHost from '../deploy/get-deployment-by-id-or-host';
|
||||
import getDeployment from '../get-deployment';
|
||||
|
||||
async function getAppLastDeployment(
|
||||
output: Output,
|
||||
@@ -22,7 +22,7 @@ async function getAppLastDeployment(
|
||||
|
||||
// Try to fetch deployment details
|
||||
if (deploymentItem) {
|
||||
return getDeploymentByIdOrHost(client, contextName, deploymentItem.uid);
|
||||
return await getDeployment(client, contextName, deploymentItem.uid);
|
||||
}
|
||||
|
||||
return null;
|
||||
@@ -42,13 +42,11 @@ export async function getDeploymentForAlias(
|
||||
// When there are no args at all we try to get the targets from the config
|
||||
if (args.length === 2) {
|
||||
const [deploymentId] = args;
|
||||
const deployment = await getDeploymentByIdOrHost(
|
||||
client,
|
||||
contextName,
|
||||
deploymentId
|
||||
);
|
||||
output.stopSpinner();
|
||||
return deployment;
|
||||
try {
|
||||
return await getDeployment(client, contextName, deploymentId);
|
||||
} finally {
|
||||
output.stopSpinner();
|
||||
}
|
||||
}
|
||||
|
||||
const appName =
|
||||
@@ -59,13 +57,15 @@ export async function getDeploymentForAlias(
|
||||
return null;
|
||||
}
|
||||
|
||||
const deployment = await getAppLastDeployment(
|
||||
output,
|
||||
client,
|
||||
appName,
|
||||
user,
|
||||
contextName
|
||||
);
|
||||
output.stopSpinner();
|
||||
return deployment;
|
||||
try {
|
||||
return await getAppLastDeployment(
|
||||
output,
|
||||
client,
|
||||
appName,
|
||||
user,
|
||||
contextName
|
||||
);
|
||||
} finally {
|
||||
output.stopSpinner();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,18 +5,14 @@ import { satisfies } from 'semver';
|
||||
import { dirname, join } from 'path';
|
||||
import { mkdirp, outputJSON, readJSON, symlink } from 'fs-extra';
|
||||
import { isStaticRuntime } from '@vercel/fs-detectors';
|
||||
import {
|
||||
BuilderV2,
|
||||
BuilderV3,
|
||||
PackageJson,
|
||||
spawnAsync,
|
||||
} from '@vercel/build-utils';
|
||||
import { BuilderV2, BuilderV3, PackageJson } from '@vercel/build-utils';
|
||||
import execa from 'execa';
|
||||
import * as staticBuilder from './static-builder';
|
||||
import { VERCEL_DIR } from '../projects/link';
|
||||
import { Output } from '../output';
|
||||
import readJSONFile from '../read-json-file';
|
||||
import { CantParseJSONFile } from '../errors-ts';
|
||||
import { errorToString, isErrnoException, isError } from '@vercel/error-utils';
|
||||
import { isErrnoException, isError } from '@vercel/error-utils';
|
||||
import cmd from '../output/cmd';
|
||||
import code from '../output/code';
|
||||
|
||||
@@ -213,32 +209,44 @@ async function installBuilders(
|
||||
).join(', ')}`
|
||||
);
|
||||
try {
|
||||
await spawnAsync(
|
||||
const { stderr } = await execa(
|
||||
'npm',
|
||||
['install', '@vercel/build-utils', ...buildersToAdd],
|
||||
{
|
||||
cwd: buildersDir,
|
||||
stdio: 'pipe',
|
||||
reject: true,
|
||||
}
|
||||
);
|
||||
stderr
|
||||
.split('/\r?\n/')
|
||||
.filter(line => line.includes('npm WARN deprecated'))
|
||||
.forEach(line => {
|
||||
output.warn(line);
|
||||
});
|
||||
} catch (err: unknown) {
|
||||
if (isError(err)) {
|
||||
(err as any).link =
|
||||
'https://vercel.link/builder-dependencies-install-failed';
|
||||
if (isErrnoException(err) && err.code === 'ENOENT') {
|
||||
const execaMessage = err.message;
|
||||
let message =
|
||||
err && 'stderr' in err && typeof err.stderr === 'string'
|
||||
? err.stderr
|
||||
: execaMessage;
|
||||
if (execaMessage.startsWith('Command failed with ENOENT')) {
|
||||
// `npm` is not installed
|
||||
err.message = `Please install ${cmd('npm')} before continuing`;
|
||||
message = `Please install ${cmd('npm')} before continuing`;
|
||||
} else {
|
||||
const message = errorToString(err);
|
||||
const notFound = /GET (.*) - Not found/.exec(message);
|
||||
if (notFound) {
|
||||
const url = new URL(notFound[1]);
|
||||
const packageName = decodeURIComponent(url.pathname.slice(1));
|
||||
err.message = `The package ${code(
|
||||
message = `The package ${code(
|
||||
packageName
|
||||
)} is not published on the npm registry`;
|
||||
}
|
||||
}
|
||||
err.message = message;
|
||||
(err as any).link =
|
||||
'https://vercel.link/builder-dependencies-install-failed';
|
||||
}
|
||||
throw err;
|
||||
}
|
||||
|
||||
@@ -1,40 +1,28 @@
|
||||
import fs from 'fs-extra';
|
||||
import { join, relative, basename } from 'path';
|
||||
import { relative, basename } from 'path';
|
||||
import {
|
||||
detectFramework,
|
||||
monorepoManagers,
|
||||
LocalFileSystemDetector,
|
||||
packageManagers,
|
||||
getMonorepoDefaultSettings,
|
||||
MissingBuildPipeline,
|
||||
MissingBuildTarget,
|
||||
} from '@vercel/fs-detectors';
|
||||
import { ProjectLinkAndSettings } from '../projects/project-settings';
|
||||
import { Output } from '../output';
|
||||
import title from 'title';
|
||||
import JSON5 from 'json5';
|
||||
import { PartialProjectSettings } from '../input/edit-project-settings';
|
||||
|
||||
export async function setMonorepoDefaultSettings(
|
||||
cwd: string,
|
||||
workPath: string,
|
||||
projectSettings: ProjectLinkAndSettings['settings'],
|
||||
projectSettings: ProjectLinkAndSettings['settings'] & PartialProjectSettings,
|
||||
output: Output
|
||||
) {
|
||||
const localFileSystem = new LocalFileSystemDetector(cwd);
|
||||
|
||||
const [monorepoManager, packageManager] = await Promise.all([
|
||||
detectFramework({
|
||||
fs: localFileSystem,
|
||||
frameworkList: monorepoManagers,
|
||||
}),
|
||||
detectFramework({
|
||||
fs: localFileSystem,
|
||||
frameworkList: packageManagers,
|
||||
}),
|
||||
]);
|
||||
|
||||
const projectName = basename(workPath);
|
||||
const relativeToRoot = relative(workPath, cwd);
|
||||
|
||||
const setCommand = (
|
||||
command: 'buildCommand' | 'installCommand',
|
||||
command: 'buildCommand' | 'installCommand' | 'commandForIgnoringBuildStep',
|
||||
value: string
|
||||
) => {
|
||||
if (projectSettings[command]) {
|
||||
@@ -46,114 +34,43 @@ export async function setMonorepoDefaultSettings(
|
||||
}
|
||||
};
|
||||
|
||||
if (monorepoManager) {
|
||||
output.log(
|
||||
`Automatically detected ${title(
|
||||
monorepoManager
|
||||
)} monorepo manager. Attempting to assign default \`buildCommand\` and \`installCommand\` settings.`
|
||||
try {
|
||||
const result = await getMonorepoDefaultSettings(
|
||||
projectName,
|
||||
relative(cwd, workPath),
|
||||
relativeToRoot,
|
||||
localFileSystem
|
||||
);
|
||||
}
|
||||
|
||||
if (monorepoManager === 'turbo') {
|
||||
const [turboJSONBuf, packageJSONBuf] = await Promise.all([
|
||||
fs.readFile(join(cwd, 'turbo.json')).catch(() => null),
|
||||
fs.readFile(join(cwd, 'package.json')).catch(() => null),
|
||||
]);
|
||||
|
||||
let hasBuildPipeline = false;
|
||||
|
||||
if (turboJSONBuf !== null) {
|
||||
const turboJSON = JSON5.parse(turboJSONBuf.toString('utf-8'));
|
||||
|
||||
if (turboJSON?.pipeline?.build) {
|
||||
hasBuildPipeline = true;
|
||||
}
|
||||
} else if (packageJSONBuf !== null) {
|
||||
const packageJSON = JSON.parse(packageJSONBuf.toString('utf-8'));
|
||||
|
||||
if (packageJSON?.turbo?.pipeline?.build) {
|
||||
hasBuildPipeline = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!hasBuildPipeline) {
|
||||
output.warn(
|
||||
'Missing required `build` pipeline in turbo.json or package.json Turbo configuration. Skipping automatic setting assignment.'
|
||||
);
|
||||
if (result === null) {
|
||||
return;
|
||||
}
|
||||
|
||||
setCommand(
|
||||
'buildCommand',
|
||||
`cd ${relativeToRoot} && npx turbo run build --filter={./${relative(
|
||||
cwd,
|
||||
workPath
|
||||
)}}...`
|
||||
);
|
||||
setCommand(
|
||||
'installCommand',
|
||||
`cd ${relativeToRoot} && ${packageManager} install`
|
||||
);
|
||||
} else if (monorepoManager === 'nx') {
|
||||
// No ENOENT handling required here since conditional wouldn't be `true` unless `nx.json` was found.
|
||||
const nxJSON = JSON5.parse(fs.readFileSync(join(cwd, 'nx.json'), 'utf-8'));
|
||||
const { monorepoManager, ...commands } = result;
|
||||
|
||||
if (!nxJSON?.targetDefaults?.build) {
|
||||
output.log(
|
||||
'Missing default `build` target in nx.json. Checking for project level Nx configuration...'
|
||||
output.log(
|
||||
`Automatically detected ${title(
|
||||
monorepoManager
|
||||
)} monorepo manager. Attempting to assign default settings.`
|
||||
);
|
||||
|
||||
setCommand('buildCommand', commands.buildCommand);
|
||||
setCommand('installCommand', commands.installCommand);
|
||||
if (commands.commandForIgnoringBuildStep) {
|
||||
setCommand(
|
||||
'commandForIgnoringBuildStep',
|
||||
commands.commandForIgnoringBuildStep
|
||||
);
|
||||
|
||||
const [projectJSONBuf, packageJSONBuf] = await Promise.all([
|
||||
fs.readFile(join(workPath, 'project.json')).catch(() => null),
|
||||
fs.readFile(join(workPath, 'package.json')).catch(() => null),
|
||||
]);
|
||||
|
||||
let hasBuildTarget = false;
|
||||
|
||||
if (projectJSONBuf) {
|
||||
output.log('Found project.json Nx configuration.');
|
||||
const projectJSON = JSON5.parse(projectJSONBuf.toString('utf-8'));
|
||||
if (projectJSON?.targets?.build) {
|
||||
hasBuildTarget = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (packageJSONBuf) {
|
||||
const packageJSON = JSON5.parse(packageJSONBuf.toString('utf-8'));
|
||||
if (packageJSON?.nx) {
|
||||
output.log('Found package.json Nx configuration.');
|
||||
if (packageJSON.nx.targets?.build) {
|
||||
hasBuildTarget = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!hasBuildTarget) {
|
||||
output.warn(
|
||||
'Missing required `build` target in either project.json or package.json Nx configuration. Skipping automatic setting assignment.'
|
||||
);
|
||||
return;
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
if (
|
||||
error instanceof MissingBuildPipeline ||
|
||||
error instanceof MissingBuildTarget
|
||||
) {
|
||||
output.warn(`${error.message} Skipping automatic setting assignment.`);
|
||||
return;
|
||||
}
|
||||
|
||||
setCommand(
|
||||
'buildCommand',
|
||||
`cd ${relativeToRoot} && npx nx build ${projectName}`
|
||||
);
|
||||
setCommand(
|
||||
'installCommand',
|
||||
`cd ${relativeToRoot} && ${packageManager} install`
|
||||
);
|
||||
throw error;
|
||||
}
|
||||
// TODO (@Ethan-Arrowood) - Revisit rush support when we can test it better
|
||||
/* else if (monorepoManager === 'rush') {
|
||||
setCommand(
|
||||
'buildCommand',
|
||||
`node ${relativeToRoot}/common/scripts/install-run-rush.js build --to ${projectName}`
|
||||
);
|
||||
setCommand(
|
||||
'installCommand',
|
||||
`node ${relativeToRoot}/common/scripts/install-run-rush.js install`
|
||||
);
|
||||
} */
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ import {
|
||||
import pipe from 'promisepipe';
|
||||
import { unzip } from './unzip';
|
||||
import { VERCEL_DIR } from '../projects/link';
|
||||
import { VercelConfig } from '@vercel/client';
|
||||
import { fileNameSymbol, VercelConfig } from '@vercel/client';
|
||||
|
||||
const { normalize } = posix;
|
||||
export const OUTPUT_DIR = join(VERCEL_DIR, 'output');
|
||||
@@ -56,6 +56,7 @@ export async function writeBuildResult(
|
||||
return writeBuildResultV2(
|
||||
outputDir,
|
||||
buildResult as BuildResultV2,
|
||||
build,
|
||||
vercelConfig
|
||||
);
|
||||
} else if (version === 3) {
|
||||
@@ -107,6 +108,7 @@ function stripDuplicateSlashes(path: string): string {
|
||||
async function writeBuildResultV2(
|
||||
outputDir: string,
|
||||
buildResult: BuildResultV2,
|
||||
build: Builder,
|
||||
vercelConfig: VercelConfig | null
|
||||
) {
|
||||
if ('buildOutputPath' in buildResult) {
|
||||
@@ -114,6 +116,18 @@ async function writeBuildResultV2(
|
||||
return;
|
||||
}
|
||||
|
||||
// Some very old `@now` scoped Builders return `output` at the top-level.
|
||||
// These Builders are no longer supported.
|
||||
if (!buildResult.output) {
|
||||
const configFile = vercelConfig?.[fileNameSymbol];
|
||||
const updateMessage = build.use.startsWith('@now/')
|
||||
? ` Please update from "@now" to "@vercel" in your \`${configFile}\` file.`
|
||||
: '';
|
||||
throw new Error(
|
||||
`The build result from "${build.use}" is missing the "output" property.${updateMessage}`
|
||||
);
|
||||
}
|
||||
|
||||
const lambdas = new Map<Lambda, string>();
|
||||
const overrides: Record<string, PathOverride> = {};
|
||||
for (const [path, output] of Object.entries(buildResult.output)) {
|
||||
|
||||
@@ -1,78 +0,0 @@
|
||||
import type Client from '../client';
|
||||
import toHost from '../to-host';
|
||||
import { Deployment } from '../../types';
|
||||
import {
|
||||
DeploymentNotFound,
|
||||
DeploymentPermissionDenied,
|
||||
InvalidDeploymentId,
|
||||
isAPIError,
|
||||
} from '../errors-ts';
|
||||
import mapCertError from '../certs/map-cert-error';
|
||||
|
||||
type APIVersion = 'v5' | 'v10';
|
||||
|
||||
export default async function getDeploymentByIdOrHost(
|
||||
client: Client,
|
||||
contextName: string,
|
||||
idOrHost: string,
|
||||
apiVersion: APIVersion = 'v5'
|
||||
) {
|
||||
try {
|
||||
const { deployment } =
|
||||
idOrHost.indexOf('.') !== -1
|
||||
? await getDeploymentByHost(
|
||||
client,
|
||||
toHost(idOrHost) as string,
|
||||
apiVersion
|
||||
)
|
||||
: await getDeploymentById(client, idOrHost, apiVersion);
|
||||
return deployment;
|
||||
} catch (err: unknown) {
|
||||
if (isAPIError(err)) {
|
||||
if (err.status === 404) {
|
||||
return new DeploymentNotFound({ id: idOrHost, context: contextName });
|
||||
}
|
||||
if (err.status === 403) {
|
||||
return new DeploymentPermissionDenied(idOrHost, contextName);
|
||||
}
|
||||
if (err.status === 400 && err.message.includes('`id`')) {
|
||||
return new InvalidDeploymentId(idOrHost);
|
||||
}
|
||||
|
||||
const certError = mapCertError(err);
|
||||
if (certError) {
|
||||
return certError;
|
||||
}
|
||||
}
|
||||
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
|
||||
async function getDeploymentById(
|
||||
client: Client,
|
||||
id: string,
|
||||
apiVersion: APIVersion
|
||||
) {
|
||||
const deployment = await client.fetch<Deployment>(
|
||||
`/${apiVersion}/now/deployments/${encodeURIComponent(id)}`
|
||||
);
|
||||
return { deployment };
|
||||
}
|
||||
|
||||
type Response = {
|
||||
id: string;
|
||||
};
|
||||
|
||||
async function getDeploymentByHost(
|
||||
client: Client,
|
||||
host: string,
|
||||
apiVersion: APIVersion
|
||||
) {
|
||||
const response = await client.fetch<Response>(
|
||||
`/v10/now/deployments/get?url=${encodeURIComponent(
|
||||
host
|
||||
)}&resolve=1&noState=1`
|
||||
);
|
||||
return getDeploymentById(client, response.id, apiVersion);
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
import { NowError } from '../now-error';
|
||||
import Client from '../client';
|
||||
import getDeploymentByIdOrHost from './get-deployment-by-id-or-host';
|
||||
|
||||
export default async function getDeploymentByIdOrThrow(
|
||||
client: Client,
|
||||
contextName: string,
|
||||
idOrHost: string
|
||||
) {
|
||||
const deployment = await getDeploymentByIdOrHost(
|
||||
client,
|
||||
contextName,
|
||||
idOrHost
|
||||
);
|
||||
if (deployment instanceof NowError) {
|
||||
throw deployment;
|
||||
}
|
||||
return deployment;
|
||||
}
|
||||
@@ -6,7 +6,7 @@ type Response = {
|
||||
deployments: DeploymentPartial[];
|
||||
};
|
||||
export interface DeploymentPartial {
|
||||
uid: string;
|
||||
id: string;
|
||||
name: string;
|
||||
url: string;
|
||||
created: number;
|
||||
|
||||
@@ -7,7 +7,8 @@ import jsonlines from 'jsonlines';
|
||||
import { eraseLines } from 'ansi-escapes';
|
||||
|
||||
import Client from './client';
|
||||
import { getDeployment } from './get-deployment';
|
||||
import getDeployment from './get-deployment';
|
||||
import getScope from './get-scope';
|
||||
|
||||
export interface FindOpts {
|
||||
direction: 'forward' | 'backward';
|
||||
@@ -37,6 +38,7 @@ async function printEvents(
|
||||
{ mode, onEvent, quiet, findOpts }: PrintEventsOptions
|
||||
) {
|
||||
const { log, debug } = client.output;
|
||||
const { contextName } = await getScope(client);
|
||||
|
||||
// we keep track of how much we log in case we
|
||||
// drop the connection and have to start over
|
||||
@@ -74,7 +76,11 @@ async function printEvents(
|
||||
poller = (function startPoller() {
|
||||
return setTimeout(async () => {
|
||||
try {
|
||||
const json = await getDeployment(client, deploymentIdOrURL);
|
||||
const json = await getDeployment(
|
||||
client,
|
||||
contextName,
|
||||
deploymentIdOrURL
|
||||
);
|
||||
if (json.readyState === 'READY') {
|
||||
stream.end();
|
||||
finish();
|
||||
|
||||
@@ -1,27 +1,53 @@
|
||||
import { stringify } from 'querystring';
|
||||
import { Deployment } from '@vercel/client';
|
||||
import Client from './client';
|
||||
import type Client from './client';
|
||||
import {
|
||||
DeploymentNotFound,
|
||||
DeploymentPermissionDenied,
|
||||
InvalidDeploymentId,
|
||||
isAPIError,
|
||||
} from './errors-ts';
|
||||
import type { Deployment } from '../types';
|
||||
import mapCertError from './certs/map-cert-error';
|
||||
import toHost from './to-host';
|
||||
|
||||
export async function getDeployment(
|
||||
/**
|
||||
* Retrieves a v13 deployment.
|
||||
*
|
||||
* @param client - The Vercel CLI client instance.
|
||||
* @param contextName - The scope context/team name.
|
||||
* @param hostOrId - A deployment host or id.
|
||||
* @returns The deployment information.
|
||||
*/
|
||||
export default async function getDeployment(
|
||||
client: Client,
|
||||
contextName: string,
|
||||
hostOrId: string
|
||||
): Promise<Deployment> {
|
||||
let url = `/v13/deployments`;
|
||||
|
||||
if (hostOrId.includes('.')) {
|
||||
let host = hostOrId.replace(/^https:\/\//i, '');
|
||||
|
||||
if (host.slice(-1) === '/') {
|
||||
host = host.slice(0, -1);
|
||||
}
|
||||
|
||||
url += `/get?${stringify({
|
||||
url: host,
|
||||
})}`;
|
||||
} else {
|
||||
url += `/${encodeURIComponent(hostOrId)}`;
|
||||
hostOrId = toHost(hostOrId);
|
||||
}
|
||||
|
||||
const deployment = await client.fetch<Deployment>(url);
|
||||
return deployment;
|
||||
try {
|
||||
return await client.fetch<Deployment>(
|
||||
`/v13/deployments/${encodeURIComponent(hostOrId)}`
|
||||
);
|
||||
} catch (err: unknown) {
|
||||
if (isAPIError(err)) {
|
||||
if (err.status === 404) {
|
||||
throw new DeploymentNotFound({ id: hostOrId, context: contextName });
|
||||
}
|
||||
if (err.status === 403) {
|
||||
throw new DeploymentPermissionDenied(hostOrId, contextName);
|
||||
}
|
||||
if (err.status === 400 && err.message.includes('`id`')) {
|
||||
throw new InvalidDeploymentId(hostOrId);
|
||||
}
|
||||
|
||||
const certError = mapCertError(err);
|
||||
if (certError) {
|
||||
throw certError;
|
||||
}
|
||||
}
|
||||
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
|
||||
225
packages/cli/src/util/get-latest-version/get-latest-worker.js
Normal file
225
packages/cli/src/util/get-latest-version/get-latest-worker.js
Normal file
@@ -0,0 +1,225 @@
|
||||
/**
|
||||
* This file is spawned in the background and checks npm for the latest version
|
||||
* of the CLI, then writes the version to the cache file.
|
||||
*
|
||||
* NOTE: Since this file runs asynchronously in the background, it's possible
|
||||
* for multiple instances of this file to be running at the same time leading
|
||||
* to a race condition where the most recent instance will overwrite the
|
||||
* previous cache file resetting the `notified` flag and cause the update
|
||||
* notification to appear for multiple consequetive commands. Not the end of
|
||||
* the world, but something to be aware of.
|
||||
*
|
||||
* IMPORTANT! This file must NOT depend on any 3rd party dependencies. This
|
||||
* file is NOT bundled by `ncc` and thus any 3rd party dependencies will never
|
||||
* be available.
|
||||
*/
|
||||
|
||||
const https = require('https');
|
||||
const { mkdirSync, writeFileSync } = require('fs');
|
||||
const { access, mkdir, readFile, unlink, writeFile } = require('fs/promises');
|
||||
const path = require('path');
|
||||
const { format, inspect } = require('util');
|
||||
|
||||
/**
|
||||
* An simple output helper which accumulates error and debug log messages in
|
||||
* memory for potential persistance to disk while immediately outputting errors
|
||||
* and debug messages, when the `--debug` flag is set, to `stderr`.
|
||||
*/
|
||||
class WorkerOutput {
|
||||
debugLog = [];
|
||||
logFile = null;
|
||||
|
||||
constructor({ debug = true }) {
|
||||
this.debugOutputEnabled = debug;
|
||||
}
|
||||
|
||||
debug(...args) {
|
||||
this.print('debug', args);
|
||||
}
|
||||
|
||||
error(...args) {
|
||||
this.print('error', args);
|
||||
}
|
||||
|
||||
print(type, args) {
|
||||
// note: `args` may contain an `Error` that will be toString()'d and thus
|
||||
// no stack trace
|
||||
const str = format(
|
||||
...args.map(s => (typeof s === 'string' ? s : inspect(s)))
|
||||
);
|
||||
this.debugLog.push(`[${new Date().toISOString()}] [${type}] ${str}`);
|
||||
if (type === 'debug' && this.debugOutputEnabled) {
|
||||
console.error(`> '[debug] [${new Date().toISOString()}] ${str}`);
|
||||
} else if (type === 'error') {
|
||||
console.error(`Error: ${str}`);
|
||||
}
|
||||
}
|
||||
|
||||
setLogFile(file) {
|
||||
// wire up the exit handler the first time the log file is set
|
||||
if (this.logFile === null) {
|
||||
process.on('exit', () => {
|
||||
if (this.debugLog.length) {
|
||||
mkdirSync(path.dirname(this.logFile), { recursive: true });
|
||||
writeFileSync(this.logFile, this.debugLog.join('\n'));
|
||||
}
|
||||
});
|
||||
}
|
||||
this.logFile = file;
|
||||
}
|
||||
}
|
||||
|
||||
const output = new WorkerOutput({
|
||||
// enable the debug logging if the `--debug` is set or if this worker script
|
||||
// was directly executed
|
||||
debug: process.argv.includes('--debug') || !process.connected,
|
||||
});
|
||||
|
||||
process.on('unhandledRejection', err => {
|
||||
output.error('Exiting worker due to unhandled rejection:', err);
|
||||
process.exit(1);
|
||||
});
|
||||
|
||||
// this timer will prevent this worker process from running longer than 10s
|
||||
const timer = setTimeout(() => {
|
||||
output.error('Worker timed out after 10 seconds');
|
||||
process.exit(1);
|
||||
}, 10000);
|
||||
|
||||
// wait for the parent to give us the work payload
|
||||
process.once('message', async msg => {
|
||||
output.debug('Received message from parent:', msg);
|
||||
|
||||
output.debug('Disconnecting from parent');
|
||||
process.disconnect();
|
||||
|
||||
const { cacheFile, distTag, name, updateCheckInterval } = msg;
|
||||
const cacheFileParsed = path.parse(cacheFile);
|
||||
await mkdir(cacheFileParsed.dir, { recursive: true });
|
||||
|
||||
output.setLogFile(
|
||||
path.join(cacheFileParsed.dir, `${cacheFileParsed.name}.log`)
|
||||
);
|
||||
|
||||
const lockFile = path.join(
|
||||
cacheFileParsed.dir,
|
||||
`${cacheFileParsed.name}.lock`
|
||||
);
|
||||
|
||||
try {
|
||||
// check for a lock file and either bail if running or write our pid and continue
|
||||
output.debug(`Checking lock file: ${lockFile}`);
|
||||
if (await isRunning(lockFile)) {
|
||||
output.debug('Worker already running, exiting');
|
||||
process.exit(1);
|
||||
}
|
||||
output.debug(`Initializing lock file with pid ${process.pid}`);
|
||||
await writeFile(lockFile, String(process.pid), 'utf-8');
|
||||
|
||||
// fetch the latest version from npm
|
||||
const agent = new https.Agent({
|
||||
keepAlive: true,
|
||||
maxSockets: 15, // See: `npm config get maxsockets`
|
||||
});
|
||||
const headers = {
|
||||
accept:
|
||||
'application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*',
|
||||
};
|
||||
const url = `https://registry.npmjs.org/-/package/${name}/dist-tags`;
|
||||
output.debug(`Fetching ${url}`);
|
||||
|
||||
const tags = await new Promise((resolve, reject) => {
|
||||
const req = https.get(
|
||||
url,
|
||||
{
|
||||
agent,
|
||||
headers,
|
||||
},
|
||||
res => {
|
||||
let buf = '';
|
||||
res.on('data', chunk => {
|
||||
buf += chunk;
|
||||
});
|
||||
res.on('end', () => {
|
||||
try {
|
||||
resolve(JSON.parse(buf));
|
||||
} catch (err) {
|
||||
reject(err);
|
||||
}
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
req.on('error', reject);
|
||||
req.end();
|
||||
});
|
||||
|
||||
const version = tags[distTag];
|
||||
|
||||
if (version) {
|
||||
output.debug(`Found dist tag "${distTag}" with version "${version}"`);
|
||||
} else {
|
||||
output.error(`Dist tag "${distTag}" not found`);
|
||||
output.debug('Available dist tags:', Object.keys(tags));
|
||||
}
|
||||
|
||||
output.debug(`Writing cache file: ${cacheFile}`);
|
||||
await writeFile(
|
||||
cacheFile,
|
||||
JSON.stringify({
|
||||
expireAt: Date.now() + updateCheckInterval,
|
||||
notified: false,
|
||||
version,
|
||||
})
|
||||
);
|
||||
} catch (err) {
|
||||
output.error(`Failed to get package info:`, err);
|
||||
} finally {
|
||||
clearTimeout(timer);
|
||||
|
||||
if (await fileExists(lockFile)) {
|
||||
output.debug(`Releasing lock file: ${lockFile}`);
|
||||
await unlink(lockFile);
|
||||
}
|
||||
|
||||
output.debug(`Worker finished successfully!`);
|
||||
|
||||
// force the worker to exit
|
||||
process.exit(0);
|
||||
}
|
||||
});
|
||||
|
||||
// signal the parent process we're ready
|
||||
if (process.connected) {
|
||||
output.debug("Notifying parent we're ready");
|
||||
process.send({ type: 'ready' });
|
||||
} else {
|
||||
console.error('No IPC bridge detected, exiting');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
async function fileExists(file) {
|
||||
return access(file)
|
||||
.then(() => true)
|
||||
.catch(() => false);
|
||||
}
|
||||
|
||||
async function isRunning(lockFile) {
|
||||
try {
|
||||
const pid = parseInt(await readFile(lockFile, 'utf-8'));
|
||||
output.debug(`Found lock file with pid: ${pid}`);
|
||||
|
||||
// checks for existence of a process; throws if not found
|
||||
process.kill(pid, 0);
|
||||
|
||||
// process is still running
|
||||
return true;
|
||||
} catch (err) {
|
||||
if (await fileExists(lockFile)) {
|
||||
// lock file does not exist or process is not running and pid is stale
|
||||
output.debug(`Resetting lock file: ${err.toString()}`);
|
||||
await unlink(lockFile);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
151
packages/cli/src/util/get-latest-version/index.ts
Normal file
151
packages/cli/src/util/get-latest-version/index.ts
Normal file
@@ -0,0 +1,151 @@
|
||||
import semver from 'semver';
|
||||
import XDGAppPaths from 'xdg-app-paths';
|
||||
import { dirname, parse as parsePath, resolve as resolvePath } from 'path';
|
||||
import type { Output } from '../output';
|
||||
import { existsSync, outputJSONSync, readJSONSync } from 'fs-extra';
|
||||
import type { PackageJson } from '@vercel/build-utils';
|
||||
import { spawn } from 'child_process';
|
||||
|
||||
interface GetLatestVersionOptions {
|
||||
cacheDir?: string;
|
||||
distTag?: string;
|
||||
output?: Output;
|
||||
pkg: PackageJson;
|
||||
updateCheckInterval?: number;
|
||||
}
|
||||
|
||||
interface PackageInfoCache {
|
||||
version: string;
|
||||
expireAt: number;
|
||||
notified: boolean;
|
||||
}
|
||||
|
||||
interface GetLatestWorkerPayload {
|
||||
cacheFile?: string;
|
||||
distTag?: string;
|
||||
updateCheckInterval?: number;
|
||||
name?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if it needs to check for a newer CLI version and returns the last
|
||||
* detected version. The version could be stale, but still newer than the
|
||||
* current version.
|
||||
*
|
||||
* @returns {String|undefined} If a newer version is found, then the lastest
|
||||
* version, otherwise `undefined`.
|
||||
*/
|
||||
export default function getLatestVersion({
|
||||
cacheDir = XDGAppPaths('com.vercel.cli').cache(),
|
||||
distTag = 'latest',
|
||||
output,
|
||||
pkg,
|
||||
updateCheckInterval = 1000 * 60 * 60 * 24 * 7, // 1 week
|
||||
}: GetLatestVersionOptions): string | undefined {
|
||||
if (
|
||||
!pkg ||
|
||||
typeof pkg !== 'object' ||
|
||||
!pkg.name ||
|
||||
typeof pkg.name !== 'string'
|
||||
) {
|
||||
throw new TypeError('Expected package to be an object with a package name');
|
||||
}
|
||||
|
||||
const cacheFile = resolvePath(
|
||||
cacheDir,
|
||||
'package-updates',
|
||||
`${pkg.name}-${distTag}.json`
|
||||
);
|
||||
|
||||
let cache: PackageInfoCache | undefined;
|
||||
try {
|
||||
cache = readJSONSync(cacheFile);
|
||||
} catch (err: any) {
|
||||
// cache does not exist or malformed
|
||||
if (err.code !== 'ENOENT') {
|
||||
output?.debug(`Error reading latest package cache file: ${err}`);
|
||||
}
|
||||
}
|
||||
|
||||
if (!cache || cache.expireAt < Date.now()) {
|
||||
spawnWorker(
|
||||
{
|
||||
cacheFile,
|
||||
distTag,
|
||||
updateCheckInterval,
|
||||
name: pkg.name,
|
||||
},
|
||||
output
|
||||
);
|
||||
}
|
||||
|
||||
if (
|
||||
cache &&
|
||||
!cache.notified &&
|
||||
pkg.version &&
|
||||
semver.lt(pkg.version, cache.version)
|
||||
) {
|
||||
cache.notified = true;
|
||||
outputJSONSync(cacheFile, cache);
|
||||
return cache.version;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Spawn the worker, wait for the worker to report it's ready, then signal the
|
||||
* worker to fetch the latest version.
|
||||
*/
|
||||
function spawnWorker(
|
||||
payload: GetLatestWorkerPayload,
|
||||
output: Output | undefined
|
||||
) {
|
||||
// we need to find the update worker script since the location is
|
||||
// different based on production vs tests
|
||||
let dir = dirname(__filename);
|
||||
let script = resolvePath(dir, 'dist', 'get-latest-worker.js');
|
||||
const { root } = parsePath(dir);
|
||||
while (!existsSync(script)) {
|
||||
dir = dirname(dir);
|
||||
if (dir === root) {
|
||||
// didn't find it, bail
|
||||
output?.debug('Failed to find the get latest worker script!');
|
||||
return;
|
||||
}
|
||||
script = resolvePath(dir, 'dist', 'get-latest-worker.js');
|
||||
}
|
||||
|
||||
// spawn the worker with an IPC channel
|
||||
output?.debug(`Spawning ${script}`);
|
||||
const args = [script];
|
||||
if (output?.debugEnabled) {
|
||||
args.push('--debug');
|
||||
}
|
||||
const worker = spawn(process.execPath, args, {
|
||||
stdio: ['inherit', 'inherit', 'inherit', 'ipc'],
|
||||
windowsHide: true,
|
||||
});
|
||||
|
||||
// we allow the child 2 seconds to let us know it's ready before we give up
|
||||
const workerReadyTimer = setTimeout(() => worker.kill(), 2000);
|
||||
|
||||
// listen for an early on close error, but then we remove it when unref
|
||||
const onClose = (code: number) => {
|
||||
output?.debug(`Get latest worker exited (code ${code})`);
|
||||
};
|
||||
worker.on('close', onClose);
|
||||
|
||||
// generally, the parent won't be around long enough to handle a non-zero
|
||||
// worker process exit code
|
||||
worker.on('error', err => {
|
||||
output?.log(`Failed to spawn get latest worker: ${err.stack}`);
|
||||
});
|
||||
|
||||
// wait for the worker to start and notify us it is ready
|
||||
worker.once('message', () => {
|
||||
clearTimeout(workerReadyTimer);
|
||||
|
||||
worker.removeListener('close', onClose);
|
||||
worker.send(payload);
|
||||
worker.unref();
|
||||
});
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
import Client from '../client';
|
||||
import { stringify } from 'qs';
|
||||
import { Org } from '../../types';
|
||||
import chalk from 'chalk';
|
||||
import link from '../output/link';
|
||||
@@ -19,9 +18,7 @@ export async function disconnectGitProvider(
|
||||
org: Org,
|
||||
projectId: string
|
||||
) {
|
||||
const fetchUrl = `/v9/projects/${projectId}/link?${stringify({
|
||||
teamId: org.type === 'team' ? org.id : undefined,
|
||||
})}`;
|
||||
const fetchUrl = `/v9/projects/${projectId}/link`;
|
||||
return client.fetch(fetchUrl, {
|
||||
method: 'DELETE',
|
||||
headers: {
|
||||
@@ -37,9 +34,7 @@ export async function connectGitProvider(
|
||||
type: string,
|
||||
repo: string
|
||||
) {
|
||||
const fetchUrl = `/v9/projects/${projectId}/link?${stringify({
|
||||
teamId: org.type === 'team' ? org.id : undefined,
|
||||
})}`;
|
||||
const fetchUrl = `/v9/projects/${projectId}/link`;
|
||||
try {
|
||||
return await client.fetch(fetchUrl, {
|
||||
method: 'POST',
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
import type Client from '../client';
|
||||
import type { Deployment } from '../../types';
|
||||
import getDeploymentByIdOrHost from '../deploy/get-deployment-by-id-or-host';
|
||||
import handleCertError from '../certs/handle-cert-error';
|
||||
|
||||
/**
|
||||
* Attempts to find the deployment by name or id.
|
||||
* @param {Client} client - The Vercel client instance
|
||||
* @param {string} contextName - The scope name
|
||||
* @param {string} deployId - The deployment name or id to rollback
|
||||
* @returns {Promise<Deployment>} Resolves an exit code or deployment info
|
||||
*/
|
||||
export default async function getDeploymentInfo(
|
||||
client: Client,
|
||||
contextName: string,
|
||||
deployId: string
|
||||
): Promise<Deployment> {
|
||||
const deployment = handleCertError(
|
||||
client.output,
|
||||
await getDeploymentByIdOrHost(client, contextName, deployId)
|
||||
);
|
||||
|
||||
if (deployment === 1) {
|
||||
throw new Error(
|
||||
`Failed to get deployment "${deployId}" in scope "${contextName}"`
|
||||
);
|
||||
}
|
||||
|
||||
if (deployment instanceof Error) {
|
||||
throw deployment;
|
||||
}
|
||||
|
||||
if (!deployment) {
|
||||
throw new Error(`Couldn't find the deployment "${deployId}"`);
|
||||
}
|
||||
|
||||
return deployment;
|
||||
}
|
||||
@@ -1,11 +1,12 @@
|
||||
import chalk from 'chalk';
|
||||
import type Client from '../client';
|
||||
import type { Deployment, Project, Team } from '../../types';
|
||||
import { getCommandName } from '../pkg-name';
|
||||
import getDeploymentInfo from './get-deployment-info';
|
||||
import getDeployment from '../get-deployment';
|
||||
import getScope from '../get-scope';
|
||||
import getTeamById from '../teams/get-team-by-id';
|
||||
import { isValidName } from '../is-valid-name';
|
||||
import ms from 'ms';
|
||||
import type { Project } from '../../types';
|
||||
import rollbackStatus from './status';
|
||||
|
||||
/**
|
||||
@@ -27,7 +28,7 @@ export default async function requestRollback({
|
||||
project: Project;
|
||||
timeout?: string;
|
||||
}): Promise<number> {
|
||||
const { output } = client;
|
||||
const { config, output } = client;
|
||||
const { contextName } = await getScope(client);
|
||||
|
||||
if (!isValidName(deployId)) {
|
||||
@@ -37,27 +38,65 @@ export default async function requestRollback({
|
||||
return 1;
|
||||
}
|
||||
|
||||
output.spinner(
|
||||
`Fetching deployment "${deployId}" in ${chalk.bold(contextName)}…`
|
||||
);
|
||||
let deployment: Deployment;
|
||||
let team: Team | undefined;
|
||||
|
||||
let deployment;
|
||||
try {
|
||||
deployment = await getDeploymentInfo(client, contextName, deployId);
|
||||
} catch (err: any) {
|
||||
output.error(err?.toString() || err);
|
||||
return 1;
|
||||
} finally {
|
||||
output.stopSpinner();
|
||||
output.spinner(
|
||||
`Fetching deployment "${deployId}" in ${chalk.bold(contextName)}…`
|
||||
);
|
||||
|
||||
const [teamResult, deploymentResult] = await Promise.allSettled([
|
||||
config.currentTeam ? getTeamById(client, config.currentTeam) : undefined,
|
||||
getDeployment(client, contextName, deployId),
|
||||
]);
|
||||
|
||||
if (teamResult.status === 'rejected') {
|
||||
output.error(`Failed to retrieve team information: ${teamResult.reason}`);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (deploymentResult.status === 'rejected') {
|
||||
output.error(deploymentResult.reason);
|
||||
return 1;
|
||||
}
|
||||
|
||||
team = teamResult.value;
|
||||
deployment = deploymentResult.value;
|
||||
|
||||
// re-render the spinner text because it goes so fast
|
||||
output.log(
|
||||
`Fetching deployment "${deployId}" in ${chalk.bold(contextName)}…`
|
||||
);
|
||||
} finally {
|
||||
output.stopSpinner();
|
||||
}
|
||||
|
||||
if (deployment.team?.id) {
|
||||
if (!team || deployment.team.id !== team.id) {
|
||||
output.error(
|
||||
team
|
||||
? `Deployment doesn't belong to current team ${chalk.bold(
|
||||
contextName
|
||||
)}`
|
||||
: `Deployment belongs to a different team`
|
||||
);
|
||||
output.error(
|
||||
`Use ${chalk.bold('vc switch')} to change your current team`
|
||||
);
|
||||
return 1;
|
||||
}
|
||||
} else if (team) {
|
||||
output.error(
|
||||
`Deployment doesn't belong to current team ${chalk.bold(contextName)}`
|
||||
);
|
||||
output.error(`Use ${chalk.bold('vc switch')} to change your current team`);
|
||||
return 1;
|
||||
}
|
||||
|
||||
// create the rollback
|
||||
await client.fetch<any>(
|
||||
`/v9/projects/${project.id}/rollback/${deployment.uid}`,
|
||||
`/v9/projects/${project.id}/rollback/${deployment.id}`,
|
||||
{
|
||||
body: {}, // required
|
||||
method: 'POST',
|
||||
@@ -68,7 +107,7 @@ export default async function requestRollback({
|
||||
output.log(
|
||||
`Successfully requested rollback of ${chalk.bold(project.name)} to ${
|
||||
deployment.url
|
||||
} (${deployment.uid})`
|
||||
} (${deployment.id})`
|
||||
);
|
||||
output.log(`To check rollback status, run ${getCommandName('rollback')}.`);
|
||||
return 0;
|
||||
|
||||
@@ -8,7 +8,7 @@ import type {
|
||||
} from '../../types';
|
||||
import elapsed from '../output/elapsed';
|
||||
import formatDate from '../format-date';
|
||||
import getDeploymentInfo from './get-deployment-info';
|
||||
import getDeployment from '../get-deployment';
|
||||
import getScope from '../get-scope';
|
||||
import ms from 'ms';
|
||||
import renderAliasStatus from './render-alias-status';
|
||||
@@ -168,8 +168,7 @@ async function renderJobFailed({
|
||||
|
||||
try {
|
||||
const name = (
|
||||
deployment ||
|
||||
(await getDeploymentInfo(client, contextName, toDeploymentId))
|
||||
deployment || (await getDeployment(client, contextName, toDeploymentId))
|
||||
)?.url;
|
||||
output.error(
|
||||
`Failed to remap all aliases to the requested deployment ${name} (${toDeploymentId})`
|
||||
@@ -228,13 +227,10 @@ async function renderJobSucceeded({
|
||||
}) {
|
||||
const { output } = client;
|
||||
|
||||
// attempt to get the new deployment url
|
||||
let deploymentInfo = '';
|
||||
try {
|
||||
const deployment = await getDeploymentInfo(
|
||||
client,
|
||||
contextName,
|
||||
toDeploymentId
|
||||
);
|
||||
const deployment = await getDeployment(client, contextName, toDeploymentId);
|
||||
deploymentInfo = `${chalk.bold(deployment.url)} (${toDeploymentId})`;
|
||||
} catch (err: any) {
|
||||
output.debug(
|
||||
|
||||
@@ -1,20 +1,8 @@
|
||||
// Native
|
||||
import { parse } from 'url';
|
||||
|
||||
/**
|
||||
* Converts a valid deployment lookup parameter to a hostname.
|
||||
* `http://google.com` => google.com
|
||||
* google.com => google.com
|
||||
*/
|
||||
|
||||
function toHost(url: string): string {
|
||||
if (/^https?:\/\//.test(url)) {
|
||||
return parse(url).host!;
|
||||
}
|
||||
|
||||
// Remove any path if present
|
||||
// `a.b.c/` => `a.b.c`
|
||||
return url.replace(/(\/\/)?([^/]+)(.*)/, '$2');
|
||||
export default function toHost(url: string): string {
|
||||
return url.replace(/^(?:.*?\/\/)?([^/]+).*/, '$1');
|
||||
}
|
||||
|
||||
export default toHost;
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
README.md
|
||||
yarn.lock
|
||||
@@ -2,6 +2,7 @@
|
||||
"name": "vite-template-solid",
|
||||
"version": "0.0.0",
|
||||
"description": "",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"start": "vite",
|
||||
"dev": "vite",
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"noEmit": true,
|
||||
"esModuleInterop": true,
|
||||
"module": "esnext",
|
||||
"module": "CommonJS",
|
||||
"moduleResolution": "node",
|
||||
"resolveJsonModule": true,
|
||||
"isolatedModules": true,
|
||||
|
||||
@@ -1,16 +1,5 @@
|
||||
import { join } from 'path';
|
||||
import ms from 'ms';
|
||||
import fs, { mkdirp } from 'fs-extra';
|
||||
|
||||
const {
|
||||
exec,
|
||||
fetch,
|
||||
fixture,
|
||||
sleep,
|
||||
testFixture,
|
||||
testFixtureStdio,
|
||||
validateResponseHeaders,
|
||||
} = require('./utils.js');
|
||||
import { isIP } from 'net';
|
||||
const { exec, fixture, testFixture, testFixtureStdio } = require('./utils.js');
|
||||
|
||||
test('[vercel dev] validate redirects', async () => {
|
||||
const directory = fixture('invalid-redirects');
|
||||
@@ -124,260 +113,112 @@ test(
|
||||
);
|
||||
|
||||
test(
|
||||
'[vercel dev] test cleanUrls serve correct content',
|
||||
testFixtureStdio('test-clean-urls', async (testPath: any) => {
|
||||
await testPath(200, '/', 'Index Page');
|
||||
await testPath(200, '/about', 'About Page');
|
||||
await testPath(200, '/sub', 'Sub Index Page');
|
||||
await testPath(200, '/sub/another', 'Sub Another Page');
|
||||
await testPath(200, '/style.css', 'body { color: green }');
|
||||
await testPath(308, '/index.html', 'Redirecting to / (308)', {
|
||||
Location: '/',
|
||||
});
|
||||
await testPath(308, '/about.html', 'Redirecting to /about (308)', {
|
||||
Location: '/about',
|
||||
});
|
||||
await testPath(308, '/sub/index.html', 'Redirecting to /sub (308)', {
|
||||
Location: '/sub',
|
||||
'[vercel dev] Use `@vercel/python` with Flask requirements.txt',
|
||||
testFixtureStdio('python-flask', async (testPath: any) => {
|
||||
const name = 'Alice';
|
||||
const year = new Date().getFullYear();
|
||||
await testPath(200, `/api/user?name=${name}`, new RegExp(`Hello ${name}`));
|
||||
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/headers`, (body: any, res: any) => {
|
||||
// @ts-ignore
|
||||
const { host } = new URL(res.url);
|
||||
expect(body).toBe(host);
|
||||
});
|
||||
})
|
||||
);
|
||||
|
||||
test(
|
||||
'[vercel dev] Use custom runtime from the "functions" property',
|
||||
testFixtureStdio('custom-runtime', async (testPath: any) => {
|
||||
await testPath(200, `/api/user`, /Hello, from Bash!/m);
|
||||
await testPath(200, `/api/user.sh`, /Hello, from Bash!/m);
|
||||
})
|
||||
);
|
||||
|
||||
test(
|
||||
'[vercel dev] Should work with nested `tsconfig.json` files',
|
||||
testFixtureStdio('nested-tsconfig', async (testPath: any) => {
|
||||
await testPath(200, `/`, /Nested tsconfig.json test page/);
|
||||
await testPath(200, `/api`, 'Nested `tsconfig.json` API endpoint');
|
||||
})
|
||||
);
|
||||
|
||||
test(
|
||||
'[vercel dev] Should force `tsc` option "module: commonjs" for `startDevServer()`',
|
||||
testFixtureStdio('force-module-commonjs', async (testPath: any) => {
|
||||
await testPath(200, `/`, /Force "module: commonjs" test page/);
|
||||
await testPath(
|
||||
308,
|
||||
'/sub/another.html',
|
||||
'Redirecting to /sub/another (308)',
|
||||
{ Location: '/sub/another' }
|
||||
200,
|
||||
`/api`,
|
||||
'Force "module: commonjs" JavaScript with ES Modules API endpoint'
|
||||
);
|
||||
await testPath(
|
||||
200,
|
||||
`/api/ts`,
|
||||
'Force "module: commonjs" TypeScript API endpoint'
|
||||
);
|
||||
})
|
||||
);
|
||||
|
||||
test(
|
||||
'[vercel dev] test cleanUrls serve correct content when using `outputDirectory`',
|
||||
testFixtureStdio(
|
||||
'test-clean-urls-with-output-directory',
|
||||
async (testPath: any) => {
|
||||
await testPath(200, '/', 'Index Page');
|
||||
await testPath(200, '/about', 'About Page');
|
||||
await testPath(200, '/sub', 'Sub Index Page');
|
||||
await testPath(200, '/sub/another', 'Sub Another Page');
|
||||
await testPath(200, '/style.css', 'body { color: green }');
|
||||
await testPath(308, '/index.html', 'Redirecting to / (308)', {
|
||||
Location: '/',
|
||||
});
|
||||
await testPath(308, '/about.html', 'Redirecting to /about (308)', {
|
||||
Location: '/about',
|
||||
});
|
||||
await testPath(308, '/sub/index.html', 'Redirecting to /sub (308)', {
|
||||
Location: '/sub',
|
||||
});
|
||||
await testPath(
|
||||
308,
|
||||
'/sub/another.html',
|
||||
'Redirecting to /sub/another (308)',
|
||||
{ Location: '/sub/another' }
|
||||
);
|
||||
}
|
||||
)
|
||||
);
|
||||
|
||||
test(
|
||||
'[vercel dev] should serve custom 404 when `cleanUrls: true`',
|
||||
testFixtureStdio('test-clean-urls-custom-404', async (testPath: any) => {
|
||||
await testPath(200, '/', 'This is the home page');
|
||||
await testPath(200, '/about', 'The about page');
|
||||
await testPath(200, '/contact/me', 'Contact Me Subdirectory');
|
||||
await testPath(404, '/nothing', 'Custom 404 Page');
|
||||
await testPath(404, '/nothing/', 'Custom 404 Page');
|
||||
'[vercel dev] should prioritize index.html over other file named index.*',
|
||||
testFixtureStdio('index-html-priority', async (testPath: any) => {
|
||||
await testPath(200, '/', 'This is index.html');
|
||||
await testPath(200, '/index.css', 'This is index.css');
|
||||
})
|
||||
);
|
||||
|
||||
test(
|
||||
'[vercel dev] test cleanUrls and trailingSlash serve correct content',
|
||||
testFixtureStdio('test-clean-urls-trailing-slash', async (testPath: any) => {
|
||||
await testPath(200, '/', 'Index Page');
|
||||
await testPath(200, '/about/', 'About Page');
|
||||
await testPath(200, '/sub/', 'Sub Index Page');
|
||||
await testPath(200, '/sub/another/', 'Sub Another Page');
|
||||
await testPath(200, '/style.css', 'body { color: green }');
|
||||
//TODO: fix this test so that location is `/` instead of `//`
|
||||
//await testPath(308, '/index.html', 'Redirecting to / (308)', { Location: '/' });
|
||||
await testPath(308, '/about.html', 'Redirecting to /about/ (308)', {
|
||||
Location: '/about/',
|
||||
});
|
||||
await testPath(308, '/sub/index.html', 'Redirecting to /sub/ (308)', {
|
||||
Location: '/sub/',
|
||||
});
|
||||
'[vercel dev] Should support `*.go` API serverless functions',
|
||||
testFixtureStdio('go', async (testPath: any) => {
|
||||
await testPath(200, `/api`, 'This is the index page');
|
||||
await testPath(200, `/api/index`, 'This is the index page');
|
||||
await testPath(200, `/api/index.go`, 'This is the index page');
|
||||
await testPath(200, `/api/another`, 'This is another page');
|
||||
await testPath(200, '/api/another.go', 'This is another page');
|
||||
await testPath(200, `/api/foo`, 'Req Path: /api/foo');
|
||||
await testPath(200, `/api/bar`, 'Req Path: /api/bar');
|
||||
})
|
||||
);
|
||||
|
||||
test(
|
||||
'[vercel dev] Should set the `ts-node` "target" to match Node.js version',
|
||||
testFixtureStdio('node-ts-node-target', async (testPath: any) => {
|
||||
await testPath(200, `/api/subclass`, '{"ok":true}');
|
||||
await testPath(
|
||||
308,
|
||||
'/sub/another.html',
|
||||
'Redirecting to /sub/another/ (308)',
|
||||
{
|
||||
Location: '/sub/another/',
|
||||
}
|
||||
200,
|
||||
`/api/array`,
|
||||
'{"months":[1,2,3,4,5,6,7,8,9,10,11,12]}'
|
||||
);
|
||||
})
|
||||
);
|
||||
|
||||
test(
|
||||
'[vercel dev] test cors headers work with OPTIONS',
|
||||
testFixtureStdio('test-cors-routes', async (testPath: any) => {
|
||||
const headers = {
|
||||
'Access-Control-Allow-Origin': '*',
|
||||
'Access-Control-Allow-Headers':
|
||||
'Content-Type, Authorization, Accept, Content-Length, Origin, User-Agent',
|
||||
'Access-Control-Allow-Methods':
|
||||
'GET, POST, OPTIONS, HEAD, PATCH, PUT, DELETE',
|
||||
};
|
||||
await testPath(200, '/', 'status api', headers, { method: 'GET' });
|
||||
await testPath(200, '/', 'status api', headers, { method: 'POST' });
|
||||
await testPath(200, '/api/status.js', 'status api', headers, {
|
||||
method: 'GET',
|
||||
});
|
||||
await testPath(200, '/api/status.js', 'status api', headers, {
|
||||
method: 'POST',
|
||||
});
|
||||
await testPath(204, '/', '', headers, { method: 'OPTIONS' });
|
||||
await testPath(204, '/api/status.js', '', headers, { method: 'OPTIONS' });
|
||||
})
|
||||
);
|
||||
await testPath(200, `/api/dump`, (body: any, res: any, isDev: any) => {
|
||||
// @ts-ignore
|
||||
const { host } = new URL(res.url);
|
||||
const { env, headers } = JSON.parse(body);
|
||||
|
||||
test(
|
||||
'[vercel dev] test trailingSlash true serve correct content',
|
||||
testFixtureStdio('test-trailing-slash', async (testPath: any) => {
|
||||
await testPath(200, '/', 'Index Page');
|
||||
await testPath(200, '/index.html', 'Index Page');
|
||||
await testPath(200, '/about.html', 'About Page');
|
||||
await testPath(200, '/sub/', 'Sub Index Page');
|
||||
await testPath(200, '/sub/index.html', 'Sub Index Page');
|
||||
await testPath(200, '/sub/another.html', 'Sub Another Page');
|
||||
await testPath(200, '/style.css', 'body { color: green }');
|
||||
await testPath(308, '/about.html/', 'Redirecting to /about.html (308)', {
|
||||
Location: '/about.html',
|
||||
});
|
||||
await testPath(308, '/style.css/', 'Redirecting to /style.css (308)', {
|
||||
Location: '/style.css',
|
||||
});
|
||||
await testPath(308, '/sub', 'Redirecting to /sub/ (308)', {
|
||||
Location: '/sub/',
|
||||
});
|
||||
})
|
||||
);
|
||||
// Test that the API endpoint receives the Vercel proxy request headers
|
||||
expect(headers['x-forwarded-host']).toBe(host);
|
||||
expect(headers['x-vercel-deployment-url']).toBe(host);
|
||||
expect(isIP(headers['x-real-ip'])).toBeTruthy();
|
||||
expect(isIP(headers['x-forwarded-for'])).toBeTruthy();
|
||||
expect(isIP(headers['x-vercel-forwarded-for'])).toBeTruthy();
|
||||
|
||||
test(
|
||||
'[vercel dev] should serve custom 404 when `trailingSlash: true`',
|
||||
testFixtureStdio('test-trailing-slash-custom-404', async (testPath: any) => {
|
||||
await testPath(200, '/', 'This is the home page');
|
||||
await testPath(200, '/about.html', 'The about page');
|
||||
await testPath(200, '/contact/', 'Contact Subdirectory');
|
||||
await testPath(404, '/nothing/', 'Custom 404 Page');
|
||||
})
|
||||
);
|
||||
|
||||
test(
|
||||
'[vercel dev] test trailingSlash false serve correct content',
|
||||
testFixtureStdio('test-trailing-slash-false', async (testPath: any) => {
|
||||
await testPath(200, '/', 'Index Page');
|
||||
await testPath(200, '/index.html', 'Index Page');
|
||||
await testPath(200, '/about.html', 'About Page');
|
||||
await testPath(200, '/sub', 'Sub Index Page');
|
||||
await testPath(200, '/sub/index.html', 'Sub Index Page');
|
||||
await testPath(200, '/sub/another.html', 'Sub Another Page');
|
||||
await testPath(200, '/style.css', 'body { color: green }');
|
||||
await testPath(308, '/about.html/', 'Redirecting to /about.html (308)', {
|
||||
Location: '/about.html',
|
||||
});
|
||||
await testPath(308, '/sub/', 'Redirecting to /sub (308)', {
|
||||
Location: '/sub',
|
||||
});
|
||||
await testPath(
|
||||
308,
|
||||
'/sub/another.html/',
|
||||
'Redirecting to /sub/another.html (308)',
|
||||
{
|
||||
Location: '/sub/another.html',
|
||||
// Test that the API endpoint has the Vercel platform env vars defined.
|
||||
expect(env.NOW_REGION).toMatch(/^[a-z]{3}\d$/);
|
||||
if (isDev) {
|
||||
// Only dev is tested because in production these are opt-in.
|
||||
expect(env.VERCEL_URL).toBe(host);
|
||||
expect(env.VERCEL_REGION).toBe('dev1');
|
||||
}
|
||||
);
|
||||
});
|
||||
})
|
||||
);
|
||||
|
||||
test(
|
||||
'[vercel dev] throw when invalid builder routes detected',
|
||||
testFixtureStdio(
|
||||
'invalid-builder-routes',
|
||||
async (testPath: any) => {
|
||||
await testPath(
|
||||
500,
|
||||
'/',
|
||||
/Route at index 0 has invalid `src` regular expression/m
|
||||
);
|
||||
},
|
||||
{ skipDeploy: true }
|
||||
)
|
||||
);
|
||||
|
||||
test(
|
||||
'[vercel dev] support legacy `@now` scope runtimes',
|
||||
testFixtureStdio('legacy-now-runtime', async (testPath: any) => {
|
||||
await testPath(200, '/', /A simple deployment with the Vercel API!/m);
|
||||
})
|
||||
);
|
||||
|
||||
test(
|
||||
'[vercel dev] 00-list-directory',
|
||||
testFixtureStdio(
|
||||
'00-list-directory',
|
||||
async (testPath: any) => {
|
||||
await testPath(200, '/', /Files within/m);
|
||||
await testPath(200, '/', /test[0-3]\.txt/m);
|
||||
await testPath(200, '/', /\.well-known/m);
|
||||
await testPath(200, '/.well-known/keybase.txt', 'proof goes here');
|
||||
},
|
||||
{ projectSettings: { directoryListing: true } }
|
||||
)
|
||||
);
|
||||
|
||||
test(
|
||||
'[vercel dev] 01-node',
|
||||
testFixtureStdio('01-node', async (testPath: any) => {
|
||||
await testPath(200, '/', /A simple deployment with the Vercel API!/m);
|
||||
})
|
||||
);
|
||||
|
||||
test(
|
||||
'[vercel dev] add a `api/fn.ts` when `api` does not exist at startup`',
|
||||
testFixtureStdio('no-api', async (_testPath: any, port: any) => {
|
||||
const directory = fixture('no-api');
|
||||
const apiDir = join(directory, 'api');
|
||||
|
||||
try {
|
||||
{
|
||||
const response = await fetch(`http://localhost:${port}/api/new-file`);
|
||||
validateResponseHeaders(response);
|
||||
expect(response.status).toBe(404);
|
||||
}
|
||||
|
||||
const fileContents = `
|
||||
export const config = {
|
||||
runtime: 'edge'
|
||||
}
|
||||
|
||||
export default async function edge(request, event) {
|
||||
return new Response('from new file');
|
||||
}
|
||||
`;
|
||||
|
||||
await mkdirp(apiDir);
|
||||
await fs.writeFile(join(apiDir, 'new-file.js'), fileContents);
|
||||
|
||||
// Wait until file events have been processed
|
||||
await sleep(ms('1s'));
|
||||
|
||||
{
|
||||
const response = await fetch(`http://localhost:${port}/api/new-file`);
|
||||
validateResponseHeaders(response);
|
||||
const body = await response.text();
|
||||
expect(body.trim()).toBe('from new file');
|
||||
}
|
||||
} finally {
|
||||
await fs.remove(apiDir);
|
||||
}
|
||||
'[vercel dev] Do not fail if `src` is missing',
|
||||
testFixtureStdio('missing-src-property', async (testPath: any) => {
|
||||
await testPath(200, '/', /hello:index.txt/m);
|
||||
await testPath(404, '/i-do-not-exist');
|
||||
})
|
||||
);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user