Skip to content

Running build from the root in a monorepo does not behave like production deployment #7392

Open
@lachieh

Description

@lachieh

Describe the bug

I have a repo configured with the workspace root as an application, and packages inside of the same folder. This is not typical, but it is a supported structure according to the the NPM documentation.

The main application is built from the workspace root, and deploys perfectly fine in production however, running netlify build from the workspace root will only ever show the prompt to select a workspace package.

Previous to this PR, it was possible to set the --cwd flag and override this behavior.

Steps to reproduce

  1. create a monorepo with a build script in the workspace package.json
  2. create a new package inside the workspace packages folder and add the folder to the root package.json workspaces key
  3. run npx [email protected] build --cwd .
    build runs successfully
  4. run npx [email protected] build --cwd .
    cli prompt for workspace package appears - This is breaking behavior

Configuration

No response

Environment

System:
OS: macOS 15.5
CPU: (10) arm64 Apple M1 Max
Memory: 66.64 MB / 64.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 22.15.0
npm: 10.9.2
npmPackages:
netlify-cli: ^22.1.6 => 22.2.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bugcode to address defects in shipped code

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions