Commit Graph

120 Commits

Author SHA1 Message Date
Jeff See
9db0298981 Switch from jest to vitest for remix builder (#11652) 2024-05-28 17:02:45 +00:00
Nathan Rajlich
139e8cdb17 [node] Use vitest for unit tests (#11631)
Similar to #11302, but for the `@vercel/node` package.
2024-05-23 18:20:18 +00:00
Kiko Beats
bc95d764b4 ci: add Node.js v18 tests (#11575)
Some tests are skipped because CI tests are running against v16.

I added a new GitHub CI job just inlcuding the tests that are skipped for now.
2024-05-10 21:15:37 +00:00
Steven
d3e83ad8b8 [ci] Speed up CI with macos-14 (#11133)
- Before: [5m 38s](https://github.com/vercel/vercel/actions/runs/7831733256/job/21368857518?pr=11131)
- After: [1m 23s](https://github.com/vercel/vercel/actions/runs/7836156637/job/21383185433?pr=11133)


Learn more: https://github.blog/changelog/2024-01-30-github-actions-macos-14-sonoma-is-now-available/
2024-04-11 16:04:24 +00:00
Jeff See
cdfc879f69 Specify npm script to run during Find Changes step (#11409)
Add a new vitest-unit test type and specify which npm script to run for a given chunks tests. Currently the CLI unit tests are actually running as part of the Find Changes action, because vitest ignores the `--listTests` flag and just runs the tests immediately.
2024-04-11 00:26:58 +00:00
Nathan Rajlich
1333071a3a Remix Vite plugin support (#11031)
Adds support for Remix apps which use the new Remix Vite plugin.

* The vanilla Remix + Vite template deploys correctly out-of-the-box,
however only a single Node.js function will be used, and a warning will
be printed saying to configure the `vercelPreset()` Preset.
* When used in conjunction with the `vercelPreset()` Preset
(https://github.com/vercel/remix/pull/81), allows for the application to
utilize Vercel-specific features, like per-route `export const config`
configuration, including multi-runtime (Node.js / Edge runtimes) within
the same app.

## To test this today

1. Generate a Remix + Vite project from the template:
    ```
    npx create-remix@latest --template remix-run/remix/templates/vite
    ```
1. Install `@vercel/remix`:
    ```
    npm i --save-dev @vercel/remix
    ```
1. **(Before Remix v2.8.0 is released)** - Update the `@remix-run/dev`
dependency to use the "pre" tag which contains [a bug
fix](https://github.com/remix-run/remix/pull/8864):
    ```
    npm i --save--dev @remix-run/dev@pre @remix-run/serve@pre
    ```
1. Configure the `vercelPreset()` in the `vite.config.ts` file:
    ```diff
    --- a/vite.config.ts
    +++ b/vite.config.ts
    @@ -1,10 +1,11 @@
     import { vitePlugin as remix } from "@remix-run/dev";
     import { installGlobals } from "@remix-run/node";
     import { defineConfig } from "vite";
    +import { vercelPreset } from "@vercel/remix/vite";
     import tsconfigPaths from "vite-tsconfig-paths";
    
     installGlobals();
    
     export default defineConfig({
    -  plugins: [remix(), tsconfigPaths()],
    +  plugins: [remix({ presets: [vercelPreset()] }), tsconfigPaths()],
     });
    ```
1. Create a new Vercel Project in the dashboard, and ensure the Vercel
preset is set to "Remix" in the Project Settings. The autodetection will
work correctly once this PR is merged, but for now it gets incorrectly
detected as "Vite" preset.
* **Hint**: You can create a new empty Project by running the `vercel
link` command.
<img width="545" alt="Screenshot 2024-02-27 at 10 37 11"
src="https://github.com/vercel/vercel/assets/71256/f46baf57-5d97-4bde-9529-c9165632cb30">
1. Deploy to Vercel, setting the `VERCEL_CLI_VERSION` environment
variable to use the changes in this PR:
    ```
vercel deploy -b
VERCEL_CLI_VERSION=https://vercel-git-tootallnate-zero-1217-research-remix-v-next-vite.vercel.sh/tarballs/vercel.tgz
    ```
2024-02-28 11:22:05 -06:00
Ethan Arrowood
447c20fb99 Add GitHub Runner Image Version to turbo-cache-key.json (#10887)
Add GitHub Runner Image Version to turbo-cache-key.json
2023-12-01 19:39:07 +00:00
JJ Kasper
39ce9166ba Update to run Next.js integration with Node.js v18 (#10740)
Co-authored-by: Chris Barber <chris.barber@vercel.com>
Co-authored-by: Steven <steven@ceriously.com>
2023-10-20 09:36:50 -05:00
Chris Barber
222710f612 Add type-check and unify tsconfig (#10667)
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.
2023-10-09 11:58:23 +00:00
Steven
ab01608785 Revert "[ci] use --output-logs=new-only to only list tests that changed" (#10584)
Reverts vercel/vercel#10570

This was causing a bug because my assumption about turbo cache hit/miss was incorrect. 

I thought `turbo run test-e2e --listTests` would be use the same cache as `turbo run test-e2e` but it does not. So what was happening is that tests were not running on a second push to a PR because turbo already "cached" the result of `--listTests` so that `new-only` was saying there are no new tests and nothing to run 🤦
2023-09-25 20:11:40 +00:00
Steven
33e43e103a [ci] use --output-logs=new-only to only list tests that changed (#10570)
This PR effectively reverts the change in https://github.com/vercel/vercel/pull/9172 since it is safe to skip tests that are not part of the turbo cache miss results. Previously, we were unable to do this because all of those jobs/checks were marked as required on the github repo settings. But now we have a single ["Summary" job](f6e863d4bb/.github/workflows/test.yml (L111-L128)) that is marked as required at the repo level so now we don't need to create jobs anymore just to see the turbo cache hit go green.

- [15f90b0](15f90b057d) correctly skipped all e2e tests since none of the packages changed
- [2613963](26139634fb) correctly ran the `vercel` e2e tests since the cli package was changed
- [8488b05](8488b0543b) correctly runs tests for all packages since build-utils was changed and all packages depend on it

Also see [Turbo `-output-logs` docs](https://turbo.build/repo/docs/reference/command-line-reference/run#--output-logs) for more.
2023-09-22 17:14:57 +00:00
Steven
3dbc75580d [ci] increase concurrency for e2e tests (#10569)
Increase concurrency for e2e tests so they finish faster
2023-09-22 16:50:21 +00:00
Nathan Rajlich
10d4e51ac5 [node] Use "esbuild" to build package (#10553) 2023-09-20 18:35:57 -03:00
Nathan Rajlich
d0d0520111 [next] Use "esbuild" to build package (#10482)
### Before

```
$ time pnpm run build

> @vercel/next@4.0.6 build /Users/nrajlich/Code/vercel/vercel/packages/next
> node build.js

ncc: Version 0.24.0
ncc: Compiling file index.js
ncc: Using typescript@4.9.5 (local user-provided)
1506kB  dist/main/index.js
1506kB  [3345ms] - ncc 0.24.0

real    0m5.210s
user    0m9.083s
sys     0m0.506s

$ ls -l dist/
total 1700
-rw-r--r-- 1 nrajlich staff    2176 Sep 20 15:18 ___get-nextjs-edge-function.js
-rw-r--r-- 1 nrajlich staff    3283 Sep 20 15:18 create-serverless-config.js
drwxr-xr-x 6 nrajlich staff     192 Sep 20 15:18 edge-function-source/
-rw-r--r-- 1 nrajlich staff 1542314 Sep 20 15:18 index.js
-rw-r--r-- 1 nrajlich staff     728 Sep 20 15:18 legacy-launcher.js
-rw-r--r-- 1 nrajlich staff    6807 Sep 20 15:18 legacy-versions.js
-rw-r--r-- 1 nrajlich staff   66662 Sep 20 15:18 server-build.js
-rw-r--r-- 1 nrajlich staff    1583 Sep 20 15:18 server-launcher.js
-rw-r--r-- 1 nrajlich staff    5167 Sep 20 15:18 sourcemapped.js
-rw-r--r-- 1 nrajlich staff    1003 Sep 20 15:18 templated-launcher-shared.js
-rw-r--r-- 1 nrajlich staff     799 Sep 20 15:18 templated-launcher.js
-rw-r--r-- 1 nrajlich staff   83876 Sep 20 15:18 utils.js

$ pnpm pack && ls -lh vercel-next-4.0.6.tgz 
-rw-r--r-- 1 nrajlich staff 373K Sep 20 15:19 vercel-next-4.0.6.tgz
```

### After

```
$ time pnpm run build

> @vercel/next@4.0.6 build /Users/nrajlich/Code/vercel/vercel/packages/next
> node build.mjs

real    0m1.144s
user    0m0.550s
sys     0m0.171s

$ ls -l dist/
total 540
-rw-r--r-- 1 nrajlich staff   2176 Sep 20 15:15 ___get-nextjs-edge-function.js
-rw-r--r-- 1 nrajlich staff 528575 Sep 20 15:15 index.js
-rw-r--r-- 1 nrajlich staff   1680 Sep 20 15:15 legacy-launcher.js
-rw-r--r-- 1 nrajlich staff    901 Sep 20 15:15 server-launcher.js
-rw-r--r-- 1 nrajlich staff    532 Sep 20 15:15 templated-launcher-shared.js
-rw-r--r-- 1 nrajlich staff    316 Sep 20 15:15 templated-launcher.js

$ pnpm pack && ls -lh vercel-next-4.0.6.tgz 
-rw-r--r-- 1 nrajlich staff 104K Sep 20 15:15 vercel-next-4.0.6.tgz
```
2023-09-20 20:01:03 +00:00
Trek Glowacki
92ad73b8f3 Restore datadog checking with logs not exit codes (#10527)
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!
2023-09-18 16:43:16 +00:00
Trek Glowacki
9953fc765f Complete the error message (#10509) 2023-09-14 11:39:53 -05:00
Trek Glowacki
29ea1af971 Skip DataDog reporting if Turbo cache indicates the uploaded files would be identical (#10501) 2023-09-14 10:47:20 -05:00
Nathan Rajlich
b265e13d40 [static-build] Use esbuild (#10462)
Switch to using esbuild to compile + bundle `@vercel/static-build`.
2023-09-08 19:39:12 +00:00
Nathan Rajlich
1138f7e3d1 Use esbuild for non-ncc'd packages (#10430)
The intention is for this to be a drop-in replacement for compiling TypeScript to JavaScript, but using `esbuild` instead of `tsc`. `tsc` is still needed, but only for the cases where we want to generate type definitions.
2023-09-06 19:49:50 +00:00
Nathan Rajlich
0e9ec194a3 Keep vercel@canary up to date with vercel@latest (#10410) 2023-08-28 22:50:30 -07:00
Steven
37f5c62700 BREAKING CHANGE: Drop Node.js 14, bump minimum to Node.js 16 (#10369)
https://vercel.com/changelog/node-js-14-and-16-are-being-deprecated


https://github.com/nodejs/Release/blob/main/README.md#end-of-life-releases
2023-08-21 08:51:38 -04:00
Nathan Rajlich
d1b0dbe3a7 [remix] Install @vercel/remix-run-dev at build-time instead of using symlink (#9784)
Instead of including the fork `@remix-run/dev` package as a regular dependency of `@vercel/remix-builder`, install it at build-time by modifying the project's `package.json` file. The reasons for this are:

* Avoids deprecation warnings from a few packages that currently exist on the `@remix-run/dev` package when installing Vercel CLI (those warnings already show up in the build logs anyways, so nothing new there).
* Allows us to install a version as close as possible to the version specified in the user's `package.json` (similar to how we do when auto-injecting the `@vercel/remix` package). This will be especially important once Remix v2 is released, which will have breaking changes compared to v1.

**Note:** `@vercel/remix-run-dev` is still a _dev_ dependency, so that we can use TypeScript types from it, as well as, at runtime, we use the version in the Builder's `package.json` to determine the maximum versions of `@vercel/remix-run-dev` and/or `@vercel/remix` which can safely be installed.

Fixes #10027.
Fixes #10222.
2023-07-28 20:49:32 +00:00
Steven
b61674cb2d [tests] Fix next update cron job (#10214)
This was supposed to be fixed in https://github.com/vercel/vercel/pull/10173 but the file was created after git commit.

This PR makes sure the file is created before git commit.
2023-07-14 16:07:26 +00:00
Steven
680d666fdc [tests] Add huozhi to cron job for Next.js (#10205)
This adds Jiachi to the default reviewer list for the Next.js update cron job.
2023-07-13 13:48:27 +00:00
Vercel Release Bot
ca1f41200a [tests] Upgrade Turbo to version 1.10.7 (#10164)
This auto-generated PR updates Turbo to version 1.10.7
2023-07-05 20:46:59 +00:00
Steven
5c6941d18c [tests] Fix update-next.js cron job to include changeset (#10173)
The cron job script only updates the Next.js example so it should have an empty changeset
2023-07-03 21:03:42 +00: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
Chris Barber
6cdd38d130 [tests] Pin Next.js version in test fixtures (#9910)
Co-authored-by: Sean Massa <EndangeredMassa@gmail.com>
2023-05-19 09:06:08 -05:00
Nathan Rajlich
18c1c45ce3 Add changeset for @remix-run/dev updater GH Action (#9972)
Adds a changeset file when the GH Action to update `@remix-run/dev`
creates a pull request.
2023-05-17 16:39:09 -07:00
Sean Massa
7235000181 fix release script (#9959)
The [previous PR](https://github.com/vercel/vercel/pull/9942) used `github.repos`, but I think this needs to be `github.rest.repos`.

- [Docs](https://octokit.github.io/rest.js/v19#repos)
- [Failed GH Action](https://github.com/vercel/vercel/actions/runs/4994578940/jobs/8945329301)
2023-05-17 18:26:30 +00:00
Sean Massa
5124d431ea fix deploy from local (#9969)
Local deployments of this repo would fail because this repo assumes that it's only ever deployed via git connection.
2023-05-17 17:45:28 +00:00
Nathan Rajlich
d80732d74f [release] Promote vercel CLI release to "latest" (#9942)
It's possible that changesets will promote a release to latest that is
not the Vercel CLI release. This script ensures that a `vercel@` release
is always the latest after a publish happens.
2023-05-11 13:40:34 -07:00
Nathan Rajlich
2fd59a3b5a Use changesets instead of lerna (#9914)
`changesets` will improve our release workflow, since we will no longer need to manually curate and publish the changelog and GitHub Release. Instead, you simply merge the publish PR that the changesets GH action maintains as we push commits to `main`.
2023-05-10 19:35:17 +00:00
Kiko Beats
6dded87426 [node] Add streaming support for vc dev (#9745)
Until now, the user code response it's buffered and serialized. This is
mismatching how Vercel works these days.

This PR enables streaming response in `vc dev` for Edge/Serverless.

As part of the implementation, the `node-bridge` which spawns a process
to consume the user code is not necessary anymore.

Some necessary files (like HTTP server helpers) have been moved to live
in node builder package instead.

---------

Co-authored-by: Ethan Arrowood <ethan.arrowood@vercel.com>
Co-authored-by: Sean Massa <EndangeredMassa@gmail.com>
2023-04-19 23:56:41 +02:00
Nathan Rajlich
64d9cef963 [publish] Trigger update workflow on "api" repo after Publish (#9791)
So that we don't need to trigger it manually and/or wait for the cronjob.
2023-04-12 06:53:46 +00:00
Sean Massa
a2da071755 [tests] re-chunk example tests (#9792)
It turns out that these do take a long time to run when not cached. We do want these chunks.
2023-04-12 00:57:07 +00:00
Sean Massa
dc8523998c [tests] combine examples e2e into one chunk (#9772)
We don't need 5 chunks of the very fast examples tests. We spend more time in setup for each one. We are also more likely to hit the [usage limit](https://docs.github.com/en/actions/learn-github-actions/usage-limits-billing-and-administration#usage-limits) with these.

This PR combines them into one test suite.
2023-04-07 23:47:27 +00:00
Ethan Arrowood
46d0503361 Fix update gatsby fixture cron job (#9725)
This PR fixes the gatsby fixture update script to correctly create pull
requests after it updates the fixtures.
2023-04-06 09:56:04 -06:00
Steven
c06209901c [tests] Run unit tests concurrently in chunks (#9615)
We can separate each package `test-unit` into a separate job. This will help isolate problems and we can re-run CI for a specific package.
2023-03-07 23:50:21 +00:00
Ethan Arrowood
ddae78458d Fix remix updater workflow when fetching latest version (#9592) 2023-03-02 11:54:29 -08:00
Ethan Arrowood
2309c43fce add vercel/remix-run-dev updater workflow (#9588)
Adds a github workflow and javascript updater script that will update
the `@remix-run/dev` version to the latest release of
`@vercel/remix-run-dev`
2023-03-01 13:50:23 -08:00
Steven
9200be61d2 [tests] Publish with npm@9 (#9583)
https://vercel.slack.com/archives/C04DUD7EB1B/p1676488464681929
2023-03-01 00:09:40 +00:00
Ethan Arrowood
a05cc11719 [tests] Fix gatsby cron job script - git diff operation (#9577)
as titled
2023-02-28 13:13:57 -07:00
Ethan Arrowood
55b999ea9b [tests] add missing -w option for pnpm in gatsby cron job script (#9575)
as titled
2023-02-28 13:05:31 -07:00
Ethan Arrowood
8babc3694f [tests] Fix gatsby cron job (#9574)
Changes logic so its a single npm call instead of multiple
2023-02-28 11:59:58 -08:00
Ethan Arrowood
6dc0321216 [tests] add missing __dirname from gatsby cron job script (#9572)
as titled
2023-02-28 11:40:05 -08:00
Ethan Arrowood
3df8c05792 [tests] Add cron job to update gatsby fixtures (#9510)
PR to add a cron job and script that automatically updates gatsby
fixture versions.
2023-02-28 11:32:00 -08:00
Steven
c2f8a5990a [tests] Fix gh actions cron job to update next/turbo (#9453)
This token should run the tests automatically
2023-02-15 12:11:54 -05:00
Steven
8f49969585 [tests] Update tests script names (#9433)
### Description 

These script names are currently really long and that makes it difficult
to read.

In particular, the most important part (the package name) is often
truncated.

See before/after below.

## Before

<img width="302" alt="image"
src="https://user-images.githubusercontent.com/229881/218588978-b8ed9a7a-f4da-4d58-af3f-2b1a7087737d.png">

## After

<img width="290" alt="image"
src="https://user-images.githubusercontent.com/229881/218596895-65627ad0-2895-4bd7-8506-f5f545a419d3.png">
2023-02-14 10:31:46 -05:00
Steven
a9ff23fe22 [test] Switch to turbo main release line (#9429)
Per @tknickman, we don't need to be testing every turbo canary in this
repo, that will happen in the turborepo tests
2023-02-13 16:00:42 -05:00