fix: pass rootDirectory in projectSettings for monorepo deployments

FE
6mo ago
+1900-2188

Summary

When deploying monorepos via the API, the root-directory input is only passed
to @vercel/client's clientOptions (local file hashing) but never included
in the POST /v13/deployments body as projectSettings.rootDirectory.

Without this, Vercel's build server falls back to the repo root, fails to detect
the correct package manager (e.g. pnpm), and uses npm — which breaks on
workspace:* protocol with EUNSUPPORTEDPROTOCOL.

Changes

  • Pass projectSettings.rootDirectory in the deployment options when
    root-directory is set
  • Add new source-files-outside-root-directory input (default: true) to
    support monorepos where dependencies live outside the root directory
  • Add unit tests for the new behavior

Test plan

  • Existing unit tests pass (196/196)
  • Action builds successfully
  • Tested with a real monorepo deployment (pnpm + turborepo)

Summary by cubic

Fixes monorepo deployments by sending projectSettings.rootDirectory and optionally sourceFilesOutsideRootDirectory, and adds a node-version input to control Vercel’s Node.js version.

  • Bug Fixes

    • Include projectSettings.rootDirectory in POST /v13/deployments to avoid falling back to the repo root and mis-detecting the package manager.
    • Always apply action inputs even when vercel.json exists; include rootDirectory and/or sourceFilesOutsideRootDirectory only when set, and treat them independently.
  • New Features

    • Added node-version input to set projectSettings.nodeVersion; the input takes precedence, and when unset falls back to package.json engines.node.
    • Added source-files-outside-root-directory input (default false) for monorepos with shared packages outside the root.