feat(misc): make directory a required option for generators (#28093)

<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

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

Fixes #

---------

Co-authored-by: Colum Ferry <cferry09@gmail.com>
Co-authored-by: Nicholas Cunningham <ndcunningham@gmail.com>
This commit is contained in:
Jack Hsu 2024-10-01 09:29:44 -04:00 committed by GitHub
parent e0f2f02552
commit 27edf71cef
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
387 changed files with 2525 additions and 4124 deletions

View File

@ -9,22 +9,17 @@
"type": "object",
"cli": "nx",
"properties": {
"name": {
"description": "The name of the application.",
"type": "string",
"$default": { "$source": "argv", "index": 0 },
"x-prompt": "What name would you like to use for the application?",
"pattern": "^[a-zA-Z][^:]*$"
},
"directory": {
"description": "The directory of the new application.",
"type": "string",
"x-priority": "important"
"$default": { "$source": "argv", "index": 0 },
"x-prompt": "Which directory do you want to create the application in?"
},
"projectNameAndRootFormat": {
"description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).",
"name": {
"description": "The name of the application.",
"type": "string",
"enum": ["as-provided", "derived"]
"pattern": "^[a-zA-Z][^:]*$",
"x-priority": "important"
},
"style": {
"description": "The file extension to be used for style files.",
@ -184,7 +179,7 @@
}
},
"additionalProperties": false,
"required": ["name"],
"required": ["directory"],
"examplesFile": "## Examples\n\n{% tabs %}\n{% tab label=\"Simple Application\" %}\n\nCreate an application named `my-app`:\n\n```bash\nnx g @nx/angular:application apps/my-app\n```\n\n{% /tab %}\n\n{% tab label=\"Specify directory and style extension\" %}\n\nCreate an application named `my-app` in the `my-dir` directory and use `scss` for styles:\n\n{% callout type=\"note\" title=\"Directory Flag Behavior Changes\" %}\nThe command below uses the `as-provided` directory flag behavior, which is the default in Nx 16.8.0. If you're on an earlier version of Nx or using the `derived` option, use `--directory=my-dir`. See the [as-provided vs. derived documentation](/deprecated/as-provided-vs-derived) for more details.\n{% /callout %}\n\n```bash\nnx g @nx/angular:app my-dir/my-app --style=scss\n```\n\n{% /tab %}\n\n{% tab label=\"Single File Components application\" %}\n\nCreate an application with Single File Components (inline styles and inline templates):\n\n```bash\nnx g @nx/angular:app apps/my-app --inlineStyle --inlineTemplate\n```\n\n{% /tab %}\n\n{% tab label=\"Set custom prefix and tags\" %}\n\nSet the prefix to apply to generated selectors and add tags to the application (used for linting).\n\n```bash\nnx g @nx/angular:app apps/my-app --prefix=admin --tags=scope:admin,type:ui\n```\n\n{% /tab %}\n{% /tabs %}\n",
"presets": []
},

View File

@ -37,11 +37,6 @@
"description": "The directory of the new remote application if one needs to be created.",
"type": "string"
},
"projectNameAndRootFormat": {
"description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).",
"type": "string",
"enum": ["as-provided", "derived"]
},
"style": {
"description": "The file extension to be used for style files for the remote if one needs to be created.",
"type": "string",

View File

@ -15,11 +15,17 @@
}
],
"properties": {
"directory": {
"description": "The directory of the new application.",
"type": "string",
"$default": { "$source": "argv", "index": 0 },
"x-prompt": "Which directory do you want to create the application in?"
},
"name": {
"type": "string",
"description": "The name to give to the host Angular application.",
"$default": { "$source": "argv", "index": 0 },
"pattern": "^[a-zA-Z][^:]*$"
"pattern": "^[a-zA-Z][^:]*$",
"x-priority": "important"
},
"remotes": {
"type": "array",
@ -31,15 +37,6 @@
"description": "Should the host application use dynamic federation?",
"default": false
},
"directory": {
"description": "The directory of the new application.",
"type": "string"
},
"projectNameAndRootFormat": {
"description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).",
"type": "string",
"enum": ["as-provided", "derived"]
},
"style": {
"description": "The file extension to be used for style files.",
"type": "string",
@ -178,7 +175,7 @@
}
},
"additionalProperties": false,
"required": ["name"],
"required": ["directory"],
"presets": []
},
"x-type": "application",

View File

@ -12,19 +12,13 @@
"name": {
"type": "string",
"description": "The name of the library.",
"$default": { "$source": "argv", "index": 0 },
"x-prompt": "What name would you like to use for the library?",
"pattern": "(?:^@[a-zA-Z0-9-*~][a-zA-Z0-9-*._~]*\\/[a-zA-Z0-9-~][a-zA-Z0-9-._~]*|^[a-zA-Z][^:]*)$"
"x-priority": "important"
},
"directory": {
"type": "string",
"description": "A directory where the library is placed.",
"x-priority": "important"
},
"projectNameAndRootFormat": {
"description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).",
"type": "string",
"enum": ["as-provided", "derived"]
"$default": { "$source": "argv", "index": 0 },
"x-prompt": "Which directory do you want to create the library in?"
},
"publishable": {
"type": "boolean",
@ -203,7 +197,7 @@
}
},
"additionalProperties": false,
"required": ["name"],
"required": ["directory"],
"examplesFile": "## Examples\n\n{% tabs %}\n{% tab label=\"Simple Library\" %}\n\nCreates the `my-ui-lib` library with an `ui` tag:\n\n```bash\nnx g @nx/angular:library libs/my-ui-lib --tags=ui\n```\n\n{% /tab %}\n\n{% tab label=\"Publishable Library\" %}\n\nCreates the `my-lib` library that can be built producing an output following the Angular Package Format (APF) to be distributed as an NPM package:\n\n```bash\nnx g @nx/angular:library libs/my-lib --publishable --import-path=@my-org/my-lib\n```\n\n{% /tab %}\n\n{% tab label=\"Buildable Library\" %}\n\nCreates the `my-lib` library with support for incremental builds:\n\n```bash\nnx g @nx/angular:library libs/my-lib --buildable\n```\n\n{% /tab %}\n\n{% tab label=\"Nested Folder & Import\"%}\nCreates the `my-lib` library in the `nested` directory and sets the import path to `@myorg/nested/my-lib`:\n\n{% callout type=\"note\" title=\"Directory Flag Behavior Changes\" %}\nThe command below uses the `as-provided` directory flag behavior, which is the default in Nx 16.8.0. If you're on an earlier version of Nx or using the `derived` option, use `--directory=nested`. See the [as-provided vs. derived documentation](/deprecated/as-provided-vs-derived) for more details.\n{% /callout %}\n\n```bash\nnx g @nx/angular:library libs/nested/my-lib --importPath=@myorg/nested/my-lib\n```\n\n{% /tab %}\n",
"presets": []
},

View File

@ -35,11 +35,6 @@
"$default": { "$source": "argv", "index": 0 },
"x-priority": "important"
},
"projectNameAndRootFormat": {
"description": "Whether to generate the new project name and destination as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).",
"type": "string",
"enum": ["as-provided", "derived"]
},
"importPath": {
"type": "string",
"description": "The new import path to use in the `tsconfig.base.json`."

View File

@ -15,11 +15,17 @@
}
],
"properties": {
"directory": {
"description": "The directory of the new application.",
"type": "string",
"$default": { "$source": "argv", "index": 0 },
"x-prompt": "Which directory do you want to create the application in?"
},
"name": {
"type": "string",
"description": "The name to give to the remote Angular app.",
"$default": { "$source": "argv", "index": 0 },
"pattern": "^[a-zA-Z][^:]*$"
"pattern": "^[a-zA-Z][^:]*$",
"x-priority": "important"
},
"host": {
"type": "string",
@ -31,15 +37,6 @@
"type": "number",
"description": "The port on which this app should be served."
},
"directory": {
"description": "The directory of the new application.",
"type": "string"
},
"projectNameAndRootFormat": {
"description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).",
"type": "string",
"enum": ["as-provided", "derived"]
},
"style": {
"description": "The file extension to be used for style files.",
"type": "string",
@ -171,7 +168,7 @@
}
},
"additionalProperties": false,
"required": ["name"],
"required": ["directory"],
"presets": []
},
"x-type": "application",

View File

@ -13,12 +13,15 @@
"$default": { "$source": "projectName" },
"x-prompt": "What is the name of the frontend project to test?"
},
"e2eDirectory": {
"type": "string",
"description": "A directory where the project is placed relative current working directory (CWD).",
"$default": { "$source": "argv", "index": 0 },
"x-prompt": "Which directory do you want to create the E2E project in?"
},
"e2eName": {
"type": "string",
"description": "Name of the E2E Project.",
"$default": { "$source": "argv", "index": 0 },
"x-prompt": "What name would you like to use for the E2E project?",
"pattern": "^[a-zA-Z][^:]*$"
"description": "Name of the E2E Project."
},
"appName": {
"type": "string",
@ -34,15 +37,6 @@
"enum": ["react-native", "expo"],
"x-prompt": "What app framework should detox test?"
},
"e2eDirectory": {
"type": "string",
"description": "A directory where the project is placed relative to apps directory."
},
"projectNameAndRootFormat": {
"description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).",
"type": "string",
"enum": ["as-provided", "derived"]
},
"linter": {
"description": "The tool to use for running lint checks.",
"type": "string",
@ -66,7 +60,7 @@
"default": false
}
},
"required": ["e2eName", "appProject", "framework"],
"required": ["e2eDirectory", "appProject", "framework"],
"presets": []
},
"aliases": ["app"],

View File

@ -18,27 +18,22 @@
],
"type": "object",
"properties": {
"directory": {
"description": "The directory of the new application.",
"type": "string",
"$default": { "$source": "argv", "index": 0 },
"x-prompt": "Which directory do you want to create the application in?"
},
"name": {
"description": "The name of the application.",
"type": "string",
"$default": { "$source": "argv", "index": 0 },
"x-prompt": "What name would you like to use for the application?",
"pattern": "^[a-zA-Z][^:]*$"
"pattern": "^[a-zA-Z][^:]*$",
"x-priority": "important"
},
"displayName": {
"description": "The display name to show in the application. Defaults to name.",
"type": "string"
},
"directory": {
"description": "The directory of the new application.",
"type": "string",
"x-priority": "important"
},
"projectNameAndRootFormat": {
"description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).",
"type": "string",
"enum": ["as-provided", "derived"]
},
"skipFormat": {
"description": "Skip formatting files",
"type": "boolean",
@ -90,7 +85,7 @@
"default": false
}
},
"required": ["name"],
"required": ["directory"],
"presets": []
},
"aliases": ["app"],

View File

@ -14,22 +14,16 @@
}
],
"properties": {
"name": {
"type": "string",
"description": "Library name",
"$default": { "$source": "argv", "index": 0 },
"x-prompt": "What name would you like to use for the library?",
"pattern": "(?:^@[a-zA-Z0-9-*~][a-zA-Z0-9-*._~]*\\/[a-zA-Z0-9-~][a-zA-Z0-9-._~]*|^[a-zA-Z][^:]*)$"
},
"directory": {
"type": "string",
"description": "A directory where the lib is placed.",
"x-priority": "important"
"$default": { "$source": "argv", "index": 0 },
"x-prompt": "Which directory do you want to create the library in?"
},
"projectNameAndRootFormat": {
"description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).",
"name": {
"type": "string",
"enum": ["as-provided", "derived"]
"description": "Library name",
"x-priority": "important"
},
"linter": {
"description": "The tool to use for running lint checks.",
@ -94,7 +88,7 @@
"default": false
}
},
"required": ["name"],
"required": ["directory"],
"presets": []
},
"aliases": ["lib"],

View File

@ -9,21 +9,16 @@
"description": "Nx Application Options Schema.",
"type": "object",
"properties": {
"name": {
"description": "The name of the application.",
"type": "string",
"$default": { "$source": "argv", "index": 0 },
"x-prompt": "What name would you like to use for the node application?",
"pattern": "^[a-zA-Z][^:]*$"
},
"directory": {
"description": "The directory of the new application.",
"type": "string"
},
"projectNameAndRootFormat": {
"description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).",
"type": "string",
"enum": ["as-provided", "derived"]
"$default": { "$source": "argv", "index": 0 },
"x-prompt": "Which directory do you want to create the application in?"
},
"name": {
"description": "The name of the application.",
"pattern": "^[a-zA-Z][^:]*$",
"type": "string"
},
"skipFormat": {
"description": "Skip formatting files.",
@ -71,19 +66,13 @@
"description": "Generate JavaScript files rather than TypeScript files.",
"default": false
},
"standaloneConfig": {
"description": "Split the project configuration into `<projectRoot>/project.json` rather than including it inside `workspace.json`.",
"type": "boolean",
"default": true,
"x-deprecated": "Nx only supports standaloneConfig"
},
"setParserOptionsProject": {
"type": "boolean",
"description": "Whether or not to configure the ESLint `parserOptions.project` option. We do not do this by default for lint performance reasons.",
"default": false
}
},
"required": [],
"required": ["directory"],
"presets": []
},
"aliases": ["app"],

View File

@ -9,16 +9,15 @@
"description": "Create a TypeScript Library.",
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "Library name.",
"$default": { "$source": "argv", "index": 0 },
"x-prompt": "What name would you like to use for the library?",
"pattern": "(?:^@[a-zA-Z0-9-*~][a-zA-Z0-9-*._~]*\\/[a-zA-Z0-9-~][a-zA-Z0-9-._~]*|^[a-zA-Z][^:]*)$"
},
"directory": {
"type": "string",
"description": "A directory where the lib is placed.",
"$default": { "$source": "argv", "index": 0 },
"x-prompt": "Which directory do you want to create the library in?"
},
"name": {
"type": "string",
"description": "Library name.",
"x-priority": "important"
},
"bundler": {
@ -39,11 +38,6 @@
"enum": ["none", "jest", "vitest"],
"x-priority": "important"
},
"projectNameAndRootFormat": {
"description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).",
"type": "string",
"enum": ["as-provided", "derived"]
},
"tags": {
"type": "string",
"description": "Add tags to the library (used for linting)."
@ -141,7 +135,7 @@
"description": "Use a `project.json` configuration file instead of inlining the Nx configuration in the `package.json` file."
}
},
"required": ["name"],
"required": ["directory"],
"examplesFile": "---\ntitle: JS library generator examples\ndescription: This page contains examples for the @nx/js:lib generator.\n---\n\nThe `@nx/js:lib` generator will generate a library for you, and it will configure it according to the options you provide.\n\n```bash\nnpx nx g @nx/js:lib libs/mylib\n```\n\nBy default, the library that is generated when you use this executor without passing any options, like the example above, will be a buildable library, using the `@nx/js:tsc` executor as a builder.\n\nYou may configure the tools you want to use to build your library, or bundle it too, by passing the `--bundler` flag. The `--bundler` flag controls the compiler and/or the bundler that will be used to build your library. If you choose `tsc` or `swc`, the result will be a buildable library using either `tsc` or `swc` as the compiler. If you choose `rollup` or `vite`, the result will be a buildable library using `rollup` or `vite` as the bundler. In the case of `rollup`, it will default to the `tsc` compiler. If you choose `esbuild`, you may use the [`esbuildOptions` property](https://esbuild.github.io/api/) in your `project.json` under the `build` target options to specify whether you wish to bundle your library or not.\n\n## Examples\n\n{% tabs %}\n\n{% tab label=\"Buildable with default compiler (tsc)\" %}\n\nGenerate a buildable library using the `@nx/js:tsc` executor. This uses `tsc` as the compiler.\n\n```bash\nnpx nx g @nx/js:lib libs/mylib\n```\n\n{% /tab %}\n\n{% tab label=\"Buildable with SWC compiler\" %}\n\nGenerate a buildable library using [SWC](https://swc.rs) as the compiler. This will use the `@nx/js:swc` executor.\n\n```bash\nnpx nx g @nx/js:lib libs/mylib --bundler=swc\n```\n\n{% /tab %}\n\n{% tab label=\"Buildable with tsc\" %}\n\nGenerate a buildable library using tsc as the compiler. This will use the `@nx/js:tsc` executor.\n\n```bash\nnpx nx g @nx/js:lib libs/mylib --bundler=tsc\n```\n\n{% /tab %}\n\n{% tab label=\"Buildable, with Rollup as a bundler\" %}\n\nGenerate a buildable library using [Rollup](https://rollupjs.org) as the bundler. This will use the `@nx/rollup:rollup` executor. It will also use [SWC](https://swc.rs) as the compiler.\n\n```bash\nnpx nx g @nx/js:lib libs/mylib --bundler=rollup\n```\n\nIf you do not want to use `swc` as the compiler, and want to use the default `babel` compiler, you can do so in your `project.json` under the `build` target options, using the [`compiler` property](/nx-api/rollup/executors/rollup#compiler):\n\n```jsonc {% fileName=\"libs/mylib/project.json\" %}\n\"build\": {\n \"executor\": \"@nx/rollup:rollup\",\n \"options\": {\n //...\n \"compiler\": \"babel\"\n }\n}\n```\n\n{% /tab %}\n\n{% tab label=\"Buildable, with Vite as a bundler\" %}\n\nGenerate a buildable library using [Vite](https://vitejs.dev/) as the bundler. This will use the `@nx/vite:build` executor.\n\n```bash\nnpx nx g @nx/js:lib libs/mylib --bundler=vite\n```\n\n{% /tab %}\n\n{% tab label=\"Using ESBuild\" %}\n\nGenerate a buildable library using [ESBuild](https://esbuild.github.io/) as the bundler. This will use the `@nx/esbuild:esbuild` executor.\n\n```bash\nnpx nx g @nx/js:lib libs/mylib --bundler=esbuild\n```\n\nIf you want to specify whether you want to bundle your library or not, you can do so in your `project.json` under the `build` target options, using the [`esbuildOptions` property](https://esbuild.github.io/api/):\n\n```jsonc {% fileName=\"libs/mylib/project.json\" %}\n\"build\": {\n \"executor\": \"@nx/esbuild:esbuild\",\n \"options\": {\n //...\n \"esbuildOptions\": {\n \"bundle\": true\n }\n }\n}\n```\n\n{% /tab %}\n\n{% tab label=\"Minimal publishing target\" %}\n\nGenerate a **publishable** library with a minimal publishing target. The result will be a buildable library using the `@nx/js:tsc` executor, using `tsc` as the compiler. You can change the compiler or the bundler by passing the `--bundler` flag.\n\n```bash\nnpx nx g lib libs/mylib --publishable\n```\n\n{% /tab %}\n\n{% tab label=\"Using directory flag\" %}\n\nGenerate a library named `mylib` and put it under a directory named `myapp` (`libs/myapp/mylib`)\n\n{% callout type=\"note\" title=\"Directory Flag Behavior Changes\" %}\nThe command below uses the `as-provided` directory flag behavior, which is the default in Nx 16.8.0. If you're on an earlier version of Nx or using the `derived` option, use `--directory=myapp`. See the [as-provided vs. derived documentation](/deprecated/as-provided-vs-derived) for more details.\n{% /callout %}\n\n```shell\nnpx nx g lib libs/nested/mylib\n```\n\n{% /tab %}\n\n{% tab label=\"Non-buildable library\" %}\n\nGenerate a non-buildable library.\n\n```bash\nnpx nx g @nx/js:lib libs/mylib --bundler=none\n```\n\n{% /tab %}\n\n{% /tabs %}\n",
"presets": []
},

View File

@ -9,21 +9,17 @@
"cli": "nx",
"type": "object",
"properties": {
"directory": {
"description": "The directory of the new application.",
"type": "string",
"$default": { "$source": "argv", "index": 0 },
"x-prompt": "Which directory do you want to create the application in?"
},
"name": {
"description": "The name of the application.",
"type": "string",
"$default": { "$source": "argv", "index": 0 },
"x-prompt": "What name would you like to use for the node application?",
"pattern": "^[a-zA-Z][^:]*$"
},
"directory": {
"description": "The directory of the new application.",
"type": "string"
},
"projectNameAndRootFormat": {
"description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).",
"type": "string",
"enum": ["as-provided", "derived"]
"pattern": "^[a-zA-Z][^:]*$",
"x-priority": "important"
},
"skipFormat": {
"description": "Skip formatting files.",
@ -82,7 +78,7 @@
}
},
"additionalProperties": false,
"required": ["name"],
"required": ["directory"],
"presets": []
},
"aliases": ["app"],

View File

@ -15,22 +15,17 @@
}
],
"properties": {
"name": {
"description": "Library name.",
"type": "string",
"$default": { "$source": "argv", "index": 0 },
"x-prompt": "What name would you like to use for the library?",
"pattern": "(?:^@[a-zA-Z0-9-*~][a-zA-Z0-9-*._~]*\\/[a-zA-Z0-9-~][a-zA-Z0-9-._~]*|^[a-zA-Z][^:]*)$"
},
"directory": {
"description": "A directory where the library is placed.",
"type": "string",
"alias": "dir"
"alias": "dir",
"$default": { "$source": "argv", "index": 0 },
"x-prompt": "Which directory do you want to create the library in?"
},
"projectNameAndRootFormat": {
"description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).",
"type": "string",
"enum": ["as-provided"]
"name": {
"description": "Library name.",
"pattern": "(?:^@[a-zA-Z0-9-*~][a-zA-Z0-9-*._~]*\\/[a-zA-Z0-9-~][a-zA-Z0-9-._~]*|^[a-zA-Z][^:]*)$",
"type": "string"
},
"linter": {
"description": "The tool to use for running lint checks.",
@ -143,7 +138,7 @@
}
},
"additionalProperties": false,
"required": ["name"],
"required": ["directory"],
"presets": []
},
"aliases": ["lib"],

View File

@ -9,24 +9,18 @@
"description": "Create a Next.js Application for Nx.",
"type": "object",
"properties": {
"name": {
"description": "The name of the application.",
"type": "string",
"$default": { "$source": "argv", "index": 0 },
"x-prompt": "What name would you like to use for the application?",
"pattern": "^[a-zA-Z][^:]*$",
"x-priority": "important"
},
"directory": {
"description": "The directory of the new application.",
"type": "string",
"alias": "dir",
"x-priority": "important"
"$default": { "$source": "argv", "index": 0 },
"x-prompt": "Which directory do you want to create the application in?"
},
"projectNameAndRootFormat": {
"description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).",
"name": {
"description": "The name of the application.",
"type": "string",
"enum": ["as-provided", "derived"]
"pattern": "^[a-zA-Z][^:]*$",
"x-priority": "important"
},
"style": {
"description": "The file extension to be used for style files.",
@ -142,7 +136,7 @@
"x-priority": "internal"
}
},
"required": [],
"required": ["directory"],
"examplesFile": "## Examples\n\n{% tabs %}\n{% tab label=\"Create app in a directory\" %}\n\n{% callout type=\"note\" title=\"Directory Flag Behavior Changes\" %}\nThe command below uses the `as-provided` directory flag behavior, which is the default in Nx 16.8.0. If you're on an earlier version of Nx or using the `derived` option, use `--directory=nested`. See the [as-provided vs. derived documentation](/deprecated/as-provided-vs-derived) for more details.\n{% /callout %}\n\n```shell\nnx g app apps/nested/myapp\n```\n\n{% /tab %}\n{% tab label=\"Use a custom Express server\" %}\n\n```shell\nnx g app apps/myapp --custom-server\n```\n\n{% /tab %}\n{% tab label=\"Use plain JavaScript (not TypeScript)\" %}\n\n```shell\nnx g app apps/myapp --js\n```\n\n{% /tab %}\n{% /tabs %}\n",
"presets": []
},

