Allows to define a `statusCode` property on `rewrites` in the same way as we already have it for `redirects`.
This is still blocked internally as it requires a feature flag to build with that setting.
So it would allow to set the status in `vercel.json` like this:
```json
{
"rewrites": [
{
"source": "/*",
"destination": "not-found.html",
"statusCode": 404
}
]
}
```
Once released, I'll update the documentation on that as well.
### Requirements
> Cause once router sees a status code is set, it stops routing.
> So it wont run the `miss` and `rewrite` sections again once it has a status.
> So just need to make sure wherever status code is set, its at the end of its routing.
> [[internal ref](https://vercel.slack.com/archives/C01A2M9R8RZ/p1691594782351809?thread_ts=1691540814.244679&cid=C01A2M9R8RZ)]
This adds a new `pnpm type-check` that leverages `turbo` to validate the TypeScript code. This can be run at the top-level or for an individual package.
The `test-lint` workflow will run it after linting and doing the prettier check.
As apart of this effort, each package's `tsconfig.json` has been simplified. There's a new top-level `tsconfig.base.json` file that extends the Vercel Style Guide for TypeScript. Each package's `tsconfig.json` has been audited and previously suppressed rules that no longer apply have been removed. The result is each package's `tsconfig.json` is greatly simplified and we can control common settings in the base config while keeping the flexibility of package-level overrides.
Lastly, in `package/cli`, `pnpm build` calls `scripts/build.mjs` which calls `scripts/compile-templates.mjs`. The `compile-templates.mjs` file was generating invalid TypeScript code. I've fixed it and now it's happier than ever.
Note: In order to run `pnpm type-check`, you must first `pnpm build` because we need the `.d.ts` definition files.
Auditing for options use of `testFixtureStdio`:
* `{ skipDeploy: true }` is used frequently.
* `{ readyTimeout: 2000 }` is used once in `'[vercel dev] 08-hugo'`
* `{ projectSettings: { directoryListing: true } }` is used once in `'[vercel dev] 00-list-directory'`
Both `isExample` and `expectedCode` have stopped being used.
Some of our tests take quite some time to run and occasionally timeout when accessing https://yarnpkg.com/. We decided to make sure there is a lockfile for this _and_ just move over to `npm`. Shifting the `packages/cli` fixtures over in this PR.
I possibly missed one but I changed the install commands in tests and ran
* pnpm test
* pnpm test-unit
* pnpm test-dev
* pnpm test-e2e
As part of a refactor in #10535, we lost the – admittedly untested – behavior of
1. setting the new `teamId` from a login `result`
2. removing this value if it was `undefined` ensuring we didn't write `"currentTeam": undefined` to `config.json`.
This resulted in subsequent calls to `vc login` keeping the last known defined `teamId`.
This should restore that behavior but also retain the behavior of calling `updateCurrentTeamAfterLogin` to check if the user has a new `defaultTeamId` to be stored.
Not a fan of just how much mutation exists on `client.config` in this flow, but that predates this change and I wanted to keep this bugfix as small as possible.
During [project-level-rbac bug bash](https://linear.app/vercel/issue/IAM-1267/vc-certs-ls-fails-with-typeerror-for-contributors) we were facing a runtime error
```
Error: An unexpected error occurred in certs: TypeError: Cannot read properties of undefined (reading 'length')
```
The reason for that is because the API responded with `403`, which was expected in our test. However the CLI should not exit with a generic runtime error in this case.
This PR removes the `.catch(err => err)` error shallowing instruction.
This PR removes a [deprecated package](https://www.npmjs.com/package/@zeit/source-map-support) that was originally added in PR https://github.com/vercel/vercel/pull/1205
The comment said:
```js
// we only enable source maps while developing, since
// they have a small performance hit. for this, we
// look for `pkg`, which is only present in the final bin
```
Some time along the way this was changed from development only, to always being installed.
However, no longer need this package because we can enable source maps for development by using [`--enable-source-map`](https://nodejs.org/docs/latest-v18.x/api/cli.html#--enable-source-maps) which has been available since Node.js 12
I noticed the latest release got [larger in size](https://packagephobia.com/result?p=vercel@32.3.1) when we were expecting it to get smaller.
This is because a 14MB source map was published to npm as [`dist/index.js.map`](https://unpkg.com/browse/vercel@32.3.1/dist/).
This PR disables source maps by default and you can optionally enable when running locally to debug.
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.
# Releases
## vercel@32.3.1
### Patch Changes
- Use "esbuild" to build CLI
([#10555](https://github.com/vercel/vercel/pull/10555))
- Updated dependencies
\[[`9f63ca60a`](9f63ca60ad),
[`e3f9faf51`](e3f9faf513)]:
- @vercel/next@4.0.8
- @vercel/remix-builder@2.0.8
## @vercel/next@4.0.8
### Patch Changes
- Fix edge case for setting `__NEXT_PRIVATE_PREBUNDLED_REACT`
([#10568](https://github.com/vercel/vercel/pull/10568))
## @vercel/remix-builder@2.0.8
### Patch Changes
- Update `@remix-run/dev` fork to v2.0.1
([#10566](https://github.com/vercel/vercel/pull/10566))
During `vc build` do following when `@vercel/speed-insights` package is in dependencies:
- Show a warning when `VERCEL_ANALYTICS_ID` is set in environment variables
- Unset it in process.env to prevent auto-injecting old speed insights in Next.js
Durning `vc env pull` prevent pulling internal environment variables `VERCEL_ANALYTICS_ID`, `VERCEL_SPEED_INSIGHTS_ID` & `VERCEL_WEB_ANALYTICS_ID`. They are never required in the frontend
Restores DataDog flakey test detection. Briefly disabled because the old method of using exit codes would bail the entire workflow.
Taking the Turbo team's suggestion of looking at `runData.execution` values to avoid an extra loop. Now with unit tests!
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.
# Releases
## @vercel/fs-detectors@5.1.0
### Minor Changes
- Add support for bun detection in monorepo
([#10511](https://github.com/vercel/vercel/pull/10511))
## vercel@32.2.4
### Patch Changes
- Add support for bun detection in monorepo
([#10511](https://github.com/vercel/vercel/pull/10511))
- Updated dependencies
\[[`1b6f3a0f6`](1b6f3a0f65)]:
- @vercel/static-build@2.0.6
## @vercel/static-build@2.0.6
### Patch Changes
- Add support for bun detection in monorepo
([#10511](https://github.com/vercel/vercel/pull/10511))
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Updates the `secrets` command to be a bit more modern. Initially I was going to covert this to typescript but that change was quite large, so going stepwise for easier review.
1. Moves the command implementation into a directory like other commands
2. Shifts the command data structure into its own file
3. Adds a test.
Other relevant comments inline.
Addresses ReDoS vulnerability: https://security.snyk.io/vuln/SNYK-JS-SEMVER-3247795
Uses the latest unaffected versions in the respective major versions, to prevent having to deal with any other breaking changes.