Leosvel Pérez Espinosa cfe32c2560
feat(misc): add --useProjectJson flag to CNW (#30475)
## Current Behavior

Creating new workspaces since Nx 20.6.0 will generate the Nx
configuration in `package.json` files. This is intended, given that it
is part of the new setup using TypeScript Project References and Package
Manager Workspaces, but there's no way to choose to generate the Nx
configuration in `project.json` files. Project generators do allow to
choose but there's no way to do it when creating a new workspace. This
forces users who want to use `project.json` files to generate an empty
workspace and then use a project generator.

## Expected Behavior

When creating a new Nx workspace, users can provide an option
(`--use-project-json`) to generate the Nx configuration in
`project.json` files.

## Related Issue(s)

Fixes #30464
2025-03-24 08:42:18 -04:00

127 lines
4.1 KiB
JSON

{
"name": "new",
"factory": "./src/generators/new/new#newGenerator",
"schema": {
"$schema": "https://json-schema.org/schema",
"$id": "NxWorkspaceNew",
"title": "Create an empty workspace",
"description": "Create an empty workspace.",
"type": "object",
"cli": "nx",
"properties": {
"name": {
"description": "The name of the workspace.",
"type": "string",
"$default": { "$source": "argv", "index": 0 },
"x-prompt": "What name would you like to use for the workspace?"
},
"style": {
"description": "The file extension to be used for style files.",
"type": "string",
"default": "css"
},
"routing": {
"description": "Add routing to the generated application.",
"type": "boolean",
"default": true
},
"useReactRouter": {
"description": "Use React Router for routing.",
"type": "boolean",
"default": false
},
"standaloneApi": {
"description": "Use Standalone Components if generating an Angular application.",
"type": "boolean",
"default": false
},
"defaultBase": {
"type": "string",
"description": "Default base branch for affected."
},
"skipInstall": {
"description": "Skip installing dependency packages.",
"type": "boolean",
"default": false
},
"preset": {
"description": "What to create in the new workspace.",
"type": "string"
},
"appName": { "type": "string", "description": "Application name." },
"linter": {
"description": "The tool to use for running lint checks.",
"type": "string",
"enum": ["eslint", "none"],
"default": "eslint"
},
"packageManager": {
"description": "The package manager used to install dependencies.",
"type": "string",
"enum": ["npm", "yarn", "pnpm", "bun"]
},
"framework": {
"description": "The framework which the application is using",
"type": "string",
"enum": ["express", "koa", "fastify", "nest", "none"]
},
"nextAppDir": {
"description": "Enable the App Router for this project.",
"type": "boolean",
"default": true
},
"nextSrcDir": {
"description": "Generate a `src` directory for this project.",
"type": "boolean",
"default": true
},
"unitTestRunner": {
"description": "The tool to use for running unit tests.",
"type": "string",
"enum": ["jest", "vitest", "none"]
},
"e2eTestRunner": {
"description": "The tool to use for running e2e tests.",
"type": "string",
"enum": ["playwright", "cypress", "jest", "detox", "none"]
},
"ssr": {
"description": "Enable Server-Side Rendering (SSR) and Static Site Generation (SSG/Prerendering) for the Angular application.",
"type": "boolean",
"default": false
},
"serverRouting": {
"description": "Use the Angular Server Routing and App Engine APIs (Developer Preview).",
"type": "boolean"
},
"prefix": {
"description": "The prefix to use for Angular component and directive selectors.",
"type": "string"
},
"formatter": {
"description": "The tool to use for code formatting.",
"type": "string",
"enum": ["none", "prettier"],
"default": "none"
},
"workspaces": {
"description": "Whether to use package manager workspaces.",
"type": "boolean",
"default": true
},
"useProjectJson": {
"type": "boolean",
"description": "Use a `project.json` configuration file instead of inlining the Nx configuration in the `package.json` file."
}
},
"additionalProperties": true,
"presets": []
},
"description": "Create a workspace.",
"hidden": true,
"implementation": "/packages/workspace/src/generators/new/new#newGenerator.ts",
"aliases": [],
"path": "/packages/workspace/src/generators/new/schema.json",
"type": "generator"
}