Compare commits

...

38 Commits

Author SHA1 Message Date
Vercel Release Bot
4cd77608e8 Version Packages (#10020)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-06-01 10:09:24 -05:00
Steven
e6b2980eba [tests] Fix summary workflow to always run (#10048)
### Description
This ensures the Summary job always runs to check if any test failed and
cause itself to fail as well.

This allows us to dynamically add as many concurrent jobs as we want but
only have one (Summary) marked as required.

### Testing
I verified this worked by making a change to `@vercel/static-config`
which is not required and the Summary check failed:

https://github.com/vercel/vercel/actions/runs/5136560652/jobs/9243924596

Then I reverted it so that the test was passing and the Summary check
passed:

https://github.com/vercel/vercel/actions/runs/5137401343/jobs/9245554297
2023-05-31 18:24:54 -04:00
Nathan Rajlich
67e20a6ede [cli] Add repo linking support for deploy command (#10013)
Adds support for `vercel deploy` command when the repository has been linked via `vercel link --repo`.
2023-05-31 18:07:30 +00:00
JJ Kasper
c63679ea0a Revert "[next] Update rsc content-type test fixtures" (#10040)
Relies on https://github.com/vercel/next.js/pull/50472 this should only be merged after the Next.js PR is released to canary

Reverts vercel/vercel#10023
2023-05-31 15:38:22 +00:00
Damien Simonin Feugas
4280166df4 docs(sveltekit): re-introduce speed insights (#9988) 2023-05-31 09:41:46 +02:00
Nathan Rajlich
18ae78137c Fetch git tags during Release workflow (#10045)
Follow-up to #10044. The git tags need to be present for `changeset tag` to work properly.
2023-05-30 21:10:03 +00:00
Nathan Rajlich
ebe4058073 Use pnpm publish -r and changeset tag to publish packages (#10044)
This is a re-application of #10022 (which was reverted in #10032), but with the addition of `changeset tag` after the `pnpm publish -r` command. This ensures the proper git tags are also created, allowing for the GitHub releases to be published.
2023-05-30 19:25:24 +00:00
Vercel Release Bot
942e76840e [tests] Upgrade Turbo to version 1.9.9 (#10036)
This auto-generated PR updates Turbo to version 1.9.9
2023-05-29 20:31:12 +00:00
Nathan Rajlich
57515d2d07 [cli] Fix link subcommand unit tests on Windows (#10033)
Follow-up to #10031 which broke the `link` unit tests on Windows.

For some reason Kodiak was a bad bot and merged the PR with failing tests <picture data-single-emoji=":rarityannoyed:" title=":rarityannoyed:"><img class="emoji" src="https://emoji.slack-edge.com/T0CAQ00TU/rarityannoyed/b62f8c87a5fb7239.png" alt=":rarityannoyed:" width="20" height="auto" align="absmiddle"></picture> 

_Note:_ Probably easier to review with [whitespace hidden](https://github.com/vercel/vercel/pull/10033/files?w=1).
2023-05-26 21:27:19 +00:00
Nathan Rajlich
ef30a46c03 [cli] Add client.cwd to unify all working directory related logic (#10031)
A few commands were still checking on `--cwd` explicitly, which is incorrect since the entrypoint file already handles the directory change.

The new `client.cwd` property is a helper to make writing tests easier. Tests no longer need to `chdir()` explicitly and then revert afterwards.
2023-05-26 20:42:03 +00:00
Nathan Rajlich
113b8ac87b Revert "Use pnpm publish -r to publish packages (#10022)" (#10032)
This reverts commit 1e47bbf32f.

`changeset publish` also creates git tags, whereas `pnpm publish -r` does not. This causes the GitHub Releases to not be created.
2023-05-26 20:18:49 +00:00
Shohei Maeda
b56ac2717d [next] Pass pageExtensions data to apiLambdaGroups (#10015)
Right now, we can't detect API routes correctly if `pageExtensions` is set:

> WARNING: Unable to find source file for page xxxx with extensions: js, jsx, ts, tsx, this can cause functions config from `vercel.json` to not be applied
2023-05-26 18:01:05 +00:00
Vercel Release Bot
aa8957ab10 [examples][tests] Upgrade Next.js to version 13.4.4 (#10025)
This auto-generated PR updates 3 packages to Next.js version 13.4.4
2023-05-26 10:54:42 -04:00
Shohei Maeda
c6c19354e8 [next] Fix functions config with App Router (#9889)
We added appDir support in https://github.com/vercel/vercel/pull/9811 so that users can customize `memory`/`maxDuration` for routes in appDir.

But since RSC is enabled by default in Next.js 13, `vercel build` still reports some warning messages, such as:

```json
"functions": {
  "app/**/*": {
    "maxDuration": 5,
    "memory": 512
  }
}
```
```
WARNING: Unable to find source file for page hello.js with extensions: ts, tsx, js, jsx, md, mdx, this can cause functions config from `vercel.json` to not be applied
WARNING: Unable to find source file for page index.js with extensions: ts, tsx, js, jsx, md, mdx, this can cause functions config from `vercel.json` to not be applied
```

To suppress these errors and properly apply `functions` setting to those routes, updating the current detection logic to also search `page.${ext}` files.
2023-05-25 21:01:29 +00:00
JJ Kasper
96b2502133 [next] Update rsc content-type test fixtures (#10023)
This updates the tests to the latest expected content-type header for RSC responses. 

x-ref: https://github.com/vercel/next.js/pull/50314
2023-05-25 08:32:53 +00:00
Swarnava Sengupta
2df0262675 [examples] Update preact template to use Node 18 (#10012) 2023-05-24 15:06:01 -07:00
Nathan Rajlich
1e47bbf32f Use pnpm publish -r to publish packages (#10022)
Following the instructions here: https://pnpm.io/using-changesets

This should ensure that packages are published in the correct order (see related issue: https://github.com/changesets/changesets/issues/238).
2023-05-24 21:56:45 +00:00
Nathan Rajlich
00813a3945 [cli] Add expect dev dependency to fix type error in toOutput (#10021)
Also make the timeout print what was buffered to help with debugging failed tests.
2023-05-24 21:35:33 +00:00
Chris Barber
a73ec6343f [cli] Clean up 'vc rollback' (#10019)
This PR removes dependency on the deprecated `lastRollbackTarget` project property and adopts many of the code conventions used in `vc promote`.

Important! Please merge #9984 first!
2023-05-24 19:10:28 +00:00
Chris Barber
4bd70d4b6e [cli] New vc promote command (#9984)
~This PR is blocked by https://github.com/vercel/api/pull/19508.~

Linear: https://linear.app/vercel/issue/VCCLI-262/cli-new-command-to-promote-deployment
2023-05-24 17:22:11 +00:00
Javi Velasco
c7bcea4081 Remove usage of env from Edge Functions and Middleware (#10018)
Co-authored-by: Steven <steven@ceriously.com>
2023-05-24 18:22:43 +02:00
Vercel Release Bot
aab95532d6 Version Packages (#10006)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-05-24 10:13:01 -05:00
Sean Massa
1b18c853c2 [cli] implement vc deploy --prod --skip-domain (#9836)
Adds the `--skip-domain` option to be used like `vc deploy --prod --skip-domain`. This passes along the `autoAliasCustomDomains: false` flag to the API so that the deployment will not auto alias domains for this deployment.

This PR also moves the `commands/deploy/archive` fixture to `commands/deploy/static` to better describe what the fixture is, not how it is sometimes used in a test.

---

Depends on: https://github.com/vercel/api/pull/18730
Card: https://linear.app/vercel/issue/VCCLI-276/cli-allow-creation-of-production-deployment-without-auto-alias
2023-05-23 19:26:47 +00:00
Swarnava Sengupta
1663db7ca3 [examples] Update solid-js template to use Node 18 (#10009) 2023-05-23 11:29:14 -07:00
Nathan Rajlich
e80247fb99 Update to latest version of patrickedqvist/wait-for-vercel-preview (#10008)
The older version we were using is using Node 12, and GH Actions prints this warning:

> Node.js 12 actions are deprecated. Please update the following actions to use Node.js 16: patrickedqvist/wait-for-vercel-preview@ae34b392ef. For more information see: https://github.blog/changelog/2022-09-22-github-actions-all-actions-will-begin-running-on-node16-instead-of-node12/.

The current version of this action uses Node 16.
2023-05-23 15:01:18 +00:00
Samuel Bodin
a19edc985b [cli] Fix vercel git connect command when passing a URL parameter (#9967)
Hey team,

I had an error this morning when trying to link my repo using the CLI 
![Screenshot 2023-05-17 at 11 38 01](https://github.com/vercel/vercel/assets/1637651/798d6e4f-8c9e-41b7-b712-0322001fca02)


Seems like a combination of `: any` and a recent refacto introduced an issue here.

~- Removed all `any` that were hiding the error~
- Correctly pass the URL already parsed

~- Removed the second useless parsing~
~- Added missing `--help` flag~
  ~I noticed you never specify them and Typescript screams because of that, not sure if on purpose and how you make the compilation pass with this error. Don't hesitate to tell me.~

The fix could be improved by using `arg.Result<THE_ACTUAL_TYPE>` but that would require to store the dictionnary of flags somewhere else and also create an external type. This is already better so...

--- 

NB: 
I had multiple issues while cloning this repo
- pnpm bootstrap does not work
- missing `constants.ts` file that is not explained in the Contributing guidelines
- maybe due to bootstrap not working, almost nothing else worked and the tests too.
2023-05-23 02:50:42 +00:00
Nathan Rajlich
4fd593ac09 Sync repo package versions (#10002)
Some of these packages got out of sync at some point, causing duplicate
/ older copies to be installed. Additionally, the `@vercel-internal`
packages should have "version" fields.

Attempting to fix these
[warnings](https://github.com/vercel/vercel/actions/runs/5048844603/jobs/9057538600)
during release:

```
Package "examples" must depend on the current version of "@vercel/frameworks": "1.4.2" vs "1.3.0"
Package "@vercel-internals/constants" must depend on the current version of "@vercel/build-utils": "6.7.3" vs "6.3.2"
Package "@vercel-internals/constants" must depend on the current version of "@vercel/routing-utils": "2.2.1" vs "2.1.10"
Package "@vercel-internals/constants" must depend on the current version of "@vercel-internals/tsconfig": "undefined" vs "*"
Package "@vercel-internals/get-package-json" must depend on the current version of "@vercel-internals/tsconfig": "undefined" vs "*"
Package "@vercel-internals/types" must depend on the current version of "@vercel-internals/constants": "undefined" vs "*"
Package "@vercel-internals/types" must depend on the current version of "@vercel/build-utils": "6.7.3" vs "6.3.2"
Package "@vercel-internals/types" must depend on the current version of "@vercel/routing-utils": "2.2.1" vs "2.1.10"
Package "@vercel-internals/types" must depend on the current version of "@vercel-internals/tsconfig": "undefined" vs "*"
Package "vercel" must depend on the current version of "@vercel-internals/constants": "undefined" vs "*"
Package "vercel" must depend on the current version of "@vercel-internals/get-package-json": "undefined" vs "*"
Package "vercel" must depend on the current version of "@vercel-internals/types": "undefined" vs "*"
Package "@vercel/node" must depend on the current version of "@vercel/error-utils": "1.0.10" vs "1.0.8"
```
2023-05-22 15:26:36 -07:00
Dan Stowell
1b0d72aba5 [cli] Change vc env pull default output file to .env.local (#9892)
`vc deploy` ignores `.env.local`. To make sure we don't inadvertently
push people's secrets to source control, have all environment pulls
default to writing to `.env.local`.
2023-05-22 15:24:38 -07:00
Nathan Rajlich
c52a59809e Remove pnpm bootstrap from contributing instructions (#10005)
This script no longer exists.
2023-05-22 22:16:47 +00:00
Chris Barber
cdf55b3b1a [cli] New vc redeploy command (#9956)
This adds a new `vc redeploy <url-or-id>` command. It fetches the requested deployment, then performs a redeploy with similar output to `vc deploy` including the ability to pipe the deployment URL into a file or program.

### Redeploy Example:

<img width="650" alt="image" src="https://github.com/vercel/vercel/assets/97262/b17fc424-558b-415c-8b74-63e450f4b753">

### Bad deployment URL:

<img width="579" alt="image" src="https://github.com/vercel/vercel/assets/97262/0cb53209-396e-4490-b5d0-744d5d870aaf">

### No args:

<img width="622" alt="image" src="https://github.com/vercel/vercel/assets/97262/cb36d625-991b-41fa-bb49-d7d36c1a201b">

Linear: https://linear.app/vercel/issue/VCCLI-558/cli-new-command-to-redeploy
2023-05-22 22:08:49 +00:00
Nathan Rajlich
8de42e0a70 [cli] Remove --platform-version global common arg (#9807)
Removes the unused `--platform-version` flag from the common args.

Technically this is a breaking change, so we should probably hold off on merging until we plan to do a major version bump.
2023-05-22 21:44:52 +00:00
Swarnava Sengupta
7ff321310f [examples] Update "vue" template to use Node 18 (#10001) 2023-05-22 11:56:21 -07:00
Nathan Rajlich
2da72bc5e4 Fix promoting CLI release to "latest" GH Release (#10003)
The logic to retrieve the latest release was not working correctly, so use the `getLatestRelease()` function instead of assuming that `release[0]` is tagged as the latest.
2023-05-22 18:49:51 +00:00
Vercel Release Bot
46950633f4 Version Packages (#9994) 2023-05-22 10:47:47 -07:00
Vercel Release Bot
44b1dfe7c5 [tests] Upgrade Turbo to version 1.9.8 (#9996)
This auto-generated PR updates Turbo to version 1.9.8
2023-05-22 08:50:23 +00:00
Vercel Release Bot
0278c7b7b9 [examples] Upgrade Next.js to version 13.4.3 (#9980)
This auto-generated PR updates Next.js to version 13.4.3
2023-05-19 21:08:38 +00:00
Sean Massa
761db597be clarify next.js dupe api directory warning (#9979)
In a Next.js app, if you have Node.js Functions in both `api` and `pages/api`, you'll get a warning about moving those `api` functions into `pages/api`. This does specify Node.js Functions already, but a user was confused and tried to move their non-Node.js functions into `pages/api` as well.

This PR tries to make it clearer that you can do both. Note that this still requires a non-ideal local dev setup where you:

- update next config to fall back to the `vc dev` port for `api` handlers
- run `next dev` for the Next.js app on one port
- run `vc dev` for the top-level `api` Functions on another port

---

Example repo: https://github.com/rexfordessilfie/vercel-api-languages
2023-05-19 19:31:32 +00:00
Nathan Rajlich
671e63e7b8 [cli] Add vc link --repo flag (alpha) (#8931)
Adding a new `--repo` flag to `vc link` which is a new linking style to
link to a Git URL rather then directly to a single Vercel Project. This
allows for multiple Projects to be linked simultaneously, which is
useful for monorepo setups.

Utilization of this new linking style in other commands will be done in
a follow-up PR.
2023-05-19 11:53:49 -07:00
149 changed files with 13432 additions and 13351 deletions

View File

@@ -15,7 +15,6 @@ git clone https://github.com/vercel/vercel
cd vercel
corepack enable
pnpm install
pnpm bootstrap
pnpm build
pnpm lint
pnpm test-unit

View File

@@ -23,6 +23,9 @@ jobs:
- name: Checkout Repo
uses: actions/checkout@v3
- name: Fetch git tags
run: git fetch origin 'refs/tags/*:refs/tags/*'
- name: Setup Node
uses: actions/setup-node@v3
with:
@@ -47,8 +50,8 @@ jobs:
id: changesets
uses: changesets/action@v1
with:
version: pnpm version:prepare
publish: pnpm release
version: pnpm ci:version
publish: pnpm ci:publish
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN_PULL_REQUESTS }}
NPM_CONFIG_PROVENANCE: 'true'
@@ -56,15 +59,6 @@ jobs:
GA_TRACKING_ID: ${{ secrets.GA_TRACKING_ID }}
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
- name: Set latest Release to `vercel` (if a Publish Happened)
if: steps.changesets.outputs.published == 'true'
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GH_TOKEN_PULL_REQUESTS }}
script: |
const script = require('./utils/update-latest-release.js')
await script({ github, context })
- name: Trigger Update (if a Publish Happened)
if: steps.changesets.outputs.published == 'true'
uses: actions/github-script@v6
@@ -73,3 +67,12 @@ jobs:
script: |
const script = require('./utils/trigger-update-workflow.js')
await script({ github, context })
- name: Set latest Release to `vercel` (if a Publish Happened)
if: steps.changesets.outputs.published == 'true'
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GH_TOKEN_PULL_REQUESTS }}
script: |
const script = require('./utils/update-latest-release.js')
await script({ github, context })

View File

@@ -41,7 +41,7 @@ jobs:
echo "Files to test:"
echo "$TESTS_ARRAY"
echo "tests=$TESTS_ARRAY" >> $GITHUB_OUTPUT
- uses: patrickedqvist/wait-for-vercel-preview@ae34b392ef30297f2b672f9afb3c329bde9bd487
- uses: patrickedqvist/wait-for-vercel-preview@bfdff514ff78a669f2536e9f4dd4ef5813a704a2
id: waitForTarball
with:
token: ${{ secrets.GITHUB_TOKEN }}
@@ -97,11 +97,21 @@ jobs:
if: matrix.runner != 'windows-latest'
run: echo | openssl s_client -showcerts -servername 'api.vercel.com' -connect 76.76.21.21:443
conclusion:
summary:
name: Summary
runs-on: ubuntu-latest
timeout-minutes: 5
if: always()
needs:
- test
runs-on: ubuntu-latest
name: E2E
steps:
- name: Done
run: echo "Done."
- name: Check All
run: |-
for status in ${{ join(needs.*.result, ' ') }}
do
if [ "$status" != "success" ] && [ "$status" != "skipped" ]
then
echo "Some checks failed"
exit 1
fi
done

View File

@@ -4,7 +4,7 @@
You ran `vercel dev` inside a project that contains a `vercel.json` file with `env` or `build.env` properties that use [Vercel Secrets](https://vercel.com/docs/concepts/projects/environment-variables).
In order to use environment variables in your project locally that have values defined using the Vercel Secrets format (e.g. `@my-secret-value`), you will need to provide the value as an environment variable using a `.env`.
In order to use environment variables in your project locally that have values defined using the Vercel Secrets format (e.g. `@my-secret-value`), you will need to provide the value as an environment variable using a `.env.local`.
We require this to ensure your app works as you intend it to, in the development environment, and to provide you with a way to mirror or separate private environment variables within your applications, for example when connecting to a database.
@@ -12,11 +12,11 @@ Read below for how to address this error.
#### Possible Ways to Fix It
The error message will list environment variables that are required and which file they are required to be included in `.env`.
The error message will list environment variables that are required and which file they are required to be included in `.env.local`.
If the file does not exist yet, please create the file that the error message mentions and insert the missing environment variable into it.
For example, if the error message shows that the environment variable `TEST` is missing from `.env`, then the `.env` file should look like this:
For example, if the error message shows that the environment variable `TEST` is missing from `.env.local`, then the `.env.local` file should look like this:
```
TEST=value

View File

@@ -8,9 +8,9 @@
"name": "nextjs",
"version": "0.1.0",
"dependencies": {
"eslint": "8.40.0",
"eslint-config-next": "13.4.2",
"next": "13.4.2",
"eslint": "8.41.0",
"eslint-config-next": "13.4.4",
"next": "13.4.4",
"react": "18.2.0",
"react-dom": "18.2.0"
}
@@ -71,9 +71,9 @@
}
},
"node_modules/@eslint/js": {
"version": "8.40.0",
"resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.40.0.tgz",
"integrity": "sha512-ElyB54bJIhXQYVKjDSvCkPO1iU1tSAeVQJbllWJq1XQSmmA4dgFk8CbiBGpiOPxleE48vDogxCtmMYku4HSVLA==",
"version": "8.41.0",
"resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.41.0.tgz",
"integrity": "sha512-LxcyMGxwmTh2lY9FwHPGWOHmYFCZvbrFCBZL4FzSSsxsRPuhrYUg/49/0KDfW8tnIEaEHtfmn6+NPN+1DqaNmA==",
"engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
}
@@ -109,22 +109,22 @@
"integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA=="
},
"node_modules/@next/env": {
"version": "13.4.2",
"resolved": "https://registry.npmjs.org/@next/env/-/env-13.4.2.tgz",
"integrity": "sha512-Wqvo7lDeS0KGwtwg9TT9wKQ8raelmUxt+TQKWvG/xKfcmDXNOtCuaszcfCF8JzlBG1q0VhpI6CKaRMbVPMDWgw=="
"version": "13.4.4",
"resolved": "https://registry.npmjs.org/@next/env/-/env-13.4.4.tgz",
"integrity": "sha512-q/y7VZj/9YpgzDe64Zi6rY1xPizx80JjlU2BTevlajtaE3w1LqweH1gGgxou2N7hdFosXHjGrI4OUvtFXXhGLg=="
},
"node_modules/@next/eslint-plugin-next": {
"version": "13.4.2",
"resolved": "https://registry.npmjs.org/@next/eslint-plugin-next/-/eslint-plugin-next-13.4.2.tgz",
"integrity": "sha512-ZeFWgrxwckxTpYM+ANeUL9E7LOGPbZKmI94LJIjbDU69iEIgqd4WD0l2pVbOJMr/+vgoZmJ9Dx1m0WJ7WScXHA==",
"version": "13.4.4",
"resolved": "https://registry.npmjs.org/@next/eslint-plugin-next/-/eslint-plugin-next-13.4.4.tgz",
"integrity": "sha512-5jnh7q6I15efnjR/rR+/TGTc9hn53g3JTbEjAMjmeQiExKqEUgIXqrHI5zlTNlNyzCPkBB860/ctxXheZaF2Vw==",
"dependencies": {
"glob": "7.1.7"
}
},
"node_modules/@next/swc-darwin-arm64": {
"version": "13.4.2",
"resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-13.4.2.tgz",
"integrity": "sha512-6BBlqGu3ewgJflv9iLCwO1v1hqlecaIH2AotpKfVUEzUxuuDNJQZ2a4KLb4MBl8T9/vca1YuWhSqtbF6ZuUJJw==",
"version": "13.4.4",
"resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-13.4.4.tgz",
"integrity": "sha512-xfjgXvp4KalNUKZMHmsFxr1Ug+aGmmO6NWP0uoh4G3WFqP/mJ1xxfww0gMOeMeSq/Jyr5k7DvoZ2Pv+XOITTtw==",
"cpu": [
"arm64"
],
@@ -137,9 +137,9 @@
}
},
"node_modules/@next/swc-darwin-x64": {
"version": "13.4.2",
"resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-13.4.2.tgz",
"integrity": "sha512-iZuYr7ZvGLPjPmfhhMl0ISm+z8EiyLBC1bLyFwGBxkWmPXqdJ60mzuTaDSr5WezDwv0fz32HB7JHmRC6JVHSZg==",
"version": "13.4.4",
"resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-13.4.4.tgz",
"integrity": "sha512-ZY9Ti1hkIwJsxGus3nlubIkvYyB0gNOYxKrfsOrLEqD0I2iCX8D7w8v6QQZ2H+dDl6UT29oeEUdDUNGk4UEpfg==",
"cpu": [
"x64"
],
@@ -152,9 +152,9 @@
}
},
"node_modules/@next/swc-linux-arm64-gnu": {
"version": "13.4.2",
"resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-13.4.2.tgz",
"integrity": "sha512-2xVabFtIge6BJTcJrW8YuUnYTuQjh4jEuRuS2mscyNVOj6zUZkom3CQg+egKOoS+zh2rrro66ffSKIS+ztFJTg==",
"version": "13.4.4",
"resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-13.4.4.tgz",
"integrity": "sha512-+KZnDeMShYkpkqAvGCEDeqYTRADJXc6SY1jWXz+Uo6qWQO/Jd9CoyhTJwRSxvQA16MoYzvILkGaDqirkRNctyA==",
"cpu": [
"arm64"
],
@@ -167,9 +167,9 @@
}
},
"node_modules/@next/swc-linux-arm64-musl": {
"version": "13.4.2",
"resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-13.4.2.tgz",
"integrity": "sha512-wKRCQ27xCUJx5d6IivfjYGq8oVngqIhlhSAJntgXLt7Uo9sRT/3EppMHqUZRfyuNBTbykEre1s5166z+pvRB5A==",
"version": "13.4.4",
"resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-13.4.4.tgz",
"integrity": "sha512-evC1twrny2XDT4uOftoubZvW3EG0zs0ZxMwEtu/dDGVRO5n5pT48S8qqEIBGBUZYu/Xx4zzpOkIxx1vpWdE+9A==",
"cpu": [
"arm64"
],
@@ -182,9 +182,9 @@
}
},
"node_modules/@next/swc-linux-x64-gnu": {
"version": "13.4.2",
"resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-13.4.2.tgz",
"integrity": "sha512-NpCa+UVhhuNeaFVUP1Bftm0uqtvLWq2JTm7+Ta48+2Uqj2mNXrDIvyn1DY/ZEfmW/1yvGBRaUAv9zkMkMRixQA==",
"version": "13.4.4",
"resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-13.4.4.tgz",
"integrity": "sha512-PX706XcCHr2FfkyhP2lpf+pX/tUvq6/ke7JYnnr0ykNdEMo+sb7cC/o91gnURh4sPYSiZJhsF2gbIqg9rciOHQ==",
"cpu": [
"x64"
],
@@ -197,9 +197,9 @@
}
},
"node_modules/@next/swc-linux-x64-musl": {
"version": "13.4.2",
"resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-13.4.2.tgz",
"integrity": "sha512-ZWVC72x0lW4aj44e3khvBrj2oSYj1bD0jESmyah3zG/3DplEy/FOtYkMzbMjHTdDSheso7zH8GIlW6CDQnKhmQ==",
"version": "13.4.4",
"resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-13.4.4.tgz",
"integrity": "sha512-TKUUx3Ftd95JlHV6XagEnqpT204Y+IsEa3awaYIjayn0MOGjgKZMZibqarK3B1FsMSPaieJf2FEAcu9z0yT5aA==",
"cpu": [
"x64"
],
@@ -212,9 +212,9 @@
}
},
"node_modules/@next/swc-win32-arm64-msvc": {
"version": "13.4.2",
"resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-13.4.2.tgz",
"integrity": "sha512-pLT+OWYpzJig5K4VKhLttlIfBcVZfr2+Xbjra0Tjs83NQSkFS+y7xx+YhCwvpEmXYLIvaggj2ONPyjbiigOvHQ==",
"version": "13.4.4",
"resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-13.4.4.tgz",
"integrity": "sha512-FP8AadgSq4+HPtim7WBkCMGbhr5vh9FePXiWx9+YOdjwdQocwoCK5ZVC3OW8oh3TWth6iJ0AXJ/yQ1q1cwSZ3A==",
"cpu": [
"arm64"
],
@@ -227,9 +227,9 @@
}
},
"node_modules/@next/swc-win32-ia32-msvc": {
"version": "13.4.2",
"resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-13.4.2.tgz",
"integrity": "sha512-dhpiksQCyGca4WY0fJyzK3FxMDFoqMb0Cn+uDB+9GYjpU2K5//UGPQlCwiK4JHxuhg8oLMag5Nf3/IPSJNG8jw==",
"version": "13.4.4",
"resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-13.4.4.tgz",
"integrity": "sha512-3WekVmtuA2MCdcAOrgrI+PuFiFURtSyyrN1I3UPtS0ckR2HtLqyqmS334Eulf15g1/bdwMteePdK363X/Y9JMg==",
"cpu": [
"ia32"
],
@@ -242,9 +242,9 @@
}
},
"node_modules/@next/swc-win32-x64-msvc": {
"version": "13.4.2",
"resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-13.4.2.tgz",
"integrity": "sha512-O7bort1Vld00cu8g0jHZq3cbSTUNMohOEvYqsqE10+yfohhdPHzvzO+ziJRz4Dyyr/fYKREwS7gR4JC0soSOMw==",
"version": "13.4.4",
"resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-13.4.4.tgz",
"integrity": "sha512-AHRITu/CrlQ+qzoqQtEMfaTu7GHaQ6bziQln/pVWpOYC1wU+Mq6VQQFlsDtMCnDztPZtppAXdvvbNS7pcfRzlw==",
"cpu": [
"x64"
],
@@ -289,9 +289,9 @@
}
},
"node_modules/@pkgr/utils": {
"version": "2.4.0",
"resolved": "https://registry.npmjs.org/@pkgr/utils/-/utils-2.4.0.tgz",
"integrity": "sha512-2OCURAmRtdlL8iUDTypMrrxfwe8frXTeXaxGsVOaYtc/wrUyk8Z/0OBetM7cdlsy7ZFWlMX72VogKeh+A4Xcjw==",
"version": "2.4.1",
"resolved": "https://registry.npmjs.org/@pkgr/utils/-/utils-2.4.1.tgz",
"integrity": "sha512-JOqwkgFEyi+OROIyq7l4Jy28h/WwhDnG/cPkXG2Z1iFbubB6jsHW1NDvmyOzTBxHr3yg68YGirmh1JUgMqa+9w==",
"dependencies": {
"cross-spawn": "^7.0.3",
"fast-glob": "^3.2.12",
@@ -308,9 +308,9 @@
}
},
"node_modules/@rushstack/eslint-patch": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/@rushstack/eslint-patch/-/eslint-patch-1.2.0.tgz",
"integrity": "sha512-sXo/qW2/pAcmT43VoRKOJbDOfV3cYpq3szSVfIThQXNt+E4DfKj361vaAt3c88U5tPUxzEswam7GW48PJqtKAg=="
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/@rushstack/eslint-patch/-/eslint-patch-1.3.0.tgz",
"integrity": "sha512-IthPJsJR85GhOkp3Hvp8zFOPK5ynKn6STyHa/WZpioK7E1aYDiBzpqQPrngc14DszIUkIrdd3k9Iu0XSzlP/1w=="
},
"node_modules/@swc/helpers": {
"version": "0.5.1",
@@ -326,13 +326,13 @@
"integrity": "sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ=="
},
"node_modules/@typescript-eslint/parser": {
"version": "5.59.5",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.59.5.tgz",
"integrity": "sha512-NJXQC4MRnF9N9yWqQE2/KLRSOLvrrlZb48NGVfBa+RuPMN6B7ZcK5jZOvhuygv4D64fRKnZI4L4p8+M+rfeQuw==",
"version": "5.59.7",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.59.7.tgz",
"integrity": "sha512-VhpsIEuq/8i5SF+mPg9jSdIwgMBBp0z9XqjiEay+81PYLJuroN+ET1hM5IhkiYMJd9MkTz8iJLt7aaGAgzWUbQ==",
"dependencies": {
"@typescript-eslint/scope-manager": "5.59.5",
"@typescript-eslint/types": "5.59.5",
"@typescript-eslint/typescript-estree": "5.59.5",
"@typescript-eslint/scope-manager": "5.59.7",
"@typescript-eslint/types": "5.59.7",
"@typescript-eslint/typescript-estree": "5.59.7",
"debug": "^4.3.4"
},
"engines": {
@@ -352,12 +352,12 @@
}
},
"node_modules/@typescript-eslint/scope-manager": {
"version": "5.59.5",
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.59.5.tgz",
"integrity": "sha512-jVecWwnkX6ZgutF+DovbBJirZcAxgxC0EOHYt/niMROf8p4PwxxG32Qdhj/iIQQIuOflLjNkxoXyArkcIP7C3A==",
"version": "5.59.7",
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.59.7.tgz",
"integrity": "sha512-FL6hkYWK9zBGdxT2wWEd2W8ocXMu3K94i3gvMrjXpx+koFYdYV7KprKfirpgY34vTGzEPPuKoERpP8kD5h7vZQ==",
"dependencies": {
"@typescript-eslint/types": "5.59.5",
"@typescript-eslint/visitor-keys": "5.59.5"
"@typescript-eslint/types": "5.59.7",
"@typescript-eslint/visitor-keys": "5.59.7"
},
"engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
@@ -368,9 +368,9 @@
}
},
"node_modules/@typescript-eslint/types": {
"version": "5.59.5",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.59.5.tgz",
"integrity": "sha512-xkfRPHbqSH4Ggx4eHRIO/eGL8XL4Ysb4woL8c87YuAo8Md7AUjyWKa9YMwTL519SyDPrfEgKdewjkxNCVeJW7w==",
"version": "5.59.7",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.59.7.tgz",
"integrity": "sha512-UnVS2MRRg6p7xOSATscWkKjlf/NDKuqo5TdbWck6rIRZbmKpVNTLALzNvcjIfHBE7736kZOFc/4Z3VcZwuOM/A==",
"engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
},
@@ -380,12 +380,12 @@
}
},
"node_modules/@typescript-eslint/typescript-estree": {
"version": "5.59.5",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.59.5.tgz",
"integrity": "sha512-+XXdLN2CZLZcD/mO7mQtJMvCkzRfmODbeSKuMY/yXbGkzvA9rJyDY5qDYNoiz2kP/dmyAxXquL2BvLQLJFPQIg==",
"version": "5.59.7",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.59.7.tgz",
"integrity": "sha512-4A1NtZ1I3wMN2UGDkU9HMBL+TIQfbrh4uS0WDMMpf3xMRursDbqEf1ahh6vAAe3mObt8k3ZATnezwG4pdtWuUQ==",
"dependencies": {
"@typescript-eslint/types": "5.59.5",
"@typescript-eslint/visitor-keys": "5.59.5",
"@typescript-eslint/types": "5.59.7",
"@typescript-eslint/visitor-keys": "5.59.7",
"debug": "^4.3.4",
"globby": "^11.1.0",
"is-glob": "^4.0.3",
@@ -406,11 +406,11 @@
}
},
"node_modules/@typescript-eslint/visitor-keys": {
"version": "5.59.5",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.59.5.tgz",
"integrity": "sha512-qL+Oz+dbeBRTeyJTIy0eniD3uvqU7x+y1QceBismZ41hd4aBSRh8UAw4pZP0+XzLuPZmx4raNMq/I+59W2lXKA==",
"version": "5.59.7",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.59.7.tgz",
"integrity": "sha512-tyN+X2jvMslUszIiYbF0ZleP+RqQsFVpGrKI6e0Eet1w8WmhsAtmzaqm8oM8WJQ1ysLwhnsK/4hYHJjOgJVfQQ==",
"dependencies": {
"@typescript-eslint/types": "5.59.5",
"@typescript-eslint/types": "5.59.7",
"eslint-visitor-keys": "^3.3.0"
},
"engines": {
@@ -591,9 +591,9 @@
}
},
"node_modules/axe-core": {
"version": "4.7.0",
"resolved": "https://registry.npmjs.org/axe-core/-/axe-core-4.7.0.tgz",
"integrity": "sha512-M0JtH+hlOL5pLQwHOLNYZaXuhqmvS8oExsqB1SBYgA4Dk7u/xx+YdGHXaK5pyUfed5mYXdlYiphWq3G8cRi5JQ==",
"version": "4.7.2",
"resolved": "https://registry.npmjs.org/axe-core/-/axe-core-4.7.2.tgz",
"integrity": "sha512-zIURGIS1E1Q4pcrMjp+nnEh+16G56eG/MUllJH8yEvw7asDo7Ac9uhC9KIH5jzpITueEZolfYglnCGIuSBz39g==",
"engines": {
"node": ">=4"
}
@@ -696,9 +696,9 @@
}
},
"node_modules/caniuse-lite": {
"version": "1.0.30001486",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001486.tgz",
"integrity": "sha512-uv7/gXuHi10Whlj0pp5q/tsK/32J2QSqVRKQhs2j8VsDCjgyruAh/eEXHF822VqO9yT6iZKw3nRwZRSPBE9OQg==",
"version": "1.0.30001489",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001489.tgz",
"integrity": "sha512-x1mgZEXK8jHIfAxm+xgdpHpk50IN3z3q3zP261/WS+uvePxW8izXuCu6AHz0lkuYTlATDehiZ/tNyYBdSQsOUQ==",
"funding": [
{
"type": "opencollective",
@@ -908,9 +908,9 @@
"integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg=="
},
"node_modules/enhanced-resolve": {
"version": "5.14.0",
"resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.14.0.tgz",
"integrity": "sha512-+DCows0XNwLDcUhbFJPdlQEVnT2zXlCv7hPxemTz86/O+B/hCQ+mb7ydkPKiflpVraqLPCAfu7lDy+hBXueojw==",
"version": "5.14.1",
"resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.14.1.tgz",
"integrity": "sha512-Vklwq2vDKtl0y/vtwjSesgJ5MYS7Etuk5txS8VdKL4AOS1aUlD96zqIfsOSLQsdv3xgMRbtkWM8eG9XDfKUPow==",
"dependencies": {
"graceful-fs": "^4.2.4",
"tapable": "^2.2.0"
@@ -1034,14 +1034,14 @@
}
},
"node_modules/eslint": {
"version": "8.40.0",
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.40.0.tgz",
"integrity": "sha512-bvR+TsP9EHL3TqNtj9sCNJVAFK3fBN8Q7g5waghxyRsPLIMwL73XSKnZFK0hk/O2ANC+iAoq6PWMQ+IfBAJIiQ==",
"version": "8.41.0",
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.41.0.tgz",
"integrity": "sha512-WQDQpzGBOP5IrXPo4Hc0814r4/v2rrIsB0rhT7jtunIalgg6gYXWhRMOejVO8yH21T/FGaxjmFjBMNqcIlmH1Q==",
"dependencies": {
"@eslint-community/eslint-utils": "^4.2.0",
"@eslint-community/regexpp": "^4.4.0",
"@eslint/eslintrc": "^2.0.3",
"@eslint/js": "8.40.0",
"@eslint/js": "8.41.0",
"@humanwhocodes/config-array": "^0.11.8",
"@humanwhocodes/module-importer": "^1.0.1",
"@nodelib/fs.walk": "^1.2.8",
@@ -1061,13 +1061,12 @@
"find-up": "^5.0.0",
"glob-parent": "^6.0.2",
"globals": "^13.19.0",
"grapheme-splitter": "^1.0.4",
"graphemer": "^1.4.0",
"ignore": "^5.2.0",
"import-fresh": "^3.0.0",
"imurmurhash": "^0.1.4",
"is-glob": "^4.0.0",
"is-path-inside": "^3.0.3",
"js-sdsl": "^4.1.4",
"js-yaml": "^4.1.0",
"json-stable-stringify-without-jsonify": "^1.0.1",
"levn": "^0.4.1",
@@ -1090,11 +1089,11 @@
}
},
"node_modules/eslint-config-next": {
"version": "13.4.2",
"resolved": "https://registry.npmjs.org/eslint-config-next/-/eslint-config-next-13.4.2.tgz",
"integrity": "sha512-zjLJ9B9bbeWSo5q+iHfdt8gVYyT+y2BpWDfjR6XMBtFRSMKRGjllDKxnuKBV1q2Y/QpwLM2PXHJTMRyblCmRAg==",
"version": "13.4.4",
"resolved": "https://registry.npmjs.org/eslint-config-next/-/eslint-config-next-13.4.4.tgz",
"integrity": "sha512-z/PMbm6L0iC/fwISULxe8IVy4DtNqZk2wQY711o35klenq70O6ns82A8yuMVCFjHC0DIyB2lyugesRtuk9u8dQ==",
"dependencies": {
"@next/eslint-plugin-next": "13.4.2",
"@next/eslint-plugin-next": "13.4.4",
"@rushstack/eslint-patch": "^1.1.3",
"@typescript-eslint/parser": "^5.42.0",
"eslint-import-resolver-node": "^0.3.6",
@@ -1625,12 +1624,13 @@
}
},
"node_modules/get-intrinsic": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.0.tgz",
"integrity": "sha512-L049y6nFOuom5wGyRc3/gdTLO94dySVKRACj1RmJZBQXlbTMhtNIgkWkUHq+jYmZvKf14EW1EoJnnjbmoHij0Q==",
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.1.tgz",
"integrity": "sha512-2DcsyfABl+gVHEfCOaTrWgyt+tb6MSEGmKq+kI5HwLbIYgjgmMcV8KQ41uaKz1xxUcn9tJtgFbQUEVcEbd0FYw==",
"dependencies": {
"function-bind": "^1.1.1",
"has": "^1.0.3",
"has-proto": "^1.0.1",
"has-symbols": "^1.0.3"
},
"funding": {
@@ -1764,10 +1764,10 @@
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz",
"integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ=="
},
"node_modules/grapheme-splitter": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/grapheme-splitter/-/grapheme-splitter-1.0.4.tgz",
"integrity": "sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ=="
"node_modules/graphemer": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz",
"integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag=="
},
"node_modules/has": {
"version": "1.0.3",
@@ -1975,9 +1975,9 @@
}
},
"node_modules/is-core-module": {
"version": "2.12.0",
"resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.12.0.tgz",
"integrity": "sha512-RECHCBCd/viahWmwj6enj19sKbHfJrddi/6cBDsNTKbNq0f7VeaUkBo60BqzvPqo/W54ChS62Z5qyun7cfOMqQ==",
"version": "2.12.1",
"resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.12.1.tgz",
"integrity": "sha512-Q4ZuBAe2FUsKtyQJoQHlvP8OvBERxO3jEmy1I7hcRXcJBGGHFh/aJBswbXuS9sgrDH2QUO8ilkwNPHvHMd8clg==",
"dependencies": {
"has": "^1.0.3"
},
@@ -2255,15 +2255,6 @@
"resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
"integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw=="
},
"node_modules/js-sdsl": {
"version": "4.4.0",
"resolved": "https://registry.npmjs.org/js-sdsl/-/js-sdsl-4.4.0.tgz",
"integrity": "sha512-FfVSdx6pJ41Oa+CF7RDaFmTnCaFhua+SNYQX74riGOpl96x+2jQCqEfQ2bnXu/5DPCqlRuiqyvTJM0Qjz26IVg==",
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/js-sdsl"
}
},
"node_modules/js-tokens": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
@@ -2462,11 +2453,11 @@
"integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw=="
},
"node_modules/next": {
"version": "13.4.2",
"resolved": "https://registry.npmjs.org/next/-/next-13.4.2.tgz",
"integrity": "sha512-aNFqLs3a3nTGvLWlO9SUhCuMUHVPSFQC0+tDNGAsDXqx+WJDFSbvc233gOJ5H19SBc7nw36A9LwQepOJ2u/8Kg==",
"version": "13.4.4",
"resolved": "https://registry.npmjs.org/next/-/next-13.4.4.tgz",
"integrity": "sha512-C5S0ysM0Ily9McL4Jb48nOQHT1BukOWI59uC3X/xCMlYIh9rJZCv7nzG92J6e1cOBqQbKovlpgvHWFmz4eKKEA==",
"dependencies": {
"@next/env": "13.4.2",
"@next/env": "13.4.4",
"@swc/helpers": "0.5.1",
"busboy": "1.6.0",
"caniuse-lite": "^1.0.30001406",
@@ -2481,20 +2472,19 @@
"node": ">=16.8.0"
},
"optionalDependencies": {
"@next/swc-darwin-arm64": "13.4.2",
"@next/swc-darwin-x64": "13.4.2",
"@next/swc-linux-arm64-gnu": "13.4.2",
"@next/swc-linux-arm64-musl": "13.4.2",
"@next/swc-linux-x64-gnu": "13.4.2",
"@next/swc-linux-x64-musl": "13.4.2",
"@next/swc-win32-arm64-msvc": "13.4.2",
"@next/swc-win32-ia32-msvc": "13.4.2",
"@next/swc-win32-x64-msvc": "13.4.2"
"@next/swc-darwin-arm64": "13.4.4",
"@next/swc-darwin-x64": "13.4.4",
"@next/swc-linux-arm64-gnu": "13.4.4",
"@next/swc-linux-arm64-musl": "13.4.4",
"@next/swc-linux-x64-gnu": "13.4.4",
"@next/swc-linux-x64-musl": "13.4.4",
"@next/swc-win32-arm64-msvc": "13.4.4",
"@next/swc-win32-ia32-msvc": "13.4.4",
"@next/swc-win32-x64-msvc": "13.4.4"
},
"peerDependencies": {
"@opentelemetry/api": "^1.1.0",
"fibers": ">= 3.1.0",
"node-sass": "^6.0.0 || ^7.0.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"sass": "^1.3.0"
@@ -2506,9 +2496,6 @@
"fibers": {
"optional": true
},
"node-sass": {
"optional": true
},
"sass": {
"optional": true
}
@@ -3103,9 +3090,9 @@
}
},
"node_modules/semver": {
"version": "7.5.0",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.5.0.tgz",
"integrity": "sha512-+XC0AD/R7Q2mPSRuy2Id0+CGTZ98+8f+KvwirxOKIEyid+XSx6HbC63p+O4IndTHuX5Z+JxQ0TghCkO5Cg/2HA==",
"version": "7.5.1",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.5.1.tgz",
"integrity": "sha512-Wvss5ivl8TMRZXXESstBA4uR5iXgEN/VC5/sOcuXdVLzcdkz4HWetIoRfG5gb5X+ij/G9rw9YoGn3QoQ8OCSpw==",
"dependencies": {
"lru-cache": "^6.0.0"
},
@@ -3395,9 +3382,9 @@
}
},
"node_modules/tslib": {
"version": "2.5.0",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.5.0.tgz",
"integrity": "sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg=="
"version": "2.5.2",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.5.2.tgz",
"integrity": "sha512-5svOrSA2w3iGFDs1HibEVBGbDrAY82bFQ3HZ3ixB+88nsbsWQoKqDRb5UBYAUPEzbBn6dAp5gRNXglySbx1MlA=="
},
"node_modules/tsutils": {
"version": "3.21.0",

View File

@@ -9,9 +9,9 @@
"lint": "next lint"
},
"dependencies": {
"eslint": "8.40.0",
"eslint-config-next": "13.4.2",
"next": "13.4.2",
"eslint": "8.41.0",
"eslint-config-next": "13.4.4",
"next": "13.4.4",
"react": "18.2.0",
"react-dom": "18.2.0"
}

View File

@@ -9,6 +9,6 @@
},
"devDependencies": {
"@types/jest": "27.4.1",
"@vercel/frameworks": "1.3.0"
"@vercel/frameworks": "1.4.2"
}
}

View File

@@ -1,14 +1,14 @@
{
"private": true,
"scripts": {
"build": "preact build",
"build": "NODE_OPTIONS=--openssl-legacy-provider preact build",
"serve": "sirv build --port 8080 --cors --single",
"dev": "preact watch",
"lint": "eslint src",
"test": "jest"
},
"engines": {
"node": "16.x"
"node": "18.x"
},
"eslintConfig": {
"extends": "preact",
@@ -17,19 +17,19 @@
]
},
"devDependencies": {
"enzyme": "^3.10.0",
"enzyme-adapter-preact-pure": "^2.0.0",
"eslint": "^6.0.1",
"eslint-config-preact": "^1.1.0",
"jest": "^24.9.0",
"jest-preset-preact": "^1.0.0",
"preact-cli": "^3.0.0",
"sirv-cli": "1.0.3"
"enzyme": "^3.11.0",
"enzyme-adapter-preact-pure": "^4.1.0",
"eslint": "^8.41.0",
"eslint-config-preact": "^1.3.0",
"jest": "^29.5.0",
"jest-preset-preact": "^4.0.4",
"preact-cli": "^3.4.5",
"sirv-cli": "2.0.2"
},
"dependencies": {
"preact": "^10.3.2",
"preact-render-to-string": "^5.1.4",
"preact-router": "^3.2.1"
"preact": "^10.15.0",
"preact-render-to-string": "6.0.3",
"preact-router": "^4.1.1"
},
"jest": {
"preset": "jest-preset-preact",

File diff suppressed because it is too large Load Diff

View File

@@ -7,18 +7,18 @@
"type": "module",
"private": true,
"devDependencies": {
"solid-start-vercel": "^0.2.0",
"typescript": "^4.8.3",
"vite": "^3.1.0"
"solid-start-vercel": "^0.2.26",
"typescript": "^5.0.4",
"vite": "^4.3.8"
},
"dependencies": {
"@solidjs/meta": "^0.28.2",
"@solidjs/router": "^0.5.0",
"solid-js": "^1.6.0",
"solid-start": "^0.2.0",
"undici": "^5.11.0"
"@solidjs/meta": "^0.28.5",
"@solidjs/router": "^0.8.2",
"solid-js": "^1.7.5",
"solid-start": "^0.2.26",
"undici": "^5.22.1"
},
"engines": {
"node": "16.x"
"node": "18.x"
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,11 +1,10 @@
module.exports = {
root: true,
extends: ['eslint:recommended', 'prettier'],
plugins: ['svelte3'],
overrides: [{ files: ['*.svelte'], processor: 'svelte3/svelte3' }],
extends: ['eslint:recommended', 'plugin:svelte/recommended', 'prettier'],
parserOptions: {
sourceType: 'module',
ecmaVersion: 2020
ecmaVersion: 2020,
extraFileExtensions: ['.svelte']
},
env: {
browser: true,

View File

@@ -1 +1,2 @@
engine-strict=true
resolution-mode=highest

View File

@@ -1,18 +1,12 @@
# create-svelte
# SvelteKit Demo app
Everything you need to build a Svelte project, powered by [`create-svelte`](https://github.com/sveltejs/kit/tree/master/packages/create-svelte).
The official demo app for SvelteKit, hosted on Vercel.
## Creating a project
## Deploy Your Own
If you're seeing this, you've probably already done this step. Congrats!
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fvercel%2Fvercel%2Ftree%2Fmain%2Fexamples%2Fsveltekit-1&project-name=sveltekit-vercel&repository-name=sveltekit-vercel&demo-title=SvelteKit%20%2B%20Vercel&demo-url=https%3A%2F%2Fsveltekit-template.vercel.app%2F)
```bash
# create a new project in the current directory
npm create svelte@latest
# create a new project in my-app
npm create svelte@latest my-app
```
_Live Example: https://sveltekit-template.vercel.app_
## Developing
@@ -35,4 +29,8 @@ npm run build
You can preview the production build with `npm run preview`.
> To deploy your app, you may need to install an [adapter](https://kit.svelte.dev/docs/adapters) for your target environment.
## Speed Insights
Once deployed on Vercel, you can benefit from [Speed Insights](https://vercel.com/docs/concepts/speed-insights) simply by navigating to Vercel's dashboard, clicking on the 'Speed Insights' tab, and enabling the product.
You will get data once your application will be re-deployed and will receive visitors.

View File

@@ -16,19 +16,20 @@
"@fontsource/fira-mono": "^4.5.10",
"@neoconfetti/svelte": "^1.0.0",
"@playwright/test": "^1.28.1",
"@sveltejs/adapter-vercel": "^1.0.0",
"@sveltejs/kit": "^1.0.0",
"@sveltejs/adapter-vercel": "^3.0.0",
"@sveltejs/kit": "^1.5.0",
"@types/cookie": "^0.5.1",
"eslint": "^8.28.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-svelte3": "^4.0.0",
"eslint-plugin-svelte": "^2.26.0",
"prettier": "^2.8.0",
"prettier-plugin-svelte": "^2.8.1",
"svelte": "^3.54.0",
"svelte-check": "^2.9.2",
"typescript": "^4.9.3",
"vite": "^4.0.0",
"vitest": "^0.25.3"
"svelte-check": "^3.0.1",
"typescript": "^5.0.0",
"vite": "^4.3.0",
"vitest": "^0.25.3",
"web-vitals": "^3.3.1"
},
"type": "module"
}

View File

@@ -4,7 +4,8 @@ const config = {
command: 'npm run build && npm run preview',
port: 4173
},
testDir: 'tests'
testDir: 'tests',
testMatch: /(.+\.)?(test|spec)\.[jt]s/
};
export default config;

File diff suppressed because it is too large Load Diff

View File

@@ -1,9 +1,12 @@
// See https://kit.svelte.dev/docs/types#app
// for information about these interfaces
// and what to do when importing types
declare namespace App {
// interface Error {}
// interface Locals {}
// interface PageData {}
// interface Platform {}
declare global {
namespace App {
// interface Error {}
// interface Locals {}
// interface PageData {}
// interface Platform {}
}
}
export {};

View File

@@ -0,0 +1,63 @@
import { onCLS, onFCP, onFID, onLCP, onTTFB } from 'web-vitals';
const vitalsUrl = 'https://vitals.vercel-analytics.com/v1/vitals';
function getConnectionSpeed() {
// @ts-ignore
return navigator?.connection?.effectiveType ?? '';
}
/**
* @param {import("web-vitals").Metric} metric
* @param {{ params: { [s: string]: any; } | ArrayLike<any>; path: string; analyticsId: string; debug: boolean; }} options
*/
function sendToAnalytics(metric, options) {
const page = Object.entries(options.params).reduce(
(acc, [key, value]) => acc.replace(value, `[${key}]`),
options.path
);
const body = {
dsn: options.analyticsId,
id: metric.id,
page,
href: location.href,
event_name: metric.name,
value: metric.value.toString(),
speed: getConnectionSpeed()
};
if (options.debug) {
console.log('[Web Vitals]', metric.name, JSON.stringify(body, null, 2));
}
const blob = new Blob([new URLSearchParams(body).toString()], {
// This content type is necessary for `sendBeacon`
type: 'application/x-www-form-urlencoded'
});
if (navigator.sendBeacon) {
navigator.sendBeacon(vitalsUrl, blob);
} else
fetch(vitalsUrl, {
body: blob,
method: 'POST',
credentials: 'omit',
keepalive: true
});
}
/**
* @param {any} options
*/
export function webVitals(options) {
try {
console.log(`[Web Vitals] for page ${options.path}`);
onFID((metric) => sendToAnalytics(metric, options));
onTTFB((metric) => sendToAnalytics(metric, options));
onLCP((metric) => sendToAnalytics(metric, options));
onCLS((metric) => sendToAnalytics(metric, options));
onFCP((metric) => sendToAnalytics(metric, options));
} catch (err) {
console.error(`[Web Vitals] for page ${options.path}`, err);
}
}

View File

@@ -0,0 +1,6 @@
import { env } from '$env/dynamic/private';
/** @type {import('./$types').LayoutServerLoad} */
export function load() {
return { analyticsId: env.VERCEL_ANALYTICS_ID };
}

View File

@@ -1,6 +1,20 @@
<script>
import { browser } from '$app/environment';
import { page } from '$app/stores';
import { webVitals } from '$lib/vitals';
import Header from './Header.svelte';
import './styles.css';
/** @type {import('./$types').LayoutServerData} */
export let data;
$: if (browser && data?.analyticsId) {
webVitals({
path: $page.url.pathname,
params: $page.params,
analyticsId: data.analyticsId
});
}
</script>
<div class="app">

View File

@@ -107,11 +107,11 @@
<a class="how-to-play" href="/sverdle/how-to-play">How to play</a>
<div class="grid" class:playing={!won} class:bad-guess={form?.badGuess}>
{#each Array(6) as _, row}
{#each Array.from(Array(6).keys()) as row (row)}
{@const current = row === i}
<h2 class="visually-hidden">Row {row + 1}</h2>
<div class="row" class:current>
{#each Array(5) as _, column}
{#each Array.from(Array(5).keys()) as column (column)}
{@const answer = data.answers[row]?.[column]}
{@const value = data.guesses[row]?.[column] ?? ''}
{@const selected = current && column === data.guesses[row].length}

View File

@@ -2,5 +2,5 @@ import { expect, test } from '@playwright/test';
test('about page has expected h1', async ({ page }) => {
await page.goto('/about');
expect(await page.textContent('h1')).toBe('About this app');
await expect(page.getByRole('heading', { name: 'About this app' })).toBeVisible();
});

View File

@@ -1,11 +1,9 @@
import { sveltekit } from '@sveltejs/kit/vite';
import { defineConfig } from 'vitest/config';
/** @type {import('vite').UserConfig} */
const config = {
export default defineConfig({
plugins: [sveltekit()],
test: {
include: ['src/**/*.{test,spec}.{js,ts}']
}
};
export default config;
});

View File

@@ -6,20 +6,20 @@
"lint": "vue-cli-service lint"
},
"engines": {
"node": "16.x"
"node": "18.x"
},
"dependencies": {
"core-js": "^3.6.5",
"vue": "^3.0.0"
"core-js": "^3.30.2",
"vue": "^3.3.4"
},
"devDependencies": {
"@vue/cli-plugin-babel": "~4.5.0",
"@vue/cli-plugin-eslint": "~4.5.0",
"@vue/cli-service": "~4.5.0",
"@vue/compiler-sfc": "^3.0.0",
"babel-eslint": "^10.1.0",
"eslint": "^6.7.2",
"eslint-plugin-vue": "^7.0.0"
"@vue/cli-plugin-babel": "~5.0.8",
"@vue/cli-plugin-eslint": "~5.0.8",
"@vue/cli-service": "~5.0.8",
"@vue/compiler-sfc": "^3.3.4",
"@babel/eslint-parser": "^7.21.8",
"eslint": "^8.4.1",
"eslint-plugin-vue": "^9.14.0"
},
"eslintConfig": {
"root": true,
@@ -31,7 +31,7 @@
"eslint:recommended"
],
"parserOptions": {
"parser": "babel-eslint"
"parser": "@babel/eslint-parser"
},
"rules": {}
},

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,8 @@
# @vercel-internals/constants
## 1.0.1
### Patch Changes
- Updated dependencies [[`c7bcea408`](https://github.com/vercel/vercel/commit/c7bcea408131df2d65338e50ce319a6d8e4a8a82)]:
- @vercel/build-utils@6.7.4

View File

@@ -1,17 +1,18 @@
{
"private": true,
"name": "@vercel-internals/constants",
"version": "1.0.1",
"types": "dist/index.d.ts",
"main": "dist/index.js",
"scripts": {
"build": "tsc -p tsconfig.json"
},
"dependencies": {
"@vercel/build-utils": "6.3.2",
"@vercel/routing-utils": "2.1.10"
"@vercel/build-utils": "6.7.4",
"@vercel/routing-utils": "2.2.1"
},
"devDependencies": {
"@vercel-internals/tsconfig": "*",
"@vercel-internals/tsconfig": "1.0.0",
"@vercel/style-guide": "4.0.2",
"typescript": "4.9.4"
}

View File

@@ -1,6 +1,7 @@
{
"private": true,
"name": "@vercel-internals/get-package-json",
"version": "1.0.0",
"types": "dist/index.d.ts",
"main": "dist/index.js",
"files": [
@@ -14,7 +15,7 @@
"devDependencies": {
"@types/jest": "29.5.0",
"@types/node": "14.14.31",
"@vercel-internals/tsconfig": "*",
"@vercel-internals/tsconfig": "1.0.0",
"@vercel/style-guide": "4.0.2",
"jest": "29.5.0",
"ts-jest": "29.1.0",

View File

@@ -1,6 +1,7 @@
{
"private": true,
"name": "@vercel-internals/tsconfig",
"version": "1.0.0",
"description": "Node.js tsconfig file based on `@vercel/style-guide`",
"files": [
"tsconfig.json"

View File

@@ -0,0 +1,9 @@
# @vercel-internals/types
## 1.0.1
### Patch Changes
- Updated dependencies [[`c7bcea408`](https://github.com/vercel/vercel/commit/c7bcea408131df2d65338e50ce319a6d8e4a8a82)]:
- @vercel/build-utils@6.7.4
- @vercel-internals/constants@1.0.1

View File

@@ -157,6 +157,7 @@ export type Deployment = {
errorLink?: string;
errorMessage?: string | null;
errorStep?: string;
forced?: boolean;
functions?: BuilderFunctions | null;
gitSource?: {
org?: string;
@@ -183,6 +184,7 @@ export type Deployment = {
ownerId?: string;
plan?: 'enterprise' | 'hobby' | 'oss' | 'pro';
previewCommentsEnabled?: boolean;
private?: boolean;
projectId?: string;
projectSettings?: {
buildCommand?: string | null;
@@ -353,7 +355,7 @@ export interface Project extends ProjectSettings {
link?: ProjectLinkData;
alias?: ProjectAliasTarget[];
latestDeployments?: Partial<Deployment>[];
lastRollbackTarget: RollbackTarget | null;
lastAliasRequest?: LastAliasRequest | null;
}
export interface Org {
@@ -363,8 +365,19 @@ export interface Org {
}
export interface ProjectLink {
/**
* ID of the Vercel Project.
*/
projectId: string;
/**
* User or Team ID of the owner of the Vercel Project.
*/
orgId: string;
/**
* When linked as a repository, contains the absolute path
* to the root directory of the repository.
*/
repoRoot?: string;
}
export interface PaginationOptions {
@@ -374,7 +387,7 @@ export interface PaginationOptions {
}
export type ProjectLinkResult =
| { status: 'linked'; org: Org; project: Project }
| { status: 'linked'; org: Org; project: Project; repoRoot?: string }
| { status: 'not_linked'; org: null; project: null }
| {
status: 'error';
@@ -388,6 +401,9 @@ export type ProjectLinkResult =
| 'MISSING_PROJECT_SETTINGS';
};
/**
* @deprecated - `RollbackJobStatus` has been replace by `LastAliasRequest['jobStatus']`.
*/
export type RollbackJobStatus =
| 'pending'
| 'in-progress'
@@ -395,6 +411,10 @@ export type RollbackJobStatus =
| 'failed'
| 'skipped';
/**
* @deprecated - `RollbackTarget` has been renamed to `LastAliasRequest` so it can
* be shared with "promote".
*/
export interface RollbackTarget {
fromDeploymentId: string;
jobStatus: RollbackJobStatus;
@@ -402,6 +422,14 @@ export interface RollbackTarget {
toDeploymentId: string;
}
export interface LastAliasRequest {
fromDeploymentId: string;
jobStatus: 'pending' | 'in-progress' | 'succeeded' | 'failed' | 'skipped';
requestedAt: number;
toDeploymentId: string;
type: 'rollback' | 'promote';
}
export interface Token {
id: string;
name: string;

View File

@@ -1,16 +1,17 @@
{
"private": true,
"name": "@vercel-internals/types",
"version": "1.0.1",
"types": "index.d.ts",
"main": "index.d.ts",
"dependencies": {
"@types/node": "14.14.31",
"@vercel-internals/constants": "*",
"@vercel/build-utils": "6.3.2",
"@vercel/routing-utils": "2.1.10"
"@vercel-internals/constants": "1.0.1",
"@vercel/build-utils": "6.7.4",
"@vercel/routing-utils": "2.2.1"
},
"devDependencies": {
"@vercel-internals/tsconfig": "*",
"@vercel-internals/tsconfig": "1.0.0",
"@vercel/style-guide": "4.0.2",
"typescript": "4.9.4"
}

View File

@@ -32,7 +32,7 @@
"source-map-support": "0.5.12",
"ts-eager": "2.0.2",
"ts-jest": "29.1.0",
"turbo": "1.9.4",
"turbo": "1.9.9",
"typescript": "4.9.5"
},
"scripts": {
@@ -48,8 +48,8 @@
"prettier-check": "prettier --check .",
"prepare": "husky install",
"pack": "cd utils && node -r ts-eager/register ./pack.ts",
"version:prepare": "changeset version && pnpm install --no-frozen-lockfile",
"release": "changeset publish"
"ci:version": "changeset version && pnpm install --no-frozen-lockfile",
"ci:publish": "pnpm publish -r && changeset tag"
},
"lint-staged": {
"./{*,{api,packages,test,utils}/**/*}.{js,ts}": [

View File

@@ -1,5 +1,11 @@
# @vercel/build-utils
## 6.7.4
### Patch Changes
- Remove usage of `env` from Edge Functions and Middleware ([#10018](https://github.com/vercel/vercel/pull/10018))
## 6.7.3
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@vercel/build-utils",
"version": "6.7.3",
"version": "6.7.4",
"license": "Apache-2.0",
"main": "./dist/index.js",
"types": "./dist/index.d.js",

View File

@@ -27,12 +27,6 @@ export class EdgeFunction {
*/
files: Files;
/**
* Extra environment variables in use for the user code, to be
* assigned to the edge function.
*/
envVarsInUse?: string[];
/**
* Extra binary files to be included in the edge function
*/
@@ -50,7 +44,6 @@ export class EdgeFunction {
this.deploymentTarget = params.deploymentTarget;
this.entrypoint = params.entrypoint;
this.files = params.files;
this.envVarsInUse = params.envVarsInUse;
this.assets = params.assets;
this.regions = params.regions;
this.framework = params.framework;

View File

@@ -1,5 +1,50 @@
# vercel
## 30.1.0
### Minor Changes
- New `vc promote` command ([#9984](https://github.com/vercel/vercel/pull/9984))
### Patch Changes
- Support `deploy` subcommand in "repo linked" mode ([#10013](https://github.com/vercel/vercel/pull/10013))
- [cli] Update `vc rollback` to use `lastRequestAlias` instead of `lastRollbackTarget` ([#10019](https://github.com/vercel/vercel/pull/10019))
- Fix `--cwd` flag with a relative path for `env`, `link`, `promote`, and `rollback` subcommands ([#10031](https://github.com/vercel/vercel/pull/10031))
- Updated dependencies [[`c6c19354e`](https://github.com/vercel/vercel/commit/c6c19354e852cfc1338b223058c4b07fdc71c723), [`b56ac2717`](https://github.com/vercel/vercel/commit/b56ac2717d6769eb400f9746f0a05431929b4501), [`c63679ea0`](https://github.com/vercel/vercel/commit/c63679ea0a6bc48c0759ccf3c0c0a8106bd324f0), [`c7bcea408`](https://github.com/vercel/vercel/commit/c7bcea408131df2d65338e50ce319a6d8e4a8a82)]:
- @vercel/next@3.8.6
- @vercel/build-utils@6.7.4
- @vercel/node@2.14.4
- @vercel/remix-builder@1.8.11
- @vercel/static-build@1.3.33
## 30.0.0
### Major Changes
- Change `vc env pull` default output file to `.env.local` ([#9892](https://github.com/vercel/vercel/pull/9892))
- Remove `--platform-version` global common arg ([#9807](https://github.com/vercel/vercel/pull/9807))
### Minor Changes
- [cli] implement `vc deploy --prod --skip-build` ([#9836](https://github.com/vercel/vercel/pull/9836))
- New `vc redeploy` command ([#9956](https://github.com/vercel/vercel/pull/9956))
### Patch Changes
- Fix `vercel git connect` command when passing a URL parameter ([#9967](https://github.com/vercel/vercel/pull/9967))
## 29.4.0
### Minor Changes
- Add `vercel link --repo` flag to link to repository (multiple projects), rather than an individual project (alpha) ([#8931](https://github.com/vercel/vercel/pull/8931))
## 29.3.6
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "vercel",
"version": "29.3.6",
"version": "30.1.0",
"preferGlobal": true,
"license": "Apache-2.0",
"description": "The command-line interface for Vercel",
@@ -32,16 +32,16 @@
"node": ">= 14"
},
"dependencies": {
"@vercel/build-utils": "6.7.3",
"@vercel/build-utils": "6.7.4",
"@vercel/go": "2.5.1",
"@vercel/hydrogen": "0.0.64",
"@vercel/next": "3.8.5",
"@vercel/node": "2.14.3",
"@vercel/next": "3.8.6",
"@vercel/node": "2.14.4",
"@vercel/python": "3.1.60",
"@vercel/redwood": "1.1.15",
"@vercel/remix-builder": "1.8.10",
"@vercel/remix-builder": "1.8.11",
"@vercel/ruby": "1.3.76",
"@vercel/static-build": "1.3.32"
"@vercel/static-build": "1.3.33"
},
"devDependencies": {
"@alex_neo/jest-expect-message": "1.0.5",
@@ -85,13 +85,13 @@
"@types/which": "3.0.0",
"@types/write-json-file": "2.2.1",
"@types/yauzl-promise": "2.1.0",
"@vercel-internals/constants": "*",
"@vercel-internals/get-package-json": "*",
"@vercel-internals/types": "*",
"@vercel/client": "12.5.1",
"@vercel-internals/constants": "1.0.1",
"@vercel-internals/get-package-json": "1.0.0",
"@vercel-internals/types": "1.0.1",
"@vercel/client": "12.6.1",
"@vercel/error-utils": "1.0.10",
"@vercel/frameworks": "1.4.2",
"@vercel/fs-detectors": "3.9.2",
"@vercel/fs-detectors": "3.9.3",
"@vercel/fun": "1.0.4",
"@vercel/ncc": "0.24.0",
"@vercel/routing-utils": "2.2.1",
@@ -119,6 +119,7 @@
"escape-html": "1.0.3",
"esm": "3.1.4",
"execa": "3.2.0",
"expect": "29.5.0",
"express": "4.17.1",
"fast-deep-equal": "3.1.3",
"find-up": "4.1.0",

View File

@@ -24,7 +24,9 @@ export const help = () => `
ls | list [app] Lists deployments
login [email] Logs into your account or creates a new one
logout Logs out of your account
promote [url|id] Promote an existing deployment to current
pull [path] Pull your Project Settings from the cloud
redeploy [url|id] Rebuild and deploy a previous deployment.
rollback [url|id] Quickly revert back to a previous deployment
switch [scope] Switches between teams and your personal account

View File

@@ -133,7 +133,7 @@ const help = () => {
};
export default async function main(client: Client): Promise<number> {
const { output } = client;
const { cwd, output } = client;
// Ensure that `vc build` is not being invoked recursively
if (process.env.__VERCEL_BUILD_RUNNING) {
@@ -165,8 +165,6 @@ export default async function main(client: Client): Promise<number> {
return 2;
}
const cwd = process.cwd();
// Build `target` influences which environment variables will be used
const target = argv['--prod'] ? 'production' : 'preview';
const yes = Boolean(argv['--yes']);

View File

@@ -2,7 +2,7 @@ import ms from 'ms';
import fs from 'fs-extra';
import bytes from 'bytes';
import chalk from 'chalk';
import { join, resolve, basename } from 'path';
import { join, resolve } from 'path';
import {
fileNameSymbol,
VALID_ARCHIVE_FORMATS,
@@ -21,7 +21,6 @@ import stamp from '../../util/output/stamp';
import createDeploy from '../../util/deploy/create-deploy';
import getDeployment from '../../util/get-deployment';
import parseMeta from '../../util/parse-meta';
import linkStyle from '../../util/output/link';
import param from '../../util/output/param';
import {
BuildsRateLimited,
@@ -59,7 +58,6 @@ import validatePaths, {
validateRootDirectory,
} from '../../util/validate-paths';
import { getCommandName } from '../../util/pkg-name';
import { getPreferredPreviewURL } from '../../util/deploy/get-preferred-preview-url';
import { Output } from '../../util/output';
import { help } from './args';
import { getDeploymentChecks } from '../../util/deploy/get-deployment-checks';
@@ -70,8 +68,7 @@ import { isValidArchive } from '../../util/deploy/validate-archive-format';
import { parseEnv } from '../../util/parse-env';
import { errorToString, isErrnoException, isError } from '@vercel/error-utils';
import { pickOverrides } from '../../util/projects/project-settings';
import { isDeploying } from '../../util/deploy/is-deploying';
import type { Deployment } from '@vercel-internals/types';
import { printDeploymentStatus } from '../../util/deploy/print-deployment-status';
export default async (client: Client): Promise<number> => {
const { output } = client;
@@ -93,6 +90,7 @@ export default async (client: Client): Promise<number> => {
'--prod': Boolean,
'--archive': String,
'--no-wait': Boolean,
'--skip-domain': Boolean,
'--yes': Boolean,
'-f': '--force',
'-p': '--public',
@@ -132,24 +130,19 @@ export default async (client: Client): Promise<number> => {
if (argv._.length > 0) {
// If path is relative: resolve
// if path is absolute: clear up strange `/` etc
paths = argv._.map(item => resolve(process.cwd(), item));
paths = argv._.map(item => resolve(client.cwd, item));
} else {
paths = [process.cwd()];
paths = [client.cwd];
}
// check paths
const pathValidation = await validatePaths(client, paths);
if (!pathValidation.valid) {
return pathValidation.exitCode;
}
let localConfig = client.localConfig || readLocalConfig(paths[0]);
for (const path of paths) {
try {
await fs.stat(path);
} catch (err) {
output.error(
`The specified file or directory "${basename(path)}" does not exist.`
);
return 1;
}
}
if (localConfig) {
const { version } = localConfig;
const file = highlight(localConfig[fileNameSymbol]!);
@@ -178,14 +171,7 @@ export default async (client: Client): Promise<number> => {
const quiet = !client.stdout.isTTY;
// check paths
const pathValidation = await validatePaths(client, paths);
if (!pathValidation.valid) {
return pathValidation.exitCode;
}
const { path } = pathValidation;
let { path: cwd } = pathValidation;
const autoConfirm = argv['--yes'];
// deprecate --name
@@ -219,7 +205,7 @@ export default async (client: Client): Promise<number> => {
// build `--prebuilt`
if (argv['--prebuilt']) {
const prebuiltExists = await fs.pathExists(join(path, '.vercel/output'));
const prebuiltExists = await fs.pathExists(join(cwd, '.vercel/output'));
if (!prebuiltExists) {
error(
`The ${param(
@@ -231,7 +217,7 @@ export default async (client: Client): Promise<number> => {
return 1;
}
const prebuiltBuild = await getPrebuiltJson(path);
const prebuiltBuild = await getPrebuiltJson(cwd);
// Ensure that there was not a build error
const prebuiltError =
@@ -274,7 +260,7 @@ export default async (client: Client): Promise<number> => {
}
// retrieve `project` and `org` from .vercel
const link = await getLinkedProject(client, path);
const link = await getLinkedProject(client, cwd);
if (link.status === 'error') {
return link.exitCode;
@@ -291,7 +277,7 @@ export default async (client: Client): Promise<number> => {
autoConfirm ||
(await confirm(
client,
`Set up and deploy ${chalk.cyan(`${toHumanPath(path)}`)}?`,
`Set up and deploy ${chalk.cyan(`${toHumanPath(cwd)}`)}?`,
true
));
@@ -338,7 +324,7 @@ export default async (client: Client): Promise<number> => {
if (typeof projectOrNewProjectName === 'string') {
newProjectName = projectOrNewProjectName;
rootDirectory = await inputRootDirectory(client, path, autoConfirm);
rootDirectory = await inputRootDirectory(client, cwd, autoConfirm);
} else {
project = projectOrNewProjectName;
rootDirectory = project.rootDirectory;
@@ -346,8 +332,8 @@ export default async (client: Client): Promise<number> => {
// we can already link the project
await linkFolderToProject(
output,
path,
client,
cwd,
{
projectId: project.id,
orgId: org.id,
@@ -359,6 +345,11 @@ export default async (client: Client): Promise<number> => {
}
}
// For repo-style linking, reset the path to the root of the repository
if (link.status === 'linked' && link.repoRoot) {
cwd = link.repoRoot;
}
// At this point `org` should be populated
if (!org) {
throw new Error(`"org" is not defined`);
@@ -373,14 +364,14 @@ export default async (client: Client): Promise<number> => {
// and upload the entire directory.
const sourcePath =
rootDirectory && !sourceFilesOutsideRootDirectory
? join(path, rootDirectory)
: path;
? join(cwd, rootDirectory)
: cwd;
if (
rootDirectory &&
(await validateRootDirectory(
output,
path,
cwd,
sourcePath,
project
? `To change your Project Settings, go to https://vercel.com/${org?.slug}/${project.name}/settings`
@@ -393,7 +384,7 @@ export default async (client: Client): Promise<number> => {
// If Root Directory is used we'll try to read the config
// from there instead and use it if it exists.
if (rootDirectory) {
const rootDirectoryConfig = readLocalConfig(join(path, rootDirectory));
const rootDirectoryConfig = readLocalConfig(join(cwd, rootDirectory));
if (rootDirectoryConfig) {
debug(`Read local config from root directory (${rootDirectory})`);
@@ -469,7 +460,7 @@ export default async (client: Client): Promise<number> => {
parseMeta(argv['--meta'])
);
const gitMetadata = await createGitMeta(path, output, project);
const gitMetadata = await createGitMeta(cwd, output, project);
// Merge dotenv config, `env` from vercel.json, and `--env` / `-e` arguments
const deploymentEnv = Object.assign(
@@ -520,6 +511,8 @@ export default async (client: Client): Promise<number> => {
}
try {
const autoAssignCustomDomains = !argv['--skip-domain'];
const createArgs: CreateOptions = {
name,
env: deploymentEnv,
@@ -543,6 +536,7 @@ export default async (client: Client): Promise<number> => {
target,
skipAutoDetectionConfirmation: autoConfirm,
noWait,
autoAssignCustomDomains,
};
if (!localConfig.builds || localConfig.builds.length === 0) {
@@ -559,11 +553,11 @@ export default async (client: Client): Promise<number> => {
client,
now,
contextName,
[sourcePath],
sourcePath,
createArgs,
org,
!project,
path,
cwd,
archive
);
@@ -595,11 +589,11 @@ export default async (client: Client): Promise<number> => {
client,
now,
contextName,
[sourcePath],
sourcePath,
createArgs,
org,
false,
path
cwd
);
}
@@ -728,7 +722,7 @@ export default async (client: Client): Promise<number> => {
return 1;
}
return printDeploymentStatus(output, client, deployment, deployStamp, noWait);
return printDeploymentStatus(client, deployment, deployStamp, noWait);
};
function handleCreateDeployError(
@@ -835,112 +829,3 @@ const addProcessEnv = async (
}
}
};
const printDeploymentStatus = async (
output: Output,
client: Client,
{
readyState,
alias: aliasList,
aliasError,
target,
indications,
url: deploymentUrl,
aliasWarning,
}: {
readyState: Deployment['readyState'];
alias: string[];
aliasError: Error;
target: string;
indications: any;
url: string;
aliasWarning?: {
code: string;
message: string;
link?: string;
action?: string;
};
},
deployStamp: () => string,
noWait: boolean
) => {
indications = indications || [];
const isProdDeployment = target === 'production';
let isStillBuilding = false;
if (noWait) {
if (isDeploying(readyState)) {
isStillBuilding = true;
output.print(
prependEmoji(
'Note: Deployment is still processing...',
emoji('notice')
) + '\n'
);
}
}
if (!isStillBuilding && readyState !== 'READY') {
output.error(
`Your deployment failed. Please retry later. More: https://err.sh/vercel/deployment-error`
);
return 1;
}
if (aliasError) {
output.warn(
`Failed to assign aliases${
aliasError.message ? `: ${aliasError.message}` : ''
}`
);
} else {
// print preview/production url
let previewUrl: string;
// if `noWait` is true, then use the deployment url, not an alias
if (!noWait && Array.isArray(aliasList) && aliasList.length > 0) {
const previewUrlInfo = await getPreferredPreviewURL(client, aliasList);
if (previewUrlInfo) {
previewUrl = previewUrlInfo.previewUrl;
} else {
previewUrl = `https://${deploymentUrl}`;
}
} else {
// fallback to deployment url
previewUrl = `https://${deploymentUrl}`;
}
output.print(
prependEmoji(
`${isProdDeployment ? 'Production' : 'Preview'}: ${chalk.bold(
previewUrl
)} ${deployStamp()}`,
emoji('success')
) + `\n`
);
}
if (aliasWarning?.message) {
indications.push({
type: 'warning',
payload: aliasWarning.message,
link: aliasWarning.link,
action: aliasWarning.action,
});
}
const newline = '\n';
for (let indication of indications) {
const message =
prependEmoji(chalk.dim(indication.payload), emoji(indication.type)) +
newline;
let link = '';
if (indication.link)
link =
chalk.dim(
`${indication.action || 'Learn More'}: ${linkStyle(indication.link)}`
) + newline;
output.print(message + link);
}
return 0;
};

View File

@@ -26,7 +26,7 @@ const help = () => {
ls [environment] [gitbranch] List all variables for the specified Environment
add [name] [environment] [gitbranch] Add an Environment Variable (see examples below)
rm [name] [environment] [gitbranch] Remove an Environment Variable (see examples below)
pull [filename] Pull all Development Environment Variables from the cloud and write to a file [.env]
pull [filename] Pull all Development Environment Variables from the cloud and write to a file [.env.local]
${chalk.dim('Options:')}
@@ -130,10 +130,9 @@ export default async function main(client: Client) {
return 2;
}
const cwd = argv['--cwd'] || process.cwd();
const subArgs = argv._.slice(1);
const { subcommand, args } = getSubcommand(subArgs, COMMAND_CONFIG);
const { output, config } = client;
const { cwd, output, config } = client;
const target = argv['--environment']?.toLowerCase() || 'development';
if (!isValidEnvTarget(target)) {

View File

@@ -67,7 +67,7 @@ export default async function pull(
}
// handle relative or absolute filename
const [filename = '.env'] = args;
const [filename = '.env.local'] = args;
const fullPath = resolve(cwd, filename);
const skipConfirmation = opts['--yes'];
const gitBranch = opts['--git-branch'];

View File

@@ -16,7 +16,6 @@ import {
parseRepoUrl,
printRemoteUrls,
} from '../../util/git/connect-git-provider';
import validatePaths from '../../util/validate-paths';
interface GitRepoCheckParams {
client: Client;
@@ -56,7 +55,7 @@ export default async function connect(
project: Project | undefined,
org: Org | undefined
) {
const { output } = client;
const { cwd, output } = client;
const confirm = Boolean(argv['--yes']);
const repoArg = argv._[1];
@@ -77,19 +76,11 @@ export default async function connect(
return 1;
}
let paths = [process.cwd()];
const validate = await validatePaths(client, paths);
if (!validate.valid) {
return validate.exitCode;
}
const { path } = validate;
const gitProviderLink = project.link;
client.config.currentTeam = org.type === 'team' ? org.id : undefined;
// get project from .git
const gitConfigPath = join(path, '.git/config');
const gitConfigPath = join(cwd, '.git/config');
const gitConfig = await parseGitConfig(gitConfigPath, output);
if (repoArg) {
@@ -116,7 +107,7 @@ export default async function connect(
confirm,
org,
project,
repoInfo: repoArg,
repoInfo: parsedUrlArg,
});
}

View File

@@ -6,7 +6,6 @@ import getInvalidSubcommand from '../../util/get-invalid-subcommand';
import handleError from '../../util/handle-error';
import logo from '../../util/output/logo';
import { getPkgName } from '../../util/pkg-name';
import validatePaths from '../../util/validate-paths';
import connect from './connect';
import disconnect from './disconnect';
@@ -81,16 +80,9 @@ export default async function main(client: Client) {
subcommand = argv._[0];
const args = argv._.slice(1);
const autoConfirm = Boolean(argv['--yes']);
const { output } = client;
const { cwd, output } = client;
let paths = [process.cwd()];
const pathValidation = await validatePaths(client, paths);
if (!pathValidation.valid) {
return pathValidation.exitCode;
}
const { path } = pathValidation;
const linkedProject = await ensureLink('git', client, path, { autoConfirm });
const linkedProject = await ensureLink('git', client, cwd, { autoConfirm });
if (typeof linkedProject === 'number') {
return linkedProject;
}

View File

@@ -26,7 +26,9 @@ export default new Map([
['ls', 'list'],
['project', 'project'],
['projects', 'project'],
['promote', 'promote'],
['pull', 'pull'],
['redeploy', 'redeploy'],
['remove', 'remove'],
['rm', 'remove'],
['rollback', 'rollback'],

View File

@@ -2,8 +2,10 @@ import chalk from 'chalk';
import Client from '../../util/client';
import getArgs from '../../util/get-args';
import logo from '../../util/output/logo';
import cmd from '../../util/output/cmd';
import { getPkgName } from '../../util/pkg-name';
import { ensureLink } from '../../util/link/ensure-link';
import { ensureRepoLink } from '../../util/link/repo';
const help = () => {
console.log(`
@@ -12,6 +14,7 @@ const help = () => {
${chalk.dim('Options:')}
-h, --help Output usage information
-r, --repo Link multiple projects based on Git repository (alpha)
-A ${chalk.bold.underline('FILE')}, --local-config=${chalk.bold.underline(
'FILE'
)} Path to the local ${'`vercel.json`'} file
@@ -42,7 +45,14 @@ const help = () => {
${chalk.gray('')} Link a specific directory to a Vercel Project
${chalk.cyan(`$ ${getPkgName()} link /usr/src/project`)}
${chalk.cyan(`$ ${getPkgName()} link --cwd /path/to/project`)}
${chalk.gray('')} ${chalk.yellow(
'(alpha)'
)} Link to the current Git repository, allowing for multiple
Vercel Projects to be linked simultaneously (useful for monorepos)
${chalk.cyan(`$ ${getPkgName()} link --repo`)}
`);
};
@@ -52,6 +62,8 @@ export default async function main(client: Client) {
'-y': '--yes',
'--project': String,
'-p': '--project',
'--repo': Boolean,
'-r': '--repo',
// deprecated
'--confirm': Boolean,
@@ -68,17 +80,36 @@ export default async function main(client: Client) {
argv['--yes'] = argv['--confirm'];
}
const cwd = argv._[1] || process.cwd();
const yes = !!argv['--yes'];
const link = await ensureLink('link', client, cwd, {
autoConfirm: !!argv['--yes'],
forceDelete: true,
projectName: argv['--project'],
successEmoji: 'success',
});
if (typeof link === 'number') {
return link;
let cwd = argv._[1];
if (cwd) {
client.output.warn(
`The ${cmd('vc link <directory>')} syntax is deprecated, please use ${cmd(
`vc link --cwd ${cwd}`
)} instead`
);
} else {
cwd = client.cwd;
}
if (argv['--repo']) {
client.output.warn(
`The ${cmd('--repo')} flag is in alpha, please report issues`
);
await ensureRepoLink(client, cwd, yes);
} else {
const link = await ensureLink('link', client, cwd, {
autoConfirm: yes,
forceDelete: true,
projectName: argv['--project'],
successEmoji: 'success',
});
if (typeof link === 'number') {
return link;
}
}
return 0;
}

View File

@@ -15,7 +15,6 @@ import getCommandFlags from '../util/get-command-flags';
import { getPkgName, getCommandName } from '../util/pkg-name';
import Client from '../util/client';
import { Deployment } from '@vercel/client';
import validatePaths from '../util/validate-paths';
import { getLinkedProject } from '../util/projects/link';
import { ensureLink } from '../util/link/ensure-link';
import getScope from '../util/get-scope';
@@ -94,7 +93,7 @@ export default async function main(client: Client) {
return 1;
}
const { output, config } = client;
const { cwd, output, config } = client;
if ('--confirm' in argv) {
output.warn('`--confirm` is deprecated, please use `--yes` instead');
@@ -115,19 +114,10 @@ export default async function main(client: Client) {
const autoConfirm = !!argv['--yes'];
const prod = argv['--prod'] || false;
const meta = parseMeta(argv['--meta']);
let paths = [process.cwd()];
const pathValidation = await validatePaths(client, paths);
if (!pathValidation.valid) {
return pathValidation.exitCode;
}
const { path } = pathValidation;
// retrieve `project` and `org` from .vercel
let link = await getLinkedProject(client, path);
let link = await getLinkedProject(client, cwd);
if (link.status === 'error') {
return link.exitCode;
@@ -146,7 +136,7 @@ export default async function main(client: Client) {
// If there's no linked project and user doesn't pass `app` arg,
// prompt to link their current directory.
if (status === 'not_linked' && !app) {
const linkedProject = await ensureLink('list', client, path, {
const linkedProject = await ensureLink('list', client, cwd, {
autoConfirm,
link,
});

View File

@@ -0,0 +1,121 @@
import chalk from 'chalk';
import type Client from '../../util/client';
import getArgs from '../../util/get-args';
import getProjectByCwdOrLink from '../../util/projects/get-project-by-cwd-or-link';
import { getPkgName } from '../../util/pkg-name';
import handleError from '../../util/handle-error';
import { isErrnoException } from '@vercel/error-utils';
import logo from '../../util/output/logo';
import ms from 'ms';
import requestPromote from './request-promote';
import promoteStatus from './status';
const help = () => {
console.log(`
${chalk.bold(`${logo} ${getPkgName()} promote`)} [deployment id/url]
Promote an existing deployment to current.
${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
-d, --debug Debug mode [off]
--no-color No color mode [off]
-t ${chalk.bold.underline('TOKEN')}, --token=${chalk.bold.underline(
'TOKEN'
)} Login token
--timeout=${chalk.bold.underline(
'TIME'
)} Time to wait for promotion completion [3m]
-y, --yes Skip questions when setting up new project using default scope and settings
${chalk.dim('Examples:')}
${chalk.gray('')} Show the status of any current pending promotions
${chalk.cyan(`$ ${getPkgName()} promote`)}
${chalk.cyan(`$ ${getPkgName()} promote status`)}
${chalk.cyan(`$ ${getPkgName()} promote status <project>`)}
${chalk.cyan(`$ ${getPkgName()} promote status --timeout 30s`)}
${chalk.gray('')} Promote a deployment using id or url
${chalk.cyan(`$ ${getPkgName()} promote <deployment id/url>`)}
`);
};
/**
* `vc promote` command
* @param {Client} client
* @returns {Promise<number>} Resolves an exit code; 0 on success
*/
export default async (client: Client): Promise<number> => {
let argv;
try {
argv = getArgs(client.argv.slice(2), {
'--timeout': String,
'--yes': Boolean,
'-y': '--yes',
});
} catch (err) {
handleError(err);
return 1;
}
if (argv['--help'] || argv._[0] === 'help') {
help();
return 2;
}
// validate the timeout
let timeout = argv['--timeout'];
if (timeout && ms(timeout) === undefined) {
client.output.error(`Invalid timeout "${timeout}"`);
return 1;
}
const actionOrDeployId = argv._[1] || 'status';
try {
if (actionOrDeployId === 'status') {
const project = await getProjectByCwdOrLink({
autoConfirm: Boolean(argv['--yes']),
client,
commandName: 'promote',
cwd: client.cwd,
projectNameOrId: argv._[2],
});
return await promoteStatus({
client,
project,
timeout,
});
}
return await requestPromote({
client,
deployId: actionOrDeployId,
timeout,
});
} catch (err) {
if (isErrnoException(err)) {
if (err.code === 'ERR_CANCELED') {
return 0;
}
if (err.code === 'ERR_INVALID_CWD' || err.code === 'ERR_LINK_PROJECT') {
// do not show the message
return 1;
}
}
client.output.prettyError(err);
return 1;
}
};

View File

@@ -0,0 +1,57 @@
import chalk from 'chalk';
import type Client from '../../util/client';
import { getCommandName } from '../../util/pkg-name';
import getProjectByDeployment from '../../util/projects/get-project-by-deployment';
import ms from 'ms';
import promoteStatus from './status';
/**
* Requests a promotion and waits for it complete.
* @param {Client} client - The Vercel client instance
* @param {string} deployId - The deployment name or id to promote
* @param {string} [timeout] - Time to poll for succeeded/failed state
* @returns {Promise<number>} Resolves an exit code; 0 on success
*/
export default async function requestPromote({
client,
deployId,
timeout,
}: {
client: Client;
deployId: string;
timeout?: string;
}): Promise<number> {
const { output } = client;
const { contextName, deployment, project } = await getProjectByDeployment({
client,
deployId,
output: client.output,
});
// request the promotion
await client.fetch(`/v9/projects/${project.id}/promote/${deployment.id}`, {
body: {}, // required
json: false,
method: 'POST',
});
if (timeout !== undefined && ms(timeout) === 0) {
output.log(
`Successfully requested promote of ${chalk.bold(project.name)} to ${
deployment.url
} (${deployment.id})`
);
output.log(`To check promote status, run ${getCommandName('promote')}.`);
return 0;
}
// check the status
return await promoteStatus({
client,
contextName,
deployment,
project,
timeout,
});
}

View File

@@ -0,0 +1,265 @@
import chalk from 'chalk';
import type Client from '../../util/client';
import type {
Deployment,
LastAliasRequest,
PaginationOptions,
Project,
} from '@vercel-internals/types';
import elapsed from '../../util/output/elapsed';
import formatDate from '../../util/format-date';
import getDeployment from '../../util/get-deployment';
import { getPkgName } from '../../util/pkg-name';
import getProjectByNameOrId from '../../util/projects/get-project-by-id-or-name';
import getScope from '../../util/get-scope';
import ms from 'ms';
import { ProjectNotFound } from '../../util/errors-ts';
import renderAliasStatus from '../../util/alias/render-alias-status';
import sleep from '../../util/sleep';
interface DeploymentAlias {
alias: {
alias: string;
deploymentId: string;
};
id: string;
status: 'completed' | 'in-progress' | 'pending' | 'failed';
}
interface AliasesResponse {
aliases: DeploymentAlias[];
pagination: PaginationOptions;
}
/**
* Continuously checks a deployment status until it has succeeded, failed, or
* taken longer than the timeout (default 3 minutes).
*
* @param {Client} client - The Vercel client instance
* @param {string} [contextName] - The scope name; if not specified, it will be
* extracted from the `client`
* @param {Deployment} [deployment] - Info about the deployment which is used
* to display different output following a promotion request
* @param {Project} project - Project info instance
* @param {string} [timeout] - Milliseconds to poll for succeeded/failed state
* @returns {Promise<number>} Resolves an exit code; 0 on success
*/
export default async function promoteStatus({
client,
contextName,
deployment,
project,
timeout = '3m',
}: {
client: Client;
contextName?: string;
deployment?: Deployment;
project: Project;
timeout?: string;
}): Promise<number> {
const { output } = client;
const recentThreshold = Date.now() - ms('3m');
const promoteTimeout = Date.now() + ms(timeout);
let counter = 0;
let spinnerMessage = deployment
? 'Promote in progress'
: `Checking promotion status of ${project.name}`;
if (!contextName) {
({ contextName } = await getScope(client));
}
try {
output.spinner(`${spinnerMessage}`);
// continuously loop until the promotion has explicitly succeeded, failed,
// or timed out
for (;;) {
const projectCheck = await getProjectByNameOrId(
client,
project.id,
project.accountId,
true
);
if (projectCheck instanceof ProjectNotFound) {
throw projectCheck;
}
const {
jobStatus,
requestedAt,
toDeploymentId,
type,
}: Partial<LastAliasRequest> = projectCheck.lastAliasRequest ?? {};
if (
!jobStatus ||
(jobStatus !== 'in-progress' && jobStatus !== 'pending')
) {
output.stopSpinner();
output.log(`${spinnerMessage}`);
}
if (
!jobStatus ||
!requestedAt ||
!toDeploymentId ||
requestedAt < recentThreshold
) {
output.log('No deployment promotion in progress');
return 0;
}
if (jobStatus === 'skipped' && type === 'promote') {
output.log('Promote deployment was skipped');
return 0;
}
if (jobStatus === 'succeeded') {
return await renderJobSucceeded({
client,
contextName,
performingPromote: !!deployment,
requestedAt,
project,
toDeploymentId,
});
}
if (jobStatus === 'failed') {
return await renderJobFailed({
client,
contextName,
deployment,
project,
toDeploymentId,
});
}
// lastly, if we're not pending/in-progress, then we don't know what
// the status is, so bail
if (jobStatus !== 'pending' && jobStatus !== 'in-progress') {
output.log(`Unknown promote deployment status "${jobStatus}"`);
return 1;
}
// check if we have been running for too long
if (requestedAt < recentThreshold || Date.now() >= promoteTimeout) {
output.log(
`The promotion exceeded its deadline - rerun ${chalk.bold(
`${getPkgName()} promote ${toDeploymentId}`
)} to try again`
);
return 1;
}
// if we've done our first poll and not rolling back, then print the
// requested at date/time
if (counter++ === 0 && !deployment) {
spinnerMessage += ` requested at ${formatDate(requestedAt)}`;
}
output.spinner(`${spinnerMessage}`);
await sleep(250);
}
} finally {
output.stopSpinner();
}
}
async function renderJobFailed({
client,
contextName,
deployment,
project,
toDeploymentId,
}: {
client: Client;
contextName: string;
deployment?: Deployment;
project: Project;
toDeploymentId: string;
}) {
const { output } = client;
try {
const name = (
deployment || (await getDeployment(client, contextName, toDeploymentId))
)?.url;
output.error(
`Failed to remap all aliases to the requested deployment ${name} (${toDeploymentId})`
);
} catch (e) {
output.error(
`Failed to remap all aliases to the requested deployment ${toDeploymentId}`
);
}
// aliases are paginated, so continuously loop until all of them have been
// fetched
let nextTimestamp;
for (;;) {
let url = `/v9/projects/${project.id}/promote/aliases?failedOnly=true&limit=20`;
if (nextTimestamp) {
url += `&until=${nextTimestamp}`;
}
const { aliases, pagination } = await client.fetch<AliasesResponse>(url);
for (const { alias, status } of aliases) {
output.log(
` ${renderAliasStatus(status).padEnd(11)} ${alias.alias} (${
alias.deploymentId
})`
);
}
if (pagination?.next) {
nextTimestamp = pagination.next;
} else {
break;
}
}
return 1;
}
async function renderJobSucceeded({
client,
contextName,
performingPromote,
project,
requestedAt,
toDeploymentId,
}: {
client: Client;
contextName: string;
performingPromote: boolean;
project: Project;
requestedAt: number;
toDeploymentId: string;
}) {
const { output } = client;
// attempt to get the new deployment url
let deploymentInfo = '';
try {
const deployment = await getDeployment(client, contextName, toDeploymentId);
deploymentInfo = `${chalk.bold(deployment.url)} (${toDeploymentId})`;
} catch (err: any) {
output.debug(
`Failed to get deployment url for ${toDeploymentId}: ${
err?.toString() || err
}`
);
deploymentInfo = chalk.bold(toDeploymentId);
}
const duration = performingPromote ? elapsed(Date.now() - requestedAt) : '';
output.log(
`Success! ${chalk.bold(
project.name
)} was promoted to ${deploymentInfo} ${duration}`
);
return 0;
}

View File

@@ -0,0 +1,204 @@
import chalk from 'chalk';
import { checkDeploymentStatus } from '@vercel/client';
import type Client from '../util/client';
import { emoji, prependEmoji } from '../util/emoji';
import getArgs from '../util/get-args';
import { getCommandName, getPkgName } from '../util/pkg-name';
import { getDeploymentByIdOrURL } from '../util/deploy/get-deployment-by-id-or-url';
import getScope from '../util/get-scope';
import handleError from '../util/handle-error';
import { isErrnoException } from '@vercel/error-utils';
import logo from '../util/output/logo';
import Now from '../util';
import { printDeploymentStatus } from '../util/deploy/print-deployment-status';
import stamp from '../util/output/stamp';
import ua from '../util/ua';
import type { VercelClientOptions } from '@vercel/client';
const help = () => {
console.log(`
${chalk.bold(
`${logo} ${getPkgName()} redeploy`
)} [deploymentId|deploymentName]
Rebuild and deploy a previous deployment.
${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
-d, --debug Debug mode [off]
--no-color No color mode [off]
--no-wait Don't wait for the redeploy to finish
-t ${chalk.bold.underline('TOKEN')}, --token=${chalk.bold.underline(
'TOKEN'
)} Login token
-y, --yes Skip questions when setting up new project using default scope and settings
${chalk.dim('Examples:')}
${chalk.gray('')} Rebuild and deploy an existing deployment using id or url
${chalk.cyan(`$ ${getPkgName()} redeploy my-deployment.vercel.app`)}
${chalk.gray('')} Write Deployment URL to a file
${chalk.cyan(
`$ ${getPkgName()} redeploy my-deployment.vercel.app > deployment-url.txt`
)}
`);
};
/**
* `vc redeploy` command
* @param {Client} client
* @returns {Promise<number>} Resolves an exit code; 0 on success
*/
export default async (client: Client): Promise<number> => {
let argv;
try {
argv = getArgs(client.argv.slice(2), {
'--no-wait': Boolean,
'--yes': Boolean,
'-y': '--yes',
});
} catch (err) {
handleError(err);
return 1;
}
if (argv['--help'] || argv._[0] === 'help') {
help();
return 2;
}
const { output } = client;
const deployIdOrUrl = argv._[1];
if (!deployIdOrUrl) {
output.error(
`Missing required deployment id or url: ${getCommandName(
`redeploy <deployment-id-or-url>`
)}`
);
return 1;
}
const { contextName } = await getScope(client);
const noWait = !!argv['--no-wait'];
try {
const fromDeployment = await getDeploymentByIdOrURL({
client,
contextName,
deployIdOrUrl,
});
const deployStamp = stamp();
output.spinner(`Redeploying project ${fromDeployment.id}`, 0);
let deployment = await client.fetch<any>(`/v13/deployments?forceNew=1`, {
body: {
deploymentId: fromDeployment.id,
meta: {
action: 'redeploy',
},
name: fromDeployment.name,
target: fromDeployment.target || 'production',
},
method: 'POST',
});
output.stopSpinner();
output.print(
`${prependEmoji(
`Inspect: ${chalk.bold(deployment.inspectorUrl)} ${deployStamp()}`,
emoji('inspect')
)}\n`
);
if (!client.stdout.isTTY) {
client.stdout.write(`https://${deployment.url}`);
}
if (!noWait) {
output.spinner(
deployment.readyState === 'QUEUED' ? 'Queued' : 'Building',
0
);
if (deployment.readyState === 'READY' && deployment.aliasAssigned) {
output.spinner('Completing', 0);
} else {
try {
const clientOptions: VercelClientOptions = {
agent: client.agent,
apiUrl: client.apiUrl,
debug: client.output.debugEnabled,
path: '', // unused by checkDeploymentStatus()
teamId: fromDeployment.team?.id,
token: client.authConfig.token!,
userAgent: ua,
};
for await (const event of checkDeploymentStatus(
deployment,
clientOptions
)) {
if (event.type === 'building') {
output.spinner('Building', 0);
} else if (
event.type === 'ready' &&
((event.payload as any).checksState
? (event.payload as any).checksState === 'completed'
: true)
) {
output.spinner('Completing', 0);
} else if (event.type === 'checks-running') {
output.spinner('Running Checks', 0);
} else if (
event.type === 'alias-assigned' ||
event.type === 'checks-conclusion-failed'
) {
output.stopSpinner();
deployment = event.payload;
break;
} else if (event.type === 'canceled') {
output.stopSpinner();
output.print('The deployment has been canceled.\n');
return 1;
} else if (event.type === 'error') {
output.stopSpinner();
const now = new Now({
client,
currentTeam: fromDeployment.team?.id,
});
const error = await now.handleDeploymentError(event.payload, {
env: {},
});
throw error;
}
}
} catch (err: unknown) {
output.prettyError(err);
process.exit(1);
}
}
}
return printDeploymentStatus(client, deployment, deployStamp, noWait);
} catch (err: unknown) {
output.prettyError(err);
if (isErrnoException(err) && err.code === 'ERR_INVALID_TEAM') {
output.error(
`Use ${chalk.bold('vc switch')} to change your current team`
);
}
return 1;
}
};

View File

@@ -1,20 +1,18 @@
import chalk from 'chalk';
import type Client from '../util/client';
import { ensureLink } from '../util/link/ensure-link';
import getArgs from '../util/get-args';
import { getPkgName } from '../util/pkg-name';
import handleError from '../util/handle-error';
import logo from '../util/output/logo';
import type Client from '../../util/client';
import getArgs from '../../util/get-args';
import getProjectByCwdOrLink from '../../util/projects/get-project-by-cwd-or-link';
import { getPkgName } from '../../util/pkg-name';
import handleError from '../../util/handle-error';
import { isErrnoException } from '@vercel/error-utils';
import logo from '../../util/output/logo';
import ms from 'ms';
import requestRollback from '../util/rollback/request-rollback';
import rollbackStatus from '../util/rollback/status';
import validatePaths from '../util/validate-paths';
import requestRollback from './request-rollback';
import rollbackStatus from './status';
const help = () => {
console.log(`
${chalk.bold(
`${logo} ${getPkgName()} rollback`
)} [deploymentId|deploymentName]
${chalk.bold(`${logo} ${getPkgName()} rollback`)} [deployment id/url]
Quickly revert back to a previous deployment.
@@ -43,6 +41,7 @@ const help = () => {
${chalk.cyan(`$ ${getPkgName()} rollback`)}
${chalk.cyan(`$ ${getPkgName()} rollback status`)}
${chalk.cyan(`$ ${getPkgName()} rollback status <project>`)}
${chalk.cyan(`$ ${getPkgName()} rollback status --timeout 30s`)}
${chalk.gray('')} Rollback a deployment using id or url
@@ -60,8 +59,6 @@ export default async (client: Client): Promise<number> => {
let argv;
try {
argv = getArgs(client.argv.slice(2), {
'--debug': Boolean,
'-d': '--debug',
'--timeout': String,
'--yes': Boolean,
'-y': '--yes',
@@ -76,26 +73,6 @@ export default async (client: Client): Promise<number> => {
return 2;
}
// ensure the current directory is good
const cwd = argv['--cwd'] || process.cwd();
const pathValidation = await validatePaths(client, [cwd]);
if (!pathValidation.valid) {
return pathValidation.exitCode;
}
// ensure the current directory is a linked project
const linkedProject = await ensureLink(
'rollback',
client,
pathValidation.path,
{
autoConfirm: Boolean(argv['--yes']),
}
);
if (typeof linkedProject === 'number') {
return linkedProject;
}
// validate the timeout
let timeout = argv['--timeout'];
if (timeout && ms(timeout) === undefined) {
@@ -103,21 +80,42 @@ export default async (client: Client): Promise<number> => {
return 1;
}
const { project } = linkedProject;
const actionOrDeployId = argv._[1] || 'status';
if (actionOrDeployId === 'status') {
return await rollbackStatus({
try {
if (actionOrDeployId === 'status') {
const project = await getProjectByCwdOrLink({
autoConfirm: Boolean(argv['--yes']),
client,
commandName: 'promote',
cwd: client.cwd,
projectNameOrId: argv._[2],
});
return await rollbackStatus({
client,
project,
timeout,
});
}
return await requestRollback({
client,
project,
deployId: actionOrDeployId,
timeout,
});
}
} catch (err) {
if (isErrnoException(err)) {
if (err.code === 'ERR_CANCELED') {
return 0;
}
if (err.code === 'ERR_INVALID_CWD' || err.code === 'ERR_LINK_PROJECT') {
// do not show the message
return 1;
}
}
return await requestRollback({
client,
deployId: actionOrDeployId,
project,
timeout,
});
client.output.prettyError(err);
return 1;
}
};

View File

@@ -0,0 +1,56 @@
import chalk from 'chalk';
import type Client from '../../util/client';
import { getCommandName } from '../../util/pkg-name';
import getProjectByDeployment from '../../util/projects/get-project-by-deployment';
import ms from 'ms';
import rollbackStatus from './status';
/**
* Requests a rollback and waits for it complete.
* @param {Client} client - The Vercel client instance
* @param {string} deployIdOrUrl - The deployment name or id to rollback
* @param {string} [timeout] - Time to poll for succeeded/failed state
* @returns {Promise<number>} Resolves an exit code; 0 on success
*/
export default async function requestRollback({
client,
deployId,
timeout,
}: {
client: Client;
deployId: string;
timeout?: string;
}): Promise<number> {
const { output } = client;
const { contextName, deployment, project } = await getProjectByDeployment({
client,
deployId,
output: client.output,
});
// create the rollback
await client.fetch(`/v9/projects/${project.id}/rollback/${deployment.id}`, {
body: {}, // required
method: 'POST',
});
if (timeout !== undefined && ms(timeout) === 0) {
output.log(
`Successfully requested rollback of ${chalk.bold(project.name)} to ${
deployment.url
} (${deployment.id})`
);
output.log(`To check rollback status, run ${getCommandName('rollback')}.`);
return 0;
}
// check the status
return await rollbackStatus({
client,
contextName,
deployment,
project,
timeout,
});
}

View File

@@ -1,18 +1,21 @@
import chalk from 'chalk';
import type Client from '../client';
import type Client from '../../util/client';
import type {
Deployment,
LastAliasRequest,
PaginationOptions,
Project,
RollbackTarget,
} from '@vercel-internals/types';
import elapsed from '../output/elapsed';
import formatDate from '../format-date';
import getDeployment from '../get-deployment';
import getScope from '../get-scope';
import elapsed from '../../util/output/elapsed';
import formatDate from '../../util/format-date';
import getDeployment from '../../util/get-deployment';
import { getPkgName } from '../../util/pkg-name';
import getProjectByNameOrId from '../../util/projects/get-project-by-id-or-name';
import getScope from '../../util/get-scope';
import ms from 'ms';
import renderAliasStatus from './render-alias-status';
import sleep from '../sleep';
import { ProjectNotFound } from '../../util/errors-ts';
import renderAliasStatus from '../../util/alias/render-alias-status';
import sleep from '../../util/sleep';
interface RollbackAlias {
alias: {
@@ -61,13 +64,6 @@ export default async function rollbackStatus({
? 'Rollback in progress'
: `Checking rollback status of ${project.name}`;
const check = async () => {
const { lastRollbackTarget } = await client.fetch<any>(
`/v9/projects/${project.id}?rollbackInfo=true`
);
return lastRollbackTarget;
};
if (!contextName) {
({ contextName } = await getScope(client));
}
@@ -78,8 +74,22 @@ export default async function rollbackStatus({
// continuously loop until the rollback has explicitly succeeded, failed,
// or timed out
for (;;) {
const { jobStatus, requestedAt, toDeploymentId }: RollbackTarget =
(await check()) ?? {};
const projectCheck = await getProjectByNameOrId(
client,
project.id,
project.accountId,
true
);
if (projectCheck instanceof ProjectNotFound) {
throw projectCheck;
}
const {
jobStatus,
requestedAt,
toDeploymentId,
type,
}: Partial<LastAliasRequest> = projectCheck.lastAliasRequest ?? {};
if (
!jobStatus ||
@@ -89,12 +99,17 @@ export default async function rollbackStatus({
output.log(`${spinnerMessage}`);
}
if (!jobStatus || requestedAt < recentThreshold) {
if (
!jobStatus ||
!requestedAt ||
!toDeploymentId ||
requestedAt < recentThreshold
) {
output.log('No deployment rollback in progress');
return 0;
}
if (jobStatus === 'skipped') {
if (jobStatus === 'skipped' && type === 'rollback') {
output.log('Rollback was skipped');
return 0;
}
@@ -131,7 +146,7 @@ export default async function rollbackStatus({
if (requestedAt < recentThreshold || Date.now() >= rollbackTimeout) {
output.log(
`The rollback exceeded its deadline - rerun ${chalk.bold(
`vercel rollback ${toDeploymentId}`
`${getPkgName()} rollback ${toDeploymentId}`
)} to try again`
);
return 1;

View File

@@ -144,12 +144,6 @@ const main = async () => {
return 1;
}
let cwd = argv['--cwd'];
if (cwd) {
process.chdir(cwd);
}
cwd = process.cwd();
// The second argument to the command can be:
//
// * a path to deploy (as in: `vercel path/`)
@@ -277,6 +271,12 @@ const main = async () => {
argv: process.argv,
});
// The `--cwd` flag is respected for all sub-commands
if (argv['--cwd']) {
client.cwd = argv['--cwd'];
}
const { cwd } = client;
// Gets populated to the subcommand name when a built-in is
// provided, otherwise it remains undefined for an extension
let subcommand: string | undefined = undefined;
@@ -571,9 +571,15 @@ const main = async () => {
case 'project':
func = require('./commands/project').default;
break;
case 'promote':
func = require('./commands/promote').default;
break;
case 'pull':
func = require('./commands/pull').default;
break;
case 'redeploy':
func = require('./commands/redeploy').default;
break;
case 'remove':
func = require('./commands/remove').default;
break;

View File

@@ -25,10 +25,6 @@ const ARG_COMMON = {
'--api': String,
'--cwd': String,
// Deprecated
'--platform-version': Number,
'-V': '--platform-version',
};
export default () => ARG_COMMON;

View File

@@ -207,4 +207,12 @@ export default class Client extends EventEmitter implements Stdio {
output: this.stderr as NodeJS.WriteStream,
});
}
get cwd(): string {
return process.cwd();
}
set cwd(v: string) {
process.chdir(v);
}
}

View File

@@ -12,21 +12,21 @@ export default async function createDeploy(
client: Client,
now: Now,
contextName: string,
paths: string[],
path: string,
createArgs: CreateOptions,
org: Org,
isSettingUpProject: boolean,
cwd?: string,
cwd: string,
archive?: ArchiveFormat
): Promise<any | DeploymentError> {
try {
return await now.create(
paths,
path,
createArgs,
org,
isSettingUpProject,
archive,
cwd
cwd,
archive
);
} catch (err: unknown) {
if (ERRORS_TS.isAPIError(err)) {
@@ -109,10 +109,11 @@ export default async function createDeploy(
client,
now,
contextName,
paths,
path,
createArgs,
org,
isSettingUpProject
isSettingUpProject,
cwd
);
}

View File

@@ -0,0 +1,89 @@
import chalk from 'chalk';
import getDeployment from '../get-deployment';
import getTeamById from '../teams/get-team-by-id';
import { isValidName } from '../is-valid-name';
import type Client from '../client';
import type { Deployment, Team } from '@vercel-internals/types';
/**
* Renders feedback while retrieving a deployment, then validates the
* deployment belongs to the current team.
*
* @param client - The CLI client instance.
* @param contextName - The context/team name.
* @param deployIdOrUrl - The deployment id or URL.
* @returns The deployment info.
*/
export async function getDeploymentByIdOrURL({
client,
contextName,
deployIdOrUrl,
}: {
client: Client;
contextName: string;
deployIdOrUrl: string;
}): Promise<Deployment> {
const { config, output } = client;
if (!isValidName(deployIdOrUrl)) {
throw new Error(
`The provided argument "${deployIdOrUrl}" is not a valid deployment ID or URL`
);
}
let deployment: Deployment;
let team: Team | undefined;
try {
output.spinner(
`Fetching deployment "${deployIdOrUrl}" in ${chalk.bold(contextName)}`
);
const [teamResult, deploymentResult] = await Promise.allSettled([
config.currentTeam ? getTeamById(client, config.currentTeam) : undefined,
getDeployment(client, contextName, deployIdOrUrl),
]);
if (teamResult.status === 'rejected') {
throw new Error(
`Failed to retrieve team information: ${teamResult.reason}`
);
}
if (deploymentResult.status === 'rejected') {
throw new Error(deploymentResult.reason.message);
}
team = teamResult.value;
deployment = deploymentResult.value;
// re-render the spinner text because it goes so fast
output.log(
`Fetching deployment "${deployIdOrUrl}" in ${chalk.bold(contextName)}`
);
} finally {
output.stopSpinner();
}
if (deployment.team?.id) {
if (!team || deployment.team.id !== team.id) {
const err: NodeJS.ErrnoException = new Error(
team
? `Deployment doesn't belong to current team ${chalk.bold(
contextName
)}`
: `Deployment belongs to a different team`
);
err.code = 'ERR_INVALID_TEAM';
throw err;
}
} else if (team) {
const err: NodeJS.ErrnoException = new Error(
`Deployment doesn't belong to current team ${chalk.bold(contextName)}`
);
err.code = 'ERR_INVALID_TEAM';
throw err;
}
return deployment;
}

View File

@@ -0,0 +1,117 @@
import chalk from 'chalk';
import type Client from '../client';
import type { Deployment } from '@vercel-internals/types';
import { getPreferredPreviewURL } from '../../util/deploy/get-preferred-preview-url';
import { isDeploying } from '../../util/deploy/is-deploying';
import linkStyle from '../output/link';
import { prependEmoji, emoji } from '../../util/emoji';
export async function printDeploymentStatus(
client: Client,
{
readyState,
alias: aliasList,
aliasError,
target,
indications,
url: deploymentUrl,
aliasWarning,
}: {
readyState: Deployment['readyState'];
alias: string[];
aliasError: Error;
target: string;
indications: any;
url: string;
aliasWarning?: {
code: string;
message: string;
link?: string;
action?: string;
};
},
deployStamp: () => string,
noWait: boolean
): Promise<number> {
const { output } = client;
indications = indications || [];
const isProdDeployment = target === 'production';
let isStillBuilding = false;
if (noWait) {
if (isDeploying(readyState)) {
isStillBuilding = true;
output.print(
prependEmoji(
'Note: Deployment is still processing...',
emoji('notice')
) + '\n'
);
}
}
if (!isStillBuilding && readyState !== 'READY') {
output.error(
`Your deployment failed. Please retry later. More: https://err.sh/vercel/deployment-error`
);
return 1;
}
if (aliasError) {
output.warn(
`Failed to assign aliases${
aliasError.message ? `: ${aliasError.message}` : ''
}`
);
} else {
// print preview/production url
let previewUrl: string;
// if `noWait` is true, then use the deployment url, not an alias
if (!noWait && Array.isArray(aliasList) && aliasList.length > 0) {
const previewUrlInfo = await getPreferredPreviewURL(client, aliasList);
if (previewUrlInfo) {
previewUrl = previewUrlInfo.previewUrl;
} else {
previewUrl = `https://${deploymentUrl}`;
}
} else {
// fallback to deployment url
previewUrl = `https://${deploymentUrl}`;
}
output.print(
prependEmoji(
`${isProdDeployment ? 'Production' : 'Preview'}: ${chalk.bold(
previewUrl
)} ${deployStamp()}`,
emoji('success')
) + `\n`
);
}
if (aliasWarning?.message) {
indications.push({
type: 'warning',
payload: aliasWarning.message,
link: aliasWarning.link,
action: aliasWarning.action,
});
}
const newline = '\n';
for (let indication of indications) {
const message =
prependEmoji(chalk.dim(indication.payload), emoji(indication.type)) +
newline;
let link = '';
if (indication.link)
link =
chalk.dim(
`${indication.action || 'Learn More'}: ${linkStyle(indication.link)}`
) + newline;
output.print(message + link);
}
return 0;
}

View File

@@ -40,8 +40,7 @@ export default async function processDeployment({
...args
}: {
now: Now;
output: Output;
paths: string[];
path: string;
requestBody: DeploymentOptions;
uploadStamp: () => string;
deployStamp: () => string;
@@ -54,15 +53,14 @@ export default async function processDeployment({
isSettingUpProject: boolean;
archive?: ArchiveFormat;
skipAutoDetectionConfirmation?: boolean;
cwd?: string;
cwd: string;
rootDirectory?: string | null;
noWait?: boolean;
agent?: Agent;
}) {
let {
now,
output,
paths,
path,
requestBody,
deployStamp,
force,
@@ -72,10 +70,9 @@ export default async function processDeployment({
rootDirectory,
} = args;
const { debug } = output;
const client = now._client;
const { output } = client;
const { env = {} } = requestBody;
const token = now._token;
if (!token) {
throw new Error('Missing authentication token');
@@ -87,7 +84,7 @@ export default async function processDeployment({
token,
debug: now._debug,
userAgent: ua,
path: paths[0],
path,
force,
withCache,
prebuilt,
@@ -114,7 +111,7 @@ export default async function processDeployment({
if (event.type === 'file-count') {
const { total, missing, uploads } = event.payload;
debug(`Total files ${total.size}, ${missing.length} changed`);
output.debug(`Total files ${total.size}, ${missing.length} changed`);
const missingSize = missing
.map((sha: string) => total.get(sha).data.length)
@@ -157,7 +154,7 @@ export default async function processDeployment({
}
if (event.type === 'file-uploaded') {
debug(
output.debug(
`Uploaded: ${event.payload.file.names.join(' ')} (${bytes(
event.payload.file.data.length
)})`
@@ -166,8 +163,8 @@ export default async function processDeployment({
if (event.type === 'created') {
await linkFolderToProject(
output,
cwd || paths[0],
client,
cwd,
{
orgId: org.id,
projectId: event.payload.projectId,

View File

@@ -10,7 +10,7 @@ import mapCertError from './certs/map-cert-error';
import toHost from './to-host';
/**
* Retrieves a v13 deployment.
* Retrieves a deployment by id or URL.
*
* @param client - The Vercel CLI client instance.
* @param contextName - The scope context/team name.

View File

@@ -50,6 +50,7 @@ export interface CreateOptions {
projectSettings?: any;
skipAutoDetectionConfirmation?: boolean;
noWait?: boolean;
autoAssignCustomDomains: boolean;
}
export interface RemoveOptions {
@@ -106,7 +107,7 @@ export default class Now extends EventEmitter {
}
async create(
paths: string[],
path: string,
{
// Legacy
nowConfig: nowConfig = {},
@@ -130,11 +131,12 @@ export default class Now extends EventEmitter {
projectSettings,
skipAutoDetectionConfirmation,
noWait,
autoAssignCustomDomains,
}: CreateOptions,
org: Org,
isSettingUpProject: boolean,
archive?: ArchiveFormat,
cwd?: string
cwd: string,
archive?: ArchiveFormat
) {
let hashes: any = {};
const uploadStamp = stamp();
@@ -152,6 +154,7 @@ export default class Now extends EventEmitter {
target: target || undefined,
projectSettings,
source: 'cli',
autoAssignCustomDomains,
};
// Ignore specific items from vercel.json
@@ -160,9 +163,8 @@ export default class Now extends EventEmitter {
const deployment = await processDeployment({
now: this,
output: this._output,
agent: this._client.agent,
paths,
path,
requestBody,
uploadStamp,
deployStamp,

View File

@@ -0,0 +1,31 @@
import os from 'os';
import { join } from 'path';
import { readFile, writeFile } from 'fs-extra';
import { VERCEL_DIR } from '../projects/link';
export async function addToGitIgnore(path: string, ignore = VERCEL_DIR) {
let isGitIgnoreUpdated = false;
try {
const gitIgnorePath = join(path, '.gitignore');
let gitIgnore =
(await readFile(gitIgnorePath, 'utf8').catch(() => null)) ?? '';
const EOL = gitIgnore.includes('\r\n') ? '\r\n' : os.EOL;
let contentModified = false;
if (!gitIgnore.split(EOL).includes(ignore)) {
gitIgnore += `${
gitIgnore.endsWith(EOL) || gitIgnore.length === 0 ? '' : EOL
}${ignore}${EOL}`;
contentModified = true;
}
if (contentModified) {
await writeFile(gitIgnorePath, gitIgnore);
isGitIgnoreUpdated = true;
}
} catch (error) {
// ignore errors since this is non-critical
}
return isGitIgnoreUpdated;
}

View File

@@ -0,0 +1,294 @@
import chalk from 'chalk';
import pluralize from 'pluralize';
import { homedir } from 'os';
import { join, normalize } from 'path';
import { normalizePath } from '@vercel/build-utils';
import { lstat, readJSON, outputJSON, writeFile, readFile } from 'fs-extra';
import confirm from '../input/confirm';
import toHumanPath from '../humanize-path';
import {
VERCEL_DIR,
VERCEL_DIR_README,
VERCEL_DIR_REPO,
} from '../projects/link';
import { getRemoteUrls } from '../create-git-meta';
import link from '../output/link';
import { emoji, prependEmoji } from '../emoji';
import selectOrg from '../input/select-org';
import { addToGitIgnore } from './add-to-gitignore';
import type Client from '../client';
import type { Project } from '@vercel-internals/types';
const home = homedir();
export interface RepoProjectConfig {
id: string;
name: string;
directory: string;
}
export interface RepoProjectsConfig {
orgId: string;
remoteName: string;
projects: RepoProjectConfig[];
}
export interface RepoLink {
rootPath: string;
repoConfigPath: string;
repoConfig?: RepoProjectsConfig;
}
/**
* Given a directory path `cwd`, finds the root of the Git repository
* and returns the parsed `.vercel/repo.json` file if the repository
* has already been linked.
*/
export async function getRepoLink(cwd: string): Promise<RepoLink | undefined> {
// Determine where the root of the repo is
const rootPath = await findRepoRoot(cwd);
if (!rootPath) return undefined;
// Read the `repo.json`, if this repo has already been linked
const repoConfigPath = join(rootPath, VERCEL_DIR, VERCEL_DIR_REPO);
const repoConfig: RepoProjectsConfig = await readJSON(repoConfigPath).catch(
err => {
if (err.code !== 'ENOENT') throw err;
}
);
return { rootPath, repoConfig, repoConfigPath };
}
export async function ensureRepoLink(
client: Client,
cwd: string,
yes = false
): Promise<RepoLink | undefined> {
const { output } = client;
const repoLink = await getRepoLink(cwd);
if (repoLink) {
output.debug(`Found Git repository root directory: ${repoLink.rootPath}`);
} else {
throw new Error('Could not determine Git repository root directory');
}
let { rootPath, repoConfig, repoConfigPath } = repoLink;
if (!repoConfig) {
// Not yet linked, so prompt user to begin linking
let shouldLink =
yes ||
(await confirm(
client,
`Link Git repository at ${chalk.cyan(
`${toHumanPath(rootPath)}`
)} to your Project(s)?`,
true
));
if (!shouldLink) {
output.print(`Canceled. Repository not linked.\n`);
return;
}
const org = await selectOrg(
client,
'Which scope should contain your Project(s)?',
yes
);
client.config.currentTeam = org.type === 'team' ? org.id : undefined;
const remoteUrls = await getRemoteUrls(
join(rootPath, '.git/config'),
output
);
if (!remoteUrls) {
throw new Error('Could not determine Git remote URLs');
}
const remoteNames = Object.keys(remoteUrls);
let remoteName: string;
if (remoteNames.length === 1) {
remoteName = remoteNames[0];
} else {
// Prompt user to select which remote to use
const originIndex = remoteNames.indexOf('origin');
const answer = await client.prompt({
type: 'list',
name: 'value',
message: 'Which Git remote should be used?',
choices: remoteNames.map(name => {
return { name: name, value: name };
}),
default: originIndex === -1 ? 0 : originIndex,
});
remoteName = answer.value;
}
const repoUrl = remoteUrls[remoteName];
output.spinner(
`Fetching Projects for ${link(repoUrl)} under ${chalk.bold(org.slug)}`
);
// TODO: Add pagination to fetch all Projects
const query = new URLSearchParams({ repoUrl, limit: '100' });
const projects: Project[] = await client.fetch(`/v2/projects?${query}`);
if (projects.length === 0) {
output.log(
`No Projects are linked to ${link(repoUrl)} under ${chalk.bold(
org.slug
)}.`
);
// TODO: run detection logic to find potential projects.
// then prompt user to select valid projects.
// then create new Projects
} else {
output.log(
`Found ${chalk.bold(projects.length)} ${pluralize(
'Project',
projects.length
)} linked to ${link(repoUrl)} under ${chalk.bold(org.slug)}:`
);
}
for (const project of projects) {
output.print(` * ${chalk.cyan(`${org.slug}/${project.name}\n`)}`);
}
shouldLink =
yes ||
(await confirm(
client,
`Link to ${projects.length === 1 ? 'it' : 'them'}?`,
true
));
if (!shouldLink) {
output.print(`Canceled. Repository not linked.\n`);
return;
}
repoConfig = {
orgId: org.id,
remoteName,
projects: projects.map(project => {
return {
id: project.id,
name: project.name,
directory: normalize(project.rootDirectory || ''),
};
}),
};
await outputJSON(repoConfigPath, repoConfig, { spaces: 2 });
await writeFile(
join(rootPath, VERCEL_DIR, VERCEL_DIR_README),
await readFile(join(__dirname, 'VERCEL_DIR_README.txt'), 'utf8')
);
// update .gitignore
const isGitIgnoreUpdated = await addToGitIgnore(rootPath);
output.print(
prependEmoji(
`Linked to ${link(repoUrl)} under ${chalk.bold(
org.slug
)} (created ${VERCEL_DIR}${
isGitIgnoreUpdated ? ' and added it to .gitignore' : ''
})`,
emoji('link')
) + '\n'
);
}
return {
repoConfig,
repoConfigPath,
rootPath,
};
}
/**
* Given a `start` directory, traverses up the directory hierarchy until
* the nearest `.git/config` file is found. Returns the directory where
* the Git config was found, or `undefined` when no Git repo was found.
*/
export async function findRepoRoot(start: string): Promise<string | undefined> {
for (const current of traverseUpDirectories(start)) {
if (current === home) {
// Sometimes the $HOME directory is set up as a Git repo
// (for dotfiles, etc.). In this case it's safe to say that
// this isn't the repo we're looking for. Bail.
break;
}
// if `.vercel/repo.json` exists (already linked),
// then consider this the repo root
const repoConfigPath = join(current, VERCEL_DIR, VERCEL_DIR_REPO);
let stat = await lstat(repoConfigPath).catch(err => {
if (err.code !== 'ENOENT') throw err;
});
if (stat) {
return current;
}
// if `.git/config` exists (unlinked),
// then consider this the repo root
const gitConfigPath = join(current, '.git/config');
stat = await lstat(gitConfigPath).catch(err => {
if (err.code !== 'ENOENT') throw err;
});
if (stat) {
return current;
}
}
}
export function* traverseUpDirectories(start: string) {
let current: string | undefined = normalize(start);
while (current) {
yield current;
// Go up one directory
const next = join(current, '..');
current = next === current ? undefined : next;
}
}
function sortByDirectory(a: RepoProjectConfig, b: RepoProjectConfig): number {
const aParts = a.directory.split('/');
const bParts = b.directory.split('/');
return bParts.length - aParts.length;
}
/**
* Finds the matching Projects from an array of Project links
* where the provided relative path is within the Project's
* root directory.
*/
export function findProjectsFromPath(
projects: RepoProjectConfig[],
path: string
): RepoProjectConfig[] {
const normalizedPath = normalizePath(path);
return projects
.slice()
.sort(sortByDirectory)
.filter(project => {
if (project.directory === '.') {
// Project has no "Root Directory" setting, so any path is valid
return true;
}
return (
normalizedPath === project.directory ||
normalizedPath.startsWith(`${project.directory}/`)
);
});
}
/**
* TODO: remove
*/
export function findProjectFromPath(
projects: RepoProjectConfig[],
path: string
): RepoProjectConfig | undefined {
return findProjectsFromPath(projects, path)[0];
}

View File

@@ -133,7 +133,7 @@ export default async function setupAndLink(
const project = projectOrNewProjectName;
await linkFolderToProject(
output,
client,
path,
{
projectId: project.id,
@@ -200,13 +200,14 @@ export default async function setupAndLink(
...localConfigurationOverrides,
sourceFilesOutsideRootDirectory,
},
autoAssignCustomDomains: true,
};
const deployment = await createDeploy(
client,
now,
config.currentTeam || 'current user',
[sourcePath],
sourcePath,
createArgs,
org,
true,
@@ -250,7 +251,7 @@ export default async function setupAndLink(
Object.assign(project, settings);
await linkFolderToProject(
output,
client,
path,
{
projectId: project.id,

View File

@@ -0,0 +1,40 @@
import type Client from '../client';
import { ProjectNotFound } from '../errors-ts';
import { ensureLink } from '../link/ensure-link';
import getProjectByNameOrId from './get-project-by-id-or-name';
import type { Project } from '@vercel-internals/types';
export default async function getProjectByCwdOrLink({
autoConfirm,
client,
commandName,
cwd,
projectNameOrId,
}: {
autoConfirm?: boolean;
client: Client;
commandName: string;
cwd: string;
projectNameOrId?: string;
}): Promise<Project> {
if (projectNameOrId) {
const project = await getProjectByNameOrId(client, projectNameOrId);
if (project instanceof ProjectNotFound) {
throw project;
}
return project;
}
// ensure the current directory is a linked project
const linkedProject = await ensureLink(commandName, client, cwd, {
autoConfirm,
});
if (typeof linkedProject === 'number') {
const err: NodeJS.ErrnoException = new Error('Link project error');
err.code = 'ERR_LINK_PROJECT';
throw err;
}
return linkedProject.project;
}

View File

@@ -0,0 +1,104 @@
import chalk from 'chalk';
import type Client from '../client';
import type { Deployment, Project, Team } from '@vercel-internals/types';
import getDeployment from '../get-deployment';
import getProjectByNameOrId from './get-project-by-id-or-name';
import getScope from '../get-scope';
import getTeamById from '../teams/get-team-by-id';
import { isValidName } from '../is-valid-name';
import { Output } from '../output';
import { ProjectNotFound } from '../errors-ts';
export default async function getProjectByDeployment({
client,
deployId,
output,
}: {
client: Client;
deployId: string;
output?: Output;
}): Promise<{
contextName: string;
deployment: Deployment;
project: Project;
}> {
const { config } = client;
const { contextName } = await getScope(client);
if (!isValidName(deployId)) {
throw new Error(
`The provided argument "${deployId}" is not a valid deployment ID or URL`
);
}
let deployment: Deployment;
let team: Team | undefined;
try {
output?.spinner(
`Fetching deployment "${deployId}" in ${chalk.bold(contextName)}`
);
const [teamResult, deploymentResult] = await Promise.allSettled([
config.currentTeam ? getTeamById(client, config.currentTeam) : undefined,
getDeployment(client, contextName, deployId),
]);
if (teamResult.status === 'rejected') {
throw new Error(
`Failed to retrieve team information: ${teamResult.reason}`
);
}
if (deploymentResult.status === 'rejected') {
throw new Error(deploymentResult.reason);
}
team = teamResult.value;
deployment = deploymentResult.value;
// re-render the spinner text
output?.log(
`Fetching deployment "${deployId}" in ${chalk.bold(contextName)}`
);
if (deployment.team?.id) {
if (!team || deployment.team.id !== team.id) {
const err: NodeJS.ErrnoException = new Error(
team
? `Deployment doesn't belong to current team ${chalk.bold(
contextName
)}`
: `Deployment belongs to a different team`
);
err.code = 'ERR_INVALID_TEAM';
throw err;
}
}
if (team) {
const err: NodeJS.ErrnoException = new Error(
`Deployment doesn't belong to current team ${chalk.bold(contextName)}`
);
err.code = 'ERR_INVALID_TEAM';
throw err;
}
if (!deployment.projectId) {
throw new Error('Deployment is not associated to a project');
}
const project = await getProjectByNameOrId(client, deployment.projectId);
if (project instanceof ProjectNotFound) {
throw project;
}
return {
contextName,
deployment,
project,
};
} finally {
output?.stopSpinner();
}
}

View File

@@ -5,11 +5,13 @@ import { isAPIError, ProjectNotFound } from '../errors-ts';
export default async function getProjectByNameOrId(
client: Client,
projectNameOrId: string,
accountId?: string
accountId?: string,
includeRollbackInfo?: boolean
) {
try {
const qs = includeRollbackInfo ? '?rollbackInfo=true' : '';
const project = await client.fetch<Project>(
`/v8/projects/${encodeURIComponent(projectNameOrId)}`,
`/v9/projects/${encodeURIComponent(projectNameOrId)}${qs}`,
{ accountId }
);
return project;

View File

@@ -1,8 +1,7 @@
import fs from 'fs';
import os from 'os';
import AJV from 'ajv';
import chalk from 'chalk';
import { join } from 'path';
import { join, relative } from 'path';
import { ensureDir } from 'fs-extra';
import { promisify } from 'util';
@@ -11,7 +10,6 @@ import Client from '../client';
import { InvalidToken, isAPIError, ProjectNotFound } from '../errors-ts';
import getUser from '../get-user';
import getTeamById from '../teams/get-team-by-id';
import { Output } from '../output';
import type {
Project,
ProjectLinkResult,
@@ -23,6 +21,9 @@ import { isDirectory } from '../config/global-path';
import { NowBuildError, getPlatformEnv } from '@vercel/build-utils';
import outputCode from '../output/code';
import { isErrnoException, isError } from '@vercel/error-utils';
import { findProjectsFromPath, getRepoLink } from '../link/repo';
import { addToGitIgnore } from '../link/add-to-gitignore';
import type { RepoProjectConfig } from '../link/repo';
const readFile = promisify(fs.readFile);
const writeFile = promisify(fs.writeFile);
@@ -31,6 +32,7 @@ export const VERCEL_DIR = '.vercel';
export const VERCEL_DIR_FALLBACK = '.now';
export const VERCEL_DIR_README = 'README.txt';
export const VERCEL_DIR_PROJECT = 'project.json';
export const VERCEL_DIR_REPO = 'repo.json';
const linkSchema = {
type: 'object',
@@ -53,7 +55,7 @@ const linkSchema = {
*
* Throws an error if *both* `.vercel` and `.now` directories exist.
*/
export function getVercelDirectory(cwd: string = process.cwd()): string {
export function getVercelDirectory(cwd: string): string {
const possibleDirs = [join(cwd, VERCEL_DIR), join(cwd, VERCEL_DIR_FALLBACK)];
const existingDirs = possibleDirs.filter(d => isDirectory(d));
if (existingDirs.length > 1) {
@@ -67,9 +69,51 @@ export function getVercelDirectory(cwd: string = process.cwd()): string {
return existingDirs[0] || possibleDirs[0];
}
async function getLink(path?: string): Promise<ProjectLink | null> {
const dir = getVercelDirectory(path);
return getLinkFromDir(dir);
async function getProjectLink(
client: Client,
path: string
): Promise<ProjectLink | null> {
return (
(await getProjectLinkFromRepoLink(client, path)) ||
(await getLinkFromDir(getVercelDirectory(path)))
);
}
async function getProjectLinkFromRepoLink(
client: Client,
path: string
): Promise<ProjectLink | null> {
const repoLink = await getRepoLink(path);
if (!repoLink?.repoConfig) {
return null;
}
const projects = findProjectsFromPath(
repoLink.repoConfig.projects,
relative(repoLink.rootPath, path)
);
let project: RepoProjectConfig | undefined;
if (projects.length === 1) {
project = projects[0];
} else {
const { p } = await client.prompt({
name: 'p',
type: 'list',
message: `Please select a Project:`,
choices: repoLink.repoConfig.projects.map(p => ({
value: p,
name: p.name,
})),
});
project = p;
}
if (project) {
return {
orgId: repoLink.repoConfig.orgId,
projectId: project.id,
repoRoot: repoLink.rootPath,
};
}
return null;
}
export async function getLinkFromDir<T = ProjectLink>(
@@ -121,9 +165,45 @@ async function getOrgById(client: Client, orgId: string): Promise<Org | null> {
return { type: 'user', id: orgId, slug: user.username };
}
async function hasProjectLink(
projectLink: ProjectLink,
path: string
): Promise<boolean> {
// "linked" via env vars?
const VERCEL_ORG_ID = getPlatformEnv('ORG_ID');
const VERCEL_PROJECT_ID = getPlatformEnv('PROJECT_ID');
if (
VERCEL_ORG_ID === projectLink.orgId &&
VERCEL_PROJECT_ID === projectLink.projectId
) {
return true;
}
// linked via `repo.json`?
const repoLink = await getRepoLink(path);
if (
repoLink?.repoConfig?.orgId === projectLink.orgId &&
repoLink.repoConfig.projects.find(p => p.id === projectLink.projectId)
) {
return true;
}
// if the project is already linked, we skip linking
const link = await getLinkFromDir(getVercelDirectory(path));
if (
link &&
link.orgId === projectLink.orgId &&
link.projectId === projectLink.projectId
) {
return true;
}
return false;
}
export async function getLinkedProject(
client: Client,
path?: string
path = client.cwd
): Promise<ProjectLinkResult> {
const { output } = client;
const VERCEL_ORG_ID = getPlatformEnv('ORG_ID');
@@ -144,7 +224,7 @@ export async function getLinkedProject(
const link =
VERCEL_ORG_ID && VERCEL_PROJECT_ID
? { orgId: VERCEL_ORG_ID, projectId: VERCEL_PROJECT_ID }
: await getLink(path);
: await getProjectLink(client, path);
if (!link) {
return { status: 'not_linked', org: null, project: null };
@@ -201,32 +281,19 @@ export async function getLinkedProject(
return { status: 'not_linked', org: null, project: null };
}
return { status: 'linked', org, project };
return { status: 'linked', org, project, repoRoot: link.repoRoot };
}
export async function linkFolderToProject(
output: Output,
client: Client,
path: string,
projectLink: ProjectLink,
projectName: string,
orgSlug: string,
successEmoji: EmojiLabel = 'link'
) {
const VERCEL_ORG_ID = getPlatformEnv('ORG_ID');
const VERCEL_PROJECT_ID = getPlatformEnv('PROJECT_ID');
// if defined, skip linking
if (VERCEL_ORG_ID || VERCEL_PROJECT_ID) {
return;
}
// if the project is already linked, we skip linking
const link = await getLink(path);
if (
link &&
link.orgId === projectLink.orgId &&
link.projectId === projectLink.projectId
) {
if (await hasProjectLink(projectLink, path)) {
return;
}
@@ -252,31 +319,9 @@ export async function linkFolderToProject(
);
// update .gitignore
let isGitIgnoreUpdated = false;
try {
const gitIgnorePath = join(path, '.gitignore');
const isGitIgnoreUpdated = await addToGitIgnore(path);
let gitIgnore =
(await readFile(gitIgnorePath, 'utf8').catch(() => null)) ?? '';
const EOL = gitIgnore.includes('\r\n') ? '\r\n' : os.EOL;
let contentModified = false;
if (!gitIgnore.split(EOL).includes(VERCEL_DIR)) {
gitIgnore += `${
gitIgnore.endsWith(EOL) || gitIgnore.length === 0 ? '' : EOL
}${VERCEL_DIR}${EOL}`;
contentModified = true;
}
if (contentModified) {
await writeFile(gitIgnorePath, gitIgnore);
isGitIgnoreUpdated = true;
}
} catch (error) {
// ignore errors since this is non-critical
}
output.print(
client.output.print(
prependEmoji(
`Linked to ${chalk.bold(
`${orgSlug}/${projectName}`

View File

@@ -1,124 +0,0 @@
import chalk from 'chalk';
import type Client from '../client';
import type { Deployment, Project, Team } from '@vercel-internals/types';
import { getCommandName } from '../pkg-name';
import getDeployment from '../get-deployment';
import getScope from '../get-scope';
import getTeamById from '../teams/get-team-by-id';
import { isValidName } from '../is-valid-name';
import ms from 'ms';
import rollbackStatus from './status';
/**
* Requests a rollback and waits for it complete.
* @param {Client} client - The Vercel client instance
* @param {string} deployId - The deployment name or id to rollback
* @param {Project} project - Project info instance
* @param {string} [timeout] - Time to poll for succeeded/failed state
* @returns {Promise<number>} Resolves an exit code; 0 on success
*/
export default async function requestRollback({
client,
deployId,
project,
timeout,
}: {
client: Client;
deployId: string;
project: Project;
timeout?: string;
}): Promise<number> {
const { config, output } = client;
const { contextName } = await getScope(client);
if (!isValidName(deployId)) {
output.error(
`The provided argument "${deployId}" is not a valid deployment or project`
);
return 1;
}
let deployment: Deployment;
let team: Team | undefined;
try {
output.spinner(
`Fetching deployment "${deployId}" in ${chalk.bold(contextName)}`
);
const [teamResult, deploymentResult] = await Promise.allSettled([
config.currentTeam ? getTeamById(client, config.currentTeam) : undefined,
getDeployment(client, contextName, deployId),
]);
if (teamResult.status === 'rejected') {
output.error(`Failed to retrieve team information: ${teamResult.reason}`);
return 1;
}
if (deploymentResult.status === 'rejected') {
output.error(deploymentResult.reason);
return 1;
}
team = teamResult.value;
deployment = deploymentResult.value;
// re-render the spinner text because it goes so fast
output.log(
`Fetching deployment "${deployId}" in ${chalk.bold(contextName)}`
);
} finally {
output.stopSpinner();
}
if (deployment.team?.id) {
if (!team || deployment.team.id !== team.id) {
output.error(
team
? `Deployment doesn't belong to current team ${chalk.bold(
contextName
)}`
: `Deployment belongs to a different team`
);
output.error(
`Use ${chalk.bold('vc switch')} to change your current team`
);
return 1;
}
} else if (team) {
output.error(
`Deployment doesn't belong to current team ${chalk.bold(contextName)}`
);
output.error(`Use ${chalk.bold('vc switch')} to change your current team`);
return 1;
}
// create the rollback
await client.fetch<any>(
`/v9/projects/${project.id}/rollback/${deployment.id}`,
{
body: {}, // required
method: 'POST',
}
);
if (timeout !== undefined && ms(timeout) === 0) {
output.log(
`Successfully requested rollback of ${chalk.bold(project.name)} to ${
deployment.url
} (${deployment.id})`
);
output.log(`To check rollback status, run ${getCommandName('rollback')}.`);
return 0;
}
// check the status
return await rollbackStatus({
client,
contextName,
deployment,
project,
timeout,
});
}

View File

@@ -1,5 +1,4 @@
import { lstat as lstatRaw } from 'fs';
import { promisify } from 'util';
import { lstat } from 'fs-extra';
import { Output } from './output';
import chalk from 'chalk';
import { homedir } from 'os';
@@ -7,8 +6,6 @@ import confirm from './input/confirm';
import toHumanPath from './humanize-path';
import Client from './client';
const stat = promisify(lstatRaw);
/**
* A helper function to validate the `rootDirectory` input.
*/
@@ -18,7 +15,7 @@ export async function validateRootDirectory(
path: string,
errorSuffix: string
) {
const pathStat = await stat(path).catch(() => null);
const pathStat = await lstat(path).catch(() => null);
const suffix = errorSuffix ? ` ${errorSuffix}` : '';
if (!pathStat) {
@@ -66,7 +63,7 @@ export default async function validatePaths(
const path = paths[0];
// can only deploy a directory
const pathStat = await stat(path).catch(() => null);
const pathStat = await lstat(path).catch(() => null);
if (!pathStat) {
output.error(`Could not find ${chalk.cyan(`${toHumanPath(path)}`)}`);

View File

@@ -0,0 +1,11 @@
{
"orgId": "team_dummy",
"remoteName": "origin",
"projects": [
{
"id": "QmbKpqpiUqbcke",
"name": "app",
"directory": "app"
}
]
}

View File

@@ -0,0 +1 @@
!.vercel

View File

@@ -1,4 +1,4 @@
{
"orgId": "team_dummy",
"projectId": "archive"
"projectId": "static"
}

View File

@@ -0,0 +1 @@
<h1>hi</h1>

View File

@@ -0,0 +1,3 @@
body {
background-color: red;
}

View File

@@ -0,0 +1,4 @@
{
"orgId": "team_dummy",
"projectId": "vercel-promote"
}

View File

@@ -0,0 +1,12 @@
{
"scripts": {
"build": "next build",
"dev": "next",
"now-build": "next build"
},
"dependencies": {
"next": "13.4.3",
"react": "latest",
"react-dom": "latest"
}
}

View File

@@ -0,0 +1,10 @@
{
"version": 2,
"name": "vercel-promote",
"routes": [
{
"src": "/(.*)",
"dest": "/index?route-param=b"
}
]
}

View File

@@ -0,0 +1 @@
test

View File

@@ -0,0 +1,3 @@
.next
yarn.lock
!.vercel

View File

@@ -0,0 +1,11 @@
import { withRouter } from 'next/router';
function Index({ router }) {
const data = {
pathname: router.pathname,
query: router.query,
};
return <div>{JSON.stringify(data)}</div>;
}
export default withRouter(Index);

View File

@@ -0,0 +1 @@
!.vercel

View File

@@ -0,0 +1,21 @@
{
"orgId": "team_dummy",
"remoteName": "origin",
"projects": [
{
"id": "QmbKpqpiUqbcke",
"name": "monorepo-dashboard",
"directory": "dashboard"
},
{
"id": "QmX6P93ChNDoZP",
"name": "monorepo-marketing",
"directory": "marketing"
},
{
"id": "QmScb7GPQt6gsS",
"name": "monorepo-blog",
"directory": "blog"
}
]
}

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