View File

@ -9,24 +9,18 @@
"description": "Create a React Library for an Nx workspace.",
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "Library name",
"$default": { "$source": "argv", "index": 0 },
"x-prompt": "What name would you like to use for the library?",
"pattern": "(?:^@[a-zA-Z0-9-*~][a-zA-Z0-9-*._~]*\\/[a-zA-Z0-9-~][a-zA-Z0-9-._~]*|^[a-zA-Z][^:]*)$",
"x-priority": "important"
},
"directory": {
"type": "string",
"description": "A directory where the lib is placed.",
"alias": "dir",
"x-priority": "important"
"$default": { "$source": "argv", "index": 0 },
"x-prompt": "Which directory do you want to create the library in?"
},
"projectNameAndRootFormat": {
"description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).",
"name": {
"type": "string",
"enum": ["as-provided", "derived"]
"description": "Library name",
"pattern": "(?:^@[a-zA-Z0-9-*~][a-zA-Z0-9-*._~]*\\/[a-zA-Z0-9-~][a-zA-Z0-9-._~]*|^[a-zA-Z][^:]*)$",
"x-priority": "important"
},
"style": {
"description": "The file extension to be used for style files.",
@ -143,7 +137,7 @@
"x-priority": "internal"
}
},
"required": ["name"],
"required": ["directory"],
"examplesFile": "## Examples\n\n{% tabs %}\n{% tab label=\"Create a new lib\" %}\n\n```shell\nnx g lib libs/my-lib\n```\n\n{% /tab %}\n{% tab label=\"Create a new lib under a directory\" %}\n\nThe following will create a library at `libs/shared/my-lib`.\n\n```shell\nnx g lib libs/shared/my-lib\n```\n\n{% /tab %}\n{% /tabs %}\n",
"presets": []
},

View File

@ -9,23 +9,17 @@
"description": "Nx Application Options Schema.",
"type": "object",
"properties": {
"name": {
"description": "The name of the application.",
"type": "string",
"$default": { "$source": "argv", "index": 0 },
"x-prompt": "What name would you like to use for the node application?",
"x-priority": "important",
"pattern": "^[a-zA-Z][^:]*$"
},
"directory": {
"description": "The directory of the new application.",
"type": "string",
"x-priority": "important"
"$default": { "$source": "argv", "index": 0 },
"x-prompt": "Which directory do you want to create the application in?"
},
"projectNameAndRootFormat": {
"description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).",
"name": {
"description": "The name of the application.",
"type": "string",
"enum": ["as-provided", "derived"]
"pattern": "^[a-zA-Z][^:]*$",
"x-priority": "important"
},
"skipFormat": {
"description": "Skip formatting files",
@ -126,7 +120,7 @@
"description": "Add a docker build target"
}
},
"required": ["name"],
"required": ["directory"],
"presets": []
},
"aliases": ["app"],

View File

@ -15,26 +15,21 @@
}
],
"properties": {
"name": {
"type": "string",
"description": "Library name",
"$default": { "$source": "argv", "index": 0 },
"x-prompt": "What name would you like to use for the library?",
"pattern": "(?:^@[a-zA-Z0-9-*~][a-zA-Z0-9-*._~]*\\/[a-zA-Z0-9-~][a-zA-Z0-9-._~]*|^[a-zA-Z][^:]*)$"
},
"directory": {
"type": "string",
"description": "A directory where the lib is placed",
"alias": "dir",
"$default": { "$source": "argv", "index": 0 },
"x-prompt": "Which directory do you want to create the library in?"
},
"name": {
"type": "string",
"description": "Library name",
"pattern": "(?:^@[a-zA-Z0-9-*~][a-zA-Z0-9-*._~]*\\/[a-zA-Z0-9-~][a-zA-Z0-9-._~]*|^[a-zA-Z][^:]*)$",
"x-priority": "important"
},
"projectNameAndRootFormat": {
"description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).",
"type": "string",
"enum": ["as-provided", "derived"]
},
"simpleModuleName": {
"description": "Keep the module name simple (when using `--directory`).",
"description": "Keep the module name simple.",
"type": "boolean",
"default": false
},
@ -126,7 +121,7 @@
"default": false
}
},
"required": ["name"],
"required": ["directory"],
"presets": []
},
"aliases": ["lib"],

View File

@ -9,24 +9,18 @@
"description": "Create a Nuxt Application for Nx.",
"type": "object",
"properties": {
"name": {
"description": "The name of the application.",
"type": "string",
"$default": { "$source": "argv", "index": 0 },
"x-prompt": "What name would you like to use for the application?",
"pattern": "^[a-zA-Z][^:]*$",
"x-priority": "important"
},
"directory": {
"description": "The directory of the new application.",
"type": "string",
"alias": "dir",
"x-priority": "important"
"$default": { "$source": "argv", "index": 0 },
"x-prompt": "Which directory do you want to create the application in?"
},
"projectNameAndRootFormat": {
"description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).",
"name": {
"description": "The name of the application.",
"type": "string",
"enum": ["as-provided", "derived"]
"pattern": "^[a-zA-Z][^:]*$",
"x-priority": "important"
},
"linter": {
"description": "The tool to use for running lint checks.",
@ -105,7 +99,7 @@
"default": false
}
},
"required": [],
"required": ["directory"],
"examplesFile": "---\ntitle: Nuxt application generator examples\ndescription: This page contains examples for the @nx/nuxt:app generator.\n---\n\nYour new Nuxt application will be generated with the following directory structure, following the suggested [directory structure](https://nuxt.com/docs/guide/directory-structure) for Nuxt applications:\n\n```text\nmy-nuxt-app\n├── nuxt.config.ts\n├── project.json\n├── src\n│   ├── app.vue\n│   ├── assets\n│   │   └── css\n│   │   └── styles.css\n│   ├── components\n│   │   └── NxWelcome.vue\n│   ├── pages\n│   │   ├── about.vue\n│   │   └── index.vue\n│   ├── public\n│   │   └── favicon.ico\n│   └── server\n│   ├── api\n│   │   └── greet.ts\n│   └── tsconfig.json\n├── tsconfig.app.json\n├── tsconfig.json\n├── tsconfig.spec.json\n└── vitest.config.ts\n```\n\nYour new app will contain the following:\n\n- Two pages (home and about) under `pages`\n- A component (`NxWelcome`) under `components`\n- A `greet` API endpoint that returns a JSON response under `/api/greet`\n- Configuration for `vitest`\n- Your app's entrypoint (`app.vue`) will contain the navigation links to the home and about pages, and the `nuxt-page` component to display the contents of your pages.\n\n## Examples\n\n{% tabs %}\n{% tab label=\"Create app in a directory\" %}\n\n{% callout type=\"note\" title=\"Directory Flag Behavior Changes\" %}\nThe command below uses the `as-provided` directory flag behavior, which is the default in Nx 16.8.0. If you're on an earlier version of Nx or using the `derived` option, use `--directory=nested`. See the [as-provided vs. derived documentation](/deprecated/as-provided-vs-derived) for more details.\n{% /callout %}\n\n```shell\nnx g @nx/nuxt:app =apps/nested/myapp\n```\n\n{% /tab %}\n\n{% tab label=\"Create app with vitest configured\" %}\n\n```shell\nnx g @nx/nuxt:app apps/nested/myapp --unitTestRunner=vitest\n```\n\n{% /tab %}\n\n{% tab label=\"Use plain JavaScript (not TypeScript)\" %}\n\n```shell\nnx g @nx/nuxt:app apps/myapp --js\n```\n\n{% /tab %}\n{% /tabs %}\n\n## Generate pages and components\n\nYou can use the the [`@nx/vue:component` generator](/nx-api/vue/generators/component) to generate new pages and components for your application. You can read more on the [`@nx/vue:component` generator documentation page](/nx-api/vue/generators/component), but here are some examples:\n\n{% tabs %}\n{% tab label=\"New page\" %}\n\n```shell\nnx g @nx/nuxt:component my-app/src/pages/my-page\n```\n\n{% /tab %}\n\n{% tab label=\"New component\" %}\n\n```shell\nnx g @nx/nuxt:component my-app/src/components/my-cmp\n```\n\n{% /tab %}\n{% /tabs %}\n",
"presets": []
},

View File

@ -10,11 +10,15 @@
"examplesFile": "## Examples\n\n{% tabs %}\n{% tab label=\"Basic executable\" %}\n\nCreate an executable that initializes an Nx workspace with {my-plugin}'s preset:\n\n```bash\nnx g @nx/plugin:create-package create-my-plugin --project my-plugin\n```\n\n{% /tab %}\n{% /tabs %}\n",
"type": "object",
"properties": {
"directory": {
"type": "string",
"description": "A directory where the app is placed.",
"$default": { "$source": "argv", "index": 0 }
},
"name": {
"type": "string",
"description": "The package name of cli, e.g. `create-framework-package`. Note this must be a valid NPM name to be published.",
"pattern": "create-.+|^@.+/create(?:-.+)?",
"$default": { "$source": "argv", "index": 0 },
"x-priority": "important"
},
"project": {
@ -31,15 +35,6 @@
"description": "Test runner to use for unit tests.",
"default": "jest"
},
"directory": {
"type": "string",
"description": "A directory where the app is placed."
},
"projectNameAndRootFormat": {
"description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).",
"type": "string",
"enum": ["as-provided", "derived"]
},
"linter": {
"description": "The tool to use for running lint checks.",
"type": "string",
@ -69,7 +64,7 @@
"x-prompt": "What is the name of the e2e project? Leave blank to skip e2e tests"
}
},
"required": ["name", "project"],
"required": ["directory", "name", "project"],
"presets": []
},
"description": "Create a package which can be used by npx to create a new workspace",

View File

@ -24,11 +24,6 @@
"type": "string",
"description": "the directory where the plugin is placed."
},
"projectNameAndRootFormat": {
"description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).",
"type": "string",
"enum": ["as-provided", "derived"]
},
"pluginOutputPath": {
"type": "string",
"description": "the output path of the plugin after it builds.",

View File

@ -15,22 +15,16 @@
}
],
"properties": {
"directory": {
"type": "string",
"description": "A directory where the plugin is placed.",
"$default": { "$source": "argv", "index": 0 },
"x-prompt": "Which directory do you want to create the plugin in?"
},
"name": {
"type": "string",
"description": "Plugin name",
"$default": { "$source": "argv", "index": 0 },
"x-prompt": "What name would you like to use for the plugin?",
"x-priority": "important",
"pattern": "(?:^@[a-zA-Z0-9-*~][a-zA-Z0-9-*._~]*\\/[a-zA-Z0-9-~][a-zA-Z0-9-._~]*|^[a-zA-Z][^:]*)$"
},
"directory": {
"type": "string",
"description": "A directory where the plugin is placed."
},
"projectNameAndRootFormat": {
"description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).",
"type": "string",
"enum": ["as-provided", "derived"]
"x-priority": "important"
},
"importPath": {
"type": "string",
@ -100,7 +94,7 @@
"default": false
}
},
"required": ["name"],
"required": ["directory"],
"presets": []
},
"description": "Create a Nx Plugin.",

View File

@ -19,26 +19,21 @@
],
"type": "object",
"properties": {
"name": {
"description": "The name of the application.",
"directory": {
"description": "The directory of the new application.",
"type": "string",
"$default": { "$source": "argv", "index": 0 },
"x-prompt": "What name would you like to use for the application?",
"pattern": "^[a-zA-Z][^:]*$"
"x-prompt": "Which directory do you want to create the application in?"
},
"name": {
"description": "The name of the application.",
"pattern": "^[a-zA-Z][^:]*$",
"type": "string"
},
"displayName": {
"description": "The display name to show in the application. Defaults to name.",
"type": "string"
},
"directory": {
"description": "The directory of the new application.",
"type": "string"
},
"projectNameAndRootFormat": {
"description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).",
"type": "string",
"enum": ["as-provided", "derived"]
},
"skipFormat": {
"description": "Skip formatting files",
"type": "boolean",
@ -99,7 +94,7 @@
"x-priority": "important"
}
},
"required": [],
"required": ["directory"],
"presets": []
},
"aliases": ["app"],

View File

@ -15,23 +15,18 @@
}
],
"properties": {
"name": {
"type": "string",
"description": "Library name.",
"$default": { "$source": "argv", "index": 0 },
"x-prompt": "What name would you like to use for the library?",
"pattern": "(?:^@[a-zA-Z0-9-*~][a-zA-Z0-9-*._~]*\\/[a-zA-Z0-9-~][a-zA-Z0-9-._~]*|^[a-zA-Z][^:]*)$"
},
"directory": {
"type": "string",
"description": "A directory where the lib is placed.",
"alias": "dir",
"x-priority": "important"
"$default": { "$source": "argv", "index": 0 },
"x-prompt": "Which directory do you want to create the library in?"
},
"projectNameAndRootFormat": {
"description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).",
"name": {
"type": "string",
"enum": ["as-provided", "derived"]
"description": "Library name.",
"pattern": "(?:^@[a-zA-Z0-9-*~][a-zA-Z0-9-*._~]*\\/[a-zA-Z0-9-~][a-zA-Z0-9-._~]*|^[a-zA-Z][^:]*)$",
"x-priority": "important"
},
"linter": {
"description": "The tool to use for running lint checks.",
@ -97,7 +92,7 @@
"x-priority": "internal"
}
},
"required": ["name"],
"required": ["directory"],
"presets": []
},
"aliases": ["lib"],

View File

@ -9,37 +9,32 @@
"description": "Create a React application for Nx.",
"examples": [
{
"command": "nx g app myapp --directory=myorg",
"command": "nx g app apps/myorg/myapp",
"description": "Generate `apps/myorg/myapp` and `apps/myorg/myapp-e2e`"
},
{
"command": "nx g app myapp --classComponent",
"command": "nx g app apps/myapp --classComponent",
"description": "Use class components instead of functional components"
},
{
"command": "nx g app myapp --routing",
"command": "nx g app apps/myapp --routing",
"description": "Set up React Router"
}
],
"type": "object",
"properties": {
"name": {
"description": "The name of the application.",
"type": "string",
"$default": { "$source": "argv", "index": 0 },
"x-prompt": "What name would you like to use for the application?",
"pattern": "^[a-zA-Z][^:]*$"
},
"directory": {
"description": "The directory of the new application.",
"type": "string",
"alias": "dir",
"x-priority": "important"
"$default": { "$source": "argv", "index": 0 },
"x-prompt": "Which directory do you want to create the application in?"
},
"projectNameAndRootFormat": {
"description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).",
"name": {
"description": "The name of the application.",
"type": "string",
"enum": ["as-provided", "derived"]
"pattern": "^[a-zA-Z][^:]*$",
"x-priority": "important"
},
"style": {
"description": "The file extension to be used for style files.",
@ -184,7 +179,7 @@
"default": false
}
},
"required": ["name"],
"required": ["directory"],
"examplesFile": "## Examples\n\n{% tabs %}\n{% tab label=\"Simple Application\" %}\n\nCreate an application named `my-app`:\n\n```bash\nnx g @nx/react:application apps/my-app\n```\n\n{% /tab %}\n\n{% tab label=\"Application using Vite as bundler\" %}\n\nCreate an application named `my-app`:\n\n```bash\nnx g @nx/react:app apps/my-app --bundler=vite\n```\n\nWhen choosing `vite` as the bundler, your unit tests will be set up with `vitest`, unless you choose `none` for `unitTestRunner`.\n\n{% /tab %}\n\n{% tab label=\"Specify directory and style extension\" %}\n\nCreate an application named `my-app` in the `my-dir` directory and use `scss` for styles:\n\n{% callout type=\"note\" title=\"Directory Flag Behavior Changes\" %}\nThe command below uses the `as-provided` directory flag behavior, which is the default in Nx 16.8.0. If you're on an earlier version of Nx or using the `derived` option, use `--directory=my-dir`. See the [as-provided vs. derived documentation](/deprecated/as-provided-vs-derived) for more details.\n{% /callout %}\n\n```bash\nnx g @nx/react:app apps/my-dir/my-app --style=scss\n```\n\n{% /tab %}\n\n{% tab label=\"Add tags\" %}\n\nAdd tags to the application (used for linting).\n\n```bash\nnx g @nx/react:app apps/my-app --tags=scope:admin,type:ui\n```\n\n{% /tab %}\n{% /tabs %}\n",
"presets": []
},

View File

@ -37,11 +37,6 @@
"description": "The directory of the new remote application if one needs to be created.",
"type": "string"
},
"projectNameAndRootFormat": {
"description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).",
"type": "string",
"enum": ["as-provided", "derived"]
},
"style": {
"description": "The file extension to be used for style files.",
"type": "string",

View File

@ -9,24 +9,18 @@
"description": "Create Module Federation configuration files for given React Host Application.",
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "The name of the host application to generate the Module Federation configuration",
"$default": { "$source": "argv", "index": 0 },
"x-prompt": "What name would you like to use as the host application?",
"pattern": "^[a-zA-Z][^:]*$",
"x-priority": "important"
},
"directory": {
"description": "The directory of the new application.",
"type": "string",
"alias": "dir",
"x-priority": "important"
"$default": { "$source": "argv", "index": 0 },
"x-prompt": "Which directory do you want to create the application in?"
},
"projectNameAndRootFormat": {
"description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).",
"name": {
"type": "string",
"enum": ["as-provided", "derived"]
"description": "The name of the host application to generate the Module Federation configuration",
"pattern": "^[a-zA-Z][^:]*$",
"x-priority": "important"
},
"style": {
"description": "The file extension to be used for style files.",
@ -181,7 +175,7 @@
"x-priority": "important"
}
},
"required": ["name"],
"required": ["directory"],
"additionalProperties": false,
"presets": []
},

View File

@ -19,24 +19,17 @@
}
],
"properties": {
"name": {
"type": "string",
"description": "Library name",
"$default": { "$source": "argv", "index": 0 },
"x-prompt": "What name would you like to use for the library?",
"pattern": "(?:^@[a-zA-Z0-9-*~][a-zA-Z0-9-*._~]*\\/[a-zA-Z0-9-~][a-zA-Z0-9-._~]*|^[a-zA-Z][^:]*)$",
"x-priority": "important"
},
"directory": {
"type": "string",
"description": "A directory where the lib is placed.",
"alias": "dir",
"x-priority": "important"
"$default": { "$source": "argv", "index": 0 },
"x-prompt": "Which directory do you want to create the library in?"
},
"projectNameAndRootFormat": {
"description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).",
"name": {
"type": "string",
"enum": ["as-provided", "derived"]
"description": "Library name",
"x-priority": "important"
},
"style": {
"description": "The file extension to be used for style files.",
@ -186,7 +179,7 @@
"default": false
}
},
"required": ["name"],
"required": ["directory"],
"presets": []
},
"aliases": ["lib"],

View File

@ -9,24 +9,18 @@
"description": "Create Module Federation configuration files for given React Remote Application.",
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "The name of the remote application to generate the Module Federation configuration",
"$default": { "$source": "argv", "index": 0 },
"x-prompt": "What name would you like to use as the remote application?",
"pattern": "^[a-zA-Z][^:]*$",
"x-priority": "important"
},
"directory": {
"description": "The directory of the new application.",
"type": "string",
"alias": "dir",
"x-priority": "important"
"$default": { "$source": "argv", "index": 0 },
"x-prompt": "Which directory do you want to create the application in?"
},
"projectNameAndRootFormat": {
"description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).",
"name": {
"type": "string",
"enum": ["as-provided", "derived"]
"description": "The name of the remote application to generate the Module Federation configuration",
"pattern": "^[a-zA-Z][^:]*$",
"x-priority": "important"
},
"dynamic": {
"type": "boolean",
@ -180,7 +174,7 @@
"x-priority": "important"
}
},
"required": ["name"],
"required": ["directory"],
"additionalProperties": false,
"presets": []
},

View File

@ -8,28 +8,23 @@
"description": "Generate a new Remix application.",
"type": "object",
"properties": {
"directory": {
"type": "string",
"description": "A directory where the app is placed.",
"alias": "dir",
"$default": { "$source": "argv", "index": 0 },
"x-prompt": "Which directory do you want to create the application in?"
},
"name": {
"type": "string",
"description": "",
"$default": { "$source": "argv", "index": 0 },
"x-prompt": "What is the name of the application?"
"description": "The name of the application.",
"x-priority": "important"
},
"js": {
"type": "boolean",
"description": "Generate JavaScript files rather than TypeScript files.",
"default": false
},
"directory": {
"type": "string",
"description": "A directory where the app is placed.",
"alias": "dir",
"x-priority": "important"
},
"projectNameAndRootFormat": {
"description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).",
"type": "string",
"enum": ["as-provided", "derived"]
},
"linter": {
"description": "The tool to use for running lint checks.",
"type": "string",
@ -66,6 +61,7 @@
"default": false
}
},
"required": ["directory"],
"presets": []
},
"description": "Generate a new Remix application",

View File

@ -14,23 +14,18 @@
}
],
"properties": {
"name": {
"type": "string",
"description": "Library name",
"$default": { "$source": "argv", "index": 0 },
"x-prompt": "What name would you like to use for the library?",
"pattern": "^[a-zA-Z].*$"
},
"directory": {
"type": "string",
"description": "A directory where the lib is placed.",
"alias": "dir",
"x-priority": "important"
"$default": { "$source": "argv", "index": 0 },
"x-prompt": "Which directory do you want to create the library in?"
},
"projectNameAndRootFormat": {
"description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).",
"name": {
"type": "string",
"enum": ["as-provided", "derived"]
"description": "Library name",
"pattern": "^[a-zA-Z].*$",
"x-priority": "important"
},
"tags": {
"type": "string",
@ -70,7 +65,7 @@
"x-priority": "internal"
}
},
"required": ["name"],
"required": ["directory"],
"presets": []
},
"description": "Generate a new library",

View File

@ -9,18 +9,21 @@
"description": "React + Rspack application generator.",
"examples": [
{
"command": "nx g app myapp --directory=myorg",
"command": "nx g app myorg/myapp",
"description": "Generate `apps/myorg/myapp` and `apps/myorg/myapp-e2e`"
}
],
"properties": {
"directory": {
"type": "string",
"description": "The directory to nest the app under.",
"$default": { "$source": "argv", "index": 0 },
"x-prompt": "What directory would you like to use for the application?"
},
"name": {
"description": "The name of the application.",
"type": "string",
"$default": { "$source": "argv", "index": 0 },
"x-prompt": "What name would you like to use for the application?",
"pattern": "^[a-zA-Z].*$",
"x-priority": "important"
"pattern": "^[a-zA-Z].*$"
},
"framework": {
"type": "string",
@ -69,10 +72,6 @@
"enum": ["none", "cypress"],
"default": "cypress"
},
"directory": {
"type": "string",
"description": "The directory to nest the app under."
},
"tags": {
"type": "string",
"description": "Add tags to the application (used for linting).",
@ -85,7 +84,7 @@
},
"rootProject": { "type": "boolean", "x-priority": "internal" }
},
"required": ["name"],
"required": ["directory"],
"presets": []
},
"aliases": ["app"],

View File

@ -44,11 +44,6 @@
"type": "boolean",
"default": false,
"x-priority": "internal"
},
"projectNameAndRootFormat": {
"description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).",
"type": "string",
"enum": ["as-provided", "derived"]
}
},
"required": ["name"],

