mirror of
https://github.com/LukeHagar/vercel.git
synced 2025-12-11 12:57:46 +00:00
Compare commits
153 Commits
@vercel/py
...
@vercel/no
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
54514a44af | ||
|
|
0db8fadf74 | ||
|
|
6f01e5ab75 | ||
|
|
78d45f9e7e | ||
|
|
22e1a6a9ce | ||
|
|
8391734b5e | ||
|
|
6a7fa1526c | ||
|
|
64b15d2409 | ||
|
|
40f73e7978 | ||
|
|
4c9ca27195 | ||
|
|
a847ef43fd | ||
|
|
3b466232a9 | ||
|
|
efdeea9db2 | ||
|
|
ab9915af32 | ||
|
|
d6dc27638c | ||
|
|
0fb0601d19 | ||
|
|
ce25dec97d | ||
|
|
20bd71ce70 | ||
|
|
4c77dab5cb | ||
|
|
151b0dfb63 | ||
|
|
42e9bbea5b | ||
|
|
c0471302e9 | ||
|
|
b2c68f1301 | ||
|
|
9712640fe3 | ||
|
|
0dd3711f63 | ||
|
|
4b657debed | ||
|
|
ffdca76155 | ||
|
|
af7b34aa45 | ||
|
|
e210977a9c | ||
|
|
1c2ef37173 | ||
|
|
65bbcd3e62 | ||
|
|
5caf73380d | ||
|
|
395929b36a | ||
|
|
0e235a926a | ||
|
|
f1bdc0bfd1 | ||
|
|
59ca86365c | ||
|
|
13d54b2095 | ||
|
|
bada86b8d6 | ||
|
|
7ec377757d | ||
|
|
8040c8806b | ||
|
|
2b1c8d89d4 | ||
|
|
c5e9ccfacf | ||
|
|
66fe3db888 | ||
|
|
765ec05cea | ||
|
|
413706d72a | ||
|
|
9bc8817f92 | ||
|
|
9da41dcafa | ||
|
|
f1ab5704f1 | ||
|
|
d8cf3e8831 | ||
|
|
c06209901c | ||
|
|
f20756344e | ||
|
|
21a440b832 | ||
|
|
48d925f105 | ||
|
|
011f6ff150 | ||
|
|
cd09a38c19 | ||
|
|
af239b5fa5 | ||
|
|
38244c8ed6 | ||
|
|
57e8ec13cf | ||
|
|
2e8423e24e | ||
|
|
a92c68e0ff | ||
|
|
84f3a5bc1b | ||
|
|
186bd9bb51 | ||
|
|
9ae84ba05f | ||
|
|
a638755e95 | ||
|
|
15eb018f84 | ||
|
|
7f89aca52c | ||
|
|
dc9ec1bc6d | ||
|
|
df93b01248 | ||
|
|
fb37ad22ab | ||
|
|
684f69bc5b | ||
|
|
ddae78458d | ||
|
|
fc614a7a92 | ||
|
|
6e4ea0774e | ||
|
|
cfc1c9e818 | ||
|
|
62a872fc0e | ||
|
|
03b5bfbaa2 | ||
|
|
aa305e5c66 | ||
|
|
2309c43fce | ||
|
|
0bbb06daa7 | ||
|
|
61de63d285 | ||
|
|
1ca3704297 | ||
|
|
ae4180b287 | ||
|
|
40081cb319 | ||
|
|
9200be61d2 | ||
|
|
1390f6d2ee | ||
|
|
b78cfc9ba5 | ||
|
|
803a9363f9 | ||
|
|
4a0a3b64a2 | ||
|
|
347c2de3a2 | ||
|
|
a05cc11719 | ||
|
|
55b999ea9b | ||
|
|
8babc3694f | ||
|
|
6dc0321216 | ||
|
|
3df8c05792 | ||
|
|
e0f8bc9820 | ||
|
|
ebd2e1822c | ||
|
|
31bc2581f3 | ||
|
|
96759a9fda | ||
|
|
ad2864bca5 | ||
|
|
40fbc993d7 | ||
|
|
1f30e56a6d | ||
|
|
58d6268899 | ||
|
|
4e6659ace7 | ||
|
|
769234b6a6 | ||
|
|
53cab61e88 | ||
|
|
3a65acfb32 | ||
|
|
48eed7532a | ||
|
|
f09d6fce85 | ||
|
|
cc82c499db | ||
|
|
f0bc207717 | ||
|
|
151c7f99ee | ||
|
|
61c2c494bf | ||
|
|
7f49816129 | ||
|
|
7845bef826 | ||
|
|
7acb2e4b07 | ||
|
|
abea002e93 | ||
|
|
2db9678bd4 | ||
|
|
05f942c53f | ||
|
|
6c5f0b7aa0 | ||
|
|
fea05383b9 | ||
|
|
247f49f765 | ||
|
|
231714c71b | ||
|
|
73d6f0d0fa | ||
|
|
34d199bd49 | ||
|
|
1dd421e1f6 | ||
|
|
a91690fb8a | ||
|
|
264437c751 | ||
|
|
b8cce66eff | ||
|
|
cbad57d14f | ||
|
|
4da176d26f | ||
|
|
1f51e04387 | ||
|
|
756174714f | ||
|
|
6e32832f94 | ||
|
|
e682e9cd7d | ||
|
|
b30f000d2a | ||
|
|
f78051ada9 | ||
|
|
10bc74904c | ||
|
|
c8f7a9a874 | ||
|
|
2fd3315221 | ||
|
|
54ef027cbe | ||
|
|
6620c7f600 | ||
|
|
38f40f1c15 | ||
|
|
63211b8b89 | ||
|
|
83ee5ea2b8 | ||
|
|
f063645646 | ||
|
|
4f8c5e344d | ||
|
|
70a53515bd | ||
|
|
4d4f0fa672 | ||
|
|
46c0fd153a | ||
|
|
1c8b4717e3 | ||
|
|
d52d26eaac | ||
|
|
db65728fc4 | ||
|
|
a788d06f85 |
10
.github/DISCUSSION_TEMPLATE/general.yml
vendored
Normal file
10
.github/DISCUSSION_TEMPLATE/general.yml
vendored
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
body:
|
||||||
|
- type: markdown
|
||||||
|
attributes:
|
||||||
|
value: |
|
||||||
|
> **Note**: For discussions not related to Vercel CLI or Runtimes, please visit the [Vercel Community](https://github.com/orgs/vercel/discussions)
|
||||||
|
- type: textarea
|
||||||
|
attributes:
|
||||||
|
label: Description
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
10
.github/DISCUSSION_TEMPLATE/help.yml
vendored
Normal file
10
.github/DISCUSSION_TEMPLATE/help.yml
vendored
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
body:
|
||||||
|
- type: markdown
|
||||||
|
attributes:
|
||||||
|
value: |
|
||||||
|
> **Note**: For discussions not related to Vercel CLI or Runtimes, please visit the [Vercel Community](https://github.com/orgs/vercel/discussions/categories/help)
|
||||||
|
- type: textarea
|
||||||
|
attributes:
|
||||||
|
label: Problem Description
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
10
.github/DISCUSSION_TEMPLATE/ideas.yml
vendored
Normal file
10
.github/DISCUSSION_TEMPLATE/ideas.yml
vendored
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
body:
|
||||||
|
- type: markdown
|
||||||
|
attributes:
|
||||||
|
value: |
|
||||||
|
> **Note**: For discussions not related to Vercel CLI or Runtimes, please visit the [Vercel Community](https://github.com/orgs/vercel/discussions/categories/ideas)
|
||||||
|
- type: textarea
|
||||||
|
attributes:
|
||||||
|
label: Idea
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
10
.github/DISCUSSION_TEMPLATE/polls.yml
vendored
Normal file
10
.github/DISCUSSION_TEMPLATE/polls.yml
vendored
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
body:
|
||||||
|
- type: markdown
|
||||||
|
attributes:
|
||||||
|
value: |
|
||||||
|
> **Note**: For discussions not related to Vercel CLI or Runtimes, please visit the [Vercel Community](https://github.com/orgs/vercel/discussions)
|
||||||
|
- type: textarea
|
||||||
|
attributes:
|
||||||
|
label: Description
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
10
.github/DISCUSSION_TEMPLATE/show-and-tell.yml
vendored
Normal file
10
.github/DISCUSSION_TEMPLATE/show-and-tell.yml
vendored
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
body:
|
||||||
|
- type: markdown
|
||||||
|
attributes:
|
||||||
|
value: |
|
||||||
|
> **Note**: For discussions not related to Vercel CLI or Runtimes, please visit the [Vercel Community](https://github.com/orgs/vercel/discussions)
|
||||||
|
- type: textarea
|
||||||
|
attributes:
|
||||||
|
label: Description
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
5
.github/DISCUSSION_TEMPLATE/temporary.yml
vendored
Normal file
5
.github/DISCUSSION_TEMPLATE/temporary.yml
vendored
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
body:
|
||||||
|
- type: markdown
|
||||||
|
attributes:
|
||||||
|
value: |
|
||||||
|
> **Note**: This category should not be used for new discussions. Please visit the [Vercel Community](https://github.com/orgs/vercel/discussions)
|
||||||
4
.github/ISSUE_TEMPLATE/config.yml
vendored
4
.github/ISSUE_TEMPLATE/config.yml
vendored
@@ -4,8 +4,8 @@ contact_links:
|
|||||||
url: https://vercel.com/support/request
|
url: https://vercel.com/support/request
|
||||||
about: Report a bug using the Vercel support form
|
about: Report a bug using the Vercel support form
|
||||||
- name: Feature Request
|
- name: Feature Request
|
||||||
url: https://github.com/vercel/vercel/discussions/new?category=ideas
|
url: https://github.com/orgs/vercel/discussions/new?category=ideas
|
||||||
about: Share ideas for new features
|
about: Share ideas for new features
|
||||||
- name: Ask a Question
|
- name: Ask a Question
|
||||||
url: https://github.com/vercel/vercel/discussions/new?category=help
|
url: https://github.com/orgs/vercel/discussions/new?category=help
|
||||||
about: Ask the community for help
|
about: Ask the community for help
|
||||||
|
|||||||
31
.github/workflows/cron-update-gatsby-fixtures.yml
vendored
Normal file
31
.github/workflows/cron-update-gatsby-fixtures.yml
vendored
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
name: Cron Update Gatsby Fixtures
|
||||||
|
|
||||||
|
on:
|
||||||
|
# Allow manual runs
|
||||||
|
workflow_dispatch:
|
||||||
|
# Run once a week https://crontab.guru/once-a-week
|
||||||
|
schedule:
|
||||||
|
- cron: '0 0 * * 0'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
create-pull-request:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
# 0 means fetch all commits so we can commit and push in the script below
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
- name: Enable corepack
|
||||||
|
run: corepack enable pnpm
|
||||||
|
- name: Create Pull Request
|
||||||
|
uses: actions/github-script@v6
|
||||||
|
env:
|
||||||
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GH_TOKEN_PULL_REQUESTS }}
|
||||||
|
# See https://github.com/actions/github-script#run-a-separate-file-with-an-async-function
|
||||||
|
with:
|
||||||
|
github-token: ${{ secrets.GH_TOKEN_PULL_REQUESTS }}
|
||||||
|
script: |
|
||||||
|
const script = require('./utils/update-gatsby-fixtures.js')
|
||||||
|
await script({ github, context })
|
||||||
1
.github/workflows/cron-update-next.yml
vendored
1
.github/workflows/cron-update-next.yml
vendored
@@ -25,6 +25,7 @@ jobs:
|
|||||||
GITHUB_TOKEN: ${{ secrets.GH_TOKEN_PULL_REQUESTS }}
|
GITHUB_TOKEN: ${{ secrets.GH_TOKEN_PULL_REQUESTS }}
|
||||||
# See https://github.com/actions/github-script#run-a-separate-file-with-an-async-function
|
# See https://github.com/actions/github-script#run-a-separate-file-with-an-async-function
|
||||||
with:
|
with:
|
||||||
|
github-token: ${{ secrets.GH_TOKEN_PULL_REQUESTS }}
|
||||||
script: |
|
script: |
|
||||||
const script = require('./utils/update-next.js')
|
const script = require('./utils/update-next.js')
|
||||||
await script({ github, context })
|
await script({ github, context })
|
||||||
|
|||||||
1
.github/workflows/cron-update-turbo.yml
vendored
1
.github/workflows/cron-update-turbo.yml
vendored
@@ -25,6 +25,7 @@ jobs:
|
|||||||
GITHUB_TOKEN: ${{ secrets.GH_TOKEN_PULL_REQUESTS }}
|
GITHUB_TOKEN: ${{ secrets.GH_TOKEN_PULL_REQUESTS }}
|
||||||
# See https://github.com/actions/github-script#run-a-separate-file-with-an-async-function
|
# See https://github.com/actions/github-script#run-a-separate-file-with-an-async-function
|
||||||
with:
|
with:
|
||||||
|
github-token: ${{ secrets.GH_TOKEN_PULL_REQUESTS }}
|
||||||
script: |
|
script: |
|
||||||
const script = require('./utils/update-turbo.js')
|
const script = require('./utils/update-turbo.js')
|
||||||
await script({ github, context })
|
await script({ github, context })
|
||||||
|
|||||||
4
.github/workflows/label-feature-request.yml
vendored
4
.github/workflows/label-feature-request.yml
vendored
@@ -16,7 +16,7 @@ jobs:
|
|||||||
issue-number: ${{ github.event.issue.number }}
|
issue-number: ${{ github.event.issue.number }}
|
||||||
body: |
|
body: |
|
||||||
Thank you for taking the time to created this request!
|
Thank you for taking the time to created this request!
|
||||||
|
|
||||||
We added it to our backlog but need to discuss design/architecture before we can accept a PR.
|
We added it to our backlog but need to discuss design/architecture before we can accept a PR.
|
||||||
|
|
||||||
Please let us know if you would be interested in sending a PR once we approve the design.
|
Please let us know if you would be interested in sending a PR once we approve the design.
|
||||||
|
|||||||
6
.github/workflows/label-support.yml
vendored
6
.github/workflows/label-support.yml
vendored
@@ -16,9 +16,9 @@ jobs:
|
|||||||
issue-number: ${{ github.event.issue.number }}
|
issue-number: ${{ github.event.issue.number }}
|
||||||
comment: |
|
comment: |
|
||||||
Thank you so much for filing this issue.
|
Thank you so much for filing this issue.
|
||||||
|
|
||||||
We do try to keep issues in this repository focused on the vercel command line and related code.
|
We do try to keep issues in this repository focused on the vercel command line and related code.
|
||||||
|
|
||||||
At this point we think that this issue is best handled by our friendly Vercel support team. They can be found by contacting them at: https://vercel.com/help#issues
|
At this point we think that this issue is best handled by our friendly Vercel support team. They can be found by contacting them at: https://vercel.com/help#issues
|
||||||
|
|
||||||
If you think closing of this is a mistake, then please re-open this issue and we'll take another look :bow:
|
If you think closing of this is a mistake, then please re-open this issue and we'll take another look :bow:
|
||||||
|
|||||||
6
.github/workflows/label-triaged.yml
vendored
6
.github/workflows/label-triaged.yml
vendored
@@ -16,9 +16,9 @@ jobs:
|
|||||||
issue-number: ${{ github.event.issue.number }}
|
issue-number: ${{ github.event.issue.number }}
|
||||||
body: |
|
body: |
|
||||||
Thank you for taking the time to file this issue!
|
Thank you for taking the time to file this issue!
|
||||||
|
|
||||||
We have confirmed this is a bug and added it to our backlog.
|
We have confirmed this is a bug and added it to our backlog.
|
||||||
|
|
||||||
We don't have a timeline for when this issue will be fixed, but we will accept a Pull Request with a fix and a test.
|
We don't have a timeline for when this issue will be fixed, but we will accept a Pull Request with a fix and a test.
|
||||||
|
|
||||||
See the [contributing guidelines](https://github.com/vercel/vercel/blob/main/.github/CONTRIBUTING.md) for more info.
|
See the [contributing guidelines](https://github.com/vercel/vercel/blob/main/.github/CONTRIBUTING.md) for more info.
|
||||||
|
|||||||
94
.github/workflows/publish.yml
vendored
94
.github/workflows/publish.yml
vendored
@@ -3,9 +3,9 @@ name: Publish
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
tags:
|
tags:
|
||||||
- '!*'
|
- '!*'
|
||||||
|
|
||||||
env:
|
env:
|
||||||
TURBO_REMOTE_ONLY: 'true'
|
TURBO_REMOTE_ONLY: 'true'
|
||||||
@@ -16,46 +16,52 @@ jobs:
|
|||||||
publish:
|
publish:
|
||||||
name: Publish
|
name: Publish
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
id-token: write
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- name: Check Release
|
- name: Check Release
|
||||||
id: check-release
|
id: check-release
|
||||||
run: |
|
run: |
|
||||||
tag="$(git describe --tags --exact-match 2> /dev/null || :)"
|
tag="$(git describe --tags --exact-match 2> /dev/null || :)"
|
||||||
if [[ -z "$tag" ]];
|
if [[ -z "$tag" ]];
|
||||||
then
|
then
|
||||||
echo "IS_RELEASE=false" >> $GITHUB_OUTPUT
|
echo "IS_RELEASE=false" >> $GITHUB_OUTPUT
|
||||||
else
|
else
|
||||||
echo "IS_RELEASE=true" >> $GITHUB_OUTPUT
|
echo "IS_RELEASE=true" >> $GITHUB_OUTPUT
|
||||||
fi
|
fi
|
||||||
- name: Setup Go
|
- name: Setup Go
|
||||||
if: ${{ steps.check-release.outputs.IS_RELEASE == 'true' }}
|
if: ${{ steps.check-release.outputs.IS_RELEASE == 'true' }}
|
||||||
uses: actions/setup-go@v3
|
uses: actions/setup-go@v3
|
||||||
with:
|
with:
|
||||||
go-version: '1.13.15'
|
go-version: '1.13.15'
|
||||||
- name: Setup Node
|
- name: Setup Node
|
||||||
if: ${{ steps.check-release.outputs.IS_RELEASE == 'true' }}
|
if: ${{ steps.check-release.outputs.IS_RELEASE == 'true' }}
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: 16
|
node-version: 16
|
||||||
- name: install pnpm@7.24.2
|
- name: install npm@9
|
||||||
run: npm i -g pnpm@7.24.2
|
run: npm i -g npm@9
|
||||||
- name: Install
|
- name: install pnpm@7.24.2
|
||||||
if: ${{ steps.check-release.outputs.IS_RELEASE == 'true' }}
|
run: npm i -g pnpm@7.24.2
|
||||||
run: pnpm install
|
- name: Install
|
||||||
- name: Build
|
if: ${{ steps.check-release.outputs.IS_RELEASE == 'true' }}
|
||||||
if: ${{ steps.check-release.outputs.IS_RELEASE == 'true' }}
|
run: pnpm install
|
||||||
run: pnpm build
|
- name: Build
|
||||||
env:
|
if: ${{ steps.check-release.outputs.IS_RELEASE == 'true' }}
|
||||||
GA_TRACKING_ID: ${{ secrets.GA_TRACKING_ID }}
|
run: pnpm build
|
||||||
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
|
env:
|
||||||
- name: Publish
|
GA_TRACKING_ID: ${{ secrets.GA_TRACKING_ID }}
|
||||||
if: ${{ steps.check-release.outputs.IS_RELEASE == 'true' }}
|
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
|
||||||
run: pnpm publish-from-github
|
- name: Publish
|
||||||
env:
|
if: ${{ steps.check-release.outputs.IS_RELEASE == 'true' }}
|
||||||
NPM_TOKEN: ${{ secrets.NPM_TOKEN_ELEVATED }}
|
run: pnpm publish-from-github
|
||||||
GA_TRACKING_ID: ${{ secrets.GA_TRACKING_ID }}
|
env:
|
||||||
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
|
NPM_CONFIG_PROVENANCE: 'true'
|
||||||
|
NPM_TOKEN: ${{ secrets.NPM_TOKEN_ELEVATED }}
|
||||||
|
GA_TRACKING_ID: ${{ secrets.GA_TRACKING_ID }}
|
||||||
|
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
|
||||||
|
|||||||
7
.github/workflows/test-integration-cli.yml
vendored
7
.github/workflows/test-integration-cli.yml
vendored
@@ -3,9 +3,9 @@ name: CLI
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
tags:
|
tags:
|
||||||
- '!*'
|
- '!*'
|
||||||
pull_request:
|
pull_request:
|
||||||
|
|
||||||
env:
|
env:
|
||||||
@@ -31,9 +31,6 @@ jobs:
|
|||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
fetch-depth: 2
|
fetch-depth: 2
|
||||||
- uses: actions/setup-go@v3
|
|
||||||
with:
|
|
||||||
go-version: '1.18'
|
|
||||||
- uses: actions/setup-node@v3
|
- uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: ${{ matrix.node }}
|
node-version: ${{ matrix.node }}
|
||||||
|
|||||||
35
.github/workflows/test-lint.yml
vendored
Normal file
35
.github/workflows/test-lint.yml
vendored
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
name: Lint
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
tags:
|
||||||
|
- '!*'
|
||||||
|
pull_request:
|
||||||
|
|
||||||
|
env:
|
||||||
|
TURBO_REMOTE_ONLY: 'true'
|
||||||
|
TURBO_TEAM: 'vercel'
|
||||||
|
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
|
||||||
|
NODE_VERSION: '16'
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
|
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test:
|
||||||
|
name: Lint
|
||||||
|
timeout-minutes: 10
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version: ${{ env.NODE_VERSION }}
|
||||||
|
- name: install pnpm@7.24.2
|
||||||
|
run: npm i -g pnpm@7.24.2
|
||||||
|
- run: pnpm install
|
||||||
|
- run: pnpm run lint
|
||||||
|
- run: pnpm run prettier-check
|
||||||
50
.github/workflows/test-unit.yml
vendored
50
.github/workflows/test-unit.yml
vendored
@@ -1,50 +0,0 @@
|
|||||||
name: Unit
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
tags:
|
|
||||||
- '!*'
|
|
||||||
pull_request:
|
|
||||||
|
|
||||||
env:
|
|
||||||
TURBO_REMOTE_ONLY: 'true'
|
|
||||||
TURBO_TEAM: 'vercel'
|
|
||||||
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
|
|
||||||
|
|
||||||
concurrency:
|
|
||||||
group: ${{ github.workflow }}-${{ github.ref }}
|
|
||||||
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
test:
|
|
||||||
name: Unit
|
|
||||||
timeout-minutes: 20
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
||||||
node: [16]
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
steps:
|
|
||||||
- uses: actions/setup-go@v3
|
|
||||||
with:
|
|
||||||
go-version: '1.13.15'
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
with:
|
|
||||||
fetch-depth: 2
|
|
||||||
- uses: actions/setup-node@v3
|
|
||||||
with:
|
|
||||||
node-version: ${{ matrix.node }}
|
|
||||||
- name: install pnpm@7.24.2
|
|
||||||
run: npm i -g pnpm@7.24.2
|
|
||||||
- run: pnpm install
|
|
||||||
- run: pnpm run build
|
|
||||||
- run: pnpm run lint
|
|
||||||
if: matrix.os == 'ubuntu-latest' && matrix.node == 14 # only run lint once
|
|
||||||
- run: pnpm run test-unit
|
|
||||||
- run: pnpm -C packages/cli run coverage
|
|
||||||
if: matrix.os == 'ubuntu-latest' && matrix.node == 14 # only run coverage once
|
|
||||||
env:
|
|
||||||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
|
||||||
10
.github/workflows/test.yml
vendored
10
.github/workflows/test.yml
vendored
@@ -3,9 +3,9 @@ name: Tests
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
tags:
|
tags:
|
||||||
- '!*'
|
- '!*'
|
||||||
pull_request:
|
pull_request:
|
||||||
|
|
||||||
env:
|
env:
|
||||||
@@ -29,9 +29,6 @@ jobs:
|
|||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
fetch-depth: 2
|
fetch-depth: 2
|
||||||
- uses: actions/setup-go@v3
|
|
||||||
with:
|
|
||||||
go-version: '1.13.15'
|
|
||||||
- uses: actions/setup-node@v3
|
- uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: ${{ env.NODE_VERSION }}
|
node-version: ${{ env.NODE_VERSION }}
|
||||||
@@ -66,9 +63,6 @@ jobs:
|
|||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
fetch-depth: 2
|
fetch-depth: 2
|
||||||
- uses: actions/setup-go@v3
|
|
||||||
with:
|
|
||||||
go-version: '1.13.15'
|
|
||||||
- uses: actions/setup-node@v3
|
- uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: ${{ env.NODE_VERSION }}
|
node-version: ${{ env.NODE_VERSION }}
|
||||||
|
|||||||
28
.github/workflows/update-remix-run-dev.yml
vendored
Normal file
28
.github/workflows/update-remix-run-dev.yml
vendored
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
name: Update @remix-run/dev
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
new-version:
|
||||||
|
type: string
|
||||||
|
description: 'Optional version to update @remix-run/dev to inside of @vercel/remix-builder'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
update-remix-run-dev:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
- name: Setup node
|
||||||
|
uses: actions/setup-node@v3
|
||||||
|
- name: Enable corepack
|
||||||
|
run: corepack enable pnpm
|
||||||
|
- name: Update @remix-run/dev
|
||||||
|
uses: actions/github-script@v6
|
||||||
|
with:
|
||||||
|
github-token: ${{ secrets.GH_TOKEN_PULL_REQUESTS }}
|
||||||
|
script: |
|
||||||
|
const script = require('./utils/update-remix-run-dev.js')
|
||||||
|
await script({ github, context }, "${{ inputs.new-version }}")
|
||||||
1
.npmrc
1
.npmrc
@@ -1,3 +1,4 @@
|
|||||||
|
provenance=true
|
||||||
save-exact=true
|
save-exact=true
|
||||||
hoist-pattern[]=!"**/@types/**"
|
hoist-pattern[]=!"**/@types/**"
|
||||||
hoist-pattern[]=!"**/typedoc"
|
hoist-pattern[]=!"**/typedoc"
|
||||||
|
|||||||
@@ -7,3 +7,28 @@ examples/sveltekit-1
|
|||||||
|
|
||||||
# gatsby-plugin-vercel-analytics
|
# gatsby-plugin-vercel-analytics
|
||||||
packages/gatsby-plugin-vercel-analytics
|
packages/gatsby-plugin-vercel-analytics
|
||||||
|
|
||||||
|
# ignore directories that are not source code
|
||||||
|
node_modules
|
||||||
|
dist
|
||||||
|
pnpm-lock.yaml
|
||||||
|
.vscode
|
||||||
|
.DS_Store
|
||||||
|
.next
|
||||||
|
.vercel
|
||||||
|
.turbo
|
||||||
|
.eslintcache
|
||||||
|
.output
|
||||||
|
.vercel_build_output
|
||||||
|
.vercel
|
||||||
|
coverage
|
||||||
|
turbo-cache-key.json
|
||||||
|
/examples
|
||||||
|
/public
|
||||||
|
packages/*/dist
|
||||||
|
packages/*/node_modules
|
||||||
|
packages/**/test/fixtures
|
||||||
|
packages/**/test/dev/fixtures
|
||||||
|
packages/**/test/build-fixtures
|
||||||
|
packages/**/test/cache-fixtures
|
||||||
|
|
||||||
|
|||||||
@@ -79,18 +79,23 @@ project. An example use-case is that `@vercel/node` uses this function to cache
|
|||||||
the `node_modules` directory, making it faster to install npm dependencies for
|
the `node_modules` directory, making it faster to install npm dependencies for
|
||||||
future builds.
|
future builds.
|
||||||
|
|
||||||
|
> Note: Only files within the repo root directory can be cached.
|
||||||
|
|
||||||
**Example:**
|
**Example:**
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { PrepareCacheOptions } from '@vercel/build-utils';
|
import { relative } from 'path';
|
||||||
|
import { glob, PrepareCache } from '@vercel/build-utils';
|
||||||
|
|
||||||
export async function prepareCache(options: PrepareCacheOptions) {
|
export const prepareCache: PrepareCache = async ({
|
||||||
|
workPath,
|
||||||
|
repoRootPath,
|
||||||
|
}) => {
|
||||||
// Create a mapping of file names and `File` object instances to cache here…
|
// Create a mapping of file names and `File` object instances to cache here…
|
||||||
|
const rootDirectory = relative(repoRootPath, workPath);
|
||||||
return {
|
const cache = await glob(`${rootDirectory}/some/dir/**`, repoRootPath);
|
||||||
'path-to-file': File,
|
return cache;
|
||||||
};
|
};
|
||||||
}
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### `shouldServe()`
|
### `shouldServe()`
|
||||||
|
|||||||
@@ -51,8 +51,11 @@ export async function getGitHubRepoInfo(repo: Repo) {
|
|||||||
data.subdir = repo.path.slice(subdirPath.length).split('/');
|
data.subdir = repo.path.slice(subdirPath.length).split('/');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data.id === 'vercel/vercel' && data.subdir && data.subdir[0] === 'examples') {
|
if (
|
||||||
|
data.id === 'vercel/vercel' &&
|
||||||
|
data.subdir &&
|
||||||
|
data.subdir[0] === 'examples'
|
||||||
|
) {
|
||||||
// from our examples, add `homepage` and `description` fields
|
// from our examples, add `homepage` and `description` fields
|
||||||
const example = data.subdir[1];
|
const example = data.subdir[1];
|
||||||
const exampleList = await getExampleList();
|
const exampleList = await getExampleList();
|
||||||
|
|||||||
@@ -33,7 +33,12 @@ async function main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const existingExamples = exampleDirs
|
const existingExamples = exampleDirs
|
||||||
.filter(dir => dir.isDirectory())
|
.filter(
|
||||||
|
dir =>
|
||||||
|
dir.isDirectory() &&
|
||||||
|
dir.name !== 'node_modules' &&
|
||||||
|
dir.name !== '__tests__'
|
||||||
|
)
|
||||||
.map(dir => ({
|
.map(dir => ({
|
||||||
name: dir.name,
|
name: dir.name,
|
||||||
visible: true,
|
visible: true,
|
||||||
|
|||||||
10
codecov.yml
10
codecov.yml
@@ -1,10 +0,0 @@
|
|||||||
codecov:
|
|
||||||
require_ci_to_pass: yes
|
|
||||||
|
|
||||||
coverage:
|
|
||||||
status:
|
|
||||||
project: off
|
|
||||||
patch: off
|
|
||||||
|
|
||||||
fixes:
|
|
||||||
- "::packages/cli/" # move root e.g., "path/" => "after/path/"
|
|
||||||
@@ -14,7 +14,9 @@ In order to create the smallest possible lambdas Next.js has to be configured to
|
|||||||
npm install next --save
|
npm install next --save
|
||||||
```
|
```
|
||||||
|
|
||||||
2. Add the `now-build` script to your `package.json`
|
2. Check [Node.js Version](https://vercel.link/node-version) in your Project Settings. Using an old or incompatible version of Node.js can cause the Build Step to fail with this error message.
|
||||||
|
|
||||||
|
3. Add the `now-build` script to your `package.json` [deprecated]
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
@@ -24,7 +26,7 @@ npm install next --save
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
3. Add `target: 'serverless'` to `next.config.js` [deprecated]
|
4. Add `target: 'serverless'` to `next.config.js` [deprecated]
|
||||||
|
|
||||||
```js
|
```js
|
||||||
module.exports = {
|
module.exports = {
|
||||||
@@ -33,9 +35,9 @@ module.exports = {
|
|||||||
};
|
};
|
||||||
```
|
```
|
||||||
|
|
||||||
4. Remove `distDir` from `next.config.js` as `@vercel/next` can't parse this file and expects your build output at `/.next`
|
5. Remove `distDir` from `next.config.js` as `@vercel/next` can't parse this file and expects your build output at `/.next`
|
||||||
|
|
||||||
5. Optionally make sure the `"src"` in `"builds"` points to your application `package.json`
|
6. Optionally make sure the `"src"` in `"builds"` points to your application `package.json`
|
||||||
|
|
||||||
```js
|
```js
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -38,9 +38,9 @@ All commands are run from the root of the project, from a terminal:
|
|||||||
|
|
||||||
| Command | Action |
|
| Command | Action |
|
||||||
| :--------------------- | :------------------------------------------------- |
|
| :--------------------- | :------------------------------------------------- |
|
||||||
| `npm install` | Installs dependencies |
|
| `pnpm install` | Installs dependencies |
|
||||||
| `npm run dev` | Starts local dev server at `localhost:3000` |
|
| `pnpm run dev` | Starts local dev server at `localhost:3000` |
|
||||||
| `npm run build` | Build your production site to `./dist/` |
|
| `pnpm run build` | Build your production site to `./dist/` |
|
||||||
| `npm run preview` | Preview your build locally, before deploying |
|
| `pnpm run preview` | Preview your build locally, before deploying |
|
||||||
| `npm run astro ...` | Run CLI commands like `astro add`, `astro preview` |
|
| `pnpm run astro ...` | Run CLI commands like `astro add`, `astro preview` |
|
||||||
| `npm run astro --help` | Get help using the Astro CLI |
|
| `pnpm run astro --help` | Get help using the Astro CLI |
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"baseUrl": ".",
|
|
||||||
"paths": {
|
"paths": {
|
||||||
"@/*": ["./*"]
|
"@/*": ["./*"]
|
||||||
}
|
}
|
||||||
|
|||||||
2523
examples/nextjs/package-lock.json
generated
2523
examples/nextjs/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -9,10 +9,9 @@
|
|||||||
"lint": "next lint"
|
"lint": "next lint"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@next/font": "13.1.6",
|
"eslint": "8.35.0",
|
||||||
"eslint": "8.32.0",
|
"eslint-config-next": "13.2.4",
|
||||||
"eslint-config-next": "13.1.6",
|
"next": "13.2.4",
|
||||||
"next": "13.1.6",
|
|
||||||
"react": "18.2.0",
|
"react": "18.2.0",
|
||||||
"react-dom": "18.2.0"
|
"react-dom": "18.2.0"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import Head from 'next/head'
|
import Head from 'next/head'
|
||||||
import Image from 'next/image'
|
import Image from 'next/image'
|
||||||
import { Inter } from '@next/font/google'
|
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'] })
|
const inter = Inter({ subsets: ['latin'] })
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { MetaFunction } from "@remix-run/node";
|
import type { MetaFunction } from "@vercel/remix";
|
||||||
import {
|
import {
|
||||||
Links,
|
Links,
|
||||||
LiveReload,
|
LiveReload,
|
||||||
@@ -7,7 +7,7 @@ import {
|
|||||||
Scripts,
|
Scripts,
|
||||||
ScrollRestoration,
|
ScrollRestoration,
|
||||||
} from "@remix-run/react";
|
} from "@remix-run/react";
|
||||||
import { Analytics } from '@vercel/analytics/react';
|
import { Analytics } from "@vercel/analytics/react";
|
||||||
|
|
||||||
export const meta: MetaFunction = () => ({
|
export const meta: MetaFunction = () => ({
|
||||||
charset: "utf-8",
|
charset: "utf-8",
|
||||||
|
|||||||
9
examples/remix/app/routes/edge.tsx
Normal file
9
examples/remix/app/routes/edge.tsx
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
export const config = { runtime: "edge" };
|
||||||
|
|
||||||
|
export default function Edge() {
|
||||||
|
return (
|
||||||
|
<div style={{ fontFamily: "system-ui, sans-serif", lineHeight: "1.4" }}>
|
||||||
|
<h1>Welcome to Remix@Edge</h1>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -6,20 +6,19 @@
|
|||||||
"dev": "remix dev"
|
"dev": "remix dev"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@remix-run/node": "^1.7.6",
|
"@remix-run/node": "^1.14.3",
|
||||||
"@remix-run/react": "^1.7.6",
|
"@remix-run/react": "^1.14.3",
|
||||||
"@remix-run/vercel": "^1.7.6",
|
"@remix-run/serve": "^1.14.3",
|
||||||
"@vercel/analytics": "^0.1.5",
|
"@vercel/analytics": "^0.1.11",
|
||||||
"@vercel/node": "^2.7.0",
|
"@vercel/remix": "1.14.3-patch.1",
|
||||||
"react": "^18.2.0",
|
"react": "^18.2.0",
|
||||||
"react-dom": "^18.2.0"
|
"react-dom": "^18.2.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@remix-run/dev": "^1.7.6",
|
"@remix-run/dev": "^1.14.3",
|
||||||
"@remix-run/eslint-config": "^1.7.6",
|
"@remix-run/eslint-config": "^1.14.3",
|
||||||
"@remix-run/serve": "^1.7.6",
|
|
||||||
"@types/react": "^18.0.25",
|
"@types/react": "^18.0.25",
|
||||||
"@types/react-dom": "^18.0.9",
|
"@types/react-dom": "^18.0.11",
|
||||||
"eslint": "^8.28.0",
|
"eslint": "^8.28.0",
|
||||||
"typescript": "^4.9.3"
|
"typescript": "^4.9.3"
|
||||||
},
|
},
|
||||||
|
|||||||
3530
examples/remix/pnpm-lock.yaml
generated
3530
examples/remix/pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@@ -1,13 +1,10 @@
|
|||||||
/** @type {import('@remix-run/dev').AppConfig} */
|
/**
|
||||||
|
* @type {import('@remix-run/dev').AppConfig}
|
||||||
|
*/
|
||||||
module.exports = {
|
module.exports = {
|
||||||
serverBuildTarget: "vercel",
|
ignoredRouteFiles: ['**/.*'],
|
||||||
// When running locally in development mode, we use the built in remix
|
|
||||||
// server. This does not understand the vercel lambda module format,
|
|
||||||
// so we default back to the standard build output.
|
|
||||||
server: process.env.NODE_ENV === "development" ? undefined : "./server.js",
|
|
||||||
ignoredRouteFiles: ["**/.*"],
|
|
||||||
// appDirectory: "app",
|
// appDirectory: "app",
|
||||||
// assetsBuildDirectory: "public/build",
|
// assetsBuildDirectory: "public/build",
|
||||||
// serverBuildPath: "api/index.js",
|
// serverBuildPath: "build/index.js",
|
||||||
// publicPath: "/build/",
|
// publicPath: "/build/",
|
||||||
};
|
};
|
||||||
|
|||||||
2
examples/remix/remix.env.d.ts
vendored
2
examples/remix/remix.env.d.ts
vendored
@@ -1,2 +1,2 @@
|
|||||||
/// <reference types="@remix-run/dev" />
|
/// <reference types="@remix-run/dev" />
|
||||||
/// <reference types="@remix-run/node" />
|
/// <reference types="@vercel/remix" />
|
||||||
|
|||||||
11
internals/tsconfig/package.json
Normal file
11
internals/tsconfig/package.json
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"private": true,
|
||||||
|
"name": "@vercel-internals/tsconfig",
|
||||||
|
"description": "Node.js tsconfig file based on `@vercel/style-guide`",
|
||||||
|
"files": [
|
||||||
|
"tsconfig.json"
|
||||||
|
],
|
||||||
|
"devDependencies": {
|
||||||
|
"@vercel/style-guide": "4.0.2"
|
||||||
|
}
|
||||||
|
}
|
||||||
12
internals/tsconfig/tsconfig.json
Normal file
12
internals/tsconfig/tsconfig.json
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"extends": "@vercel/style-guide/typescript",
|
||||||
|
"compilerOptions": {
|
||||||
|
"declaration": true,
|
||||||
|
"allowJs": true,
|
||||||
|
"moduleResolution": "node",
|
||||||
|
"module": "commonjs",
|
||||||
|
"lib": ["ES2020"],
|
||||||
|
"resolveJsonModule": true,
|
||||||
|
"sourceMap": true
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -300,6 +300,7 @@ export interface Secret {
|
|||||||
createdAt: number;
|
createdAt: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO (Ethan-Arrowood) - Replace enums
|
||||||
export enum ProjectEnvTarget {
|
export enum ProjectEnvTarget {
|
||||||
Production = 'production',
|
Production = 'production',
|
||||||
Preview = 'preview',
|
Preview = 'preview',
|
||||||
21
internals/types/package.json
Normal file
21
internals/types/package.json
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
{
|
||||||
|
"private": true,
|
||||||
|
"name": "@vercel-internals/types",
|
||||||
|
"types": "dist/index.d.ts",
|
||||||
|
"main": "dist/index.js",
|
||||||
|
"files": [
|
||||||
|
"dist"
|
||||||
|
],
|
||||||
|
"scripts": {
|
||||||
|
"build": "tsc -p tsconfig.json"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@vercel/build-utils": "6.3.2",
|
||||||
|
"@vercel/routing-utils": "2.1.10"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@vercel-internals/tsconfig": "*",
|
||||||
|
"@vercel/style-guide": "4.0.2",
|
||||||
|
"typescript": "4.9.4"
|
||||||
|
}
|
||||||
|
}
|
||||||
7
internals/types/tsconfig.json
Normal file
7
internals/types/tsconfig.json
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"extends": "@vercel-internals/tsconfig",
|
||||||
|
"compilerOptions": {
|
||||||
|
"outDir": "./dist"
|
||||||
|
},
|
||||||
|
"include": ["index.ts"]
|
||||||
|
}
|
||||||
17
internals/utils/package.json
Normal file
17
internals/utils/package.json
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"private": true,
|
||||||
|
"name": "@vercel-internals/utils",
|
||||||
|
"types": "dist/index.d.ts",
|
||||||
|
"main": "dist/index.js",
|
||||||
|
"files": [
|
||||||
|
"dist"
|
||||||
|
],
|
||||||
|
"scripts": {
|
||||||
|
"build": "tsc -p tsconfig.json"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@vercel-internals/tsconfig": "*",
|
||||||
|
"@vercel/style-guide": "4.0.2",
|
||||||
|
"typescript": "4.9.4"
|
||||||
|
}
|
||||||
|
}
|
||||||
0
internals/utils/src/index.ts
Normal file
0
internals/utils/src/index.ts
Normal file
7
internals/utils/tsconfig.json
Normal file
7
internals/utils/tsconfig.json
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"extends": "@vercel-internals/tsconfig",
|
||||||
|
"compilerOptions": {
|
||||||
|
"outDir": "dist"
|
||||||
|
},
|
||||||
|
"include": ["src/**/*"]
|
||||||
|
}
|
||||||
13
package.json
13
package.json
@@ -32,7 +32,7 @@
|
|||||||
"source-map-support": "0.5.12",
|
"source-map-support": "0.5.12",
|
||||||
"ts-eager": "2.0.2",
|
"ts-eager": "2.0.2",
|
||||||
"ts-jest": "28.0.5",
|
"ts-jest": "28.0.5",
|
||||||
"turbo": "1.7.4"
|
"turbo": "1.8.5"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"lerna": "lerna",
|
"lerna": "lerna",
|
||||||
@@ -42,15 +42,16 @@
|
|||||||
"publish-canary": "git checkout main && git pull && lerna version prerelease --preid canary --message \"Publish Canary\" --exact",
|
"publish-canary": "git checkout main && git pull && lerna version prerelease --preid canary --message \"Publish Canary\" --exact",
|
||||||
"publish-from-github": "./utils/publish.sh",
|
"publish-from-github": "./utils/publish.sh",
|
||||||
"changelog": "node utils/changelog.js",
|
"changelog": "node utils/changelog.js",
|
||||||
"build": "node utils/gen.js && turbo run build",
|
"build": "node utils/gen.js && turbo --no-update-notifier run build",
|
||||||
"vercel-build": "pnpm build && pnpm 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",
|
"pre-commit": "lint-staged",
|
||||||
"test": "jest --rootDir=\"test\" --testPathPattern=\"\\.test.js\"",
|
"test": "jest --rootDir=\"test\" --testPathPattern=\"\\.test.js\"",
|
||||||
"test-unit": "pnpm test && node utils/gen.js && turbo run test-unit",
|
"test-unit": "pnpm test && node utils/gen.js && turbo --no-update-notifier run test-unit",
|
||||||
"test-cli": "node utils/gen.js && turbo run test-cli",
|
"test-cli": "node utils/gen.js && turbo --no-update-notifier run test-cli",
|
||||||
"test-e2e": "node utils/gen.js && turbo run test-e2e",
|
"test-e2e": "node utils/gen.js && turbo --no-update-notifier run test-e2e",
|
||||||
"test-dev": "node utils/gen.js && turbo run test-dev",
|
"test-dev": "node utils/gen.js && turbo --no-update-notifier run test-dev",
|
||||||
"lint": "eslint . --cache --ext .ts,.js",
|
"lint": "eslint . --cache --ext .ts,.js",
|
||||||
|
"prettier-check": "prettier --check .",
|
||||||
"prepare": "husky install",
|
"prepare": "husky install",
|
||||||
"pack": "cd utils && node -r ts-eager/register ./pack.ts"
|
"pack": "cd utils && node -r ts-eager/register ./pack.ts"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@vercel/build-utils",
|
"name": "@vercel/build-utils",
|
||||||
"version": "6.3.0",
|
"version": "6.6.0",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"main": "./dist/index.js",
|
"main": "./dist/index.js",
|
||||||
"types": "./dist/index.d.js",
|
"types": "./dist/index.d.js",
|
||||||
|
|||||||
@@ -25,12 +25,16 @@ export async function readConfigFile<T>(
|
|||||||
|
|
||||||
if (data) {
|
if (data) {
|
||||||
const str = data.toString('utf8');
|
const str = data.toString('utf8');
|
||||||
if (name.endsWith('.json')) {
|
try {
|
||||||
return JSON.parse(str) as T;
|
if (name.endsWith('.json')) {
|
||||||
} else if (name.endsWith('.toml')) {
|
return JSON.parse(str) as T;
|
||||||
return (toml.parse(str) as unknown) as T;
|
} else if (name.endsWith('.toml')) {
|
||||||
} else if (name.endsWith('.yaml') || name.endsWith('.yml')) {
|
return toml.parse(str) as unknown as T;
|
||||||
return yaml.safeLoad(str, { filename: name }) as T;
|
} else if (name.endsWith('.yaml') || name.endsWith('.yml')) {
|
||||||
|
return yaml.safeLoad(str, { filename: name }) as T;
|
||||||
|
}
|
||||||
|
} catch (error: unknown) {
|
||||||
|
console.log(`Error while parsing config file: "${name}"`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -487,6 +487,7 @@ export function getEnvForPackageManager({
|
|||||||
const oldPath = env.PATH + '';
|
const oldPath = env.PATH + '';
|
||||||
const npm7 = '/node16/bin-npm7';
|
const npm7 = '/node16/bin-npm7';
|
||||||
const pnpm7 = '/pnpm7/node_modules/.bin';
|
const pnpm7 = '/pnpm7/node_modules/.bin';
|
||||||
|
const pnpm8 = '/pnpm8/node_modules/.bin';
|
||||||
const corepackEnabled = env.ENABLE_EXPERIMENTAL_COREPACK === '1';
|
const corepackEnabled = env.ENABLE_EXPERIMENTAL_COREPACK === '1';
|
||||||
if (cliType === 'npm') {
|
if (cliType === 'npm') {
|
||||||
if (
|
if (
|
||||||
@@ -509,7 +510,20 @@ export function getEnvForPackageManager({
|
|||||||
) {
|
) {
|
||||||
// Ensure that pnpm 7 is at the beginning of the `$PATH`
|
// Ensure that pnpm 7 is at the beginning of the `$PATH`
|
||||||
newEnv.PATH = `${pnpm7}${path.delimiter}${oldPath}`;
|
newEnv.PATH = `${pnpm7}${path.delimiter}${oldPath}`;
|
||||||
console.log('Detected `pnpm-lock.yaml` generated by pnpm 7...');
|
console.log(
|
||||||
|
`Detected \`pnpm-lock.yaml\` version ${lockfileVersion} generated by pnpm 7...`
|
||||||
|
);
|
||||||
|
} else if (
|
||||||
|
typeof lockfileVersion === 'number' &&
|
||||||
|
lockfileVersion >= 6 &&
|
||||||
|
!oldPath.includes(pnpm8) &&
|
||||||
|
!corepackEnabled
|
||||||
|
) {
|
||||||
|
// Ensure that pnpm 8 is at the beginning of the `$PATH`
|
||||||
|
newEnv.PATH = `${pnpm8}${path.delimiter}${oldPath}`;
|
||||||
|
console.log(
|
||||||
|
`Detected \`pnpm-lock.yaml\` version ${lockfileVersion} generated by pnpm 8...`
|
||||||
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Yarn v2 PnP mode may be activated, so force "node-modules" linker style
|
// Yarn v2 PnP mode may be activated, so force "node-modules" linker style
|
||||||
|
|||||||
@@ -14,10 +14,11 @@ export function getPrefixedEnvVars({
|
|||||||
envs: Envs;
|
envs: Envs;
|
||||||
}): Envs {
|
}): Envs {
|
||||||
const vercelSystemEnvPrefix = 'VERCEL_';
|
const vercelSystemEnvPrefix = 'VERCEL_';
|
||||||
|
const allowed = ['VERCEL_URL', 'VERCEL_ENV', 'VERCEL_REGION'];
|
||||||
const newEnvs: Envs = {};
|
const newEnvs: Envs = {};
|
||||||
if (envPrefix && envs.VERCEL_URL) {
|
if (envPrefix && envs.VERCEL_URL) {
|
||||||
Object.keys(envs)
|
Object.keys(envs)
|
||||||
.filter(key => key.startsWith(vercelSystemEnvPrefix))
|
.filter(key => allowed.includes(key) || key.startsWith('VERCEL_GIT_'))
|
||||||
.forEach(key => {
|
.forEach(key => {
|
||||||
const newKey = `${envPrefix}${key}`;
|
const newKey = `${envPrefix}${key}`;
|
||||||
if (!(newKey in envs)) {
|
if (!(newKey in envs)) {
|
||||||
|
|||||||
79
packages/build-utils/src/hard-link-dir.ts
Normal file
79
packages/build-utils/src/hard-link-dir.ts
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
// Source: https://github.com/pnpm/pnpm/blob/b38d711f3892a473e20e69dd32ca7e1b439efaec/fs/hard-link-dir/src/index.ts#L4
|
||||||
|
// LICENSE (MIT): https://github.com/pnpm/pnpm/blob/b38d711f3892a473e20e69dd32ca7e1b439efaec/LICENSE
|
||||||
|
|
||||||
|
import path from 'path';
|
||||||
|
import { promises as fs } from 'fs';
|
||||||
|
|
||||||
|
export async function hardLinkDir(src: string, destDirs: string[]) {
|
||||||
|
if (destDirs.length === 0) return;
|
||||||
|
// Don't try to hard link the source directory to itself
|
||||||
|
destDirs = destDirs.filter(destDir => path.relative(destDir, src) !== '');
|
||||||
|
const files = await fs.readdir(src);
|
||||||
|
await Promise.all(
|
||||||
|
files.map(async file => {
|
||||||
|
if (file === 'node_modules') return;
|
||||||
|
const srcFile = path.join(src, file);
|
||||||
|
if ((await fs.lstat(srcFile)).isDirectory()) {
|
||||||
|
const destSubdirs = await Promise.all(
|
||||||
|
destDirs.map(async destDir => {
|
||||||
|
const destSubdir = path.join(destDir, file);
|
||||||
|
try {
|
||||||
|
await fs.mkdir(destSubdir, { recursive: true });
|
||||||
|
} catch (err: any) {
|
||||||
|
// eslint-disable-line
|
||||||
|
if (err.code !== 'EEXIST') throw err;
|
||||||
|
}
|
||||||
|
return destSubdir;
|
||||||
|
})
|
||||||
|
);
|
||||||
|
await hardLinkDir(srcFile, destSubdirs);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
await Promise.all(
|
||||||
|
destDirs.map(async destDir => {
|
||||||
|
const destFile = path.join(destDir, file);
|
||||||
|
try {
|
||||||
|
await linkOrCopyFile(srcFile, destFile);
|
||||||
|
} catch (err: any) {
|
||||||
|
// eslint-disable-line
|
||||||
|
if (err.code === 'ENOENT') {
|
||||||
|
// Ignore broken symlinks
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
);
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function linkOrCopyFile(srcFile: string, destFile: string) {
|
||||||
|
try {
|
||||||
|
await linkOrCopy(srcFile, destFile);
|
||||||
|
} catch (err: any) {
|
||||||
|
// eslint-disable-line
|
||||||
|
if (err.code === 'ENOENT') {
|
||||||
|
await fs.mkdir(path.dirname(destFile), { recursive: true });
|
||||||
|
await linkOrCopy(srcFile, destFile);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (err.code !== 'EEXIST') {
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This function could be optimized because we don't really need to try linking again
|
||||||
|
* if linking failed once.
|
||||||
|
*/
|
||||||
|
async function linkOrCopy(srcFile: string, destFile: string) {
|
||||||
|
try {
|
||||||
|
await fs.link(srcFile, destFile);
|
||||||
|
} catch (err: any) {
|
||||||
|
// eslint-disable-line
|
||||||
|
if (err.code !== 'EXDEV') throw err;
|
||||||
|
await fs.copyFile(srcFile, destFile);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -42,6 +42,7 @@ import getIgnoreFilter from './get-ignore-filter';
|
|||||||
import { getPlatformEnv } from './get-platform-env';
|
import { getPlatformEnv } from './get-platform-env';
|
||||||
import { getPrefixedEnvVars } from './get-prefixed-env-vars';
|
import { getPrefixedEnvVars } from './get-prefixed-env-vars';
|
||||||
import { cloneEnv } from './clone-env';
|
import { cloneEnv } from './clone-env';
|
||||||
|
import { hardLinkDir } from './hard-link-dir';
|
||||||
|
|
||||||
export {
|
export {
|
||||||
FileBlob,
|
FileBlob,
|
||||||
@@ -86,6 +87,7 @@ export {
|
|||||||
scanParentDirs,
|
scanParentDirs,
|
||||||
getIgnoreFilter,
|
getIgnoreFilter,
|
||||||
cloneEnv,
|
cloneEnv,
|
||||||
|
hardLinkDir,
|
||||||
};
|
};
|
||||||
|
|
||||||
export { EdgeFunction } from './edge-function';
|
export { EdgeFunction } from './edge-function';
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ interface PrerenderOptions {
|
|||||||
initialHeaders?: Record<string, string>;
|
initialHeaders?: Record<string, string>;
|
||||||
initialStatus?: number;
|
initialStatus?: number;
|
||||||
passQuery?: boolean;
|
passQuery?: boolean;
|
||||||
|
sourcePath?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class Prerender {
|
export class Prerender {
|
||||||
@@ -24,6 +25,7 @@ export class Prerender {
|
|||||||
public initialHeaders?: Record<string, string>;
|
public initialHeaders?: Record<string, string>;
|
||||||
public initialStatus?: number;
|
public initialStatus?: number;
|
||||||
public passQuery?: boolean;
|
public passQuery?: boolean;
|
||||||
|
public sourcePath?: string;
|
||||||
|
|
||||||
constructor({
|
constructor({
|
||||||
expiration,
|
expiration,
|
||||||
@@ -35,9 +37,11 @@ export class Prerender {
|
|||||||
initialHeaders,
|
initialHeaders,
|
||||||
initialStatus,
|
initialStatus,
|
||||||
passQuery,
|
passQuery,
|
||||||
|
sourcePath,
|
||||||
}: PrerenderOptions) {
|
}: PrerenderOptions) {
|
||||||
this.type = 'Prerender';
|
this.type = 'Prerender';
|
||||||
this.expiration = expiration;
|
this.expiration = expiration;
|
||||||
|
this.sourcePath = sourcePath;
|
||||||
|
|
||||||
this.lambda = lambda;
|
this.lambda = lambda;
|
||||||
if (this.lambda) {
|
if (this.lambda) {
|
||||||
|
|||||||
@@ -355,6 +355,8 @@ export interface BuilderV3 {
|
|||||||
|
|
||||||
type ImageFormat = 'image/avif' | 'image/webp';
|
type ImageFormat = 'image/avif' | 'image/webp';
|
||||||
|
|
||||||
|
type ImageContentDispositionType = 'inline' | 'attachment';
|
||||||
|
|
||||||
export type RemotePattern = {
|
export type RemotePattern = {
|
||||||
/**
|
/**
|
||||||
* Must be `http` or `https`.
|
* Must be `http` or `https`.
|
||||||
@@ -390,6 +392,7 @@ export interface Images {
|
|||||||
formats?: ImageFormat[];
|
formats?: ImageFormat[];
|
||||||
dangerouslyAllowSVG?: boolean;
|
dangerouslyAllowSVG?: boolean;
|
||||||
contentSecurityPolicy?: string;
|
contentSecurityPolicy?: string;
|
||||||
|
contentDispositionType?: ImageContentDispositionType;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -4,8 +4,7 @@
|
|||||||
"probes": [
|
"probes": [
|
||||||
{
|
{
|
||||||
"path": "/",
|
"path": "/",
|
||||||
"mustContain": "pnpm version: 6",
|
"mustContain": "pnpm version: 7"
|
||||||
"logMustContain": "pnpm run build"
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
9
packages/build-utils/test/fixtures/27-pnpm-v7/package.json
vendored
Normal file
9
packages/build-utils/test/fixtures/27-pnpm-v7/package.json
vendored
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"private": true,
|
||||||
|
"scripts": {
|
||||||
|
"build": "mkdir -p public && (printf \"pnpm version: \" && pnpm -v) > public/index.txt"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"once": "^1.4.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
21
packages/build-utils/test/fixtures/27-pnpm-v7/pnpm-lock.yaml
generated
vendored
Normal file
21
packages/build-utils/test/fixtures/27-pnpm-v7/pnpm-lock.yaml
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
lockfileVersion: 5.4
|
||||||
|
|
||||||
|
importers:
|
||||||
|
|
||||||
|
.:
|
||||||
|
specifiers:
|
||||||
|
once: ^1.4.0
|
||||||
|
dependencies:
|
||||||
|
once: 1.4.0
|
||||||
|
|
||||||
|
packages:
|
||||||
|
|
||||||
|
/once/1.4.0:
|
||||||
|
resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==}
|
||||||
|
dependencies:
|
||||||
|
wrappy: 1.0.2
|
||||||
|
dev: false
|
||||||
|
|
||||||
|
/wrappy/1.0.2:
|
||||||
|
resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==}
|
||||||
|
dev: false
|
||||||
1
packages/build-utils/test/fixtures/27-pnpm-v7/pnpm-workspace.yaml
vendored
Normal file
1
packages/build-utils/test/fixtures/27-pnpm-v7/pnpm-workspace.yaml
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
# Empty so this is treated as its own pnpm workspace
|
||||||
8
packages/build-utils/test/fixtures/27-pnpm-v7/probes.json
vendored
Normal file
8
packages/build-utils/test/fixtures/27-pnpm-v7/probes.json
vendored
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"probes": [
|
||||||
|
{
|
||||||
|
"path": "/",
|
||||||
|
"mustContain": "pnpm version: 7"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
9
packages/build-utils/test/fixtures/28-pnpm-v8/package.json
vendored
Normal file
9
packages/build-utils/test/fixtures/28-pnpm-v8/package.json
vendored
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"private": true,
|
||||||
|
"scripts": {
|
||||||
|
"build": "mkdir -p public && (printf \"pnpm version: \" && pnpm -v) > public/index.txt"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"once": "^1.4.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
21
packages/build-utils/test/fixtures/28-pnpm-v8/pnpm-lock.yaml
generated
vendored
Normal file
21
packages/build-utils/test/fixtures/28-pnpm-v8/pnpm-lock.yaml
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
lockfileVersion: '6.0'
|
||||||
|
|
||||||
|
importers:
|
||||||
|
|
||||||
|
.:
|
||||||
|
dependencies:
|
||||||
|
once:
|
||||||
|
specifier: ^1.4.0
|
||||||
|
version: 1.4.0
|
||||||
|
|
||||||
|
packages:
|
||||||
|
|
||||||
|
/once@1.4.0:
|
||||||
|
resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==}
|
||||||
|
dependencies:
|
||||||
|
wrappy: 1.0.2
|
||||||
|
dev: false
|
||||||
|
|
||||||
|
/wrappy@1.0.2:
|
||||||
|
resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==}
|
||||||
|
dev: false
|
||||||
1
packages/build-utils/test/fixtures/28-pnpm-v8/pnpm-workspace.yaml
vendored
Normal file
1
packages/build-utils/test/fixtures/28-pnpm-v8/pnpm-workspace.yaml
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
# Empty so this is treated as its own pnpm workspace
|
||||||
8
packages/build-utils/test/fixtures/28-pnpm-v8/probes.json
vendored
Normal file
8
packages/build-utils/test/fixtures/28-pnpm-v8/probes.json
vendored
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"probes": [
|
||||||
|
{
|
||||||
|
"path": "/",
|
||||||
|
"mustContain": "pnpm version: 8"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -14,6 +14,7 @@ describe('Test `getPrefixedEnvVars()`', () => {
|
|||||||
VERCEL: '1',
|
VERCEL: '1',
|
||||||
VERCEL_URL: 'example.vercel.sh',
|
VERCEL_URL: 'example.vercel.sh',
|
||||||
USER_ENV_VAR_NOT_VERCEL: 'example.com',
|
USER_ENV_VAR_NOT_VERCEL: 'example.com',
|
||||||
|
VERCEL_ARTIFACTS_TOKEN: 'abc123',
|
||||||
FOO: 'bar',
|
FOO: 'bar',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -28,6 +29,7 @@ describe('Test `getPrefixedEnvVars()`', () => {
|
|||||||
envPrefix: 'GATSBY_',
|
envPrefix: 'GATSBY_',
|
||||||
envs: {
|
envs: {
|
||||||
USER_ENV_VAR_NOT_VERCEL: 'example.com',
|
USER_ENV_VAR_NOT_VERCEL: 'example.com',
|
||||||
|
VERCEL_ARTIFACTS_TOKEN: 'abc123',
|
||||||
FOO: 'bar',
|
FOO: 'bar',
|
||||||
VERCEL_URL: 'example.vercel.sh',
|
VERCEL_URL: 'example.vercel.sh',
|
||||||
VERCEL_ENV: 'production',
|
VERCEL_ENV: 'production',
|
||||||
@@ -51,6 +53,7 @@ describe('Test `getPrefixedEnvVars()`', () => {
|
|||||||
USER_ENV_VAR_NOT_VERCEL: 'example.com',
|
USER_ENV_VAR_NOT_VERCEL: 'example.com',
|
||||||
FOO: 'bar',
|
FOO: 'bar',
|
||||||
BLARG_VERCEL_THING: 'fake',
|
BLARG_VERCEL_THING: 'fake',
|
||||||
|
VERCEL_ARTIFACTS_TOKEN: 'abc123',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
want: {},
|
want: {},
|
||||||
|
|||||||
77
packages/build-utils/test/unit.read-config-file.test.ts
vendored
Normal file
77
packages/build-utils/test/unit.read-config-file.test.ts
vendored
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
import { join } from 'path';
|
||||||
|
import { writeFile, rm } from 'fs/promises';
|
||||||
|
import { readConfigFile } from '../src';
|
||||||
|
|
||||||
|
describe('Test `readConfigFile()`', () => {
|
||||||
|
let logMessages: string[];
|
||||||
|
const originalConsoleLog = console.log;
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
logMessages = [];
|
||||||
|
console.log = m => {
|
||||||
|
logMessages.push(m);
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
console.log = originalConsoleLog;
|
||||||
|
});
|
||||||
|
|
||||||
|
const doesnotexist = join(__dirname, 'does-not-exist.json');
|
||||||
|
const tsconfig = join(__dirname, '../tsconfig.json');
|
||||||
|
const invalid = join(__dirname, 'invalid.json');
|
||||||
|
|
||||||
|
it('should return null when file does not exist', async () => {
|
||||||
|
expect(await readConfigFile(doesnotexist)).toBeNull();
|
||||||
|
expect(logMessages).toEqual([]);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return parsed object when file exists', async () => {
|
||||||
|
expect(await readConfigFile(tsconfig)).toMatchObject({
|
||||||
|
compilerOptions: {
|
||||||
|
strict: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
expect(logMessages).toEqual([]);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return parsed object when at least one file exists', async () => {
|
||||||
|
const files = [doesnotexist, tsconfig];
|
||||||
|
expect(await readConfigFile(files)).toMatchObject({
|
||||||
|
compilerOptions: {
|
||||||
|
strict: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
expect(logMessages).toEqual([]);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return null when parse fails', async () => {
|
||||||
|
try {
|
||||||
|
await writeFile(invalid, 'borked');
|
||||||
|
expect(await readConfigFile(invalid)).toBeNull();
|
||||||
|
} finally {
|
||||||
|
await rm(invalid);
|
||||||
|
}
|
||||||
|
expect(logMessages.length).toBe(1);
|
||||||
|
expect(logMessages[0]).toMatch(
|
||||||
|
/^Error while parsing config file.+invalid.json/
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return parsed object when at least one file is valid', async () => {
|
||||||
|
try {
|
||||||
|
await writeFile(invalid, 'borked');
|
||||||
|
expect(await readConfigFile([invalid, tsconfig])).toMatchObject({
|
||||||
|
compilerOptions: {
|
||||||
|
strict: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
} finally {
|
||||||
|
await rm(invalid);
|
||||||
|
}
|
||||||
|
expect(logMessages.length).toBe(1);
|
||||||
|
expect(logMessages[0]).toMatch(
|
||||||
|
/^Error while parsing config file.+invalid.json/
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
5
packages/build-utils/test/unit.test.ts
vendored
5
packages/build-utils/test/unit.test.ts
vendored
@@ -506,6 +506,11 @@ it('should retry npm install when peer deps invalid and npm@8 on node@16', async
|
|||||||
console.log('Skipping test on windows');
|
console.log('Skipping test on windows');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (process.platform === 'darwin') {
|
||||||
|
console.log('Skipping test on mac');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const fixture = path.join(__dirname, 'fixtures', '15-npm-8-legacy-peer-deps');
|
const fixture = path.join(__dirname, 'fixtures', '15-npm-8-legacy-peer-deps');
|
||||||
const nodeVersion = { major: nodeMajor } as any;
|
const nodeVersion = { major: nodeMajor } as any;
|
||||||
await runNpmInstall(fixture, [], {}, {}, nodeVersion);
|
await runNpmInstall(fixture, [], {}, {}, nodeVersion);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "vercel",
|
"name": "vercel",
|
||||||
"version": "28.16.0",
|
"version": "28.18.2",
|
||||||
"preferGlobal": true,
|
"preferGlobal": true,
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"description": "The command-line interface for Vercel",
|
"description": "The command-line interface for Vercel",
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
"preinstall": "node ./scripts/preinstall.js",
|
"preinstall": "node ./scripts/preinstall.js",
|
||||||
"test": "jest --env node --verbose --bail",
|
"test": "jest --env node --verbose --bail",
|
||||||
"test-unit": "pnpm test test/unit/",
|
"test-unit": "pnpm test test/unit/",
|
||||||
"test-cli": "rimraf test/fixtures/integration && ava test/integration.js --serial --fail-fast --verbose",
|
"test-cli": "rimraf test/fixtures/integration && pnpm test test/integration.test.ts",
|
||||||
"test-dev": "pnpm test test/dev/",
|
"test-dev": "pnpm test test/dev/",
|
||||||
"coverage": "codecov",
|
"coverage": "codecov",
|
||||||
"build": "ts-node ./scripts/build.ts",
|
"build": "ts-node ./scripts/build.ts",
|
||||||
@@ -28,29 +28,20 @@
|
|||||||
"dist",
|
"dist",
|
||||||
"scripts/preinstall.js"
|
"scripts/preinstall.js"
|
||||||
],
|
],
|
||||||
"ava": {
|
|
||||||
"extensions": [
|
|
||||||
"ts"
|
|
||||||
],
|
|
||||||
"require": [
|
|
||||||
"ts-node/register/transpile-only",
|
|
||||||
"esm"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">= 14"
|
"node": ">= 14"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@vercel/build-utils": "6.3.0",
|
"@vercel/build-utils": "6.6.0",
|
||||||
"@vercel/go": "2.3.7",
|
"@vercel/go": "2.4.2",
|
||||||
"@vercel/hydrogen": "0.0.53",
|
"@vercel/hydrogen": "0.0.60",
|
||||||
"@vercel/next": "3.4.7",
|
"@vercel/next": "3.7.2",
|
||||||
"@vercel/node": "2.9.6",
|
"@vercel/node": "2.10.1",
|
||||||
"@vercel/python": "3.1.49",
|
"@vercel/python": "3.1.56",
|
||||||
"@vercel/redwood": "1.1.5",
|
"@vercel/redwood": "1.1.12",
|
||||||
"@vercel/remix": "1.3.3",
|
"@vercel/remix-builder": "1.8.2",
|
||||||
"@vercel/ruby": "1.3.65",
|
"@vercel/ruby": "1.3.73",
|
||||||
"@vercel/static-build": "1.3.9"
|
"@vercel/static-build": "1.3.20"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@alex_neo/jest-expect-message": "1.0.5",
|
"@alex_neo/jest-expect-message": "1.0.5",
|
||||||
@@ -93,13 +84,14 @@
|
|||||||
"@types/which": "1.3.2",
|
"@types/which": "1.3.2",
|
||||||
"@types/write-json-file": "2.2.1",
|
"@types/write-json-file": "2.2.1",
|
||||||
"@types/yauzl-promise": "2.1.0",
|
"@types/yauzl-promise": "2.1.0",
|
||||||
"@vercel/client": "12.4.0",
|
"@vercel-internals/types": "*",
|
||||||
|
"@vercel/client": "12.4.7",
|
||||||
"@vercel/error-utils": "1.0.8",
|
"@vercel/error-utils": "1.0.8",
|
||||||
"@vercel/frameworks": "1.3.1",
|
"@vercel/frameworks": "1.3.3",
|
||||||
"@vercel/fs-detectors": "3.7.14",
|
"@vercel/fs-detectors": "3.8.7",
|
||||||
"@vercel/fun": "1.0.4",
|
"@vercel/fun": "1.0.4",
|
||||||
"@vercel/ncc": "0.24.0",
|
"@vercel/ncc": "0.24.0",
|
||||||
"@vercel/routing-utils": "2.1.9",
|
"@vercel/routing-utils": "2.1.11",
|
||||||
"@zeit/source-map-support": "0.6.2",
|
"@zeit/source-map-support": "0.6.2",
|
||||||
"ajv": "6.12.2",
|
"ajv": "6.12.2",
|
||||||
"alpha-sort": "2.0.1",
|
"alpha-sort": "2.0.1",
|
||||||
@@ -109,7 +101,6 @@
|
|||||||
"async-listen": "1.2.0",
|
"async-listen": "1.2.0",
|
||||||
"async-retry": "1.1.3",
|
"async-retry": "1.1.3",
|
||||||
"async-sema": "2.1.4",
|
"async-sema": "2.1.4",
|
||||||
"ava": "2.2.0",
|
|
||||||
"bytes": "3.0.0",
|
"bytes": "3.0.0",
|
||||||
"chalk": "4.1.0",
|
"chalk": "4.1.0",
|
||||||
"chance": "1.1.7",
|
"chance": "1.1.7",
|
||||||
@@ -140,7 +131,6 @@
|
|||||||
"is-url": "1.2.2",
|
"is-url": "1.2.2",
|
||||||
"jaro-winkler": "0.2.8",
|
"jaro-winkler": "0.2.8",
|
||||||
"jest-matcher-utils": "29.3.1",
|
"jest-matcher-utils": "29.3.1",
|
||||||
"json5": "2.2.1",
|
|
||||||
"jsonlines": "0.1.1",
|
"jsonlines": "0.1.1",
|
||||||
"line-async-iterator": "3.0.0",
|
"line-async-iterator": "3.0.0",
|
||||||
"load-json-file": "3.0.0",
|
"load-json-file": "3.0.0",
|
||||||
|
|||||||
@@ -36,9 +36,7 @@ async function main() {
|
|||||||
const def = await readFile(fnPath.replace(/\.js$/, '.tsdef'), 'utf8');
|
const def = await readFile(fnPath.replace(/\.js$/, '.tsdef'), 'utf8');
|
||||||
const interfaceName = def.match(/interface (\w+)/)[1];
|
const interfaceName = def.match(/interface (\w+)/)[1];
|
||||||
|
|
||||||
const lines = require(fnPath)
|
const lines = require(fnPath).toString().split('\n');
|
||||||
.toString()
|
|
||||||
.split('\n');
|
|
||||||
let errorHtmlStart = -1;
|
let errorHtmlStart = -1;
|
||||||
let errorHtmlEnd = -1;
|
let errorHtmlEnd = -1;
|
||||||
for (let i = 0; i < lines.length; i++) {
|
for (let i = 0; i < lines.length; i++) {
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import stamp from '../../util/output/stamp';
|
|||||||
import strlen from '../../util/strlen';
|
import strlen from '../../util/strlen';
|
||||||
import getCommandFlags from '../../util/get-command-flags';
|
import getCommandFlags from '../../util/get-command-flags';
|
||||||
import { getCommandName } from '../../util/pkg-name';
|
import { getCommandName } from '../../util/pkg-name';
|
||||||
import { Alias } from '../../types';
|
import { Alias } from '@vercel-internals/types';
|
||||||
|
|
||||||
export default async function ls(
|
export default async function ls(
|
||||||
client: Client,
|
client: Client,
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import strlen from '../../util/strlen';
|
|||||||
import confirm from '../../util/input/confirm';
|
import confirm from '../../util/input/confirm';
|
||||||
import findAliasByAliasOrId from '../../util/alias/find-alias-by-alias-or-id';
|
import findAliasByAliasOrId from '../../util/alias/find-alias-by-alias-or-id';
|
||||||
|
|
||||||
import { Alias } from '../../types';
|
import { Alias } from '@vercel-internals/types';
|
||||||
import { isValidName } from '../../util/is-valid-name';
|
import { isValidName } from '../../util/is-valid-name';
|
||||||
import { getCommandName } from '../../util/pkg-name';
|
import { getCommandName } from '../../util/pkg-name';
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import chalk from 'chalk';
|
import chalk from 'chalk';
|
||||||
import { SetDifference } from 'utility-types';
|
import { SetDifference } from 'utility-types';
|
||||||
import { AliasRecord } from '../../util/alias/create-alias';
|
import { AliasRecord } from '../../util/alias/create-alias';
|
||||||
import { Domain } from '../../types';
|
import { Domain } from '@vercel-internals/types';
|
||||||
import { Output } from '../../util/output';
|
import { Output } from '../../util/output';
|
||||||
import * as ERRORS from '../../util/errors-ts';
|
import * as ERRORS from '../../util/errors-ts';
|
||||||
import assignAlias from '../../util/alias/assign-alias';
|
import assignAlias from '../../util/alias/assign-alias';
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import logo from '../../util/output/logo';
|
|||||||
import getArgs from '../../util/get-args';
|
import getArgs from '../../util/get-args';
|
||||||
import Client from '../../util/client';
|
import Client from '../../util/client';
|
||||||
import { getPkgName } from '../../util/pkg-name';
|
import { getPkgName } from '../../util/pkg-name';
|
||||||
import { Deployment, PaginationOptions } from '../../types';
|
import { Deployment, PaginationOptions } from '@vercel-internals/types';
|
||||||
import { normalizeURL } from '../../util/bisect/normalize-url';
|
import { normalizeURL } from '../../util/bisect/normalize-url';
|
||||||
import getScope from '../../util/get-scope';
|
import getScope from '../../util/get-scope';
|
||||||
import getDeployment from '../../util/get-deployment';
|
import getDeployment from '../../util/get-deployment';
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import fs from 'fs-extra';
|
import fs from 'fs-extra';
|
||||||
import chalk from 'chalk';
|
import chalk from 'chalk';
|
||||||
import dotenv from 'dotenv';
|
import dotenv from 'dotenv';
|
||||||
import { join, normalize, relative, resolve } from 'path';
|
import { join, normalize, relative, resolve, sep } from 'path';
|
||||||
import {
|
import {
|
||||||
getDiscontinuedNodeVersions,
|
getDiscontinuedNodeVersions,
|
||||||
normalizePath,
|
normalizePath,
|
||||||
@@ -157,6 +157,7 @@ export default async function main(client: Client): Promise<number> {
|
|||||||
'--output': String,
|
'--output': String,
|
||||||
'--prod': Boolean,
|
'--prod': Boolean,
|
||||||
'--yes': Boolean,
|
'--yes': Boolean,
|
||||||
|
'-y': '--yes',
|
||||||
});
|
});
|
||||||
|
|
||||||
if (argv['--help']) {
|
if (argv['--help']) {
|
||||||
@@ -296,13 +297,15 @@ async function doBuild(
|
|||||||
cwd: string,
|
cwd: string,
|
||||||
outputDir: string
|
outputDir: string
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
const { output } = client;
|
const { localConfigPath, output } = client;
|
||||||
|
|
||||||
const workPath = join(cwd, project.settings.rootDirectory || '.');
|
const workPath = join(cwd, project.settings.rootDirectory || '.');
|
||||||
|
|
||||||
const [pkg, vercelConfig, nowConfig] = await Promise.all([
|
const [pkg, vercelConfig, nowConfig] = await Promise.all([
|
||||||
readJSONFile<PackageJson>(join(workPath, 'package.json')),
|
readJSONFile<PackageJson>(join(workPath, 'package.json')),
|
||||||
readJSONFile<VercelConfig>(join(workPath, 'vercel.json')),
|
readJSONFile<VercelConfig>(
|
||||||
|
localConfigPath || join(workPath, 'vercel.json')
|
||||||
|
),
|
||||||
readJSONFile<VercelConfig>(join(workPath, 'now.json')),
|
readJSONFile<VercelConfig>(join(workPath, 'now.json')),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
@@ -710,7 +713,9 @@ function expandBuild(files: string[], build: Builder): Builder[] {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
let src = normalize(build.src || '**');
|
let src = normalize(build.src || '**')
|
||||||
|
.split(sep)
|
||||||
|
.join('/');
|
||||||
if (src === '.' || src === './') {
|
if (src === '.' || src === './') {
|
||||||
throw new NowBuildError({
|
throw new NowBuildError({
|
||||||
code: `invalid_build_specification`,
|
code: `invalid_build_specification`,
|
||||||
@@ -751,12 +756,12 @@ function mergeImages(
|
|||||||
}
|
}
|
||||||
|
|
||||||
function mergeCrons(
|
function mergeCrons(
|
||||||
crons: BuildOutputConfig['crons'],
|
crons: BuildOutputConfig['crons'] = [],
|
||||||
buildResults: Iterable<BuildResult | BuildOutputConfig>
|
buildResults: Iterable<BuildResult | BuildOutputConfig>
|
||||||
): BuildOutputConfig['crons'] {
|
): BuildOutputConfig['crons'] {
|
||||||
for (const result of buildResults) {
|
for (const result of buildResults) {
|
||||||
if ('crons' in result && result.crons) {
|
if ('crons' in result && result.crons) {
|
||||||
crons = Object.assign({}, crons, result.crons);
|
crons = crons.concat(result.crons);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return crons;
|
return crons;
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import stamp from '../../util/output/stamp';
|
|||||||
import createCertFromFile from '../../util/certs/create-cert-from-file';
|
import createCertFromFile from '../../util/certs/create-cert-from-file';
|
||||||
import createCertForCns from '../../util/certs/create-cert-for-cns';
|
import createCertForCns from '../../util/certs/create-cert-for-cns';
|
||||||
import { getCommandName } from '../../util/pkg-name';
|
import { getCommandName } from '../../util/pkg-name';
|
||||||
import { Cert } from '../../types';
|
import { Cert } from '@vercel-internals/types';
|
||||||
|
|
||||||
interface Options {
|
interface Options {
|
||||||
'--overwrite'?: boolean;
|
'--overwrite'?: boolean;
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import {
|
|||||||
import stamp from '../../util/output/stamp';
|
import stamp from '../../util/output/stamp';
|
||||||
import getCerts from '../../util/certs/get-certs';
|
import getCerts from '../../util/certs/get-certs';
|
||||||
import strlen from '../../util/strlen';
|
import strlen from '../../util/strlen';
|
||||||
import { Cert } from '../../types';
|
import { Cert } from '@vercel-internals/types';
|
||||||
import getCommandFlags from '../../util/get-command-flags';
|
import getCommandFlags from '../../util/get-command-flags';
|
||||||
import { getCommandName } from '../../util/pkg-name';
|
import { getCommandName } from '../../util/pkg-name';
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import chalk from 'chalk';
|
|||||||
import ms from 'ms';
|
import ms from 'ms';
|
||||||
import plural from 'pluralize';
|
import plural from 'pluralize';
|
||||||
import table from 'text-table';
|
import table from 'text-table';
|
||||||
import { Cert } from '../../types';
|
import { Cert } from '@vercel-internals/types';
|
||||||
import * as ERRORS from '../../util/errors-ts';
|
import * as ERRORS from '../../util/errors-ts';
|
||||||
import { Output } from '../../util/output';
|
import { Output } from '../../util/output';
|
||||||
import deleteCertById from '../../util/certs/delete-cert-by-id';
|
import deleteCertById from '../../util/certs/delete-cert-by-id';
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import DevServer from '../../util/dev/server';
|
|||||||
import { parseListen } from '../../util/dev/parse-listen';
|
import { parseListen } from '../../util/dev/parse-listen';
|
||||||
import Client from '../../util/client';
|
import Client from '../../util/client';
|
||||||
import { getLinkedProject } from '../../util/projects/link';
|
import { getLinkedProject } from '../../util/projects/link';
|
||||||
import { ProjectSettings } from '../../types';
|
import { ProjectSettings } from '@vercel-internals/types';
|
||||||
import setupAndLink from '../../util/link/setup-and-link';
|
import setupAndLink from '../../util/link/setup-and-link';
|
||||||
import { getCommandName } from '../../util/pkg-name';
|
import { getCommandName } from '../../util/pkg-name';
|
||||||
import param from '../../util/output/param';
|
import param from '../../util/output/param';
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import chalk from 'chalk';
|
import chalk from 'chalk';
|
||||||
import ms from 'ms';
|
import ms from 'ms';
|
||||||
import { DomainNotFound } from '../../util/errors-ts';
|
import { DomainNotFound } from '../../util/errors-ts';
|
||||||
import { DNSRecord } from '../../types';
|
import { DNSRecord } from '@vercel-internals/types';
|
||||||
import Client from '../../util/client';
|
import Client from '../../util/client';
|
||||||
import formatTable from '../../util/format-table';
|
import formatTable from '../../util/format-table';
|
||||||
import getDNSRecords, {
|
import getDNSRecords, {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import chalk from 'chalk';
|
import chalk from 'chalk';
|
||||||
import ms from 'ms';
|
import ms from 'ms';
|
||||||
import table from 'text-table';
|
import table from 'text-table';
|
||||||
import { DNSRecord } from '../../types';
|
import { DNSRecord } from '@vercel-internals/types';
|
||||||
import { Output } from '../../util/output';
|
import { Output } from '../../util/output';
|
||||||
import Client from '../../util/client';
|
import Client from '../../util/client';
|
||||||
import deleteDNSRecordById from '../../util/dns/delete-dns-record-by-id';
|
import deleteDNSRecordById from '../../util/dns/delete-dns-record-by-id';
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import getScope from '../../util/get-scope';
|
|||||||
import stamp from '../../util/output/stamp';
|
import stamp from '../../util/output/stamp';
|
||||||
import formatTable from '../../util/format-table';
|
import formatTable from '../../util/format-table';
|
||||||
import { formatDateWithoutTime } from '../../util/format-date';
|
import { formatDateWithoutTime } from '../../util/format-date';
|
||||||
import { Domain } from '../../types';
|
import { Domain } from '@vercel-internals/types';
|
||||||
import getCommandFlags from '../../util/get-command-flags';
|
import getCommandFlags from '../../util/get-command-flags';
|
||||||
import {
|
import {
|
||||||
PaginationOptions,
|
PaginationOptions,
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import chalk from 'chalk';
|
import chalk from 'chalk';
|
||||||
import plural from 'pluralize';
|
import plural from 'pluralize';
|
||||||
|
|
||||||
import { User, Team } from '../../types';
|
import { User, Team } from '@vercel-internals/types';
|
||||||
import * as ERRORS from '../../util/errors-ts';
|
import * as ERRORS from '../../util/errors-ts';
|
||||||
import Client from '../../util/client';
|
import Client from '../../util/client';
|
||||||
import getScope from '../../util/get-scope';
|
import getScope from '../../util/get-scope';
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import chalk from 'chalk';
|
|||||||
import plural from 'pluralize';
|
import plural from 'pluralize';
|
||||||
|
|
||||||
import { DomainNotFound, DomainPermissionDenied } from '../../util/errors-ts';
|
import { DomainNotFound, DomainPermissionDenied } from '../../util/errors-ts';
|
||||||
import { Domain } from '../../types';
|
import { Domain } from '@vercel-internals/types';
|
||||||
import { Output } from '../../util/output';
|
import { Output } from '../../util/output';
|
||||||
import Client from '../../util/client';
|
import Client from '../../util/client';
|
||||||
import deleteCertById from '../../util/certs/delete-cert-by-id';
|
import deleteCertById from '../../util/certs/delete-cert-by-id';
|
||||||
|
|||||||
6
packages/cli/src/commands/env/add.ts
vendored
6
packages/cli/src/commands/env/add.ts
vendored
@@ -1,5 +1,9 @@
|
|||||||
import chalk from 'chalk';
|
import chalk from 'chalk';
|
||||||
import { ProjectEnvTarget, Project, ProjectEnvType } from '../../types';
|
import {
|
||||||
|
ProjectEnvTarget,
|
||||||
|
Project,
|
||||||
|
ProjectEnvType,
|
||||||
|
} from '@vercel-internals/types';
|
||||||
import { Output } from '../../util/output';
|
import { Output } from '../../util/output';
|
||||||
import Client from '../../util/client';
|
import Client from '../../util/client';
|
||||||
import stamp from '../../util/output/stamp';
|
import stamp from '../../util/output/stamp';
|
||||||
|
|||||||
6
packages/cli/src/commands/env/ls.ts
vendored
6
packages/cli/src/commands/env/ls.ts
vendored
@@ -1,7 +1,11 @@
|
|||||||
import chalk from 'chalk';
|
import chalk from 'chalk';
|
||||||
import ms from 'ms';
|
import ms from 'ms';
|
||||||
import { Output } from '../../util/output';
|
import { Output } from '../../util/output';
|
||||||
import { Project, ProjectEnvVariable, ProjectEnvType } from '../../types';
|
import {
|
||||||
|
Project,
|
||||||
|
ProjectEnvVariable,
|
||||||
|
ProjectEnvType,
|
||||||
|
} from '@vercel-internals/types';
|
||||||
import Client from '../../util/client';
|
import Client from '../../util/client';
|
||||||
import formatTable from '../../util/format-table';
|
import formatTable from '../../util/format-table';
|
||||||
import getEnvRecords from '../../util/env/get-env-records';
|
import getEnvRecords from '../../util/env/get-env-records';
|
||||||
|
|||||||
2
packages/cli/src/commands/env/pull.ts
vendored
2
packages/cli/src/commands/env/pull.ts
vendored
@@ -2,7 +2,7 @@ import chalk from 'chalk';
|
|||||||
import { outputFile } from 'fs-extra';
|
import { outputFile } from 'fs-extra';
|
||||||
import { closeSync, openSync, readSync } from 'fs';
|
import { closeSync, openSync, readSync } from 'fs';
|
||||||
import { resolve } from 'path';
|
import { resolve } from 'path';
|
||||||
import { Project, ProjectEnvTarget } from '../../types';
|
import { Project, ProjectEnvTarget } from '@vercel-internals/types';
|
||||||
import Client from '../../util/client';
|
import Client from '../../util/client';
|
||||||
import { emoji, prependEmoji } from '../../util/emoji';
|
import { emoji, prependEmoji } from '../../util/emoji';
|
||||||
import confirm from '../../util/input/confirm';
|
import confirm from '../../util/input/confirm';
|
||||||
|
|||||||
2
packages/cli/src/commands/env/rm.ts
vendored
2
packages/cli/src/commands/env/rm.ts
vendored
@@ -1,5 +1,5 @@
|
|||||||
import chalk from 'chalk';
|
import chalk from 'chalk';
|
||||||
import { Project } from '../../types';
|
import { Project } from '@vercel-internals/types';
|
||||||
import { Output } from '../../util/output';
|
import { Output } from '../../util/output';
|
||||||
import confirm from '../../util/input/confirm';
|
import confirm from '../../util/input/confirm';
|
||||||
import removeEnvRecord from '../../util/env/remove-env-record';
|
import removeEnvRecord from '../../util/env/remove-env-record';
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { Dictionary } from '@vercel/client';
|
import { Dictionary } from '@vercel/client';
|
||||||
import chalk from 'chalk';
|
import chalk from 'chalk';
|
||||||
import { join } from 'path';
|
import { join } from 'path';
|
||||||
import { Org, Project, ProjectLinkData } from '../../types';
|
import { Org, Project, ProjectLinkData } from '@vercel-internals/types';
|
||||||
import Client from '../../util/client';
|
import Client from '../../util/client';
|
||||||
import { parseGitConfig, pluckRemoteUrls } from '../../util/create-git-meta';
|
import { parseGitConfig, pluckRemoteUrls } from '../../util/create-git-meta';
|
||||||
import confirm from '../../util/input/confirm';
|
import confirm from '../../util/input/confirm';
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import chalk from 'chalk';
|
import chalk from 'chalk';
|
||||||
import { Org, Project } from '../../types';
|
import { Org, Project } from '@vercel-internals/types';
|
||||||
import Client from '../../util/client';
|
import Client from '../../util/client';
|
||||||
import confirm from '../../util/input/confirm';
|
import confirm from '../../util/input/confirm';
|
||||||
import { getCommandName } from '../../util/pkg-name';
|
import { getCommandName } from '../../util/pkg-name';
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import getScope from '../util/get-scope';
|
|||||||
import { getPkgName, getCommandName } from '../util/pkg-name';
|
import { getPkgName, getCommandName } from '../util/pkg-name';
|
||||||
import Client from '../util/client';
|
import Client from '../util/client';
|
||||||
import getDeployment from '../util/get-deployment';
|
import getDeployment from '../util/get-deployment';
|
||||||
import { Build, Deployment } from '../types';
|
import { Build, Deployment } from '@vercel-internals/types';
|
||||||
import title from 'title';
|
import title from 'title';
|
||||||
import { isErrnoException } from '@vercel/error-utils';
|
import { isErrnoException } from '@vercel/error-utils';
|
||||||
import { URL } from 'url';
|
import { URL } from 'url';
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import chalk from 'chalk';
|
import chalk from 'chalk';
|
||||||
import ms from 'ms';
|
import ms from 'ms';
|
||||||
import table from 'text-table';
|
import table from 'text-table';
|
||||||
import { Project } from '../../types';
|
import { Project } from '@vercel-internals/types';
|
||||||
import Client from '../../util/client';
|
import Client from '../../util/client';
|
||||||
import getCommandFlags from '../../util/get-command-flags';
|
import getCommandFlags from '../../util/get-command-flags';
|
||||||
import { getCommandName } from '../../util/pkg-name';
|
import { getCommandName } from '../../util/pkg-name';
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import chalk from 'chalk';
|
import chalk from 'chalk';
|
||||||
import { join } from 'path';
|
import { join } from 'path';
|
||||||
import Client from '../util/client';
|
import Client from '../util/client';
|
||||||
import { ProjectEnvTarget } from '../types';
|
import type { Project, ProjectEnvTarget } from '@vercel-internals/types';
|
||||||
import { emoji, prependEmoji } from '../util/emoji';
|
import { emoji, prependEmoji } from '../util/emoji';
|
||||||
import getArgs from '../util/get-args';
|
import getArgs from '../util/get-args';
|
||||||
import logo from '../util/output/logo';
|
import logo from '../util/output/logo';
|
||||||
@@ -10,7 +10,6 @@ import { getPkgName } from '../util/pkg-name';
|
|||||||
import { VERCEL_DIR, VERCEL_DIR_PROJECT } from '../util/projects/link';
|
import { VERCEL_DIR, VERCEL_DIR_PROJECT } from '../util/projects/link';
|
||||||
import { writeProjectSettings } from '../util/projects/project-settings';
|
import { writeProjectSettings } from '../util/projects/project-settings';
|
||||||
import envPull from './env/pull';
|
import envPull from './env/pull';
|
||||||
import type { Project } from '../types';
|
|
||||||
import {
|
import {
|
||||||
isValidEnvTarget,
|
isValidEnvTarget,
|
||||||
getEnvTargetPlaceholder,
|
getEnvTargetPlaceholder,
|
||||||
|
|||||||
@@ -12,17 +12,19 @@ import { isValidName } from '../util/is-valid-name';
|
|||||||
import removeProject from '../util/projects/remove-project';
|
import removeProject from '../util/projects/remove-project';
|
||||||
import getProjectByIdOrName from '../util/projects/get-project-by-id-or-name';
|
import getProjectByIdOrName from '../util/projects/get-project-by-id-or-name';
|
||||||
import getDeployment from '../util/get-deployment';
|
import getDeployment from '../util/get-deployment';
|
||||||
import getDeploymentsByProjectId, {
|
import getDeploymentsByProjectId from '../util/deploy/get-deployments-by-project-id';
|
||||||
DeploymentPartial,
|
|
||||||
} from '../util/deploy/get-deployments-by-project-id';
|
|
||||||
import { getPkgName, getCommandName } from '../util/pkg-name';
|
import { getPkgName, getCommandName } from '../util/pkg-name';
|
||||||
import getArgs from '../util/get-args';
|
import getArgs from '../util/get-args';
|
||||||
import handleError from '../util/handle-error';
|
import handleError from '../util/handle-error';
|
||||||
import type Client from '../util/client';
|
import type Client from '../util/client';
|
||||||
import { Output } from '../util/output';
|
import { Output } from '../util/output';
|
||||||
import { Alias, Project } from '../types';
|
import { Alias, Deployment, Project } from '@vercel-internals/types';
|
||||||
import { NowError } from '../util/now-error';
|
import { NowError } from '../util/now-error';
|
||||||
|
|
||||||
|
type DeploymentWithAliases = Deployment & {
|
||||||
|
aliases: Alias[];
|
||||||
|
};
|
||||||
|
|
||||||
const help = () => {
|
const help = () => {
|
||||||
console.log(`
|
console.log(`
|
||||||
${chalk.bold(
|
${chalk.bold(
|
||||||
@@ -125,11 +127,11 @@ export default async function main(client: Client) {
|
|||||||
|
|
||||||
let aliases: Alias[][];
|
let aliases: Alias[][];
|
||||||
let projects: Project[];
|
let projects: Project[];
|
||||||
let deployments: DeploymentPartial[];
|
let deployments: DeploymentWithAliases[];
|
||||||
const findStart = Date.now();
|
const findStart = Date.now();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const searchFilter = (d: DeploymentPartial) =>
|
const searchFilter = (d: Deployment) =>
|
||||||
ids.some(
|
ids.some(
|
||||||
id =>
|
id =>
|
||||||
d &&
|
d &&
|
||||||
@@ -167,9 +169,15 @@ export default async function main(client: Client) {
|
|||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
projectDeployments
|
// only process the first 201 projects
|
||||||
.slice(0, 201)
|
const to = Math.min(projectDeployments.length, 201);
|
||||||
.map(pDeployments => deployments.push(...pDeployments));
|
for (let i = 0; i < to; i++) {
|
||||||
|
for (const pDepl of projectDeployments[i]) {
|
||||||
|
const depl = pDepl as DeploymentWithAliases;
|
||||||
|
depl.aliases = [];
|
||||||
|
deployments.push(depl);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
projects = [];
|
projects = [];
|
||||||
} else {
|
} else {
|
||||||
@@ -260,7 +268,7 @@ export default async function main(client: Client) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function readConfirmation(
|
function readConfirmation(
|
||||||
deployments: DeploymentPartial[],
|
deployments: DeploymentWithAliases[],
|
||||||
projects: Project[],
|
projects: Project[],
|
||||||
output: Output
|
output: Output
|
||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
@@ -325,7 +333,7 @@ function readConfirmation(
|
|||||||
}
|
}
|
||||||
|
|
||||||
function deploymentsAndProjects(
|
function deploymentsAndProjects(
|
||||||
deployments: DeploymentPartial[],
|
deployments: DeploymentWithAliases[],
|
||||||
projects: Project[],
|
projects: Project[],
|
||||||
conjunction = 'and'
|
conjunction = 'and'
|
||||||
) {
|
) {
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import { emoji } from '../../util/emoji';
|
|||||||
import getUser from '../../util/get-user';
|
import getUser from '../../util/get-user';
|
||||||
import getTeams from '../../util/teams/get-teams';
|
import getTeams from '../../util/teams/get-teams';
|
||||||
import listInput from '../../util/input/list';
|
import listInput from '../../util/input/list';
|
||||||
import { Team, GlobalConfig } from '../../types';
|
import { Team, GlobalConfig } from '@vercel-internals/types';
|
||||||
import { writeToConfigFile } from '../../util/config/files';
|
import { writeToConfigFile } from '../../util/config/files';
|
||||||
|
|
||||||
const updateCurrentTeam = (config: GlobalConfig, team?: Team) => {
|
const updateCurrentTeam = (config: GlobalConfig, team?: Team) => {
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ import getUpdateCommand from './util/get-update-command';
|
|||||||
import { metrics, shouldCollectMetrics } from './util/metrics';
|
import { metrics, shouldCollectMetrics } from './util/metrics';
|
||||||
import { getCommandName, getTitleName } from './util/pkg-name';
|
import { getCommandName, getTitleName } from './util/pkg-name';
|
||||||
import doLoginPrompt from './util/login/prompt';
|
import doLoginPrompt from './util/login/prompt';
|
||||||
import { AuthConfig, GlobalConfig } from './types';
|
import { AuthConfig, GlobalConfig } from '@vercel-internals/types';
|
||||||
import { VercelConfig } from '@vercel/client';
|
import { VercelConfig } from '@vercel/client';
|
||||||
import box from './util/output/box';
|
import box from './util/output/box';
|
||||||
|
|
||||||
@@ -267,6 +267,7 @@ const main = async () => {
|
|||||||
config,
|
config,
|
||||||
authConfig,
|
authConfig,
|
||||||
localConfig,
|
localConfig,
|
||||||
|
localConfigPath,
|
||||||
argv: process.argv,
|
argv: process.argv,
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -280,7 +281,12 @@ const main = async () => {
|
|||||||
GLOBAL_COMMANDS.has(targetOrSubcommand) ||
|
GLOBAL_COMMANDS.has(targetOrSubcommand) ||
|
||||||
commands.has(targetOrSubcommand);
|
commands.has(targetOrSubcommand);
|
||||||
|
|
||||||
if (targetPathExists && subcommandExists && !argv['--cwd']) {
|
if (
|
||||||
|
targetPathExists &&
|
||||||
|
subcommandExists &&
|
||||||
|
!argv['--cwd'] &&
|
||||||
|
!process.env.NOW_BUILDER
|
||||||
|
) {
|
||||||
output.warn(
|
output.warn(
|
||||||
`Did you mean to deploy the subdirectory "${targetOrSubcommand}"? ` +
|
`Did you mean to deploy the subdirectory "${targetOrSubcommand}"? ` +
|
||||||
`Use \`vc --cwd ${targetOrSubcommand}\` instead.`
|
`Use \`vc --cwd ${targetOrSubcommand}\` instead.`
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { Deployment } from '../../types';
|
import type { Deployment } from '@vercel-internals/types';
|
||||||
import { Output } from '../output';
|
import { Output } from '../output';
|
||||||
import Client from '../client';
|
import Client from '../client';
|
||||||
import createAlias from './create-alias';
|
import createAlias from './create-alias';
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { Deployment } from '../../types';
|
import type { Deployment } from '@vercel-internals/types';
|
||||||
import { Output } from '../output';
|
import { Output } from '../output';
|
||||||
import * as ERRORS from '../errors-ts';
|
import * as ERRORS from '../errors-ts';
|
||||||
import Client from '../client';
|
import Client from '../client';
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { Output } from '../output';
|
import { Output } from '../output';
|
||||||
import { Alias } from '../../types';
|
import { Alias } from '@vercel-internals/types';
|
||||||
|
|
||||||
import Client from '../client';
|
import Client from '../client';
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Alias, PaginationOptions } from '../../types';
|
import { Alias, PaginationOptions } from '@vercel-internals/types';
|
||||||
import Client from '../client';
|
import Client from '../client';
|
||||||
|
|
||||||
type Response = {
|
type Response = {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import path from 'path';
|
|||||||
import chalk from 'chalk';
|
import chalk from 'chalk';
|
||||||
import Client from '../client';
|
import Client from '../client';
|
||||||
import { Output } from '../output';
|
import { Output } from '../output';
|
||||||
import { User } from '../../types';
|
import { User } from '@vercel-internals/types';
|
||||||
import { VercelConfig } from '../dev/types';
|
import { VercelConfig } from '../dev/types';
|
||||||
import getDeploymentsByAppName from '../deploy/get-deployments-by-appname';
|
import getDeploymentsByAppName from '../deploy/get-deployments-by-appname';
|
||||||
import getDeployment from '../get-deployment';
|
import getDeployment from '../get-deployment';
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import Client from '../client';
|
import Client from '../client';
|
||||||
import getAliases from './get-aliases';
|
import getAliases from './get-aliases';
|
||||||
import { Alias } from '../../types';
|
import { Alias } from '@vercel-internals/types';
|
||||||
|
|
||||||
export default async function getDomainAliases(client: Client, domain: string) {
|
export default async function getDomainAliases(client: Client, domain: string) {
|
||||||
const { aliases } = await getAliases(client);
|
const { aliases } = await getAliases(client);
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user