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.
This will solve two of the warnings from [Socket.dev](https://socket.dev/npm/package/vercel):
<img width="1126" alt="image" src="https://github.com/vercel/vercel/assets/229881/c890c973-4f5a-44d9-9b96-2580a1e40ed0">
This preinstall script isn't necessary to run Vercel CLI, its only used to improve the error message in two cases:
- The system has `node` version prior to 14.x (3 years ago)
- The system still has `now` installed but should be using `vercel` (last shipped 3 years ago)
The usage of `preinstall` scripts have gone out of style due to security audits so we should remove this script now.
We have code that tries to detect and highlight errors in the build logs, however it doesn't look for `Error!`, only `Error:`.
We could update that highlight code or we could update Vercel CLI to make it consistent.
This PR is the latter.
I don't think anyone is using this command anymore in the world of M1.
Anyways, we should be using `ts-node` to execute the CLI from source code instead of skipping steps at build-time to iterate quickly.
* [tests] Use `turbo` for unit tests
* .
* .
* Revert "."
This reverts commit 3d6204fef3fda3c7b4bf08955a186fe806d7c597.
* Add "src/util/constants.ts" to outputs
* .
* Add `@vercel/node-bridge` outputs
* .
* Mac and Windows
* .
* Node 14
* .
* .
* Add templates to CLI output
* Run only selected test files
* Add cross platform testing
* make test paths relative and have minimum per chunk
* add install arg
* update shell
* bump cache key
* use backslashes on windows
* pass tests as arg
* update script name
* update turbo config
* forward turbo args correctly
* dont use backslashes
* chunk integration tests instead
* update env
* separate static-build tests
* ensure unit test turbo cache is saved
* ensure turbo cache is saved for dev/cli
* fix cache key and update timeout
* Increase static-build unit test timeout
* Leverage turbo remote caching instead of actions/cache
* apply suggestions and test chunking itself
* update other ci jobs
* fix test collecting
Co-authored-by: Nathan Rajlich <n@n8.io>
* Use ncc to bundle middleware plugin, move dependencies to devDependencies, remove querystring
* Switch from globby (deprecated dependencies) to glob in middleware plugin.
* Bundle the node-plugin and middleware-plugin into cli.
* Add initial `vercel-plugin-middleware`
* Ignore `entries.js` from ESLint
* Add `runDevMiddleware()` stub
* Add test
* Add support for "_middleware.{js,ts}" to `vercel dev` (#6880)
* Add websandbox from next.js codebase.
* Use node-fetch instead of next's polyfilled fetch.
* Handle middleware rewrites.
* Add response, headers, and request to websandbox context.
* Move websandbox dependency to middleware plugin.
* Add integration tests, update websandbox to support ts files and json imports.
* commit yarn.lock changes after rebasing
* Clean up left over console.logs, fix some tsc issues, and rebase issue.
* Fix failing test and eslint.
* Fix middleware test on windows.
* [examples] Update Vercel Next.js example template to 12.0.1 (#6905)
* Mark the Plugins as external to CLI's ncc build
* [cli] Improve tracing in vc build (#6898)
* [cli] Fix tracing for `vc build`
* Ignore object when there are no changes
* Make Next < 12 work with FS API w/ nft
* Update packages/cli/src/commands/build.ts
Co-authored-by: Nathan Rajlich <n@n8.io>
* Document how Next.js processing works in build
* [cli] Fix static assets (#6906)
* Make sure output path is .next
* Fix up require-server-files for processing
* Fix typo
* Move static
* Update static rename
Co-authored-by: Andy Bitz <artzbitz@gmail.com>
Co-authored-by: Nathan Rajlich <n@n8.io>
Co-authored-by: Andy <AndyBitz@users.noreply.github.com>
* Publish Canary
- vercel@23.1.3-canary.17
- @vercel/client@10.2.3-canary.15
- @vercel/static-config@0.0.1-canary.0
* [cli] Ignore `.env` and `.gitignore` in "vc build" (#6910)
* Publish Canary
- vercel@23.1.3-canary.18
* Pass workPath to plugins.
The new plugin architecture doesn't pass a full BuildOptions object, previous
to this commit it wasn't passing any options at all. I've added workingPath to
support running dev/build from directories other than the project root.
* Remove error state when package.json exists, but no build script
This allows vercel build to continue working for projects that are not using
frameworks, but use package.json to manage dependencies.
* Fix types, pull in middleware header fix from next.js
Next js PR w/ the header fix:
https://github.com/vercel/next.js/pull/30560
* Fix missing entries file for vc build.
* Update call signature of middleware when using vc build.
Co-authored-by: Drew Bredvick <dbredvick@gmail.com>
Co-authored-by: Nathan Rajlich <n@n8.io>
Co-authored-by: Jared Palmer <jared@jaredpalmer.com>
Co-authored-by: Andy Bitz <artzbitz@gmail.com>
Co-authored-by: Andy <AndyBitz@users.noreply.github.com>
Co-authored-by: Gary Borton <gdborton@gmail.com>
Co-authored-by: Drew Bredvick <dbredvick@gmail.com>
Co-authored-by: Jared Palmer <jared@jaredpalmer.com>
Co-authored-by: Andy Bitz <artzbitz@gmail.com>
Co-authored-by: Andy <AndyBitz@users.noreply.github.com>
* remove prefix from codeowners
* remove references from ignore files
* Remove prefix from package json and tests
* Add run js without prefixes
* Rename package folders
* Delete auto generated test files
* Remove now-node in integration test
* Put back deleted vercel json files
* Remove eol
* Add styfle suggestion to comment in utils/run.js
Co-authored-by: Steven <steven@ceriously.com>