View File

@ -19,23 +19,18 @@
],
"type": "object",
"properties": {
"name": {
"description": "The name of the application.",
"type": "string",
"$default": { "$source": "argv", "index": 0 },
"x-prompt": "What name would you like to use for the application?",
"pattern": "^[a-zA-Z][^:]*$"
},
"directory": {
"description": "The directory of the new application.",
"type": "string",
"alias": "dir",
"x-priority": "important"
"$default": { "$source": "argv", "index": 0 },
"x-prompt": "Which directory do you want to create the application in?"
},
"projectNameAndRootFormat": {
"description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).",
"name": {
"description": "The name of the application.",
"type": "string",
"enum": ["as-provided", "derived"]
"pattern": "^[a-zA-Z][^:]*$",
"x-priority": "important"
},
"style": {
"description": "The file extension to be used for style files.",
@ -129,7 +124,7 @@
"hidden": true
}
},
"required": ["name"],
"required": ["directory"],
"examplesFile": "---\ntitle: Vue application generator examples\ndescription: This page contains examples for the @nx/vue:app generator.\n---\n\n## Examples\n\n{% tabs %}\n{% tab label=\"Simple Application\" %}\n\nCreate an application named `my-app`:\n\n```shell\nnx g @nx/vue:app apps/my-app\n```\n\n{% /tab %}\n\n{% tab label=\"Specify directory and style extension\" %}\n\nCreate an application named `my-app` in the `my-dir` directory and use `scss` for styles:\n\n{% callout type=\"note\" title=\"Directory Flag Behavior Changes\" %}\nThe command below uses the `as-provided` directory flag behavior, which is the default in Nx 16.8.0. If you're on an earlier version of Nx or using the `derived` option, use `--directory=my-dir`. See the [as-provided vs. derived documentation](/deprecated/as-provided-vs-derived) for more details.\n{% /callout %}\n\n```shell\nnx g @nx/vue:app apps/my-dir/my-app --style=scss\n```\n\n{% /tab %}\n\n{% tab label=\"Add tags\" %}\n\nAdd tags to the application (used for linting).\n\n```shell\nnx g @nx/vue:app apps/my-app --tags=scope:admin,type:ui\n```\n\n{% /tab %}\n{% /tabs %}\n",
"presets": []
},

View File

@ -19,24 +19,18 @@
}
],
"properties": {
"name": {
"type": "string",
"description": "Library name",
"$default": { "$source": "argv", "index": 0 },
"x-prompt": "What name would you like to use for the library?",
"pattern": "(?:^@[a-zA-Z0-9-*~][a-zA-Z0-9-*._~]*\\/[a-zA-Z0-9-~][a-zA-Z0-9-._~]*|^[a-zA-Z][^:]*)$",
"x-priority": "important"
},
"directory": {
"type": "string",
"description": "A directory where the lib is placed.",
"alias": "dir",
"x-priority": "important"
"$default": { "$source": "argv", "index": 0 },
"x-prompt": "Which directory do you want to create the library in?"
},
"projectNameAndRootFormat": {
"description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).",
"name": {
"type": "string",
"enum": ["as-provided", "derived"]
"description": "Library name",
"pattern": "(?:^@[a-zA-Z0-9-*~][a-zA-Z0-9-*._~]*\\/[a-zA-Z0-9-~][a-zA-Z0-9-._~]*|^[a-zA-Z][^:]*)$",
"x-priority": "important"
},
"linter": {
"description": "The tool to use for running lint checks.",
@ -129,7 +123,7 @@
"default": false
}
},
"required": ["name"],
"required": ["directory"],
"presets": []
},
"aliases": ["lib"],

View File

@ -9,21 +9,17 @@
"description": "Create a web application using `swc` or `babel` as compiler.",
"type": "object",
"properties": {
"directory": {
"description": "The directory of the new application.",
"type": "string",
"$default": { "$source": "argv", "index": 0 },
"x-prompt": "Which directory do you want to create the application in?"
},
"name": {
"description": "The name of the application.",
"type": "string",
"$default": { "$source": "argv", "index": 0 },
"x-prompt": "What name would you like to use for the application?",
"pattern": "^[a-zA-Z][^:]*$"
},
"directory": {
"description": "The directory of the new application.",
"type": "string"
},
"projectNameAndRootFormat": {
"description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).",
"type": "string",
"enum": ["as-provided", "derived"]
"pattern": "^[a-zA-Z][^:]*$",
"x-priority": "important"
},
"style": {
"description": "The file extension to be used for style files.",
@ -111,7 +107,7 @@
"x-deprecated": "Nx only supports standaloneConfig"
}
},
"required": ["name"],
"required": ["directory"],
"examplesFile": "## Examples\n\n{% tabs %}\n{% tab label=\"Simple Application\" %}\n\nCreate an application named `my-app`:\n\n```bash\nnx g @nx/web:application apps/my-app\n```\n\n{% /tab %}\n\n{% tab label=\"Application using Vite as bundler\" %}\n\nCreate an application named `my-app`:\n\n```bash\nnx g @nx/web:app apps/my-app --bundler=vite\n```\n\nWhen choosing `vite` as the bundler, your unit tests will be set up with `vitest`, unless you choose `none` for `unitTestRunner`.\n\n{% /tab %}\n\n{% tab label=\"Specify directory\" %}\n\nCreate an application named `my-app` in the `my-dir` directory:\n\n{% callout type=\"note\" title=\"Directory Flag Behavior Changes\" %}\nThe command below uses the `as-provided` directory flag behavior, which is the default in Nx 16.8.0. If you're on an earlier version of Nx or using the `derived` option, use `--directory=my-dir`. See the [as-provided vs. derived documentation](/deprecated/as-provided-vs-derived) for more details.\n{% /callout %}\n\n```bash\nnx g @nx/web:app apps/my-dir/my-app\n```\n\n{% /tab %}\n\n{% tab label=\"Add tags\" %}\n\nAdd tags to the application (used for linting).\n\n```bash\nnx g @nx/web:app apps/my-app --tags=scope:admin,type:ui\n```\n\n{% /tab %}\n{% /tabs %}\n",
"presets": []
},

View File

@ -33,11 +33,6 @@
"description": "The folder to move the project into.",
"$default": { "$source": "argv", "index": 0 }
},
"projectNameAndRootFormat": {
"description": "Whether to generate the new project name and destination as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).",
"type": "string",
"enum": ["as-provided", "derived"]
},
"importPath": {
"type": "string",
"description": "The new import path to use in the `tsconfig.base.json`."

View File

@ -9,25 +9,16 @@
"cli": "nx",
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "Package name.",
"$default": { "$source": "argv", "index": 0 },
"x-prompt": "What name of your npm package?",
"pattern": "(?:^@[a-zA-Z0-9-*~][a-zA-Z0-9-*._~]*\\/[a-zA-Z0-9-~][a-zA-Z0-9-._~]*|^[a-zA-Z][^:]*)$"
},
"directory": {
"type": "string",
"description": "A directory where the package is placed.",
"alias": "dir"
"alias": "dir",
"$default": { "$source": "argv", "index": 0 },
"x-prompt": "Which directory do you want to create the package in?"
},
"projectNameAndRootFormat": {
"description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).",
"type": "string",
"enum": ["as-provided", "derived"]
}
"name": { "type": "string", "description": "Package name." }
},
"required": ["name"],
"required": ["directory"],
"presets": []
},
"description": "Create a minimal NPM package.",

View File

