mirror of
https://github.com/LukeHagar/vercel.git
synced 2025-12-11 21:07:47 +00:00
Compare commits
73 Commits
vercel@24.
...
@vercel/py
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
de0d2fba0b | ||
|
|
e0900128d6 | ||
|
|
8d15f30579 | ||
|
|
960c66584c | ||
|
|
1c8f91031a | ||
|
|
68cb23c3cc | ||
|
|
94f6ae2595 | ||
|
|
b92aeac84d | ||
|
|
00420b7a01 | ||
|
|
a5128790d0 | ||
|
|
ae9aa91f4f | ||
|
|
d4cef69cc9 | ||
|
|
323f67c31a | ||
|
|
63c499a826 | ||
|
|
ad436313e1 | ||
|
|
c414288b2f | ||
|
|
b07ff7431f | ||
|
|
79fde4475c | ||
|
|
855197c699 | ||
|
|
fbd9080859 | ||
|
|
b5c5b7b82c | ||
|
|
0a072ee850 | ||
|
|
0b56caba45 | ||
|
|
ab3db60824 | ||
|
|
f2f2ff2c67 | ||
|
|
ba7dafff71 | ||
|
|
987fb4d4f7 | ||
|
|
be74f79fa0 | ||
|
|
86886e6b60 | ||
|
|
e8a9000137 | ||
|
|
75ea68d445 | ||
|
|
a5a990995c | ||
|
|
cd7dcc6731 | ||
|
|
c4bd462b85 | ||
|
|
5fc266bd8a | ||
|
|
08b04d0bda | ||
|
|
92ae51c6a6 | ||
|
|
909c493d1e | ||
|
|
98b54ff61f | ||
|
|
3defd0b2fd | ||
|
|
5a7851a7f7 | ||
|
|
7f0caa7dec | ||
|
|
89b5aad367 | ||
|
|
c13775ba07 | ||
|
|
cc3c1d1eeb | ||
|
|
3aa2fbbb53 | ||
|
|
3a8b8aa03a | ||
|
|
d008617c0b | ||
|
|
8aecb99447 | ||
|
|
1793fa643f | ||
|
|
913683a8e6 | ||
|
|
0d1dc23d0d | ||
|
|
e829ce47c3 | ||
|
|
474770e9b0 | ||
|
|
e762d8d4e8 | ||
|
|
6e8935883b | ||
|
|
1c3497dc74 | ||
|
|
9836fdb5ca | ||
|
|
d6f88f019f | ||
|
|
0f720472c4 | ||
|
|
8d0c5114e4 | ||
|
|
e3c4435606 | ||
|
|
234c4dfa84 | ||
|
|
acd756436c | ||
|
|
f26858b735 | ||
|
|
623e43f865 | ||
|
|
3e696513a2 | ||
|
|
285f62c9d0 | ||
|
|
c43db1788c | ||
|
|
fc2eb1a30d | ||
|
|
ecf194b7c1 | ||
|
|
c14e5689f1 | ||
|
|
54dfe747e2 |
@@ -19,6 +19,10 @@ packages/cli/src/util/dev/templates/*.ts
|
|||||||
packages/client/tests/fixtures
|
packages/client/tests/fixtures
|
||||||
packages/client/lib
|
packages/client/lib
|
||||||
|
|
||||||
|
# next
|
||||||
|
packages/next/test/integration/middleware
|
||||||
|
packages/next/test/integration/middleware-eval
|
||||||
|
|
||||||
# node-bridge
|
# node-bridge
|
||||||
packages/node-bridge/bridge.js
|
packages/node-bridge/bridge.js
|
||||||
packages/node-bridge/launcher.js
|
packages/node-bridge/launcher.js
|
||||||
|
|||||||
39
.github/CODEOWNERS
vendored
39
.github/CODEOWNERS
vendored
@@ -1,29 +1,26 @@
|
|||||||
# Documentation
|
# Documentation
|
||||||
# https://help.github.com/en/articles/about-code-owners
|
# https://help.github.com/en/articles/about-code-owners
|
||||||
|
|
||||||
* @TooTallNate
|
* @TooTallNate @EndangeredMassa @styfle
|
||||||
/.github/workflows @AndyBitz @styfle
|
/.github/workflows @TooTallNate @EndangeredMassa @styfle @ijjk
|
||||||
/packages/frameworks @AndyBitz
|
/packages/frameworks @TooTallNate @EndangeredMassa @styfle @AndyBitz
|
||||||
/packages/cli/src/commands/build @TooTallNate @styfle @AndyBitz @gdborton @jaredpalmer
|
|
||||||
/packages/cli/src/commands/dev @TooTallNate @styfle @AndyBitz
|
|
||||||
/packages/cli/src/util/dev @TooTallNate @styfle @AndyBitz
|
|
||||||
/packages/cli/src/commands/domains @javivelasco @mglagola @anatrajkovska
|
/packages/cli/src/commands/domains @javivelasco @mglagola @anatrajkovska
|
||||||
/packages/cli/src/commands/certs @javivelasco @mglagola @anatrajkovska
|
/packages/cli/src/commands/certs @javivelasco @mglagola @anatrajkovska
|
||||||
/packages/cli/src/commands/env @styfle @lucleray
|
/packages/cli/src/commands/env @styfle @lucleray
|
||||||
/packages/client @styfle @TooTallNate
|
/packages/client @TooTallNate @EndangeredMassa @styfle
|
||||||
/packages/build-utils @styfle @AndyBitz @TooTallNate
|
/packages/build-utils @TooTallNate @EndangeredMassa @styfle @AndyBitz
|
||||||
/packages/middleware @gdborton @javivelasco
|
/packages/middleware @gdborton @javivelasco
|
||||||
/packages/node @styfle @TooTallNate @lucleray
|
/packages/node @TooTallNate @EndangeredMassa @styfle
|
||||||
/packages/node-bridge @styfle @TooTallNate @lucleray
|
/packages/node-bridge @TooTallNate @EndangeredMassa @styfle @ijjk
|
||||||
/packages/next @Timer @ijjk
|
/packages/next @TooTallNate @ijjk
|
||||||
/packages/go @styfle @TooTallNate
|
/packages/go @TooTallNate @EndangeredMassa @styfle
|
||||||
/packages/python @styfle @TooTallNate
|
/packages/python @TooTallNate @EndangeredMassa @styfle
|
||||||
/packages/ruby @styfle @TooTallNate
|
/packages/ruby @TooTallNate @EndangeredMassa @styfle
|
||||||
/packages/static-build @styfle @AndyBitz
|
/packages/static-build @TooTallNate @EndangeredMassa @styfle @AndyBitz
|
||||||
/packages/routing-utils @styfle @dav-is @ijjk
|
/packages/routing-utils @TooTallNate @EndangeredMassa @styfle @ijjk
|
||||||
/examples @mcsdevv
|
/examples @leerob
|
||||||
/examples/create-react-app @Timer
|
/examples/create-react-app @Timer
|
||||||
/examples/nextjs @timneutkens @Timer
|
/examples/nextjs @timneutkens @ijjk @styfle
|
||||||
/examples/hugo @mcsdevv @styfle
|
/examples/hugo @styfle
|
||||||
/examples/jekyll @mcsdevv @styfle
|
/examples/jekyll @styfle
|
||||||
/examples/zola @mcsdevv @styfle
|
/examples/zola @styfle
|
||||||
|
|||||||
8
.github/CONTRIBUTING.md
vendored
8
.github/CONTRIBUTING.md
vendored
@@ -23,7 +23,7 @@ Make sure all the tests pass before making changes.
|
|||||||
|
|
||||||
## Verifying your change
|
## Verifying your change
|
||||||
|
|
||||||
Once you are done with your changes (we even suggest doing it along the way), make sure all the test still pass by running:
|
Once you are done with your changes (we even suggest doing it along the way), make sure all the tests still pass by running:
|
||||||
|
|
||||||
```
|
```
|
||||||
yarn test-unit
|
yarn test-unit
|
||||||
@@ -64,7 +64,7 @@ Integration tests create deployments to your Vercel account using the `test` pro
|
|||||||
x-now-trace=iad1]
|
x-now-trace=iad1]
|
||||||
```
|
```
|
||||||
|
|
||||||
In such cases you can visit the URL of the failed deployment and append `/_logs` so see the build error. In the case above, that would be https://test-8ashcdlew.vercel.app/_logs
|
In such cases, you can visit the URL of the failed deployment and append `/_logs` to see the build error. In the case above, that would be https://test-8ashcdlew.vercel.app/_logs
|
||||||
|
|
||||||
The logs of this deployment will contain the actual error which may help you to understand what went wrong.
|
The logs of this deployment will contain the actual error which may help you to understand what went wrong.
|
||||||
|
|
||||||
@@ -82,11 +82,11 @@ nodeFileTrace(['path/to/entrypoint.js'], {
|
|||||||
.then(e => console.error(e));
|
.then(e => console.error(e));
|
||||||
```
|
```
|
||||||
|
|
||||||
When you run this script, you'll see all imported files. If anything file is missing, the bug is in [@vercel/nft](https://github.com/vercel/nft) and not the Builder.
|
When you run this script, you'll see all the imported files. If anything file is missing, the bug is in [@vercel/nft](https://github.com/vercel/nft) and not the Builder.
|
||||||
|
|
||||||
## Deploy a Builder with existing project
|
## Deploy a Builder with existing project
|
||||||
|
|
||||||
Sometimes you want to test changes to a Builder against an existing project, maybe with `vercel dev` or an actual deployment. You can avoid publishing every Builder change to npm by uploading the Builder as a tarball.
|
Sometimes you want to test changes to a Builder against an existing project, maybe with `vercel dev` or actual deployment. You can avoid publishing every Builder change to npm by uploading the Builder as a tarball.
|
||||||
|
|
||||||
1. Change directory to the desired Builder `cd ./packages/node`
|
1. Change directory to the desired Builder `cd ./packages/node`
|
||||||
2. Run `yarn build` to compile typescript and other build steps
|
2. Run `yarn build` to compile typescript and other build steps
|
||||||
|
|||||||
3
.github/workflows/cancel.yml
vendored
3
.github/workflows/cancel.yml
vendored
@@ -13,6 +13,5 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: styfle/cancel-workflow-action@0.9.1
|
- uses: styfle/cancel-workflow-action@0.9.1
|
||||||
with:
|
with:
|
||||||
workflow_id: 849295, 849296, 849297, 849298
|
workflow_id: test.yml, test-integration-cli.yml, test-unit.yml
|
||||||
access_token: ${{ github.token }}
|
access_token: ${{ github.token }}
|
||||||
|
|
||||||
|
|||||||
8
.github/workflows/test-integration-cli.yml
vendored
8
.github/workflows/test-integration-cli.yml
vendored
@@ -16,9 +16,15 @@ jobs:
|
|||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest]
|
os: [ubuntu-latest]
|
||||||
node: [12]
|
node: [14]
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
|
- name: Conditionally set remote env
|
||||||
|
if: github.event.pull_request.head.repo.full_name == github.repository
|
||||||
|
run: |
|
||||||
|
echo "TURBO_REMOTE_ONLY=true" >> $GITHUB_ENV
|
||||||
|
echo "TURBO_TEAM=vercel" >> $GITHUB_ENV
|
||||||
|
echo "TURBO_TOKEN=${{ secrets.TURBO_TOKEN }}" >> $GITHUB_ENV
|
||||||
- uses: actions/setup-go@v2
|
- uses: actions/setup-go@v2
|
||||||
with:
|
with:
|
||||||
go-version: '1.13.15'
|
go-version: '1.13.15'
|
||||||
|
|||||||
43
.github/workflows/test-integration-dev.yml
vendored
43
.github/workflows/test-integration-dev.yml
vendored
@@ -1,43 +0,0 @@
|
|||||||
name: Dev
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
tags:
|
|
||||||
- '!*'
|
|
||||||
pull_request:
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
test:
|
|
||||||
name: Dev
|
|
||||||
timeout-minutes: 75
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
os: [ubuntu-latest, macos-latest]
|
|
||||||
node: [12]
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
steps:
|
|
||||||
- uses: actions/setup-go@v2
|
|
||||||
with:
|
|
||||||
go-version: '1.13.15'
|
|
||||||
- uses: actions/setup-node@v2
|
|
||||||
with:
|
|
||||||
node-version: ${{ matrix.node }}
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
with:
|
|
||||||
fetch-depth: 100
|
|
||||||
- run: git --version
|
|
||||||
- run: git fetch origin main --depth=100
|
|
||||||
- run: git fetch origin ${{ github.ref }} --depth=100
|
|
||||||
- run: git diff origin/main...HEAD --name-only
|
|
||||||
- name: Install Hugo
|
|
||||||
if: matrix.os == 'macos-latest'
|
|
||||||
run: curl -L -O https://github.com/gohugoio/hugo/releases/download/v0.56.0/hugo_0.56.0_macOS-64bit.tar.gz && tar -xzf hugo_0.56.0_macOS-64bit.tar.gz && mv ./hugo packages/cli/test/dev/fixtures/08-hugo/
|
|
||||||
- run: yarn install --network-timeout 1000000
|
|
||||||
- run: yarn run build
|
|
||||||
- run: yarn test-integration-dev
|
|
||||||
env:
|
|
||||||
VERCEL_TEAM_TOKEN: ${{ secrets.VERCEL_TEAM_TOKEN }}
|
|
||||||
VERCEL_REGISTRATION_URL: ${{ secrets.VERCEL_REGISTRATION_URL }}
|
|
||||||
35
.github/workflows/test-integration-once.yml
vendored
35
.github/workflows/test-integration-once.yml
vendored
@@ -1,35 +0,0 @@
|
|||||||
name: E2E
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
tags:
|
|
||||||
- '!*'
|
|
||||||
pull_request:
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
test:
|
|
||||||
name: E2E
|
|
||||||
timeout-minutes: 120
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/setup-go@v2
|
|
||||||
with:
|
|
||||||
go-version: '1.13.15'
|
|
||||||
- uses: actions/setup-node@v2
|
|
||||||
with:
|
|
||||||
node-version: 12
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
with:
|
|
||||||
fetch-depth: 100
|
|
||||||
- run: git --version
|
|
||||||
- run: git fetch origin main --depth=100
|
|
||||||
- run: git fetch origin ${{ github.ref }} --depth=100
|
|
||||||
- run: git diff origin/main...HEAD --name-only
|
|
||||||
- run: yarn install --network-timeout 1000000
|
|
||||||
- run: yarn run build
|
|
||||||
- run: yarn test-integration-once
|
|
||||||
env:
|
|
||||||
VERCEL_TEAM_TOKEN: ${{ secrets.VERCEL_TEAM_TOKEN }}
|
|
||||||
VERCEL_REGISTRATION_URL: ${{ secrets.VERCEL_REGISTRATION_URL }}
|
|
||||||
12
.github/workflows/test-unit.yml
vendored
12
.github/workflows/test-unit.yml
vendored
@@ -16,9 +16,15 @@ jobs:
|
|||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, macos-latest, windows-latest]
|
os: [ubuntu-latest, macos-latest, windows-latest]
|
||||||
node: [12]
|
node: [14]
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
|
- name: Conditionally set remote env
|
||||||
|
if: github.event.pull_request.head.repo.full_name == github.repository
|
||||||
|
run: |
|
||||||
|
echo "TURBO_REMOTE_ONLY=true" >> $GITHUB_ENV
|
||||||
|
echo "TURBO_TEAM=vercel" >> $GITHUB_ENV
|
||||||
|
echo "TURBO_TOKEN=${{ secrets.TURBO_TOKEN }}" >> $GITHUB_ENV
|
||||||
- uses: actions/setup-go@v2
|
- uses: actions/setup-go@v2
|
||||||
with:
|
with:
|
||||||
go-version: '1.13.15'
|
go-version: '1.13.15'
|
||||||
@@ -35,9 +41,9 @@ jobs:
|
|||||||
- run: yarn install --network-timeout 1000000
|
- run: yarn install --network-timeout 1000000
|
||||||
- run: yarn run build
|
- run: yarn run build
|
||||||
- run: yarn run lint
|
- run: yarn run lint
|
||||||
if: matrix.os == 'ubuntu-latest' && matrix.node == 12 # only run lint once
|
if: matrix.os == 'ubuntu-latest' && matrix.node == 14 # only run lint once
|
||||||
- run: yarn run test-unit
|
- run: yarn run test-unit
|
||||||
- run: yarn workspace vercel run coverage
|
- run: yarn workspace vercel run coverage
|
||||||
if: matrix.os == 'ubuntu-latest' && matrix.node == 12 # only run coverage once
|
if: matrix.os == 'ubuntu-latest' && matrix.node == 14 # only run coverage once
|
||||||
env:
|
env:
|
||||||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
||||||
|
|||||||
90
.github/workflows/test.yml
vendored
Normal file
90
.github/workflows/test.yml
vendored
Normal file
@@ -0,0 +1,90 @@
|
|||||||
|
name: Tests
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
tags:
|
||||||
|
- '!*'
|
||||||
|
pull_request:
|
||||||
|
|
||||||
|
env:
|
||||||
|
NODE_VERSION: '14'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
setup:
|
||||||
|
name: Find Changes
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
tests: ${{ steps['set-tests'].outputs['tests'] }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- run: git --version
|
||||||
|
- run: git fetch origin main
|
||||||
|
- uses: actions/setup-node@v2
|
||||||
|
with:
|
||||||
|
node-version: ${{ env.NODE_VERSION }}
|
||||||
|
cache: 'yarn'
|
||||||
|
- run: yarn install --network-timeout 1000000
|
||||||
|
- id: set-tests
|
||||||
|
run: |
|
||||||
|
TESTS_ARRAY=$(node utils/chunk-tests.js $SCRIPT_NAME)
|
||||||
|
echo "Files to test:"
|
||||||
|
echo "$TESTS_ARRAY"
|
||||||
|
echo "::set-output name=tests::$TESTS_ARRAY"
|
||||||
|
|
||||||
|
test:
|
||||||
|
timeout-minutes: 120
|
||||||
|
runs-on: ${{ matrix.runner }}
|
||||||
|
name: ${{matrix.scriptName}} (${{matrix.packageName}}, ${{matrix.chunkNumber}}, ${{ matrix.runner }})
|
||||||
|
if: ${{ needs.setup.outputs['tests'] != '[]' }}
|
||||||
|
needs:
|
||||||
|
- setup
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
include: ${{ fromJson(needs.setup.outputs['tests']) }}
|
||||||
|
steps:
|
||||||
|
- name: Conditionally set remote env
|
||||||
|
if: github.event.pull_request.head.repo.full_name == github.repository
|
||||||
|
run: |
|
||||||
|
echo "TURBO_REMOTE_ONLY=true" >> $GITHUB_ENV
|
||||||
|
echo "TURBO_TEAM=vercel" >> $GITHUB_ENV
|
||||||
|
echo "TURBO_TOKEN=${{ secrets.TURBO_TOKEN }}" >> $GITHUB_ENV
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
fetch-depth: 2
|
||||||
|
- uses: actions/setup-go@v2
|
||||||
|
with:
|
||||||
|
go-version: '1.13.15'
|
||||||
|
- uses: actions/setup-node@v2
|
||||||
|
with:
|
||||||
|
node-version: ${{ env.NODE_VERSION }}
|
||||||
|
cache: 'yarn'
|
||||||
|
|
||||||
|
- name: Install Hugo
|
||||||
|
if: matrix.runner == 'macos-latest'
|
||||||
|
run: curl -L -O https://github.com/gohugoio/hugo/releases/download/v0.56.0/hugo_0.56.0_macOS-64bit.tar.gz && tar -xzf hugo_0.56.0_macOS-64bit.tar.gz && mv ./hugo packages/cli/test/dev/fixtures/08-hugo/
|
||||||
|
|
||||||
|
- run: yarn install --network-timeout 1000000
|
||||||
|
|
||||||
|
- name: Build ${{matrix.packageName}} and all its dependencies
|
||||||
|
run: yarn turbo run build --cache-dir=".turbo" --scope=${{matrix.packageName}} --include-dependencies --no-deps
|
||||||
|
env:
|
||||||
|
FORCE_COLOR: '1'
|
||||||
|
- name: Test ${{matrix.packageName}}
|
||||||
|
run: node_modules/.bin/turbo run test --cache-dir=".turbo" --scope=${{matrix.packageName}} --no-deps -- ${{ join(matrix.testPaths, ' ') }}
|
||||||
|
shell: bash
|
||||||
|
env:
|
||||||
|
VERCEL_TEAM_TOKEN: ${{ secrets.VERCEL_TEAM_TOKEN }}
|
||||||
|
VERCEL_REGISTRATION_URL: ${{ secrets.VERCEL_REGISTRATION_URL }}
|
||||||
|
FORCE_COLOR: '1'
|
||||||
|
|
||||||
|
conclusion:
|
||||||
|
needs:
|
||||||
|
- test
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
name: E2E
|
||||||
|
steps:
|
||||||
|
- name: Done
|
||||||
|
run: echo "Done."
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"target": "esnext",
|
"target": "ES2020",
|
||||||
"skipLibCheck": true,
|
"skipLibCheck": true,
|
||||||
"strict": false,
|
"strict": false,
|
||||||
"forceConsistentCasingInFileNames": true,
|
"forceConsistentCasingInFileNames": true,
|
||||||
|
|||||||
@@ -2,3 +2,4 @@ README.md
|
|||||||
.nuxt
|
.nuxt
|
||||||
node_modules
|
node_modules
|
||||||
*.log
|
*.log
|
||||||
|
.output
|
||||||
|
|||||||
@@ -22,8 +22,5 @@
|
|||||||
"@types/react-dom": "^17.0.9",
|
"@types/react-dom": "^17.0.9",
|
||||||
"typescript": "^4.1.2"
|
"typescript": "^4.1.2"
|
||||||
},
|
},
|
||||||
"engines": {
|
|
||||||
"node": "14.x"
|
|
||||||
},
|
|
||||||
"sideEffects": false
|
"sideEffects": false
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +0,0 @@
|
|||||||
{
|
|
||||||
"build": {
|
|
||||||
"env": {
|
|
||||||
"ENABLE_FILE_SYSTEM_API": "1"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
1
examples/solidstart/.gitignore
vendored
1
examples/solidstart/.gitignore
vendored
@@ -2,6 +2,7 @@ dist
|
|||||||
worker
|
worker
|
||||||
.solid
|
.solid
|
||||||
.vercel
|
.vercel
|
||||||
|
.output
|
||||||
|
|
||||||
# dependencies
|
# dependencies
|
||||||
/node_modules
|
/node_modules
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# SolidStart
|
# SolidStart
|
||||||
|
|
||||||
This directory is a brief example of a [SolidStart](https://github.com/ryansolid/solid-startp) site that can be deployed to Vercel with zero configuration.
|
This directory is a brief example of a [SolidStart](https://github.com/ryansolid/solid-start) site that can be deployed to Vercel with zero configuration.
|
||||||
|
|
||||||
## Deploy Your Own
|
## Deploy Your Own
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { defineConfig } from "vite";
|
import { defineConfig } from "vite";
|
||||||
import solid from "solid-start";
|
import solid from "solid-start";
|
||||||
import vercel from "solid-start-vercel"
|
import vercel from "solid-start-vercel";
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
plugins: [solid({ adapter: vercel() })]
|
plugins: [solid({ adapter: vercel() })],
|
||||||
});
|
});
|
||||||
|
|||||||
1
examples/sveltekit/.gitignore
vendored
1
examples/sveltekit/.gitignore
vendored
@@ -7,3 +7,4 @@ node_modules
|
|||||||
.env.*
|
.env.*
|
||||||
!.env.example
|
!.env.example
|
||||||
.vercel
|
.vercel
|
||||||
|
.output
|
||||||
|
|||||||
13
examples/sveltekit/.prettierignore
Normal file
13
examples/sveltekit/.prettierignore
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
.DS_Store
|
||||||
|
node_modules
|
||||||
|
/build
|
||||||
|
/.svelte-kit
|
||||||
|
/package
|
||||||
|
.env
|
||||||
|
.env.*
|
||||||
|
!.env.example
|
||||||
|
|
||||||
|
# Ignore files for PNPM, NPM and YARN
|
||||||
|
pnpm-lock.yaml
|
||||||
|
package-lock.json
|
||||||
|
yarn.lock
|
||||||
6
examples/sveltekit/.prettierrc
Normal file
6
examples/sveltekit/.prettierrc
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"useTabs": false,
|
||||||
|
"singleQuote": true,
|
||||||
|
"trailingComma": "none",
|
||||||
|
"printWidth": 100
|
||||||
|
}
|
||||||
@@ -14,31 +14,29 @@ If you're seeing this, you've probably already done this step. Congrats!
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
# create a new project in the current directory
|
# create a new project in the current directory
|
||||||
npm init svelte@next
|
npm init svelte
|
||||||
|
|
||||||
# create a new project in my-app
|
# create a new project in my-app
|
||||||
npm init svelte@next my-app
|
npm init svelte my-app
|
||||||
```
|
```
|
||||||
|
|
||||||
> Note: the `@next` is temporary
|
|
||||||
|
|
||||||
## Developing
|
## Developing
|
||||||
|
|
||||||
Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:
|
Once you've created a project and installed dependencies with `pnpm install`, start a development server:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
npm run dev
|
pnpm run dev
|
||||||
|
|
||||||
# or start the server and open the app in a new browser tab
|
# or start the server and open the app in a new browser tab
|
||||||
npm run dev -- --open
|
pnpm run dev -- --open
|
||||||
```
|
```
|
||||||
|
|
||||||
## Building
|
## Building
|
||||||
|
|
||||||
This uses the adapter-auto for SvelteKit, which detects Vercel and runs adapter-vercel on your behalf.
|
To create a production version of your app:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
npm run build
|
pnpm run build
|
||||||
```
|
```
|
||||||
|
|
||||||
> You can preview the built app with `npm run preview`, regardless of whether you installed an adapter. This should _not_ be used to serve your app in production.
|
You can preview the production build with `npm run preview`.
|
||||||
|
|||||||
@@ -1,10 +1,13 @@
|
|||||||
{
|
{
|
||||||
|
"extends": "./.svelte-kit/tsconfig.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"baseUrl": ".",
|
"allowJs": true,
|
||||||
"paths": {
|
"checkJs": true,
|
||||||
"$lib": ["src/lib"],
|
"esModuleInterop": true,
|
||||||
"$lib/*": ["src/lib/*"]
|
"forceConsistentCasingInFileNames": true,
|
||||||
|
"resolveJsonModule": true,
|
||||||
|
"skipLibCheck": true,
|
||||||
|
"sourceMap": true,
|
||||||
|
"strict": true
|
||||||
}
|
}
|
||||||
},
|
|
||||||
"include": ["src/**/*.d.ts", "src/**/*.js", "src/**/*.svelte"]
|
|
||||||
}
|
}
|
||||||
|
|||||||
1267
examples/sveltekit/package-lock.json
generated
1267
examples/sveltekit/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -1,22 +1,29 @@
|
|||||||
{
|
{
|
||||||
"private": true,
|
"private": true,
|
||||||
"name": "sveltekit",
|
|
||||||
"version": "0.0.1",
|
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "svelte-kit dev",
|
"dev": "svelte-kit dev",
|
||||||
"build": "svelte-kit build",
|
"build": "svelte-kit build",
|
||||||
"package": "svelte-kit package",
|
"package": "svelte-kit package",
|
||||||
"preview": "svelte-kit preview"
|
"preview": "svelte-kit preview",
|
||||||
|
"prepare": "svelte-kit sync",
|
||||||
|
"check": "svelte-check --tsconfig ./jsconfig.json",
|
||||||
|
"check:watch": "svelte-check --tsconfig ./jsconfig.json --watch",
|
||||||
|
"lint": "prettier --check --plugin-search-dir=. .",
|
||||||
|
"format": "prettier --write --plugin-search-dir=. ."
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@sveltejs/adapter-auto": "next",
|
"@sveltejs/adapter-auto": "next",
|
||||||
"@sveltejs/kit": "next",
|
"@sveltejs/kit": "next",
|
||||||
"svelte": "^3.46.0"
|
"@types/cookie": "^0.4.1",
|
||||||
|
"prettier": "^2.5.1",
|
||||||
|
"prettier-plugin-svelte": "^2.5.0",
|
||||||
|
"svelte": "^3.46.0",
|
||||||
|
"svelte-check": "^2.2.6",
|
||||||
|
"typescript": "~4.6.2"
|
||||||
},
|
},
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@fontsource/fira-mono": "^4.5.0",
|
"@fontsource/fira-mono": "^4.5.0",
|
||||||
"@lukeed/uuid": "^2.0.0",
|
|
||||||
"cookie": "^0.4.1"
|
"cookie": "^0.4.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
1633
examples/sveltekit/pnpm-lock.yaml
generated
Normal file
1633
examples/sveltekit/pnpm-lock.yaml
generated
Normal file
File diff suppressed because it is too large
Load Diff
15
examples/sveltekit/src/app.d.ts
vendored
Normal file
15
examples/sveltekit/src/app.d.ts
vendored
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
/// <reference types="@sveltejs/kit" />
|
||||||
|
|
||||||
|
// See https://kit.svelte.dev/docs/types#app
|
||||||
|
// for information about these interfaces
|
||||||
|
declare namespace App {
|
||||||
|
interface Locals {
|
||||||
|
userid: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
// interface Platform {}
|
||||||
|
|
||||||
|
// interface Session {}
|
||||||
|
|
||||||
|
// interface Stuff {}
|
||||||
|
}
|
||||||
@@ -2,12 +2,11 @@
|
|||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<meta name="description" content="Svelte demo app" />
|
<link rel="icon" href="%sveltekit.assets%/favicon.png" />
|
||||||
<link rel="icon" href="%svelte.assets%/favicon.png" />
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
%svelte.head%
|
%sveltekit.head%
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div>%svelte.body%</div>
|
<div>%sveltekit.body%</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
import cookie from 'cookie';
|
import * as cookie from 'cookie';
|
||||||
import { v4 as uuid } from '@lukeed/uuid';
|
|
||||||
|
|
||||||
|
/** @type {import('@sveltejs/kit').Handle} */
|
||||||
export const handle = async ({ event, resolve }) => {
|
export const handle = async ({ event, resolve }) => {
|
||||||
const cookies = cookie.parse(event.request.headers.get('cookie') || '');
|
const cookies = cookie.parse(event.request.headers.get('cookie') || '');
|
||||||
event.locals.userid = cookies.userid || uuid();
|
event.locals.userid = cookies['userid'] || crypto.randomUUID();
|
||||||
|
|
||||||
const response = await resolve(event);
|
const response = await resolve(event);
|
||||||
|
|
||||||
if (!cookies.userid) {
|
if (!cookies['userid']) {
|
||||||
// if this is the first time the user has visited this app,
|
// if this is the first time the user has visited this app,
|
||||||
// set a cookie so that we recognise them when they return
|
// set a cookie so that we recognise them when they return
|
||||||
response.headers.set(
|
response.headers.set(
|
||||||
|
|||||||
@@ -7,6 +7,10 @@
|
|||||||
$: displayed_count.set(count);
|
$: displayed_count.set(count);
|
||||||
$: offset = modulo($displayed_count, 1);
|
$: offset = modulo($displayed_count, 1);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {number} n
|
||||||
|
* @param {number} m
|
||||||
|
*/
|
||||||
function modulo(n, m) {
|
function modulo(n, m) {
|
||||||
// handle negative numbers
|
// handle negative numbers
|
||||||
return ((n % m) + m) % m;
|
return ((n % m) + m) % m;
|
||||||
@@ -50,6 +54,7 @@
|
|||||||
justify-content: center;
|
justify-content: center;
|
||||||
border: 0;
|
border: 0;
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
|
touch-action: manipulation;
|
||||||
color: var(--text-color);
|
color: var(--text-color);
|
||||||
font-size: 2rem;
|
font-size: 2rem;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,9 +2,36 @@ import { invalidate } from '$app/navigation';
|
|||||||
|
|
||||||
// this action (https://svelte.dev/tutorial/actions) allows us to
|
// this action (https://svelte.dev/tutorial/actions) allows us to
|
||||||
// progressively enhance a <form> that already works without JS
|
// progressively enhance a <form> that already works without JS
|
||||||
|
/**
|
||||||
|
* @param {HTMLFormElement} form
|
||||||
|
* @param {{
|
||||||
|
* pending?: ({ data, form }: { data: FormData; form: HTMLFormElement }) => void;
|
||||||
|
* error?: ({
|
||||||
|
* data,
|
||||||
|
* form,
|
||||||
|
* response,
|
||||||
|
* error
|
||||||
|
* }: {
|
||||||
|
* data: FormData;
|
||||||
|
* form: HTMLFormElement;
|
||||||
|
* response: Response | null;
|
||||||
|
* error: Error | null;
|
||||||
|
* }) => void;
|
||||||
|
* result?: ({
|
||||||
|
* data,
|
||||||
|
* form,
|
||||||
|
* response
|
||||||
|
* }: {
|
||||||
|
* data: FormData;
|
||||||
|
* response: Response;
|
||||||
|
* form: HTMLFormElement;
|
||||||
|
* }) => void;
|
||||||
|
* }} [opts]
|
||||||
|
*/
|
||||||
export function enhance(form, { pending, error, result } = {}) {
|
export function enhance(form, { pending, error, result } = {}) {
|
||||||
let current_token;
|
let current_token;
|
||||||
|
|
||||||
|
/** @param {SubmitEvent} e */
|
||||||
async function handle_submit(e) {
|
async function handle_submit(e) {
|
||||||
const token = (current_token = {});
|
const token = (current_token = {});
|
||||||
|
|
||||||
@@ -37,7 +64,7 @@ export function enhance(form, { pending, error, result } = {}) {
|
|||||||
console.error(await response.text());
|
console.error(await response.text());
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (error) {
|
if (error && e instanceof Error) {
|
||||||
error({ data, form, error: e, response: null });
|
error({ data, form, error: e, response: null });
|
||||||
} else {
|
} else {
|
||||||
throw e;
|
throw e;
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
<svelte:head>
|
<svelte:head>
|
||||||
<title>About</title>
|
<title>About</title>
|
||||||
|
<meta name="description" content="About this app" />
|
||||||
</svelte:head>
|
</svelte:head>
|
||||||
|
|
||||||
<div class="content">
|
<div class="content">
|
||||||
@@ -26,8 +27,7 @@
|
|||||||
following into your command line and following the prompts:
|
following into your command line and following the prompts:
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<!-- TODO lose the @next! -->
|
<pre>npm init svelte</pre>
|
||||||
<pre>npm init svelte@next</pre>
|
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
The page you're looking at is purely static HTML, with no client-side interactivity needed.
|
The page you're looking at is purely static HTML, with no client-side interactivity needed.
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
<svelte:head>
|
<svelte:head>
|
||||||
<title>Home</title>
|
<title>Home</title>
|
||||||
|
<meta name="description" content="Svelte demo app" />
|
||||||
</svelte:head>
|
</svelte:head>
|
||||||
|
|
||||||
<section>
|
<section>
|
||||||
|
|||||||
@@ -11,6 +11,11 @@
|
|||||||
|
|
||||||
const base = 'https://api.svelte.dev';
|
const base = 'https://api.svelte.dev';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {string} method
|
||||||
|
* @param {string} resource
|
||||||
|
* @param {Record<string, unknown>} [data]
|
||||||
|
*/
|
||||||
export function api(method, resource, data) {
|
export function api(method, resource, data) {
|
||||||
return fetch(`${base}/${resource}`, {
|
return fetch(`${base}/${resource}`, {
|
||||||
method,
|
method,
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { api } from './_api';
|
import { api } from './_api';
|
||||||
|
|
||||||
|
/** @type {import('./__types').RequestHandler} */
|
||||||
export const get = async ({ locals }) => {
|
export const get = async ({ locals }) => {
|
||||||
// locals.userid comes from src/hooks.js
|
// locals.userid comes from src/hooks.js
|
||||||
const response = await api('get', `todos/${locals.userid}`);
|
const response = await api('get', `todos/${locals.userid}`);
|
||||||
@@ -27,6 +28,7 @@ export const get = async ({ locals }) => {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/** @type {import('./index').RequestHandler} */
|
||||||
export const post = async ({ request, locals }) => {
|
export const post = async ({ request, locals }) => {
|
||||||
const form = await request.formData();
|
const form = await request.formData();
|
||||||
|
|
||||||
@@ -46,6 +48,7 @@ const redirect = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/** @type {import('./index').RequestHandler} */
|
||||||
export const patch = async ({ request, locals }) => {
|
export const patch = async ({ request, locals }) => {
|
||||||
const form = await request.formData();
|
const form = await request.formData();
|
||||||
|
|
||||||
@@ -57,6 +60,7 @@ export const patch = async ({ request, locals }) => {
|
|||||||
return redirect;
|
return redirect;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/** @type {import('./index').RequestHandler} */
|
||||||
export const del = async ({ request, locals }) => {
|
export const del = async ({ request, locals }) => {
|
||||||
const form = await request.formData();
|
const form = await request.formData();
|
||||||
|
|
||||||
|
|||||||
@@ -3,11 +3,23 @@
|
|||||||
import { scale } from 'svelte/transition';
|
import { scale } from 'svelte/transition';
|
||||||
import { flip } from 'svelte/animate';
|
import { flip } from 'svelte/animate';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef {{
|
||||||
|
* uid: string;
|
||||||
|
* created_at: Date;
|
||||||
|
* text: string;
|
||||||
|
* done: boolean;
|
||||||
|
* pending_delete: boolean;
|
||||||
|
* }} Todo
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @type {Todo[]} */
|
||||||
export let todos;
|
export let todos;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<svelte:head>
|
<svelte:head>
|
||||||
<title>Todos</title>
|
<title>Todos</title>
|
||||||
|
<meta name="description" content="A todo list app" />
|
||||||
</svelte:head>
|
</svelte:head>
|
||||||
|
|
||||||
<div class="todos">
|
<div class="todos">
|
||||||
|
|||||||
10
package.json
10
package.json
@@ -31,7 +31,7 @@
|
|||||||
"prettier": "2.6.2",
|
"prettier": "2.6.2",
|
||||||
"ts-eager": "2.0.2",
|
"ts-eager": "2.0.2",
|
||||||
"ts-jest": "28.0.0-next.1",
|
"ts-jest": "28.0.0-next.1",
|
||||||
"turbo": "1.2.5"
|
"turbo": "1.2.14"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"lerna": "lerna",
|
"lerna": "lerna",
|
||||||
@@ -44,10 +44,10 @@
|
|||||||
"vercel-build": "yarn build && cd api && node -r ts-eager/register ./_lib/script/build.ts",
|
"vercel-build": "yarn build && 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": "yarn test && node utils/run.js test-unit",
|
"test-unit": "yarn test && turbo run test-unit",
|
||||||
"test-integration-cli": "node utils/run.js test-integration-cli",
|
"test-integration-cli": "turbo run test-integration-cli",
|
||||||
"test-integration-once": "node utils/run.js test-integration-once",
|
"test-integration-once": "turbo run test-integration-once",
|
||||||
"test-integration-dev": "node utils/run.js test-integration-dev",
|
"test-integration-dev": "turbo run test-integration-dev",
|
||||||
"lint": "eslint . --ext .ts,.js",
|
"lint": "eslint . --ext .ts,.js",
|
||||||
"prepare": "husky install"
|
"prepare": "husky install"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@vercel/build-utils",
|
"name": "@vercel/build-utils",
|
||||||
"version": "3.0.1",
|
"version": "4.0.0",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"main": "./dist/index.js",
|
"main": "./dist/index.js",
|
||||||
"types": "./dist/index.d.js",
|
"types": "./dist/index.d.js",
|
||||||
@@ -12,8 +12,9 @@
|
|||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "node build",
|
"build": "node build",
|
||||||
"test-unit": "jest --env node --verbose --runInBand --bail test/unit.*test.*",
|
"test": "jest --env node --verbose --runInBand --bail",
|
||||||
"test-integration-once": "jest --env node --verbose --runInBand --bail test/integration.test.ts",
|
"test-unit": "yarn test test/unit.*test.*",
|
||||||
|
"test-integration-once": "yarn test test/integration.test.ts",
|
||||||
"prepublishOnly": "node build"
|
"prepublishOnly": "node build"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
@@ -30,7 +31,7 @@
|
|||||||
"@types/node-fetch": "^2.1.6",
|
"@types/node-fetch": "^2.1.6",
|
||||||
"@types/semver": "6.0.0",
|
"@types/semver": "6.0.0",
|
||||||
"@types/yazl": "2.4.2",
|
"@types/yazl": "2.4.2",
|
||||||
"@vercel/frameworks": "0.9.0",
|
"@vercel/frameworks": "1.0.1",
|
||||||
"@vercel/ncc": "0.24.0",
|
"@vercel/ncc": "0.24.0",
|
||||||
"aggregate-error": "3.0.1",
|
"aggregate-error": "3.0.1",
|
||||||
"async-retry": "1.2.3",
|
"async-retry": "1.2.3",
|
||||||
|
|||||||
@@ -1,12 +1,17 @@
|
|||||||
import { Framework, FrameworkDetectionItem } from '@vercel/frameworks';
|
import { Framework, FrameworkDetectionItem } from '@vercel/frameworks';
|
||||||
import { DetectorFilesystem } from './detectors/filesystem';
|
import { DetectorFilesystem } from './detectors/filesystem';
|
||||||
|
|
||||||
export interface DetectFrameworkOptions {
|
interface BaseFramework {
|
||||||
fs: DetectorFilesystem;
|
slug: Framework['slug'];
|
||||||
frameworkList: readonly Framework[];
|
detectors?: Framework['detectors'];
|
||||||
}
|
}
|
||||||
|
|
||||||
async function matches(fs: DetectorFilesystem, framework: Framework) {
|
export interface DetectFrameworkOptions {
|
||||||
|
fs: DetectorFilesystem;
|
||||||
|
frameworkList: readonly BaseFramework[];
|
||||||
|
}
|
||||||
|
|
||||||
|
async function matches(fs: DetectorFilesystem, framework: BaseFramework) {
|
||||||
const { detectors } = framework;
|
const { detectors } = framework;
|
||||||
|
|
||||||
if (!detectors) {
|
if (!detectors) {
|
||||||
|
|||||||
@@ -6,7 +6,12 @@ import debug from '../debug';
|
|||||||
const allOptions = [
|
const allOptions = [
|
||||||
{ major: 16, range: '16.x', runtime: 'nodejs16.x' },
|
{ major: 16, range: '16.x', runtime: 'nodejs16.x' },
|
||||||
{ major: 14, range: '14.x', runtime: 'nodejs14.x' },
|
{ major: 14, range: '14.x', runtime: 'nodejs14.x' },
|
||||||
{ major: 12, range: '12.x', runtime: 'nodejs12.x' },
|
{
|
||||||
|
major: 12,
|
||||||
|
range: '12.x',
|
||||||
|
runtime: 'nodejs12.x',
|
||||||
|
discontinueDate: new Date('2022-08-09'),
|
||||||
|
},
|
||||||
{
|
{
|
||||||
major: 10,
|
major: 10,
|
||||||
range: '10.x',
|
range: '10.x',
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import fs from 'fs-extra';
|
|||||||
import path from 'path';
|
import path from 'path';
|
||||||
import Sema from 'async-sema';
|
import Sema from 'async-sema';
|
||||||
import spawn from 'cross-spawn';
|
import spawn from 'cross-spawn';
|
||||||
|
import { coerce, intersects, validRange } from 'semver';
|
||||||
import { SpawnOptions } from 'child_process';
|
import { SpawnOptions } from 'child_process';
|
||||||
import { deprecate } from 'util';
|
import { deprecate } from 'util';
|
||||||
import debug from '../debug';
|
import debug from '../debug';
|
||||||
@@ -205,7 +206,9 @@ export function getSpawnOptions(
|
|||||||
|
|
||||||
if (!meta.isDev) {
|
if (!meta.isDev) {
|
||||||
// Ensure that the selected Node version is at the beginning of the `$PATH`
|
// Ensure that the selected Node version is at the beginning of the `$PATH`
|
||||||
opts.env.PATH = `/node${nodeVersion.major}/bin:${opts.env.PATH}`;
|
opts.env.PATH = `/node${nodeVersion.major}/bin${path.delimiter}${
|
||||||
|
opts.env.PATH || process.env.PATH
|
||||||
|
}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
return opts;
|
return opts;
|
||||||
@@ -217,9 +220,9 @@ export async function getNodeVersion(
|
|||||||
config: Config = {},
|
config: Config = {},
|
||||||
meta: Meta = {}
|
meta: Meta = {}
|
||||||
): Promise<NodeVersion> {
|
): Promise<NodeVersion> {
|
||||||
|
const latest = getLatestNodeVersion();
|
||||||
if (meta && meta.isDev) {
|
if (meta && meta.isDev) {
|
||||||
// Use the system-installed version of `node` in PATH for `vercel dev`
|
// Use the system-installed version of `node` in PATH for `vercel dev`
|
||||||
const latest = getLatestNodeVersion();
|
|
||||||
return { ...latest, runtime: 'nodejs' };
|
return { ...latest, runtime: 'nodejs' };
|
||||||
}
|
}
|
||||||
const { packageJson } = await scanParentDirs(destPath, true);
|
const { packageJson } = await scanParentDirs(destPath, true);
|
||||||
@@ -227,10 +230,27 @@ export async function getNodeVersion(
|
|||||||
let isAuto = true;
|
let isAuto = true;
|
||||||
if (packageJson && packageJson.engines && packageJson.engines.node) {
|
if (packageJson && packageJson.engines && packageJson.engines.node) {
|
||||||
const { node } = packageJson.engines;
|
const { node } = packageJson.engines;
|
||||||
if (nodeVersion && nodeVersion !== node && !meta.isDev) {
|
if (
|
||||||
|
nodeVersion &&
|
||||||
|
validRange(node) &&
|
||||||
|
!intersects(nodeVersion, node) &&
|
||||||
|
!meta.isDev
|
||||||
|
) {
|
||||||
console.warn(
|
console.warn(
|
||||||
`Warning: Due to "engines": { "node": "${node}" } in your \`package.json\` file, the Node.js Version defined in your Project Settings ("${nodeVersion}") will not apply. Learn More: http://vercel.link/node-version`
|
`Warning: Due to "engines": { "node": "${node}" } in your \`package.json\` file, the Node.js Version defined in your Project Settings ("${nodeVersion}") will not apply. Learn More: http://vercel.link/node-version`
|
||||||
);
|
);
|
||||||
|
} else if (coerce(node)?.raw === node && !meta.isDev) {
|
||||||
|
console.warn(
|
||||||
|
`Warning: Detected "engines": { "node": "${node}" } in your \`package.json\` with major.minor.patch, but only major Node.js Version can be selected. Learn More: http://vercel.link/node-version`
|
||||||
|
);
|
||||||
|
} else if (
|
||||||
|
validRange(node) &&
|
||||||
|
intersects(`${latest.major + 1}.x`, node) &&
|
||||||
|
!meta.isDev
|
||||||
|
) {
|
||||||
|
console.warn(
|
||||||
|
`Warning: Detected "engines": { "node": "${node}" } in your \`package.json\` that will automatically upgrade when a new major Node.js Version is released. Learn More: http://vercel.link/node-version`
|
||||||
|
);
|
||||||
}
|
}
|
||||||
nodeVersion = node;
|
nodeVersion = node;
|
||||||
isAuto = false;
|
isAuto = false;
|
||||||
@@ -433,13 +453,13 @@ export function getEnvForPackageManager({
|
|||||||
(nodeVersion?.major || 0) < 16
|
(nodeVersion?.major || 0) < 16
|
||||||
) {
|
) {
|
||||||
// Ensure that npm 7 is at the beginning of the `$PATH`
|
// Ensure that npm 7 is at the beginning of the `$PATH`
|
||||||
newEnv.PATH = `/node16/bin-npm7:${env.PATH}`;
|
newEnv.PATH = `/node16/bin-npm7${path.delimiter}${env.PATH}`;
|
||||||
console.log('Detected `package-lock.json` generated by npm 7...');
|
console.log('Detected `package-lock.json` generated by npm 7...');
|
||||||
}
|
}
|
||||||
} else if (cliType === 'pnpm') {
|
} else if (cliType === 'pnpm') {
|
||||||
if (typeof lockfileVersion === 'number' && lockfileVersion === 5.4) {
|
if (typeof lockfileVersion === 'number' && lockfileVersion === 5.4) {
|
||||||
// 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/node_modules/.bin:${env.PATH}`;
|
newEnv.PATH = `/pnpm7/node_modules/.bin${path.delimiter}${env.PATH}`;
|
||||||
console.log('Detected `pnpm-lock.yaml` generated by pnpm 7...');
|
console.log('Detected `pnpm-lock.yaml` generated by pnpm 7...');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -117,3 +117,5 @@ export const isStaticRuntime = (name?: string): boolean => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export { workspaceManagers } from './workspaces/workspace-managers';
|
export { workspaceManagers } from './workspaces/workspace-managers';
|
||||||
|
export { getWorkspaces } from './workspaces/get-workspaces';
|
||||||
|
export { monorepoManagers } from './monorepos/monorepo-managers';
|
||||||
|
|||||||
36
packages/build-utils/src/monorepos/monorepo-managers.ts
Normal file
36
packages/build-utils/src/monorepos/monorepo-managers.ts
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
import type { Framework } from '@vercel/frameworks';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The supported list of monorepo managers.
|
||||||
|
*
|
||||||
|
* This list is designed to work with the @see {@link detectFramework} function.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* import { monorepoManagers as frameworkList } from '@vercel/build-utils'
|
||||||
|
* import { detectFramework } from '@vercel/build-utils'
|
||||||
|
*
|
||||||
|
* const fs = new GitDetectorFilesystem(...)
|
||||||
|
* detectFramwork({ fs, frameworkList }) // returns the 'slug' field if detected, otherwise null
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
export const monorepoManagers: Array<
|
||||||
|
Omit<Framework, 'description' | 'logo' | 'settings' | 'getOutputDirName'>
|
||||||
|
> = [
|
||||||
|
{
|
||||||
|
name: 'Turborepo',
|
||||||
|
slug: 'turbo',
|
||||||
|
detectors: {
|
||||||
|
some: [
|
||||||
|
{
|
||||||
|
path: 'turbo.json',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'package.json',
|
||||||
|
matchContent: '"turbo":\\s*{[^}]*.+[^}]*}',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
export default monorepoManagers;
|
||||||
@@ -82,7 +82,7 @@ export interface BuildOptions {
|
|||||||
* is the Git Repository Root. This is only relevant for Monorepos.
|
* is the Git Repository Root. This is only relevant for Monorepos.
|
||||||
* See https://vercel.com/blog/monorepos
|
* See https://vercel.com/blog/monorepos
|
||||||
*/
|
*/
|
||||||
repoRootPath?: string;
|
repoRootPath: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An arbitrary object passed by the user in the build definition defined
|
* An arbitrary object passed by the user in the build definition defined
|
||||||
@@ -123,7 +123,7 @@ export interface PrepareCacheOptions {
|
|||||||
* is the Git Repository Root. This is only relevant for Monorepos.
|
* is the Git Repository Root. This is only relevant for Monorepos.
|
||||||
* See https://vercel.com/blog/monorepos
|
* See https://vercel.com/blog/monorepos
|
||||||
*/
|
*/
|
||||||
repoRootPath?: string;
|
repoRootPath: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An arbitrary object passed by the user in the build definition defined
|
* An arbitrary object passed by the user in the build definition defined
|
||||||
@@ -295,6 +295,7 @@ export interface PackageJson {
|
|||||||
readonly preferGlobal?: boolean;
|
readonly preferGlobal?: boolean;
|
||||||
readonly private?: boolean;
|
readonly private?: boolean;
|
||||||
readonly publishConfig?: PackageJson.PublishConfig;
|
readonly publishConfig?: PackageJson.PublishConfig;
|
||||||
|
readonly packageManager?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface NodeVersion {
|
export interface NodeVersion {
|
||||||
@@ -327,6 +328,7 @@ export interface ProjectSettings {
|
|||||||
buildCommand?: string | null;
|
buildCommand?: string | null;
|
||||||
outputDirectory?: string | null;
|
outputDirectory?: string | null;
|
||||||
rootDirectory?: string | null;
|
rootDirectory?: string | null;
|
||||||
|
nodeVersion?: string;
|
||||||
createdAt?: number;
|
createdAt?: number;
|
||||||
autoExposeSystemEnvs?: boolean;
|
autoExposeSystemEnvs?: boolean;
|
||||||
sourceFilesOutsideRootDirectory?: boolean;
|
sourceFilesOutsideRootDirectory?: boolean;
|
||||||
@@ -351,11 +353,41 @@ export interface BuilderV3 {
|
|||||||
|
|
||||||
type ImageFormat = 'image/avif' | 'image/webp';
|
type ImageFormat = 'image/avif' | 'image/webp';
|
||||||
|
|
||||||
|
export type RemotePattern = {
|
||||||
|
/**
|
||||||
|
* Must be `http` or `https`.
|
||||||
|
*/
|
||||||
|
protocol?: 'http' | 'https';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Can be literal or wildcard.
|
||||||
|
* Single `*` matches a single subdomain.
|
||||||
|
* Double `**` matches any number of subdomains.
|
||||||
|
*/
|
||||||
|
hostname: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Can be literal port such as `8080` or empty string
|
||||||
|
* meaning no port.
|
||||||
|
*/
|
||||||
|
port?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Can be literal or wildcard.
|
||||||
|
* Single `*` matches a single path segment.
|
||||||
|
* Double `**` matches any number of path segments.
|
||||||
|
*/
|
||||||
|
pathname?: string;
|
||||||
|
};
|
||||||
|
|
||||||
export interface Images {
|
export interface Images {
|
||||||
domains: string[];
|
domains: string[];
|
||||||
|
remotePatterns?: RemotePattern[];
|
||||||
sizes: number[];
|
sizes: number[];
|
||||||
minimumCacheTTL?: number;
|
minimumCacheTTL?: number;
|
||||||
formats?: ImageFormat[];
|
formats?: ImageFormat[];
|
||||||
|
dangerouslyAllowSVG?: boolean;
|
||||||
|
contentSecurityPolicy?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
59
packages/build-utils/src/workspaces/get-workspaces.ts
Normal file
59
packages/build-utils/src/workspaces/get-workspaces.ts
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
import path from 'path';
|
||||||
|
import { DetectorFilesystem } from '../detectors/filesystem';
|
||||||
|
import { workspaceManagers } from './workspace-managers';
|
||||||
|
import { detectFramework as detectWorkspaceManagers } from '../detect-framework';
|
||||||
|
|
||||||
|
const MAX_DEPTH_TRAVERSE = 3;
|
||||||
|
const posixPath = path.posix;
|
||||||
|
|
||||||
|
export interface GetWorkspaceOptions {
|
||||||
|
fs: DetectorFilesystem;
|
||||||
|
depth?: number;
|
||||||
|
cwd?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type WorkspaceType = 'yarn' | 'pnpm' | 'npm';
|
||||||
|
|
||||||
|
export type Workspace = {
|
||||||
|
type: WorkspaceType;
|
||||||
|
rootPath: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export async function getWorkspaces({
|
||||||
|
fs,
|
||||||
|
depth = MAX_DEPTH_TRAVERSE,
|
||||||
|
cwd = '/',
|
||||||
|
}: GetWorkspaceOptions): Promise<Workspace[]> {
|
||||||
|
if (depth === 0) return [];
|
||||||
|
|
||||||
|
const workspaceType = await detectWorkspaceManagers({
|
||||||
|
fs,
|
||||||
|
frameworkList: workspaceManagers,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (workspaceType === null) {
|
||||||
|
const directoryContents = await fs.readdir('./');
|
||||||
|
const childDirectories = directoryContents.filter(
|
||||||
|
stat => stat.type === 'dir'
|
||||||
|
);
|
||||||
|
|
||||||
|
return (
|
||||||
|
await Promise.all(
|
||||||
|
childDirectories.map(childDirectory =>
|
||||||
|
getWorkspaces({
|
||||||
|
fs: fs.chdir(childDirectory.path),
|
||||||
|
depth: depth - 1,
|
||||||
|
cwd: posixPath.join(cwd, childDirectory.path),
|
||||||
|
})
|
||||||
|
)
|
||||||
|
)
|
||||||
|
).flat();
|
||||||
|
}
|
||||||
|
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
type: workspaceType as WorkspaceType,
|
||||||
|
rootPath: cwd,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
}
|
||||||
@@ -6,15 +6,16 @@ import type { Framework } from '@vercel/frameworks';
|
|||||||
* This list is designed to work with the @see {@link detectFramework} function.
|
* This list is designed to work with the @see {@link detectFramework} function.
|
||||||
*
|
*
|
||||||
* @example
|
* @example
|
||||||
* import { workspaceManagers as frameworkList } from '@vercel/build-utils/workspaces'
|
* import { workspaceManagers as frameworkList } from '@vercel/build-utils'
|
||||||
* import { detectFramework } from '@vercel/build-utils'
|
* import { detectFramework } from '@vercel/build-utils'
|
||||||
*
|
*
|
||||||
* const fs = new GitDetectorFilesystem(...)
|
* const fs = new GitDetectorFilesystem(...)
|
||||||
* detectFramwork({ fs, frameworkList }) // returns the 'slug' field if detected, otherwise null
|
* detectFramwork({ fs, frameworkList }) // returns the 'slug' field if detected, otherwise null
|
||||||
*
|
*
|
||||||
* @todo Will be used by the detect-eligible-projects API endpoint for a given git url.
|
|
||||||
*/
|
*/
|
||||||
export const workspaceManagers: Array<Framework> = [
|
export const workspaceManagers: Array<
|
||||||
|
Omit<Framework, 'description' | 'logo' | 'settings' | 'getOutputDirName'>
|
||||||
|
> = [
|
||||||
{
|
{
|
||||||
name: 'Yarn',
|
name: 'Yarn',
|
||||||
slug: 'yarn',
|
slug: 'yarn',
|
||||||
@@ -30,28 +31,6 @@ export const workspaceManagers: Array<Framework> = [
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
// unused props - needed for typescript
|
|
||||||
description: '',
|
|
||||||
logo: '',
|
|
||||||
settings: {
|
|
||||||
buildCommand: {
|
|
||||||
value: '',
|
|
||||||
placeholder: '',
|
|
||||||
},
|
|
||||||
devCommand: {
|
|
||||||
value: '',
|
|
||||||
placeholder: '',
|
|
||||||
},
|
|
||||||
installCommand: {
|
|
||||||
value: '',
|
|
||||||
placeholder: '',
|
|
||||||
},
|
|
||||||
outputDirectory: {
|
|
||||||
value: '',
|
|
||||||
placeholder: '',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
getOutputDirName: () => Promise.resolve(''),
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'pnpm',
|
name: 'pnpm',
|
||||||
@@ -63,28 +42,6 @@ export const workspaceManagers: Array<Framework> = [
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
// unused props - needed for typescript
|
|
||||||
description: '',
|
|
||||||
logo: '',
|
|
||||||
settings: {
|
|
||||||
buildCommand: {
|
|
||||||
value: '',
|
|
||||||
placeholder: '',
|
|
||||||
},
|
|
||||||
devCommand: {
|
|
||||||
value: '',
|
|
||||||
placeholder: '',
|
|
||||||
},
|
|
||||||
installCommand: {
|
|
||||||
value: '',
|
|
||||||
placeholder: '',
|
|
||||||
},
|
|
||||||
outputDirectory: {
|
|
||||||
value: '',
|
|
||||||
placeholder: '',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
getOutputDirName: () => Promise.resolve(''),
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'npm',
|
name: 'npm',
|
||||||
@@ -101,28 +58,6 @@ export const workspaceManagers: Array<Framework> = [
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
// unused props - needed for typescript
|
|
||||||
description: '',
|
|
||||||
logo: '',
|
|
||||||
settings: {
|
|
||||||
buildCommand: {
|
|
||||||
value: '',
|
|
||||||
placeholder: '',
|
|
||||||
},
|
|
||||||
devCommand: {
|
|
||||||
value: '',
|
|
||||||
placeholder: '',
|
|
||||||
},
|
|
||||||
installCommand: {
|
|
||||||
value: '',
|
|
||||||
placeholder: '',
|
|
||||||
},
|
|
||||||
outputDirectory: {
|
|
||||||
value: '',
|
|
||||||
placeholder: '',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
getOutputDirName: () => Promise.resolve(''),
|
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
@@ -17,5 +17,13 @@ checkPkgOrThrow('exeggcute');
|
|||||||
|
|
||||||
// This is to satisfy `@vercel/static-build` which needs a `dist` directory.
|
// This is to satisfy `@vercel/static-build` which needs a `dist` directory.
|
||||||
const { exec } = require('exeggcute');
|
const { exec } = require('exeggcute');
|
||||||
exec('mkdir dist', __dirname);
|
exec('mkdir dist', __dirname)
|
||||||
exec('echo "node-env:RANDOMNESS_PLACEHOLDER" > dist/index.html', __dirname);
|
.then(() => {
|
||||||
|
exec(
|
||||||
|
'echo "node-env:RANDOMNESS_PLACEHOLDER" > dist/index.html',
|
||||||
|
__dirname
|
||||||
|
).then(() => {
|
||||||
|
console.log('Success');
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.catch(console.error);
|
||||||
|
|||||||
@@ -6,5 +6,10 @@ const b = require('./b');
|
|||||||
a();
|
a();
|
||||||
b();
|
b();
|
||||||
|
|
||||||
exec('mkdir public', __dirname);
|
exec('mkdir public', __dirname)
|
||||||
exec('echo "Hello, World!" > public/index.html', __dirname);
|
.then(() => {
|
||||||
|
exec('echo "Hello, World!" > public/index.html', __dirname).then(() => {
|
||||||
|
console.log('Success');
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.catch(console.error);
|
||||||
|
|||||||
15
packages/build-utils/test/fixtures/28-turborepo-with-yarn-workspaces/a/package.json
vendored
Normal file
15
packages/build-utils/test/fixtures/28-turborepo-with-yarn-workspaces/a/package.json
vendored
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"name": "a",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "",
|
||||||
|
"main": "index.js",
|
||||||
|
"scripts": {
|
||||||
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
|
},
|
||||||
|
"keywords": [],
|
||||||
|
"author": "",
|
||||||
|
"license": "ISC",
|
||||||
|
"dependencies": {
|
||||||
|
"debug": "^4.3.2"
|
||||||
|
}
|
||||||
|
}
|
||||||
15
packages/build-utils/test/fixtures/28-turborepo-with-yarn-workspaces/b/package.json
vendored
Normal file
15
packages/build-utils/test/fixtures/28-turborepo-with-yarn-workspaces/b/package.json
vendored
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"name": "b",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "",
|
||||||
|
"main": "index.js",
|
||||||
|
"scripts": {
|
||||||
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
|
},
|
||||||
|
"keywords": [],
|
||||||
|
"author": "",
|
||||||
|
"license": "ISC",
|
||||||
|
"dependencies": {
|
||||||
|
"cowsay": "^1.5.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
9
packages/build-utils/test/fixtures/28-turborepo-with-yarn-workspaces/package.json
vendored
Normal file
9
packages/build-utils/test/fixtures/28-turborepo-with-yarn-workspaces/package.json
vendored
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"name": "21-npm-workspaces",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"private": true,
|
||||||
|
"workspaces": [
|
||||||
|
"a",
|
||||||
|
"b"
|
||||||
|
]
|
||||||
|
}
|
||||||
20
packages/build-utils/test/fixtures/28-turborepo-with-yarn-workspaces/turbo.json
vendored
Normal file
20
packages/build-utils/test/fixtures/28-turborepo-with-yarn-workspaces/turbo.json
vendored
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://turborepo.org/schema.json",
|
||||||
|
"baseBranch": "origin/main",
|
||||||
|
"pipeline": {
|
||||||
|
"build": {
|
||||||
|
"dependsOn": ["^build"],
|
||||||
|
"outputs": [".next/**"]
|
||||||
|
},
|
||||||
|
"test": {
|
||||||
|
"dependsOn": ["^build"],
|
||||||
|
"outputs": []
|
||||||
|
},
|
||||||
|
"lint": {
|
||||||
|
"outputs": []
|
||||||
|
},
|
||||||
|
"dev": {
|
||||||
|
"cache": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
232
packages/build-utils/test/fixtures/28-turborepo-with-yarn-workspaces/yarn.lock
vendored
Normal file
232
packages/build-utils/test/fixtures/28-turborepo-with-yarn-workspaces/yarn.lock
vendored
Normal file
@@ -0,0 +1,232 @@
|
|||||||
|
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
||||||
|
# yarn lockfile v1
|
||||||
|
|
||||||
|
|
||||||
|
ansi-regex@^3.0.0:
|
||||||
|
version "3.0.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-3.0.1.tgz#123d6479e92ad45ad897d4054e3c7ca7db4944e1"
|
||||||
|
integrity sha512-+O9Jct8wf++lXxxFc4hc8LsjaSq0HFzzL7cVsw8pRDIPdjKD2mT4ytDZlLuSBZ4cLKZFXIrMGO7DbQCtMJJMKw==
|
||||||
|
|
||||||
|
ansi-regex@^5.0.1:
|
||||||
|
version "5.0.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304"
|
||||||
|
integrity sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==
|
||||||
|
|
||||||
|
ansi-styles@^4.0.0:
|
||||||
|
version "4.3.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.3.0.tgz#edd803628ae71c04c85ae7a0906edad34b648937"
|
||||||
|
integrity sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==
|
||||||
|
dependencies:
|
||||||
|
color-convert "^2.0.1"
|
||||||
|
|
||||||
|
camelcase@^5.0.0:
|
||||||
|
version "5.3.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320"
|
||||||
|
integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==
|
||||||
|
|
||||||
|
cliui@^6.0.0:
|
||||||
|
version "6.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/cliui/-/cliui-6.0.0.tgz#511d702c0c4e41ca156d7d0e96021f23e13225b1"
|
||||||
|
integrity sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ==
|
||||||
|
dependencies:
|
||||||
|
string-width "^4.2.0"
|
||||||
|
strip-ansi "^6.0.0"
|
||||||
|
wrap-ansi "^6.2.0"
|
||||||
|
|
||||||
|
color-convert@^2.0.1:
|
||||||
|
version "2.0.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-2.0.1.tgz#72d3a68d598c9bdb3af2ad1e84f21d896abd4de3"
|
||||||
|
integrity sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==
|
||||||
|
dependencies:
|
||||||
|
color-name "~1.1.4"
|
||||||
|
|
||||||
|
color-name@~1.1.4:
|
||||||
|
version "1.1.4"
|
||||||
|
resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2"
|
||||||
|
integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==
|
||||||
|
|
||||||
|
cowsay@^1.5.0:
|
||||||
|
version "1.5.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/cowsay/-/cowsay-1.5.0.tgz#4a2a453b8b59383c7d7a50e44d765c5de0bf615f"
|
||||||
|
integrity sha512-8Ipzr54Z8zROr/62C8f0PdhQcDusS05gKTS87xxdji8VbWefWly0k8BwGK7+VqamOrkv3eGsCkPtvlHzrhWsCA==
|
||||||
|
dependencies:
|
||||||
|
get-stdin "8.0.0"
|
||||||
|
string-width "~2.1.1"
|
||||||
|
strip-final-newline "2.0.0"
|
||||||
|
yargs "15.4.1"
|
||||||
|
|
||||||
|
debug@^4.3.2:
|
||||||
|
version "4.3.4"
|
||||||
|
resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865"
|
||||||
|
integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==
|
||||||
|
dependencies:
|
||||||
|
ms "2.1.2"
|
||||||
|
|
||||||
|
decamelize@^1.2.0:
|
||||||
|
version "1.2.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290"
|
||||||
|
integrity sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=
|
||||||
|
|
||||||
|
emoji-regex@^8.0.0:
|
||||||
|
version "8.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37"
|
||||||
|
integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==
|
||||||
|
|
||||||
|
find-up@^4.1.0:
|
||||||
|
version "4.1.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/find-up/-/find-up-4.1.0.tgz#97afe7d6cdc0bc5928584b7c8d7b16e8a9aa5d19"
|
||||||
|
integrity sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==
|
||||||
|
dependencies:
|
||||||
|
locate-path "^5.0.0"
|
||||||
|
path-exists "^4.0.0"
|
||||||
|
|
||||||
|
get-caller-file@^2.0.1:
|
||||||
|
version "2.0.5"
|
||||||
|
resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e"
|
||||||
|
integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==
|
||||||
|
|
||||||
|
get-stdin@8.0.0:
|
||||||
|
version "8.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-8.0.0.tgz#cbad6a73feb75f6eeb22ba9e01f89aa28aa97a53"
|
||||||
|
integrity sha512-sY22aA6xchAzprjyqmSEQv4UbAAzRN0L2dQB0NlN5acTTK9Don6nhoc3eAbUnpZiCANAMfd/+40kVdKfFygohg==
|
||||||
|
|
||||||
|
is-fullwidth-code-point@^2.0.0:
|
||||||
|
version "2.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f"
|
||||||
|
integrity sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=
|
||||||
|
|
||||||
|
is-fullwidth-code-point@^3.0.0:
|
||||||
|
version "3.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d"
|
||||||
|
integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==
|
||||||
|
|
||||||
|
locate-path@^5.0.0:
|
||||||
|
version "5.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-5.0.0.tgz#1afba396afd676a6d42504d0a67a3a7eb9f62aa0"
|
||||||
|
integrity sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==
|
||||||
|
dependencies:
|
||||||
|
p-locate "^4.1.0"
|
||||||
|
|
||||||
|
ms@2.1.2:
|
||||||
|
version "2.1.2"
|
||||||
|
resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009"
|
||||||
|
integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==
|
||||||
|
|
||||||
|
p-limit@^2.2.0:
|
||||||
|
version "2.3.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.3.0.tgz#3dd33c647a214fdfffd835933eb086da0dc21db1"
|
||||||
|
integrity sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==
|
||||||
|
dependencies:
|
||||||
|
p-try "^2.0.0"
|
||||||
|
|
||||||
|
p-locate@^4.1.0:
|
||||||
|
version "4.1.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-4.1.0.tgz#a3428bb7088b3a60292f66919278b7c297ad4f07"
|
||||||
|
integrity sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==
|
||||||
|
dependencies:
|
||||||
|
p-limit "^2.2.0"
|
||||||
|
|
||||||
|
p-try@^2.0.0:
|
||||||
|
version "2.2.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/p-try/-/p-try-2.2.0.tgz#cb2868540e313d61de58fafbe35ce9004d5540e6"
|
||||||
|
integrity sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==
|
||||||
|
|
||||||
|
path-exists@^4.0.0:
|
||||||
|
version "4.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-4.0.0.tgz#513bdbe2d3b95d7762e8c1137efa195c6c61b5b3"
|
||||||
|
integrity sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==
|
||||||
|
|
||||||
|
require-directory@^2.1.1:
|
||||||
|
version "2.1.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42"
|
||||||
|
integrity sha1-jGStX9MNqxyXbiNE/+f3kqam30I=
|
||||||
|
|
||||||
|
require-main-filename@^2.0.0:
|
||||||
|
version "2.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-2.0.0.tgz#d0b329ecc7cc0f61649f62215be69af54aa8989b"
|
||||||
|
integrity sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==
|
||||||
|
|
||||||
|
set-blocking@^2.0.0:
|
||||||
|
version "2.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7"
|
||||||
|
integrity sha1-BF+XgtARrppoA93TgrJDkrPYkPc=
|
||||||
|
|
||||||
|
string-width@^4.1.0, string-width@^4.2.0:
|
||||||
|
version "4.2.3"
|
||||||
|
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
|
||||||
|
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
|
||||||
|
dependencies:
|
||||||
|
emoji-regex "^8.0.0"
|
||||||
|
is-fullwidth-code-point "^3.0.0"
|
||||||
|
strip-ansi "^6.0.1"
|
||||||
|
|
||||||
|
string-width@~2.1.1:
|
||||||
|
version "2.1.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.1.1.tgz#ab93f27a8dc13d28cac815c462143a6d9012ae9e"
|
||||||
|
integrity sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==
|
||||||
|
dependencies:
|
||||||
|
is-fullwidth-code-point "^2.0.0"
|
||||||
|
strip-ansi "^4.0.0"
|
||||||
|
|
||||||
|
strip-ansi@^4.0.0:
|
||||||
|
version "4.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-4.0.0.tgz#a8479022eb1ac368a871389b635262c505ee368f"
|
||||||
|
integrity sha1-qEeQIusaw2iocTibY1JixQXuNo8=
|
||||||
|
dependencies:
|
||||||
|
ansi-regex "^3.0.0"
|
||||||
|
|
||||||
|
strip-ansi@^6.0.0, strip-ansi@^6.0.1:
|
||||||
|
version "6.0.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
|
||||||
|
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
|
||||||
|
dependencies:
|
||||||
|
ansi-regex "^5.0.1"
|
||||||
|
|
||||||
|
strip-final-newline@2.0.0:
|
||||||
|
version "2.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/strip-final-newline/-/strip-final-newline-2.0.0.tgz#89b852fb2fcbe936f6f4b3187afb0a12c1ab58ad"
|
||||||
|
integrity sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==
|
||||||
|
|
||||||
|
which-module@^2.0.0:
|
||||||
|
version "2.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/which-module/-/which-module-2.0.0.tgz#d9ef07dce77b9902b8a3a8fa4b31c3e3f7e6e87a"
|
||||||
|
integrity sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=
|
||||||
|
|
||||||
|
wrap-ansi@^6.2.0:
|
||||||
|
version "6.2.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-6.2.0.tgz#e9393ba07102e6c91a3b221478f0257cd2856e53"
|
||||||
|
integrity sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==
|
||||||
|
dependencies:
|
||||||
|
ansi-styles "^4.0.0"
|
||||||
|
string-width "^4.1.0"
|
||||||
|
strip-ansi "^6.0.0"
|
||||||
|
|
||||||
|
y18n@^4.0.0:
|
||||||
|
version "4.0.3"
|
||||||
|
resolved "https://registry.yarnpkg.com/y18n/-/y18n-4.0.3.tgz#b5f259c82cd6e336921efd7bfd8bf560de9eeedf"
|
||||||
|
integrity sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ==
|
||||||
|
|
||||||
|
yargs-parser@^18.1.2:
|
||||||
|
version "18.1.3"
|
||||||
|
resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-18.1.3.tgz#be68c4975c6b2abf469236b0c870362fab09a7b0"
|
||||||
|
integrity sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==
|
||||||
|
dependencies:
|
||||||
|
camelcase "^5.0.0"
|
||||||
|
decamelize "^1.2.0"
|
||||||
|
|
||||||
|
yargs@15.4.1:
|
||||||
|
version "15.4.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/yargs/-/yargs-15.4.1.tgz#0d87a16de01aee9d8bec2bfbf74f67851730f4f8"
|
||||||
|
integrity sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A==
|
||||||
|
dependencies:
|
||||||
|
cliui "^6.0.0"
|
||||||
|
decamelize "^1.2.0"
|
||||||
|
find-up "^4.1.0"
|
||||||
|
get-caller-file "^2.0.1"
|
||||||
|
require-directory "^2.1.1"
|
||||||
|
require-main-filename "^2.0.0"
|
||||||
|
set-blocking "^2.0.0"
|
||||||
|
string-width "^4.2.0"
|
||||||
|
which-module "^2.0.0"
|
||||||
|
y18n "^4.0.0"
|
||||||
|
yargs-parser "^18.1.2"
|
||||||
5
packages/build-utils/test/fixtures/29-nested-workspaces/backend/c/package.json
vendored
Normal file
5
packages/build-utils/test/fixtures/29-nested-workspaces/backend/c/package.json
vendored
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"name": "c",
|
||||||
|
"license": "MIT",
|
||||||
|
"version": "0.1.0"
|
||||||
|
}
|
||||||
8
packages/build-utils/test/fixtures/29-nested-workspaces/backend/d/package.json
vendored
Normal file
8
packages/build-utils/test/fixtures/29-nested-workspaces/backend/d/package.json
vendored
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"name": "d",
|
||||||
|
"license": "MIT",
|
||||||
|
"version": "0.1.0",
|
||||||
|
"devDependencies": {
|
||||||
|
"once": "1.4.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
6
packages/build-utils/test/fixtures/29-nested-workspaces/backend/package.json
vendored
Normal file
6
packages/build-utils/test/fixtures/29-nested-workspaces/backend/package.json
vendored
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"private": true,
|
||||||
|
"name": "29-nested-workspaces-backend",
|
||||||
|
"license": "MIT",
|
||||||
|
"version": "1.0.0"
|
||||||
|
}
|
||||||
27
packages/build-utils/test/fixtures/29-nested-workspaces/backend/pnpm-lock.yaml
generated
vendored
Normal file
27
packages/build-utils/test/fixtures/29-nested-workspaces/backend/pnpm-lock.yaml
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
lockfileVersion: 5.3
|
||||||
|
|
||||||
|
importers:
|
||||||
|
|
||||||
|
.:
|
||||||
|
specifiers: {}
|
||||||
|
|
||||||
|
c:
|
||||||
|
specifiers: {}
|
||||||
|
|
||||||
|
d:
|
||||||
|
specifiers:
|
||||||
|
once: 1.4.0
|
||||||
|
devDependencies:
|
||||||
|
once: 1.4.0
|
||||||
|
|
||||||
|
packages:
|
||||||
|
|
||||||
|
/once/1.4.0:
|
||||||
|
resolution: {integrity: sha1-WDsap3WWHUsROsF9nFC6753Xa9E=}
|
||||||
|
dependencies:
|
||||||
|
wrappy: 1.0.2
|
||||||
|
dev: true
|
||||||
|
|
||||||
|
/wrappy/1.0.2:
|
||||||
|
resolution: {integrity: sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=}
|
||||||
|
dev: true
|
||||||
3
packages/build-utils/test/fixtures/29-nested-workspaces/backend/pnpm-workspace.yaml
vendored
Normal file
3
packages/build-utils/test/fixtures/29-nested-workspaces/backend/pnpm-workspace.yaml
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
packages:
|
||||||
|
- 'c'
|
||||||
|
- 'd'
|
||||||
15
packages/build-utils/test/fixtures/29-nested-workspaces/frontend/a/package.json
vendored
Normal file
15
packages/build-utils/test/fixtures/29-nested-workspaces/frontend/a/package.json
vendored
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"name": "a",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "",
|
||||||
|
"main": "index.js",
|
||||||
|
"scripts": {
|
||||||
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
|
},
|
||||||
|
"keywords": [],
|
||||||
|
"author": "",
|
||||||
|
"license": "ISC",
|
||||||
|
"dependencies": {
|
||||||
|
"debug": "^4.3.2"
|
||||||
|
}
|
||||||
|
}
|
||||||
15
packages/build-utils/test/fixtures/29-nested-workspaces/frontend/b/package.json
vendored
Normal file
15
packages/build-utils/test/fixtures/29-nested-workspaces/frontend/b/package.json
vendored
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"name": "b",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "",
|
||||||
|
"main": "index.js",
|
||||||
|
"scripts": {
|
||||||
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
|
},
|
||||||
|
"keywords": [],
|
||||||
|
"author": "",
|
||||||
|
"license": "ISC",
|
||||||
|
"dependencies": {
|
||||||
|
"cowsay": "^1.5.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
0
packages/build-utils/test/fixtures/29-nested-workspaces/frontend/ignored/.gitkeep
vendored
Normal file
0
packages/build-utils/test/fixtures/29-nested-workspaces/frontend/ignored/.gitkeep
vendored
Normal file
9
packages/build-utils/test/fixtures/29-nested-workspaces/frontend/package.json
vendored
Normal file
9
packages/build-utils/test/fixtures/29-nested-workspaces/frontend/package.json
vendored
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"name": "29-nested-workspaces-frontend",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"private": true,
|
||||||
|
"workspaces": [
|
||||||
|
"a",
|
||||||
|
"b"
|
||||||
|
]
|
||||||
|
}
|
||||||
232
packages/build-utils/test/fixtures/29-nested-workspaces/frontend/yarn.lock
vendored
Normal file
232
packages/build-utils/test/fixtures/29-nested-workspaces/frontend/yarn.lock
vendored
Normal file
@@ -0,0 +1,232 @@
|
|||||||
|
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
||||||
|
# yarn lockfile v1
|
||||||
|
|
||||||
|
|
||||||
|
ansi-regex@^3.0.0:
|
||||||
|
version "3.0.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-3.0.1.tgz#123d6479e92ad45ad897d4054e3c7ca7db4944e1"
|
||||||
|
integrity sha512-+O9Jct8wf++lXxxFc4hc8LsjaSq0HFzzL7cVsw8pRDIPdjKD2mT4ytDZlLuSBZ4cLKZFXIrMGO7DbQCtMJJMKw==
|
||||||
|
|
||||||
|
ansi-regex@^5.0.1:
|
||||||
|
version "5.0.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304"
|
||||||
|
integrity sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==
|
||||||
|
|
||||||
|
ansi-styles@^4.0.0:
|
||||||
|
version "4.3.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.3.0.tgz#edd803628ae71c04c85ae7a0906edad34b648937"
|
||||||
|
integrity sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==
|
||||||
|
dependencies:
|
||||||
|
color-convert "^2.0.1"
|
||||||
|
|
||||||
|
camelcase@^5.0.0:
|
||||||
|
version "5.3.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320"
|
||||||
|
integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==
|
||||||
|
|
||||||
|
cliui@^6.0.0:
|
||||||
|
version "6.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/cliui/-/cliui-6.0.0.tgz#511d702c0c4e41ca156d7d0e96021f23e13225b1"
|
||||||
|
integrity sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ==
|
||||||
|
dependencies:
|
||||||
|
string-width "^4.2.0"
|
||||||
|
strip-ansi "^6.0.0"
|
||||||
|
wrap-ansi "^6.2.0"
|
||||||
|
|
||||||
|
color-convert@^2.0.1:
|
||||||
|
version "2.0.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-2.0.1.tgz#72d3a68d598c9bdb3af2ad1e84f21d896abd4de3"
|
||||||
|
integrity sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==
|
||||||
|
dependencies:
|
||||||
|
color-name "~1.1.4"
|
||||||
|
|
||||||
|
color-name@~1.1.4:
|
||||||
|
version "1.1.4"
|
||||||
|
resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2"
|
||||||
|
integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==
|
||||||
|
|
||||||
|
cowsay@^1.5.0:
|
||||||
|
version "1.5.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/cowsay/-/cowsay-1.5.0.tgz#4a2a453b8b59383c7d7a50e44d765c5de0bf615f"
|
||||||
|
integrity sha512-8Ipzr54Z8zROr/62C8f0PdhQcDusS05gKTS87xxdji8VbWefWly0k8BwGK7+VqamOrkv3eGsCkPtvlHzrhWsCA==
|
||||||
|
dependencies:
|
||||||
|
get-stdin "8.0.0"
|
||||||
|
string-width "~2.1.1"
|
||||||
|
strip-final-newline "2.0.0"
|
||||||
|
yargs "15.4.1"
|
||||||
|
|
||||||
|
debug@^4.3.2:
|
||||||
|
version "4.3.4"
|
||||||
|
resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865"
|
||||||
|
integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==
|
||||||
|
dependencies:
|
||||||
|
ms "2.1.2"
|
||||||
|
|
||||||
|
decamelize@^1.2.0:
|
||||||
|
version "1.2.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290"
|
||||||
|
integrity sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=
|
||||||
|
|
||||||
|
emoji-regex@^8.0.0:
|
||||||
|
version "8.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37"
|
||||||
|
integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==
|
||||||
|
|
||||||
|
find-up@^4.1.0:
|
||||||
|
version "4.1.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/find-up/-/find-up-4.1.0.tgz#97afe7d6cdc0bc5928584b7c8d7b16e8a9aa5d19"
|
||||||
|
integrity sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==
|
||||||
|
dependencies:
|
||||||
|
locate-path "^5.0.0"
|
||||||
|
path-exists "^4.0.0"
|
||||||
|
|
||||||
|
get-caller-file@^2.0.1:
|
||||||
|
version "2.0.5"
|
||||||
|
resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e"
|
||||||
|
integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==
|
||||||
|
|
||||||
|
get-stdin@8.0.0:
|
||||||
|
version "8.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-8.0.0.tgz#cbad6a73feb75f6eeb22ba9e01f89aa28aa97a53"
|
||||||
|
integrity sha512-sY22aA6xchAzprjyqmSEQv4UbAAzRN0L2dQB0NlN5acTTK9Don6nhoc3eAbUnpZiCANAMfd/+40kVdKfFygohg==
|
||||||
|
|
||||||
|
is-fullwidth-code-point@^2.0.0:
|
||||||
|
version "2.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f"
|
||||||
|
integrity sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=
|
||||||
|
|
||||||
|
is-fullwidth-code-point@^3.0.0:
|
||||||
|
version "3.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d"
|
||||||
|
integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==
|
||||||
|
|
||||||
|
locate-path@^5.0.0:
|
||||||
|
version "5.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-5.0.0.tgz#1afba396afd676a6d42504d0a67a3a7eb9f62aa0"
|
||||||
|
integrity sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==
|
||||||
|
dependencies:
|
||||||
|
p-locate "^4.1.0"
|
||||||
|
|
||||||
|
ms@2.1.2:
|
||||||
|
version "2.1.2"
|
||||||
|
resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009"
|
||||||
|
integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==
|
||||||
|
|
||||||
|
p-limit@^2.2.0:
|
||||||
|
version "2.3.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.3.0.tgz#3dd33c647a214fdfffd835933eb086da0dc21db1"
|
||||||
|
integrity sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==
|
||||||
|
dependencies:
|
||||||
|
p-try "^2.0.0"
|
||||||
|
|
||||||
|
p-locate@^4.1.0:
|
||||||
|
version "4.1.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-4.1.0.tgz#a3428bb7088b3a60292f66919278b7c297ad4f07"
|
||||||
|
integrity sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==
|
||||||
|
dependencies:
|
||||||
|
p-limit "^2.2.0"
|
||||||
|
|
||||||
|
p-try@^2.0.0:
|
||||||
|
version "2.2.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/p-try/-/p-try-2.2.0.tgz#cb2868540e313d61de58fafbe35ce9004d5540e6"
|
||||||
|
integrity sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==
|
||||||
|
|
||||||
|
path-exists@^4.0.0:
|
||||||
|
version "4.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-4.0.0.tgz#513bdbe2d3b95d7762e8c1137efa195c6c61b5b3"
|
||||||
|
integrity sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==
|
||||||
|
|
||||||
|
require-directory@^2.1.1:
|
||||||
|
version "2.1.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42"
|
||||||
|
integrity sha1-jGStX9MNqxyXbiNE/+f3kqam30I=
|
||||||
|
|
||||||
|
require-main-filename@^2.0.0:
|
||||||
|
version "2.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-2.0.0.tgz#d0b329ecc7cc0f61649f62215be69af54aa8989b"
|
||||||
|
integrity sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==
|
||||||
|
|
||||||
|
set-blocking@^2.0.0:
|
||||||
|
version "2.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7"
|
||||||
|
integrity sha1-BF+XgtARrppoA93TgrJDkrPYkPc=
|
||||||
|
|
||||||
|
string-width@^4.1.0, string-width@^4.2.0:
|
||||||
|
version "4.2.3"
|
||||||
|
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
|
||||||
|
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
|
||||||
|
dependencies:
|
||||||
|
emoji-regex "^8.0.0"
|
||||||
|
is-fullwidth-code-point "^3.0.0"
|
||||||
|
strip-ansi "^6.0.1"
|
||||||
|
|
||||||
|
string-width@~2.1.1:
|
||||||
|
version "2.1.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.1.1.tgz#ab93f27a8dc13d28cac815c462143a6d9012ae9e"
|
||||||
|
integrity sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==
|
||||||
|
dependencies:
|
||||||
|
is-fullwidth-code-point "^2.0.0"
|
||||||
|
strip-ansi "^4.0.0"
|
||||||
|
|
||||||
|
strip-ansi@^4.0.0:
|
||||||
|
version "4.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-4.0.0.tgz#a8479022eb1ac368a871389b635262c505ee368f"
|
||||||
|
integrity sha1-qEeQIusaw2iocTibY1JixQXuNo8=
|
||||||
|
dependencies:
|
||||||
|
ansi-regex "^3.0.0"
|
||||||
|
|
||||||
|
strip-ansi@^6.0.0, strip-ansi@^6.0.1:
|
||||||
|
version "6.0.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
|
||||||
|
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
|
||||||
|
dependencies:
|
||||||
|
ansi-regex "^5.0.1"
|
||||||
|
|
||||||
|
strip-final-newline@2.0.0:
|
||||||
|
version "2.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/strip-final-newline/-/strip-final-newline-2.0.0.tgz#89b852fb2fcbe936f6f4b3187afb0a12c1ab58ad"
|
||||||
|
integrity sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==
|
||||||
|
|
||||||
|
which-module@^2.0.0:
|
||||||
|
version "2.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/which-module/-/which-module-2.0.0.tgz#d9ef07dce77b9902b8a3a8fa4b31c3e3f7e6e87a"
|
||||||
|
integrity sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=
|
||||||
|
|
||||||
|
wrap-ansi@^6.2.0:
|
||||||
|
version "6.2.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-6.2.0.tgz#e9393ba07102e6c91a3b221478f0257cd2856e53"
|
||||||
|
integrity sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==
|
||||||
|
dependencies:
|
||||||
|
ansi-styles "^4.0.0"
|
||||||
|
string-width "^4.1.0"
|
||||||
|
strip-ansi "^6.0.0"
|
||||||
|
|
||||||
|
y18n@^4.0.0:
|
||||||
|
version "4.0.3"
|
||||||
|
resolved "https://registry.yarnpkg.com/y18n/-/y18n-4.0.3.tgz#b5f259c82cd6e336921efd7bfd8bf560de9eeedf"
|
||||||
|
integrity sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ==
|
||||||
|
|
||||||
|
yargs-parser@^18.1.2:
|
||||||
|
version "18.1.3"
|
||||||
|
resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-18.1.3.tgz#be68c4975c6b2abf469236b0c870362fab09a7b0"
|
||||||
|
integrity sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==
|
||||||
|
dependencies:
|
||||||
|
camelcase "^5.0.0"
|
||||||
|
decamelize "^1.2.0"
|
||||||
|
|
||||||
|
yargs@15.4.1:
|
||||||
|
version "15.4.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/yargs/-/yargs-15.4.1.tgz#0d87a16de01aee9d8bec2bfbf74f67851730f4f8"
|
||||||
|
integrity sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A==
|
||||||
|
dependencies:
|
||||||
|
cliui "^6.0.0"
|
||||||
|
decamelize "^1.2.0"
|
||||||
|
find-up "^4.1.0"
|
||||||
|
get-caller-file "^2.0.1"
|
||||||
|
require-directory "^2.1.1"
|
||||||
|
require-main-filename "^2.0.0"
|
||||||
|
set-blocking "^2.0.0"
|
||||||
|
string-width "^4.2.0"
|
||||||
|
which-module "^2.0.0"
|
||||||
|
y18n "^4.0.0"
|
||||||
|
yargs-parser "^18.1.2"
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"name": "c",
|
||||||
|
"license": "MIT",
|
||||||
|
"version": "0.1.0"
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"name": "d",
|
||||||
|
"license": "MIT",
|
||||||
|
"version": "0.1.0",
|
||||||
|
"devDependencies": {
|
||||||
|
"once": "1.4.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
6
packages/build-utils/test/fixtures/30-double-nested-workspaces/packages/backend/package.json
vendored
Normal file
6
packages/build-utils/test/fixtures/30-double-nested-workspaces/packages/backend/package.json
vendored
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"private": true,
|
||||||
|
"name": "30-double-nested-workspaces-packages-backend",
|
||||||
|
"license": "MIT",
|
||||||
|
"version": "1.0.0"
|
||||||
|
}
|
||||||
27
packages/build-utils/test/fixtures/30-double-nested-workspaces/packages/backend/pnpm-lock.yaml
generated
vendored
Normal file
27
packages/build-utils/test/fixtures/30-double-nested-workspaces/packages/backend/pnpm-lock.yaml
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
lockfileVersion: 5.3
|
||||||
|
|
||||||
|
importers:
|
||||||
|
|
||||||
|
.:
|
||||||
|
specifiers: {}
|
||||||
|
|
||||||
|
c:
|
||||||
|
specifiers: {}
|
||||||
|
|
||||||
|
d:
|
||||||
|
specifiers:
|
||||||
|
once: 1.4.0
|
||||||
|
devDependencies:
|
||||||
|
once: 1.4.0
|
||||||
|
|
||||||
|
packages:
|
||||||
|
|
||||||
|
/once/1.4.0:
|
||||||
|
resolution: {integrity: sha1-WDsap3WWHUsROsF9nFC6753Xa9E=}
|
||||||
|
dependencies:
|
||||||
|
wrappy: 1.0.2
|
||||||
|
dev: true
|
||||||
|
|
||||||
|
/wrappy/1.0.2:
|
||||||
|
resolution: {integrity: sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=}
|
||||||
|
dev: true
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
packages:
|
||||||
|
- 'c'
|
||||||
|
- 'd'
|
||||||
15
packages/build-utils/test/fixtures/30-double-nested-workspaces/packages/frontend/a/package.json
vendored
Normal file
15
packages/build-utils/test/fixtures/30-double-nested-workspaces/packages/frontend/a/package.json
vendored
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"name": "a",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "",
|
||||||
|
"main": "index.js",
|
||||||
|
"scripts": {
|
||||||
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
|
},
|
||||||
|
"keywords": [],
|
||||||
|
"author": "",
|
||||||
|
"license": "ISC",
|
||||||
|
"dependencies": {
|
||||||
|
"debug": "^4.3.2"
|
||||||
|
}
|
||||||
|
}
|
||||||
15
packages/build-utils/test/fixtures/30-double-nested-workspaces/packages/frontend/b/package.json
vendored
Normal file
15
packages/build-utils/test/fixtures/30-double-nested-workspaces/packages/frontend/b/package.json
vendored
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"name": "b",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "",
|
||||||
|
"main": "index.js",
|
||||||
|
"scripts": {
|
||||||
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
|
},
|
||||||
|
"keywords": [],
|
||||||
|
"author": "",
|
||||||
|
"license": "ISC",
|
||||||
|
"dependencies": {
|
||||||
|
"cowsay": "^1.5.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"name": "30-double-nested-workspaces-packages-frontend",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"private": true,
|
||||||
|
"workspaces": [
|
||||||
|
"a",
|
||||||
|
"b"
|
||||||
|
]
|
||||||
|
}
|
||||||
232
packages/build-utils/test/fixtures/30-double-nested-workspaces/packages/frontend/yarn.lock
vendored
Normal file
232
packages/build-utils/test/fixtures/30-double-nested-workspaces/packages/frontend/yarn.lock
vendored
Normal file
@@ -0,0 +1,232 @@
|
|||||||
|
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
||||||
|
# yarn lockfile v1
|
||||||
|
|
||||||
|
|
||||||
|
ansi-regex@^3.0.0:
|
||||||
|
version "3.0.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-3.0.1.tgz#123d6479e92ad45ad897d4054e3c7ca7db4944e1"
|
||||||
|
integrity sha512-+O9Jct8wf++lXxxFc4hc8LsjaSq0HFzzL7cVsw8pRDIPdjKD2mT4ytDZlLuSBZ4cLKZFXIrMGO7DbQCtMJJMKw==
|
||||||
|
|
||||||
|
ansi-regex@^5.0.1:
|
||||||
|
version "5.0.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304"
|
||||||
|
integrity sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==
|
||||||
|
|
||||||
|
ansi-styles@^4.0.0:
|
||||||
|
version "4.3.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.3.0.tgz#edd803628ae71c04c85ae7a0906edad34b648937"
|
||||||
|
integrity sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==
|
||||||
|
dependencies:
|
||||||
|
color-convert "^2.0.1"
|
||||||
|
|
||||||
|
camelcase@^5.0.0:
|
||||||
|
version "5.3.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320"
|
||||||
|
integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==
|
||||||
|
|
||||||
|
cliui@^6.0.0:
|
||||||
|
version "6.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/cliui/-/cliui-6.0.0.tgz#511d702c0c4e41ca156d7d0e96021f23e13225b1"
|
||||||
|
integrity sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ==
|
||||||
|
dependencies:
|
||||||
|
string-width "^4.2.0"
|
||||||
|
strip-ansi "^6.0.0"
|
||||||
|
wrap-ansi "^6.2.0"
|
||||||
|
|
||||||
|
color-convert@^2.0.1:
|
||||||
|
version "2.0.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-2.0.1.tgz#72d3a68d598c9bdb3af2ad1e84f21d896abd4de3"
|
||||||
|
integrity sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==
|
||||||
|
dependencies:
|
||||||
|
color-name "~1.1.4"
|
||||||
|
|
||||||
|
color-name@~1.1.4:
|
||||||
|
version "1.1.4"
|
||||||
|
resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2"
|
||||||
|
integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==
|
||||||
|
|
||||||
|
cowsay@^1.5.0:
|
||||||
|
version "1.5.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/cowsay/-/cowsay-1.5.0.tgz#4a2a453b8b59383c7d7a50e44d765c5de0bf615f"
|
||||||
|
integrity sha512-8Ipzr54Z8zROr/62C8f0PdhQcDusS05gKTS87xxdji8VbWefWly0k8BwGK7+VqamOrkv3eGsCkPtvlHzrhWsCA==
|
||||||
|
dependencies:
|
||||||
|
get-stdin "8.0.0"
|
||||||
|
string-width "~2.1.1"
|
||||||
|
strip-final-newline "2.0.0"
|
||||||
|
yargs "15.4.1"
|
||||||
|
|
||||||
|
debug@^4.3.2:
|
||||||
|
version "4.3.4"
|
||||||
|
resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865"
|
||||||
|
integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==
|
||||||
|
dependencies:
|
||||||
|
ms "2.1.2"
|
||||||
|
|
||||||
|
decamelize@^1.2.0:
|
||||||
|
version "1.2.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290"
|
||||||
|
integrity sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=
|
||||||
|
|
||||||
|
emoji-regex@^8.0.0:
|
||||||
|
version "8.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37"
|
||||||
|
integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==
|
||||||
|
|
||||||
|
find-up@^4.1.0:
|
||||||
|
version "4.1.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/find-up/-/find-up-4.1.0.tgz#97afe7d6cdc0bc5928584b7c8d7b16e8a9aa5d19"
|
||||||
|
integrity sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==
|
||||||
|
dependencies:
|
||||||
|
locate-path "^5.0.0"
|
||||||
|
path-exists "^4.0.0"
|
||||||
|
|
||||||
|
get-caller-file@^2.0.1:
|
||||||
|
version "2.0.5"
|
||||||
|
resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e"
|
||||||
|
integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==
|
||||||
|
|
||||||
|
get-stdin@8.0.0:
|
||||||
|
version "8.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-8.0.0.tgz#cbad6a73feb75f6eeb22ba9e01f89aa28aa97a53"
|
||||||
|
integrity sha512-sY22aA6xchAzprjyqmSEQv4UbAAzRN0L2dQB0NlN5acTTK9Don6nhoc3eAbUnpZiCANAMfd/+40kVdKfFygohg==
|
||||||
|
|
||||||
|
is-fullwidth-code-point@^2.0.0:
|
||||||
|
version "2.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f"
|
||||||
|
integrity sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=
|
||||||
|
|
||||||
|
is-fullwidth-code-point@^3.0.0:
|
||||||
|
version "3.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d"
|
||||||
|
integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==
|
||||||
|
|
||||||
|
locate-path@^5.0.0:
|
||||||
|
version "5.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-5.0.0.tgz#1afba396afd676a6d42504d0a67a3a7eb9f62aa0"
|
||||||
|
integrity sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==
|
||||||
|
dependencies:
|
||||||
|
p-locate "^4.1.0"
|
||||||
|
|
||||||
|
ms@2.1.2:
|
||||||
|
version "2.1.2"
|
||||||
|
resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009"
|
||||||
|
integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==
|
||||||
|
|
||||||
|
p-limit@^2.2.0:
|
||||||
|
version "2.3.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.3.0.tgz#3dd33c647a214fdfffd835933eb086da0dc21db1"
|
||||||
|
integrity sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==
|
||||||
|
dependencies:
|
||||||
|
p-try "^2.0.0"
|
||||||
|
|
||||||
|
p-locate@^4.1.0:
|
||||||
|
version "4.1.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-4.1.0.tgz#a3428bb7088b3a60292f66919278b7c297ad4f07"
|
||||||
|
integrity sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==
|
||||||
|
dependencies:
|
||||||
|
p-limit "^2.2.0"
|
||||||
|
|
||||||
|
p-try@^2.0.0:
|
||||||
|
version "2.2.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/p-try/-/p-try-2.2.0.tgz#cb2868540e313d61de58fafbe35ce9004d5540e6"
|
||||||
|
integrity sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==
|
||||||
|
|
||||||
|
path-exists@^4.0.0:
|
||||||
|
version "4.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-4.0.0.tgz#513bdbe2d3b95d7762e8c1137efa195c6c61b5b3"
|
||||||
|
integrity sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==
|
||||||
|
|
||||||
|
require-directory@^2.1.1:
|
||||||
|
version "2.1.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42"
|
||||||
|
integrity sha1-jGStX9MNqxyXbiNE/+f3kqam30I=
|
||||||
|
|
||||||
|
require-main-filename@^2.0.0:
|
||||||
|
version "2.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-2.0.0.tgz#d0b329ecc7cc0f61649f62215be69af54aa8989b"
|
||||||
|
integrity sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==
|
||||||
|
|
||||||
|
set-blocking@^2.0.0:
|
||||||
|
version "2.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7"
|
||||||
|
integrity sha1-BF+XgtARrppoA93TgrJDkrPYkPc=
|
||||||
|
|
||||||
|
string-width@^4.1.0, string-width@^4.2.0:
|
||||||
|
version "4.2.3"
|
||||||
|
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
|
||||||
|
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
|
||||||
|
dependencies:
|
||||||
|
emoji-regex "^8.0.0"
|
||||||
|
is-fullwidth-code-point "^3.0.0"
|
||||||
|
strip-ansi "^6.0.1"
|
||||||
|
|
||||||
|
string-width@~2.1.1:
|
||||||
|
version "2.1.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.1.1.tgz#ab93f27a8dc13d28cac815c462143a6d9012ae9e"
|
||||||
|
integrity sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==
|
||||||
|
dependencies:
|
||||||
|
is-fullwidth-code-point "^2.0.0"
|
||||||
|
strip-ansi "^4.0.0"
|
||||||
|
|
||||||
|
strip-ansi@^4.0.0:
|
||||||
|
version "4.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-4.0.0.tgz#a8479022eb1ac368a871389b635262c505ee368f"
|
||||||
|
integrity sha1-qEeQIusaw2iocTibY1JixQXuNo8=
|
||||||
|
dependencies:
|
||||||
|
ansi-regex "^3.0.0"
|
||||||
|
|
||||||
|
strip-ansi@^6.0.0, strip-ansi@^6.0.1:
|
||||||
|
version "6.0.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
|
||||||
|
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
|
||||||
|
dependencies:
|
||||||
|
ansi-regex "^5.0.1"
|
||||||
|
|
||||||
|
strip-final-newline@2.0.0:
|
||||||
|
version "2.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/strip-final-newline/-/strip-final-newline-2.0.0.tgz#89b852fb2fcbe936f6f4b3187afb0a12c1ab58ad"
|
||||||
|
integrity sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==
|
||||||
|
|
||||||
|
which-module@^2.0.0:
|
||||||
|
version "2.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/which-module/-/which-module-2.0.0.tgz#d9ef07dce77b9902b8a3a8fa4b31c3e3f7e6e87a"
|
||||||
|
integrity sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=
|
||||||
|
|
||||||
|
wrap-ansi@^6.2.0:
|
||||||
|
version "6.2.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-6.2.0.tgz#e9393ba07102e6c91a3b221478f0257cd2856e53"
|
||||||
|
integrity sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==
|
||||||
|
dependencies:
|
||||||
|
ansi-styles "^4.0.0"
|
||||||
|
string-width "^4.1.0"
|
||||||
|
strip-ansi "^6.0.0"
|
||||||
|
|
||||||
|
y18n@^4.0.0:
|
||||||
|
version "4.0.3"
|
||||||
|
resolved "https://registry.yarnpkg.com/y18n/-/y18n-4.0.3.tgz#b5f259c82cd6e336921efd7bfd8bf560de9eeedf"
|
||||||
|
integrity sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ==
|
||||||
|
|
||||||
|
yargs-parser@^18.1.2:
|
||||||
|
version "18.1.3"
|
||||||
|
resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-18.1.3.tgz#be68c4975c6b2abf469236b0c870362fab09a7b0"
|
||||||
|
integrity sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==
|
||||||
|
dependencies:
|
||||||
|
camelcase "^5.0.0"
|
||||||
|
decamelize "^1.2.0"
|
||||||
|
|
||||||
|
yargs@15.4.1:
|
||||||
|
version "15.4.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/yargs/-/yargs-15.4.1.tgz#0d87a16de01aee9d8bec2bfbf74f67851730f4f8"
|
||||||
|
integrity sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A==
|
||||||
|
dependencies:
|
||||||
|
cliui "^6.0.0"
|
||||||
|
decamelize "^1.2.0"
|
||||||
|
find-up "^4.1.0"
|
||||||
|
get-caller-file "^2.0.1"
|
||||||
|
require-directory "^2.1.1"
|
||||||
|
require-main-filename "^2.0.0"
|
||||||
|
set-blocking "^2.0.0"
|
||||||
|
string-width "^4.2.0"
|
||||||
|
which-module "^2.0.0"
|
||||||
|
y18n "^4.0.0"
|
||||||
|
yargs-parser "^18.1.2"
|
||||||
15
packages/build-utils/test/fixtures/31-turborepo-in-package-json/a/package.json
vendored
Normal file
15
packages/build-utils/test/fixtures/31-turborepo-in-package-json/a/package.json
vendored
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"name": "a",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "",
|
||||||
|
"main": "index.js",
|
||||||
|
"scripts": {
|
||||||
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
|
},
|
||||||
|
"keywords": [],
|
||||||
|
"author": "",
|
||||||
|
"license": "ISC",
|
||||||
|
"dependencies": {
|
||||||
|
"debug": "^4.3.2"
|
||||||
|
}
|
||||||
|
}
|
||||||
15
packages/build-utils/test/fixtures/31-turborepo-in-package-json/b/package.json
vendored
Normal file
15
packages/build-utils/test/fixtures/31-turborepo-in-package-json/b/package.json
vendored
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"name": "b",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "",
|
||||||
|
"main": "index.js",
|
||||||
|
"scripts": {
|
||||||
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
|
},
|
||||||
|
"keywords": [],
|
||||||
|
"author": "",
|
||||||
|
"license": "ISC",
|
||||||
|
"dependencies": {
|
||||||
|
"cowsay": "^1.5.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
34
packages/build-utils/test/fixtures/31-turborepo-in-package-json/package.json
vendored
Normal file
34
packages/build-utils/test/fixtures/31-turborepo-in-package-json/package.json
vendored
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
{
|
||||||
|
"name": "21-npm-workspaces",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"private": true,
|
||||||
|
"workspaces": [
|
||||||
|
"a",
|
||||||
|
"b"
|
||||||
|
],
|
||||||
|
"turbo": {
|
||||||
|
"baseBranch": "origin/main",
|
||||||
|
"pipeline": {
|
||||||
|
"build": {
|
||||||
|
"dependsOn": [
|
||||||
|
"^build"
|
||||||
|
],
|
||||||
|
"outputs": [
|
||||||
|
".next/**"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"test": {
|
||||||
|
"dependsOn": [
|
||||||
|
"^build"
|
||||||
|
],
|
||||||
|
"outputs": []
|
||||||
|
},
|
||||||
|
"lint": {
|
||||||
|
"outputs": []
|
||||||
|
},
|
||||||
|
"dev": {
|
||||||
|
"cache": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
232
packages/build-utils/test/fixtures/31-turborepo-in-package-json/yarn.lock
vendored
Normal file
232
packages/build-utils/test/fixtures/31-turborepo-in-package-json/yarn.lock
vendored
Normal file
@@ -0,0 +1,232 @@
|
|||||||
|
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
||||||
|
# yarn lockfile v1
|
||||||
|
|
||||||
|
|
||||||
|
ansi-regex@^3.0.0:
|
||||||
|
version "3.0.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-3.0.1.tgz#123d6479e92ad45ad897d4054e3c7ca7db4944e1"
|
||||||
|
integrity sha512-+O9Jct8wf++lXxxFc4hc8LsjaSq0HFzzL7cVsw8pRDIPdjKD2mT4ytDZlLuSBZ4cLKZFXIrMGO7DbQCtMJJMKw==
|
||||||
|
|
||||||
|
ansi-regex@^5.0.1:
|
||||||
|
version "5.0.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304"
|
||||||
|
integrity sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==
|
||||||
|
|
||||||
|
ansi-styles@^4.0.0:
|
||||||
|
version "4.3.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.3.0.tgz#edd803628ae71c04c85ae7a0906edad34b648937"
|
||||||
|
integrity sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==
|
||||||
|
dependencies:
|
||||||
|
color-convert "^2.0.1"
|
||||||
|
|
||||||
|
camelcase@^5.0.0:
|
||||||
|
version "5.3.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320"
|
||||||
|
integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==
|
||||||
|
|
||||||
|
cliui@^6.0.0:
|
||||||
|
version "6.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/cliui/-/cliui-6.0.0.tgz#511d702c0c4e41ca156d7d0e96021f23e13225b1"
|
||||||
|
integrity sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ==
|
||||||
|
dependencies:
|
||||||
|
string-width "^4.2.0"
|
||||||
|
strip-ansi "^6.0.0"
|
||||||
|
wrap-ansi "^6.2.0"
|
||||||
|
|
||||||
|
color-convert@^2.0.1:
|
||||||
|
version "2.0.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-2.0.1.tgz#72d3a68d598c9bdb3af2ad1e84f21d896abd4de3"
|
||||||
|
integrity sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==
|
||||||
|
dependencies:
|
||||||
|
color-name "~1.1.4"
|
||||||
|
|
||||||
|
color-name@~1.1.4:
|
||||||
|
version "1.1.4"
|
||||||
|
resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2"
|
||||||
|
integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==
|
||||||
|
|
||||||
|
cowsay@^1.5.0:
|
||||||
|
version "1.5.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/cowsay/-/cowsay-1.5.0.tgz#4a2a453b8b59383c7d7a50e44d765c5de0bf615f"
|
||||||
|
integrity sha512-8Ipzr54Z8zROr/62C8f0PdhQcDusS05gKTS87xxdji8VbWefWly0k8BwGK7+VqamOrkv3eGsCkPtvlHzrhWsCA==
|
||||||
|
dependencies:
|
||||||
|
get-stdin "8.0.0"
|
||||||
|
string-width "~2.1.1"
|
||||||
|
strip-final-newline "2.0.0"
|
||||||
|
yargs "15.4.1"
|
||||||
|
|
||||||
|
debug@^4.3.2:
|
||||||
|
version "4.3.4"
|
||||||
|
resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865"
|
||||||
|
integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==
|
||||||
|
dependencies:
|
||||||
|
ms "2.1.2"
|
||||||
|
|
||||||
|
decamelize@^1.2.0:
|
||||||
|
version "1.2.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290"
|
||||||
|
integrity sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=
|
||||||
|
|
||||||
|
emoji-regex@^8.0.0:
|
||||||
|
version "8.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37"
|
||||||
|
integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==
|
||||||
|
|
||||||
|
find-up@^4.1.0:
|
||||||
|
version "4.1.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/find-up/-/find-up-4.1.0.tgz#97afe7d6cdc0bc5928584b7c8d7b16e8a9aa5d19"
|
||||||
|
integrity sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==
|
||||||
|
dependencies:
|
||||||
|
locate-path "^5.0.0"
|
||||||
|
path-exists "^4.0.0"
|
||||||
|
|
||||||
|
get-caller-file@^2.0.1:
|
||||||
|
version "2.0.5"
|
||||||
|
resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e"
|
||||||
|
integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==
|
||||||
|
|
||||||
|
get-stdin@8.0.0:
|
||||||
|
version "8.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-8.0.0.tgz#cbad6a73feb75f6eeb22ba9e01f89aa28aa97a53"
|
||||||
|
integrity sha512-sY22aA6xchAzprjyqmSEQv4UbAAzRN0L2dQB0NlN5acTTK9Don6nhoc3eAbUnpZiCANAMfd/+40kVdKfFygohg==
|
||||||
|
|
||||||
|
is-fullwidth-code-point@^2.0.0:
|
||||||
|
version "2.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f"
|
||||||
|
integrity sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=
|
||||||
|
|
||||||
|
is-fullwidth-code-point@^3.0.0:
|
||||||
|
version "3.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d"
|
||||||
|
integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==
|
||||||
|
|
||||||
|
locate-path@^5.0.0:
|
||||||
|
version "5.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-5.0.0.tgz#1afba396afd676a6d42504d0a67a3a7eb9f62aa0"
|
||||||
|
integrity sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==
|
||||||
|
dependencies:
|
||||||
|
p-locate "^4.1.0"
|
||||||
|
|
||||||
|
ms@2.1.2:
|
||||||
|
version "2.1.2"
|
||||||
|
resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009"
|
||||||
|
integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==
|
||||||
|
|
||||||
|
p-limit@^2.2.0:
|
||||||
|
version "2.3.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.3.0.tgz#3dd33c647a214fdfffd835933eb086da0dc21db1"
|
||||||
|
integrity sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==
|
||||||
|
dependencies:
|
||||||
|
p-try "^2.0.0"
|
||||||
|
|
||||||
|
p-locate@^4.1.0:
|
||||||
|
version "4.1.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-4.1.0.tgz#a3428bb7088b3a60292f66919278b7c297ad4f07"
|
||||||
|
integrity sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==
|
||||||
|
dependencies:
|
||||||
|
p-limit "^2.2.0"
|
||||||
|
|
||||||
|
p-try@^2.0.0:
|
||||||
|
version "2.2.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/p-try/-/p-try-2.2.0.tgz#cb2868540e313d61de58fafbe35ce9004d5540e6"
|
||||||
|
integrity sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==
|
||||||
|
|
||||||
|
path-exists@^4.0.0:
|
||||||
|
version "4.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-4.0.0.tgz#513bdbe2d3b95d7762e8c1137efa195c6c61b5b3"
|
||||||
|
integrity sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==
|
||||||
|
|
||||||
|
require-directory@^2.1.1:
|
||||||
|
version "2.1.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42"
|
||||||
|
integrity sha1-jGStX9MNqxyXbiNE/+f3kqam30I=
|
||||||
|
|
||||||
|
require-main-filename@^2.0.0:
|
||||||
|
version "2.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-2.0.0.tgz#d0b329ecc7cc0f61649f62215be69af54aa8989b"
|
||||||
|
integrity sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==
|
||||||
|
|
||||||
|
set-blocking@^2.0.0:
|
||||||
|
version "2.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7"
|
||||||
|
integrity sha1-BF+XgtARrppoA93TgrJDkrPYkPc=
|
||||||
|
|
||||||
|
string-width@^4.1.0, string-width@^4.2.0:
|
||||||
|
version "4.2.3"
|
||||||
|
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
|
||||||
|
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
|
||||||
|
dependencies:
|
||||||
|
emoji-regex "^8.0.0"
|
||||||
|
is-fullwidth-code-point "^3.0.0"
|
||||||
|
strip-ansi "^6.0.1"
|
||||||
|
|
||||||
|
string-width@~2.1.1:
|
||||||
|
version "2.1.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.1.1.tgz#ab93f27a8dc13d28cac815c462143a6d9012ae9e"
|
||||||
|
integrity sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==
|
||||||
|
dependencies:
|
||||||
|
is-fullwidth-code-point "^2.0.0"
|
||||||
|
strip-ansi "^4.0.0"
|
||||||
|
|
||||||
|
strip-ansi@^4.0.0:
|
||||||
|
version "4.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-4.0.0.tgz#a8479022eb1ac368a871389b635262c505ee368f"
|
||||||
|
integrity sha1-qEeQIusaw2iocTibY1JixQXuNo8=
|
||||||
|
dependencies:
|
||||||
|
ansi-regex "^3.0.0"
|
||||||
|
|
||||||
|
strip-ansi@^6.0.0, strip-ansi@^6.0.1:
|
||||||
|
version "6.0.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
|
||||||
|
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
|
||||||
|
dependencies:
|
||||||
|
ansi-regex "^5.0.1"
|
||||||
|
|
||||||
|
strip-final-newline@2.0.0:
|
||||||
|
version "2.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/strip-final-newline/-/strip-final-newline-2.0.0.tgz#89b852fb2fcbe936f6f4b3187afb0a12c1ab58ad"
|
||||||
|
integrity sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==
|
||||||
|
|
||||||
|
which-module@^2.0.0:
|
||||||
|
version "2.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/which-module/-/which-module-2.0.0.tgz#d9ef07dce77b9902b8a3a8fa4b31c3e3f7e6e87a"
|
||||||
|
integrity sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=
|
||||||
|
|
||||||
|
wrap-ansi@^6.2.0:
|
||||||
|
version "6.2.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-6.2.0.tgz#e9393ba07102e6c91a3b221478f0257cd2856e53"
|
||||||
|
integrity sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==
|
||||||
|
dependencies:
|
||||||
|
ansi-styles "^4.0.0"
|
||||||
|
string-width "^4.1.0"
|
||||||
|
strip-ansi "^6.0.0"
|
||||||
|
|
||||||
|
y18n@^4.0.0:
|
||||||
|
version "4.0.3"
|
||||||
|
resolved "https://registry.yarnpkg.com/y18n/-/y18n-4.0.3.tgz#b5f259c82cd6e336921efd7bfd8bf560de9eeedf"
|
||||||
|
integrity sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ==
|
||||||
|
|
||||||
|
yargs-parser@^18.1.2:
|
||||||
|
version "18.1.3"
|
||||||
|
resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-18.1.3.tgz#be68c4975c6b2abf469236b0c870362fab09a7b0"
|
||||||
|
integrity sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==
|
||||||
|
dependencies:
|
||||||
|
camelcase "^5.0.0"
|
||||||
|
decamelize "^1.2.0"
|
||||||
|
|
||||||
|
yargs@15.4.1:
|
||||||
|
version "15.4.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/yargs/-/yargs-15.4.1.tgz#0d87a16de01aee9d8bec2bfbf74f67851730f4f8"
|
||||||
|
integrity sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A==
|
||||||
|
dependencies:
|
||||||
|
cliui "^6.0.0"
|
||||||
|
decamelize "^1.2.0"
|
||||||
|
find-up "^4.1.0"
|
||||||
|
get-caller-file "^2.0.1"
|
||||||
|
require-directory "^2.1.1"
|
||||||
|
require-main-filename "^2.0.0"
|
||||||
|
set-blocking "^2.0.0"
|
||||||
|
string-width "^4.2.0"
|
||||||
|
which-module "^2.0.0"
|
||||||
|
y18n "^4.0.0"
|
||||||
|
yargs-parser "^18.1.2"
|
||||||
@@ -33,6 +33,10 @@ const skipFixtures: string[] = [
|
|||||||
'21-npm-workspaces',
|
'21-npm-workspaces',
|
||||||
'23-pnpm-workspaces',
|
'23-pnpm-workspaces',
|
||||||
'27-yarn-workspaces',
|
'27-yarn-workspaces',
|
||||||
|
'28-turborepo-with-yarn-workspaces',
|
||||||
|
'29-nested-workspaces',
|
||||||
|
'30-double-nested-workspaces',
|
||||||
|
'31-turborepo-in-package-json',
|
||||||
];
|
];
|
||||||
|
|
||||||
// eslint-disable-next-line no-restricted-syntax
|
// eslint-disable-next-line no-restricted-syntax
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"private": true,
|
||||||
|
"engines": {
|
||||||
|
"node": "16.14.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"private": true,
|
||||||
|
"engines": {
|
||||||
|
"node": ">=16"
|
||||||
|
}
|
||||||
|
}
|
||||||
28
packages/build-utils/test/unit.detect-monorepo-managers.test.ts
vendored
Normal file
28
packages/build-utils/test/unit.detect-monorepo-managers.test.ts
vendored
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
import path from 'path';
|
||||||
|
import { detectFramework } from '../src/detect-framework';
|
||||||
|
import monorepoManagers from '../src/monorepos/monorepo-managers';
|
||||||
|
import { FixtureFilesystem } from './utils/fixture-filesystem';
|
||||||
|
|
||||||
|
describe('monorepo-managers', () => {
|
||||||
|
describe.each([
|
||||||
|
['28-turborepo-with-yarn-workspaces', 'turbo'],
|
||||||
|
['31-turborepo-in-package-json', 'turbo'],
|
||||||
|
['22-pnpm', null],
|
||||||
|
])('with detectFramework', (fixturePath, frameworkSlug) => {
|
||||||
|
const testName = frameworkSlug
|
||||||
|
? `should detect a ${frameworkSlug} workspace for ${fixturePath}`
|
||||||
|
: `should not detect a monorepo manager for ${fixturePath}`;
|
||||||
|
|
||||||
|
it(testName, async () => {
|
||||||
|
const fixture = path.join(__dirname, 'fixtures', fixturePath);
|
||||||
|
const fs = new FixtureFilesystem(fixture);
|
||||||
|
|
||||||
|
const result = await detectFramework({
|
||||||
|
fs,
|
||||||
|
frameworkList: monorepoManagers,
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(result).toBe(frameworkSlug);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -5,13 +5,13 @@ import { FixtureFilesystem } from './utils/fixture-filesystem';
|
|||||||
|
|
||||||
describe('workspace-managers', () => {
|
describe('workspace-managers', () => {
|
||||||
describe.each([
|
describe.each([
|
||||||
['npm', '21-npm-workspaces'],
|
['21-npm-workspaces', 'npm'],
|
||||||
['pnpm', '23-pnpm-workspaces'],
|
['23-pnpm-workspaces', 'pnpm'],
|
||||||
['yarn', '27-yarn-workspaces'],
|
['27-yarn-workspaces', 'yarn'],
|
||||||
['yarn', '25-multiple-lock-files-yarn'],
|
['25-multiple-lock-files-yarn', 'yarn'],
|
||||||
['pnpm', '26-multiple-lock-files-pnpm'],
|
['26-multiple-lock-files-pnpm', 'pnpm'],
|
||||||
[null, '22-pnpm'],
|
['22-pnpm', null],
|
||||||
])('with detectFramework', (frameworkSlug, fixturePath) => {
|
])('with detectFramework', (fixturePath, frameworkSlug) => {
|
||||||
const testName = frameworkSlug
|
const testName = frameworkSlug
|
||||||
? `should detect a ${frameworkSlug} workspace for ${fixturePath}`
|
? `should detect a ${frameworkSlug} workspace for ${fixturePath}`
|
||||||
: `should not detect framework for ${fixturePath}`;
|
: `should not detect framework for ${fixturePath}`;
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import assert from 'assert';
|
import assert from 'assert';
|
||||||
|
import { delimiter } from 'path';
|
||||||
import { getEnvForPackageManager } from '../src';
|
import { getEnvForPackageManager } from '../src';
|
||||||
|
|
||||||
describe('Test `getEnvForPackageManager()`', () => {
|
describe('Test `getEnvForPackageManager()`', () => {
|
||||||
@@ -34,7 +35,7 @@ describe('Test `getEnvForPackageManager()`', () => {
|
|||||||
},
|
},
|
||||||
want: {
|
want: {
|
||||||
FOO: 'bar',
|
FOO: 'bar',
|
||||||
PATH: `/node16/bin-npm7:foo`,
|
PATH: `/node16/bin-npm7${delimiter}foo`,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -97,7 +98,7 @@ describe('Test `getEnvForPackageManager()`', () => {
|
|||||||
},
|
},
|
||||||
want: {
|
want: {
|
||||||
FOO: 'bar',
|
FOO: 'bar',
|
||||||
PATH: '/pnpm7/node_modules/.bin:foo',
|
PATH: `/pnpm7/node_modules/.bin${delimiter}foo`,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
43
packages/build-utils/test/unit.get-workspaces.test.ts
vendored
Normal file
43
packages/build-utils/test/unit.get-workspaces.test.ts
vendored
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
import path from 'path';
|
||||||
|
import { getWorkspaces, Workspace } from '../src/workspaces/get-workspaces';
|
||||||
|
import { FixtureFilesystem } from './utils/fixture-filesystem';
|
||||||
|
|
||||||
|
describe.each<[string, Workspace[]]>([
|
||||||
|
['21-npm-workspaces', [{ type: 'npm', rootPath: '/' }]],
|
||||||
|
['23-pnpm-workspaces', [{ type: 'pnpm', rootPath: '/' }]],
|
||||||
|
['27-yarn-workspaces', [{ type: 'yarn', rootPath: '/' }]],
|
||||||
|
['25-multiple-lock-files-yarn', [{ type: 'yarn', rootPath: '/' }]],
|
||||||
|
['26-multiple-lock-files-pnpm', [{ type: 'pnpm', rootPath: '/' }]],
|
||||||
|
[
|
||||||
|
'29-nested-workspaces',
|
||||||
|
[
|
||||||
|
{ type: 'pnpm', rootPath: '/backend' },
|
||||||
|
{ type: 'yarn', rootPath: '/frontend' },
|
||||||
|
],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'30-double-nested-workspaces',
|
||||||
|
[
|
||||||
|
{ type: 'pnpm', rootPath: '/packages/backend' },
|
||||||
|
{ type: 'yarn', rootPath: '/packages/frontend' },
|
||||||
|
],
|
||||||
|
],
|
||||||
|
['22-pnpm', []],
|
||||||
|
])('`getWorkspaces()`', (fixturePath, workspaces) => {
|
||||||
|
const expectedImplementations = workspaces.map(({ type }) => type);
|
||||||
|
const testName =
|
||||||
|
workspaces.length > 0
|
||||||
|
? `should detect ${expectedImplementations.join()} workspace${
|
||||||
|
expectedImplementations.length > 1 ? 's' : ''
|
||||||
|
} for ${fixturePath}`
|
||||||
|
: `should not detect any workspace for ${fixturePath}`;
|
||||||
|
|
||||||
|
it(testName, async () => {
|
||||||
|
const fixture = path.join(__dirname, 'fixtures', fixturePath);
|
||||||
|
const fs = new FixtureFilesystem(fixture);
|
||||||
|
|
||||||
|
const actualWorkspaces = await getWorkspaces({ fs });
|
||||||
|
|
||||||
|
expect(actualWorkspaces).toEqual(expect.arrayContaining(workspaces));
|
||||||
|
});
|
||||||
|
});
|
||||||
69
packages/build-utils/test/unit.test.ts
vendored
69
packages/build-utils/test/unit.test.ts
vendored
@@ -277,7 +277,45 @@ it('should prefer package.json engines over project setting from config and warn
|
|||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should warn when package.json engines is exact version', async () => {
|
||||||
|
expect(
|
||||||
|
await getNodeVersion(
|
||||||
|
path.join(__dirname, 'pkg-engine-node-exact'),
|
||||||
|
undefined,
|
||||||
|
{},
|
||||||
|
{}
|
||||||
|
)
|
||||||
|
).toHaveProperty('range', '16.x');
|
||||||
|
expect(warningMessages).toStrictEqual([
|
||||||
|
'Warning: Detected "engines": { "node": "16.14.0" } in your `package.json` with major.minor.patch, but only major Node.js Version can be selected. Learn More: http://vercel.link/node-version',
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should warn when package.json engines is greater than', async () => {
|
||||||
|
expect(
|
||||||
|
await getNodeVersion(
|
||||||
|
path.join(__dirname, 'pkg-engine-node-greaterthan'),
|
||||||
|
undefined,
|
||||||
|
{},
|
||||||
|
{}
|
||||||
|
)
|
||||||
|
).toHaveProperty('range', '16.x');
|
||||||
|
expect(warningMessages).toStrictEqual([
|
||||||
|
'Warning: Detected "engines": { "node": ">=16" } in your `package.json` that will automatically upgrade when a new major Node.js Version is released. Learn More: http://vercel.link/node-version',
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
|
||||||
it('should not warn when package.json engines matches project setting from config', async () => {
|
it('should not warn when package.json engines matches project setting from config', async () => {
|
||||||
|
expect(
|
||||||
|
await getNodeVersion(
|
||||||
|
path.join(__dirname, 'pkg-engine-node'),
|
||||||
|
undefined,
|
||||||
|
{ nodeVersion: '14' },
|
||||||
|
{}
|
||||||
|
)
|
||||||
|
).toHaveProperty('range', '14.x');
|
||||||
|
expect(warningMessages).toStrictEqual([]);
|
||||||
|
|
||||||
expect(
|
expect(
|
||||||
await getNodeVersion(
|
await getNodeVersion(
|
||||||
path.join(__dirname, 'pkg-engine-node'),
|
path.join(__dirname, 'pkg-engine-node'),
|
||||||
@@ -287,6 +325,16 @@ it('should not warn when package.json engines matches project setting from confi
|
|||||||
)
|
)
|
||||||
).toHaveProperty('range', '14.x');
|
).toHaveProperty('range', '14.x');
|
||||||
expect(warningMessages).toStrictEqual([]);
|
expect(warningMessages).toStrictEqual([]);
|
||||||
|
|
||||||
|
expect(
|
||||||
|
await getNodeVersion(
|
||||||
|
path.join(__dirname, 'pkg-engine-node'),
|
||||||
|
undefined,
|
||||||
|
{ nodeVersion: '<15' },
|
||||||
|
{}
|
||||||
|
)
|
||||||
|
).toHaveProperty('range', '14.x');
|
||||||
|
expect(warningMessages).toStrictEqual([]);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should get latest node version', async () => {
|
it('should get latest node version', async () => {
|
||||||
@@ -296,17 +344,20 @@ it('should get latest node version', async () => {
|
|||||||
it('should throw for discontinued versions', async () => {
|
it('should throw for discontinued versions', async () => {
|
||||||
// Mock a future date so that Node 8 and 10 become discontinued
|
// Mock a future date so that Node 8 and 10 become discontinued
|
||||||
const realDateNow = Date.now.bind(global.Date);
|
const realDateNow = Date.now.bind(global.Date);
|
||||||
global.Date.now = () => new Date('2021-05-01').getTime();
|
global.Date.now = () => new Date('2022-09-01').getTime();
|
||||||
|
|
||||||
expect(getSupportedNodeVersion('8.10.x', false)).rejects.toThrow();
|
expect(getSupportedNodeVersion('8.10.x', false)).rejects.toThrow();
|
||||||
expect(getSupportedNodeVersion('8.10.x', true)).rejects.toThrow();
|
expect(getSupportedNodeVersion('8.10.x', true)).rejects.toThrow();
|
||||||
expect(getSupportedNodeVersion('10.x', false)).rejects.toThrow();
|
expect(getSupportedNodeVersion('10.x', false)).rejects.toThrow();
|
||||||
expect(getSupportedNodeVersion('10.x', true)).rejects.toThrow();
|
expect(getSupportedNodeVersion('10.x', true)).rejects.toThrow();
|
||||||
|
expect(getSupportedNodeVersion('12.x', false)).rejects.toThrow();
|
||||||
|
expect(getSupportedNodeVersion('12.x', true)).rejects.toThrow();
|
||||||
|
|
||||||
const discontinued = getDiscontinuedNodeVersions();
|
const discontinued = getDiscontinuedNodeVersions();
|
||||||
expect(discontinued.length).toBe(2);
|
expect(discontinued.length).toBe(3);
|
||||||
expect(discontinued[0]).toHaveProperty('range', '10.x');
|
expect(discontinued[0]).toHaveProperty('range', '12.x');
|
||||||
expect(discontinued[1]).toHaveProperty('range', '8.10.x');
|
expect(discontinued[1]).toHaveProperty('range', '10.x');
|
||||||
|
expect(discontinued[2]).toHaveProperty('range', '8.10.x');
|
||||||
|
|
||||||
global.Date.now = realDateNow;
|
global.Date.now = realDateNow;
|
||||||
});
|
});
|
||||||
@@ -324,9 +375,19 @@ it('should warn for deprecated versions, soon to be discontinued', async () => {
|
|||||||
'major',
|
'major',
|
||||||
10
|
10
|
||||||
);
|
);
|
||||||
|
expect(await getSupportedNodeVersion('12.x', false)).toHaveProperty(
|
||||||
|
'major',
|
||||||
|
12
|
||||||
|
);
|
||||||
|
expect(await getSupportedNodeVersion('12.x', true)).toHaveProperty(
|
||||||
|
'major',
|
||||||
|
12
|
||||||
|
);
|
||||||
expect(warningMessages).toStrictEqual([
|
expect(warningMessages).toStrictEqual([
|
||||||
'Error: Node.js version 10.x is deprecated. Deployments created on or after 2021-04-20 will fail to build. Please set "engines": { "node": "16.x" } in your `package.json` file to use Node.js 16. This change is the result of a decision made by an upstream infrastructure provider (AWS).',
|
'Error: Node.js version 10.x is deprecated. Deployments created on or after 2021-04-20 will fail to build. Please set "engines": { "node": "16.x" } in your `package.json` file to use Node.js 16. This change is the result of a decision made by an upstream infrastructure provider (AWS).',
|
||||||
'Error: Node.js version 10.x is deprecated. Deployments created on or after 2021-04-20 will fail to build. Please set Node.js Version to 16.x in your Project Settings to use Node.js 16. This change is the result of a decision made by an upstream infrastructure provider (AWS).',
|
'Error: Node.js version 10.x is deprecated. Deployments created on or after 2021-04-20 will fail to build. Please set Node.js Version to 16.x in your Project Settings to use Node.js 16. This change is the result of a decision made by an upstream infrastructure provider (AWS).',
|
||||||
|
'Error: Node.js version 12.x is deprecated. Deployments created on or after 2022-08-09 will fail to build. Please set "engines": { "node": "16.x" } in your `package.json` file to use Node.js 16. This change is the result of a decision made by an upstream infrastructure provider (AWS).',
|
||||||
|
'Error: Node.js version 12.x is deprecated. Deployments created on or after 2022-08-09 will fail to build. Please set Node.js Version to 16.x in your Project Settings to use Node.js 16. This change is the result of a decision made by an upstream infrastructure provider (AWS).',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
global.Date.now = realDateNow;
|
global.Date.now = realDateNow;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"declaration": true,
|
"declaration": true,
|
||||||
"esModuleInterop": true,
|
"esModuleInterop": true,
|
||||||
"lib": ["esnext"],
|
"lib": ["ES2020"],
|
||||||
"module": "commonjs",
|
"module": "commonjs",
|
||||||
"moduleResolution": "node",
|
"moduleResolution": "node",
|
||||||
"noEmitOnError": true,
|
"noEmitOnError": true,
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
"outDir": "./dist",
|
"outDir": "./dist",
|
||||||
"types": ["node", "jest"],
|
"types": ["node", "jest"],
|
||||||
"strict": true,
|
"strict": true,
|
||||||
"target": "es2019"
|
"target": "ES2020"
|
||||||
},
|
},
|
||||||
"include": ["src/**/*"],
|
"include": ["src/**/*"],
|
||||||
"exclude": ["node_modules"]
|
"exclude": ["node_modules"]
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "vercel",
|
"name": "vercel",
|
||||||
"version": "24.2.3",
|
"version": "25.0.0",
|
||||||
"preferGlobal": true,
|
"preferGlobal": true,
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"description": "The command-line interface for Vercel",
|
"description": "The command-line interface for Vercel",
|
||||||
@@ -12,10 +12,10 @@
|
|||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"preinstall": "node ./scripts/preinstall.js",
|
"preinstall": "node ./scripts/preinstall.js",
|
||||||
"test": "jest",
|
"test": "jest --env node --verbose --runInBand --bail --forceExit",
|
||||||
"test-unit": "jest --coverage --verbose",
|
"test-unit": "yarn test test/unit/",
|
||||||
"test-integration-cli": "rimraf test/fixtures/integration && ava test/integration.js --serial --fail-fast --verbose",
|
"test-integration-cli": "rimraf test/fixtures/integration && ava test/integration.js --serial --fail-fast --verbose",
|
||||||
"test-integration-dev": "ava test/dev/integration.js --serial --fail-fast --verbose",
|
"test-integration-dev": "yarn test test/dev/",
|
||||||
"prepublishOnly": "yarn build",
|
"prepublishOnly": "yarn build",
|
||||||
"coverage": "codecov",
|
"coverage": "codecov",
|
||||||
"build": "node -r ts-eager/register ./scripts/build.ts",
|
"build": "node -r ts-eager/register ./scripts/build.ts",
|
||||||
@@ -30,7 +30,6 @@
|
|||||||
"scripts/preinstall.js"
|
"scripts/preinstall.js"
|
||||||
],
|
],
|
||||||
"ava": {
|
"ava": {
|
||||||
"compileEnhancements": false,
|
|
||||||
"extensions": [
|
"extensions": [
|
||||||
"ts"
|
"ts"
|
||||||
],
|
],
|
||||||
@@ -40,15 +39,19 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">= 12"
|
"node": ">= 14"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@vercel/build-utils": "3.0.1",
|
"@vercel/build-utils": "4.0.0",
|
||||||
"@vercel/go": "1.4.2",
|
"@vercel/go": "2.0.0",
|
||||||
"@vercel/node": "1.15.2",
|
"@vercel/next": "3.0.0",
|
||||||
"@vercel/python": "2.3.2",
|
"@vercel/node": "2.0.0",
|
||||||
"@vercel/ruby": "1.3.5",
|
"@vercel/python": "3.0.0",
|
||||||
"update-notifier": "4.1.0"
|
"@vercel/redwood": "1.0.0",
|
||||||
|
"@vercel/remix": "1.0.0",
|
||||||
|
"@vercel/ruby": "1.3.8",
|
||||||
|
"@vercel/static-build": "1.0.0",
|
||||||
|
"update-notifier": "5.1.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@alex_neo/jest-expect-message": "1.0.5",
|
"@alex_neo/jest-expect-message": "1.0.5",
|
||||||
@@ -90,8 +93,9 @@
|
|||||||
"@types/update-notifier": "5.1.0",
|
"@types/update-notifier": "5.1.0",
|
||||||
"@types/which": "1.3.2",
|
"@types/which": "1.3.2",
|
||||||
"@types/write-json-file": "2.2.1",
|
"@types/write-json-file": "2.2.1",
|
||||||
"@vercel/client": "11.0.2",
|
"@types/yauzl-promise": "2.1.0",
|
||||||
"@vercel/frameworks": "0.9.0",
|
"@vercel/client": "12.0.0",
|
||||||
|
"@vercel/frameworks": "1.0.1",
|
||||||
"@vercel/ncc": "0.24.0",
|
"@vercel/ncc": "0.24.0",
|
||||||
"@zeit/fun": "0.11.2",
|
"@zeit/fun": "0.11.2",
|
||||||
"@zeit/source-map-support": "0.6.2",
|
"@zeit/source-map-support": "0.6.2",
|
||||||
@@ -167,7 +171,8 @@
|
|||||||
"utility-types": "2.1.0",
|
"utility-types": "2.1.0",
|
||||||
"which": "2.0.2",
|
"which": "2.0.2",
|
||||||
"write-json-file": "2.2.0",
|
"write-json-file": "2.2.0",
|
||||||
"xdg-app-paths": "5.1.0"
|
"xdg-app-paths": "5.1.0",
|
||||||
|
"yauzl-promise": "2.1.3"
|
||||||
},
|
},
|
||||||
"jest": {
|
"jest": {
|
||||||
"preset": "ts-jest",
|
"preset": "ts-jest",
|
||||||
|
|||||||
518
packages/cli/src/commands/build.ts
Normal file
518
packages/cli/src/commands/build.ts
Normal file
@@ -0,0 +1,518 @@
|
|||||||
|
import fs from 'fs-extra';
|
||||||
|
import chalk from 'chalk';
|
||||||
|
import dotenv from 'dotenv';
|
||||||
|
import { join, relative } from 'path';
|
||||||
|
import {
|
||||||
|
detectBuilders,
|
||||||
|
Files,
|
||||||
|
FileFsRef,
|
||||||
|
PackageJson,
|
||||||
|
BuildOptions,
|
||||||
|
Config,
|
||||||
|
Meta,
|
||||||
|
Builder,
|
||||||
|
BuildResultV2,
|
||||||
|
BuildResultV2Typical,
|
||||||
|
BuildResultV3,
|
||||||
|
} from '@vercel/build-utils';
|
||||||
|
import minimatch from 'minimatch';
|
||||||
|
import {
|
||||||
|
appendRoutesToPhase,
|
||||||
|
getTransformedRoutes,
|
||||||
|
mergeRoutes,
|
||||||
|
MergeRoutesProps,
|
||||||
|
Route,
|
||||||
|
} from '@vercel/routing-utils';
|
||||||
|
import { VercelConfig } from '@vercel/client';
|
||||||
|
|
||||||
|
import pull from './pull';
|
||||||
|
import { staticFiles as getFiles } from '../util/get-files';
|
||||||
|
import Client from '../util/client';
|
||||||
|
import getArgs from '../util/get-args';
|
||||||
|
import cmd from '../util/output/cmd';
|
||||||
|
import * as cli from '../util/pkg-name';
|
||||||
|
import cliPkg from '../util/pkg';
|
||||||
|
import readJSONFile from '../util/read-json-file';
|
||||||
|
import { CantParseJSONFile } from '../util/errors-ts';
|
||||||
|
import { readProjectSettings } from '../util/projects/project-settings';
|
||||||
|
import { VERCEL_DIR } from '../util/projects/link';
|
||||||
|
import confirm from '../util/input/confirm';
|
||||||
|
import { emoji, prependEmoji } from '../util/emoji';
|
||||||
|
import stamp from '../util/output/stamp';
|
||||||
|
import {
|
||||||
|
OUTPUT_DIR,
|
||||||
|
PathOverride,
|
||||||
|
writeBuildResult,
|
||||||
|
} from '../util/build/write-build-result';
|
||||||
|
import { importBuilders, BuilderWithPkg } from '../util/build/import-builders';
|
||||||
|
import { initCorepack, cleanupCorepack } from '../util/build/corepack';
|
||||||
|
|
||||||
|
type BuildResult = BuildResultV2 | BuildResultV3;
|
||||||
|
|
||||||
|
const help = () => {
|
||||||
|
return console.log(`
|
||||||
|
${chalk.bold(`${cli.logo} ${cli.name} build`)}
|
||||||
|
|
||||||
|
${chalk.dim('Options:')}
|
||||||
|
|
||||||
|
-h, --help Output usage information
|
||||||
|
-A ${chalk.bold.underline('FILE')}, --local-config=${chalk.bold.underline(
|
||||||
|
'FILE'
|
||||||
|
)} Path to the local ${'`vercel.json`'} file
|
||||||
|
-Q ${chalk.bold.underline('DIR')}, --global-config=${chalk.bold.underline(
|
||||||
|
'DIR'
|
||||||
|
)} Path to the global ${'`.vercel`'} directory
|
||||||
|
--cwd [path] The current working directory
|
||||||
|
--prod Build a production deployment
|
||||||
|
-d, --debug Debug mode [off]
|
||||||
|
-y, --yes Skip the confirmation prompt
|
||||||
|
|
||||||
|
${chalk.dim('Examples:')}
|
||||||
|
|
||||||
|
${chalk.gray('–')} Build the project
|
||||||
|
|
||||||
|
${chalk.cyan(`$ ${cli.name} build`)}
|
||||||
|
${chalk.cyan(`$ ${cli.name} build --cwd ./path-to-project`)}
|
||||||
|
`);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default async function main(client: Client): Promise<number> {
|
||||||
|
const { output } = client;
|
||||||
|
|
||||||
|
// Ensure that `vc build` is not being invoked recursively
|
||||||
|
if (process.env.__VERCEL_BUILD_RUNNING) {
|
||||||
|
output.error(
|
||||||
|
`${cmd(
|
||||||
|
`${cli.name} build`
|
||||||
|
)} must not recursively invoke itself. Check the Build Command in the Project Settings or the ${cmd(
|
||||||
|
'build'
|
||||||
|
)} script in ${cmd('package.json')}`
|
||||||
|
);
|
||||||
|
output.error(
|
||||||
|
`Learn More: https://vercel.link/recursive-invocation-of-commands`
|
||||||
|
);
|
||||||
|
return 1;
|
||||||
|
} else {
|
||||||
|
process.env.__VERCEL_BUILD_RUNNING = '1';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parse CLI args
|
||||||
|
const argv = getArgs(client.argv.slice(2), {
|
||||||
|
'--cwd': String,
|
||||||
|
'--prod': Boolean,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (argv['--help']) {
|
||||||
|
help();
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set the working directory if necessary
|
||||||
|
if (argv['--cwd']) {
|
||||||
|
process.chdir(argv['--cwd']);
|
||||||
|
}
|
||||||
|
const cwd = process.cwd();
|
||||||
|
|
||||||
|
// TODO: read project settings from the API, fall back to local `project.json` if that fails
|
||||||
|
|
||||||
|
// Read project settings, and pull them from Vercel if necessary
|
||||||
|
let project = await readProjectSettings(join(cwd, VERCEL_DIR));
|
||||||
|
const isTTY = process.stdin.isTTY;
|
||||||
|
while (!project?.settings) {
|
||||||
|
if (!isTTY) {
|
||||||
|
client.output.print(
|
||||||
|
`No Project Settings found locally. Run ${cli.getCommandName(
|
||||||
|
'pull --yes'
|
||||||
|
)} to retreive them.`
|
||||||
|
);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
const confirmed = await confirm(
|
||||||
|
`No Project Settings found locally. Run ${cli.getCommandName(
|
||||||
|
'pull'
|
||||||
|
)} for retrieving them?`,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
if (!confirmed) {
|
||||||
|
client.output.print(`Aborted. No Project Settings retrieved.\n`);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
client.argv = [];
|
||||||
|
const result = await pull(client);
|
||||||
|
if (result !== 0) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
project = await readProjectSettings(join(cwd, VERCEL_DIR));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Build `target` influences which environment variables will be used
|
||||||
|
const target = argv['--prod'] ? 'production' : 'preview';
|
||||||
|
|
||||||
|
// TODO: load env vars from the API, fall back to local files if that fails
|
||||||
|
|
||||||
|
const envPath = await checkExists([
|
||||||
|
join(cwd, VERCEL_DIR, `.env.${target}.local`),
|
||||||
|
join(cwd, `.env`),
|
||||||
|
]);
|
||||||
|
if (envPath) {
|
||||||
|
dotenv.config({ path: envPath, debug: client.output.isDebugEnabled() });
|
||||||
|
output.log(`Loaded env from "${relative(cwd, envPath)}"`);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Some build processes use these env vars to platform detect Vercel
|
||||||
|
process.env.VERCEL = '1';
|
||||||
|
process.env.NOW_BUILDER = '1';
|
||||||
|
|
||||||
|
const workPath = join(cwd, project.settings.rootDirectory || '.');
|
||||||
|
|
||||||
|
// Load `package.json` and `vercel.json` files
|
||||||
|
const [pkg, vercelConfig] = await Promise.all([
|
||||||
|
readJSONFile<PackageJson>(join(workPath, 'package.json')),
|
||||||
|
readJSONFile<VercelConfig>(join(workPath, 'vercel.json')).then(
|
||||||
|
config => config || readJSONFile<VercelConfig>(join(workPath, 'now.json'))
|
||||||
|
),
|
||||||
|
]);
|
||||||
|
if (pkg instanceof CantParseJSONFile) throw pkg;
|
||||||
|
if (vercelConfig instanceof CantParseJSONFile) throw vercelConfig;
|
||||||
|
|
||||||
|
// Get a list of source files
|
||||||
|
const files = (await getFiles(workPath, client)).map(f =>
|
||||||
|
relative(workPath, f)
|
||||||
|
);
|
||||||
|
|
||||||
|
const routesResult = getTransformedRoutes({ nowConfig: vercelConfig || {} });
|
||||||
|
if (routesResult.error) {
|
||||||
|
output.prettyError(routesResult.error);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (vercelConfig?.builds && vercelConfig.functions) {
|
||||||
|
output.prettyError({
|
||||||
|
message:
|
||||||
|
'The `functions` property cannot be used in conjunction with the `builds` property. Please remove one of them.',
|
||||||
|
link: 'https://vercel.link/functions-and-builds',
|
||||||
|
});
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
let builds = vercelConfig?.builds || [];
|
||||||
|
let zeroConfigRoutes: Route[] = [];
|
||||||
|
|
||||||
|
if (builds.length > 0) {
|
||||||
|
output.warn(
|
||||||
|
'Due to `builds` existing in your configuration file, the Build and Development Settings defined in your Project Settings will not apply. Learn More: https://vercel.link/unused-build-settings'
|
||||||
|
);
|
||||||
|
builds = builds.map(b => expandBuild(files, b)).flat();
|
||||||
|
} else {
|
||||||
|
// Zero config
|
||||||
|
|
||||||
|
// Detect the Vercel Builders that will need to be invoked
|
||||||
|
const detectedBuilders = await detectBuilders(files, pkg, {
|
||||||
|
...vercelConfig,
|
||||||
|
projectSettings: project.settings,
|
||||||
|
featHandleMiss: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (detectedBuilders.errors && detectedBuilders.errors.length > 0) {
|
||||||
|
output.prettyError(detectedBuilders.errors[0]);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const w of detectedBuilders.warnings) {
|
||||||
|
console.log(
|
||||||
|
`Warning: ${w.message} ${w.action || 'Learn More'}: ${w.link}`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (detectedBuilders.builders) {
|
||||||
|
builds = detectedBuilders.builders;
|
||||||
|
} else {
|
||||||
|
builds = [{ src: '**', use: '@vercel/static' }];
|
||||||
|
}
|
||||||
|
|
||||||
|
zeroConfigRoutes.push(...(detectedBuilders.redirectRoutes || []));
|
||||||
|
zeroConfigRoutes.push(
|
||||||
|
...appendRoutesToPhase({
|
||||||
|
routes: [],
|
||||||
|
newRoutes: detectedBuilders.rewriteRoutes,
|
||||||
|
phase: 'filesystem',
|
||||||
|
})
|
||||||
|
);
|
||||||
|
zeroConfigRoutes = appendRoutesToPhase({
|
||||||
|
routes: zeroConfigRoutes,
|
||||||
|
newRoutes: detectedBuilders.errorRoutes,
|
||||||
|
phase: 'error',
|
||||||
|
});
|
||||||
|
zeroConfigRoutes.push(...(detectedBuilders.defaultRoutes || []));
|
||||||
|
}
|
||||||
|
|
||||||
|
const builderSpecs = new Set(builds.map(b => b.use));
|
||||||
|
|
||||||
|
let buildersWithPkgs: Map<string, BuilderWithPkg>;
|
||||||
|
try {
|
||||||
|
buildersWithPkgs = await importBuilders(builderSpecs, cwd, output);
|
||||||
|
} catch (err: any) {
|
||||||
|
output.prettyError(err);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Populate Files -> FileFsRef mapping
|
||||||
|
const filesMap: Files = {};
|
||||||
|
for (const path of files) {
|
||||||
|
const fsPath = join(workPath, path);
|
||||||
|
const { mode } = await fs.stat(fsPath);
|
||||||
|
filesMap[path] = new FileFsRef({ mode, fsPath });
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delete output directory from potential previous build
|
||||||
|
await fs.remove(OUTPUT_DIR);
|
||||||
|
|
||||||
|
const buildStamp = stamp();
|
||||||
|
|
||||||
|
// Create fresh new output directory
|
||||||
|
await fs.mkdirp(OUTPUT_DIR);
|
||||||
|
|
||||||
|
const ops: Promise<Error | void>[] = [];
|
||||||
|
|
||||||
|
// Write the `detectedBuilders` result to output dir
|
||||||
|
ops.push(
|
||||||
|
fs.writeJSON(
|
||||||
|
join(OUTPUT_DIR, 'builds.json'),
|
||||||
|
{
|
||||||
|
'//': 'This file was generated by the `vercel build` command. It is not part of the Build Output API.',
|
||||||
|
target,
|
||||||
|
builds: builds.map(build => {
|
||||||
|
const builderWithPkg = buildersWithPkgs.get(build.use);
|
||||||
|
if (!builderWithPkg) {
|
||||||
|
throw new Error(`Failed to load Builder "${build.use}"`);
|
||||||
|
}
|
||||||
|
const { builder, pkg: builderPkg } = builderWithPkg;
|
||||||
|
return {
|
||||||
|
require: builderPkg.name,
|
||||||
|
apiVersion: builder.version,
|
||||||
|
...build,
|
||||||
|
};
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
spaces: 2,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
// The `meta` config property is re-used for each Builder
|
||||||
|
// invocation so that Builders can share state between
|
||||||
|
// subsequent entrypoint builds.
|
||||||
|
const meta: Meta = {
|
||||||
|
skipDownload: true,
|
||||||
|
cliVersion: cliPkg.version,
|
||||||
|
};
|
||||||
|
|
||||||
|
// Execute Builders for detected entrypoints
|
||||||
|
// TODO: parallelize builds
|
||||||
|
const buildResults: Map<Builder, BuildResult> = new Map();
|
||||||
|
const overrides: PathOverride[] = [];
|
||||||
|
const repoRootPath = cwd;
|
||||||
|
const rootPackageJsonPath = repoRootPath || workPath;
|
||||||
|
const corepackShimDir = await initCorepack({ cwd, rootPackageJsonPath });
|
||||||
|
|
||||||
|
for (const build of builds) {
|
||||||
|
if (typeof build.src !== 'string') continue;
|
||||||
|
|
||||||
|
const builderWithPkg = buildersWithPkgs.get(build.use);
|
||||||
|
if (!builderWithPkg) {
|
||||||
|
throw new Error(`Failed to load Builder "${build.use}"`);
|
||||||
|
}
|
||||||
|
const { builder, pkg: builderPkg } = builderWithPkg;
|
||||||
|
|
||||||
|
const buildConfig: Config = {
|
||||||
|
outputDirectory: project.settings.outputDirectory ?? undefined,
|
||||||
|
...build.config,
|
||||||
|
projectSettings: project.settings,
|
||||||
|
installCommand: project.settings.installCommand ?? undefined,
|
||||||
|
devCommand: project.settings.devCommand ?? undefined,
|
||||||
|
buildCommand: project.settings.buildCommand ?? undefined,
|
||||||
|
framework: project.settings.framework,
|
||||||
|
nodeVersion: project.settings.nodeVersion,
|
||||||
|
};
|
||||||
|
const buildOptions: BuildOptions = {
|
||||||
|
files: filesMap,
|
||||||
|
entrypoint: build.src,
|
||||||
|
workPath,
|
||||||
|
repoRootPath,
|
||||||
|
config: buildConfig,
|
||||||
|
meta,
|
||||||
|
};
|
||||||
|
output.debug(
|
||||||
|
`Building entrypoint "${build.src}" with "${builderPkg.name}"`
|
||||||
|
);
|
||||||
|
const buildResult = await builder.build(buildOptions);
|
||||||
|
|
||||||
|
// Store the build result to generate the final `config.json` after
|
||||||
|
// all builds have completed
|
||||||
|
buildResults.set(build, buildResult);
|
||||||
|
|
||||||
|
// Start flushing the file outputs to the filesystem asynchronously
|
||||||
|
ops.push(
|
||||||
|
writeBuildResult(
|
||||||
|
buildResult,
|
||||||
|
build,
|
||||||
|
builder,
|
||||||
|
builderPkg,
|
||||||
|
vercelConfig?.cleanUrls
|
||||||
|
).then(
|
||||||
|
override => {
|
||||||
|
if (override) overrides.push(override);
|
||||||
|
},
|
||||||
|
err => err
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (corepackShimDir) {
|
||||||
|
cleanupCorepack(corepackShimDir);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Wait for filesystem operations to complete
|
||||||
|
// TODO render progress bar?
|
||||||
|
let hadError = false;
|
||||||
|
const errors = await Promise.all(ops);
|
||||||
|
for (const error of errors) {
|
||||||
|
if (error) {
|
||||||
|
hadError = true;
|
||||||
|
output.prettyError(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (hadError) return 1;
|
||||||
|
|
||||||
|
// Merge existing `config.json` file into the one that will be produced
|
||||||
|
const configPath = join(OUTPUT_DIR, 'config.json');
|
||||||
|
// TODO: properly type
|
||||||
|
const existingConfig = await readJSONFile<any>(configPath);
|
||||||
|
if (existingConfig instanceof CantParseJSONFile) {
|
||||||
|
throw existingConfig;
|
||||||
|
}
|
||||||
|
if (existingConfig) {
|
||||||
|
if (existingConfig.overrides) {
|
||||||
|
overrides.push(existingConfig.overrides);
|
||||||
|
}
|
||||||
|
// Find the `Build` entry for this config file and update the build result
|
||||||
|
for (const [build, buildResult] of buildResults.entries()) {
|
||||||
|
if ('buildOutputPath' in buildResult) {
|
||||||
|
output.debug(`Using "config.json" for "${build.use}`);
|
||||||
|
buildResults.set(build, existingConfig);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const builderRoutes: MergeRoutesProps['builds'] = Array.from(
|
||||||
|
buildResults.entries()
|
||||||
|
)
|
||||||
|
.filter(b => 'routes' in b[1] && Array.isArray(b[1].routes))
|
||||||
|
.map(b => {
|
||||||
|
return {
|
||||||
|
use: b[0].use,
|
||||||
|
entrypoint: b[0].src!,
|
||||||
|
routes: (b[1] as BuildResultV2Typical).routes,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
if (zeroConfigRoutes.length) {
|
||||||
|
builderRoutes.unshift({
|
||||||
|
use: '@vercel/zero-config-routes',
|
||||||
|
entrypoint: '/',
|
||||||
|
routes: zeroConfigRoutes,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
const mergedRoutes = mergeRoutes({
|
||||||
|
userRoutes: routesResult.routes,
|
||||||
|
builds: builderRoutes,
|
||||||
|
});
|
||||||
|
|
||||||
|
const mergedImages = mergeImages(buildResults.values());
|
||||||
|
const mergedWildcard = mergeWildcard(buildResults.values());
|
||||||
|
const mergedOverrides: Record<string, PathOverride> =
|
||||||
|
overrides.length > 0 ? Object.assign({}, ...overrides) : undefined;
|
||||||
|
|
||||||
|
// Write out the final `config.json` file based on the
|
||||||
|
// user configuration and Builder build results
|
||||||
|
// TODO: properly type
|
||||||
|
const config = {
|
||||||
|
version: 3,
|
||||||
|
routes: mergedRoutes,
|
||||||
|
images: mergedImages,
|
||||||
|
wildcard: mergedWildcard,
|
||||||
|
overrides: mergedOverrides,
|
||||||
|
};
|
||||||
|
await fs.writeJSON(join(OUTPUT_DIR, 'config.json'), config, { spaces: 2 });
|
||||||
|
|
||||||
|
output.print(
|
||||||
|
`${prependEmoji(
|
||||||
|
`Build Completed in ${chalk.bold(OUTPUT_DIR)} ${chalk.gray(
|
||||||
|
buildStamp()
|
||||||
|
)}`,
|
||||||
|
emoji('success')
|
||||||
|
)}\n`
|
||||||
|
);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
function expandBuild(files: string[], build: Builder): Builder[] {
|
||||||
|
if (!build.src) return [];
|
||||||
|
|
||||||
|
let pattern = build.src;
|
||||||
|
if (pattern[0] === '/') {
|
||||||
|
// Remove a leading slash so that the globbing is relative
|
||||||
|
// to `cwd` instead of the root of the filesystem.
|
||||||
|
pattern = pattern.substring(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
const matches = files.filter(
|
||||||
|
name => name === pattern || minimatch(name, pattern, { dot: true })
|
||||||
|
);
|
||||||
|
|
||||||
|
return matches.map(m => {
|
||||||
|
return {
|
||||||
|
...build,
|
||||||
|
src: m,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function mergeImages(
|
||||||
|
buildResults: Iterable<BuildResult>
|
||||||
|
): BuildResultV2Typical['images'] {
|
||||||
|
let images: BuildResultV2Typical['images'] = undefined;
|
||||||
|
for (const result of buildResults) {
|
||||||
|
if ('images' in result && result.images) {
|
||||||
|
images = Object.assign({} || images, result.images);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return images;
|
||||||
|
}
|
||||||
|
|
||||||
|
function mergeWildcard(
|
||||||
|
buildResults: Iterable<BuildResult>
|
||||||
|
): BuildResultV2Typical['wildcard'] {
|
||||||
|
let wildcard: BuildResultV2Typical['wildcard'] = undefined;
|
||||||
|
for (const result of buildResults) {
|
||||||
|
if ('wildcard' in result && result.wildcard) {
|
||||||
|
if (!wildcard) wildcard = [];
|
||||||
|
wildcard.push(...result.wildcard);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return wildcard;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function checkExists(paths: Iterable<string>) {
|
||||||
|
for (const path of paths) {
|
||||||
|
try {
|
||||||
|
await fs.stat(path);
|
||||||
|
return path;
|
||||||
|
} catch (err: any) {
|
||||||
|
if (err.code !== 'ENOENT') throw err;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -98,6 +98,12 @@ export default async function dev(
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This is just for tests - can be removed once project settings
|
||||||
|
// are respected locally in `.vercel/project.json`
|
||||||
|
if (process.env.VERCEL_DEV_COMMAND) {
|
||||||
|
devCommand = process.env.VERCEL_DEV_COMMAND;
|
||||||
|
}
|
||||||
|
|
||||||
const devServer = new DevServer(cwd, {
|
const devServer = new DevServer(cwd, {
|
||||||
output,
|
output,
|
||||||
devCommand,
|
devCommand,
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ export default new Map([
|
|||||||
['aliases', 'alias'],
|
['aliases', 'alias'],
|
||||||
['billing', 'billing'],
|
['billing', 'billing'],
|
||||||
['bisect', 'bisect'],
|
['bisect', 'bisect'],
|
||||||
|
['build', 'build'],
|
||||||
['cc', 'billing'],
|
['cc', 'billing'],
|
||||||
['cert', 'certs'],
|
['cert', 'certs'],
|
||||||
['certs', 'certs'],
|
['certs', 'certs'],
|
||||||
|
|||||||
@@ -15,6 +15,12 @@ import { getPkgName, getCommandName } from '../util/pkg-name.ts';
|
|||||||
|
|
||||||
const help = () => {
|
const help = () => {
|
||||||
console.log(`
|
console.log(`
|
||||||
|
${chalk.yellow(
|
||||||
|
`${chalk.bold('NOTE:')} The ${getCommandName(
|
||||||
|
'env'
|
||||||
|
)} command is recommended instead of ${getCommandName('secrets')}`
|
||||||
|
)}
|
||||||
|
|
||||||
${chalk.bold(`${logo} ${getPkgName()} secrets`)} [options] <command>
|
${chalk.bold(`${logo} ${getPkgName()} secrets`)} [options] <command>
|
||||||
|
|
||||||
${chalk.dim('Commands:')}
|
${chalk.dim('Commands:')}
|
||||||
@@ -64,7 +70,7 @@ const help = () => {
|
|||||||
|
|
||||||
${chalk.gray('–')} Paginate results, where ${chalk.dim(
|
${chalk.gray('–')} Paginate results, where ${chalk.dim(
|
||||||
'`1584722256178`'
|
'`1584722256178`'
|
||||||
)} is the time in milliseconds since the UNIX epoch.
|
)} is the time in milliseconds since the UNIX epoch
|
||||||
|
|
||||||
${chalk.cyan(`$ ${getPkgName()} secrets ls --next 1584722256178`)}
|
${chalk.cyan(`$ ${getPkgName()} secrets ls --next 1584722256178`)}
|
||||||
`);
|
`);
|
||||||
@@ -130,8 +136,14 @@ async function run({ output, contextName, currentTeam, client }) {
|
|||||||
const args = argv._.slice(1);
|
const args = argv._.slice(1);
|
||||||
const start = Date.now();
|
const start = Date.now();
|
||||||
const { 'test-warning': testWarningFlag } = argv;
|
const { 'test-warning': testWarningFlag } = argv;
|
||||||
|
const commandName = getCommandName('secret ' + subcommand);
|
||||||
|
|
||||||
if (subcommand === 'ls' || subcommand === 'list') {
|
if (subcommand === 'ls' || subcommand === 'list') {
|
||||||
|
output.note(
|
||||||
|
`The ${getCommandName(
|
||||||
|
'env ls'
|
||||||
|
)} command is recommended instead of ${commandName}\n`
|
||||||
|
);
|
||||||
if (args.length > 1) {
|
if (args.length > 1) {
|
||||||
console.error(
|
console.error(
|
||||||
error(
|
error(
|
||||||
@@ -194,6 +206,11 @@ async function run({ output, contextName, currentTeam, client }) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (subcommand === 'rm' || subcommand === 'remove') {
|
if (subcommand === 'rm' || subcommand === 'remove') {
|
||||||
|
output.note(
|
||||||
|
`The ${getCommandName(
|
||||||
|
'env rm'
|
||||||
|
)} command is recommended instead of ${commandName}\n`
|
||||||
|
);
|
||||||
if (args.length !== 1) {
|
if (args.length !== 1) {
|
||||||
console.error(
|
console.error(
|
||||||
error(
|
error(
|
||||||
@@ -236,6 +253,11 @@ async function run({ output, contextName, currentTeam, client }) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (subcommand === 'rename') {
|
if (subcommand === 'rename') {
|
||||||
|
output.note(
|
||||||
|
`The ${getCommandName('env rm')} and ${getCommandName(
|
||||||
|
'env add'
|
||||||
|
)} commands are recommended instead of ${commandName}\n`
|
||||||
|
);
|
||||||
if (args.length !== 2) {
|
if (args.length !== 2) {
|
||||||
console.error(
|
console.error(
|
||||||
error(
|
error(
|
||||||
@@ -259,6 +281,11 @@ async function run({ output, contextName, currentTeam, client }) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (subcommand === 'add' || subcommand === 'set') {
|
if (subcommand === 'add' || subcommand === 'set') {
|
||||||
|
output.note(
|
||||||
|
`The ${getCommandName(
|
||||||
|
'env add'
|
||||||
|
)} command is recommended instead of ${commandName}\n`
|
||||||
|
);
|
||||||
if (args.length !== 2) {
|
if (args.length !== 2) {
|
||||||
console.error(
|
console.error(
|
||||||
error(
|
error(
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ const isCanary = pkg.version.includes('canary');
|
|||||||
const notifier = updateNotifier({
|
const notifier = updateNotifier({
|
||||||
pkg,
|
pkg,
|
||||||
distTag: isCanary ? 'canary' : 'latest',
|
distTag: isCanary ? 'canary' : 'latest',
|
||||||
|
updateCheckInterval: 1000 * 60 * 60 * 24 * 7, // 1 week
|
||||||
});
|
});
|
||||||
|
|
||||||
const VERCEL_DIR = getGlobalPathConfig();
|
const VERCEL_DIR = getGlobalPathConfig();
|
||||||
@@ -171,7 +172,7 @@ const main = async () => {
|
|||||||
// * a subcommand (as in: `vercel ls`)
|
// * a subcommand (as in: `vercel ls`)
|
||||||
const targetOrSubcommand = argv._[2];
|
const targetOrSubcommand = argv._[2];
|
||||||
|
|
||||||
const betaCommands: string[] = [];
|
const betaCommands: string[] = ['build'];
|
||||||
if (betaCommands.includes(targetOrSubcommand)) {
|
if (betaCommands.includes(targetOrSubcommand)) {
|
||||||
console.log(
|
console.log(
|
||||||
`${chalk.grey(
|
`${chalk.grey(
|
||||||
@@ -303,7 +304,14 @@ const main = async () => {
|
|||||||
|
|
||||||
let authConfig = null;
|
let authConfig = null;
|
||||||
|
|
||||||
const subcommandsWithoutToken = ['login', 'logout', 'help', 'init', 'update'];
|
const subcommandsWithoutToken = [
|
||||||
|
'login',
|
||||||
|
'logout',
|
||||||
|
'help',
|
||||||
|
'init',
|
||||||
|
'update',
|
||||||
|
'build',
|
||||||
|
];
|
||||||
|
|
||||||
if (authConfigExists) {
|
if (authConfigExists) {
|
||||||
try {
|
try {
|
||||||
@@ -524,6 +532,7 @@ const main = async () => {
|
|||||||
typeof scope === 'string' &&
|
typeof scope === 'string' &&
|
||||||
targetCommand !== 'login' &&
|
targetCommand !== 'login' &&
|
||||||
targetCommand !== 'dev' &&
|
targetCommand !== 'dev' &&
|
||||||
|
targetCommand !== 'build' &&
|
||||||
!(targetCommand === 'teams' && argv._[3] !== 'invite')
|
!(targetCommand === 'teams' && argv._[3] !== 'invite')
|
||||||
) {
|
) {
|
||||||
let user = null;
|
let user = null;
|
||||||
@@ -598,6 +607,9 @@ const main = async () => {
|
|||||||
case 'bisect':
|
case 'bisect':
|
||||||
func = require('./commands/bisect').default;
|
func = require('./commands/bisect').default;
|
||||||
break;
|
break;
|
||||||
|
case 'build':
|
||||||
|
func = require('./commands/build').default;
|
||||||
|
break;
|
||||||
case 'certs':
|
case 'certs':
|
||||||
func = require('./commands/certs').default;
|
func = require('./commands/certs').default;
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -251,9 +251,6 @@ export interface Project extends ProjectSettings {
|
|||||||
updatedAt: number;
|
updatedAt: number;
|
||||||
createdAt: number;
|
createdAt: number;
|
||||||
alias?: ProjectAliasTarget[];
|
alias?: ProjectAliasTarget[];
|
||||||
devCommand?: string | null;
|
|
||||||
framework?: string | null;
|
|
||||||
rootDirectory?: string | null;
|
|
||||||
latestDeployments?: Partial<Deployment>[];
|
latestDeployments?: Partial<Deployment>[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
82
packages/cli/src/util/build/corepack.ts
Normal file
82
packages/cli/src/util/build/corepack.ts
Normal file
@@ -0,0 +1,82 @@
|
|||||||
|
import { delimiter, join } from 'path';
|
||||||
|
import { PackageJson, spawnAsync } from '@vercel/build-utils';
|
||||||
|
import fs from 'fs-extra';
|
||||||
|
import { CantParseJSONFile } from '../errors-ts';
|
||||||
|
import { VERCEL_DIR } from '../projects/link';
|
||||||
|
import readJSONFile from '../read-json-file';
|
||||||
|
|
||||||
|
export async function initCorepack({
|
||||||
|
cwd,
|
||||||
|
rootPackageJsonPath,
|
||||||
|
}: {
|
||||||
|
cwd: string;
|
||||||
|
rootPackageJsonPath: string;
|
||||||
|
}): Promise<string | null> {
|
||||||
|
if (process.env.ENABLE_EXPERIMENTAL_COREPACK !== '1') {
|
||||||
|
// Since corepack is experimental, we need to exit early
|
||||||
|
// unless the user explicitly enables it with the env var.
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
const pkg = await readJSONFile<PackageJson>(
|
||||||
|
join(rootPackageJsonPath, 'package.json')
|
||||||
|
);
|
||||||
|
if (pkg instanceof CantParseJSONFile) {
|
||||||
|
console.warn(
|
||||||
|
'Warning: Could not enable corepack because package.json is invalid JSON'
|
||||||
|
);
|
||||||
|
} else if (!pkg?.packageManager) {
|
||||||
|
console.warn(
|
||||||
|
'Warning: Could not enable corepack because package.json is missing "packageManager" property'
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
console.log(
|
||||||
|
`Detected ENABLE_EXPERIMENTAL_COREPACK=1 and "${pkg.packageManager}" in package.json`
|
||||||
|
);
|
||||||
|
const corepackRootDir = join(cwd, VERCEL_DIR, 'cache', 'corepack');
|
||||||
|
const corepackHomeDir = join(corepackRootDir, 'home');
|
||||||
|
const corepackShimDir = join(corepackRootDir, 'shim');
|
||||||
|
await fs.mkdirp(corepackHomeDir);
|
||||||
|
await fs.mkdirp(corepackShimDir);
|
||||||
|
process.env.COREPACK_HOME = corepackHomeDir;
|
||||||
|
process.env.PATH = `${corepackShimDir}${delimiter}${process.env.PATH}`;
|
||||||
|
process.env.DEBUG = process.env.DEBUG
|
||||||
|
? `corepack,${process.env.DEBUG}`
|
||||||
|
: 'corepack';
|
||||||
|
const pkgManagerName = pkg.packageManager.split('@')[0];
|
||||||
|
// We must explicitly call `corepack enable npm` since `corepack enable`
|
||||||
|
// doesn't work with npm. See https://github.com/nodejs/corepack/pull/24
|
||||||
|
// Also, `corepack enable` is too broad and will change the verison of
|
||||||
|
// yarn & pnpm even though those versions are not specified by the user.
|
||||||
|
// See https://github.com/nodejs/corepack#known-good-releases
|
||||||
|
// Finally, we use `--install-directory` so we can cache the result to
|
||||||
|
// reuse for subsequent builds. See `@vercel/vc-build` for `prepareCache`.
|
||||||
|
await spawnAsync(
|
||||||
|
'corepack',
|
||||||
|
['enable', pkgManagerName, '--install-directory', corepackShimDir],
|
||||||
|
{
|
||||||
|
prettyCommand: `corepack enable ${pkgManagerName}`,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
return corepackShimDir;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function cleanupCorepack(corepackShimDir: string) {
|
||||||
|
if (process.env.COREPACK_HOME) {
|
||||||
|
delete process.env.COREPACK_HOME;
|
||||||
|
}
|
||||||
|
if (process.env.PATH) {
|
||||||
|
process.env.PATH = process.env.PATH.replace(
|
||||||
|
`${corepackShimDir}${delimiter}`,
|
||||||
|
''
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (process.env.DEBUG) {
|
||||||
|
if (process.env.DEBUG === 'corepack') {
|
||||||
|
delete process.env.DEBUG;
|
||||||
|
} else {
|
||||||
|
process.env.DEBUG = process.env.DEBUG.replace('corepack,', '');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
233
packages/cli/src/util/build/import-builders.ts
Normal file
233
packages/cli/src/util/build/import-builders.ts
Normal file
@@ -0,0 +1,233 @@
|
|||||||
|
import npa from 'npm-package-arg';
|
||||||
|
import { satisfies } from 'semver';
|
||||||
|
import { dirname, join } from 'path';
|
||||||
|
import { mkdirp, outputJSON, readJSON, symlink } from 'fs-extra';
|
||||||
|
import {
|
||||||
|
BuilderV2,
|
||||||
|
BuilderV3,
|
||||||
|
PackageJson,
|
||||||
|
spawnAsync,
|
||||||
|
} from '@vercel/build-utils';
|
||||||
|
import * as staticBuilder from './static-builder';
|
||||||
|
import { VERCEL_DIR } from '../projects/link';
|
||||||
|
import { Output } from '../output';
|
||||||
|
import readJSONFile from '../read-json-file';
|
||||||
|
import { CantParseJSONFile } from '../errors-ts';
|
||||||
|
|
||||||
|
export interface BuilderWithPkg {
|
||||||
|
path: string;
|
||||||
|
pkgPath: string;
|
||||||
|
builder: BuilderV2 | BuilderV3;
|
||||||
|
pkg: PackageJson;
|
||||||
|
}
|
||||||
|
|
||||||
|
type ResolveBuildersResult =
|
||||||
|
| { buildersToAdd: Set<string> }
|
||||||
|
| { builders: Map<string, BuilderWithPkg> };
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Imports the specified Vercel Builders, installing any missing ones
|
||||||
|
* into `.vercel/builders` if necessary.
|
||||||
|
*/
|
||||||
|
export async function importBuilders(
|
||||||
|
builderSpecs: Set<string>,
|
||||||
|
cwd: string,
|
||||||
|
output: Output
|
||||||
|
): Promise<Map<string, BuilderWithPkg>> {
|
||||||
|
const buildersDir = join(cwd, VERCEL_DIR, 'builders');
|
||||||
|
|
||||||
|
let importResult = await resolveBuilders(buildersDir, builderSpecs, output);
|
||||||
|
|
||||||
|
if ('buildersToAdd' in importResult) {
|
||||||
|
const installResult = await installBuilders(
|
||||||
|
buildersDir,
|
||||||
|
importResult.buildersToAdd,
|
||||||
|
output
|
||||||
|
);
|
||||||
|
|
||||||
|
importResult = await resolveBuilders(
|
||||||
|
buildersDir,
|
||||||
|
builderSpecs,
|
||||||
|
output,
|
||||||
|
installResult.resolvedSpecs
|
||||||
|
);
|
||||||
|
|
||||||
|
if ('buildersToAdd' in importResult) {
|
||||||
|
throw new Error('Something went wrong!');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return importResult.builders;
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function resolveBuilders(
|
||||||
|
buildersDir: string,
|
||||||
|
builderSpecs: Set<string>,
|
||||||
|
output: Output,
|
||||||
|
resolvedSpecs?: Map<string, string>
|
||||||
|
): Promise<ResolveBuildersResult> {
|
||||||
|
const builders = new Map<string, BuilderWithPkg>();
|
||||||
|
const buildersToAdd = new Set<string>();
|
||||||
|
|
||||||
|
for (const spec of builderSpecs) {
|
||||||
|
const resolvedSpec = resolvedSpecs?.get(spec) || spec;
|
||||||
|
const parsed = npa(resolvedSpec);
|
||||||
|
|
||||||
|
let { name } = parsed;
|
||||||
|
if (!name) {
|
||||||
|
// A URL was specified - will need to install it and resolve the
|
||||||
|
// proper package name from the written `package.json` file
|
||||||
|
buildersToAdd.add(spec);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (name === '@vercel/static') {
|
||||||
|
// `@vercel/static` is a special-case built-in builder
|
||||||
|
builders.set(name, {
|
||||||
|
builder: staticBuilder,
|
||||||
|
pkg: { name },
|
||||||
|
path: '',
|
||||||
|
pkgPath: '',
|
||||||
|
});
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
let pkgPath: string | undefined;
|
||||||
|
let builderPkg: PackageJson | undefined;
|
||||||
|
|
||||||
|
try {
|
||||||
|
// First try `.vercel/builders`. The package name should always be available
|
||||||
|
// at the top-level of `node_modules` since CLI is installing those directly.
|
||||||
|
pkgPath = join(buildersDir, 'node_modules', name, 'package.json');
|
||||||
|
builderPkg = await readJSON(pkgPath);
|
||||||
|
} catch (err: any) {
|
||||||
|
if (err?.code !== 'ENOENT') throw err;
|
||||||
|
// If `pkgPath` wasn't found in `.vercel/builders` then try as a CLI local
|
||||||
|
// dependency. `require.resolve()` will throw if the Builder is not a CLI
|
||||||
|
// dep, in which case we'll install it into `.vercel/builders`.
|
||||||
|
// NOTE: `eval('require')` is necessary to avoid bad transpilation to `__webpack_require__`
|
||||||
|
pkgPath = eval('require').resolve(`${name}/package.json`, {
|
||||||
|
paths: [__dirname],
|
||||||
|
}) as string;
|
||||||
|
builderPkg = await readJSON(pkgPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!builderPkg || !pkgPath) {
|
||||||
|
throw new Error(`Failed to load \`package.json\` for "${name}"`);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof builderPkg.version !== 'string') {
|
||||||
|
throw new Error(
|
||||||
|
`\`package.json\` for "${name}" does not contain a "version" field`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (parsed.type === 'version' && parsed.rawSpec !== builderPkg.version) {
|
||||||
|
// An explicit Builder version was specified but it does
|
||||||
|
// not match the version that is currently installed
|
||||||
|
output.debug(
|
||||||
|
`Installed version "${name}@${builderPkg.version}" does not match "${parsed.rawSpec}"`
|
||||||
|
);
|
||||||
|
buildersToAdd.add(spec);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
parsed.type === 'range' &&
|
||||||
|
!satisfies(builderPkg.version, parsed.rawSpec)
|
||||||
|
) {
|
||||||
|
// An explicit Builder range was specified but it is not
|
||||||
|
// compatible with the version that is currently installed
|
||||||
|
output.debug(
|
||||||
|
`Installed version "${name}@${builderPkg.version}" is not compatible with "${parsed.rawSpec}"`
|
||||||
|
);
|
||||||
|
buildersToAdd.add(spec);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: handle `parsed.type === 'tag'` ("latest" vs. anything else?)
|
||||||
|
|
||||||
|
const path = join(dirname(pkgPath), builderPkg.main || 'index.js');
|
||||||
|
|
||||||
|
// NOTE: `eval('require')` is necessary to avoid bad transpilation to `__webpack_require__`
|
||||||
|
const builder = eval('require')(path);
|
||||||
|
|
||||||
|
builders.set(spec, {
|
||||||
|
builder,
|
||||||
|
pkg: builderPkg,
|
||||||
|
path,
|
||||||
|
pkgPath,
|
||||||
|
});
|
||||||
|
output.debug(`Imported Builder "${name}" from "${dirname(pkgPath)}"`);
|
||||||
|
} catch (err: any) {
|
||||||
|
// `resolvedSpecs` is only passed into this function on the 2nd run,
|
||||||
|
// so if MODULE_NOT_FOUND happens in that case then we don't want to
|
||||||
|
// try to install again. Instead just pass through the error to the user
|
||||||
|
if (err.code === 'MODULE_NOT_FOUND' && !resolvedSpecs) {
|
||||||
|
output.debug(`Failed to import "${name}": ${err}`);
|
||||||
|
buildersToAdd.add(spec);
|
||||||
|
} else {
|
||||||
|
err.message = `Importing "${name}": ${err.message}`;
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add any Builders that are not yet present into `.vercel/builders`
|
||||||
|
if (buildersToAdd.size > 0) {
|
||||||
|
return { buildersToAdd };
|
||||||
|
}
|
||||||
|
|
||||||
|
return { builders };
|
||||||
|
}
|
||||||
|
|
||||||
|
async function installBuilders(
|
||||||
|
buildersDir: string,
|
||||||
|
buildersToAdd: Set<string>,
|
||||||
|
output: Output
|
||||||
|
) {
|
||||||
|
const resolvedSpecs = new Map<string, string>();
|
||||||
|
const buildersPkgPath = join(buildersDir, 'package.json');
|
||||||
|
try {
|
||||||
|
const emptyPkgJson = {
|
||||||
|
private: true,
|
||||||
|
license: 'UNLICENSED',
|
||||||
|
};
|
||||||
|
await outputJSON(buildersPkgPath, emptyPkgJson, {
|
||||||
|
flag: 'wx',
|
||||||
|
});
|
||||||
|
} catch (err: any) {
|
||||||
|
if (err.code !== 'EEXIST') throw err;
|
||||||
|
}
|
||||||
|
|
||||||
|
output.debug(`Installing Builders: ${Array.from(buildersToAdd).join(', ')}`);
|
||||||
|
await spawnAsync('yarn', ['add', '@vercel/build-utils', ...buildersToAdd], {
|
||||||
|
cwd: buildersDir,
|
||||||
|
});
|
||||||
|
|
||||||
|
// Symlink `@now/build-utils` -> `@vercel/build-utils` to support legacy Builders
|
||||||
|
const nowScopePath = join(buildersDir, 'node_modules/@now');
|
||||||
|
await mkdirp(nowScopePath);
|
||||||
|
await symlink('../@vercel/build-utils', join(nowScopePath, 'build-utils'));
|
||||||
|
|
||||||
|
// Cross-reference any builderSpecs from the saved `package.json` file,
|
||||||
|
// in case they were installed from a URL
|
||||||
|
const buildersPkg = await readJSONFile<PackageJson>(buildersPkgPath);
|
||||||
|
if (buildersPkg instanceof CantParseJSONFile) throw buildersPkg;
|
||||||
|
if (!buildersPkg) {
|
||||||
|
throw new Error(`Failed to load "${buildersPkgPath}"`);
|
||||||
|
}
|
||||||
|
for (const spec of buildersToAdd) {
|
||||||
|
for (const [name, version] of Object.entries(
|
||||||
|
buildersPkg.dependencies || {}
|
||||||
|
)) {
|
||||||
|
if (version === spec) {
|
||||||
|
output.debug(`Resolved Builder spec "${spec}" to name "${name}"`);
|
||||||
|
resolvedSpecs.set(spec, name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return { resolvedSpecs };
|
||||||
|
}
|
||||||
41
packages/cli/src/util/build/static-builder.ts
Normal file
41
packages/cli/src/util/build/static-builder.ts
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
import minimatch from 'minimatch';
|
||||||
|
import { BuildV2, Files } from '@vercel/build-utils';
|
||||||
|
|
||||||
|
export const version = 2;
|
||||||
|
|
||||||
|
export const build: BuildV2 = async ({ entrypoint, files, config }) => {
|
||||||
|
const output: Files = {};
|
||||||
|
const outputDirectory = config.zeroConfig ? config.outputDirectory : '';
|
||||||
|
|
||||||
|
for (let [filename, fileFsRef] of Object.entries(files)) {
|
||||||
|
if (
|
||||||
|
filename.startsWith('.git/') ||
|
||||||
|
filename === 'vercel.json' ||
|
||||||
|
filename === 'now.json'
|
||||||
|
) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
entrypoint &&
|
||||||
|
!(
|
||||||
|
entrypoint === filename ||
|
||||||
|
minimatch(filename, entrypoint, { dot: true })
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (outputDirectory) {
|
||||||
|
const outputMatch = outputDirectory + '/';
|
||||||
|
if (filename.startsWith(outputMatch)) {
|
||||||
|
// static output files are moved to the root directory
|
||||||
|
filename = filename.slice(outputMatch.length);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
output[filename] = fileFsRef;
|
||||||
|
}
|
||||||
|
|
||||||
|
return { output };
|
||||||
|
};
|
||||||
108
packages/cli/src/util/build/unzip.ts
Normal file
108
packages/cli/src/util/build/unzip.ts
Normal file
@@ -0,0 +1,108 @@
|
|||||||
|
/**
|
||||||
|
* Code modified from `extract-zip` to accept Buffer.
|
||||||
|
* https://github.com/maxogden/extract-zip/blob/master/index.js
|
||||||
|
* BSD-2 Copyright (c) 2014 Max Ogden and other contributors
|
||||||
|
*/
|
||||||
|
|
||||||
|
import path from 'path';
|
||||||
|
import pipe from 'promisepipe';
|
||||||
|
import * as fs from 'fs-extra';
|
||||||
|
import { streamToBuffer } from '@vercel/build-utils';
|
||||||
|
import { Entry, ZipFile, fromBuffer as zipFromBuffer } from 'yauzl-promise';
|
||||||
|
|
||||||
|
async function* createZipIterator(zipFile: ZipFile) {
|
||||||
|
let entry: Entry;
|
||||||
|
while ((entry = await zipFile.readEntry()) !== null) {
|
||||||
|
yield entry;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function unzip(buffer: Buffer, dir: string): Promise<void> {
|
||||||
|
const zipFile = await zipFromBuffer(buffer);
|
||||||
|
for await (const entry of createZipIterator(zipFile)) {
|
||||||
|
if (entry.fileName.startsWith('__MACOSX/')) continue;
|
||||||
|
|
||||||
|
try {
|
||||||
|
const destDir = path.dirname(path.join(dir, entry.fileName));
|
||||||
|
await fs.mkdirp(destDir);
|
||||||
|
|
||||||
|
const canonicalDestDir = await fs.realpath(destDir);
|
||||||
|
const relativeDestDir = path.relative(dir, canonicalDestDir);
|
||||||
|
|
||||||
|
if (relativeDestDir.split(path.sep).includes('..')) {
|
||||||
|
throw new Error(
|
||||||
|
`Out of bound path "${canonicalDestDir}" found while processing file ${entry.fileName}`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
await extractEntry(zipFile, entry, dir);
|
||||||
|
} catch (err) {
|
||||||
|
await zipFile.close();
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function extractEntry(
|
||||||
|
zipFile: ZipFile,
|
||||||
|
entry: Entry,
|
||||||
|
dir: string
|
||||||
|
): Promise<void> {
|
||||||
|
const dest = path.join(dir, entry.fileName);
|
||||||
|
|
||||||
|
// convert external file attr int into a fs stat mode int
|
||||||
|
const mode = (entry.externalFileAttributes >> 16) & 0xffff;
|
||||||
|
// check if it's a symlink or dir (using stat mode constants)
|
||||||
|
const IFMT = 61440;
|
||||||
|
const IFDIR = 16384;
|
||||||
|
const IFLNK = 40960;
|
||||||
|
const symlink = (mode & IFMT) === IFLNK;
|
||||||
|
let isDir = (mode & IFMT) === IFDIR;
|
||||||
|
|
||||||
|
// Failsafe, borrowed from jsZip
|
||||||
|
if (!isDir && entry.fileName.endsWith('/')) {
|
||||||
|
isDir = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// check for windows weird way of specifying a directory
|
||||||
|
// https://github.com/maxogden/extract-zip/issues/13#issuecomment-154494566
|
||||||
|
const madeBy = entry.versionMadeBy >> 8;
|
||||||
|
if (!isDir) isDir = madeBy === 0 && entry.externalFileAttributes === 16;
|
||||||
|
|
||||||
|
const procMode = getExtractedMode(mode, isDir) & 0o777;
|
||||||
|
|
||||||
|
// always ensure folders are created
|
||||||
|
const destDir = isDir ? dest : path.dirname(dest);
|
||||||
|
|
||||||
|
const mkdirOptions = { recursive: true };
|
||||||
|
if (isDir) {
|
||||||
|
// @ts-ignore
|
||||||
|
mkdirOptions.mode = procMode;
|
||||||
|
}
|
||||||
|
await fs.mkdir(destDir, mkdirOptions);
|
||||||
|
if (isDir) return;
|
||||||
|
|
||||||
|
const readStream = await zipFile.openReadStream(entry);
|
||||||
|
|
||||||
|
if (symlink) {
|
||||||
|
const link = await streamToBuffer(readStream);
|
||||||
|
await fs.symlink(link.toString('utf8'), dest);
|
||||||
|
} else {
|
||||||
|
await pipe(readStream, fs.createWriteStream(dest, { mode: procMode }));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function getExtractedMode(entryMode: number, isDir: boolean): number {
|
||||||
|
let mode = entryMode;
|
||||||
|
|
||||||
|
// Set defaults, if necessary
|
||||||
|
if (mode === 0) {
|
||||||
|
if (isDir) {
|
||||||
|
mode = 0o755;
|
||||||
|
} else {
|
||||||
|
mode = 0o644;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return mode;
|
||||||
|
}
|
||||||
373
packages/cli/src/util/build/write-build-result.ts
Normal file
373
packages/cli/src/util/build/write-build-result.ts
Normal file
@@ -0,0 +1,373 @@
|
|||||||
|
import fs from 'fs-extra';
|
||||||
|
import mimeTypes from 'mime-types';
|
||||||
|
import { basename, dirname, extname, join, relative, resolve } from 'path';
|
||||||
|
import {
|
||||||
|
Builder,
|
||||||
|
BuildResultV2,
|
||||||
|
BuildResultV3,
|
||||||
|
File,
|
||||||
|
FileFsRef,
|
||||||
|
BuilderV2,
|
||||||
|
BuilderV3,
|
||||||
|
Lambda,
|
||||||
|
PackageJson,
|
||||||
|
Prerender,
|
||||||
|
download,
|
||||||
|
EdgeFunction,
|
||||||
|
BuildResultBuildOutput,
|
||||||
|
} from '@vercel/build-utils';
|
||||||
|
import pipe from 'promisepipe';
|
||||||
|
import { unzip } from './unzip';
|
||||||
|
import { VERCEL_DIR } from '../projects/link';
|
||||||
|
|
||||||
|
export const OUTPUT_DIR = join(VERCEL_DIR, 'output');
|
||||||
|
|
||||||
|
export async function writeBuildResult(
|
||||||
|
buildResult: BuildResultV2 | BuildResultV3,
|
||||||
|
build: Builder,
|
||||||
|
builder: BuilderV2 | BuilderV3,
|
||||||
|
builderPkg: PackageJson,
|
||||||
|
cleanUrls?: boolean
|
||||||
|
) {
|
||||||
|
const { version } = builder;
|
||||||
|
if (version === 2) {
|
||||||
|
return writeBuildResultV2(buildResult as BuildResultV2, cleanUrls);
|
||||||
|
} else if (version === 3) {
|
||||||
|
return writeBuildResultV3(buildResult as BuildResultV3, build);
|
||||||
|
}
|
||||||
|
throw new Error(
|
||||||
|
`Unsupported Builder version \`${version}\` from "${builderPkg.name}"`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function isEdgeFunction(v: any): v is EdgeFunction {
|
||||||
|
return v?.type === 'EdgeFunction';
|
||||||
|
}
|
||||||
|
|
||||||
|
function isLambda(v: any): v is Lambda {
|
||||||
|
return v?.type === 'Lambda';
|
||||||
|
}
|
||||||
|
|
||||||
|
function isPrerender(v: any): v is Prerender {
|
||||||
|
return v?.type === 'Prerender';
|
||||||
|
}
|
||||||
|
|
||||||
|
function isFile(v: any): v is File {
|
||||||
|
const type = v?.type;
|
||||||
|
return type === 'FileRef' || type === 'FileFsRef' || type === 'FileBlob';
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface PathOverride {
|
||||||
|
contentType?: string;
|
||||||
|
path?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Writes the output from the `build()` return value of a v2 Builder to
|
||||||
|
* the filesystem.
|
||||||
|
*/
|
||||||
|
async function writeBuildResultV2(
|
||||||
|
buildResult: BuildResultV2,
|
||||||
|
cleanUrls?: boolean
|
||||||
|
) {
|
||||||
|
if ('buildOutputPath' in buildResult) {
|
||||||
|
await mergeBuilderOutput(buildResult);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const lambdas = new Map<Lambda, string>();
|
||||||
|
const overrides: Record<string, PathOverride> = {};
|
||||||
|
for (const [path, output] of Object.entries(buildResult.output)) {
|
||||||
|
if (isLambda(output)) {
|
||||||
|
await writeLambda(output, path, lambdas);
|
||||||
|
} else if (isPrerender(output)) {
|
||||||
|
await writeLambda(output.lambda, path, lambdas);
|
||||||
|
|
||||||
|
// Write the fallback file alongside the Lambda directory
|
||||||
|
let fallback = output.fallback;
|
||||||
|
if (fallback) {
|
||||||
|
const ext = getFileExtension(fallback);
|
||||||
|
const fallbackName = `${path}.prerender-fallback${ext}`;
|
||||||
|
const fallbackPath = join(OUTPUT_DIR, 'functions', fallbackName);
|
||||||
|
const stream = fallback.toStream();
|
||||||
|
await pipe(
|
||||||
|
stream,
|
||||||
|
fs.createWriteStream(fallbackPath, { mode: fallback.mode })
|
||||||
|
);
|
||||||
|
fallback = new FileFsRef({
|
||||||
|
...output.fallback,
|
||||||
|
fsPath: basename(fallbackName),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const prerenderConfigPath = join(
|
||||||
|
OUTPUT_DIR,
|
||||||
|
'functions',
|
||||||
|
`${path}.prerender-config.json`
|
||||||
|
);
|
||||||
|
const prerenderConfig = {
|
||||||
|
...output,
|
||||||
|
lambda: undefined,
|
||||||
|
fallback,
|
||||||
|
};
|
||||||
|
await fs.writeJSON(prerenderConfigPath, prerenderConfig, { spaces: 2 });
|
||||||
|
} else if (isFile(output)) {
|
||||||
|
await writeStaticFile(output, path, overrides, cleanUrls);
|
||||||
|
} else if (isEdgeFunction(output)) {
|
||||||
|
await writeEdgeFunction(output, path);
|
||||||
|
} else {
|
||||||
|
throw new Error(
|
||||||
|
`Unsupported output type: "${(output as any).type}" for ${path}`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Object.keys(overrides).length > 0 ? overrides : undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Writes the output from the `build()` return value of a v3 Builder to
|
||||||
|
* the filesystem.
|
||||||
|
*/
|
||||||
|
async function writeBuildResultV3(buildResult: BuildResultV3, build: Builder) {
|
||||||
|
const { output } = buildResult;
|
||||||
|
if (isLambda(output)) {
|
||||||
|
const src = build.src!;
|
||||||
|
const ext = extname(src);
|
||||||
|
const path = build.config?.zeroConfig
|
||||||
|
? src.substring(0, src.length - ext.length)
|
||||||
|
: src;
|
||||||
|
await writeLambda(output, path);
|
||||||
|
} else {
|
||||||
|
throw new Error(
|
||||||
|
`Unsupported output type: "${(output as any).type}" for ${build.src}`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Writes a static `File` instance to the file system in the "static" directory.
|
||||||
|
* If the filename does not have a file extension then one attempts to be inferred
|
||||||
|
* from the extension of the `fsPath`.
|
||||||
|
*
|
||||||
|
* @param file The `File` instance to write
|
||||||
|
* @param path The URL path where the `File` can be accessed from
|
||||||
|
* @param overrides Record of override configuration when a File is renamed or has other metadata
|
||||||
|
*/
|
||||||
|
async function writeStaticFile(
|
||||||
|
file: File,
|
||||||
|
path: string,
|
||||||
|
overrides: Record<string, PathOverride>,
|
||||||
|
cleanUrls = false
|
||||||
|
) {
|
||||||
|
let fsPath = path;
|
||||||
|
let override: PathOverride | null = null;
|
||||||
|
|
||||||
|
// If the output path doesn't match the determined file extension of
|
||||||
|
// the File then add the extension. This is to help avoid conflicts
|
||||||
|
// where an output path matches a directory name of another output path
|
||||||
|
// (i.e. `blog` -> `blog.html` and `blog/hello` -> `blog/hello.html`)
|
||||||
|
const ext = getFileExtension(file);
|
||||||
|
if (ext && extname(path) !== ext) {
|
||||||
|
fsPath += ext;
|
||||||
|
if (!override) override = {};
|
||||||
|
override.path = path;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If `cleanUrls` is true then remove the `.html` file extension
|
||||||
|
// for HTML files.
|
||||||
|
if (cleanUrls && path.endsWith('.html')) {
|
||||||
|
if (!override) override = {};
|
||||||
|
override.path = path.slice(0, -5);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ensure an explicit "content-type" on the `File` is returned in
|
||||||
|
// the final output asset.
|
||||||
|
if (file.contentType) {
|
||||||
|
if (!override) override = {};
|
||||||
|
override.contentType = file.contentType;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (override) {
|
||||||
|
overrides[fsPath] = override;
|
||||||
|
}
|
||||||
|
|
||||||
|
const dest = join(OUTPUT_DIR, 'static', fsPath);
|
||||||
|
await fs.mkdirp(dirname(dest));
|
||||||
|
|
||||||
|
// TODO: handle (or skip) symlinks?
|
||||||
|
const stream = file.toStream();
|
||||||
|
await pipe(stream, fs.createWriteStream(dest, { mode: file.mode }));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Serializes the `EdgeFunction` instance to the file system.
|
||||||
|
*
|
||||||
|
* @param edgeFunction The `EdgeFunction` instance
|
||||||
|
* @param path The URL path where the `EdgeFunction` can be accessed from
|
||||||
|
*/
|
||||||
|
async function writeEdgeFunction(edgeFunction: EdgeFunction, path: string) {
|
||||||
|
const dest = join(OUTPUT_DIR, 'functions', `${path}.func`);
|
||||||
|
|
||||||
|
await fs.mkdirp(dest);
|
||||||
|
const ops: Promise<any>[] = [];
|
||||||
|
ops.push(download(edgeFunction.files, dest));
|
||||||
|
|
||||||
|
const config = {
|
||||||
|
runtime: 'edge',
|
||||||
|
...edgeFunction,
|
||||||
|
files: undefined,
|
||||||
|
type: undefined,
|
||||||
|
};
|
||||||
|
const configPath = join(dest, '.vc-config.json');
|
||||||
|
ops.push(
|
||||||
|
fs.writeJSON(configPath, config, {
|
||||||
|
spaces: 2,
|
||||||
|
})
|
||||||
|
);
|
||||||
|
await Promise.all(ops);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Writes the file references from the `Lambda` instance to the file system.
|
||||||
|
*
|
||||||
|
* @param lambda The `Lambda` instance
|
||||||
|
* @param path The URL path where the `Lambda` can be accessed from
|
||||||
|
* @param lambdas (optional) Map of `Lambda` instances that have previously been written
|
||||||
|
*/
|
||||||
|
async function writeLambda(
|
||||||
|
lambda: Lambda,
|
||||||
|
path: string,
|
||||||
|
lambdas?: Map<Lambda, string>
|
||||||
|
) {
|
||||||
|
const dest = join(OUTPUT_DIR, 'functions', `${path}.func`);
|
||||||
|
|
||||||
|
// If the `lambda` has already been written to the filesystem at a different
|
||||||
|
// location then create a symlink to the previous location instead of copying
|
||||||
|
// the files again.
|
||||||
|
const existingLambdaPath = lambdas?.get(lambda);
|
||||||
|
if (existingLambdaPath) {
|
||||||
|
const destDir = dirname(dest);
|
||||||
|
const targetDest = join(
|
||||||
|
OUTPUT_DIR,
|
||||||
|
'functions',
|
||||||
|
`${existingLambdaPath}.func`
|
||||||
|
);
|
||||||
|
const target = relative(destDir, targetDest);
|
||||||
|
await fs.mkdirp(destDir);
|
||||||
|
await fs.symlink(target, dest);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
lambdas?.set(lambda, path);
|
||||||
|
|
||||||
|
await fs.mkdirp(dest);
|
||||||
|
const ops: Promise<any>[] = [];
|
||||||
|
if (lambda.files) {
|
||||||
|
// `files` is defined
|
||||||
|
ops.push(download(lambda.files, dest));
|
||||||
|
} else if (lambda.zipBuffer) {
|
||||||
|
// Builders that use the deprecated `createLambda()` might only have `zipBuffer`
|
||||||
|
ops.push(unzip(lambda.zipBuffer, dest));
|
||||||
|
} else {
|
||||||
|
throw new Error('Malformed `Lambda` - no "files" present');
|
||||||
|
}
|
||||||
|
|
||||||
|
const config = {
|
||||||
|
...lambda,
|
||||||
|
type: undefined,
|
||||||
|
files: undefined,
|
||||||
|
zipBuffer: undefined,
|
||||||
|
};
|
||||||
|
const configPath = join(dest, '.vc-config.json');
|
||||||
|
ops.push(
|
||||||
|
fs.writeJSON(configPath, config, {
|
||||||
|
spaces: 2,
|
||||||
|
})
|
||||||
|
);
|
||||||
|
await Promise.all(ops);
|
||||||
|
|
||||||
|
// XXX: remove any `.vercel/builders` directories that were
|
||||||
|
// extracted into the `dest` dir. This is a temporary band-aid
|
||||||
|
// to make `vercel-php` work since it is inadvertently including
|
||||||
|
// `.vercel/builders` into the Lambda files due to glob syntax.
|
||||||
|
// See: https://github.com/juicyfx/vercel-php/pull/232
|
||||||
|
for await (const dir of findDirs('.vercel', dest)) {
|
||||||
|
const absDir = join(dest, dir);
|
||||||
|
const entries = await fs.readdir(absDir);
|
||||||
|
if (entries.includes('cache')) {
|
||||||
|
// Delete everything except for "cache"
|
||||||
|
await Promise.all(
|
||||||
|
entries
|
||||||
|
.filter(e => e !== 'cache')
|
||||||
|
.map(entry => fs.remove(join(absDir, entry)))
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
// Delete the entire `.vercel` directory
|
||||||
|
await fs.remove(absDir);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When the Root Directory setting is utilized, merge the contents of the
|
||||||
|
* `.vercel/output` directory that was specified by the Builder into the
|
||||||
|
* `vc build` output directory.
|
||||||
|
*/
|
||||||
|
async function mergeBuilderOutput(buildResult: BuildResultBuildOutput) {
|
||||||
|
const absOutputDir = resolve(OUTPUT_DIR);
|
||||||
|
if (absOutputDir === buildResult.buildOutputPath) {
|
||||||
|
// `.vercel/output` dir is already in the correct location,
|
||||||
|
// so no need to do anything
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
await fs.copy(buildResult.buildOutputPath, OUTPUT_DIR);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Attempts to return the file extension (i.e. `.html`) from the given
|
||||||
|
* `File` instance, based on its actual filesystem path and/or the
|
||||||
|
* "content-type" of the File.
|
||||||
|
*/
|
||||||
|
function getFileExtension(file: File): string {
|
||||||
|
let ext = '';
|
||||||
|
if (file.type === 'FileFsRef') {
|
||||||
|
ext = extname(file.fsPath);
|
||||||
|
}
|
||||||
|
if (!ext && file.contentType) {
|
||||||
|
const e = mimeTypes.extension(file.contentType);
|
||||||
|
if (e) {
|
||||||
|
ext = `.${e}`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ext;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates an async iterator that scans a directory
|
||||||
|
* for sub-directories with the matching `name`.
|
||||||
|
*/
|
||||||
|
export async function* findDirs(
|
||||||
|
name: string,
|
||||||
|
dir: string,
|
||||||
|
root = dir
|
||||||
|
): AsyncIterable<string> {
|
||||||
|
let paths: string[];
|
||||||
|
try {
|
||||||
|
paths = await fs.readdir(dir);
|
||||||
|
} catch (err: any) {
|
||||||
|
if (err.code !== 'ENOENT') {
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
paths = [];
|
||||||
|
}
|
||||||
|
for (const path of paths) {
|
||||||
|
const abs = join(dir, path);
|
||||||
|
const s = await fs.stat(abs);
|
||||||
|
if (s.isDirectory()) {
|
||||||
|
if (path === name) {
|
||||||
|
yield relative(root, abs);
|
||||||
|
} else {
|
||||||
|
yield* findDirs(name, abs, root);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -142,6 +142,7 @@ export async function executeBuild(
|
|||||||
files,
|
files,
|
||||||
entrypoint,
|
entrypoint,
|
||||||
workPath,
|
workPath,
|
||||||
|
repoRootPath: workPath,
|
||||||
config,
|
config,
|
||||||
meta: {
|
meta: {
|
||||||
isDev: true,
|
isDev: true,
|
||||||
|
|||||||
@@ -89,6 +89,7 @@ import {
|
|||||||
} from './types';
|
} from './types';
|
||||||
import { ProjectEnvVariable, ProjectSettings } from '../../types';
|
import { ProjectEnvVariable, ProjectSettings } from '../../types';
|
||||||
import exposeSystemEnvs from './expose-system-envs';
|
import exposeSystemEnvs from './expose-system-envs';
|
||||||
|
import { treeKill } from '../tree-kill';
|
||||||
|
|
||||||
const frontendRuntimeSet = new Set(
|
const frontendRuntimeSet = new Set(
|
||||||
frameworkList.map(f => f.useRuntime?.use || '@vercel/static-build')
|
frameworkList.map(f => f.useRuntime?.use || '@vercel/static-build')
|
||||||
@@ -998,20 +999,7 @@ export default class DevServer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (devProcess) {
|
if (devProcess) {
|
||||||
ops.push(
|
ops.push(treeKill(devProcess.pid));
|
||||||
new Promise<void>((resolve, reject) => {
|
|
||||||
devProcess.once('exit', () => resolve());
|
|
||||||
try {
|
|
||||||
process.kill(devProcess.pid);
|
|
||||||
} catch (err) {
|
|
||||||
if (err.code === 'ESRCH') {
|
|
||||||
// Process already exited
|
|
||||||
return resolve();
|
|
||||||
}
|
|
||||||
reject(err);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ops.push(close(this.server));
|
ops.push(close(this.server));
|
||||||
@@ -1747,6 +1735,7 @@ export default class DevServer {
|
|||||||
entrypoint: match.entrypoint,
|
entrypoint: match.entrypoint,
|
||||||
workPath,
|
workPath,
|
||||||
config: match.config || {},
|
config: match.config || {},
|
||||||
|
repoRootPath: this.cwd,
|
||||||
meta: {
|
meta: {
|
||||||
isDev: true,
|
isDev: true,
|
||||||
requestPath,
|
requestPath,
|
||||||
@@ -2120,7 +2109,7 @@ export default class DevServer {
|
|||||||
.replace(/%PORT%/g, `${port}`);
|
.replace(/%PORT%/g, `${port}`);
|
||||||
|
|
||||||
this.output.debug(
|
this.output.debug(
|
||||||
`Starting dev command with parameters : ${JSON.stringify({
|
`Starting dev command with parameters: ${JSON.stringify({
|
||||||
cwd,
|
cwd,
|
||||||
command,
|
command,
|
||||||
port,
|
port,
|
||||||
@@ -2152,6 +2141,7 @@ export default class DevServer {
|
|||||||
cwd,
|
cwd,
|
||||||
env,
|
env,
|
||||||
});
|
});
|
||||||
|
this.devProcess = p;
|
||||||
|
|
||||||
if (!p.stdout || !p.stderr) {
|
if (!p.stdout || !p.stderr) {
|
||||||
throw new Error('Expected child process to have stdout and stderr');
|
throw new Error('Expected child process to have stdout and stderr');
|
||||||
@@ -2164,17 +2154,14 @@ export default class DevServer {
|
|||||||
process.stdout.write(data.replace(proxyPort, devPort));
|
process.stdout.write(data.replace(proxyPort, devPort));
|
||||||
});
|
});
|
||||||
|
|
||||||
p.on('exit', (code: number) => {
|
p.on('exit', (code, signal) => {
|
||||||
if (code > 0) {
|
this.output.debug(`Dev command exited with "${signal || code}"`);
|
||||||
process.exit(code);
|
|
||||||
}
|
|
||||||
this.devProcessPort = undefined;
|
this.devProcessPort = undefined;
|
||||||
});
|
});
|
||||||
|
|
||||||
await checkForPort(port, 1000 * 60 * 5);
|
await checkForPort(port, 1000 * 60 * 5);
|
||||||
|
|
||||||
this.devProcessPort = port;
|
this.devProcessPort = port;
|
||||||
this.devProcess = p;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,16 @@ import title from 'title';
|
|||||||
import pkg from './pkg';
|
import pkg from './pkg';
|
||||||
import cmd from './output/cmd';
|
import cmd from './output/cmd';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The package name defined in the CLI's `package.json` file (`vercel`).
|
||||||
|
*/
|
||||||
|
export const name = pkg.name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unicode symbol used to represent the CLI.
|
||||||
|
*/
|
||||||
|
export const logo = '▲';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the package name such as `vercel` or `now`.
|
* Returns the package name such as `vercel` or `now`.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -5,12 +5,14 @@ import { join } from 'path';
|
|||||||
|
|
||||||
export type ProjectLinkAndSettings = ProjectLink & {
|
export type ProjectLinkAndSettings = ProjectLink & {
|
||||||
settings: {
|
settings: {
|
||||||
|
installCommand: Project['installCommand'];
|
||||||
buildCommand: Project['buildCommand'];
|
buildCommand: Project['buildCommand'];
|
||||||
devCommand: Project['devCommand'];
|
devCommand: Project['devCommand'];
|
||||||
outputDirectory: Project['outputDirectory'];
|
outputDirectory: Project['outputDirectory'];
|
||||||
directoryListing: Project['directoryListing'];
|
directoryListing: Project['directoryListing'];
|
||||||
rootDirectory: Project['rootDirectory'];
|
rootDirectory: Project['rootDirectory'];
|
||||||
framework: Project['framework'];
|
framework: Project['framework'];
|
||||||
|
nodeVersion: Project['nodeVersion'];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -22,20 +24,22 @@ export async function writeProjectSettings(
|
|||||||
project: Project,
|
project: Project,
|
||||||
org: Org
|
org: Org
|
||||||
) {
|
) {
|
||||||
const data = {
|
const projectLinkAndSettings: ProjectLinkAndSettings = {
|
||||||
projectId: project.id,
|
projectId: project.id,
|
||||||
orgId: org.id,
|
orgId: org.id,
|
||||||
settings: {
|
settings: {
|
||||||
buildCommand: project.buildCommand,
|
|
||||||
devCommand: project.devCommand,
|
|
||||||
outputDirectory: project.outputDirectory,
|
|
||||||
directoryListing: project.directoryListing,
|
|
||||||
rootDirectory: project.rootDirectory,
|
|
||||||
framework: project.framework,
|
framework: project.framework,
|
||||||
|
devCommand: project.devCommand,
|
||||||
|
installCommand: project.installCommand,
|
||||||
|
buildCommand: project.buildCommand,
|
||||||
|
outputDirectory: project.outputDirectory,
|
||||||
|
rootDirectory: project.rootDirectory,
|
||||||
|
directoryListing: project.directoryListing,
|
||||||
|
nodeVersion: project.nodeVersion,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
const path = join(cwd, VERCEL_DIR, VERCEL_DIR_PROJECT);
|
const path = join(cwd, VERCEL_DIR, VERCEL_DIR_PROJECT);
|
||||||
return await outputJSON(path, data, {
|
return await outputJSON(path, projectLinkAndSettings, {
|
||||||
spaces: 2,
|
spaces: 2,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user