This PR updates examples in `.md` files (both docs and blog posts) to use positional args. Nx 20 changes the position arg to be either `directory` for apps/libs or `path` for artifacts (e.g. components). So before you'd do this: ``` nx g app myapp --directory=apps/myapp nx g lib mylib --directory=libs/mylib nx g lib mylib --directory=libs/nested/mylib nx g lib @acme/foo --directory=libs/@acme/foo --importPath=@acme/foo nx g component foo --directory=libs/ui/src/foo --pascalCaseFiles ``` Will now be simplified to ``` nx g app apps/myapp nx g lib libs/mylib nx g lib libs/nested/mylib nx g lib libs/@acme/foo # name and import path are both "@acme/foo" nx g component libs/ui/src/foo/Foo ``` For cases where `name` and `importPath` need to be changed, you can always manually specify them. ``` nx g lib libs/nested/foo # name is foo nx g lib libs/nested/foo --name=nested-foo # specify name with prefix nx g lib libs/@acme/foo --name # use "foo" as name and don't match importPath nx g lib libs/@internal/foo --importPath=@acme/foo # different importPath from name <!-- 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 #
199 lines
8.2 KiB
JSON
199 lines
8.2 KiB
JSON
{
|
|
"name": "application",
|
|
"factory": "./src/generators/application/application",
|
|
"schema": {
|
|
"$schema": "https://json-schema.org/schema",
|
|
"$id": "GeneratorNxApp",
|
|
"title": "Creates an Angular application.",
|
|
"description": "Creates an Angular application.",
|
|
"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"
|
|
},
|
|
"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",
|
|
"default": "css",
|
|
"enum": ["css", "scss", "sass", "less"],
|
|
"x-prompt": {
|
|
"message": "Which stylesheet format would you like to use?",
|
|
"type": "list",
|
|
"items": [
|
|
{ "value": "css", "label": "CSS" },
|
|
{
|
|
"value": "scss",
|
|
"label": "SASS(.scss) [ https://sass-lang.com ]"
|
|
},
|
|
{
|
|
"value": "sass",
|
|
"label": "SASS(.sass) [ https://sass-lang.com ]"
|
|
},
|
|
{
|
|
"value": "less",
|
|
"label": "LESS [ https://lesscss.org ]"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"routing": {
|
|
"type": "boolean",
|
|
"description": "Enable routing for the application.",
|
|
"default": true,
|
|
"x-priority": "important"
|
|
},
|
|
"inlineStyle": {
|
|
"description": "Specifies if the style will be in the ts file.",
|
|
"type": "boolean",
|
|
"default": false,
|
|
"alias": "s"
|
|
},
|
|
"inlineTemplate": {
|
|
"description": "Specifies if the template will be in the ts file.",
|
|
"type": "boolean",
|
|
"default": false,
|
|
"alias": "t"
|
|
},
|
|
"viewEncapsulation": {
|
|
"description": "Specifies the view encapsulation strategy.",
|
|
"enum": ["Emulated", "None", "ShadowDom"],
|
|
"type": "string"
|
|
},
|
|
"prefix": {
|
|
"type": "string",
|
|
"format": "html-selector",
|
|
"description": "The prefix to apply to generated selectors.",
|
|
"default": "app",
|
|
"alias": "p"
|
|
},
|
|
"skipTests": {
|
|
"description": "Skip creating spec files.",
|
|
"type": "boolean",
|
|
"default": false,
|
|
"alias": "S"
|
|
},
|
|
"skipFormat": {
|
|
"description": "Skip formatting files.",
|
|
"type": "boolean",
|
|
"default": false,
|
|
"x-priority": "internal"
|
|
},
|
|
"skipPackageJson": {
|
|
"type": "boolean",
|
|
"default": false,
|
|
"description": "Do not add dependencies to `package.json`.",
|
|
"x-priority": "internal"
|
|
},
|
|
"unitTestRunner": {
|
|
"type": "string",
|
|
"enum": ["jest", "none"],
|
|
"description": "Test runner to use for unit tests.",
|
|
"default": "jest"
|
|
},
|
|
"e2eTestRunner": {
|
|
"type": "string",
|
|
"enum": ["playwright", "cypress", "none"],
|
|
"description": "Test runner to use for end to end (E2E) tests.",
|
|
"x-prompt": "Which E2E test runner would you like to use?",
|
|
"default": "playwright"
|
|
},
|
|
"tags": {
|
|
"type": "string",
|
|
"description": "Add tags to the application (used for linting)."
|
|
},
|
|
"linter": {
|
|
"description": "The tool to use for running lint checks.",
|
|
"type": "string",
|
|
"enum": ["eslint", "none"],
|
|
"default": "eslint"
|
|
},
|
|
"backendProject": {
|
|
"type": "string",
|
|
"description": "Backend project that provides data to this application. This sets up `proxy.config.json`."
|
|
},
|
|
"strict": {
|
|
"type": "boolean",
|
|
"description": "Create an application with stricter type checking and build optimization options.",
|
|
"default": true
|
|
},
|
|
"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"
|
|
},
|
|
"port": {
|
|
"type": "number",
|
|
"description": "The port at which the remote application should be served."
|
|
},
|
|
"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
|
|
},
|
|
"addTailwind": {
|
|
"type": "boolean",
|
|
"description": "Whether to configure Tailwind CSS for the application.",
|
|
"default": false
|
|
},
|
|
"standalone": {
|
|
"description": "Generate an application that is setup to use standalone components.",
|
|
"type": "boolean",
|
|
"default": true,
|
|
"x-priority": "important"
|
|
},
|
|
"rootProject": {
|
|
"description": "Create an application at the root of the workspace.",
|
|
"type": "boolean",
|
|
"default": false,
|
|
"hidden": true,
|
|
"x-priority": "internal"
|
|
},
|
|
"minimal": {
|
|
"description": "Generate a Angular app with a minimal setup.",
|
|
"type": "boolean",
|
|
"default": false
|
|
},
|
|
"bundler": {
|
|
"description": "Bundler to use to build the application. It defaults to `esbuild` for Angular versions >= 17.0.0. Otherwise, it defaults to `webpack`. _Note: The `esbuild` bundler is only considered stable from Angular v17._",
|
|
"type": "string",
|
|
"enum": ["webpack", "esbuild"],
|
|
"x-prompt": "Which bundler do you want to use to build the application?",
|
|
"x-priority": "important"
|
|
},
|
|
"ssr": {
|
|
"description": "Creates an application with Server-Side Rendering (SSR) and Static Site Generation (SSG/Prerendering) enabled.",
|
|
"type": "boolean",
|
|
"x-prompt": "Do you want to enable Server-Side Rendering (SSR) and Static Site Generation (SSG/Prerendering)?",
|
|
"default": false
|
|
}
|
|
},
|
|
"additionalProperties": false,
|
|
"required": ["name"],
|
|
"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": []
|
|
},
|
|
"aliases": ["app"],
|
|
"x-type": "application",
|
|
"description": "Creates an Angular application.",
|
|
"implementation": "/packages/angular/src/generators/application/application.ts",
|
|
"hidden": false,
|
|
"path": "/packages/angular/src/generators/application/schema.json",
|
|
"type": "generator"
|
|
}
|