@ -48,7 +48,6 @@ export async function libraryGenerator(
) {
const callbackAfterFilesUpdated = await reactLibraryGenerator(tree, {
...options,
projectNameAndRootFormat: 'as-provided',
linter: Linter.EsLint,
style: 'css',
unitTestRunner: 'vitest',
@ -214,7 +213,6 @@ export async function libraryGenerator(
...options,
tags: `scope:${options.scope}`,
directory: options.directory || `${options.scope}/${options.name}`,
projectNameAndRootFormat: 'as-provided',
linter: Linter.EsLint,
style: 'css',
unitTestRunner: 'vitest',
@ -261,7 +259,6 @@ export async function libraryGenerator(
...options,
tags: `scope:${options.scope}`,
directory,
projectNameAndRootFormat: 'as-provided',
linter: Linter.EsLint,
style: 'css',
unitTestRunner: 'vitest',

View File

@ -46,14 +46,14 @@ Now that we have created the module, we need to configure it to be federated.
{%tab label="React"%}
```shell
nx generate @nx/react:federate-module hello/src/index.ts --name=hello --remote=greeting --projectNameAndRootFormat=as-provided
nx generate @nx/react:federate-module hello/src/index.ts --name=hello --remote=greeting
```
{% /tab %}
{%tab label="Angular"%}
```shell
nx generate @nx/angular:federate-module hello/src/index.ts --name=hello --remote=greeting --projectNameAndRootFormat=as-provided
nx generate @nx/angular:federate-module hello/src/index.ts --name=hello --remote=greeting
```
{% /tab %}

View File

@ -13,9 +13,7 @@ describe('angular.json v1 config', () => {
beforeAll(() => {
newProject({ packages: ['@nx/angular'] });
runCLI(
`generate @nx/angular:app ${app1} --project-name-and-root-format=as-provided --no-interactive`
);
runCLI(`generate @nx/angular:app ${app1} --no-interactive`);
// reset workspace to use v1 config
updateFile(`angular.json`, angularV1Json(app1));
removeFile(`${app1}/project.json`);
@ -33,9 +31,7 @@ describe('angular.json v1 config', () => {
it('should generate new app with project.json and keep the existing in angular.json', async () => {
// create new app
const app2 = uniq('app2');
runCLI(
`generate @nx/angular:app ${app2} --project-name-and-root-format=as-provided --no-interactive`
);
runCLI(`generate @nx/angular:app ${app2} --no-interactive`);
// should generate project.json for new projects
checkFilesExist(`${app2}/project.json`);

View File

@ -133,7 +133,7 @@ describe('Angular Cypress Component Tests', () => {
function createApp(appName: string) {
runCLI(
`generate @nx/angular:app ${appName} --bundler=webpack --project-name-and-root-format=as-provided --no-interactive`
`generate @nx/angular:app ${appName} --bundler=webpack --no-interactive`
);
runCLI(
`generate @nx/angular:component ${appName}/src/lib/fancy-component/fancy-component --no-interactive`
@ -141,9 +141,7 @@ function createApp(appName: string) {
}
function createLib(projectName: string, appName: string, libName: string) {
runCLI(
`generate @nx/angular:lib ${libName} --project-name-and-root-format=as-provided --no-interactive`
);
runCLI(`generate @nx/angular:lib ${libName} --no-interactive`);
runCLI(
`generate @nx/angular:component ${libName}/src/lib/btn/btn --inlineTemplate --inlineStyle --export --no-interactive`
);
@ -186,9 +184,7 @@ export class BtnStandaloneComponent {
function createBuildableLib(projectName: string, libName: string) {
// create lib
runCLI(
`generate @nx/angular:lib ${libName} --buildable --project-name-and-root-format=as-provided --no-interactive`
);
runCLI(`generate @nx/angular:lib ${libName} --buildable --no-interactive`);
// create cmp for lib
runCLI(
`generate @nx/angular:component ${libName}/src/lib/input/input --inlineTemplate --inlineStyle --export --no-interactive`

View File

@ -20,9 +20,7 @@ describe('Move Angular Project', () => {
app1 = uniq('app1');
app2 = uniq('app2');
newPath = `subfolder/${app2}`;
runCLI(
`generate @nx/angular:app ${app1} --project-name-and-root-format=as-provided --no-interactive`
);
runCLI(`generate @nx/angular:app ${app1} --no-interactive`);
});
afterAll(() => cleanupProject());
@ -32,7 +30,7 @@ describe('Move Angular Project', () => {
*/
it('should work for apps', () => {
const moveOutput = runCLI(
`generate @nx/angular:move --project ${app1} ${newPath} --project-name-and-root-format=as-provided`
`generate @nx/angular:move --project ${app1} ${newPath} `
);
// just check the output
@ -76,7 +74,7 @@ describe('Move Angular Project', () => {
`
);
const moveOutput = runCLI(
`generate @nx/angular:move --projectName=${app1}-e2e --destination=${newPath}-e2e --project-name-and-root-format=as-provided`
`generate @nx/angular:move --projectName=${app1}-e2e --destination=${newPath}-e2e`
);
// just check that the cypress.config.ts is updated correctly
@ -97,17 +95,13 @@ describe('Move Angular Project', () => {
it('should work for libraries', () => {
const lib1 = uniq('mylib');
const lib2 = uniq('mylib');
runCLI(
`generate @nx/angular:lib ${lib1} --no-standalone --project-name-and-root-format=as-provided --no-interactive`
);
runCLI(`generate @nx/angular:lib ${lib1} --no-standalone --no-interactive`);
/**
* Create a library which imports the module from the other lib
*/
runCLI(
`generate @nx/angular:lib ${lib2} --no-standalone --project-name-and-root-format=as-provided --no-interactive`
);
runCLI(`generate @nx/angular:lib ${lib2} --no-standalone --no-interactive`);
updateFile(
`${lib2}/src/lib/${lib2}.module.ts`,
@ -117,7 +111,7 @@ describe('Move Angular Project', () => {
);
const moveOutput = runCLI(
`generate @nx/angular:move --projectName=${lib1} --destination=shared/${lib1} --newProjectName=shared-${lib1} --project-name-and-root-format=as-provided`
`generate @nx/angular:move --projectName=${lib1} --destination=shared/${lib1} --newProjectName=shared-${lib1}`
);
const newPath = `shared/${lib1}`;

View File

@ -40,11 +40,11 @@ describe('Angular Module Federation', () => {
// generate host app
runCLI(
`generate @nx/angular:host ${hostApp} --style=css --no-standalone --project-name-and-root-format=as-provided --no-interactive`
`generate @nx/angular:host ${hostApp} --style=css --no-standalone --no-interactive`
);
// generate remote app
runCLI(
`generate @nx/angular:remote ${remoteApp1} --host=${hostApp} --port=${remotePort} --style=css --no-standalone --project-name-and-root-format=as-provided --no-interactive`
`generate @nx/angular:remote ${remoteApp1} --host=${hostApp} --port=${remotePort} --style=css --no-standalone --no-interactive`
);
// check files are generated without the layout directory ("apps/")
@ -59,7 +59,7 @@ describe('Angular Module Federation', () => {
// generate a shared lib with a seconary entry point
runCLI(
`generate @nx/angular:library ${sharedLib} --buildable --no-standalone --project-name-and-root-format=as-provided --no-interactive`
`generate @nx/angular:library ${sharedLib} --buildable --no-standalone --no-interactive`
);
runCLI(
`generate @nx/angular:library-secondary-entry-point --library=${sharedLib} --name=${secondaryEntry} --no-interactive`
@ -67,7 +67,7 @@ describe('Angular Module Federation', () => {
// Add a library that will be accessed via a wildcard in tspath mappings
runCLI(
`generate @nx/angular:library ${wildcardLib} --buildable --no-standalone --project-name-and-root-format=as-provided --no-interactive`
`generate @nx/angular:library ${wildcardLib} --buildable --no-standalone --no-interactive`
);
updateJson('tsconfig.base.json', (json) => {
@ -180,10 +180,10 @@ describe('Angular Module Federation', () => {
// generate apps
runCLI(
`generate @nx/angular:application ${app1} --routing --bundler=webpack --project-name-and-root-format=as-provided --no-interactive`
`generate @nx/angular:application ${app1} --routing --bundler=webpack --no-interactive`
);
runCLI(
`generate @nx/angular:application ${app2} --bundler=webpack --project-name-and-root-format=as-provided --no-interactive`
`generate @nx/angular:application ${app2} --bundler=webpack --no-interactive`
);
// convert apps
@ -221,7 +221,7 @@ describe('Angular Module Federation', () => {
// generate remote apps
runCLI(
`generate @nx/angular:host ${host} --ssr --remotes=${remote1},${remote2} --project-name-and-root-format=as-provided --no-interactive`
`generate @nx/angular:host ${host} --ssr --remotes=${remote1},${remote2} --no-interactive`
);
// ports
@ -283,12 +283,10 @@ test('renders remotes', async ({ page }) => {
const hostPort = 4200;
runCLI(
`generate @nx/angular:host ${host} --remotes=${remote} --e2eTestRunner=cypress --no-interactive --projectNameAndRootFormat=as-provided`
`generate @nx/angular:host ${host} --remotes=${remote} --e2eTestRunner=cypress --no-interactive`
);
runCLI(
`generate @nx/js:lib ${lib} --no-interactive --projectNameAndRootFormat=as-provided`
);
runCLI(`generate @nx/js:lib ${lib} --no-interactive`);
// Federate Module
runCLI(
@ -357,16 +355,14 @@ test('renders remotes', async ({ page }) => {
const hostPort = 4200;
runCLI(
`generate @nx/angular:host ${host} --remotes=${remote} --e2eTestRunner=cypress --no-interactive --projectNameAndRootFormat=as-provided`
`generate @nx/angular:host ${host} --remotes=${remote} --e2eTestRunner=cypress --no-interactive`
);
runCLI(
`generate @nx/js:lib ${lib} --no-interactive --projectNameAndRootFormat=as-provided`
);
runCLI(`generate @nx/js:lib ${lib} --no-interactive`);
// Federate Module
runCLI(
`generate @nx/angular:federate-module ${lib}/src/index.ts --name=${module} --remote=${childRemote} --no-interactive`
`generate @nx/angular:federate-module ${lib}/src/index.ts --name=${module} --remote=${childRemote} --remoteDirectory=${childRemote} --no-interactive`
);
updateFile(`${lib}/src/index.ts`, `export { isEven } from './lib/${lib}';`);

View File

@ -21,7 +21,7 @@ describe('Angular Package', () => {
it('should work', async () => {
const myapp = uniq('myapp');
runCLI(
`generate @nx/angular:app ${myapp} --no-standalone --project-name-and-root-format=as-provided --no-interactive`
`generate @nx/angular:app ${myapp} --no-standalone --no-interactive`
);
// Generate root ngrx state management
@ -36,9 +36,7 @@ describe('Angular Package', () => {
const mylib = uniq('mylib');
// Generate feature library and ngrx state within that library
runCLI(
`g @nx/angular:lib ${mylib} --prefix=fl --no-standalone --project-name-and-root-format=as-provided`
);
runCLI(`g @nx/angular:lib ${mylib} --prefix=fl --no-standalone`);
runCLI(
`generate @nx/angular:ngrx flights --parent=${mylib}/src/lib/${mylib}.module.ts --facade`
);
@ -54,7 +52,7 @@ describe('Angular Package', () => {
it('should work with creators', async () => {
const myapp = uniq('myapp');
runCLI(
`generate @nx/angular:app ${myapp} --routing --no-standalone --project-name-and-root-format=as-provided --no-interactive`
`generate @nx/angular:app ${myapp} --routing --no-standalone --no-interactive`
);
// Generate root ngrx state management
@ -71,9 +69,7 @@ describe('Angular Package', () => {
const mylib = uniq('mylib');
// Generate feature library and ngrx state within that library
runCLI(
`g @nx/angular:lib ${mylib} --prefix=fl --no-standalone --project-name-and-root-format=as-provided`
);
runCLI(`g @nx/angular:lib ${mylib} --prefix=fl --no-standalone`);
const flags = `--facade --barrels`;
runCLI(
@ -91,7 +87,7 @@ describe('Angular Package', () => {
it('should work with creators using --module', async () => {
const myapp = uniq('myapp');
runCLI(
`generate @nx/angular:app ${myapp} --routing --no-standalone --project-name-and-root-format=as-provided --no-interactive`
`generate @nx/angular:app ${myapp} --routing --no-standalone --no-interactive`
);
// Generate root ngrx state management
@ -108,9 +104,7 @@ describe('Angular Package', () => {
const mylib = uniq('mylib');
// Generate feature library and ngrx state within that library
runCLI(
`g @nx/angular:lib ${mylib} --prefix=fl --no-standalone --project-name-and-root-format=as-provided`
);
runCLI(`g @nx/angular:lib ${mylib} --prefix=fl --no-standalone`);
const flags = `--facade --barrels`;
runCLI(

View File

@ -25,7 +25,6 @@ describe('Angular Crystal Plugin', () => {
beforeAll(() => {
proj = newProject({
packages: ['@nx/angular'],
unsetProjectNameAndRootFormat: false,
});
if (getSelectedPackageManager() === 'pnpm') {

View File

@ -34,14 +34,12 @@ describe('Angular Projects', () => {
beforeAll(() => {
proj = newProject({ packages: ['@nx/angular'] });
runCLI(
`generate @nx/angular:app ${app1} --no-standalone --bundler=webpack --project-name-and-root-format=as-provided --no-interactive`
`generate @nx/angular:app ${app1} --no-standalone --bundler=webpack --no-interactive`
);
runCLI(
`generate @nx/angular:app ${esbuildApp} --bundler=esbuild --no-standalone --project-name-and-root-format=as-provided --no-interactive`
);
runCLI(
`generate @nx/angular:lib ${lib1} --project-name-and-root-format=as-provided --no-interactive`
`generate @nx/angular:app ${esbuildApp} --bundler=esbuild --no-standalone --no-interactive`
);
runCLI(`generate @nx/angular:lib ${lib1} --no-interactive`);
app1DefaultModule = readFile(`${app1}/src/app/app.module.ts`);
app1DefaultComponentTemplate = readFile(
`${app1}/src/app/app.component.html`
@ -72,12 +70,12 @@ describe('Angular Projects', () => {
it('should successfully generate apps and libs and work correctly', async () => {
const standaloneApp = uniq('standalone-app');
runCLI(
`generate @nx/angular:app ${standaloneApp} --directory=my-dir/${standaloneApp} --bundler=webpack --project-name-and-root-format=as-provided --no-interactive`
`generate @nx/angular:app my-dir/${standaloneApp} --bundler=webpack --no-interactive`
);
const esbuildStandaloneApp = uniq('esbuild-app');
runCLI(
`generate @nx/angular:app ${esbuildStandaloneApp} --bundler=esbuild --directory=my-dir/${esbuildStandaloneApp} --project-name-and-root-format=as-provided --no-interactive`
`generate @nx/angular:app my-dir/${esbuildStandaloneApp} --bundler=esbuild --no-interactive`
);
updateFile(
@ -155,7 +153,7 @@ describe('Angular Projects', () => {
const app = uniq('app');
runCLI(
`generate @nx/angular:app ${app} --e2eTestRunner=playwright --project-name-and-root-format=as-provided --no-interactive`
`generate @nx/angular:app ${app} --e2eTestRunner=playwright --no-interactive`
);
if (runE2ETests('playwright')) {
@ -219,10 +217,10 @@ describe('Angular Projects', () => {
const buildableChildLib = uniq('buildlib2');
runCLI(
`generate @nx/angular:library ${buildableLib} --buildable=true --no-standalone --project-name-and-root-format=as-provided --no-interactive`
`generate @nx/angular:library ${buildableLib} --buildable=true --no-standalone --no-interactive`
);
runCLI(
`generate @nx/angular:library ${buildableChildLib} --buildable=true --no-standalone --project-name-and-root-format=as-provided --no-interactive`
`generate @nx/angular:library ${buildableChildLib} --buildable=true --no-standalone --no-interactive`
);
// update the app module to include a ref to the buildable lib
@ -463,14 +461,14 @@ describe('Angular Projects', () => {
const entryPoint = uniq('entrypoint');
runCLI(
`generate @nx/angular:lib ${lib} --publishable --importPath=@${proj}/${lib} --no-standalone --project-name-and-root-format=as-provided --no-interactive`
`generate @nx/angular:lib ${lib} --publishable --importPath=@${proj}/${lib} --no-standalone --no-interactive`
);
runCLI(
`generate @nx/angular:secondary-entry-point --name=${entryPoint} --library=${lib} --no-interactive`
);
runCLI(
`generate @nx/angular:library ${childLib} --publishable=true --importPath=@${proj}/${childLib} --no-standalone --project-name-and-root-format=as-provided --no-interactive`
`generate @nx/angular:library ${childLib} --publishable=true --importPath=@${proj}/${childLib} --no-standalone --no-interactive`
);
runCLI(
`generate @nx/angular:secondary-entry-point --name=sub --library=${childLib} --no-interactive`
@ -504,12 +502,10 @@ describe('Angular Projects', () => {
expect(() => runCLI(`lint ${childLib} --fix`)).not.toThrow();
});
it('should support generating libraries with a scoped name when --project-name-and-root-format=as-provided', () => {
it('should support generating libraries with a scoped name when', () => {
const libName = uniq('@my-org/lib1');
runCLI(
`generate @nx/angular:lib ${libName} --buildable --standalone --project-name-and-root-format=as-provided`
);
runCLI(`generate @nx/angular:lib ${libName} --buildable --standalone`);
// check files are generated without the layout directory ("libs/") and
// using the project name as the directory when no directory is provided
@ -530,7 +526,7 @@ describe('Angular Projects', () => {
const webpackApp = uniq('webpack-app');
runCLI(
`generate @nx/angular:app ${esbuildApp} --bundler=esbuild --ssr --project-name-and-root-format=as-provided --no-interactive`
`generate @nx/angular:app ${esbuildApp} --bundler=esbuild --ssr --no-interactive`
);
// check build produces both the browser and server bundles
@ -541,7 +537,7 @@ describe('Angular Projects', () => {
);
runCLI(
`generate @nx/angular:app ${webpackApp} --bundler=webpack --ssr --project-name-and-root-format=as-provided --no-interactive`
`generate @nx/angular:app ${webpackApp} --bundler=webpack --ssr --no-interactive`
);
// check build only produces the browser bundle

View File

@ -187,7 +187,7 @@ describe('Tailwind support', () => {
it('should generate a buildable library with tailwind and build correctly', () => {
runCLI(
`generate @nx/angular:lib ${buildLibWithTailwind.name} --buildable --add-tailwind --project-name-and-root-format=as-provided --no-interactive`
`generate @nx/angular:lib ${buildLibWithTailwind.name} --buildable --add-tailwind --no-interactive`
);
updateTailwindConfig(
`${buildLibWithTailwind.name}/tailwind.config.js`,
@ -209,7 +209,7 @@ describe('Tailwind support', () => {
it('should set up tailwind in a previously generated buildable library and build correctly', () => {
const buildLibSetupTailwind = uniq('build-lib-setup-tailwind');
runCLI(
`generate @nx/angular:lib ${buildLibSetupTailwind} --buildable --project-name-and-root-format=as-provided --no-interactive`
`generate @nx/angular:lib ${buildLibSetupTailwind} --buildable --no-interactive`
);
runCLI(
`generate @nx/angular:setup-tailwind ${buildLibSetupTailwind} --no-interactive`
@ -228,7 +228,7 @@ describe('Tailwind support', () => {
it('should correctly build a buildable library with a tailwind.config.js file in the project root or workspace root', () => {
const buildLibNoProjectConfig = uniq('build-lib-no-project-config');
runCLI(
`generate @nx/angular:lib ${buildLibNoProjectConfig} --buildable --project-name-and-root-format=as-provided --no-interactive`
`generate @nx/angular:lib ${buildLibNoProjectConfig} --buildable --no-interactive`
);
createTailwindConfigFile(
`${buildLibNoProjectConfig}/tailwind.config.js`,
@ -253,7 +253,7 @@ describe('Tailwind support', () => {
it('should generate a publishable library with tailwind and build correctly', () => {
runCLI(
`generate @nx/angular:lib ${pubLibWithTailwind.name} --publishable --add-tailwind --importPath=@${project}/${pubLibWithTailwind.name} --project-name-and-root-format=as-provided --no-interactive`
`generate @nx/angular:lib ${pubLibWithTailwind.name} --publishable --add-tailwind --importPath=@${project}/${pubLibWithTailwind.name} --no-interactive`
);
updateTailwindConfig(
`${pubLibWithTailwind.name}/tailwind.config.js`,
@ -275,7 +275,7 @@ describe('Tailwind support', () => {
it('should set up tailwind in a previously generated publishable library and build correctly', () => {
const pubLibSetupTailwind = uniq('pub-lib-setup-tailwind');
runCLI(
`generate @nx/angular:lib ${pubLibSetupTailwind} --publishable --importPath=@${project}/${pubLibSetupTailwind} --project-name-and-root-format=as-provided --no-interactive`
`generate @nx/angular:lib ${pubLibSetupTailwind} --publishable --importPath=@${project}/${pubLibSetupTailwind} --no-interactive`
);
runCLI(
`generate @nx/angular:setup-tailwind ${pubLibSetupTailwind} --no-interactive`
@ -294,7 +294,7 @@ describe('Tailwind support', () => {
it('should correctly build a publishable library with a tailwind.config.js file in the project root or workspace root', () => {
const pubLibNoProjectConfig = uniq('pub-lib-no-project-config');
runCLI(
`generate @nx/angular:lib ${pubLibNoProjectConfig} --publishable --importPath=@${project}/${pubLibNoProjectConfig} --project-name-and-root-format=as-provided --no-interactive`
`generate @nx/angular:lib ${pubLibNoProjectConfig} --publishable --importPath=@${project}/${pubLibNoProjectConfig} --no-interactive`
);
createTailwindConfigFile(
`${pubLibNoProjectConfig}/tailwind.config.js`,
@ -379,7 +379,7 @@ describe('Tailwind support', () => {
it('should build correctly and only output the tailwind utilities used', async () => {
const appWithTailwind = uniq('app-with-tailwind');
runCLI(
`generate @nx/angular:app ${appWithTailwind} --add-tailwind --project-name-and-root-format=as-provided --no-interactive`
`generate @nx/angular:app ${appWithTailwind} --add-tailwind --no-interactive`
);
setupTailwindAndProjectDependencies(appWithTailwind);
@ -398,7 +398,7 @@ describe('Tailwind support', () => {
it('should build correctly and only output the tailwind utilities used when using webpack and incremental builds', async () => {
const appWithTailwind = uniq('app-with-tailwind');
runCLI(
`generate @nx/angular:app ${appWithTailwind} --add-tailwind --bundler=webpack --project-name-and-root-format=as-provided --no-interactive`
`generate @nx/angular:app ${appWithTailwind} --add-tailwind --bundler=webpack --no-interactive`
);
setupTailwindAndProjectDependencies(appWithTailwind);
updateJson(join(appWithTailwind, 'project.json'), (config) => {

View File

@ -26,7 +26,7 @@ describe('Cypress E2E Test runner', () => {
'should generate an app with the Cypress as e2e test runner',
() => {
runCLI(
`generate @nx/react:app ${myapp} --directory=apps/${myapp} --e2eTestRunner=cypress --linter=eslint`
`generate @nx/react:app apps/${myapp} --e2eTestRunner=cypress --linter=eslint`
);
// Making sure the package.json file contains the Cypress dependency
@ -155,7 +155,7 @@ export default defineConfig({
async () => {
const appName = uniq('next-cy-app');
runCLI(
`generate @nx/next:app ${appName} --directory=apps/${appName} --e2eTestRunner=none --no-interactive --projectNameAndRootFormat=as-provided`
`generate @nx/next:app apps/${appName} --e2eTestRunner=none --no-interactive `
);
runCLI(
`generate @nx/next:component apps/${appName}/components/btn --no-interactive`
@ -183,7 +183,7 @@ export default defineConfig({
async () => {
let appName = uniq(`angular-cy-app`);
runCLI(
`generate @nx/angular:app ${appName} --directory=apps/${appName} --e2eTestRunner=none --no-interactive --bundler=webpack`
`generate @nx/angular:app apps/${appName} --e2eTestRunner=none --no-interactive --bundler=webpack`
);
runCLI(
`generate @nx/angular:component apps/${appName}/src/app/btn/btn --no-interactive`

View File

@ -26,7 +26,7 @@ describe('@nx/detox (legacy)', () => {
it('should create files and run lint command for react-native apps', async () => {
runCLI(
`generate @nx/react-native:app ${appName} --directory=apps/${appName} --e2eTestRunner=detox --linter=eslint --install=false`
`generate @nx/react-native:app apps/${appName} --e2eTestRunner=detox --linter=eslint --install=false`
);
checkFilesExist(`apps/${appName}-e2e/.detoxrc.json`);
checkFilesExist(`apps/${appName}-e2e/tsconfig.json`);
@ -43,7 +43,7 @@ describe('@nx/detox (legacy)', () => {
it('should create files and run lint command for expo apps', async () => {
const expoAppName = uniq('myapp');
runCLI(
`generate @nx/expo:app ${expoAppName} --directory=apps/${expoAppName} --e2eTestRunner=detox --linter=eslint`
`generate @nx/expo:app apps/${expoAppName} --e2eTestRunner=detox --linter=eslint`
);
checkFilesExist(`apps/${expoAppName}-e2e/.detoxrc.json`);
checkFilesExist(`apps/${expoAppName}-e2e/tsconfig.json`);
@ -61,7 +61,7 @@ describe('@nx/detox (legacy)', () => {
const appName = uniq('app1');
runCLI(
`generate @nx/react-native:app ${appName} --e2eTestRunner=detox --linter=eslint --install=false --project-name-and-root-format=as-provided --interactive=false`
`generate @nx/react-native:app ${appName} --e2eTestRunner=detox --linter=eslint --install=false --interactive=false`
);
// check files are generated without the layout directory ("apps/") and

View File

@ -17,10 +17,10 @@ describe('@nx/detox', () => {
reactNativeAppName = uniq('appTest');
expoAppName = uniq('expoAppTest');
runCLI(
`generate @nx/react-native:app ${reactNativeAppName} --e2eTestRunner=detox --install=false --project-name-and-root-format=as-provided --interactive=false`
`generate @nx/react-native:app ${reactNativeAppName} --e2eTestRunner=detox --install=false --interactive=false`
);
runCLI(
`generate @nx/expo:app ${expoAppName} --e2eTestRunner=detox --project-name-and-root-format=as-provided --interactive=false`
`generate @nx/expo:app ${expoAppName} --e2eTestRunner=detox --interactive=false`
);
updateAppDetoxJson(reactNativeAppName);
updateAppDetoxJson(expoAppName);

View File

@ -27,13 +27,10 @@ describe('Linter (legacy)', () => {
newProject({
packages: ['@nx/react', '@nx/js', '@nx/eslint'],
});
runCLI(
`generate @nx/react:app ${myapp} --tags=validtag --directory=apps/${myapp}`,
{
env: { NX_ADD_PLUGINS: 'false' },
}
);
runCLI(`generate @nx/js:lib ${mylib} --directory=libs/${mylib}`, {
runCLI(`generate @nx/react:app apps/${myapp} --tags=validtag`, {
env: { NX_ADD_PLUGINS: 'false' },
});
runCLI(`generate @nx/js:lib apps/${mylib}`, {
env: { NX_ADD_PLUGINS: 'false' },
});
});
@ -138,18 +135,12 @@ describe('Linter (legacy)', () => {
bundler: 'vite',
e2eTestRunner: 'none',
});
runCLI(
`generate @nx/js:lib ${mylib} --directory libs/${mylib} --projectNameAndRootFormat as-provided`,
{
env: { NX_ADD_PLUGINS: 'false' },
}
);
runCLI(
`generate @nx/js:lib ${mylib2} --directory libs/${mylib2} --projectNameAndRootFormat as-provided`,
{
env: { NX_ADD_PLUGINS: 'false' },
}
);
runCLI(`generate @nx/js:lib libs/${mylib}`, {
env: { NX_ADD_PLUGINS: 'false' },
});
runCLI(`generate @nx/js:lib libs/${mylib2}`, {
env: { NX_ADD_PLUGINS: 'false' },
});
// migrate to flat structure
runCLI(`generate @nx/eslint:convert-to-flat-config`, {

View File

@ -35,10 +35,8 @@ describe('Linter', () => {
projScope = newProject({
packages: ['@nx/react', '@nx/js', '@nx/eslint'],
});
runCLI(
`generate @nx/react:app ${myapp} --tags=validtag --directory=apps/${myapp}`
);
runCLI(`generate @nx/js:lib ${mylib} --directory=libs/${mylib}`);
runCLI(`generate @nx/react:app apps/${myapp} --tags=validtag`);
runCLI(`generate @nx/js:lib libs/${mylib}`);
});
afterAll(() => cleanupProject());
@ -211,14 +209,10 @@ describe('Linter', () => {
const invalidtaglib = uniq('invalidtaglib');
const validtaglib = uniq('validtaglib');
runCLI(`generate @nx/react:app ${myapp2} --directory=apps/${myapp2}`);
runCLI(`generate @nx/react:lib ${lazylib} --directory=libs/${lazylib}`);
runCLI(
`generate @nx/js:lib ${invalidtaglib} --tags=invalidtag --directory=libs/${invalidtaglib}`
);
runCLI(
`generate @nx/js:lib ${validtaglib} --tags=validtag --directory=libs/${validtaglib}`
);
runCLI(`generate @nx/react:app apps/${myapp2}`);
runCLI(`generate @nx/react:lib libs/${lazylib}`);
runCLI(`generate @nx/js:lib libs/${invalidtaglib} --tags=invalidtag`);
runCLI(`generate @nx/js:lib libs/${validtaglib} --tags=validtag`);
const eslint = readJson('.eslintrc.json');
eslint.overrides[0].rules[
@ -280,15 +274,9 @@ describe('Linter', () => {
beforeAll(() => {
// make these libs non-buildable to avoid dep-checks triggering lint errors
runCLI(
`generate @nx/js:lib ${libA} --bundler=none --directory=libs/${libA}`
);
runCLI(
`generate @nx/js:lib ${libB} --bundler=none --directory=libs/${libB}`
);
runCLI(
`generate @nx/js:lib ${libC} --bundler=none --directory=libs/${libC}`
);
runCLI(`generate @nx/js:lib libs/${libA} --bundler=none`);
runCLI(`generate @nx/js:lib libs/${libB} --bundler=none`);
runCLI(`generate @nx/js:lib libs/${libC} --bundler=none`);
/**
* create tslib-a structure
@ -602,12 +590,8 @@ describe('Linter', () => {
const reactLib = uniq('react-lib');
const jsLib = uniq('js-lib');
runCLI(
`generate @nx/react:lib ${reactLib} --directory=${reactLib} --projectNameAndRootFormat=as-provided`
);
runCLI(
`generate @nx/js:lib ${jsLib} --directory=${jsLib} --projectNameAndRootFormat=as-provided`
);
runCLI(`generate @nx/react:lib ${reactLib}`);
runCLI(`generate @nx/js:lib ${jsLib}`);
checkFilesExist(
`${reactLib}/eslint.config.js`,
@ -686,7 +670,7 @@ describe('Linter', () => {
const mylib = uniq('mylib');
runCLI(
`generate @nx/react:app ${myapp} --unitTestRunner=jest --rootProject=true`
`generate @nx/react:app --name=${myapp} --unitTestRunner=jest --directory="."`
);
verifySuccessfulStandaloneSetup(myapp);
@ -700,9 +684,7 @@ describe('Linter', () => {
let e2eOverrides = JSON.stringify(e2eEslint.overrides);
expect(e2eOverrides).toContain('plugin:@nx/javascript');
runCLI(
`generate @nx/js:lib ${mylib} --unitTestRunner=jest --directory=libs/${mylib}`
);
runCLI(`generate @nx/js:lib libs/${mylib} --unitTestRunner=jest`);
verifySuccessfulMigratedSetup(myapp, mylib);
appEslint = readJson(`.eslintrc.json`);
@ -722,7 +704,7 @@ describe('Linter', () => {
const mylib = uniq('mylib');
runCLI(
`generate @nx/angular:app ${myapp} --rootProject=true --no-interactive`
`generate @nx/angular:app --name=${myapp} --directory="." --no-interactive`
);
verifySuccessfulStandaloneSetup(myapp);
@ -735,9 +717,7 @@ describe('Linter', () => {
let e2eOverrides = JSON.stringify(e2eEslint.overrides);
expect(e2eOverrides).toContain('plugin:@nx/javascript');
runCLI(
`generate @nx/js:lib ${mylib} --no-interactive --directory=libs/${mylib}`
);
runCLI(`generate @nx/js:lib libs/${mylib} --no-interactive`);
verifySuccessfulMigratedSetup(myapp, mylib);
appEslint = readJson(`.eslintrc.json`);
@ -755,7 +735,7 @@ describe('Linter', () => {
const mylib = uniq('mylib');
runCLI(
`generate @nx/node:app ${myapp} --rootProject=true --no-interactive`
`generate @nx/node:app --name=${myapp} --directory="." --no-interactive`
);
verifySuccessfulStandaloneSetup(myapp);
@ -770,9 +750,7 @@ describe('Linter', () => {
expect(e2eOverrides).toContain('plugin:@nx/javascript');
expect(e2eOverrides).toContain('plugin:@nx/typescript');
runCLI(
`generate @nx/js:lib ${mylib} --no-interactive --directory=libs/${mylib}`
);
runCLI(`generate @nx/js:lib libs/${mylib} --no-interactive`);
verifySuccessfulMigratedSetup(myapp, mylib);
appEslint = readJson(`.eslintrc.json`);

View File

@ -40,10 +40,10 @@ describe('@nx/expo (legacy)', () => {
return nxJson;
});
runCLI(
`generate @nx/expo:application ${appName} --directory=apps/${appName} --e2eTestRunner=cypress --no-interactive`
`generate @nx/expo:application apps/${appName} --e2eTestRunner=cypress --no-interactive`
);
runCLI(
`generate @nx/expo:library ${libName} --directory=libs/${libName} --buildable --publishable --importPath=${proj}/${libName}`
`generate @nx/expo:library libs/${libName} --buildable --publishable --importPath=${proj}/${libName}`
);
});
afterAll(() => {
@ -210,9 +210,7 @@ describe('@nx/expo (legacy)', () => {
const appName = uniq('app1');
const libName = uniq('@my-org/lib1');
runCLI(
`generate @nx/expo:application ${appName} --project-name-and-root-format=as-provided --no-interactive`
);
runCLI(`generate @nx/expo:application ${appName} --no-interactive`);
// check files are generated without the layout directory ("apps/") and
// using the project name as the directory when no directory is provided
@ -223,9 +221,7 @@ describe('@nx/expo (legacy)', () => {
`Successfully ran target test for project ${appName}`
);
runCLI(
`generate @nx/expo:library ${libName} --buildable --project-name-and-root-format=as-provided`
);
runCLI(`generate @nx/expo:library ${libName} --buildable`);
// check files are generated without the layout directory ("libs/") and
// using the project name as the directory when no directory is provided

View File

@ -23,9 +23,7 @@ describe('@nx/expo', () => {
beforeAll(() => {
newProject();
appName = uniq('app');
runCLI(
`generate @nx/expo:app ${appName} --project-name-and-root-format=as-provided --no-interactive`
);
runCLI(`generate @nx/expo:app ${appName} --no-interactive`);
});
afterAll(() => cleanupProject());

View File

@ -22,7 +22,6 @@ describe('Nx Import Gradle', () => {
beforeAll(() => {
proj = newProject({
packages: ['@nx/js'],
unsetProjectNameAndRootFormat: false,
});
if (getSelectedPackageManager() === 'pnpm') {

View File

@ -18,14 +18,11 @@ describe('Jest', () => {
it('should support multiple `coverageReporters` when using @nx/jest:jest executor', async () => {
const mylib = uniq('mylib');
runCLI(
`generate @nx/js:lib ${mylib} --directory=libs/${mylib} --unitTestRunner=jest`,
{
env: {
NX_ADD_PLUGINS: 'false',
},
}
);
runCLI(`generate @nx/js:lib libs/${mylib} --unitTestRunner=jest`, {
env: {
NX_ADD_PLUGINS: 'false',
},
});
updateFile(
`libs/${mylib}/src/lib/${mylib}.spec.ts`,

View File

@ -8,10 +8,9 @@ describe('Jest root projects', () => {
beforeAll(() => {
newProject({
packages: ['@nx/angular'],
unsetProjectNameAndRootFormat: false,
});
runCLI(
`generate @nx/angular:app ${myapp} --directory . --rootProject --projectNameAndRootFormat as-provided --no-interactive`
`generate @nx/angular:app --name=${myapp} --directory . --rootProject --no-interactive`
);
});
@ -20,9 +19,7 @@ describe('Jest root projects', () => {
}, 300_000);
it('should add lib project and tests should still work', async () => {
runCLI(
`generate @nx/angular:lib ${mylib} --projectNameAndRootFormat as-provided --no-interactive`
);
runCLI(`generate @nx/angular:lib ${mylib} --no-interactive`);
expect(() => runCLI(`test ${mylib}`)).not.toThrow();
expect(() => runCLI(`test ${myapp}`)).not.toThrow();
@ -33,10 +30,9 @@ describe('Jest root projects', () => {
beforeAll(() => {
newProject({
packages: ['@nx/react'],
unsetProjectNameAndRootFormat: false,
});
runCLI(
`generate @nx/react:app ${myapp} --directory . --rootProject --projectNameAndRootFormat as-provided`
`generate @nx/react:app --name=${myapp} --directory . --rootProject`
);
});
@ -45,9 +41,7 @@ describe('Jest root projects', () => {
}, 300_000);
it('should add lib project and tests should still work', async () => {
runCLI(
`generate @nx/react:lib ${mylib} --unitTestRunner=jest --projectNameAndRootFormat as-provided`
);
runCLI(`generate @nx/react:lib ${mylib} --unitTestRunner=jest`);
expect(() => runCLI(`test ${mylib}`)).not.toThrow();
expect(() => runCLI(`test ${myapp}`)).not.toThrow();

View File

@ -43,10 +43,10 @@ describe('Jest', () => {
const mylib = uniq('mylib');
const utilLib = uniq('util-lib');
runCLI(
`generate @nx/js:lib ${mylib} --directory=libs/${mylib} --unitTestRunner=jest --no-interactive`
`generate @nx/js:lib libs/${mylib} --unitTestRunner=jest --no-interactive`
);
runCLI(
`generate @nx/js:lib ${utilLib} --directory=libs/${utilLib} --importPath=@global-fun/globals --unitTestRunner=jest --no-interactive`
`generate @nx/js:lib libs/${utilLib} --importPath=@global-fun/globals --unitTestRunner=jest --no-interactive`
);
updateFile(
`libs/${utilLib}/src/index.ts`,
@ -122,9 +122,7 @@ describe('Jest', () => {
it('should set the NODE_ENV to `test`', async () => {
const mylib = uniq('mylib');
runCLI(
`generate @nx/js:lib ${mylib} --directory=libs/${mylib} --unitTestRunner=jest`
);
runCLI(`generate @nx/js:lib libs/${mylib} --unitTestRunner=jest`);
updateFile(
`libs/${mylib}/src/lib/${mylib}.spec.ts`,
@ -143,7 +141,7 @@ describe('Jest', () => {
it('should be able to test node lib with babel-jest', async () => {
const libName = uniq('babel-test-lib');
runCLI(
`generate @nx/node:lib ${libName} --directory=libs/${libName} --buildable --importPath=@some-org/babel-test --publishable --babelJest`
`generate @nx/node:lib libs/${libName} --buildable --importPath=@some-org/babel-test --publishable --babelJest`
);
const cliResults = await runCLIAsync(`test ${libName}`);
@ -154,9 +152,7 @@ describe('Jest', () => {
it('should be able to run e2e tests split by tasks', async () => {
const libName = uniq('lib');
runCLI(
`generate @nx/js:lib ${libName} --directory=libs/${libName} --unitTestRunner=jest`
);
runCLI(`generate @nx/js:lib libs/${libName} --unitTestRunner=jest`);
updateJson('nx.json', (json) => {
const jestPlugin = json.plugins.find(
(plugin) => plugin.plugin === '@nx/jest/plugin'

View File

@ -21,7 +21,7 @@ describe('js:node executor', () => {
const esbuildLib = uniq('esbuildlib');
runCLI(
`generate @nx/js:lib ${esbuildLib} --directory=libs/${esbuildLib} --bundler=esbuild --no-interactive`
`generate @nx/js:lib libs/${esbuildLib} --bundler=esbuild --no-interactive`
);
updateFile(`libs/${esbuildLib}/src/index.ts`, () => {
@ -55,7 +55,7 @@ describe('js:node executor', () => {
const rollupLib = uniq('rolluplib');
runCLI(
`generate @nx/js:lib ${rollupLib} --directory=libs/${rollupLib} --bundler=rollup --no-interactive`
`generate @nx/js:lib libs/${rollupLib} --bundler=rollup --no-interactive`
);
updateFile(`libs/${rollupLib}/src/index.ts`, () => {
@ -82,9 +82,7 @@ describe('js:node executor', () => {
it('should execute library compiled with tsc', async () => {
const tscLib = uniq('tsclib');
runCLI(
`generate @nx/js:lib ${tscLib} --directory=libs/${tscLib} --bundler=tsc --no-interactive`
);
runCLI(`generate @nx/js:lib libs/${tscLib} --bundler=tsc --no-interactive`);
updateFile(`libs/${tscLib}/src/index.ts`, () => {
return `
@ -110,9 +108,7 @@ describe('js:node executor', () => {
it('should execute library compiled with swc', async () => {
const swcLib = uniq('swclib');
runCLI(
`generate @nx/js:lib ${swcLib} --directory=libs/${swcLib} --bundler=swc --no-interactive`
);
runCLI(`generate @nx/js:lib libs/${swcLib} --bundler=swc --no-interactive`);
updateFile(`libs/${swcLib}/src/index.ts`, () => {
return `
@ -139,7 +135,7 @@ describe('js:node executor', () => {
const webpackProject = uniq('webpackproject');
runCLI(
`generate @nx/node:application ${webpackProject} --directory=apps/${webpackProject} --bundler=webpack --no-interactive`
`generate @nx/node:application apps/${webpackProject} --bundler=webpack --no-interactive`
);
updateFile(`apps/${webpackProject}/src/main.ts`, () => {

View File

@ -24,9 +24,7 @@ describe('js:swc executor', () => {
it('should create libs with js executors (--bundler=swc)', async () => {
const lib = uniq('lib');
runCLI(
`generate @nx/js:lib ${lib} --directory=libs/${lib} --bundler=swc --no-interactive`
);
runCLI(`generate @nx/js:lib libs/${lib} --bundler=swc --no-interactive`);
const libPackageJson = readJson(`libs/${lib}/package.json`);
expect(libPackageJson.scripts).toBeUndefined();
@ -50,9 +48,7 @@ describe('js:swc executor', () => {
it('should handle swcrc path mappings', async () => {
const lib = uniq('lib');
runCLI(
`generate @nx/js:lib ${lib} --directory=libs/${lib} --bundler=swc --no-interactive`
);
runCLI(`generate @nx/js:lib libs/${lib} --bundler=swc --no-interactive`);
// add a dummy x.ts file for path mappings
updateFile(
@ -99,9 +95,7 @@ myLib();
it('should support --strip-leading-paths option', () => {
const lib = uniq('lib');
runCLI(
`generate @nx/js:lib ${lib} --directory=libs/${lib} --bundler=swc --no-interactive`
);
runCLI(`generate @nx/js:lib libs/${lib} --bundler=swc --no-interactive`);
runCLI(`build ${lib} --stripLeadingPaths`);

View File

@ -28,9 +28,7 @@ describe('js:tsc executor', () => {
it('should create libs with js executors (--compiler=tsc)', async () => {
const lib = uniq('lib');
runCLI(
`generate @nx/js:lib ${lib} --directory=libs/${lib} --bundler=tsc --no-interactive`
);
runCLI(`generate @nx/js:lib libs/${lib} --bundler=tsc --no-interactive`);
const libPackageJson = readJson(`libs/${lib}/package.json`);
expect(libPackageJson.scripts).toBeUndefined();
@ -112,7 +110,7 @@ describe('js:tsc executor', () => {
const parentLib = uniq('parentlib');
runCLI(
`generate @nx/js:lib ${parentLib} --directory=libs/${parentLib} --bundler=tsc --no-interactive`
`generate @nx/js:lib libs/${parentLib} --bundler=tsc --no-interactive`
);
const parentLibPackageJson = readJson(`libs/${parentLib}/package.json`);
expect(parentLibPackageJson.scripts).toBeUndefined();
@ -217,7 +215,7 @@ describe('js:tsc executor', () => {
it('should not create a `.babelrc` file when creating libs with js executors (--compiler=tsc)', () => {
const lib = uniq('lib');
runCLI(
`generate @nx/js:lib ${lib} --compiler=tsc --directory=libs/${lib}--includeBabelRc=false --no-interactive`
`generate @nx/js:lib libs/${lib} --compiler=tsc --includeBabelRc=false --no-interactive`
);
checkFilesDoNotExist(`libs/${lib}/.babelrc`);
@ -225,14 +223,10 @@ describe('js:tsc executor', () => {
it('should allow wildcard ts path alias', async () => {
const base = uniq('base');
runCLI(
`generate @nx/js:lib ${base} --directory=libs/${base} --bundler=tsc --no-interactive`
);
runCLI(`generate @nx/js:lib libs/${base} --bundler=tsc --no-interactive`);
const lib = uniq('lib');
runCLI(
`generate @nx/js:lib ${lib} --directory=libs/${lib} --bundler=tsc --no-interactive`
);
runCLI(`generate @nx/js:lib libs/${lib} --bundler=tsc --no-interactive`);
updateFile(`libs/${base}/src/index.ts`, () => {
return `
@ -282,9 +276,7 @@ export function ${lib}Wildcard() {
it('should update package.json with detected dependencies', async () => {
const pmc = getPackageManagerCommand();
const lib = uniq('lib');
runCLI(
`generate @nx/js:lib ${lib} --directory=libs/${lib} --bundler=tsc --no-interactive`
);
runCLI(`generate @nx/js:lib libs/${lib} --bundler=tsc --no-interactive`);
// Add a dependency for this lib to check the built package.json
runCommand(`${pmc.addProd} react`);

View File

@ -25,7 +25,7 @@ describe('js e2e', () => {
it('should create libs with npm scripts', () => {
const npmScriptsLib = uniq('npmscriptslib');
runCLI(
`generate @nx/js:lib ${npmScriptsLib} --directory=libs/${npmScriptsLib} --config=npm-scripts --no-interactive`
`generate @nx/js:lib libs/${npmScriptsLib} --config=npm-scripts --no-interactive`
);
const libPackageJson = readJson(`libs/${npmScriptsLib}/package.json`);
expect(libPackageJson.scripts.test).toBeDefined();
@ -43,7 +43,7 @@ describe('js e2e', () => {
const dirName = uniq('dir');
runCLI(
`generate @nx/js:lib ${dirName}-${libName} --directory libs/${dirName}/${libName}`
`generate @nx/js:lib --name=${dirName}-${libName} --directory libs/${dirName}/${libName}`
);
checkFilesExist(
@ -67,9 +67,7 @@ describe('js e2e', () => {
it('should be able to add build to non-buildable projects', () => {
const nonBuildable = uniq('nonbuildable');
runCLI(
`generate @nx/js:lib ${nonBuildable} --directory=libs/${nonBuildable} --bundler=none`
);
runCLI(`generate @nx/js:lib libs/${nonBuildable} --bundler=none`);
expect(() => runCLI(`build ${nonBuildable}`)).toThrow();
checkFilesDoNotExist(`dist/libs/${nonBuildable}/src/index.js`);
@ -83,12 +81,8 @@ describe('js e2e', () => {
it('should build buildable libraries using the task graph and handle more scenarios than current implementation', () => {
const lib1 = uniq('lib1');
const lib2 = uniq('lib2');
runCLI(
`generate @nx/js:lib ${lib1} --directory=libs/${lib1} --bundler=tsc --no-interactive`
);
runCLI(
`generate @nx/js:lib ${lib2} --directory=libs/${lib2} --bundler=tsc --no-interactive`
);
runCLI(`generate @nx/js:lib libs/${lib1} --bundler=tsc --no-interactive`);
runCLI(`generate @nx/js:lib libs/${lib2} --bundler=tsc --no-interactive`);
// add dep between lib1 and lib2
updateFile(
@ -152,10 +146,10 @@ describe('js e2e', () => {
updateFile('nx.json', () => originalNxJson);
});
it('should generate project with name and directory as provided when --project-name-and-root-format=as-provided', async () => {
it('should generate project with name and directory as provided', async () => {
const lib1 = uniq('lib1');
runCLI(
`generate @nx/js:lib ${lib1} --directory=shared --bundler=tsc --project-name-and-root-format=as-provided`
`generate @nx/js:lib --name=${lib1} --directory=shared --bundler=tsc`
);
// check files are generated without the layout directory ("libs/") and
@ -172,12 +166,10 @@ describe('js e2e', () => {
);
}, 500_000);
it('should support generating with a scoped project name when --project-name-and-root-format=as-provided', async () => {
it('should support generating with a scoped project name', async () => {
const scopedLib = uniq('@my-org/lib1');
runCLI(
`generate @nx/js:lib ${scopedLib} --bundler=tsc --project-name-and-root-format=as-provided`
);
runCLI(`generate @nx/js:lib ${scopedLib} --bundler=tsc`);
// check files are generated without the layout directory ("libs/") and
// using the project name as the directory when no directory is provided

View File

@ -23,22 +23,22 @@ describe('inlining', () => {
async (bundler) => {
const parent = uniq('parent');
runCLI(
`generate @nx/js:lib ${parent} --directory=libs/${parent} --bundler=${bundler} --no-interactive`
`generate @nx/js:lib libs/${parent} --bundler=${bundler} --no-interactive`
);
const buildable = uniq('buildable');
runCLI(
`generate @nx/js:lib ${buildable} --directory=libs/${buildable} --bundler=${bundler} --no-interactive`
`generate @nx/js:lib libs/${buildable} --bundler=${bundler} --no-interactive`
);
const buildableTwo = uniq('buildabletwo');
runCLI(
`generate @nx/js:lib ${buildableTwo} --directory=libs/${buildableTwo} --bundler=${bundler} --no-interactive`
`generate @nx/js:lib libs/${buildableTwo} --bundler=${bundler} --no-interactive`
);
const nonBuildable = uniq('nonbuildable');
runCLI(
`generate @nx/js:lib ${nonBuildable} --directory=libs/${nonBuildable} --bundler=none --no-interactive`
`generate @nx/js:lib libs/${nonBuildable} --bundler=none --no-interactive`
);
updateFile(`libs/${parent}/src/lib/${parent}.ts`, () => {
@ -102,18 +102,14 @@ describe('inlining', () => {
it('should inline nesting libraries', async () => {
const parent = uniq('parent');
runCLI(
`generate @nx/js:lib ${parent} --directory=libs/${parent} --no-interactive`
);
runCLI(`generate @nx/js:lib libs/${parent} --no-interactive`);
const child = uniq('child');
runCLI(
`generate @nx/js:lib ${child} --directory=libs/${child} --bundler=none --no-interactive`
);
runCLI(`generate @nx/js:lib libs/${child} --bundler=none --no-interactive`);
const grandChild = uniq('grandchild');
runCLI(
`generate @nx/js:lib ${grandChild} --directory=libs/${grandChild} --bundler=none --no-interactive`
`generate @nx/js:lib libs/${grandChild} --bundler=none --no-interactive`
);
updateFile(`libs/${parent}/src/lib/${parent}.ts`, () => {

View File

@ -30,13 +30,13 @@ describe('packaging libs', () => {
const rollupLib = uniq('rolluplib');
runCLI(
`generate @nx/js:lib ${esbuildLib} --directory=libs/${esbuildLib} --bundler=esbuild --no-interactive`
`generate @nx/js:lib libs/${esbuildLib} --bundler=esbuild --no-interactive`
);
runCLI(
`generate @nx/js:lib ${viteLib} --directory=libs/${viteLib} --bundler=vite --no-interactive`
`generate @nx/js:lib libs/${viteLib} --bundler=vite --no-interactive`
);
runCLI(
`generate @nx/js:lib ${rollupLib} --directory=libs/${rollupLib} --bundler=rollup --no-interactive`
`generate @nx/js:lib libs/${rollupLib} --bundler=rollup --no-interactive`
);
updateFile(`libs/${rollupLib}/src/index.ts`, (content) => {
// Test that default functions work in ESM (Node).
@ -139,17 +139,15 @@ describe('packaging libs', () => {
const tscEsmLib = uniq('tscesmlib');
const swcEsmLib = uniq('swcesmlib');
runCLI(`generate @nx/js:lib libs/${tscLib} --bundler=tsc --no-interactive`);
runCLI(
`generate @nx/js:lib ${tscLib} --directory=libs/${tscLib} --bundler=tsc --no-interactive`
`generate @nx/js:lib libs/${swcLib} --bundler=swc --no-interactive`
);
runCLI(
`generate @nx/js:lib ${swcLib} --directory=libs/${swcLib} --bundler=swc --no-interactive`
`generate @nx/js:lib libs/${tscEsmLib} --bundler=tsc --no-interactive`
);
runCLI(
`generate @nx/js:lib ${tscEsmLib} --directory=libs/${tscEsmLib} --bundler=tsc --no-interactive`
);
runCLI(
`generate @nx/js:lib ${swcEsmLib} --directory=libs/${swcEsmLib} --bundler=swc --no-interactive`
`generate @nx/js:lib libs/${swcEsmLib} --bundler=swc --no-interactive`
);
// Change module format to ESM

View File

@ -118,7 +118,7 @@ function addBabelSupport(path: string) {
function createAppWithCt(appName: string) {
runCLI(
`generate @nx/next:app ${appName} --directory=apps/${appName} --no-interactive --appDir=false --src=false --projectNameAndRootFormat=as-provided`
`generate @nx/next:app apps/${appName} --no-interactive --appDir=false --src=false`
);
runCLI(
`generate @nx/next:component apps/${appName}/components/button --no-interactive`
@ -213,9 +213,7 @@ export default Button;
}
function createLibWithCtCypress(libName: string) {
runCLI(
`generate @nx/next:lib ${libName} --no-interactive --projectNameAndRootFormat=as-provided`
);
runCLI(`generate @nx/next:lib ${libName} --no-interactive`);
runCLI(
`generate @nx/next:cypress-component-configuration --project=${libName} --no-interactive`
@ -254,6 +252,7 @@ function createLibWithCtCypress(libName: string) {
`
);
}
function addTailwindToLib(libName: string) {
createFile(`libs/${libName}/src/lib/styles.css`, ``);
runCLI(

View File

@ -18,7 +18,7 @@ describe('Next Playwright e2e tests', () => {
packages: ['@nx/next'],
});
runCLI(
`generate @nx/next:app ${appName} --e2eTestRunner=playwright --projectNameAndRootFormat=as-provided --no-interactive`
`generate @nx/next:app ${appName} --e2eTestRunner=playwright --no-interactive`
);
});
@ -35,7 +35,7 @@ describe('Next Playwright e2e tests', () => {
it('should execute e2e tests using playwright with a library used in the app', () => {
runCLI(
`generate @nx/js:library ${usedInAppLibName} --unitTestRunner=none --importPath=@mylib --projectNameAndRootFormat=as-provided --no-interactive`
`generate @nx/js:library ${usedInAppLibName} --unitTestRunner=none --importPath=@mylib --no-interactive`
);
updateFile(

View File

@ -15,7 +15,7 @@ describe('Next.js Storybook', () => {
packages: ['@nx/next', '@nx/react'],
});
runCLI(
`generate @nx/next:app ${appName} --e2eTestRunner=none --project-name-and-root-format=as-provided --no-interactive`
`generate @nx/next:app ${appName} --e2eTestRunner=none --no-interactive`
);
runCLI(
`generate @nx/next:component ${appName}/components/foo/foo --no-interactive`

View File

@ -37,9 +37,7 @@ describe('Next.js Applications', () => {
const appName = uniq('app1');
const libName = uniq('@my-org/lib1');
runCLI(
`generate @nx/next:app ${appName} --project-name-and-root-format=as-provided --no-interactive`
);
runCLI(`generate @nx/next:app ${appName} --no-interactive`);
// check files are generated without the layout directory ("apps/") and
// using the project name as the directory when no directory is provided
@ -54,9 +52,7 @@ describe('Next.js Applications', () => {
`Successfully ran target test for project ${appName}`
);
runCLI(
`generate @nx/next:lib ${libName} --buildable --project-name-and-root-format=as-provided --no-interactive`
);
runCLI(`generate @nx/next:lib ${libName} --buildable --no-interactive`);
// check files are generated without the layout directory ("libs/") and
// using the project name as the directory when no directory is provided
@ -189,9 +185,7 @@ describe('Next.js Applications', () => {
it('should run e2e-ci test', async () => {
const appName = uniq('app');
runCLI(
`generate @nx/next:app ${appName} --no-interactive --style=css --project-name-and-root-format=as-provided`
);
runCLI(`generate @nx/next:app ${appName} --no-interactive --style=css`);
if (runE2ETests('cypress')) {
const e2eResults = runCLI(`e2e-ci ${appName}-e2e --verbose`, {

View File

@ -24,7 +24,7 @@ describe('Node Applications + esbuild', () => {
const app = uniq('nodeapp');
runCLI(
`generate @nx/node:app ${app} --bundler=esbuild --directory=apps/${app} --no-interactive`
`generate @nx/node:app apps/${app} --bundler=esbuild --no-interactive`
);
checkFilesDoNotExist(`apps/${app}/webpack.config.js`);

View File

@ -80,21 +80,19 @@ describe('Node Applications + webpack', () => {
const nestApp = uniq('nest');
beforeAll(() => {
runCLI(`generate @nx/node:lib ${testLib1} --directory=libs/${testLib1}`);
runCLI(`generate @nx/node:lib libs/${testLib1}`);
runCLI(`generate @nx/node:lib libs/${testLib2} --importPath=@acme/test2`);
runCLI(
`generate @nx/node:lib ${testLib2} --directory=libs/${testLib2} --importPath=@acme/test2`
`generate @nx/node:app apps/${expressApp} --framework=express --port=7000 --no-interactive`
);
runCLI(
`generate @nx/node:app ${expressApp} --directory=apps/${expressApp} --framework=express --port=7000 --no-interactive`
`generate @nx/node:app apps/${fastifyApp} --framework=fastify --port=7001 --no-interactive`
);
runCLI(
`generate @nx/node:app ${fastifyApp} --directory=apps/${fastifyApp} --framework=fastify --port=7001 --no-interactive`
`generate @nx/node:app apps/${koaApp} --framework=koa --port=7002 --no-interactive`
);
runCLI(
`generate @nx/node:app ${koaApp} --directory=apps/${koaApp} --framework=koa --port=7002 --no-interactive`
);
runCLI(
`generate @nx/node:app ${nestApp} --directory=apps/${nestApp} --framework=nest --port=7003 --bundler=webpack --no-interactive`
`generate @nx/node:app apps/${nestApp} --framework=nest --port=7003 --bundler=webpack --no-interactive`
);
addLibImport(expressApp, testLib1);
@ -167,7 +165,7 @@ describe('Node Applications + webpack', () => {
const expressApp = 'docker-express-app'; // needs to be consistent for the Dockerfile snapshot
runCLI(
`generate @nx/node:app ${expressApp} --framework=express --directory=apps/${expressApp} --docker --no-interactive`
`generate @nx/node:app apps/${expressApp} --framework=express --docker --no-interactive`
);
checkFilesExist(`apps/${expressApp}/Dockerfile`);
@ -181,10 +179,10 @@ describe('Node Applications + webpack', () => {
// Set ports to avoid conflicts with other tests that might run in parallel
runCLI(
`generate @nx/node:app ${nodeApp1} --directory=apps/${nodeApp1} --framework=none --no-interactive --port=4444`
`generate @nx/node:app apps/${nodeApp1} --framework=none --no-interactive --port=4444`
);
runCLI(
`generate @nx/node:app ${nodeApp2} --directory=apps/${nodeApp2} --framework=none --no-interactive --port=4445`
`generate @nx/node:app apps/${nodeApp2} --framework=none --no-interactive --port=4445`
);
updateJson(join('apps', nodeApp1, 'project.json'), (config) => {
config.targets.serve.options.waitUntilTargets = [`${nodeApp2}:build`];

View File

@ -30,7 +30,7 @@ describe('Node Applications + webpack', () => {
// This fails with Crystal enabled because `--optimization` is not a correct flag to pass to `webpack`.
runCLI(
`generate @nx/node:app ${app} --directory=apps/${app} --bundler=webpack --no-interactive`,
`generate @nx/node:app apps/${app} --bundler=webpack --no-interactive`,
{
env: { NX_ADD_PLUGINS: 'false' },
}
@ -66,7 +66,7 @@ describe('Node Applications + webpack', () => {
// Test that serve can re-run dependency builds.
const lib = uniq('nodelib');
runCLI(
`generate @nx/js:lib ${lib} --bundler=esbuild --directory=libs/${lib} --no-interactive`
`generate @nx/js:lib libs/${lib} --bundler=esbuild --no-interactive`
);
updateJson(join('apps', app, 'project.json'), (config) => {

View File

@ -72,7 +72,7 @@ describe('Node Applications', () => {
const port = getRandomPort();
process.env.PORT = `${port}`;
runCLI(
`generate @nx/node:app ${nodeapp} --port=${port} --directory=apps/${nodeapp} --linter=eslint`
`generate @nx/node:app apps/${nodeapp} --port=${port} --linter=eslint`
);
const lintResults = runCLI(`lint ${nodeapp}`);
@ -92,9 +92,7 @@ describe('Node Applications', () => {
// TODO(crystal, @ndcunningham): This does not work because NxWebpackPlugin({}) outputFilename does not work.
xit('should be able to generate the correct outputFileName in options', async () => {
const nodeapp = uniq('nodeapp');
runCLI(
`generate @nx/node:app ${nodeapp} --directory=apps/${nodeapp} --linter=eslint`
);
runCLI(`generate @nx/node:app apps/${nodeapp} --linter=eslint`);
updateJson(join('apps', nodeapp, 'project.json'), (config) => {
config.targets.build.options.outputFileName = 'index.js';
@ -110,7 +108,7 @@ describe('Node Applications', () => {
const port = getRandomPort();
process.env.PORT = `${port}`;
runCLI(
`generate @nx/node:app ${nodeapp} --directory=apps/${nodeapp} --port=${port} --linter=eslint --bundler=webpack`
`generate @nx/node:app apps/${nodeapp} --port=${port} --linter=eslint --bundler=webpack`
);
const lintResults = runCLI(`lint ${nodeapp}`);
@ -192,7 +190,7 @@ module.exports = {
const nodeapp = uniq('nodeapp');
runCLI(
`generate @nx/node:app ${nodeapp} --directory=apps/${nodeapp} --linter=eslint --bundler=webpack --framework=none`
`generate @nx/node:app apps/${nodeapp} --linter=eslint --bundler=webpack --framework=none`
);
updateFile('.env', `NX_FOOBAR="test foo bar"`);
@ -229,9 +227,7 @@ module.exports = {
it("should exclude 'test' target from e2e project that uses jest", async () => {
const appName = uniq('nodeapp');
runCLI(
`generate @nx/node:app ${appName} --project-name-and-root-format=as-provided --no-interactive`
);
runCLI(`generate @nx/node:app ${appName} --no-interactive`);
const nxJson = JSON.parse(readFile('nx.json'));
expect(nxJson.plugins).toBeDefined();
@ -250,7 +246,7 @@ module.exports = {
process.env.PORT = `${port}`;
runCLI(
`generate @nx/express:app ${nodeapp} --directory=apps/${nodeapp} --port=${port} --linter=eslint`
`generate @nx/express:app apps/${nodeapp} --port=${port} --linter=eslint`
);
const lintResults = runCLI(`lint ${nodeapp}`);
@ -300,9 +296,7 @@ module.exports = {
it('should be able to generate a nest application', async () => {
const nestapp = uniq('nestapp');
const port = 3335;
runCLI(
`generate @nx/nest:app ${nestapp} --directory=apps/${nestapp} --linter=eslint`
);
runCLI(`generate @nx/nest:app apps/${nestapp} --linter=eslint`);
const lintResults = runCLI(`lint ${nestapp}`);
expect(lintResults).toContain('Successfully ran target lint');
@ -350,7 +344,7 @@ module.exports = {
const nestapp = 'node-nest-docker-test';
runCLI(
`generate @nx/node:app ${nestapp} --project-name-and-root-format=as-provided --bundler=webpack --framework=nest --docker`
`generate @nx/node:app ${nestapp} --bundler=webpack --framework=nest --docker`
);
checkFilesExist(`${nestapp}/Dockerfile`);
@ -430,9 +424,7 @@ describe('Build Node apps', () => {
xit('should generate a package.json with the `--generatePackageJson` flag', async () => {
const packageManager = detectPackageManager(tmpProjPath());
const nestapp = uniq('nestapp');
runCLI(
`generate @nx/nest:app ${nestapp} --linter=eslint --directory=apps/${nestapp}`
);
runCLI(`generate @nx/nest:app apps/${nestapp} --linter=eslint`);
await runCLIAsync(`build ${nestapp} --generatePackageJson`);
@ -537,7 +529,7 @@ ${jslib}();
process.env.PORT = `${port}`;
runCLI(
`generate @nx/node:app ${appName} --port=${port} --no-interactive --directory=apps/${appName}`
`generate @nx/node:app apps/${appName} --port=${port} --no-interactive`
);
// deleteOutputPath should default to true
@ -577,9 +569,7 @@ ${jslib}();
const port = getRandomPort();
process.env.PORT = `${port}`;
runCLI(
`generate @nx/node:app ${appName} --project-name-and-root-format=as-provided --port=${port} --no-interactive`
);
runCLI(`generate @nx/node:app ${appName} --port=${port} --no-interactive`);
// check files are generated without the layout directory ("apps/") and
// using the project name as the directory when no directory is provided
@ -594,9 +584,7 @@ ${jslib}();
`Successfully ran target test for project ${appName}`
);
runCLI(
`generate @nx/node:lib ${libName} --buildable --project-name-and-root-format=as-provided --no-interactive`
);
runCLI(`generate @nx/node:lib ${libName} --buildable --no-interactive`);
// check files are generated without the layout directory ("libs/") and
// using the project name as the directory when no directory is provided
@ -671,7 +659,7 @@ ${jslib}();
describe('nest libraries', function () {
it('should be able to generate a nest library', async () => {
const nestlib = uniq('nestlib');
runCLI(`generate @nx/nest:lib ${nestlib} --directory=libs/${nestlib}`);
runCLI(`generate @nx/nest:lib libs/${nestlib}`);
const lintResults = runCLI(`lint ${nestlib}`);
expect(lintResults).toContain('Successfully ran target lint');
@ -726,9 +714,7 @@ ${jslib}();
it('should have plugin output if specified in `transformers`', async () => {
const nestlib = uniq('nestlib');
runCLI(
`generate @nx/nest:lib ${nestlib} --buildable --directory=libs/${nestlib}`
);
runCLI(`generate @nx/nest:lib libs/${nestlib} --buildable`);
packageInstall('@nestjs/swagger', undefined, '^7.0.0');

View File

@ -14,10 +14,9 @@ describe('Nuxt Plugin', () => {
beforeAll(() => {
newProject({
packages: ['@nx/nuxt'],
unsetProjectNameAndRootFormat: false,
});
runCLI(
`generate @nx/nuxt:app ${app} --unitTestRunner=vitest --projectNameAndRootFormat=as-provided --e2eTestRunner=cypress`
`generate @nx/nuxt:app ${app} --unitTestRunner=vitest --e2eTestRunner=cypress`
);
runCLI(
`generate @nx/nuxt:component ${app}/src/components/one/one --name=one --unitTestRunner=vitest`

View File

@ -31,12 +31,12 @@ describe('Nx Affected and Graph Tests', () => {
const mylib = uniq('mylib');
const mylib2 = uniq('mylib2');
const mypublishablelib = uniq('mypublishablelib');
runCLI(`generate @nx/web:app ${myapp} --directory apps/${myapp}`);
runCLI(`generate @nx/web:app ${myapp2} --directory apps/${myapp2}`);
runCLI(`generate @nx/js:lib ${mylib} --directory libs/${mylib}`);
runCLI(`generate @nx/js:lib ${mylib2} --directory libs/${mylib2}`);
runCLI(`generate @nx/web:app apps/${myapp}`);
runCLI(`generate @nx/web:app apps/${myapp2}`);
runCLI(`generate @nx/js:lib libs/${mylib}`);
runCLI(`generate @nx/js:lib libs/${mylib2}`);
runCLI(
`generate @nx/js:lib ${mypublishablelib} --directory libs/${mypublishablelib} --publishable --importPath=@${proj}/${mypublishablelib} --tags=ui`
`generate @nx/js:lib libs/${mypublishablelib} --publishable --importPath=@${proj}/${mypublishablelib} --tags=ui`
);
updateFile(
@ -193,26 +193,26 @@ describe('Nx Affected and Graph Tests', () => {
});
function generateAll() {
runCLI(`generate @nx/web:app ${myapp} --directory=apps/${myapp}`);
runCLI(`generate @nx/web:app ${myapp2} --directory=apps/${myapp2}`);
runCLI(`generate @nx/js:lib ${mylib} --directory=libs/${mylib}`);
runCLI(`generate @nx/web:app apps/${myapp}`);
runCLI(`generate @nx/web:app apps/${myapp2}`);
runCLI(`generate @nx/js:lib libs/${mylib}`);
runCommand(`git add . && git commit -am "add all"`);
}
it('should not affect other projects by generating a new project', () => {
// TODO: investigate why affected gives different results on windows
if (isNotWindows()) {
runCLI(`generate @nx/web:app ${myapp} --directory=apps/${myapp}`);
runCLI(`generate @nx/web:app apps/${myapp}`);
expect(runCLI('show projects --affected')).toContain(myapp);
runCommand(`git add . && git commit -am "add ${myapp}"`);
runCLI(`generate @nx/web:app ${myapp2} --directory=apps/${myapp2}`);
runCLI(`generate @nx/web:app apps/${myapp2}`);
let output = runCLI('show projects --affected');
expect(output).not.toContain(myapp);
expect(output).toContain(myapp2);
runCommand(`git add . && git commit -am "add ${myapp2}"`);
runCLI(`generate @nx/js:lib ${mylib} --directory=libs/${mylib}`);
runCLI(`generate @nx/js:lib libs/${mylib}`);
output = runCLI('show projects --affected');
expect(output).not.toContain(myapp);
expect(output).not.toContain(myapp2);

View File

@ -248,9 +248,9 @@ describe('cache', () => {
const parent = uniq('parent');
const child1 = uniq('child1');
const child2 = uniq('child2');
runCLI(`generate @nx/js:lib ${parent} --directory=libs/${parent}`);
runCLI(`generate @nx/js:lib ${child1} --directory=libs/${child1}`);
runCLI(`generate @nx/js:lib ${child2} --directory=libs/${child2}`);
runCLI(`generate @nx/js:lib libs/${parent}`);
runCLI(`generate @nx/js:lib libs/${child1}`);
runCLI(`generate @nx/js:lib libs/${child2}`);
updateJson(`nx.json`, (c) => {
c.namedInputs = {
default: ['{projectRoot}/**/*'],
@ -315,7 +315,7 @@ describe('cache', () => {
it('should support ENV as an input', () => {
const lib = uniq('lib');
runCLI(`generate @nx/js:lib ${lib} --directory=libs/${lib}`);
runCLI(`generate @nx/js:lib libs/${lib}`);
updateJson(`nx.json`, (c) => {
c.targetDefaults = {
echo: {

View File

@ -20,7 +20,7 @@ describe('Extra Nx Misc Tests', () => {
describe('Output Style', () => {
it('should stream output', async () => {
const myapp = 'abcdefghijklmon';
runCLI(`generate @nx/web:app ${myapp} --directory=apps/${myapp}`);
runCLI(`generate @nx/web:app apps/${myapp}`);
updateJson(join('apps', myapp, 'project.json'), (c) => {
c.targets['inner'] = {
@ -103,7 +103,7 @@ describe('Extra Nx Misc Tests', () => {
describe('Run Commands', () => {
const mylib = uniq('lib');
beforeAll(() => {
runCLI(`generate @nx/js:lib ${mylib} --directory=libs/${mylib}`);
runCLI(`generate @nx/js:lib libs/${mylib}`);
});
it('should not override environment variables already set when setting a custom env file path', async () => {
@ -249,7 +249,7 @@ describe('Extra Nx Misc Tests', () => {
const folder = `dist/libs/${mylib}/some-folder`;
runCLI(`generate @nx/js:lib ${mylib} --directory=libs/${mylib}`);
runCLI(`generate @nx/js:lib libs/${mylib}`);
runCLI(
`generate @nx/workspace:run-commands build --command=echo --outputs=${folder}/ --project=${mylib}`
@ -296,7 +296,7 @@ describe('Extra Nx Misc Tests', () => {
beforeAll(() => {
runCLI(
`generate @nx/js:lib ${libName} --directory=libs/${libName} --bundler=none --unitTestRunner=none --no-interactive`
`generate @nx/js:lib libs/${libName} --bundler=none --unitTestRunner=none --no-interactive`
);
});
@ -366,7 +366,7 @@ NX_USERNAME=$FIRSTNAME $LASTNAME`
const baseLib = 'lib-base-123';
beforeAll(() => {
runCLI(`generate @nx/js:lib ${baseLib} --directory=libs/${baseLib}`);
runCLI(`generate @nx/js:lib libs/${baseLib}`);
});
it('should correctly expand default task inputs', () => {
@ -387,9 +387,7 @@ NX_USERNAME=$FIRSTNAME $LASTNAME`
it('should correctly expand dependent task inputs', () => {
const dependentLib = 'lib-dependent-123';
runCLI(
`generate @nx/js:lib ${dependentLib} --directory=libs/${dependentLib}`
);
runCLI(`generate @nx/js:lib libs/${dependentLib}`);
updateJson(join('libs', baseLib, 'project.json'), (config) => {
config.targets['build'].inputs = ['default', '^default'];

View File

@ -19,7 +19,6 @@ describe('Nx Import', () => {
beforeAll(() => {
proj = newProject({
packages: ['@nx/js'],
unsetProjectNameAndRootFormat: false,
});
if (getSelectedPackageManager() === 'pnpm') {

View File

@ -16,7 +16,7 @@ describe('Invoke Runner', () => {
it('should invoke runner imperatively ', async () => {
const mylib = uniq('mylib');
runCLI(`generate @nx/js:lib ${mylib} --directory=libs/${mylib}`);
runCLI(`generate @nx/js:lib libs/${mylib}`);
updateJson(join('libs', mylib, 'project.json'), (c) => {
c.targets['prebuild'] = {
command: 'echo prebuild',

View File

@ -43,10 +43,8 @@ describe('Nx Commands', () => {
runCLI('show projects').replace(/.*nx show projects( --verbose)?\n/, '')
).toEqual('');
runCLI(
`generate @nx/web:app ${app1} --tags e2etag --directory=apps/${app1}`
);
runCLI(`generate @nx/web:app ${app2} --directory=apps/${app2}`);
runCLI(`generate @nx/web:app apps/${app1} --tags e2etag`);
runCLI(`generate @nx/web:app apps/${app2}`);
const s = runCLI('show projects').split('\n');
@ -70,7 +68,7 @@ describe('Nx Commands', () => {
it('should show detailed project info', () => {
const app = uniq('myapp');
runCLI(`generate @nx/web:app ${app} --directory=apps/${app}`);
runCLI(`generate @nx/web:app apps/${app}`);
const project: ProjectConfiguration = JSON.parse(
runCLI(`show project ${app}`)
);
@ -80,7 +78,7 @@ describe('Nx Commands', () => {
it('should open project details view', async () => {
const app = uniq('myapp');
runCLI(`generate @nx/web:app ${app} --directory=apps/${app}`);
runCLI(`generate @nx/web:app apps/${app}`);
let url: string;
let port: number;
const child_process = await runCommandUntil(
@ -182,8 +180,8 @@ describe('Nx Commands', () => {
const mylib = uniq('mylib');
beforeAll(async () => {
runCLI(`generate @nx/web:app ${myapp} --directory=apps/${myapp}`);
runCLI(`generate @nx/js:lib ${mylib} --directory=libs/${mylib}`);
runCLI(`generate @nx/web:app apps/${myapp}`);
runCLI(`generate @nx/js:lib libs/${mylib}`);
});
beforeEach(() => {

View File

@ -3,7 +3,6 @@ import { cleanupProject, newProject, runCLI } from '@nx/e2e/utils';
describe('Nx Cloud', () => {
beforeAll(() =>
newProject({
unsetProjectNameAndRootFormat: false,
packages: ['@nx/js'],
})
);

View File

@ -37,7 +37,7 @@ describe('Nx Running Tests', () => {
describe('(forwarding params)', () => {
let proj = uniq('proj');
beforeAll(() => {
runCLI(`generate @nx/js:lib ${proj} --directory=libs/${proj}`);
runCLI(`generate @nx/js:lib libs/${proj}`);
updateJson(`libs/${proj}/project.json`, (c) => {
c.targets['echo'] = {
command: 'echo ECHO:',
@ -107,7 +107,7 @@ describe('Nx Running Tests', () => {
it('should execute long running tasks', () => {
const myapp = uniq('myapp');
runCLI(`generate @nx/web:app ${myapp} --directory=apps/${myapp}`);
runCLI(`generate @nx/web:app apps/${myapp}`);
updateJson(`apps/${myapp}/project.json`, (c) => {
c.targets['counter'] = {
executor: '@nx/workspace:counter',
@ -127,7 +127,7 @@ describe('Nx Running Tests', () => {
it('should run npm scripts', async () => {
const mylib = uniq('mylib');
runCLI(`generate @nx/node:lib ${mylib} --directory=libs/${mylib}`);
runCLI(`generate @nx/node:lib libs/${mylib}`);
// Used to restore targets to lib after test
const original = readJson(`libs/${mylib}/project.json`);
@ -172,7 +172,7 @@ describe('Nx Running Tests', () => {
beforeAll(async () => {
app = uniq('myapp');
runCLI(`generate @nx/web:app ${app} --directory=apps/${app}`);
runCLI(`generate @nx/web:app apps/${app}`);
});
it('should support using {projectRoot} in options blocks in project.json', async () => {
@ -236,7 +236,7 @@ describe('Nx Running Tests', () => {
it('should pass env option to nx:run-commands executor', () => {
const mylib = uniq('mylib');
runCLI(`generate @nx/js:lib ${mylib} --directory=libs/${mylib}`);
runCLI(`generate @nx/js:lib libs/${mylib}`);
updateJson(`libs/${mylib}/project.json`, (c) => {
c.targets['echo'] = {
@ -257,7 +257,7 @@ describe('Nx Running Tests', () => {
it('should not run dependencies if --no-dependencies is passed', () => {
const mylib = uniq('mylib');
runCLI(`generate @nx/js:lib ${mylib} --directory=libs/${mylib}`);
runCLI(`generate @nx/js:lib libs/${mylib}`);
updateJson(`libs/${mylib}/project.json`, (c) => {
c.targets['one'] = {
@ -294,8 +294,8 @@ describe('Nx Running Tests', () => {
it('should stop executing all tasks when one of the tasks fails', async () => {
const myapp1 = uniq('a');
const myapp2 = uniq('b');
runCLI(`generate @nx/web:app ${myapp1} --directory=apps/${myapp1}`);
runCLI(`generate @nx/web:app ${myapp2} --directory=apps/${myapp2}`);
runCLI(`generate @nx/web:app apps/${myapp1}`);
runCLI(`generate @nx/web:app apps/${myapp2}`);
updateJson(`apps/${myapp1}/project.json`, (c) => {
c.targets['error'] = {
command: 'echo boom1 && exit 1',
@ -343,14 +343,14 @@ describe('Nx Running Tests', () => {
describe('run-one', () => {
it('should build a specific project', () => {
const myapp = uniq('app');
runCLI(`generate @nx/web:app ${myapp} --directory=apps/${myapp}`);
runCLI(`generate @nx/web:app apps/${myapp}`);
runCLI(`build ${myapp}`);
}, 10000);
it('should support project name positional arg non-consecutive to target', () => {
const myapp = uniq('app');
runCLI(`generate @nx/web:app ${myapp} --directory=apps/${myapp}`);
runCLI(`generate @nx/web:app apps/${myapp}`);
runCLI(`build --verbose ${myapp}`);
}, 10000);
@ -361,7 +361,7 @@ describe('Nx Running Tests', () => {
const expectedOutput = uniq('myEchoedString');
const expectedEnvOutput = uniq('myEnvString');
runCLI(`generate @nx/web:app ${myapp} --directory=apps/${myapp}`);
runCLI(`generate @nx/web:app apps/${myapp}`);
updateFile(
`apps/${myapp}/package.json`,
JSON.stringify({

View File

@ -31,9 +31,9 @@ describe('Nx Watch', () => {
let proj3 = uniq('proj3');
beforeAll(() => {
newProject({ packages: ['@nx/js'] });
runCLI(`generate @nx/js:lib ${proj1} --directory=libs/${proj1}`);
runCLI(`generate @nx/js:lib ${proj2} --directory=libs/${proj2}`);
runCLI(`generate @nx/js:lib ${proj3} --directory=libs/${proj3}`);
runCLI(`generate @nx/js:lib libs/${proj1}`);
runCLI(`generate @nx/js:lib libs/${proj2}`);
runCLI(`generate @nx/js:lib libs/${proj3}`);
runCLI('daemon --start', {
env: {
NX_DAEMON: 'true',

View File

@ -19,7 +19,7 @@ describe('@nx/workspace:convert-to-monorepo', () => {
it('should convert a standalone webpack and jest react project to a monorepo (legacy)', async () => {
const reactApp = uniq('reactapp');
runCLI(
`generate @nx/react:app ${reactApp} --rootProject=true --bundler=webpack --unitTestRunner=jest --e2eTestRunner=cypress --no-interactive`,
`generate @nx/react:app --name=${reactApp} --directory="." --bundler=webpack --unitTestRunner=jest --e2eTestRunner=cypress --no-interactive`,
{
env: {
NX_ADD_PLUGINS: 'false',

View File

@ -32,7 +32,7 @@ describe('@nx/workspace:infer-targets', () => {
// default case, everything is generated with crystal, everything should be skipped
const remixApp = uniq('remix');
runCLI(
`generate @nx/remix:app ${remixApp} --dir apps/${remixApp} --unitTestRunner jest --e2eTestRunner=playwright --projectNameAndDirectoryFormat=as-provided --no-interactive`
`generate @nx/remix:app apps/${remixApp} --unitTestRunner jest --e2eTestRunner=playwright --projectNameAndDirectoryFormat=as-provided --no-interactive`
);
const output = runCLI(`generate infer-targets --no-interactive`);
@ -70,7 +70,7 @@ describe('@nx/workspace:infer-targets', () => {
// default case, everything is generated with crystal, relevant plugins should be skipped
const remixApp = uniq('remix');
runCLI(
`generate @nx/remix:app ${remixApp} --dir apps/${remixApp} --unitTestRunner jest --e2eTestRunner=playwright --projectNameAndDirectoryFormat=as-provided --no-interactive`
`generate @nx/remix:app apps/${remixApp} --unitTestRunner jest --e2eTestRunner=playwright --projectNameAndDirectoryFormat=as-provided --no-interactive`
);
const output = runCLI(
@ -116,7 +116,7 @@ describe('@nx/workspace:infer-targets', () => {
// even if we make sure there are executors for remix & remix-e2e, only remix conversions will run with --project option
const remixApp = uniq('remix');
runCLI(
`generate @nx/remix:app ${remixApp} --dir apps/${remixApp} --unitTestRunner jest --e2eTestRunner=playwright --projectNameAndDirectoryFormat=as-provided --no-interactive`
`generate @nx/remix:app apps/${remixApp} --unitTestRunner jest --e2eTestRunner=playwright --projectNameAndDirectoryFormat=as-provided --no-interactive`
);
updateJson('nx.json', (json) => {
@ -167,7 +167,7 @@ describe('@nx/workspace:convert-to-monorepo', () => {
it('should be convert a standalone vite and playwright react project to a monorepo', async () => {
const reactApp = uniq('reactapp');
runCLI(
`generate @nx/react:app ${reactApp} --rootProject=true --bundler=vite --unitTestRunner vitest --e2eTestRunner=playwright --no-interactive`
`generate @nx/react:app --name=${reactApp} --directory="." --rootProject=true --bundler=vite --unitTestRunner vitest --e2eTestRunner=playwright --no-interactive`
);
runCLI('generate @nx/workspace:convert-to-monorepo --no-interactive');
@ -226,7 +226,7 @@ describe('Workspace Tests', () => {
const lib2 = uniq('mylib');
const lib3 = uniq('mylib');
runCLI(
`generate @nx/js:lib ${lib1}-data-access --directory=${lib1}/data-access --unitTestRunner=jest --project-name-and-root-format=as-provided`
`generate @nx/js:lib --name=${lib1}-data-access --directory=${lib1}/data-access --unitTestRunner=jest`
);
updateFile(
@ -244,7 +244,7 @@ describe('Workspace Tests', () => {
*/
runCLI(
`generate @nx/js:lib ${lib2}-ui --directory=${lib2}/ui --unitTestRunner=jest --project-name-and-root-format=as-provided`
`generate @nx/js:lib --name=${lib2}-ui --directory=${lib2}/ui --unitTestRunner=jest`
);
updateFile(
@ -258,9 +258,7 @@ describe('Workspace Tests', () => {
* Create a library which has an implicit dependency on lib1
*/
runCLI(
`generate @nx/js:lib ${lib3} --unitTestRunner=jest --project-name-and-root-format=as-provided`
);
runCLI(`generate @nx/js:lib ${lib3} --unitTestRunner=jest`);
updateFile(join(lib3, 'project.json'), (content) => {
const data = JSON.parse(content);
data.implicitDependencies = [`${lib1}-data-access`];
@ -272,7 +270,7 @@ describe('Workspace Tests', () => {
*/
const moveOutput = runCLI(
`generate @nx/workspace:move --project ${lib1}-data-access shared/${lib1}/data-access --newProjectName=shared-${lib1}-data-access --project-name-and-root-format=as-provided`
`generate @nx/workspace:move --project ${lib1}-data-access shared/${lib1}/data-access --newProjectName=shared-${lib1}-data-access`
);
expect(moveOutput).toContain(`DELETE ${lib1}/data-access`);
@ -365,7 +363,7 @@ describe('Workspace Tests', () => {
const lib2 = uniq('mylib');
const lib3 = uniq('mylib');
runCLI(
`generate @nx/js:lib ${lib1}-data-access --directory=${lib1}/data-access --importPath=${importPath} --unitTestRunner=jest --project-name-and-root-format=as-provided`
`generate @nx/js:lib --name=${lib1}-data-access --directory=${lib1}/data-access --importPath=${importPath} --unitTestRunner=jest`
);
updateFile(
@ -383,7 +381,7 @@ describe('Workspace Tests', () => {
*/
runCLI(
`generate @nx/js:lib ${lib2}-ui --directory=${lib2}/ui --unitTestRunner=jest --project-name-and-root-format=as-provided`
`generate @nx/js:lib --name=${lib2}-ui --directory=${lib2}/ui --unitTestRunner=jest`
);
updateFile(
@ -397,9 +395,7 @@ describe('Workspace Tests', () => {
* Create a library which has an implicit dependency on lib1
*/
runCLI(
`generate @nx/js:lib ${lib3} --unitTestRunner=jest --project-name-and-root-format=as-provided`
);
runCLI(`generate @nx/js:lib ${lib3} --unitTestRunner=jest`);
updateFile(join(lib3, 'project.json'), (content) => {
const data = JSON.parse(content);
data.implicitDependencies = [`${lib1}-data-access`];
@ -411,7 +407,7 @@ describe('Workspace Tests', () => {
*/
const moveOutput = runCLI(
`generate @nx/workspace:move --project ${lib1}-data-access shared/${lib1}/data-access --newProjectName=shared-${lib1}-data-access --project-name-and-root-format=as-provided`
`generate @nx/workspace:move --project ${lib1}-data-access shared/${lib1}/data-access --newProjectName=shared-${lib1}-data-access`
);
expect(moveOutput).toContain(`DELETE ${lib1}/data-access`);
@ -494,9 +490,7 @@ describe('Workspace Tests', () => {
const lib1 = uniq('lib1');
const lib2 = uniq('lib2');
const lib3 = uniq('lib3');
runCLI(
`generate @nx/js:lib ${lib1} --unitTestRunner=jest --project-name-and-root-format=as-provided`
);
runCLI(`generate @nx/js:lib ${lib1} --unitTestRunner=jest`);
updateFile(
`${lib1}/src/lib/${lib1}.ts`,
@ -510,7 +504,7 @@ describe('Workspace Tests', () => {
*/
runCLI(
`generate @nx/js:lib ${lib2}-ui --directory=${lib2}/ui --unitTestRunner=jest --project-name-and-root-format=as-provided`
`generate @nx/js:lib --name=${lib2}-ui --directory=${lib2}/ui --unitTestRunner=jest`
);
updateFile(
@ -524,9 +518,7 @@ describe('Workspace Tests', () => {
* Create a library which has an implicit dependency on lib1
*/
runCLI(
`generate @nx/js:lib ${lib3} --unitTestRunner=jest --project-name-and-root-format=as-provided`
);
runCLI(`generate @nx/js:lib ${lib3} --unitTestRunner=jest`);
updateFile(join(lib3, 'project.json'), (content) => {
const data = JSON.parse(content);
data.implicitDependencies = [lib1];
@ -538,7 +530,7 @@ describe('Workspace Tests', () => {
*/
const moveOutput = runCLI(
`generate @nx/workspace:move --project ${lib1} ${lib1}/data-access --newProjectName=${lib1}-data-access --project-name-and-root-format=as-provided`
`generate @nx/workspace:move --project ${lib1} ${lib1}/data-access --newProjectName=${lib1}-data-access`
);
expect(moveOutput).toContain(`DELETE ${lib1}/project.json`);
@ -626,7 +618,7 @@ describe('Workspace Tests', () => {
const lib2 = uniq('mylib');
const lib3 = uniq('mylib');
runCLI(
`generate @nx/js:lib ${lib1}-data-access --directory=${lib1}/data-access --unitTestRunner=jest --project-name-and-root-format=as-provided`
`generate @nx/js:lib --name=${lib1}-data-access --directory=${lib1}/data-access --unitTestRunner=jest`
);
let rootTsConfig = readJson('tsconfig.base.json');
expect(
@ -651,7 +643,7 @@ describe('Workspace Tests', () => {
*/
runCLI(
`generate @nx/js:lib ${lib2}-ui --directory=${lib2}/ui --unitTestRunner=jest --project-name-and-root-format=as-provided`
`generate @nx/js:lib --name${lib2}-ui --directory=${lib2}/ui --unitTestRunner=jest`
);
updateFile(
@ -665,9 +657,7 @@ describe('Workspace Tests', () => {
* Create a library which has an implicit dependency on lib1
*/
runCLI(
`generate @nx/js:lib ${lib3} --unitTestRunner=jest --project-name-and-root-format=as-provided`
);
runCLI(`generate @nx/js:lib ${lib3} --unitTestRunner=jest`);
updateFile(join(lib3, 'project.json'), (content) => {
const data = JSON.parse(content);
data.implicitDependencies = [`${lib1}-data-access`];
@ -679,7 +669,7 @@ describe('Workspace Tests', () => {
*/
const moveOutput = runCLI(
`generate @nx/workspace:move --project ${lib1}-data-access shared/${lib1}/data-access --newProjectName=shared-${lib1}-data-access --project-name-and-root-format=as-provided`
`generate @nx/workspace:move --project ${lib1}-data-access shared/${lib1}/data-access --newProjectName=shared-${lib1}-data-access`
);
expect(moveOutput).toContain(`DELETE ${lib1}/data-access`);
@ -752,9 +742,7 @@ describe('Workspace Tests', () => {
* Create a library which has an implicit dependency on lib1
*/
runCLI(
`generate @nx/js:lib ${lib2} --directory=libs/${lib2} --unitTestRunner=jest`
);
runCLI(`generate @nx/js:lib libs/${lib2} --unitTestRunner=jest`);
updateFile(join('libs', lib2, 'project.json'), (content) => {
const data = JSON.parse(content);
data.implicitDependencies = [lib1];

View File

@ -76,7 +76,6 @@ describe('Playwright E2E Test Runner - legacy', () => {
env = process.env.NX_ADD_PLUGINS;
newProject({
name: uniq('playwright'),
unsetProjectNameAndRootFormat: false,
});
process.env.NX_ADD_PLUGINS = 'false';
});
@ -98,7 +97,7 @@ describe('Playwright E2E Test Runner - legacy', () => {
const pmc = getPackageManagerCommand();
runCLI(
`g @nx/web:app demo-e2e --directory apps/demo-e2e --unitTestRunner=none --bundler=vite --e2eTestRunner=none --style=css --no-interactive --projectNameAndRootFormat=as-provided`
`g @nx/web:app demo-e2e --directory apps/demo-e2e --unitTestRunner=none --bundler=vite --e2eTestRunner=none --style=css --no-interactive`
);
runCLI(
`g @nx/playwright:configuration --project demo-e2e --webServerCommand="${pmc.runNx} serve demo-e2e" --webServerAddress="http://localhost:4200"`
@ -121,7 +120,7 @@ describe('Playwright E2E Test Runner - legacy', () => {
const pmc = getPackageManagerCommand();
runCLI(
`g @nx/web:app demo-js-e2e --directory apps/demo-js-e2e --unitTestRunner=none --bundler=vite --e2eTestRunner=none --style=css --no-interactive --projectNameAndRootFormat=as-provided`
`g @nx/web:app demo-js-e2e --directory apps/demo-js-e2e --unitTestRunner=none --bundler=vite --e2eTestRunner=none --style=css --no-interactive`
);
runCLI(
`g @nx/playwright:configuration --project demo-js-e2e --js --webServerCommand="${pmc.runNx} serve demo-e2e" --webServerAddress="http://localhost:4200"`

View File

@ -407,7 +407,7 @@ describe('Nx Plugin', () => {
it('should create a plugin in the specified directory', async () => {
const plugin = uniq('plugin');
runCLI(
`generate @nx/plugin:plugin ${plugin} --linter=eslint --directory libs/subdir/${plugin} --e2eTestRunner=jest`
`generate @nx/plugin:plugin libs/subdir/${plugin} --linter=eslint --e2eTestRunner=jest`
);
checkFilesExist(`libs/subdir/${plugin}/package.json`);
const pluginProject = readJson(
@ -438,7 +438,7 @@ describe('Nx Plugin', () => {
`generate @nx/plugin:plugin ${plugin} --e2eTestRunner jest --publishable`
);
runCLI(
`generate @nx/plugin:create-package ${createAppName} --project=${plugin}`
`generate @nx/plugin:create-package ${createAppName} --name=${createAppName} --project=${plugin} --verbose`
);
const buildResults = runCLI(`build ${createAppName}`);
@ -458,7 +458,7 @@ describe('Nx Plugin', () => {
`generate @nx/plugin:plugin ${plugin} --e2eTestRunner jest --publishable`
);
runCLI(
`generate @nx/plugin:create-package ${createAppName} --project=${plugin} --e2eProject=${plugin}-e2e`
`generate @nx/plugin:create-package ${createAppName} --name=${createAppName} --project=${plugin} --e2eProject=${plugin}-e2e --verbose`
);
const buildResults = runCLI(`build ${createAppName}`);
@ -477,7 +477,7 @@ describe('Nx Plugin', () => {
const plugin = uniq('plugin');
expect(() =>
runCLI(
`generate @nx/plugin:create-package create-${plugin} --project=invalid-plugin`
`generate @nx/plugin:create-package create-${plugin} --name=create-${plugin} --project=invalid-plugin`
)
).toThrow();
});
@ -487,7 +487,7 @@ describe('Nx Plugin', () => {
const createAppName = `create-${plugin}-app`;
runCLI(
`generate @nx/plugin:plugin ${plugin} --e2eTestRunner jest --publishable --project-name-and-root-format=as-provided`
`generate @nx/plugin:plugin ${plugin} --e2eTestRunner jest --publishable`
);
// check files are generated without the layout directory ("libs/") and
@ -504,7 +504,7 @@ describe('Nx Plugin', () => {
);
runCLI(
`generate @nx/plugin:create-package ${createAppName} --project=${plugin} --e2eProject=${plugin}-e2e --project-name-and-root-format=as-provided`
`generate @nx/plugin:create-package ${createAppName} --name=${createAppName} --project=${plugin} --e2eProject=${plugin}-e2e`
);
// check files are generated without the layout directory ("libs/") and

View File

@ -265,7 +265,7 @@ describe('@nx/react-native (legacy)', () => {
const libName = uniq('@my-org/lib1');
runCLI(
`generate @nx/react-native:application ${appName} --project-name-and-root-format=as-provided --install=false --no-interactive`
`generate @nx/react-native:application ${appName} --install=false --no-interactive`
);
// check files are generated without the layout directory ("apps/") and
@ -274,9 +274,7 @@ describe('@nx/react-native (legacy)', () => {
// check tests pass
expect(() => runCLI(`test ${appName}`)).not.toThrow();
runCLI(
`generate @nx/react-native:library ${libName} --buildable --project-name-and-root-format=as-provided`
);
runCLI(`generate @nx/react-native:library ${libName} --buildable`);
// check files are generated without the layout directory ("libs/") and
// using the project name as the directory when no directory is provided

View File

@ -18,7 +18,7 @@ describe('@nx/react-native', () => {
newProject();
appName = uniq('app');
runCLI(
`generate @nx/react-native:app ${appName} --project-name-and-root-format=as-provided --install=false --no-interactive`
`generate @nx/react-native:app ${appName} --install=false --no-interactive`
);
});

View File

@ -27,7 +27,7 @@ describe('React Cypress Component Tests', () => {
ensureCypressInstallation();
runCLI(
`generate @nx/react:app ${appName} --directory=apps/${appName} --bundler=webpack --no-interactive`
`generate @nx/react:app apps/${appName} --bundler=webpack --no-interactive`
);
updateJson('nx.json', (json) => ({
@ -46,7 +46,7 @@ describe('React Cypress Component Tests', () => {
`generate @nx/react:component apps/${appName}/src/app/fancy-cmp/fancy-cmp --no-interactive`
);
runCLI(
`generate @nx/react:lib ${usedInAppLibName} --directory=libs/${usedInAppLibName} --no-interactive --unitTestRunner=jest`
`generate @nx/react:lib libs/${usedInAppLibName} --no-interactive --unitTestRunner=jest`
);
runCLI(
`generate @nx/react:component libs/${usedInAppLibName}/src/lib/btn/btn --export --no-interactive`
@ -108,7 +108,7 @@ export default App;`
);
runCLI(
`generate @nx/react:lib ${buildableLibName} --directory=libs/${buildableLibName} --buildable --no-interactive --unitTestRunner=jest`
`generate @nx/react:lib libs/${buildableLibName} --buildable --no-interactive --unitTestRunner=jest`
);
runCLI(
`generate @nx/react:component libs/${buildableLibName}/src/lib/input/input --export --no-interactive`

View File

@ -18,7 +18,7 @@ describe('React Playwright e2e tests', () => {
packages: ['@nx/react'],
});
runCLI(
`generate @nx/react:app ${appName} --e2eTestRunner=playwright --bundler=vite --projectNameAndRootFormat=as-provided --no-interactive`
`generate @nx/react:app ${appName} --e2eTestRunner=playwright --bundler=vite --no-interactive`
);
});
@ -35,7 +35,7 @@ describe('React Playwright e2e tests', () => {
it('should execute e2e tests using playwright with a library used in the app', () => {
runCLI(
`generate @nx/js:library ${usedInAppLibName} --unitTestRunner=none --importPath=@mylib --projectNameAndRootFormat=as-provided --no-interactive`
`generate @nx/js:library ${usedInAppLibName} --unitTestRunner=none --importPath=@mylib --no-interactive`
);
updateFile(

View File

@ -40,7 +40,7 @@ describe('React Rspack Module Federation', () => {
const remote3 = uniq('remote3');
runCLI(
`generate @nx/react:host ${shell} --directory=apps/${shell} --remotes=${remote1},${remote2},${remote3} --bundler=rspack --e2eTestRunner=cypress --style=css --no-interactive --skipFormat --js=${js}`
`generate @nx/react:host apps/${shell} --name=${shell} --remotes=${remote1},${remote2},${remote3} --bundler=rspack --e2eTestRunner=cypress --style=css --no-interactive --skipFormat --js=${js}`
);
checkFilesExist(
@ -132,7 +132,7 @@ describe('React Rspack Module Federation', () => {
const remote3 = uniq('remote3');
runCLI(
`generate @nx/react:host ${shell} --directory=apps/${shell} --remotes=${remote1},${remote2},${remote3} --bundler=rspack --e2eTestRunner=playwright --style=css --no-interactive --skipFormat`
`generate @nx/react:host apps/${shell} --name=${shell} --remotes=${remote1},${remote2},${remote3} --bundler=rspack --e2eTestRunner=playwright --style=css --no-interactive --skipFormat`
);
checkFilesExist(`apps/${shell}/module-federation.config.ts`);
@ -198,11 +198,11 @@ describe('React Rspack Module Federation', () => {
const remote2 = uniq('remote2');
runCLI(
`generate @nx/react:host ${shell} --directory=apps/${shell} --remotes=${remote1} --bundler=webpack --e2eTestRunner=cypress --style=css --no-interactive --skipFormat`
`generate @nx/react:host apps/${shell} --name=${shell} --remotes=${remote1} --bundler=webpack --e2eTestRunner=cypress --style=css --no-interactive --skipFormat`
);
runCLI(
`generate @nx/react:remote ${remote2} --directory=apps/${remote2} --host=${shell} --bundler=rspack --style=css --no-interactive --skipFormat`
`generate @nx/react:remote apps/${remote2} --name=${remote2} --host=${shell} --bundler=rspack --style=css --no-interactive --skipFormat`
);
updateFile(
@ -267,11 +267,11 @@ describe('React Rspack Module Federation', () => {
const remote1 = uniq('remote1');
const remote2 = uniq('remote2');
runCLI(
`generate @nx/react:host ${shell} --directory=apps/${shell} --remotes=${remote1} --bundler=rspack --e2eTestRunner=cypress --style=css --no-interactive --skipFormat`
`generate @nx/react:host apps/${shell} --name=${shell} --remotes=${remote1} --bundler=rspack --e2eTestRunner=cypress --style=css --no-interactive --skipFormat`
);
runCLI(
`generate @nx/react:remote ${remote2} --directory=apps/${remote2} --host=${shell} --bundler=webpack --style=css --no-interactive --skipFormat`
`generate @nx/react:remote apps/${remote2} --name=${remote2} --host=${shell} --bundler=webpack --style=css --no-interactive --skipFormat`
);
updateFile(
@ -327,7 +327,7 @@ describe('React Rspack Module Federation', () => {
const remote3 = uniq('remote3');
await runCLIAsync(
`generate @nx/react:host ${shell} --ssr --directory=apps/${shell} --remotes=${remote1},${remote2},${remote3} --bundler=rspack --style=css --no-interactive --skipFormat`
`generate @nx/react:host apps/${shell} --ssr --name=${shell} --remotes=${remote1},${remote2},${remote3} --bundler=rspack --style=css --no-interactive --skipFormat`
);
expect(readPort(shell)).toEqual(4200);
@ -358,7 +358,7 @@ describe('React Rspack Module Federation', () => {
const remote3 = uniq('remote3');
await runCLIAsync(
`generate @nx/react:host ${shell} --ssr --directory=apps/${shell} --remotes=${remote1},${remote2},${remote3} --bundler=rspack --style=css --e2eTestRunner=cypress --no-interactive --skipFormat`
`generate @nx/react:host apps/${shell} --ssr --name=${shell} --remotes=${remote1},${remote2},${remote3} --bundler=rspack --style=css --e2eTestRunner=cypress --no-interactive --skipFormat`
);
const serveResult = await runCommandUntil(`serve ${shell}`, (output) =>
@ -375,7 +375,7 @@ describe('React Rspack Module Federation', () => {
const remote3 = uniq('remote3');
await runCLIAsync(
`generate @nx/react:host ${shell} --ssr --directory=apps/${shell} --remotes=${remote1},${remote2},${remote3} --bundler=rspack --style=css --e2eTestRunner=cypress --no-interactive --skipFormat`
`generate @nx/react:host apps/${shell} --ssr --name=${shell} --remotes=${remote1},${remote2},${remote3} --bundler=rspack --style=css --e2eTestRunner=cypress --no-interactive --skipFormat`
);
const capitalize = (s: string) =>
@ -418,11 +418,9 @@ describe('React Rspack Module Federation', () => {
const shell = uniq('shell');
const remote = uniq('remote');
runCLI(`generate @nx/react:host ${shell} --no-interactive --skipFormat`);
runCLI(
`generate @nx/react:host ${shell} --project-name-and-root-format=as-provided --no-interactive --skipFormat`
);
runCLI(
`generate @nx/react:remote ${remote} --host=${shell} --bundler=rspack --project-name-and-root-format=as-provided --no-interactive --skipFormat`
`generate @nx/react:remote ${remote} --host=${shell} --bundler=rspack --no-interactive --skipFormat`
);
const shellPort = readPort(shell);
@ -495,16 +493,14 @@ describe('React Rspack Module Federation', () => {
const host = uniq('host');
runCLI(
`generate @nx/react:host ${host} --remotes=${remote} --bundler=rspack --e2eTestRunner=cypress --no-interactive --projectNameAndRootFormat=as-provided --skipFormat`
`generate @nx/react:host ${host} --remotes=${remote} --bundler=rspack --e2eTestRunner=cypress --no-interactive --skipFormat`
);
runCLI(
`generate @nx/js:lib ${lib} --no-interactive --projectNameAndRootFormat=as-provided --skipFormat`
);
runCLI(`generate @nx/js:lib ${lib} --no-interactive --skipFormat`);
// Federate Module
runCLI(
`generate @nx/react:federate-module ${lib}/src/index.ts --name=${module} --remote=${remote} --bundler=rspack --no-interactive --skipFormat`
`generate @nx/react:federate-module ${lib}/src/index.ts --name=${module} --remote=${remote} --remoteDirectory=${remote} --bundler=rspack --no-interactive --skipFormat`
);
updateFile(
@ -596,16 +592,14 @@ describe('React Rspack Module Federation', () => {
const host = uniq('host');
runCLI(
`generate @nx/react:host ${host} --remotes=${remote} --bundler=rspack --e2eTestRunner=cypress --no-interactive --projectNameAndRootFormat=as-provided --skipFormat`
`generate @nx/react:host ${host} --remotes=${remote} --bundler=rspack --e2eTestRunner=cypress --no-interactive --skipFormat`
);
runCLI(
`generate @nx/js:lib ${lib} --no-interactive --projectNameAndRootFormat=as-provided --skipFormat`
);
runCLI(`generate @nx/js:lib ${lib} --no-interactive --skipFormat`);
// Federate Module
runCLI(
`generate @nx/react:federate-module ${lib}/src/index.ts --name=${module} --remote=${childRemote} --bundler=rspack --no-interactive --skipFormat`
`generate @nx/react:federate-module ${lib}/src/index.ts --name=${module} --remote=${childRemote} --remoteDirectory=${childRemote} --bundler=rspack --no-interactive --skipFormat`
);
updateFile(
@ -704,7 +698,7 @@ describe('React Rspack Module Federation', () => {
const host = uniq('host');
runCLI(
`generate @nx/react:host ${host} --remotes=${remote} --bundler=rspack --e2eTestRunner=cypress --no-interactive --projectNameAndRootFormat=as-provided --typescriptConfiguration=false --skipFormat`
`generate @nx/react:host ${host} --remotes=${remote} --bundler=rspack --e2eTestRunner=cypress --no-interactive --typescriptConfiguration=false --skipFormat`
);
// Update remote to be loaded via script
@ -838,11 +832,11 @@ describe('React Rspack Module Federation', () => {
const lib = uniq('lib');
runCLI(
`generate @nx/react:host ${shell} --remotes=${remote} --bundler=rspack --e2eTestRunner=cypress --no-interactive --projectNameAndRootFormat=as-provided --skipFormat`
`generate @nx/react:host ${shell} --remotes=${remote} --bundler=rspack --e2eTestRunner=cypress --no-interactive --skipFormat`
);
runCLI(
`generate @nx/js:lib ${lib} --importPath=@acme/${lib} --publishable=true --no-interactive --projectNameAndRootFormat=as-provided --skipFormat`
`generate @nx/js:lib ${lib} --importPath=@acme/${lib} --publishable=true --no-interactive --skipFormat`
);
const shellPort = readPort(shell);
@ -986,7 +980,7 @@ describe('React Rspack Module Federation', () => {
const remote = uniq('remote');
runCLI(
`generate @nx/react:host ${shell} --remotes=${remote} --bundler=rspack --e2eTestRunner=cypress --project-name-and-root-format=as-provided --no-interactive --skipFormat`
`generate @nx/react:host ${shell} --remotes=${remote} --bundler=rspack --e2eTestRunner=cypress --no-interactive --skipFormat`
);
const shellPort = readPort(shell);
@ -1122,7 +1116,7 @@ describe('React Rspack Module Federation', () => {
const remotePort = 4205;
runCLI(
`generate @nx/react:host ${shell} --remotes=${remote} --bundler=rspack --e2eTestRunner=cypress --dynamic=true --project-name-and-root-format=as-provided --no-interactive --skipFormat`
`generate @nx/react:host ${shell} --remotes=${remote} --bundler=rspack --e2eTestRunner=cypress --dynamic=true --no-interactive --skipFormat`
);
updateJson(`${remote}/project.json`, (project) => {

View File

@ -133,7 +133,7 @@ describe('React Module Federation', () => {
const remote3 = uniq('remote3');
runCLI(
`generate @nx/react:host ${shell} --directory=apps/${shell} --remotes=${remote1},${remote2},${remote3} --bundler=webpack --e2eTestRunner=playwright --style=css --no-interactive --skipFormat`
`generate @nx/react:host apps/${shell} --name=${shell} --remotes=${remote1},${remote2},${remote3} --bundler=webpack --e2eTestRunner=playwright --style=css --no-interactive --skipFormat`
);
checkFilesExist(`apps/${shell}/module-federation.config.ts`);
@ -292,10 +292,10 @@ describe('React Module Federation', () => {
const remote = uniq('remote');
runCLI(
`generate @nx/react:host ${shell} --bundler=webpack --project-name-and-root-format=as-provided --no-interactive --skipFormat`
`generate @nx/react:host ${shell} --bundler=webpack --no-interactive --skipFormat`
);
runCLI(
`generate @nx/react:remote ${remote} --bundler=webpack --host=${shell} --project-name-and-root-format=as-provided --no-interactive --skipFormat`
`generate @nx/react:remote ${remote} --bundler=webpack --host=${shell} --no-interactive --skipFormat`
);
const shellPort = readPort(shell);
@ -368,16 +368,14 @@ describe('React Module Federation', () => {
const host = uniq('host');
runCLI(
`generate @nx/react:host ${host} --bundler=webpack --remotes=${remote} --e2eTestRunner=cypress --no-interactive --projectNameAndRootFormat=as-provided --skipFormat`
`generate @nx/react:host ${host} --bundler=webpack --remotes=${remote} --e2eTestRunner=cypress --no-interactive --skipFormat`
);
runCLI(
`generate @nx/js:lib ${lib} --no-interactive --projectNameAndRootFormat=as-provided --skipFormat`
);
runCLI(`generate @nx/js:lib ${lib} --no-interactive --skipFormat`);
// Federate Module
runCLI(
`generate @nx/react:federate-module ${lib}/src/index.ts --bundler=webpack --name=${module} --remote=${remote} --no-interactive --skipFormat`
`generate @nx/react:federate-module ${lib}/src/index.ts --bundler=webpack --name=${module} --remote=${remote} --remoteDirectory=${remote} --no-interactive --skipFormat`
);
updateFile(
@ -469,16 +467,14 @@ describe('React Module Federation', () => {
const host = uniq('host');
runCLI(
`generate @nx/react:host ${host} --remotes=${remote} --bundler=webpack --e2eTestRunner=cypress --no-interactive --projectNameAndRootFormat=as-provided --skipFormat`
`generate @nx/react:host ${host} --remotes=${remote} --bundler=webpack --e2eTestRunner=cypress --no-interactive --skipFormat`
);
runCLI(
`generate @nx/js:lib ${lib} --no-interactive --projectNameAndRootFormat=as-provided --skipFormat`
);
runCLI(`generate @nx/js:lib ${lib} --no-interactive --skipFormat`);
// Federate Module
runCLI(
`generate @nx/react:federate-module ${lib}/src/index.ts --bundler=webpack --name=${module} --remote=${childRemote} --no-interactive --skipFormat`
`generate @nx/react:federate-module ${lib}/src/index.ts --bundler=webpack --name=${module} --remote=${childRemote} --remoteDirectory=${childRemote} --no-interactive --skipFormat`
);
updateFile(
@ -577,7 +573,7 @@ describe('React Module Federation', () => {
const host = uniq('host');
runCLI(
`generate @nx/react:host ${host} --remotes=${remote} --bundler=webpack --e2eTestRunner=cypress --no-interactive --projectNameAndRootFormat=as-provided --typescriptConfiguration=false --skipFormat`
`generate @nx/react:host ${host} --remotes=${remote} --bundler=webpack --e2eTestRunner=cypress --no-interactive --typescriptConfiguration=false --skipFormat`
);
// Update remote to be loaded via script
@ -711,11 +707,11 @@ describe('React Module Federation', () => {
const lib = uniq('lib');
runCLI(
`generate @nx/react:host ${shell} --remotes=${remote} --bundler=webpack --e2eTestRunner=cypress --no-interactive --projectNameAndRootFormat=as-provided --skipFormat`
`generate @nx/react:host ${shell} --remotes=${remote} --bundler=webpack --e2eTestRunner=cypress --no-interactive --skipFormat`
);
runCLI(
`generate @nx/js:lib ${lib} --importPath=@acme/${lib} --publishable=true --no-interactive --projectNameAndRootFormat=as-provided --skipFormat`
`generate @nx/js:lib ${lib} --importPath=@acme/${lib} --publishable=true --no-interactive --skipFormat`
);
const shellPort = readPort(shell);
@ -861,7 +857,7 @@ describe('React Module Federation', () => {
const remote = uniq('remote');
runCLI(
`generate @nx/react:host ${shell} --remotes=${remote} --bundler=webpack --e2eTestRunner=cypress --project-name-and-root-format=as-provided --no-interactive --skipFormat`
`generate @nx/react:host ${shell} --remotes=${remote} --bundler=webpack --e2eTestRunner=cypress --no-interactive --skipFormat`
);
const shellPort = readPort(shell);
@ -997,7 +993,7 @@ describe('React Module Federation', () => {
const remotePort = 4205;
runCLI(
`generate @nx/react:host ${shell} --remotes=${remote} --bundler=webpack --e2eTestRunner=cypress --dynamic=true --project-name-and-root-format=as-provided --no-interactive --skipFormat`
`generate @nx/react:host ${shell} --remotes=${remote} --bundler=webpack --e2eTestRunner=cypress --dynamic=true --no-interactive --skipFormat`
);
updateJson(`${remote}/project.json`, (project) => {

View File

@ -66,9 +66,7 @@ describe('Build React libraries and apps', () => {
);
};
runCLI(
`generate @nx/react:app ${app} --directory=apps/${app} --no-interactive`
);
runCLI(`generate @nx/react:app apps/${app} --no-interactive`);
updateJson('nx.json', (json) => ({
...json,
generators: {
@ -82,13 +80,13 @@ describe('Build React libraries and apps', () => {
}));
// generate buildable libs
runCLI(
`generate @nx/react:library ${parentLib} --bundler=rollup --directory=libs/${parentLib} --importPath=@${proj}/${parentLib} --no-interactive --unitTestRunner=jest --skipFormat`
`generate @nx/react:library libs/${parentLib} --bundler=rollup --importPath=@${proj}/${parentLib} --no-interactive --unitTestRunner=jest --skipFormat`
);
runCLI(
`generate @nx/react:library ${childLib} --bundler=rollup --directory=libs/${childLib} --importPath=@${proj}/${childLib} --no-interactive --unitTestRunner=jest --skipFormat`
`generate @nx/react:library libs/${childLib} --bundler=rollup --importPath=@${proj}/${childLib} --no-interactive --unitTestRunner=jest --skipFormat`
);
runCLI(
`generate @nx/react:library ${childLib2} --bundler=rollup --directory=libs/${childLib2} --importPath=@${proj}/${childLib2} --no-interactive --unitTestRunner=jest --skipFormat`
`generate @nx/react:library libs/${childLib2} --bundler=rollup --importPath=@${proj}/${childLib2} --no-interactive --unitTestRunner=jest --skipFormat`
);
createDep(parentLib, [childLib, childLib2]);
@ -187,7 +185,7 @@ export async function h() { return 'c'; }
const libName = uniq('lib');
runCLI(
`generate @nx/react:lib ${libName} --bundler=rollup --directory=libs/${libName} --importPath=@${proj}/${libName} --no-interactive --unitTestRunner=jest`
`generate @nx/react:lib libs/${libName} --bundler=rollup --importPath=@${proj}/${libName} --no-interactive --unitTestRunner=jest`
);
const mainPath = `libs/${libName}/src/lib/${libName}.tsx`;

View File

@ -61,9 +61,7 @@ describe('Build React libraries and apps', () => {
);
};
runCLI(
`generate @nx/react:app ${app} --directory=apps/${app} --no-interactive`
);
runCLI(`generate @nx/react:app apps/${app} --no-interactive`);
updateJson('nx.json', (json) => ({
...json,
generators: {
@ -77,13 +75,13 @@ describe('Build React libraries and apps', () => {
}));
// generate buildable libs
runCLI(
`generate @nx/react:library ${parentLib} --bundler=rollup --directory=libs/${parentLib} --importPath=@${proj}/${parentLib} --no-interactive --unitTestRunner=jest --skipFormat`
`generate @nx/react:library libs/${parentLib} --bundler=rollup --importPath=@${proj}/${parentLib} --no-interactive --unitTestRunner=jest --skipFormat`
);
runCLI(
`generate @nx/react:library ${childLib} --bundler=rollup --directory=libs/${childLib} --importPath=@${proj}/${childLib} --no-interactive --unitTestRunner=jest --skipFormat`
`generate @nx/react:library libs/${childLib} --bundler=rollup --importPath=@${proj}/${childLib} --no-interactive --unitTestRunner=jest --skipFormat`
);
runCLI(
`generate @nx/react:library ${childLib2} --bundler=rollup --directory=libs/${childLib2} --importPath=@${proj}/${childLib2} --no-interactive --unitTestRunner=jest --skipFormat`
`generate @nx/react:library libs/${childLib2} --bundler=rollup --importPath=@${proj}/${childLib2} --no-interactive --unitTestRunner=jest --skipFormat`
);
createDep(parentLib, [childLib, childLib2]);
@ -158,7 +156,7 @@ module.exports = withNx(
// Setup
const myLib = uniq('my-lib');
runCLI(
`generate @nx/react:library ${myLib} --bundler=rollup --directory=libs/${myLib} --publishable --importPath="@mproj/${myLib}" --no-interactive --unitTestRunner=jest`
`generate @nx/react:library libs/${myLib} --bundler=rollup --publishable --importPath="@mproj/${myLib}" --no-interactive --unitTestRunner=jest`
);
/**
@ -209,7 +207,7 @@ module.exports = withNx(
const libName = uniq('lib');
runCLI(
`generate @nx/react:lib ${libName} --directory=libs/${libName} --bundler=rollup --importPath=@${proj}/${libName} --no-interactive --unitTestRunner=jest`
`generate @nx/react:lib libs/${libName} --bundler=rollup --importPath=@${proj}/${libName} --no-interactive --unitTestRunner=jest`
);
const mainPath = `libs/${libName}/src/lib/${libName}.tsx`;

View File

@ -22,7 +22,7 @@ describe('Build React applications and libraries with Vite', () => {
const viteApp = uniq('viteapp');
runCLI(
`generate @nx/react:app ${viteApp} --bundler=vite --directory=apps/${viteApp} --compiler=babel --unitTestRunner=vitest --no-interactive`
`generate @nx/react:app apps/${viteApp} --bundler=vite --compiler=babel --unitTestRunner=vitest --no-interactive`
);
const appTestResults = await runCLIAsync(`test ${viteApp}`);
@ -43,7 +43,7 @@ describe('Build React applications and libraries with Vite', () => {
const viteApp = uniq('viteapp');
runCLI(
`generate @nx/react:app ${viteApp} --bundler=vite --directory=apps/${viteApp} --compiler=swc --unitTestRunner=vitest --no-interactive`
`generate @nx/react:app apps/${viteApp} --bundler=vite --compiler=swc --unitTestRunner=vitest --no-interactive`
);
const appTestResults = await runCLIAsync(`test ${viteApp}`);
@ -65,7 +65,7 @@ describe('Build React applications and libraries with Vite', () => {
const viteLib = uniq('vitelib');
runCLI(
`generate @nx/react:app ${viteApp} --bundler=vite --directory=apps/${viteApp} --unitTestRunner=vitest --inSourceTests --no-interactive`
`generate @nx/react:app apps/${viteApp} --bundler=vite --unitTestRunner=vitest --inSourceTests --no-interactive`
);
expect(() => {
checkFilesExist(`apps/${viteApp}/src/app/app.spec.tsx`);
@ -85,7 +85,7 @@ describe('Build React applications and libraries with Vite', () => {
checkFilesExist(`dist/apps/${viteApp}/index.html`);
runCLI(
`generate @nx/react:lib ${viteLib} --bundler=vite --directory=libs/${viteLib} --inSourceTests --unitTestRunner=vitest --no-interactive`
`generate @nx/react:lib libs/${viteLib} --bundler=vite --inSourceTests --unitTestRunner=vitest --no-interactive`
);
expect(() => {
checkFilesExist(`libs/${viteLib}/src/lib/${viteLib}.spec.tsx`);
@ -125,7 +125,7 @@ describe('Build React applications and libraries with Vite', () => {
const viteLib = uniq('vitelib');
runCLI(
`generate @nx/react:lib ${viteLib} --bundler=vite --directory=libs/${viteLib} --no-interactive --unit-test-runner=none`
`generate @nx/react:lib libs/${viteLib} --bundler=vite --no-interactive --unit-test-runner=none`
);
await runCLIAsync(`build ${viteLib}`);
@ -139,7 +139,7 @@ describe('Build React applications and libraries with Vite', () => {
// Convert non-buildable lib to buildable one
const nonBuildableLib = uniq('nonbuildablelib');
runCLI(
`generate @nx/react:lib ${nonBuildableLib} --no-interactive --directory=libs/${nonBuildableLib} --unitTestRunner=jest`
`generate @nx/react:lib libs/${nonBuildableLib} --no-interactive --unitTestRunner=jest`
);
runCLI(
`generate @nx/vite:configuration ${nonBuildableLib} --uiFramework=react --no-interactive`
@ -157,7 +157,7 @@ describe('Build React applications and libraries with Vite', () => {
const viteApp = uniq('viteapp');
runCLI(
`generate @nx/react:app ${viteApp} --directory=apps/${viteApp} --bundler=vite --unitTestRunner=jest --no-interactive`
`generate @nx/react:app apps/${viteApp} --bundler=vite --unitTestRunner=jest --no-interactive`
);
const appTestResults = await runCLIAsync(`test ${viteApp}`);

View File

@ -26,7 +26,7 @@ describe('Build React applications and libraries with Vite', () => {
const appName = uniq('app');
runCLI(
`generate @nx/react:app ${appName} --directory=apps/${appName} --bundler=webpack --compiler=babel --unitTestRunner=none --no-interactive`
`generate @nx/react:app apps/${appName} --bundler=webpack --compiler=babel --unitTestRunner=none --no-interactive`
);
createFile(
`apps/${appName}/src/app/nx.svg`,
@ -67,7 +67,7 @@ describe('Build React applications and libraries with Vite', () => {
const appName = uniq('app');
runCLI(
`generate @nx/react:app ${appName} --directory=apps/${appName} --bundler=webpack --compiler=babel --unitTestRunner=none --no-interactive`
`generate @nx/react:app apps/${appName} --bundler=webpack --compiler=babel --unitTestRunner=none --no-interactive`
);
createFile(
`apps/${appName}/src/app/nx.svg`,

View File

@ -34,10 +34,10 @@ describe('React Applications', () => {
const libName = uniq('lib');
runCLI(
`generate @nx/react:app ${appName} --directory=apps/${appName} --bundler=vite --no-interactive --skipFormat`
`generate @nx/react:app apps/${appName} --name=${appName} --bundler=vite --no-interactive --skipFormat`
);
runCLI(
`generate @nx/react:lib ${libName} --directory=libs/${libName} --bundler=none --no-interactive --unit-test-runner=vitest --skipFormat`
`generate @nx/react:lib libs/${libName} --bundler=none --no-interactive --unit-test-runner=vitest --skipFormat`
);
// Library generated with Vite
@ -107,13 +107,13 @@ describe('React Applications', () => {
const redSvg = `<?xml version="1.0"?><svg xmlns="http://www.w3.org/2000/svg" version="1.2" baseProfile="tiny" viewBox="0 0 30 30"><rect x="10" y="10" width="10" height="10" fill="red"/></svg>`;
runCLI(
`generate @nx/react:app ${appName} --directory=apps/${appName} --style=css --bundler=webpack --unit-test-runner=jest --no-interactive --skipFormat`
`generate @nx/react:app apps/${appName} --style=css --bundler=webpack --unit-test-runner=jest --no-interactive --skipFormat`
);
runCLI(
`generate @nx/react:lib ${libName} --directory=libs${libName} --style=css --no-interactive --unit-test-runner=jest --skipFormat`
`generate @nx/react:lib libs/${libName} --style=css --no-interactive --unit-test-runner=jest --skipFormat`
);
runCLI(
`generate @nx/react:lib ${libWithNoComponents} --directory=libs/${libWithNoComponents} --no-interactive --no-component --unit-test-runner=jest --skipFormat`
`generate @nx/react:lib libs/${libWithNoComponents} --no-interactive --no-component --unit-test-runner=jest --skipFormat`
);
// Libs should not include package.json by default
@ -199,7 +199,7 @@ describe('React Applications', () => {
const appName = uniq('app');
runCLI(
`generate @nx/react:app ${appName} --directory=apps/${appName} --routing --bundler=webpack --no-interactive --skipFormat`
`generate @nx/react:app apps/${appName} --routing --bundler=webpack --no-interactive --skipFormat`
);
runCLI(`build ${appName}`);
@ -216,13 +216,13 @@ describe('React Applications', () => {
const libName = uniq('lib');
runCLI(
`g @nx/react:app ${appName} --directory=apps/${appName} --bundler=webpack --no-interactive --skipFormat`
`g @nx/react:app apps/${appName} --bundler=webpack --no-interactive --skipFormat`
);
runCLI(
`g @nx/react:redux apps/${appName}/src/app/lemon/lemon --skipFormat`
);
runCLI(
`g @nx/react:lib ${libName} --directory=libs/${libName} --unit-test-runner=jest --no-interactive --skipFormat`
`g @nx/react:lib libs/${libName} --unit-test-runner=jest --no-interactive --skipFormat`
);
runCLI(
`g @nx/react:redux libs/${libName}/src/lib/orange/orange --skipFormat`
@ -252,7 +252,7 @@ describe('React Applications', () => {
const libName = uniq('@my-org/lib1');
runCLI(
`generate @nx/react:app ${appName} --bundler=webpack --project-name-and-root-format=as-provided --no-interactive --skipFormat`
`generate @nx/react:app ${appName} --bundler=webpack --no-interactive --skipFormat`
);
// check files are generated without the layout directory ("apps/") and
@ -269,7 +269,7 @@ describe('React Applications', () => {
);
runCLI(
`generate @nx/react:lib ${libName} --unit-test-runner=jest --buildable --project-name-and-root-format=as-provided --no-interactive --skipFormat`
`generate @nx/react:lib ${libName} --unit-test-runner=jest --buildable --no-interactive --skipFormat`
);
// check files are generated without the layout directory ("libs/") and
@ -340,7 +340,7 @@ describe('React Applications', () => {
it('should support tailwind', async () => {
const appName = uniq('app');
runCLI(
`generate @nx/react:app ${appName} --directory=apps/${appName} --style=tailwind --bundler=vite --no-interactive --skipFormat`
`generate @nx/react:app apps/${appName} --style=tailwind --bundler=vite --no-interactive --skipFormat`
);
// update app to use styled-jsx
@ -414,15 +414,15 @@ describe('React Applications', () => {
const plainJsLib = uniq('jslib');
runCLI(
`generate @nx/react:app ${appName} --directory=apps/${appName} --bundler=webpack --unit-test-runner=jest --no-interactive --js --skipFormat`
`generate @nx/react:app apps/${appName} --bundler=webpack --unit-test-runner=jest --no-interactive --js --skipFormat`
);
runCLI(
`generate @nx/react:lib ${libName} --directory=libs/${libName} --no-interactive --js --unit-test-runner=none --skipFormat`
`generate @nx/react:lib libs/${libName} --no-interactive --js --unit-test-runner=none --skipFormat`
);
// Make sure plain JS libs can be imported as well.
// There was an issue previously: https://github.com/nrwl/nx/issues/10990
runCLI(
`generate @nx/js:lib ${plainJsLib} --directory=libs/${plainJsLib} --js --unit-test-runner=none --bundler=none --compiler=tsc --no-interactive --skipFormat`
`generate @nx/js:lib libs/${plainJsLib} --js --unit-test-runner=none --bundler=none --compiler=tsc --no-interactive --skipFormat`
);
const mainPath = `apps/${appName}/src/main.js`;
@ -448,7 +448,7 @@ describe('React Applications', () => {
`('should support global and css modules', async ({ style }) => {
const appName = uniq('app');
runCLI(
`generate @nx/react:app ${appName} --directory=apps/${appName} --style=${style} --bundler=webpack --no-interactive --skipFormat`
`generate @nx/react:app apps/${appName} --style=${style} --bundler=webpack --no-interactive --skipFormat`
);
// make sure stylePreprocessorOptions works
@ -484,10 +484,10 @@ describe('React Applications', () => {
const libName = uniq('lib');
runCLI(
`g @nx/react:app ${appName} --directory=apps/${appName} --bundler=webpack --no-interactive --skipFormat`
`g @nx/react:app apps/${appName} --bundler=webpack --no-interactive --skipFormat`
);
runCLI(
`g @nx/react:lib ${libName} --directory=libs/${libName} --no-interactive --unit-test-runner=none --skipFormat`
`g @nx/react:lib libs/${libName} --no-interactive --unit-test-runner=none --skipFormat`
);
const mainPath = `apps/${appName}/src/main.tsx`;

View File

@ -50,7 +50,6 @@ describe('nx release circular dependencies', () => {
beforeAll(async () => {
newProject({
unsetProjectNameAndRootFormat: false,
packages: ['@nx/js'],
});

View File

@ -50,7 +50,6 @@ describe('nx release conventional commits config', () => {
beforeAll(async () => {
newProject({
unsetProjectNameAndRootFormat: false,
packages: ['@nx/js'],
});

View File

@ -46,7 +46,6 @@ describe('nx release create github release', () => {
beforeAll(async () => {
newProject({
unsetProjectNameAndRootFormat: false,
packages: ['@nx/js'],
});

Some files were not shown because too many files have changed in this diff Show More