Jack Hsu c86de97b12
fix(core): convert-to-monorepo support for root project without project.json (#26507)
This PR fixes `convert-to-monorepo` generator, so it works after `nx
init` on a single project.

## Current Behavior

If you use :

```
npm create vite react-app -- --template=react-ts
cd react-app
npx nx init
```

Then, you'll get an error when running `nx g convert-to-monorepo`.

```
 NX   The following projects are defined in multiple locations:

- react-app:
  - .
  - packages/react-app

To fix this, set a unique name for each project in a project.json inside the project's root. If the project does not currently have a project.json, you can create one that contains only a name.

MultipleProjectsWithSameNameError: The following projects are defined in multiple locations:
- react-app:
  - .
  - packages/react-app
  - 
```

## Expected Behavior
The generator should work, and you can run commands successfully
afterwards (e.g. `nx serve react-app`).

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #
2024-06-12 18:24:32 -04:00
..

Nx - Smart Monorepos · Fast CI

{{links}}


Nx: Smart Monorepos · Fast CI

Nx is a build system with built-in tooling and advanced CI capabilities. It helps you maintain and scale monorepos, both locally and on CI.

{{content}}