Commit Graph

1171 Commits

Author SHA1 Message Date
Gary Borton
a5c3cbcd45 Allow passing of local git meta even with no remote. (#9824)
This enables the CLI to pass locally detected git meta data even when there is no available remote. It requires a corresponding internal change, which is blocking the e2e tests.
2023-04-20 13:11: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
Chris Barber
a63b9d960b Publish Stable
- vercel@28.19.0
 - @vercel/client@12.4.10
 - @vercel/edge@0.3.3
 - @vercel/error-utils@1.0.10
 - @vercel/fs-detectors@3.8.11
 - @vercel/gatsby-plugin-vercel-builder@1.2.9
 - @vercel/go@2.5.0
 - @vercel/hydrogen@0.0.63
 - @vercel/next@3.7.5
 - @vercel/node@2.11.0
 - @vercel/python@3.1.59
 - @vercel/remix-builder@1.8.5
 - @vercel/static-build@1.3.24
 - @vercel/static-config@2.0.16
2023-04-19 10:14:58 -05:00
Sean Massa
f43894ef4e [cli] refactor to use create deployment param type (#9805)
Small refactor to provide type safety to this invocation of `createDeploy`.
2023-04-18 19:29:42 +00:00
Chris Barber
b52df7a533 [cli] Add vc deploy --no-wait and vc inspect --wait (#9802)
There's a need to allow `vc deploy` to not block and not wait for the deployment to finish, yet return the URL.

```
$ vc deploy --no-wait
Vercel CLI 28.18.5
🔍  Inspect: https://vercel.com/chrisbarber/next13fun/L8X4oxp5LGcmy51yVptXwMK7n4wt [1s]
📝  Note: Deployment is still processing...
  Production: https://next13fun-kecpx6za2-chrisbarber.vercel.app [1s]
```

Normally this deployment takes around 30 seconds, but the `--no-wait` flag causes the command to exit in less than 2 seconds.

The next step is to add the ability for `vc inspect` to wait as well as specify the maximum time to wait (defaults to 3 minutes, same as `vc rollback`).

```
$ vc inspect --wait --timeout 1m https://next13fun-kecpx6za2-chrisbarber.vercel.app
Vercel CLI 28.18.5
> Fetched deployment "next13fun-ov2r4pvdz-chrisbarber.vercel.app" in chrisbarber [23s]

  General

    id		dpl_9VUuV23EGeoqWf7akEeL8rP1c8cb
    name	next13fun
    status	● Ready
    url		https://next13fun-ov2r4pvdz-chrisbarber.vercel.app
    created	Thu Apr 13 2023 12:25:07 GMT-0500 (Central Daylight Time) [24s ago]
<snip>
```

Also added the ability to pipe the URL into `vc inspect`:

```
echo https://next13fun-ov2r4pvdz-chrisbarber.vercel.app | vc inspect
```

Combined, it allows us to support cool things like:

```
$ vc inspect $(vc deploy --prod --no-wait) --wait
```
2023-04-17 15:43:05 +00:00
Nathan Rajlich
993a404311 [cli] Support pnpm in getUpdateCommand() (#9813)
We're currently showing bad instructions when CLI was installed via pnpm:

![image](https://user-images.githubusercontent.com/71256/232131890-ecc1c2c1-ace6-48b3-bd6f-8631cf7be087.png)

This adds support for it by leveraging our existing `scanParentDirs()` logic from build-utils.
2023-04-14 21:45:35 +00:00
Nathan Rajlich
3e7bcb2073 [cli] Remove a bunch of isCanary checks (#9806)
We no longer publish versions that include `-canary` in the package.json `version` field, so these are dead code. Just doing a little bit of cleanup.
2023-04-14 20:35:56 +00:00
Ethan Arrowood
ed119d6a33 [internals] Refactor @vercel-internals/types enums into constants (#9789)
- Creates new internals package, `@vercel-internals/constants`
- Refactors the `enum`s from `@vercel-internals/types` into `as const` objects, and moves them to `@vercel-intenrals/constants`
- Updates all relevant code within `packages/cli`, including `@vercel-internals/types` imports to be `import type`
2023-04-14 18:08:12 +00:00
Chris Barber
38eb0bca04 [go] Support 'go.work' file and resolve shared deps relative to work path (#9708)
This PR fixes a few issues related to `vc dev`.

1. Create a default `go.work` file in the cache dir when building the `vercel-dev-server-go` executable
2. Copy the existing `go.mod` file into the cache dir and update any "replace" relative paths
3. Split the "build" logic into separate functions for the legacy "main" package build and the `go.mod` build

Additionally, it fixes:

1. `vc build`: pass in `build.env` from `vercel.json`
2. Fix several tests to work with `vc dev` and `vc build`

Linear: https://linear.app/vercel/issue/VCCLI-638/vc-dev-go-builder-cant-resolve-workspace-dependencies

The user that reported the issue has tested this build and seems to fix their use case: https://github.com/vercel/vercel/issues/9393#issuecomment-1490726785.
2023-04-13 17:59:47 +00:00
Chris Barber
732ac2072c [tests] Update Typescript, Jest, and ts-jest (#9782)
Co-authored-by: Nathan Rajlich <n@n8.io>
Co-authored-by: Swarnava Sengupta <swarnavasengupta@gmail.com>
2023-04-12 08:38:03 -05:00
Nathan Rajlich
6b9e274bc7 [cli] Simplify parseRepoUrl() and fix edge case (#9796)
Fixes an edge case in `parseRepoUrl()` when there is a `.com` in the repo name. The code was hard to refactor in its previous form so I refactored it to be simpler as well.
2023-04-12 04:29:29 +00:00
Dan Stowell
14ece4111a Publish Stable
- vercel@28.18.5
 - @vercel/fs-detectors@3.8.10
 - @vercel/gatsby-plugin-vercel-builder@1.2.8
 - @vercel/static-build@1.3.23
2023-04-11 16:25:20 -05:00
Sean Massa
925c8ba18c Publish Stable
- @vercel/build-utils@6.7.1
 - vercel@28.18.4
 - @vercel/client@12.4.9
 - @vercel/edge@0.3.2
 - @vercel/error-utils@1.0.9
 - @vercel/frameworks@1.3.4
 - @vercel/fs-detectors@3.8.9
 - @vercel/gatsby-plugin-vercel-analytics@1.0.9
 - @vercel/gatsby-plugin-vercel-builder@1.2.7
 - @vercel/go@2.4.4
 - @vercel/hydrogen@0.0.62
 - @vercel/next@3.7.4
 - @vercel/node-bridge@4.0.1
 - @vercel/node@2.10.3
 - @vercel/python@3.1.58
 - @vercel/redwood@1.1.14
 - @vercel/remix-entry-server@0.1.1
 - @vercel/remix-builder@1.8.4
 - @vercel/routing-utils@2.2.0
 - @vercel/ruby@1.3.75
 - @vercel/static-build@1.3.22
 - @vercel/static-config@2.0.15
2023-04-07 16:43:42 -05:00
Espen Hovlandsdal
52b2892b80 [build-utils][cli][fs-detectors] Upgrade minimatch to 3.1.2 (#9762)
Minimatch 3.0.4 has a [ReDoS
vulnerability](https://security.snyk.io/vuln/SNYK-JS-MINIMATCH-3050818).
While not likely to be an issue for the packages that use it here, a
simple version bump should prevent the issue and reduce vulnerability
noise on audits. 3.1.2 is the latest version within the 3.x range, so
prevents breaking changes.
2023-04-06 16:18:07 -07:00
Ethan Arrowood
07a09b7880 [cli] refactor pkg.ts into @vercel-internals/get-package-json (#9719)
Extracts the logic from `pkg.ts` into a new utility function
`getPackageJSON` from `@vercel-internals/utils`.

---------

Co-authored-by: Nathan Rajlich <n@n8.io>
2023-04-06 12:18:04 -06:00
Nathan Rajlich
46348201b4 Publish Stable
- @vercel/build-utils@6.7.0
 - vercel@28.18.3
 - @vercel/client@12.4.8
 - @vercel/fs-detectors@3.8.8
 - @vercel/gatsby-plugin-vercel-builder@1.2.6
 - @vercel/go@2.4.3
 - @vercel/hydrogen@0.0.61
 - @vercel/next@3.7.3
 - @vercel/node@2.10.2
 - @vercel/python@3.1.57
 - @vercel/redwood@1.1.13
 - @vercel/remix-builder@1.8.3
 - @vercel/ruby@1.3.74
 - @vercel/static-build@1.3.21
2023-03-29 12:25:26 -07:00
Sean Massa
70c8b32cf0 [tests] Split CLI integration tests into chunks (#9688)
Welcome to the grand splitting of CLI integration tests:

- replaced `test-cli` test suite with `test-e2e`
- made some small fixes along the way
- split integration tests into 3 files
- moved shared logic to `packages/cli/test/helpers/*`
- simplified `_execa` / `execa` / `execute` usage into `execCli` and `exec`
    - simplified arguments required to make these work
- defaulted `execCLI` to set `NO_COLOR=1` to make assertions simpler in tests that aren't testing color/emoji support
- expanded functionality of `formatOutput` to handle error states
- centralized temp dir handling and cleanup
- enhanced `waitForPrompt` to:
    - more clearly show what it was waiting for
    - support waiting for regex, string, or a function that returns a boolean
    - show what was the most recent thing it saw
    - end early if the process it's monitoring exits
- removed some test pollution where unnecessary, shifted some into `beforeAll`
- renamed unit tests helper from `setupFixture` to `setupUnitFixture` to avoid confusion with the new shared helper `setupE2EFixture`


Some of this could be pulled out into a separate PR, but the feedback cycle is a slog, which this PR is helping to address. I'd be happy to discuss what could be pulled out, but I'd also be happy to get the whole thing through.

---

Wait for prompt failures:

<img width="939" alt="CleanShot 2023-03-27 at 10 24 21@2x" src="https://user-images.githubusercontent.com/41545/227987773-a3582549-32f9-4131-8a35-7be7cc265b66.png">

---

Current Timing:

```
Tests / test-e2e (vercel, 1, ubuntu-latest) (pull_request) Successful in 3m
Tests / test-e2e (vercel, 2, ubuntu-latest) (pull_request) Successful in 8m
Tests / test-e2e (vercel, 3, ubuntu-latest) (pull_request) Successful in 8m
```

---

Before merge, I'll mark the original `CLI` integration test suite as no longer required.
2023-03-29 07:44:42 +00:00
Sean Massa
54514a44af Publish Stable
- @vercel/build-utils@6.6.0
 - vercel@28.18.2
 - @vercel/client@12.4.7
 - @vercel/fs-detectors@3.8.7
 - @vercel/gatsby-plugin-vercel-builder@1.2.5
 - @vercel/go@2.4.2
 - @vercel/hydrogen@0.0.60
 - @vercel/next@3.7.2
 - @vercel/node-bridge@4.0.0
 - @vercel/node@2.10.1
 - @vercel/python@3.1.56
 - @vercel/redwood@1.1.12
 - @vercel/remix-builder@1.8.2
 - @vercel/ruby@1.3.73
 - @vercel/static-build@1.3.20
2023-03-27 22:25:08 -05:00
Sean Massa
6f01e5ab75 [cli] support build -y shorthand (#9717)
The `build` command wasn't supporting the `-y` shorthand for `--yes`. Now it does.

I looked at the other uses and they all seem fine.
2023-03-27 15:18:16 +00:00
Sean Massa
6a7fa1526c Publish Stable
- vercel@28.18.1
 - @vercel/gatsby-plugin-vercel-builder@1.2.4
 - @vercel/next@3.7.1
 - @vercel/node@2.10.0
 - @vercel/remix-builder@1.8.1
 - @vercel/static-build@1.3.19
2023-03-23 14:45:33 -05:00
Sean Massa
ab9915af32 Publish Stable
- @vercel/build-utils@6.5.0
 - vercel@28.18.0
 - @vercel/client@12.4.6
 - @vercel/fs-detectors@3.8.6
 - @vercel/gatsby-plugin-vercel-builder@1.2.3
 - @vercel/go@2.4.1
 - @vercel/hydrogen@0.0.59
 - @vercel/next@3.7.0
 - @vercel/node@2.9.14
 - @vercel/python@3.1.55
 - @vercel/redwood@1.1.11
 - @vercel/remix-builder@1.8.0
 - @vercel/ruby@1.3.72
 - @vercel/static-build@1.3.18
2023-03-22 12:37:51 -05:00
Sean Massa
0fb0601d19 [node] Improve edge-handler-template error handling (#9697) 2023-03-22 11:31:44 -05:00
Sean Massa
4c77dab5cb [tests][cli] convert CLI integration tests to TS (#9672)
Converts the CLI integration tests to TypeScript. This will make it easier to pick apart the test pollution.
2023-03-18 18:21:45 +00:00
Sean Massa
151b0dfb63 [cli] handle BUILD_UTILS_SPAWN_* errors (#9689)
Some condition in the system caused `BUILD_UTILS_SPAWN_1` errors to be thrown for failed deployments. The error handling logic wasn't handling this properly, causing the error message to never show up in the output.

```
Error: Unexpected error. Please try again later. ()
```
2023-03-17 22:12:23 +00:00
Steven
c0471302e9 [cli] Ignore vc build subdirectory warning on vercel (#9685)
This warning is only relevant when running `vc build` locally so we can hide it for Vercel deployments.

I noticed this in the build logs here:

<img width="862" alt="image" src="https://user-images.githubusercontent.com/229881/225774670-9b4aecf5-d020-489f-819f-7b55ce96f877.png">
2023-03-16 23:57:33 +00:00
Nathan Rajlich
b2c68f1301 Publish Stable
- @vercel/build-utils@6.4.0
 - vercel@28.17.0
 - @vercel/client@12.4.5
 - @vercel/frameworks@1.3.3
 - @vercel/fs-detectors@3.8.5
 - @vercel/gatsby-plugin-vercel-builder@1.2.2
 - @vercel/go@2.4.0
 - @vercel/hydrogen@0.0.58
 - @vercel/next@3.6.7
 - @vercel/node@2.9.13
 - @vercel/python@3.1.54
 - @vercel/redwood@1.1.10
 - @vercel/remix-builder@1.7.0
 - @vercel/routing-utils@2.1.11
 - @vercel/ruby@1.3.71
 - @vercel/static-build@1.3.17
 - @vercel/static-config@2.0.14
2023-03-16 12:23:51 -07:00
Chris Barber
0dd3711f63 [go] Go builder improvements (#9576)
This PR fixes a handful of Go builder issues all related to the selected Golang version being used to build the function:

- `go.mod` version ignored for `vc build` and `vc dev`, uses system `PATH` version only
- `vc dev` fails if `go.mod` does not exist
- If the analyze bin doesn’t exist, downloads golang into `.vercel/cache/golang` instead of a global shared dir
- When running `vc dev`, doesn’t reuse go build code/common settings
- go tidy fails when `go.mod` set to 1.19 or 1.20, but 1.18 or older is installed
- `vc build` builds wrong arch on Apple Silicon/arm64
- `vc build` on Windows doesn't properly resolve "builds" in `vercel.json` due to posix separator issue
- `vc build` on Windows fails with `package <pkg/name> is not in GOROOT` due to posix separator issue
- Removed `actions/setup-go` from all test workflows

I added a test that tests the `go tidy` issue.
2023-03-16 19:05:09 +00:00
Chris Barber
4b657debed [cli] Honor --local-config when present during vc build (#9675)
As reported https://github.com/vercel/vercel/discussions/9648, `vc build` does not honor the `--local-config <file>` option.

`vc build` will only load the `vercel.json` (or `now.json`) in the `workPath` which is based on the `rootDirctory`.

If `--local-config` is specified in the command line arguments, then it should take precedence.
2023-03-16 18:31:43 +00:00
Sean Massa
395929b36a [tests] remove comment (#9671)
We don't need this comment.
2023-03-14 16:18:56 +00:00
Sean Massa
0e235a926a [tests][cli] CLI Integration tests - better failure messages (#9667)
Co-authored-by: Steven <steven@ceriously.com>
2023-03-14 10:48:27 -05:00
Nathan Rajlich
f1bdc0bfd1 [remix] Rename @vercel/remix to @vercel/remix-builder (#9665)
We're changing the name of the Remix Builder to free up the name `@vercel/remix` for user-facing usage within Remix applications.
2023-03-13 22:10:52 +00:00
Steven
bada86b8d6 [tests] Add prettier check (#9664)
This PR fixes the formatting on several files that were never run through `prettier`.

It also makes sure to run `prettier` in CI to to [fail fast](https://github.com/vercel/vercel/actions/runs/4408442998/jobs/7723453978) when the incorrect formatting is attempted.
2023-03-13 19:55:59 +00:00
Ethan Arrowood
7ec377757d [cli] update monorepo default setting log (#9654)
Updates the `setMonorepoDefaultSetting` log
2023-03-10 19:23:38 +00:00
Sean Massa
c5e9ccfacf [tests] convert CLI Integration tests from ava to jest (#9632)
Co-authored-by: Steven <steven@ceriously.com>
2023-03-09 18:34:03 -06:00
Sean Massa
66fe3db888 [tests] add tests to edge handler template (#9528)
The Edge Handler wrapping logic we add during `vc dev` was not testable. This PR refactors it to be testable and adds some basic tests.
2023-03-08 22:56:51 +00:00
Chris Barber
413706d72a [tests] Bump test timeouts for slow tests (#9631)
This PR address the following slow tests:

* https://linear.app/vercel/issue/VCCLI-560/flakey-test-login-with-no-color
* https://linear.app/vercel/issue/VCCLI-561/flakey-test-[vercel-dev]-04-create-react-app
* https://linear.app/vercel/issue/VCCLI-563/flakey-test-build-›-should-build-with-vercelnode
* https://linear.app/vercel/issue/VCCLI-574/flakey-test-build-output-api-v1-should-detect-the-output-format
* https://linear.app/vercel/issue/VCCLI-578/flakey-test-importbuilders-›-should-install-and-import-1st-party
* https://linear.app/vercel/issue/VCCLI-580/flakey-test-creategitmeta-›-detects-dirty-commit
2023-03-08 18:44:13 +00:00
Steven
21a440b832 Publish Stable
- @vercel/build-utils@6.3.4
 - vercel@28.16.15
 - @vercel/client@12.4.4
 - @vercel/fs-detectors@3.8.4
 - @vercel/gatsby-plugin-vercel-builder@1.2.1
 - @vercel/go@2.3.11
 - @vercel/hydrogen@0.0.57
 - @vercel/next@3.6.6
 - @vercel/node@2.9.12
 - @vercel/python@3.1.53
 - @vercel/redwood@1.1.9
 - @vercel/remix@1.6.2
 - @vercel/ruby@1.3.70
 - @vercel/static-build@1.3.16
2023-03-07 13:56:14 -05:00
Steven
48d925f105 Publish Stable
- @vercel/build-utils@6.3.3
 - vercel@28.16.14
 - @vercel/client@12.4.3
 - @vercel/fs-detectors@3.8.3
 - @vercel/gatsby-plugin-vercel-builder@1.2.0
 - @vercel/go@2.3.10
 - @vercel/hydrogen@0.0.56
 - @vercel/next@3.6.5
 - @vercel/node@2.9.11
 - @vercel/python@3.1.52
 - @vercel/redwood@1.1.8
 - @vercel/remix@1.6.1
 - @vercel/ruby@1.3.69
 - @vercel/static-build@1.3.15
2023-03-07 13:17:14 -05:00
Ethan Arrowood
af239b5fa5 [internals] Create @vercel-internals/types (#9608)
Moves the type file out of the cli package and into its own standalone
package. utilizes `@vercel/style-guide` too for typescript config,
eslint, and prettier.
2023-03-07 08:44:25 -07:00
Sean Massa
a92c68e0ff Publish Stable
- vercel@28.16.13
 - @vercel/next@3.6.4
 - @vercel/remix@1.6.0
2023-03-06 13:47:36 -06:00
Jeemin Choi(최지민)
a638755e95 [cli] change patch-inquirer-legacy to patch-inquirer (#8919)
Co-authored-by: Sean Massa <EndangeredMassa@gmail.com>
2023-03-03 14:27:11 -06:00
Nathan Rajlich
fc614a7a92 Publish Stable
- vercel@28.16.12
 - @vercel/remix@1.5.1
2023-03-02 09:00:40 -08:00
Nathan Rajlich
cfc1c9e818 Publish Stable
- vercel@28.16.11
 - @vercel/next@3.6.3
 - @vercel/remix@1.5.0
2023-03-01 17:24:34 -08:00
Steven
40081cb319 Publish Stable
- vercel@28.16.10
 - @vercel/remix@1.4.3
2023-02-28 19:12:33 -05:00
Chris Barber
803a9363f9 Publish Stable
- vercel@28.16.9
 - @vercel/gatsby-plugin-vercel-analytics@1.0.8
 - @vercel/gatsby-plugin-vercel-builder@1.1.11
 - @vercel/node-bridge@3.1.14
 - @vercel/node@2.9.10
 - @vercel/static-build@1.3.14
2023-02-28 15:32:23 -06:00
Chris Barber
4a0a3b64a2 [node] Added middlewareRawSrc to BOA route config (#9435)
Blocked by https://github.com/vercel/vercel/pull/9564

The build output's route configuration contains a compiled `src` from the list of `matchers` in middleware config, however we need to also save the original inputs so that we can render something meaningful in the web UI. The new prop added to the route is called `middlewareRawSrc` of type `string[]`.

This PR depends on https://github.com/vercel/api/pull/17231.

Linear: https://linear.app/vercel/issue/VCCLI-411/display-uncompressed-edge-middleware-matcher-show-the-list-of-matches
2023-02-28 21:26:26 +00:00
Mehul Kar
347c2de3a2 [tests] Adopt Workspace Configurations from turbo@1.8 (#9573) 2023-02-28 20:49:28 +00:00
Sean Massa
e0f8bc9820 Publish Stable
- @vercel/build-utils@6.3.2
 - vercel@28.16.8
 - @vercel/client@12.4.2
 - @vercel/edge@0.3.1
 - @vercel/frameworks@1.3.2
 - @vercel/fs-detectors@3.8.2
 - @vercel/gatsby-plugin-vercel-builder@1.1.10
 - @vercel/go@2.3.9
 - @vercel/hydrogen@0.0.55
 - @vercel/next@3.6.2
 - @vercel/node-bridge@3.1.13
 - @vercel/node@2.9.9
 - @vercel/python@3.1.51
 - @vercel/redwood@1.1.7
 - @vercel/remix@1.4.2
 - @vercel/routing-utils@2.1.10
 - @vercel/ruby@1.3.68
 - @vercel/static-build@1.3.13
2023-02-28 10:26:29 -06:00
Steven
31bc2581f3 [cli] Remove unncessary warning when monorepo setting override (#9565)
This warning is not actionable by the user so this PR removes it.
2023-02-27 16:23:49 -05:00
Sean Massa
1f30e56a6d [cli][dev] remove link to 404 FAQ (#9508) 2023-02-27 10:37:57 -06:00