diff --git a/docs/generated/packages/angular.json b/docs/generated/packages/angular.json index a39f8b9f5e..03c3af8183 100644 --- a/docs/generated/packages/angular.json +++ b/docs/generated/packages/angular.json @@ -8,6 +8,7 @@ { "name": "Overview", "id": "overview", + "path": "/packages/angular", "file": "shared/angular-plugin", "content": "![Angular logo](/shared/angular-logo.png)\n\nThe Nx Plugin for Angular contains executors, generators, and utilities for managing Angular applications and libraries within an Nx workspace. It provides:\n\n- Integration with libraries such as Storybook, Jest, Cypress, Karma, and Protractor.\n- Generators to help scaffold code quickly, including:\n - Micro Frontends\n - Libraries, both internal to your codebase and publishable to npm\n - Upgrading AngularJS applications\n - Single Component Application Modules (SCAMs)\n- NgRx helpers.\n- Utilities for automatic workspace refactoring.\n\n## Setting up the Angular plugin\n\nAdding the Angular plugin to an existing Nx workspace can be done with the following:\n\n```bash\nyarn add -D @nrwl/angular\n```\n\n```bash\nnpm install -D @nrwl/angular\n```\n\n## Using the Angular Plugin\n\n### Generating an application\n\nIt's straightforward to generate an Angular application:\n\n```bash\nnx g @nrwl/angular:app appName\n```\n\nBy default, the application will be generated with:\n\n- ESLint as the linter.\n- Jest as the unit test runner.\n- Cypress as the E2E test runner.\n\nWe can then serve, build, test, lint, and run e2e tests on the application with the following commands:\n\n```bash\nnx serve appName\nnx build appName\nnx test appName\nnx lint appName\nnx e2e appName\n```\n\n### Generating a library\n\nGenerating an Angular library is very similar to generating an application:\n\n```bash\nnx g @nrwl/angular:lib libName\n```\n\nBy default, the library will be generated with:\n\n- ESLint as the linter.\n- Jest as the unit test runner.\n\nWe can then test and lint the library with the following commands:\n\n```bash\nnx test libName\nnx lint libName\n```\n\nRead more about:\n\n- [Creating Libraries](/structure/creating-libraries)\n- [Library Types](/structure/library-types)\n- [Buildable and Publishable Libraries](/structure/buildable-and-publishable-libraries)\n\n## More Documentation\n\n- [Angular Nx Tutorial](/angular-tutorial/01-create-application)\n- [Setup Module Federation with Angular and Nx](/module-federation/faster-builds)\n- [Using NgRx](/guides/misc-ngrx)\n- [Using DataPersistence](/guides/misc-data-persistence)\n- [Upgrading an AngularJS application to Angular](/guides/misc-upgrade)\n- [Using Tailwind CSS with Angular projects](/guides/using-tailwind-css-with-angular-projects)\n" } diff --git a/docs/generated/packages/cli.json b/docs/generated/packages/cli.json index df7dad63e4..8f49f1e05d 100644 --- a/docs/generated/packages/cli.json +++ b/docs/generated/packages/cli.json @@ -4,7 +4,158 @@ "description": "Smart, Fast and Extensible Build System", "root": "/packages/cli", "source": "/packages/cli/src", - "documentation": [], + "documentation": [ + { + "name": "create-nx-workspace", + "id": "create-nx-workspace", + "file": "generated/cli/create-nx-workspace", + "content": "---\ntitle: 'create-nx-workspace - CLI command'\ndescription: 'Create a new Nx workspace'\n---\n\n# create-nx-workspace\n\nCreate a new Nx workspace\n\n## Usage\n\n```bash\ncreate-nx-workspace [name] [options]\n```\n\nInstall `create-nx-workspace` globally to invoke the command directly, or use `npx create-nx-workspace`, `yarn create nx-workspace`, or `pnpx create-nx-workspace`.\n\n## Options\n\n### allPrompts\n\nType: boolean\n\nDefault: false\n\nShow all prompts\n\n### appName\n\nType: string\n\nThe name of the application when a preset with pregenerated app is selected\n\n### ci\n\nType: string\n\nChoices: [github, circleci, azure]\n\nGenerate a CI workflow file\n\n### cli\n\nType: string\n\nChoices: [nx, angular]\n\nCLI to power the Nx workspace\n\n### defaultBase\n\nType: string\n\nDefault: main\n\nDefault base to use for new projects\n\n### help\n\nType: boolean\n\nShow help\n\n### interactive\n\nType: boolean\n\nEnable interactive mode with presets\n\n### name\n\nType: string\n\nWorkspace name (e.g. org name)\n\n### nxCloud\n\nType: boolean\n\nUse Nx Cloud\n\n### packageManager\n\nType: string\n\nChoices: [npm, pnpm, yarn]\n\nDefault: npm\n\nPackage manager to use\n\n### preset\n\nType: string\n\nCustomizes the initial content of your workspace. Default presets include: [\"apps\", \"empty\", \"core\", \"npm\", \"ts\", \"web-components\", \"angular\", \"angular-nest\", \"react\", \"react-express\", \"react-native\", \"next\", \"nest\", \"express\"]. To build your own see https://nx.dev/nx-plugin/overview#preset\n\n### style\n\nType: string\n\nStyle option to be used when a preset with pregenerated app is selected\n\n### version\n\nType: boolean\n\nShow version number\n" + }, + { + "name": "generate", + "id": "generate", + "file": "generated/cli/generate", + "content": "---\ntitle: 'generate - CLI command'\ndescription: 'Runs a generator that creates and/or modifies files based on a generator from a collection.'\n---\n\n# generate\n\nRuns a generator that creates and/or modifies files based on a generator from a collection.\n\n## Usage\n\n```bash\nnx generate \n```\n\n```bash\nnx g \n```\n\n[Install `nx` globally](/getting-started/nx-setup#install-nx) to invoke the command directly using `nx`, or use `npx nx`, `yarn nx`, or `pnpx nx`.\n\n### Examples\n\nGenerate a new Angular application:\n\n```bash\nnx generate @nrwl/angular:app myapp\n```\n\nGenerate a new React application:\n\n```bash\nnx generate @nrwl/react:app myapp\n```\n\nGenerate a new web component application:\n\n```bash\nnx generate @nrwl/web:app myapp\n```\n\nGenerate a new Node application:\n\n```bash\nnx generate @nrwl/node:app myapp\n```\n\nGenerate a new Angular library application:\n\n```bash\nnx generate @nrwl/angular:library mylibrary\n```\n\nGenerate a new React library application:\n\n```bash\nnx generate @nrwl/react:library mylibrary\n```\n\nGenerate a new Node library application:\n\n```bash\nnx generate @nrwl/node:library mylibrary\n```\n\n## Options\n\n### defaults\n\nDefault: `false`\n\nWhen true, disables interactive input prompts for options with a default.\n\n### dryRun\n\nDefault: `false`\n\nWhen true, disables interactive input prompts for options with a default.\n\n### force\n\nDefault: `false`\n\nWhen true, forces overwriting of existing files.\n\n### interactive\n\nDefault: `true`\n\nWhen false, disables interactive input prompts.\n\n### help\n\nShow help and display available generators in the default collection.\n\n### version\n\nShow version number\n" + }, + { + "name": "serve", + "id": "serve", + "file": "generated/cli/serve", + "content": "---\ntitle: 'serve - CLI command'\ndescription: 'Builds and serves an application, rebuilding on file changes.'\n---\n\n# serve\n\nBuilds and serves an application, rebuilding on file changes.\n\n## Usage\n\nThe `serve` command is a built-in alias to the [run command](/cli/run).\n\nThese two commands are equivalent:\n\n```bash\nnx serve [options]\n```\n\n```bash\nnx run :serve [options]\n```\n\n[Install `nx` globally](/getting-started/nx-setup#install-nx) to invoke the command directly using `nx`, or use `npx nx`, `yarn nx`, or `pnpx nx`.\n\n### Examples\n\nServe the `myapp` project:\n\n```bash\nnx serve myapp\n```\n\n## Common Options\n\nThe options below are common to the `serve` command used within an Nx workspace. The Web and Angular-specific serve options are listed after these options.\n\n### allowedHosts\n\nThis option allows you to whitelist services that are allowed to access the dev server.\n\n### hmr\n\nEnable hot module replacement.\n\n### host\n\nHost to listen on.\n\nDefault: `localhost`\n\n### liveReload\n\nWhether to reload the page on change, using live-reload.\n\nDefault: `true`\n\n### open (-o)\n\nOpen the application in the browser.\n\n### port\n\nPort to listen on.\n\nDefault: `4200`\n\n### publicHost\n\nPublic URL where the application will be served\n\n### ssl\n\nServe using HTTPS.\n\n### sslKey\n\nSSL key to use for serving HTTPS.\n\n### sslCert\n\nSSL certificate to use for serving HTTPS.\n\n### watch\n\nWatches for changes and rebuilds application\n\nDefault: `true`\n\n### help\n\nShow help\n\n### version\n\nShow version number\n\n## Web-Serve Options\n\n### buildTarget\n\nTarget which builds the application\n\n### memoryLimit\n\nMemory limit for type checking service process in MB.\n\n### maxWorkers\n\nNumber of workers to use for type checking.\n\n## Angular-Serve Options\n\n### aot\n\nBuild using Ahead of Time compilation.\n\n### base-href\n\nBase url for the application being built.\n\n### browser-target\n\nTarget to serve.\n\n### build-event-log\n\n**EXPERIMENTAL** Output file path for Build Event Protocol events.\n\n### common-chunk\n\nUse a separate bundle containing code used across multiple bundles.\n\n### configuration (-c)\n\nA named build target, as specified in the \"configurations\" section of the workspace configuration.\nEach named target is accompanied by a configuration of option defaults for that target.\nSetting this explicitly overrides the `--prod` flag\n\n### deploy-url\n\nURL where files will be deployed.\n\n### disable-host-check\n\nDon't verify connected clients are part of allowed hosts.\n\n### eval-source-map\n\nOutput in-file eval sourcemaps.\n\n### hmr-warning\n\nShow a warning when the `--hmr` option is enabled.\n\n### optimization\n\nEnables optimization of the build output.\n\n### poll\n\nEnable and define the file watching poll time period in milliseconds.\n\n### prod\n\nShorthand for `--configuration=production`.\nWhen true, sets the build configuration to the production target.\nBy default, the production target is set up in the workspace configuration such that all builds make use of bundling, limited tree-shaking, and also limited dead code elimination.\n\n### progress\n\nLog progress to the console while building.\n\n### proxy-config\n\nProxy configuration file.\n\n### public-host\n\nThe URL that the browser client (or live-reload client, if enabled) should use to connect to the development server. Use for a complex dev server setup, such as one with reverse proxies.\n\n### serve-path\n\nThe pathname where the app will be served.\n\n### serve-path-default-warning\n\nShow a warning when deploy-url/base-href use unsupported serve path values.\n\n### source-map\n\nOutput sourcemaps.\n\n### vendor-chunk\n\nUse a separate bundle containing only vendor libraries.\n\n### vendor-source-map\n\nResolve vendor packages sourcemaps.\n\n### verbose\n\nAdds more details to output logging.\n" + }, + { + "name": "build", + "id": "build", + "file": "generated/cli/build", + "content": "---\ntitle: 'build - CLI command'\ndescription: 'Compiles an application into an output directory named dist/ at the given output path. Must be executed from within a workspace directory.'\n---\n\n# build\n\nCompiles an application into an output directory named dist/ at the given output path. Must be executed from within a workspace directory.\n\n## Usage\n\nThe `build` command is a built-in alias to the [run command](/cli/run).\n\nThese two commands are equivalent:\n\n```bash\nnx build [options]\n```\n\n```bash\nnx run :build [options]\n```\n\n[Install `nx` globally](/getting-started/nx-setup#install-nx) to invoke the command directly using `nx`, or use `npx nx`, `yarn nx`, or `pnpx nx`.\n\n### Examples\n\nCompile a `production` build of the `myapp` project:\n\n```bash\nnx build myapp --prod\n```\n\n## Options\n\nThe options below are common to the `build` command used within an Nx workspace. The Web and Angular-specific build options are listed after these options.\n\n### baseHref\n\nDefault: `/`\n\nBase url for the application being built.\n\n### commonChunk\n\nUse a separate bundle containing code used across multiple bundles.\n\nDefault: `true`\n\n### budgets\n\nBudget thresholds to ensure parts of your application stay within boundaries which you set.\n\n### namedChunks\n\nDefault: `true`\n\nNames the produced bundles according to their entry file\n\n### deployUrl\n\nURL where the application will be deployed.\n\n### es2015Polyfills\n\nConditional polyfills loaded in browsers which do not support ES2015.\n\n### extractCss\n\nExtract css into a .css file\n\n### extractLicenses\n\nExtract all licenses in a separate file, in the case of production builds only.\n\n### index\n\nHTML File which will be contain the application\n\n### main\n\nThe name of the main entry-point file.\n\n### tsConfig\n\nThe name of the Typescript configuration file.\n\n### outputPath\n\nThe output path of the generated files.\n\n### progress\n\nLog progress to the console while building.\n\n### optimization\n\nEnables optimization of the build output.\n\n### outputHashing\n\nDefault: `none`\n\nDefine the output filename cache-busting hashing mode.\n\n### scripts\n\nExternal Scripts which will be included before the main application entry.\n\n### showCircularDependencies\n\nDefault: `true`\n\nShow circular dependency warnings on builds.\n\n### sourceMap\n\nDefault: `true`\n\nOutput sourcemaps.\n\n### statsJson\n\nGenerates a 'stats.json' file which can be analyzed using tools such as: 'webpack-bundle-analyzer' or .\n\n### styles\n\nExternal Styles which will be included with the application\n\n### subresourceIntegrity\n\nEnables the use of subresource integrity validation.\n\n### vendorChunk\n\nDefault: `true`\n\nUse a separate bundle containing only vendor libraries.\n\n### verbose\n\nEmits verbose output\n\n### watch\n\nEnable re-building when files change.\n\n### help\n\nShow help information\n\n### version\n\nShow version number\n\n## Web-Build Options\n\n### assets\n\nList of static application assets.\n\n### fileReplacements\n\nReplace files with other files in the build.\n\n### maxWorkers\n\nNumber of workers to use for type checking.\n\nDefault: `# of CPUS - 2`\n\n### memoryLimit\n\nMemory limit for type checking service process in MB.\n\nDefault: `2048`\n\n### polyfills\n\nPolyfills to load before application\n\n### stylePreprocessorOptions\n\nOptions to pass to style preprocessors.\n\n### webpackConfig\n\nPath to a function which takes a webpack config, some context and returns the resulting webpack config. See https://nx.dev/guides/customize-webpack\n\n## Angular Options\n\n### aot\n\nBuild using Ahead of Time compilation.\n\n### buildEventLog\n\n**EXPERIMENTAL** Output file path for Build Event Protocol events\n\n### buildOptimizer\n\nEnables `@angular-devkit/build-optimizer` optimizations when using the `--aot` option.\n\n### configuration (-c)\n\nA named build target, as specified in the \"configurations\" section of angular.json.\nEach named target is accompanied by a configuration of option defaults for that target.\nSetting this explicitly overrides the \"--prod\" flag\n\n### crossOrigin\n\nDefine the crossorigin attribute setting of elements that provide CORS support.\n\n### deleteOutputPath\n\nDelete the output path before building.\n\n### deployUrl\n\nURL where files will be deployed.\n\n### es5BrowserSupport\n\nEnables conditionally loaded ES2015 polyfills.\n\n### evalSourceMap\n\nOutput in-file eval sourcemaps.\n\n### experimentalRollupPass\n\nConcatenate modules with Rollup before bundling them with Webpack.\n\n### forkTypeChecker\n\nRun the TypeScript type checker in a forked process.\n\n### i18nFile\n\nLocalization file to use for i18n.\n\n### i18nFormat\n\nFormat of the localization file specified with --i18n-file.\n\n### i18nLocale\n\nLocale to use for i18n.\n\n### i18nMissingTranslation\n\nHow to handle missing translations for i18n.\n\n### localize\n\n### ngswConfigPath\n\nPath to ngsw-config.json.\n\n### poll\n\nEnable and define the file watching poll time period in milliseconds.\n\n### polyfills\n\nThe full path for the polyfills file, relative to the current workspace.\n\n### preserveSymlinks\n\nDo not use the real path when resolving modules.\n\n### rebaseRootRelativeCssUrls\n\nChange root relative URLs in stylesheets to include base HREF and deploy URL. Use only for compatibility and transition. The behavior of this option is non-standard and will be removed in the next major release.\n\n### resourcesOutputPath\n\nThe path where style resources will be placed, relative to outputPath.\n\n### serviceWorker\n\nGenerates a service worker config for production builds.\n\n### skipAppShell\n\nFlag to prevent building an app shell.\n\n### vendorSourceMap\n\nResolve vendor packages sourcemaps.\n\n### verbose\n\nAdds more details to output logging.\n\n### webWorkerTsConfig\n\nTypeScript configuration for Web Worker modules.\n" + }, + { + "name": "test", + "id": "test", + "file": "generated/cli/test", + "content": "---\ntitle: 'test - CLI command'\ndescription: 'Runs unit tests in a project using the configured unit test runner.'\n---\n\n# test\n\nRuns unit tests in a project using the configured unit test runner.\n\n## Usage\n\nThe `test` command is a built-in alias to the [run command](/cli/run).\n\nThese two commands are equivalent:\n\n```bash\nnx test [options]\n```\n\n```bash\nnx run :test [options]\n```\n\n[Install `nx` globally](/getting-started/nx-setup#install-nx) to invoke the command directly using `nx`, or use `npx nx`, `yarn nx`, or `pnpx nx`.\n\n### Examples\n\nRun unit tests:\n\n```bash\nnx test myapp\n```\n\n## Common Options\n\nThe options below are common to the `test` command used within an Nx workspace. The Jest and Karma-specific test options are listed after these options.\n\n### codeCoverage\n\nIndicates that test coverage information should be collected and reported in the output. (https://jestjs.io/docs/en/cli#coverage)\n\n### tsConfig\n\nThe path to the Typescript configuration file.\n\n### watch\n\nWatch files for changes and rerun tests.\n\n### help\n\nShow help information.\n\n### version\n\nShow version number\n\n## Jest Options\n\n### bail\n\nExit the test suite immediately after `n` number of failing tests. (https://jestjs.io/docs/en/cli#bail)\n\n### ci\n\nWhether to run Jest in continuous integration (CI) mode. This option is on by default in most popular CI environments. It will prevent snapshots from being written unless explicitly requested. (https://jestjs.io/docs/en/cli#ci)\n\n### color\n\nForces test results output color highlighting (even if stdout is not a TTY). Set to false if you would like to have no colors. (https://jestjs.io/docs/en/cli#colors)\n\n### colors\n\nForces test results output highlighting even if stdout is not a TTY. (https://jestjs.io/docs/en/cli#colors)\n\n### coverageReporters\n\nA list of reporter names that Jest uses when writing coverage reports. Any istanbul reporter\n\n### coverageDirectory\n\nAn array of regexp pattern strings that are matched against all file paths before executing the test. If the file path matches any of the patterns, coverage information will be skipped.\n\n### config\n\nThe path to a Jest config file specifying how to find and execute tests. If no rootDir is set in the config, the directory containing the config file is assumed to be the rootDir for the project. This can also be a JSON-encoded value which Jest will use as configuration\n\n### clearCache\n\nDeletes the Jest cache directory and then exits without running tests. Will delete Jest's default cache directory. _Note: clearing the cache will reduce performance_.\n\n### findRelatedTests\n\nFind and run the tests that cover a comma separated list of source files that were passed in as arguments. (https://jestjs.io/docs/en/cli#findrelatedtests-spaceseparatedlistofsourcefiles)\n\n### jestConfig\n\nThe path of the Jest configuration. (https://jestjs.io/docs/en/configuration)\n\n### json\n\nPrints the test results in JSON. This mode will send all other test output and user messages to stderr. (https://jestjs.io/docs/en/cli#json)\n\n### maxWorkers\n\nSpecifies the maximum number of workers the worker-pool will spawn for running tests. This defaults to the number of the cores available on your machine. Useful for CI. (its usually best not to override this default) (https://jestjs.io/docs/en/cli#maxworkers-num)\n\n### onlyChanged\n\nAttempts to identify which tests to run based on which files have changed in the current repository. Only works if you're running tests in a git or hg repository at the moment. (https://jestjs.io/docs/en/cli#onlychanged)\n\n### outputFile\n\nWrite test results to a file when the --json option is also specified. (https://jestjs.io/docs/en/cli#outputfile-filename)\n\n### passWithNoTests\n\nWill not fail if no tests are found (for example while using `--testPathPattern`.) (https://jestjs.io/docs/en/cli#passwithnotests)\n\n### reporters\n\nRun tests with specified reporters. Reporter options are not available via CLI. Example with multiple reporters: jest --reporters=\"default\" --reporters=\"jest-junit\" (https://jestjs.io/docs/en/cli#reporters)\n\n### runInBand\n\nRun all tests serially in the current process (rather than creating a worker pool of child processes that run tests). This is sometimes useful for debugging, but such use cases are pretty rare. Useful for CI. (https://jestjs.io/docs/en/cli#runinband)\n\n### setupFile\n\nThe name of a setup file used by Jest. (https://jestjs.io/docs/en/configuration#setupfilesafterenv-array)\n\n### silent\n\nPrevent tests from printing messages through the console. (https://jestjs.io/docs/en/cli#silent)\n\n### testFile\n\nThe name of the file to test.\n\n### testNamePattern\n\nRun only tests with a name that matches the regex pattern. (https://jestjs.io/docs/en/cli#testnamepattern-regex)\n\n### testPathPattern\n\nAn array of regexp pattern strings that is matched against all tests paths before executing the test. (https://jestjs.io/docs/en/cli#testpathpattern-regex)\n\n### testLocationInResults\n\nAdds a location field to test results. Used to report location of a test in a reporter. { \"column\": 4, \"line\": 5 } (https://jestjs.io/docs/en/cli#testlocationinresults)\n\n### testResultsProcessor\n\nNode module that implements a custom results processor. (https://jestjs.io/docs/en/configuration#testresultsprocessor-string)\n\n### updateSnapshot\n\nUse this flag to re-record snapshots. Can be used together with a test suite pattern or with `--testNamePattern` to re-record snapshot for test matching the pattern. (https://jestjs.io/docs/en/cli#updatesnapshot)\n\n### useStderr\n\nDivert all output to stderr.\n\n### verbose\n\nDisplay individual test results with the test suite hierarchy. (https://jestjs.io/docs/en/cli#verbose)\n\n### watchAll\n\nWatch files for changes and rerun all tests when something changes. If you want to re-run only the tests that depend on the changed files, use the `--watch` option. (https://jestjs.io/docs/en/cli#watchall)\n\n## Karma Options\n\n### browsers\n\nOverride which browsers tests are run against.\n\n### codeCoverage\n\nOutput a code coverage report.\n\n### codeCoverageExclude\n\nGlobs to exclude from code coverage.\n\n### configuration (-c)\n\nA named build target, as specified in the \"configurations\" section of angular.json.\nEach named target is accompanied by a configuration of option defaults for that target.\nSetting this explicitly overrides the `--prod` flag.\n\n### environment\n\nDefines the build environment.\n\n### evalSourceMap\n\nOutput in-file eval sourcemaps.\n\n### help\n\nShows a help message for this command in the console.\n\n### include\n\nGlobs of files to include, relative to workspace or project root.\n\nThere are 2 special cases:\n\n- when a path to directory is provided, all spec files ending \".spec.@(ts|tsx)\" will be included\n- when a path to a file is provided, and a matching spec file exists it will be included instead\n\n### karmaConfig\n\nThe name of the Karma configuration file.\n\n### main\n\nThe name of the main entry-point file.\n\n### poll\n\nEnable and define the file watching poll time period in milliseconds.\n\n### polyfills\n\nThe name of the polyfills file.\n\n### preserveSymlinks\n\nDo not use the real path when resolving modules.\n\n### prod\n\nShorthand for \"--configuration=production\". When true, sets the build configuration to the production target. By default, the production target is set up in the workspace configuration such that all builds make use of bundling, limited tree-shaking, and also limited dead code elimination.\n\n### progress\n\nLog progress to the console while building.\n\n### reporters\n\nKarma reporters to use. Directly passed to the karma runner.\n\n### sourceMap\n\nOutput sourcemaps.\n\n### tsConfig\n\nThe name of the TypeScript configuration file.\n\n### vendorSourceMap\n\nResolve vendor packages sourcemaps.\n\n### watch\n\nRun build when files change.\n\n### webWorkerTsConfig\n\nTypeScript configuration for Web Worker modules.\n" + }, + { + "name": "lint", + "id": "lint", + "file": "generated/cli/lint", + "content": "---\ntitle: 'lint - CLI command'\ndescription: 'Runs linting tools on application code in a given project folder using the configured linter.'\n---\n\n# lint\n\nRuns linting tools on application code in a given project folder using the configured linter.\n\n## Usage\n\nThe `lint` command is a built-in alias to the [run command](/cli/run).\n\nThese two commands are equivalent:\n\n```bash\nnx lint [options]\n```\n\n```bash\nnx run :lint [options]\n```\n\n[Install `nx` globally](/getting-started/nx-setup#install-nx) to invoke the command directly using `nx`, or use `npx nx`, `yarn nx`, or `pnpx nx`.\n\n### Examples\n\nRun lint checks for the `myapp` project and fix linter errors:\n\n```bash\nnx lint myapp --fix\n```\n\n## Common Options\n\nThe options below are common to the `lint` command used within an Nx workspace. The ESLint and Angular-specific lint options are listed after these options.\n\n### exclude\n\nFiles to exclude from linting.\n\n### files\n\nFiles to include in linting.\n\n### fix\n\nFixes linting errors (may overwrite linted files).\n\n### force\n\nSucceeds even if there was linting errors.\n\n### format\n\nESLint Output formatter (https://eslint.org/docs/user-guide/formatters). (default: stylish)\n\n### silent\n\nHide output text.\n\n### tsConfig\n\nThe name of the TypeScript configuration file.\n\n### help\n\nShow help information\n\n### version\n\nShow version number\n\n## ESLint Options\n\n### cache\n\nOnly check changed files.\n\n### cacheLocation\n\nPath to the cache file or directory.\n\n### config\n\nThe name of the configuration file.\n\n### linter\n\nThe tool to use for running lint checks.\n\nDefault: `tslint`\n\n### outputFile\n\nFile to write report to.\n\n## Angular-TSLint Options\n\n### configuration (-c)\n\nThe linting configuration to use.\n\n### tslint-config\n\nThe name of the TSLint configuration file.\n\n### type-check\n\nControls the type check for linting.\n" + }, + { + "name": "e2e", + "id": "e2e", + "file": "generated/cli/e2e", + "content": "---\ntitle: 'e2e - CLI command'\ndescription: 'Builds and serves an app, then runs end-to-end tests using the configured E2E test runner.'\n---\n\n# e2e\n\nBuilds and serves an app, then runs end-to-end tests using the configured E2E test runner.\n\n## Usage\n\nThe `e2e` command is a built-in alias to the [run command](/cli/run).\n\nThese two commands are equivalent:\n\n```bash\nnx e2e \n```\n\n```bash\nnx run :e2e\n```\n\n[Install `nx` globally](/getting-started/nx-setup#install-nx) to invoke the command directly using `nx`, or use `npx nx`, `yarn nx`, or `pnpx nx`.\n\n### Examples\n\nRun E2E test with a custom base url:\n\n```bash\nnx e2e myapp-e2e --base-url http://localhost:4201\n```\n\nRun E2E test with a specific target:\n\n```bash\nnx e2e myapp-e2e --configuration smoke\n```\n\nRun E2E test in watch mode:\n\n```bash\nnx e2e myapp-e2e --watch\n```\n\n## Common Options\n\nThe options below are common to the E2E commands used within an Nx workspace. Cypress and Protractor-specific options are listed below.\n\n### baseUrl\n\nUse this to pass directly the address of your distant server address with the port running your application. Setting this will ignore any local server targets. To skip running local targets, reset the `devServerTarget` to empty string.\n\n### configuration (-c)\n\nA named build target, as specified in the \"configurations\" section of angular.json. Each named target is accompanied by a configuration of option defaults for that target. Setting this explicitly overrides the `--prod` option.\n\n### devServerTarget\n\nDev server target to run tests against.\n\n### prod\n\nShorthand for `--configuration=production`. When true, sets the build configuration to the production target. By default, the production target is set up in the workspace configuration such that all builds make use of bundling, limited tree-shaking, and also limited dead code elimination.\n\n### version\n\nShow version number\n\n### watch\n\nOpen the Cypress test runner & automatically run tests when files are updated\n\n## Cypress Options\n\n### browser\n\nThe browser to run tests in.\n\n### ci-build-id\n\nA unique identifier for a run to enable grouping or parallelization.\n\n### ci-build-id\n\nA unique identifier for a run to enable grouping or parallelization.\n\n### cypress-config\n\nThe path of the Cypress configuration json file.\n\n### exit\n\nWhether or not the Cypress Test Runner will stay open after running tests in a spec file\n\n### group\n\nA named group for recorded runs in the Cypress dashboard.\n\n### headless\n\nWhether or not to open the Cypress application to run the tests. If set to 'true', will run in headless mode.\n\n### help\n\nShows a help message for this command in the console.\n\n### key\n\nThe key cypress should use to run tests in parallel/record the run (CI only).\n\n### parallel\n\nWhether or not Cypress should run its tests in parallel (CI only).\n\n### record\n\nWhether or not Cypress should record the results of the tests\n\n### spec\n\nA comma delimited glob string that is provided to the Cypress runner to specify which spec files to run. For example: '**examples/**,**actions.spec**\n\n### ts-config\n\nThe path of the Cypress tsconfig configuration json file.\n\n## Protractor Options\n\n### element-explorer\n\nStart Protractor's Element Explorer for debugging.\n\n### host\n\nHost to listen on.\n\n### port\n\nThe port to use to serve the application.\n\n### protractor-config\n\nThe name of the Protractor configuration file.\n\n### specs\n\nOverride specs in the protractor config.\n\n### suite\n\nOverride suite in the protractor config.\n\n### webdriver-update\n\nTry to update webdriver.\n" + }, + { + "name": "run", + "id": "run", + "file": "generated/cli/run", + "content": "---\ntitle: 'run - CLI command'\ndescription: 'Runs an Architect target with an optional custom builder configuration defined in your project.'\n---\n\n# run\n\nRuns an Architect target with an optional custom builder configuration defined in your project.\n\n## Usage\n\n```bash\nnx run [options]\n```\n\n[Install `nx` globally](/getting-started/nx-setup#install-nx) to invoke the command directly using `nx`, or use `npx nx`, `yarn nx`, or `pnpx nx`.\n\n### Examples\n\nRun the `build` target for the `myapp` :\n\n```bash\nnx run myapp:build\n```\n\nRun the `build` target for the `myapp` project with a `production` configuration:\n\n```bash\nnx run myapp:build:production\n```\n\n## Options\n\n### configuration (-c)\n\nA named builder configuration, defined in the \"configurations\" section of the workspace configuration file. The builder uses the named configuration to run the given target.\n\n### help\n\nShow help\n\n### version\n\nShow version number\n" + }, + { + "name": "daemon", + "id": "daemon", + "file": "generated/cli/daemon", + "content": "---\ntitle: 'daemon - CLI command'\ndescription: 'Prints information about the Nx Daemon process'\n---\n\n# daemon\n\nPrints information about the Nx Daemon process\n\n## Usage\n\n```bash\nnx daemon\n```\n\n[Install `nx` globally](/getting-started/nx-setup#install-nx) to invoke the command directly using `nx`, or use `npx nx`, `yarn nx`, or `pnpx nx`.\n\n## Options\n\n### background\n\nType: boolean\n\nDefault: true\n\n### help\n\nType: boolean\n\nShow help\n\n### version\n\nType: boolean\n\nShow version number\n" + }, + { + "name": "graph", + "id": "dep-graph", + "file": "generated/cli/graph", + "content": "---\ntitle: 'graph - CLI command'\ndescription: 'Graph dependencies within workspace'\n---\n\n# graph\n\nGraph dependencies within workspace\n\n## Usage\n\n```bash\nnx graph\n```\n\n[Install `nx` globally](/getting-started/nx-setup#install-nx) to invoke the command directly using `nx`, or use `npx nx`, `yarn nx`, or `pnpx nx`.\n\n### Examples\n\nOpen the project graph of the workspace in the browser:\n\n```bash\nnx graph\n```\n\nSave the project graph into a json file:\n\n```bash\nnx graph --file=output.json\n```\n\nGenerate a static website with project graph into an html file, accompanied by an asset folder called static:\n\n```bash\nnx graph --file=output.html\n```\n\nShow the graph where every node is either an ancestor or a descendant of todos-feature-main:\n\n```bash\nnx graph --focus=todos-feature-main\n```\n\nInclude project-one and project-two in the project graph:\n\n```bash\nnx graph --include=project-one,project-two\n```\n\nExclude project-one and project-two from the project graph:\n\n```bash\nnx graph --exclude=project-one,project-two\n```\n\nShow the graph where every node is either an ancestor or a descendant of todos-feature-main, but exclude project-one and project-two:\n\n```bash\nnx graph --focus=todos-feature-main --exclude=project-one,project-two\n```\n\nWatch for changes to project graph and update in-browser:\n\n```bash\nnx graph --watch\n```\n\n## Options\n\n### exclude\n\nType: array\n\nList of projects delimited by commas to exclude from the project graph.\n\n### file\n\nType: string\n\nOutput file (e.g. --file=output.json or --file=dep-graph.html)\n\n### focus\n\nType: string\n\nUse to show the project graph for a particular project and every node that is either an ancestor or a descendant.\n\n### groupByFolder\n\nType: boolean\n\nGroup projects by folder in the project graph\n\n### help\n\nType: boolean\n\nShow help\n\n### host\n\nType: string\n\nBind the project graph server to a specific ip address.\n\n### open\n\nType: boolean\n\nDefault: true\n\nOpen the project graph in the browser.\n\n### port\n\nType: number\n\nBind the project graph server to a specific port.\n\n### version\n\nType: boolean\n\nShow version number\n\n### watch\n\nType: boolean\n\nDefault: false\n\nWatch for changes to project graph and update in-browser\n" + }, + { + "name": "run-many", + "id": "run-many", + "file": "generated/cli/run-many", + "content": "---\ntitle: 'run-many - CLI command'\ndescription: 'Run target for multiple listed projects'\n---\n\n# run-many\n\nRun target for multiple listed projects\n\n## Usage\n\n```bash\nnx run-many\n```\n\n[Install `nx` globally](/getting-started/nx-setup#install-nx) to invoke the command directly using `nx`, or use `npx nx`, `yarn nx`, or `pnpx nx`.\n\n### Examples\n\nTest all projects:\n\n```bash\nnx run-many --target=test --all\n```\n\nTest proj1 and proj2:\n\n```bash\nnx run-many --target=test --projects=proj1,proj2\n```\n\nTest proj1 and proj2 in parallel:\n\n```bash\nnx run-many --target=test --projects=proj1,proj2 --parallel=2\n```\n\n## Options\n\n### all\n\nType: boolean\n\nRun the target on all projects in the workspace\n\n### configuration\n\nType: string\n\nThis is the configuration to use when performing tasks on projects\n\n### exclude\n\nType: array\n\nDefault: []\n\nExclude certain projects from being processed\n\n### help\n\nType: boolean\n\nShow help\n\n### ~~only-failed~~\n\nType: boolean\n\nDefault: false\n\n**Deprecated:** The command to rerun failed projects will appear if projects fail. This now does nothing and will be removed in v15.\n\nOnly run the target on projects which previously failed\n\n### output-style\n\nType: string\n\nChoices: [dynamic, static, stream]\n\nDefines how Nx emits outputs tasks logs\n\n### parallel\n\nType: string\n\nMax number of parallel processes [default is 3]\n\n### projects\n\nType: string\n\nProjects to run (comma delimited)\n\n### runner\n\nType: string\n\nOverride the tasks runner in `nx.json`\n\n### skip-nx-cache\n\nType: boolean\n\nDefault: false\n\nRerun the tasks even when the results are available in the cache\n\n### target\n\nType: string\n\nTask to run for affected projects\n\n### verbose\n\nPrint additional error stack trace on failure\n\n### version\n\nType: boolean\n\nShow version number\n" + }, + { + "name": "affected", + "id": "affected", + "file": "generated/cli/affected", + "content": "---\ntitle: 'affected - CLI command'\ndescription: 'Run target for affected projects'\n---\n\n# affected\n\nRun target for affected projects\n\n## Usage\n\n```bash\nnx affected\n```\n\n[Install `nx` globally](/getting-started/nx-setup#install-nx) to invoke the command directly using `nx`, or use `npx nx`, `yarn nx`, or `pnpx nx`.\n\n### Examples\n\nRun custom target for all affected projects:\n\n```bash\nnx affected --target=custom-target\n```\n\nRun tests in parallel:\n\n```bash\nnx affected --target=test --parallel=5\n```\n\nRun the test target for all projects:\n\n```bash\nnx affected --target=test --all\n```\n\nRun tests for all the projects affected by changing the index.ts file:\n\n```bash\nnx affected --target=test --files=libs/mylib/src/index.ts\n```\n\nRun tests for all the projects affected by the changes between main and HEAD (e.g., PR):\n\n```bash\nnx affected --target=test --base=main --head=HEAD\n```\n\nRun tests for all the projects affected by the last commit on main:\n\n```bash\nnx affected --target=test --base=main~1 --head=main\n```\n\n## Options\n\n### all\n\nType: boolean\n\nAll projects\n\n### base\n\nType: string\n\nBase of the current branch (usually main)\n\n### configuration\n\nType: string\n\nThis is the configuration to use when performing tasks on projects\n\n### exclude\n\nType: array\n\nDefault: []\n\nExclude certain projects from being processed\n\n### files\n\nType: array\n\nChange the way Nx is calculating the affected command by providing directly changed files, list of files delimited by commas\n\n### head\n\nType: string\n\nLatest commit of the current branch (usually HEAD)\n\n### help\n\nType: boolean\n\nShow help\n\n### ~~only-failed~~\n\nType: boolean\n\nDefault: false\n\n**Deprecated:** The command to rerun failed projects will appear if projects fail. This now does nothing and will be removed in v15.\n\nIsolate projects which previously failed\n\n### output-style\n\nType: string\n\nChoices: [dynamic, static, stream]\n\nDefines how Nx emits outputs tasks logs\n\n### parallel\n\nType: string\n\nMax number of parallel processes [default is 3]\n\n### runner\n\nType: string\n\nThis is the name of the tasks runner configured in nx.json\n\n### skip-nx-cache\n\nType: boolean\n\nDefault: false\n\nRerun the tasks even when the results are available in the cache\n\n### target\n\nType: string\n\nTask to run for affected projects\n\n### uncommitted\n\nType: boolean\n\nUncommitted changes\n\n### untracked\n\nType: boolean\n\nUntracked changes\n\n### verbose\n\nPrint additional error stack trace on failure\n\n### version\n\nType: boolean\n\nShow version number\n" + }, + { + "name": "affected:graph", + "id": "affected-dep-graph", + "file": "generated/cli/affected-graph", + "content": "---\ntitle: 'affected:graph - CLI command'\ndescription: 'Graph dependencies affected by changes'\n---\n\n# affected:graph\n\nGraph dependencies affected by changes\n\n## Usage\n\n```bash\nnx affected:graph\n```\n\n[Install `nx` globally](/getting-started/nx-setup#install-nx) to invoke the command directly using `nx`, or use `npx nx`, `yarn nx`, or `pnpx nx`.\n\n### Examples\n\nOpen the project graph of the workspace in the browser, and highlight the projects affected by changing the index.ts file:\n\n```bash\nnx affected:graph --files=libs/mylib/src/index.ts\n```\n\nOpen the project graph of the workspace in the browser, and highlight the projects affected by the changes between main and HEAD (e.g., PR):\n\n```bash\nnx affected:graph --base=main --head=HEAD\n```\n\nSave the project graph of the workspace in a json file, and highlight the projects affected by the changes between main and HEAD (e.g., PR):\n\n```bash\nnx affected:graph --base=main --head=HEAD --file=output.json\n```\n\nGenerate a static website with project graph data in an html file, highlighting the projects affected by the changes between main and HEAD (e.g., PR):\n\n```bash\nnx affected:graph --base=main --head=HEAD --file=output.html\n```\n\nOpen the project graph of the workspace in the browser, and highlight the projects affected by the last commit on main:\n\n```bash\nnx affected:graph --base=main~1 --head=main\n```\n\nOpen the project graph of the workspace in the browser, highlight the projects affected, but exclude project-one and project-two:\n\n```bash\nnx affected:graph --exclude=project-one,project-two\n```\n\n## Options\n\n### all\n\nType: boolean\n\nAll projects\n\n### base\n\nType: string\n\nBase of the current branch (usually main)\n\n### configuration\n\nType: string\n\nThis is the configuration to use when performing tasks on projects\n\n### exclude\n\nType: array\n\nDefault: []\n\nExclude certain projects from being processed\n\n### file\n\nType: string\n\nOutput file (e.g. --file=output.json or --file=dep-graph.html)\n\n### files\n\nType: array\n\nChange the way Nx is calculating the affected command by providing directly changed files, list of files delimited by commas\n\n### focus\n\nType: string\n\nUse to show the project graph for a particular project and every node that is either an ancestor or a descendant.\n\n### groupByFolder\n\nType: boolean\n\nGroup projects by folder in the project graph\n\n### head\n\nType: string\n\nLatest commit of the current branch (usually HEAD)\n\n### help\n\nType: boolean\n\nShow help\n\n### host\n\nType: string\n\nBind the project graph server to a specific ip address.\n\n### ~~only-failed~~\n\nType: boolean\n\nDefault: false\n\n**Deprecated:** The command to rerun failed projects will appear if projects fail. This now does nothing and will be removed in v15.\n\nIsolate projects which previously failed\n\n### open\n\nType: boolean\n\nDefault: true\n\nOpen the project graph in the browser.\n\n### port\n\nType: number\n\nBind the project graph server to a specific port.\n\n### runner\n\nType: string\n\nThis is the name of the tasks runner configured in nx.json\n\n### skip-nx-cache\n\nType: boolean\n\nDefault: false\n\nRerun the tasks even when the results are available in the cache\n\n### uncommitted\n\nType: boolean\n\nUncommitted changes\n\n### untracked\n\nType: boolean\n\nUntracked changes\n\n### verbose\n\nPrint additional error stack trace on failure\n\n### version\n\nType: boolean\n\nShow version number\n\n### watch\n\nType: boolean\n\nDefault: false\n\nWatch for changes to project graph and update in-browser\n" + }, + { + "name": "affected:apps", + "id": "affected-apps", + "file": "generated/cli/affected-apps", + "content": "---\ntitle: 'affected:apps - CLI command'\ndescription: 'Print applications affected by changes'\n---\n\n# affected:apps\n\nPrint applications affected by changes\n\n## Usage\n\n```bash\nnx affected:apps\n```\n\n[Install `nx` globally](/getting-started/nx-setup#install-nx) to invoke the command directly using `nx`, or use `npx nx`, `yarn nx`, or `pnpx nx`.\n\n### Examples\n\nPrint the names of all the apps affected by changing the index.ts file:\n\n```bash\nnx affected:apps --files=libs/mylib/src/index.ts\n```\n\nPrint the names of all the apps affected by the changes between main and HEAD (e.g., PR):\n\n```bash\nnx affected:apps --base=main --head=HEAD\n```\n\nPrint the names of all the apps affected by the last commit on main:\n\n```bash\nnx affected:apps --base=main~1 --head=main\n```\n\n## Options\n\n### all\n\nType: boolean\n\nAll projects\n\n### base\n\nType: string\n\nBase of the current branch (usually main)\n\n### configuration\n\nType: string\n\nThis is the configuration to use when performing tasks on projects\n\n### exclude\n\nType: array\n\nDefault: []\n\nExclude certain projects from being processed\n\n### files\n\nType: array\n\nChange the way Nx is calculating the affected command by providing directly changed files, list of files delimited by commas\n\n### head\n\nType: string\n\nLatest commit of the current branch (usually HEAD)\n\n### help\n\nType: boolean\n\nShow help\n\n### ~~only-failed~~\n\nType: boolean\n\nDefault: false\n\n**Deprecated:** The command to rerun failed projects will appear if projects fail. This now does nothing and will be removed in v15.\n\nIsolate projects which previously failed\n\n### plain\n\nProduces a plain output for affected:apps and affected:libs\n\n### runner\n\nType: string\n\nThis is the name of the tasks runner configured in nx.json\n\n### skip-nx-cache\n\nType: boolean\n\nDefault: false\n\nRerun the tasks even when the results are available in the cache\n\n### uncommitted\n\nType: boolean\n\nUncommitted changes\n\n### untracked\n\nType: boolean\n\nUntracked changes\n\n### verbose\n\nPrint additional error stack trace on failure\n\n### version\n\nType: boolean\n\nShow version number\n" + }, + { + "name": "affected:libs", + "id": "affected-libs", + "file": "generated/cli/affected-libs", + "content": "---\ntitle: 'affected:libs - CLI command'\ndescription: 'Print libraries affected by changes'\n---\n\n# affected:libs\n\nPrint libraries affected by changes\n\n## Usage\n\n```bash\nnx affected:libs\n```\n\n[Install `nx` globally](/getting-started/nx-setup#install-nx) to invoke the command directly using `nx`, or use `npx nx`, `yarn nx`, or `pnpx nx`.\n\n### Examples\n\nPrint the names of all the libs affected by changing the index.ts file:\n\n```bash\nnx affected:libs --files=libs/mylib/src/index.ts\n```\n\nPrint the names of all the libs affected by the changes between main and HEAD (e.g., PR):\n\n```bash\nnx affected:libs --base=main --head=HEAD\n```\n\nPrint the names of all the libs affected by the last commit on main:\n\n```bash\nnx affected:libs --base=main~1 --head=main\n```\n\n## Options\n\n### all\n\nType: boolean\n\nAll projects\n\n### base\n\nType: string\n\nBase of the current branch (usually main)\n\n### configuration\n\nType: string\n\nThis is the configuration to use when performing tasks on projects\n\n### exclude\n\nType: array\n\nDefault: []\n\nExclude certain projects from being processed\n\n### files\n\nType: array\n\nChange the way Nx is calculating the affected command by providing directly changed files, list of files delimited by commas\n\n### head\n\nType: string\n\nLatest commit of the current branch (usually HEAD)\n\n### help\n\nType: boolean\n\nShow help\n\n### ~~only-failed~~\n\nType: boolean\n\nDefault: false\n\n**Deprecated:** The command to rerun failed projects will appear if projects fail. This now does nothing and will be removed in v15.\n\nIsolate projects which previously failed\n\n### plain\n\nProduces a plain output for affected:apps and affected:libs\n\n### runner\n\nType: string\n\nThis is the name of the tasks runner configured in nx.json\n\n### skip-nx-cache\n\nType: boolean\n\nDefault: false\n\nRerun the tasks even when the results are available in the cache\n\n### uncommitted\n\nType: boolean\n\nUncommitted changes\n\n### untracked\n\nType: boolean\n\nUntracked changes\n\n### verbose\n\nPrint additional error stack trace on failure\n\n### version\n\nType: boolean\n\nShow version number\n" + }, + { + "name": "print-affected", + "id": "print-affected", + "file": "generated/cli/print-affected", + "content": "---\ntitle: 'print-affected - CLI command'\ndescription: 'Prints information about the projects and targets affected by changes'\n---\n\n# print-affected\n\nPrints information about the projects and targets affected by changes\n\n## Usage\n\n```bash\nnx print-affected\n```\n\n[Install `nx` globally](/getting-started/nx-setup#install-nx) to invoke the command directly using `nx`, or use `npx nx`, `yarn nx`, or `pnpx nx`.\n\n### Examples\n\nPrint information about affected projects and the project graph:\n\n```bash\nnx print-affected\n```\n\nPrint information about the projects affected by the changes between main and HEAD (e.g,. PR):\n\n```bash\nnx print-affected --base=main --head=HEAD\n```\n\nPrints information about the affected projects and a list of tasks to test them:\n\n```bash\nnx print-affected --target=test\n```\n\nPrints the projects property from the print-affected output:\n\n```bash\nnx print-affected --target=build --select=projects\n```\n\nPrints the tasks.target.project property from the print-affected output:\n\n```bash\nnx print-affected --target=build --select=tasks.target.project\n```\n\n## Options\n\n### all\n\nType: boolean\n\nAll projects\n\n### base\n\nType: string\n\nBase of the current branch (usually main)\n\n### configuration\n\nType: string\n\nThis is the configuration to use when performing tasks on projects\n\n### exclude\n\nType: array\n\nDefault: []\n\nExclude certain projects from being processed\n\n### files\n\nType: array\n\nChange the way Nx is calculating the affected command by providing directly changed files, list of files delimited by commas\n\n### head\n\nType: string\n\nLatest commit of the current branch (usually HEAD)\n\n### help\n\nType: boolean\n\nShow help\n\n### ~~only-failed~~\n\nType: boolean\n\nDefault: false\n\n**Deprecated:** The command to rerun failed projects will appear if projects fail. This now does nothing and will be removed in v15.\n\nIsolate projects which previously failed\n\n### runner\n\nType: string\n\nThis is the name of the tasks runner configured in nx.json\n\n### select\n\nType: string\n\nSelect the subset of the returned json document (e.g., --selected=projects)\n\n### skip-nx-cache\n\nType: boolean\n\nDefault: false\n\nRerun the tasks even when the results are available in the cache\n\n### uncommitted\n\nType: boolean\n\nUncommitted changes\n\n### untracked\n\nType: boolean\n\nUntracked changes\n\n### verbose\n\nPrint additional error stack trace on failure\n\n### version\n\nType: boolean\n\nShow version number\n" + }, + { + "name": "format:check", + "id": "format-check", + "file": "generated/cli/format-check", + "content": "---\ntitle: 'format:check - CLI command'\ndescription: 'Check for un-formatted files'\n---\n\n# format:check\n\nCheck for un-formatted files\n\n## Usage\n\n```bash\nnx format:check\n```\n\n[Install `nx` globally](/getting-started/nx-setup#install-nx) to invoke the command directly using `nx`, or use `npx nx`, `yarn nx`, or `pnpx nx`.\n\n## Options\n\n### all\n\nType: boolean\n\nAll projects\n\n### base\n\nType: string\n\nBase of the current branch (usually main)\n\n### configuration\n\nType: string\n\nThis is the configuration to use when performing tasks on projects\n\n### exclude\n\nType: array\n\nDefault: []\n\nExclude certain projects from being processed\n\n### files\n\nType: array\n\nChange the way Nx is calculating the affected command by providing directly changed files, list of files delimited by commas\n\n### head\n\nType: string\n\nLatest commit of the current branch (usually HEAD)\n\n### help\n\nType: boolean\n\nShow help\n\n### libs-and-apps\n\nType: boolean\n\nFormat only libraries and applications files.\n\n### ~~only-failed~~\n\nType: boolean\n\nDefault: false\n\n**Deprecated:** The command to rerun failed projects will appear if projects fail. This now does nothing and will be removed in v15.\n\nIsolate projects which previously failed\n\n### projects\n\nType: array\n\nProjects to format (comma delimited)\n\n### runner\n\nType: string\n\nThis is the name of the tasks runner configured in nx.json\n\n### skip-nx-cache\n\nType: boolean\n\nDefault: false\n\nRerun the tasks even when the results are available in the cache\n\n### uncommitted\n\nType: boolean\n\nUncommitted changes\n\n### untracked\n\nType: boolean\n\nUntracked changes\n\n### verbose\n\nPrint additional error stack trace on failure\n\n### version\n\nType: boolean\n\nShow version number\n" + }, + { + "name": "format:write", + "id": "format-write", + "file": "generated/cli/format-write", + "content": "---\ntitle: 'format:write - CLI command'\ndescription: 'Overwrite un-formatted files'\n---\n\n# format:write\n\nOverwrite un-formatted files\n\n## Usage\n\n```bash\nnx format:write\n```\n\n[Install `nx` globally](/getting-started/nx-setup#install-nx) to invoke the command directly using `nx`, or use `npx nx`, `yarn nx`, or `pnpx nx`.\n\n## Options\n\n### all\n\nType: boolean\n\nAll projects\n\n### base\n\nType: string\n\nBase of the current branch (usually main)\n\n### configuration\n\nType: string\n\nThis is the configuration to use when performing tasks on projects\n\n### exclude\n\nType: array\n\nDefault: []\n\nExclude certain projects from being processed\n\n### files\n\nType: array\n\nChange the way Nx is calculating the affected command by providing directly changed files, list of files delimited by commas\n\n### head\n\nType: string\n\nLatest commit of the current branch (usually HEAD)\n\n### help\n\nType: boolean\n\nShow help\n\n### libs-and-apps\n\nType: boolean\n\nFormat only libraries and applications files.\n\n### ~~only-failed~~\n\nType: boolean\n\nDefault: false\n\n**Deprecated:** The command to rerun failed projects will appear if projects fail. This now does nothing and will be removed in v15.\n\nIsolate projects which previously failed\n\n### projects\n\nType: array\n\nProjects to format (comma delimited)\n\n### runner\n\nType: string\n\nThis is the name of the tasks runner configured in nx.json\n\n### skip-nx-cache\n\nType: boolean\n\nDefault: false\n\nRerun the tasks even when the results are available in the cache\n\n### uncommitted\n\nType: boolean\n\nUncommitted changes\n\n### untracked\n\nType: boolean\n\nUntracked changes\n\n### verbose\n\nPrint additional error stack trace on failure\n\n### version\n\nType: boolean\n\nShow version number\n" + }, + { + "name": "migrate", + "id": "migrate", + "file": "generated/cli/migrate", + "content": "---\ntitle: \"migrate - CLI command\"\ndescription: \"Creates a migrations file or runs migrations from the migrations file.\n- Migrate packages and create migrations.json (e.g., nx migrate @nrwl/workspace@latest)\n- Run migrations (e.g., nx migrate --run-migrations=migrations.json)\"\n---\n\n# migrate\n\nCreates a migrations file or runs migrations from the migrations file.\n\n- Migrate packages and create migrations.json (e.g., nx migrate @nrwl/workspace@latest)\n- Run migrations (e.g., nx migrate --run-migrations=migrations.json)\n\n## Usage\n\n```bash\nnx migrate [packageAndVersion]\n```\n\n[Install `nx` globally](/getting-started/nx-setup#install-nx) to invoke the command directly using `nx`, or use `npx nx`, `yarn nx`, or `pnpx nx`.\n\n### Examples\n\nUpdate @nrwl/workspace to \"next\". This will update other packages and will generate migrations.json:\n\n```bash\nnx migrate next\n```\n\nUpdate @nrwl/workspace to \"9.0.0\". This will update other packages and will generate migrations.json:\n\n```bash\nnx migrate 9.0.0\n```\n\nUpdate @nrwl/workspace and generate the list of migrations starting with version 8.0.0 of @nrwl/workspace and @nrwl/node, regardless of what installed locally:\n\n```bash\nnx migrate @nrwl/workspace@9.0.0 --from=\"@nrwl/workspace@8.0.0,@nrwl/node@8.0.0\"\n```\n\nUpdate @nrwl/workspace to \"9.0.0\". If it tries to update @nrwl/react or @nrwl/angular, use version \"9.0.1\":\n\n```bash\nnx migrate @nrwl/workspace@9.0.0 --to=\"@nrwl/react@9.0.1,@nrwl/angular@9.0.1\"\n```\n\nUpdate another-package to \"12.0.0\". This will update other packages and will generate migrations.json file:\n\n```bash\nnx migrate another-package@12.0.0\n```\n\nRun migrations from the provided migrations.json file. You can modify migrations.json and run this command many times:\n\n```bash\nnx migrate --run-migrations=migrations.json\n```\n\nCreate a dedicated commit for each successfully completed migration. You can customize the prefix used for each commit by additionally setting --commit-prefix=\"PREFIX_HERE \":\n\n```bash\nnx migrate --run-migrations --create-commits\n```\n\n## Options\n\n### commitPrefix\n\nType: string\n\nDefault: chore: [nx migration]\n\nCommit prefix to apply to the commit for each migration, when --create-commits is enabled\n\n### createCommits\n\nType: boolean\n\nDefault: false\n\nAutomatically create a git commit after each migration runs\n\n### from\n\nType: string\n\nUse the provided versions for packages instead of the ones installed in node_modules (e.g., --from=\"@nrwl/react:12.0.0,@nrwl/js:12.0.0\")\n\n### help\n\nType: boolean\n\nShow help\n\n### packageAndVersion\n\nType: string\n\nThe target package and version (e.g, @nrwl/workspace@13.0.0)\n\n### runMigrations\n\nType: string\n\nExecute migrations from a file (when the file isn't provided, execute migrations from migrations.json)\n\n### to\n\nType: string\n\nUse the provided versions for packages instead of the ones calculated by the migrator (e.g., --to=\"@nrwl/react:12.0.0,@nrwl/js:12.0.0\")\n\n### version\n\nType: boolean\n\nShow version number\n" + }, + { + "name": "report", + "id": "report", + "file": "generated/cli/report", + "content": "---\ntitle: 'report - CLI command'\ndescription: 'Reports useful version numbers to copy into the Nx issue template'\n---\n\n# report\n\nReports useful version numbers to copy into the Nx issue template\n\n## Usage\n\n```bash\nnx report\n```\n\n[Install `nx` globally](/getting-started/nx-setup#install-nx) to invoke the command directly using `nx`, or use `npx nx`, `yarn nx`, or `pnpx nx`.\n" + }, + { + "name": "list", + "id": "list", + "file": "generated/cli/list", + "content": "---\ntitle: 'list - CLI command'\ndescription: 'Lists installed plugins, capabilities of installed plugins and other available plugins.'\n---\n\n# list\n\nLists installed plugins, capabilities of installed plugins and other available plugins.\n\n## Usage\n\n```bash\nnx list [plugin]\n```\n\n[Install `nx` globally](/getting-started/nx-setup#install-nx) to invoke the command directly using `nx`, or use `npx nx`, `yarn nx`, or `pnpx nx`.\n\n### Examples\n\nList the plugins installed in the current workspace:\n\n```bash\nnx list\n```\n\nList the generators and executors available in the `@nrwl/web` plugin if it is installed (If the plugin is not installed `nx` will show advice on how to add it to your workspace):\n\n```bash\nnx list @nrwl/web\n```\n\n## Options\n\n### help\n\nType: boolean\n\nShow help\n\n### plugin\n\nType: string\n\nThe name of an installed plugin to query\n\n### version\n\nType: boolean\n\nShow version number\n" + }, + { + "name": "workspace-lint", + "id": "workspace-lint", + "file": "generated/cli/workspace-lint", + "content": "---\ntitle: 'workspace-lint - CLI command'\ndescription: 'Lint nx specific workspace files (nx.json, workspace.json)'\n---\n\n# workspace-lint\n\nLint nx specific workspace files (nx.json, workspace.json)\n\n## Usage\n\n```bash\nnx workspace-lint [files..]\n```\n\n[Install `nx` globally](/getting-started/nx-setup#install-nx) to invoke the command directly using `nx`, or use `npx nx`, `yarn nx`, or `pnpx nx`.\n" + }, + { + "name": "workspace-generator", + "id": "workspace-generator", + "file": "generated/cli/workspace-generator", + "content": "---\ntitle: 'workspace-generator - CLI command'\ndescription: 'Runs a workspace generator from the tools/generators directory'\n---\n\n# workspace-generator\n\nRuns a workspace generator from the tools/generators directory\n\n## Usage\n\n```bash\nnx workspace-generator [name]\n```\n\n[Install `nx` globally](/getting-started/nx-setup#install-nx) to invoke the command directly using `nx`, or use `npx nx`, `yarn nx`, or `pnpx nx`.\n\n## Options\n\n### help\n\nType: boolean\n\nShow help\n\n### list-generators\n\nType: boolean\n\nList the available workspace-generators\n\n### name\n\nType: string\n\nThe name of your generator\n\n### version\n\nType: boolean\n\nShow version number\n" + }, + { + "name": "connect-to-nx-cloud", + "id": "connect-to-nx-cloud", + "file": "generated/cli/connect-to-nx-cloud", + "content": "---\ntitle: 'connect-to-nx-cloud - CLI command'\ndescription: 'Makes sure the workspace is connected to Nx Cloud'\n---\n\n# connect-to-nx-cloud\n\nMakes sure the workspace is connected to Nx Cloud\n\n## Usage\n\n```bash\nnx connect-to-nx-cloud\n```\n\n[Install `nx` globally](/getting-started/nx-setup#install-nx) to invoke the command directly using `nx`, or use `npx nx`, `yarn nx`, or `pnpx nx`.\n\n## Options\n\n### help\n\nType: boolean\n\nShow help\n\n### version\n\nType: boolean\n\nShow version number\n" + }, + { + "name": "reset", + "id": "reset", + "file": "generated/cli/reset", + "content": "---\ntitle: 'reset - CLI command'\ndescription: 'Clears all the cached Nx artifacts and metadata about the workspace and shuts down the Nx Daemon.'\n---\n\n# reset\n\nClears all the cached Nx artifacts and metadata about the workspace and shuts down the Nx Daemon.\n\n## Usage\n\n```bash\nnx reset\n```\n\n[Install `nx` globally](/getting-started/nx-setup#install-nx) to invoke the command directly using `nx`, or use `npx nx`, `yarn nx`, or `pnpx nx`.\n" + } + ], "generators": [], "executors": [] } diff --git a/docs/generated/packages/cypress.json b/docs/generated/packages/cypress.json index f1a1a53515..d5ae36477d 100644 --- a/docs/generated/packages/cypress.json +++ b/docs/generated/packages/cypress.json @@ -8,6 +8,7 @@ { "name": "Overview", "id": "overview", + "path": "/packages/cypress", "file": "shared/cypress-plugin", "content": "![Cypress logo](/shared/cypress-logo.png)\n\nCypress is an e2e test runner built for modern web. It has a lot of great features:\n\n- Time travel\n- Real-time reloads\n- Automatic waiting\n- Spies, stubs, and clocks\n- Network traffic control\n- Screenshots and videos\n\n## Setting Up Cypress\n\n### Generating Applications\n\nBy default, when creating a new frontend application, Nx will use Cypress to create the e2e tests project.\n\n```bash\nnx g @nrwl/web:app frontend\n```\n\n### Creating a Cypress E2E project for an existing project\n\nYou can create a new Cypress E2E project for an existing project.\n\nIf the `@nrwl/cypress` package is not installed, install the version that matches your `@nrwl/workspace` version.\n\n```bash\nyarn add --dev @nrwl/cypress\n```\n\n```bash\nnpm install --save-dev @nrwl/cypress\n```\n\nNext, generate an E2E project based on an existing project.\n\n```bash\nnx g @nrwl/cypress:cypress-project your-app-name-e2e --project=your-app-name\n```\n\nReplace `your-app-name` with the app's name as defined in your `workspace.json` file.\n\n## Using Cypress\n\n### Testing Applications\n\nSimply run `nx e2e frontend-e2e` to execute e2e tests with Cypress.\n\nBy default, Cypress will run in headless mode. You will have the result of all the tests and errors (if any) in your terminal. Screenshots and videos will be accessible in `dist/apps/frontend/screenshots` and `dist/apps/frontend/videos`.\n\n### Watching for Changes\n\nWith, `nx e2e frontend-e2e --watch` Cypress will start in the application mode.\n\nRunning Cypress with `--watch` is a great way to enhance dev workflow - you can build up test files with the application running and Cypress will re-run those tests as you enhance and add to the suite.\n\nCypress doesn't currently re-run your tests after changes are made to application code when it runs in “headed” mode.\n\n### Using Cypress in the Headed Mode\n\nYou can run Cypress in headed mode to see your app being tested. To do this, pass in the `--watch` option. E.g: `nx frontend-e2e --watch`\n\n### Testing Against Prod Build\n\nYou can run your e2e test against a production build like this: `nx e2e frontend-e2e --prod`.\n\n## Configuration\n\n### Specifying a Custom Url to Test\n\nThe `baseUrl` property provides you the ability to test an application hosted on a specific domain.\n\n```bash\nnx e2e frontend-e2e --baseUrl=https://frontend.com\n```\n\n> If no `baseUrl` and no `devServerTarget` are provided, Cypress will expect to have the `baseUrl` property in the `cypress.json` file, or will error.\n\n### Using cypress.json\n\nIf you need to fine tune your Cypress setup, you can do so by modifying `cypress.json` in the e2e project. For instance, you can easily add your `projectId` to save all the screenshots and videos into your Cypress dashboard. The complete configuration is documented on [the official website](https://docs.cypress.io/guides/references/configuration.html#Options).\n\n## More Documentation\n\nReact Nx Tutorial\n\n- [Step 2: Add E2E Tests](/react-tutorial/02-add-e2e-test)\n- [Step 3: Display Todos](/react-tutorial/03-display-todos)\n\nAngular Nx Tutorial\n\n- [Step 2: Add E2E Tests](/angular-tutorial/02-add-e2e-test)\n- [Step 3: Display Todos](/angular-tutorial/03-display-todos)\n" } diff --git a/docs/generated/packages/detox.json b/docs/generated/packages/detox.json index c54ee747af..888a5c0196 100644 --- a/docs/generated/packages/detox.json +++ b/docs/generated/packages/detox.json @@ -8,6 +8,7 @@ { "id": "overview", "name": "Overview", + "path": "/packages/detox", "file": "shared/detox-plugin", "content": "![Detox logo](/shared/detox-logo.png)\n\nDetox is gray box end-to-end testing and automation library for mobile apps. It has a lot of great features:\n\n- Cross Platform\n- Runs on Devices\n- Automatically Synchronized\n- Test Runner Independent\n- Debuggable\n\n## Setting Up Detox\n\n### Install applesimutils (Mac only)\n\n[applesimutils](https://github.com/wix/AppleSimulatorUtils) is a collection of utils for Apple simulators.\n\n```sh\nbrew tap wix/brew\nbrew install applesimutils\n```\n\n### Install Jest Globally\n\n```sh\nnpm install -g jest\n```\n\n### Generating Applications\n\nBy default, when creating a mobile application, Nx will use Detox to create the e2e tests project.\n\n```bash\nnx g @nrwl/react-native:app frontend\n```\n\n### Creating a Detox E2E project for an existing project\n\nYou can create a new Detox E2E project for an existing mobile project.\n\nIf the `@nrwl/detox` package is not installed, install the version that matches your `@nrwl/workspace` version.\n\n```sh\n# yarn\nyarn add --dev @nrwl/detox\n```\n\n```sh\n# npm\nnpm install --save-dev @nrwl/detox\n```\n\nNext, generate an E2E project based on an existing project.\n\n```sh\nnx g @nrwl/detox:app your-app-name-e2e --project=your-app-name\n```\n\nReplace `your-app-name` with the app's name as defined in your `workspace.json` file.\n\nIn addition, you need to follow [instructions at Detox](https://github.com/wix/Detox/blob/master/docs/Introduction.Android.md) to do manual setup for Android files.\n\n## Using Detox\n\n### Testing Applications\n\n- Run `nx test-ios frontend-e2e` to build the iOS app and execute e2e tests with Detox for iOS (Mac only)\n- Run `nx test-android frontend-e2e` to build the Android app and execute e2e tests with Detox for Android\n\nYou can run below commands:\n\n- `nx build-ios frontend-e2e`: build the iOS app (Mac only)\n- `nx build-android frontend-e2e`: build the Android app\n\n### Testing against Prod Build\n\nYou can run your e2e test against a production build:\n\n- `nx test-ios frontend-e2e --prod`: to build the iOS app and execute e2e tests with Detox for iOS with Release configuration (Mac only)\n- `nx test-android frontend-e2e`: rto build the Android app and execute e2e tests with Detox for Android with release build type\n- `nx build-ios frontend-e2e --prod`: build the iOS app using Release configuration (Mac only)\n- `nx build-android frontend-e2e --prod`: build the Android app using release build type\n\n## Configuration\n\n### Using .detoxrc.json\n\nIf you need to fine tune your Detox setup, you can do so by modifying `.detoxrc.json` in the e2e project.\n\n#### Change Testing Simulator/Emulator\n\nFor iOS, in terminal, run `xcrun simctl list` to view a list of simulators on your Mac. To open your active simulator, `run open -a simulator`. In `frontend-e2e/.detoxrc.json`, you could change the simulator under `devices.simulator.device`.\n\nFor Android, in terminal, run `emulator -list-avds` to view a list of emulators installed. To open your emulator, run `emulator -avd `. In `frontend-e2e/.detoxrc.json`, you could change the simulator under `devices.emulator.device`.\n\nIn additon, to override the device name specified in a configuration, you could use `--device-name` option: `nx test-ios --device-name \"iPhone 11\"`. The `device-name` property provides you the ability to test an application run on specific device.\n\n```bash\nnx test-ios frontend-e2e --device-name \"iPhone 11\"\nnx test-android frontend-e2e --device-name \"Pixel_4a_API_30\"\n```\n" } diff --git a/docs/generated/packages/eslint-plugin-nx.json b/docs/generated/packages/eslint-plugin-nx.json index 3ca55b6c71..639247353e 100644 --- a/docs/generated/packages/eslint-plugin-nx.json +++ b/docs/generated/packages/eslint-plugin-nx.json @@ -4,7 +4,15 @@ "description": "ESLint Plugin for Nx", "root": "/packages/eslint-plugin-nx", "source": "/packages/eslint-plugin-nx/src", - "documentation": [], + "documentation": [ + { + "id": "overview", + "name": "Overview", + "path": "/packages/eslint-plugin-nx", + "file": "shared/eslint-plugin-nx", + "content": "![ESLint logo](/shared/eslint-logo.png)\n\nA plugin containing a collection of recommended ESLint rule configurations wrapped as ESLint plugins and an Nx specific [enforce-module-boundaries](#enforce-module-boundaries) rule.\n\n## Setting Up ESLint Plugin\n\n### Installation\n\nIn any Nx workspace, you can install `@nrwl/eslint-plugin-nx` by running the following commands if the package is not already installed:\n\n```bash\nnpm i --save-dev @nrwl/eslint-plugin-nx\n```\n\n```bash\nyarn add --dev @nrwl/eslint-plugin-nx\n```\n\n## ESLint plugins\n\nThe plugin contains the following rule configurations divided into sub-plugins.\n\n### JavaScript\n\nThe `@nrwl/nx/javascript` ESLint plugin contains best practices when using JavaScript.\n\n### TypeScript\n\nThe `@nrwl/nx/typescript` ESLint plugin contains best practices when using TypeSript.\n\n### Angular\n\nContains configurations matching best practices when using Angular framework:\n\n- @nrwl/nx/angular\n- @nrwl/nx/angular-template\n\n### React\n\nContains configurations matching best practices when using React framework:\n\n- @nrwl/nx/react-base\n- @nrwl/nx/react-jsx\n- @nrwl/nx/react-typescript\n\nYou can also use `@nrwl/nx/react` which includes all three `@nrwl/nx/react-*` plugins\n\n## enforce-module-boundaries\n\nThe `@nrwl/nx/enforce-module-boundaries` ESLint rule enables you to define strict rules for accessing resources between different projects in the repository. By enforcing strict boundaries it helps keep prevent unplanned cross-dependencies.\n\n### Usage\n\nYou can use `enforce-module-boundaries` rule by adding it to your ESLint rules configuration:\n\n```json\n{\n // ... more ESLint config here\n \"overrides\": [\n {\n \"files\": [\"*.ts\", \"*.tsx\", \"*.js\", \"*.jsx\"],\n \"rules\": {\n \"@nrwl/nx/enforce-module-boundaries\": [\n \"error\",\n {\n // ...rule specific configuration\n }\n ]\n }\n }\n // ... more ESLint overrides here\n ]\n}\n```\n\nRead more about proper usage of this rule:\n\n- [Imposing Constraints on the Project Graph](/structure/monorepo-tags)\n- [Taming Code Organization with Module Boundaries in Nx](https://blog.nrwl.io/mastering-the-project-boundaries-in-nx-f095852f5bf4)\n" + } + ], "generators": [], "executors": [] } diff --git a/docs/generated/packages/express.json b/docs/generated/packages/express.json index e2f657ed20..4a9cfad3de 100644 --- a/docs/generated/packages/express.json +++ b/docs/generated/packages/express.json @@ -8,6 +8,7 @@ { "id": "overview", "name": "Overview", + "path": "/packages/express", "file": "shared/express-plugin", "content": "![Express Logo](/shared/express-logo.png)\n\n[Express](https://expressjs.com/) is mature, minimal, and an open source web framework for making web applications and\napis.\n\n## Setting Up Express\n\nTo create a new workspace with Express, run the following command:\n\n```shell\n npx create-nx-workspace --preset=express\n```\n\n### Adding Express to an Existing Project\n\nInstall the express plugin\n\n```shell\nnpm install --save-dev @nrwl/express\n```\n\n```shell\nyarn add --dev @nrwl/express\n```\n\n## Creating Applications\n\nAdd a new application to your workspace with the following command:\n\n```shell\nnx g @nrwl/express:app my-app\n```\n\nServe the application by running\n\n```shell\nnx serve my-app\n```\n\nThis starts the application on localhost:3333/api by default.\n\n> Express does not come with any library generators, but you can leverage the[`@nrwl/js`](/js/overview#create-libraries) plugin to generate a Node.js library for your express application.\n\n### Application Proxies\n\nThe Express application generator has an option to configure other projects in the workspace to proxy API requests. This\ncan be done by passing the `--frontendProject` with the project name you wish to enable proxy support for.\n\n```shell\nnx g @nrwl/express:app --frontendProject my-react-app\n```\n\n## Using Express\n\n### Testing Projects\n\nYou can run unit tests with:\n\n```shell\nnx test \n```\n\n### Building Projects\n\nExpress projects can be built with:\n\n```shell\nnx build \n```\n\nBuild artifacts will be found in the `dist` directory under `apps/` by default. Customize the build\nconfiguration by editing `outputPath` in the [project configuration](/configuration/projectjson).\n\n### Waiting for Other Tasks\n\nYou can wait for other tasks to run before serving the express app which can be handy for spinning up various services\nthe application depends on— for example, other apis in a microservice.\n\nSetting the `waitUntilTargets` option with an array of targets (format: `\"project:target\"`) executes those tasks\nbefore serving the Express application.\n\n## More Documentation\n\n- [Using Jest](/jest/overview)\n- [@nrwl/js](/js/overview)\n- [Express](https://expressjs.com/)\n" } diff --git a/docs/generated/packages/jest.json b/docs/generated/packages/jest.json index 4a1d8a88e4..87e0979bef 100644 --- a/docs/generated/packages/jest.json +++ b/docs/generated/packages/jest.json @@ -8,6 +8,7 @@ { "name": "Overview", "id": "overview", + "path": "/packages/jest", "file": "shared/jest-plugin", "content": "![Jest logo](/shared/jest-logo.png)\n\n[Jest](https://jestjs.io/) is an open source test runner created by Facebook. It has a lot of great features:\n\n- Immersive watch mode for providing near instant feedback when developing tests.\n- Snapshot testing for validating features.\n- Great built-in reporter for printing out test results.\n\n## Setting up Jest\n\nBy default, Nx will use Jest when creating applications and libraries.\n\n```shell\nnx g @nrwl/web:app frontend\n```\n\n### Adding Jest to an Existing Project\n\nAdd Jest to a project using the `jest-project` generator from `@nrwl/jest`.\n\nFirst, install `@nrwl/jest`, if not already installed using your preferred package manager.\n\n```shell\nnpm install --save-dev @nrwl/jest\n```\n\n```shell\nyarn add --dev @nrwl/jest\n```\n\nOnce installed, run the `jest-project` generator\n\n```shell\nnx g @nrwl/jest:jest-project --project=\n```\n\n> Hint: You can use the `--dry-run` flag to see what will be generated.\n\nReplacing `` with the name of the project you're wanting to add Jest too.\n\n## Using Jest\n\n### Testing Applications\n\nThe recommended way to run/debug Jest tests via an editor\n\n- [VSCode](https://marketplace.visualstudio.com/items?itemName=firsttris.vscode-jest-runner)\n- [Webstorm](https://blog.jetbrains.com/webstorm/2018/10/testing-with-jest-in-webstorm/)\n\nTo run Jest tests via nx use\n\n```shell\nnx test frontend\n```\n\n### Watching for Changes\n\nUsing the `--watch` flag will run the tests whenever a file changes.\n\n```shell\nnx test frontend --watch\n```\n\n### Snapshot Testing\n\nJest has support for **Snapshot Testing**, a tool which simplifies validating data. Check out the [official Jest Documentation on Snapshot Testing](https://jestjs.io/docs/en/snapshot-testing).\n\nExample of using snapshots:\n\n```typescript\ndescribe('SuperAwesomFunction', () => {\n it('should return the correct data shape', () => {\n const actual = superAwesomFunction();\n expect(actual).toMatchSnapshot();\n });\n});\n```\n\nWhen using snapshots, you can update them with the `--updateSnapshot` flag, `-u` for short.\n\n> By default, snapshots will be generated when there are not existing snapshots for the associated test.\n\n```shell\nnx test frontend -u\n```\n\nSnapshot files should be checked in with your code.\n\n### Performance in CI\n\nTypically, in CI it's recommended to use `nx affected --target=test --parallel=[# CPUs] -- --runInBand` for the best performance.\n\nThis is because each [jest process creates a workers based on system resources](https://jestjs.io/docs/cli#--maxworkersnumstring), running multiple projects via nx and using jest workers will create too many process overall causing the system to run slower than desired. Using the `--runInBand` flag tells jest to run in a single process.\n\n## Configurations\n\n### Jest\n\nPrimary configurations for Jest will be via the `jest.config.js` file that generated for your project. This file will extend the root `jest.config.js` file. Learn more about [Jest configurations](https://jestjs.io/docs/configuration#options).\n\n### Nx\n\nNx Jest Plugin options can be configured via the [project config file](/configuration/projectjson) or via the [command line flags](/jest/jest).\n\n> Hint: Use `--help` to see all available options\n>\n> ```shell\n> nx test --help\n> ```\n\n### Code Coverage\n\nEnable code coverage with the `--coverage` flag or by adding it to the executor options in the [project configuration file](/configuration/projectjson).\n\nBy default, coverage reports will be generated in the `coverage/` directory under projects name. i.e. `coverage/apps/frontend`. Modify this directory with the `--coverageDirectory` flag. Coverage reporters can also be customized with the `--coverageReporters` flag.\n\n> `coverageDirectory` and `coverageReporters` are configurable via the project configuration file as well.\n\n### Global setup/teardown with nx libraries\n\nIn order to use Jest's global setup/teardown functions that reference nx libraries, you'll need to register the TS path for jest to resolve the libraries.\nNx provides a helper function that you can import within your setup/teardown file.\n\n```typescript\nimport { registerTsProject } from 'nx/src/utils/register';\nconst cleanupRegisteredPaths = registerTsProject('.', 'tsconfig.base.json');\n\nimport { yourFancyFunction } from '@some-org/my-util-library';\nexport default async function () {\n yourFancyFunction();\n}\n// make sure to run the clean up!\ncleanupRegisteredPaths();\n```\n\n## Debugging Failing Tests\n\nIf your code editor doesn't provide a way to debug your tests, you can leverage the Chrome DevTools to debug your tests with the `--inspect-brk` flag for node.\n\n```shell\nnode --inspect-brk ./node_modules/@nrwl/cli/bin/nx test \n```\n\nEnter [chrome://inspect](chrome://inspect) in Chrome address bar and inspect the target to attach to the node process. Visit the official [Jest documentation](https://jestjs.io/docs/en/troubleshooting#tests-are-failing-and-you-don-t-know-why) to find out more.\n\n## More Documentation\n\n- [Jest Docs](https://jestjs.io/)\n- [@nrwl/jest options](/jest/jest)\n" } diff --git a/docs/generated/packages/js.json b/docs/generated/packages/js.json index 71e8480df6..a198323160 100644 --- a/docs/generated/packages/js.json +++ b/docs/generated/packages/js.json @@ -8,6 +8,7 @@ { "name": "Overview", "id": "overview", + "path": "/packages/js", "file": "shared/js-plugin", "content": "The JS plugin contains executors and generators that are useful for JavaScript/TypeScript projects in an Nx workspace.\n\n## Setting Up JS\n\n### Installation\n\nIn any Nx workspace, you can install `@nrwl/js` by running the following commands if `@nrwl/js` package is not installed:\n\n```shell\nnpm i --save-dev @nrwl/js\n```\n\n```shell\nyarn add --dev @nrwl/js\n```\n\n### `ts` Preset\n\nWhen initializing a new Nx workspace, specifying `--preset=ts` will generate a workspace with `@nrwl/js` pre-installed.\n\n```shell\nnpx create-nx-workspace my-org --preset=ts\n```\n\n```shell\nyarn create nx-workspace my-org --preset=ts\n```\n\n## Create Libraries\n\nYou can add a new JS/TS library with the following command:\n\n```shell\nnx g @nrwl/js:lib my-lib\n```\n\n## Build\n\nYou can `build` libraries that are generated with `--buildable` flag.\n\n```shell\nnx g @nrwl/js:lib my-buildable-lib --buildable\n```\n\nGenerating a library with `--buildable` will add a `build` target to the library's `project.json` file allows the library to be built.\n\n```shell\nnx build my-buildable-lib\n```\n\n## Test\n\nYou can test a library with the following command:\n\n```shell\nnx test my-lib\n```\n\n## Lint\n\nYou can lint a library with the following command:\n\n```shell\nnx lint my-lib\n```\n\n## Compiler\n\nBy default, `@nrwl/js` uses [TypeScript Compiler (TSC)](https://www.typescriptlang.org/docs/handbook/2/basic-types.html#tsc-the-typescript-compiler), via `@nrwl/js:tsc` executor, to compile your libraries. Optionally, you can switch `tsc` out for a different compiler with `--compiler` flag when executing the generators.\n\nCurrently, `@nrwl/js` supports the following compilers:\n\n- [Speedy Web Compiler (SWC)](https://swc.rs)\n\n### SWC\n\n- Create a buildable library with `swc`\n\n```shell\nnx g @nrwl/js:lib my-swc-lib --compiler=swc --buildable\n```\n\n- Convert a `tsc` library to use `swc`\n\n```shell\nnx g @nrwl/js:convert-to-swc my-buildable-lib\n```\n\nNow the `build` command will use `@nrwl/js:swc` executor to compile your libraries.\n\n> The first time you generate a `swc` library or convert a `tsc` library over to `swc`, `@nrwl/js` will install the necessary dependencies to use `swc`.\n" } diff --git a/docs/generated/packages/linter.json b/docs/generated/packages/linter.json index fe2274a44a..2ce6906334 100644 --- a/docs/generated/packages/linter.json +++ b/docs/generated/packages/linter.json @@ -8,6 +8,7 @@ { "id": "overview", "name": "Overview", + "path": "/packages/linter", "file": "shared/linter-plugin", "content": "The Linter plugin contains executors, generator, plugin and utilities used for linting JavaScript/TypeScript projects within an Nx workspace.\n\n## Setting Up Linter\n\n### Installation\n\nIn any Nx workspace, you can install `@nrwl/linter` by running the following commands if `@nrwl/linter` package is not installed:\n\n```bash\nnpm i --save-dev @nrwl/linter\n```\n\n```bash\nyarn add --dev @nrwl/linter\n```\n\n## Lint\n\nYou can lint an application or a library with the following command:\n\n```bash\nnx lint my-app\n```\n\n```bash\nnx lint my-lib\n```\n\n## Utils\n\n- [convert-tslint-to-eslint](/angular/convert-tslint-to-eslint) - Converts a project linter from [TSLint](https://palantir.github.io/tslint/) to [ESLint](https://eslint.org/)\n" }, diff --git a/docs/generated/packages/nest.json b/docs/generated/packages/nest.json index 24f0d52895..b8de564c33 100644 --- a/docs/generated/packages/nest.json +++ b/docs/generated/packages/nest.json @@ -8,6 +8,7 @@ { "id": "overview", "name": "Overview", + "path": "/packages/nest", "file": "shared/nest-plugin", "content": "![NestJS logo](/shared/nest-logo.png)\n\nNest.js is a framework designed for building scalable server-side applications. In many ways, Nest is familiar to Angular developers:\n\n- It has excellent TypeScript support.\n- Its dependency injection system is similar to the one in Angular.\n- It emphasises testability.\n- Its configuration APIs are similar to Angular as well.\n\nMany conventions and best practices used in Angular applications can be also be used in Nest.\n\n## Setting Up Nest\n\nTo create a new workspace with Nest, run the following command:\n\n```shell\nnpx create-nx-workspace my-workspace --preset=nest\n```\n\nYarn users can use the following command instead:\n\n```shell\nyarn create nx-workspace my-workspace --preset=nest\n```\n\nTo add the Nest plugin to an existing workspace, run one the following commands:\n\n```shell\nnpm install -D @nrwl/nest\n```\n\n```shell\nyarn add -D @nrwl/nest\n```\n\n### Create Applications\n\nYou can add a new Nest application with the following command:\n\n```shell\nnx g @nrwl/nest:app my-nest-app\n```\n\n#### Application Proxies\n\nGenerating Nest applications has an option to configure other projects in the workspace to proxy API requests. This can be done by passing the `--frontendProject` with the project name you wish to enable proxy support for.\n\n```shell\nnx g @nrwl/nest:app my-nest-app --frontendProject my-angular-app\n```\n\n### Create Libraries\n\nYou can add a new Nest library with the following command:\n\n```shell\nnx g @nrwl/nest:lib my-nest-lib\n```\n\nTo make the library `buildable`, use the following command:\n\n```shell\nnx g @nrwl/nest:lib my-nest-lib --buildable\n```\n\nTo make the library `publishable`, use the following command:\n\n```shell\nnx g @nrwl/nest:lib my-nest-lib --publishable --importPath=@my-workspace/my-nest-lib\n```\n\n> Read more about [building and publishing libraries here](/structure/buildable-and-publishable-libraries).\n\n### Nest Generators\n\nThe Nest plugin for Nx extends the generators provided by Nest. Any commands that can be used with the Nest CLI can also be used with the `nx` command. The `--project` flag should be used for all Nest generators.\n\n> `--project` is used to infer the root of the project where the generators will generate the files.\n\n## Using Nest\n\n### Build\n\nYou can build an application with the following command:\n\n```shell\nnx build my-nest-app\n```\n\nThis applies to `buildable` libraries as well\n\n```shell\nnx build my-nest-lib\n```\n\n#### Waiting for other builds\n\nSetting the `waitUntilTargets` option with an array of projects (with the following format: `\"project:architect\"`) will execute those commands before serving the Nest application.\n\n### Serve\n\nYou can serve an application with the following command:\n\n```shell\nnx serve my-nest-app\n```\n\nThe `serve` command runs the `build` target, and executes the application.\n\nBy default, the serve command will run in `watch` mode. This allows code to be changed, and the Nest application to be rebuilt automatically.\n\n#### Debugging\n\nNest applications also have the `inspect` flag set, so you can attach your debugger to the running instance.\n\nDebugging is set to use a random port that is available on the system. The port can be changed by setting the port option in the `serve` architect in the workspace.json. Or by running the serve command with `--port `.\n\nFor additional information on how to debug Node applications, see the [Node.js debugging getting started guide](https://nodejs.org/en/docs/guides/debugging-getting-started/#inspector-clients).\n\n### Lint\n\nYou can lint an application with the following command:\n\n```shell\nnx lint my-nest-app\n```\n\nYou can lint a library with the following command:\n\n```shell\nnx lint my-nest-lib\n```\n\n### Unit Test\n\nYou can run unit test for an application with the following command:\n\n```shell\nnx test my-nest-app\n```\n\nYou can run unit test for a library with the following command:\n\n```shell\nnx test my-nest-lib\n```\n\n## More Documentation\n\n- [Todo Tutorial](/node-tutorial/01-create-application)\n- [Using Jest](/jest/overview)\n" } diff --git a/docs/generated/packages/next.json b/docs/generated/packages/next.json index 005a7663da..56c0c48b49 100644 --- a/docs/generated/packages/next.json +++ b/docs/generated/packages/next.json @@ -8,6 +8,7 @@ { "id": "overview", "name": "Overview", + "path": "/packages/next", "file": "shared/next-plugin", "content": "![](/shared/nextjs-logo.png)\n\nWhen using Next.js in Nx, you get the out-of-the-box support for TypeScript, Cypress, and Jest. No need to configure anything: watch mode, source maps, and typings just work.\n\nThe Next.js plugin contains executors and generators for managing Next.js applications and libraries within an Nx workspace. It provides:\n\n- Scaffolding for creating, building, serving, linting, and testing Next.js applications.\n- Integration with building, serving, and exporting a Next.js application.\n- Integration with React libraries within the workspace.\n\n## Setting up Next.js\n\nTo create a new Nx workspace with Next.js, run `npx create-nx-workspace@latest --preset=next`.\n\nTo add Next.js to an existing Nx workspace, install the `@nrwl/next` package. Make sure to install the version that matches your `@nrwl/workspace` version.\n\n```bash\n#yarn\nyarn add --dev @nrwl/next\n```\n\n```bash\n#npm\nnpm install --save-dev @nrwl/next\n```\n\n### Creating Applications\n\nYou can add a new application with the following:\n\n```bash\nnx g @nrwl/next:app my-new-app\n```\n\n### Generating Libraries\n\nNx allows you to create libraries with just one command. Some reasons you might want to create a library include:\n\n- Share code between applications\n- Publish a package to be used outside the monorepo\n- Better visualize the architecture using `nx graph`\n\nFor more information on Nx libraries, see our documentation on [Creating Libraries](/structure/creating-libraries)\nand [Library Types](/structure/library-types).\n\nTo generate a new library run:\n\n```bash\nnx g @nrwl/next:lib my-new-lib\n```\n\n### Generating Pages and Components\n\nNx also provides commands to quickly generate new pages and components for your application.\n\n```bash\nnx g @nrwl/next:page my-new-page --project=my-new-app\n\nnx g @nrwl/next:component my-new-component --project=my-new-app\n```\n\nAbove commands will add a new page `my-new-page` and a component `my-new-component` to `my-new-app` project respectively.\n\nNx generates components with tests by default. For pages, you can pass the `--withTests` option to generate tests under the `specs` folder.\n\n## Using Next.js\n\n### Serving Next.js Applications\n\nYou can run `nx serve my-new-app` to serve a Next.js application called `my-new-app` for development. This will start the dev server at http://localhost:4200.\n\nTo serve a Next.js application for production, add the `--prod` flag to the serve command:\n\n```bash\nnx serve my-new-app --prod\n```\n\n### Using an Nx Library in your Application\n\nYou can import a library called `my-new-lib` in your application as follows.\n\n```typescript jsx\n// apps/my-next-app/pages/index.tsx\nimport { MyNewLib } from '@/my-new-lib';\n\nexport function Index() {\n return (\n \n

The main content

\n
\n );\n}\n\nexport default Index;\n```\n\nThere is no need to build the library prior to using it. When you update your library, the Next.js application will automatically pick up the changes.\n\n### Publishable libraries\n\nFor libraries intended to be built and published to a registry (e.g. npm) you can use the `--publishable` and `--importPath` options.\n\n```bash\nnx g @nrwl/next:lib my-new-lib --publishable --importPath=@happynrwl/ui-components\n```\n\n### Testing Projects\n\nYou can run unit tests with:\n\n```bash\nnx test my-new-app\nnx test my-new-lib\n```\n\nReplace `my-new-app` and `my-new-lib` with the name or the project you want to test. This command works for both applications and libraries.\n\nYou can also run E2E tests for applications:\n\n```bash\nnx e2e my-new-app-e2e\n```\n\nReplace `my-new-app-e2e` with the name or your project with -e2e appended.\n\n### Linting Projects\n\nYou can lint projects with:\n\n```bash\nnx lint my-new-app\nnx lint my-new-lib\n```\n\nReplace `my-new-app` and `my-new-lib` with the name or the project you want to test. This command works for both applications and libraries.\n\n### Building Projects\n\nNext.js applications can be build with:\n\n```bash\nnx build my-new-app\n```\n\nAnd if you generated a library with --buildable, then you can build a library as well:\n\n```bash\nnx build my-new-lib\n```\n\nAfter running a build, the output will be in the `dist` folder. You can customize the output folder by setting `outputPath` in the project's `project.json` file.\n\nThe library in `dist` is publishable to npm or a private registry.\n\n### Static HTML Export\n\nNext.js applications can be statically exported with:\n\n```bash\nnx export my-new-app\n```\n\n### Deploying Next.js Applications\n\nOnce you are ready to deploy your Next.js application, you have absolute freedom to choose any hosting provider that fits your needs.\n\nYou may know that the company behind Next.js, Vercel, has a great hosting platform offering that is developed in tandem with Next.js itself to offer a great overall developer and user experience. We have detailed [how to deploy your Next.js application to Vercel in a separate guide](/guides/deploy-nextjs-to-vercel).\n\n## More Documentation\n\nHere are other resources that you may find useful to learn more about Next.js and Nx.\n\n- **Blog post:** [Building a blog with Next.js and Nx Series](https://blog.nrwl.io/create-a-next-js-web-app-with-nx-bcf2ab54613) by Juri Strumpflohner\n- **Video tutorial:** [Typescript NX Monorepo with NextJS and Express](https://www.youtube.com/watch?v=WOfL5q2HznI) by Jack Herrington\n" } diff --git a/docs/generated/packages/node.json b/docs/generated/packages/node.json index 55122b6aaf..a8b6de20a0 100644 --- a/docs/generated/packages/node.json +++ b/docs/generated/packages/node.json @@ -8,6 +8,7 @@ { "id": "overview", "name": "Overview", + "path": "/packages/node", "file": "shared/node-plugin", "content": "The Node Plugin contains generators and executors to manage Node applications within an Nx workspace. It provides:\n\n## Setting Up Node\n\nTo add the Node plugin to an existing workspace, run one of the following:\n\n```bash\n# For npm users\nnpm install -D @nrwl/node\n\n# For yarn users\nyarn add -D @nrwl/node\n```\n\n### Creating Applications\n\nYou can add a new application with the following:\n\n```bash\nnx g @nrwl/node:application my-new-app\n```\n\nYou can run your application with `nx serve my-new-app`, which starts it in watch mode.\n\n### Creating Libraries\n\nNode libraries are a good way to separate features within your organization. To create a Node library run the following command:\n\n```bash\nnx g @nrwl/js:node my-new-lib\n\n# If you want the library to be buildable or publishable to npm\nnx g @nrwl/node:lib my-new-lib --buildable\nnx g @nrwl/node:lib my-new-lib \\\n--publishable \\\n--importPath=@myorg/my-new-lib\n```\n\n## Using Node\n\n### Testing Projects\n\nYou can run unit tests with:\n\n```bash\nnx test my-new-app\nnx test my-new-lib\n```\n\nReplace `my-new-app` with the name or your project. This command works for both applications and libraries.\n\n### Building Projects\n\nNode applications can be build with:\n\n```bash\nnx build my-new-app\n```\n\nAnd if you generated a library with `--buildable`, then you can build a library as well:\n\n```bash\nnx build my-new-lib\n```\n\nThe output is in the `dist` folder. You can customize the output folder by setting `outputPath` in the project's `project.json` file.\n\n### Application Proxies\n\nGenerating Node applications has an option to configure other projects in the workspace to proxy API requests. This can be done by passing the `--frontendProject` with the project name you wish to enable proxy support for.\n\n```bash\nnx g @nrwl/node:application my-new-app \\\n--frontendProject my-react-app\n```\n\n### Debugging\n\nDebugging is set to use a random port that is available on the system. The port can be changed by setting the port option in the `serve` architect in the project.json. Or by running the serve command with `--port `.\n\nFor additional information on how to debug Node applications, see the [Node.js debugging getting started guide](https://nodejs.org/en/docs/guides/debugging-getting-started/#inspector-clients).\n\n## More Documentation\n\n- [Using Cypress](/cypress/overview)\n- [Using Jest](/jest/overview)\n" } diff --git a/docs/generated/packages/nx-plugin.json b/docs/generated/packages/nx-plugin.json index 4343cac33f..2e461fc352 100644 --- a/docs/generated/packages/nx-plugin.json +++ b/docs/generated/packages/nx-plugin.json @@ -8,6 +8,7 @@ { "id": "overview", "name": "Overview", + "path": "/packages/nx-plugin", "file": "shared/nx-plugin", "content": "Nx plugins are npm packages that contain generators and executors to extend a Nx workspace. Generators are blueprints to create new files from templates, and executors run those files. These plugins also update the `nx.json` when generating new libs or apps.\n\n> A list of plugins that is maintained by Nrwl is found in the [Nrwl/nx repo](https://github.com/nrwl/nx/tree/master/packages). \\\n> A list of custom plugins created by the community is found in the [Community](/community) section.\n> Plugins are written using Nx Devkit. **Read [Nx Devkit](/getting-started/nx-devkit) for more information.**\n\n\n\n## Generating a Plugin\n\nTo get started with building a Nx Plugin, run the following command:\n\n```bash\nnpx create-nx-plugin my-org --pluginName my-plugin\n```\n\nThis command creates a brand new workspace, and sets up a pre-configured plugin with the specified name.\n\n> Note, the command above will create a plugin the package name set to `@my-org/my-plugin`. You can pass `--importPath` to provide a different package name.\n\n> If you do not want to create a new workspace, install the `@nrwl/nx-plugin` dependency in an already existing workspace with npm or yarn. Then run `nx g @nrwl/nx-plugin:plugin [pluginName]`.\n\nA new plugin is created with a default generator, executor, and e2e app.\n\n## Generator\n\nThe created generator contains boilerplate that will do the following:\n\n- Normalize a schema (the options that the generator accepts)\n- Update the `workspace.json`\n- Add the plugin's project to the `nx.json` file\n- Add files to the disk using templates\n\nThere will be a exported default function that will be the main entry for the generator.\n\n### Generator options\n\nThe `schema.d.ts` file contains all the options that the generator supports. By default, it includes `directory`, `tags`, and `name` as the options. If more options need to be added, please update this file and the `schema.json` file.\n\n> Note: The `schema.d.ts` file is used for type checking inside the implementation file. It should match the properties in `schema.json`.\n\n### Adding more generators\n\nTo add more generators to the plugin, run the following command:\n`nx generate @nrwl/nx-plugin:generator [generatorName] --project=[pluginName]`.\n\nThis will scaffold out a new generator and update the necessary files to support it.\n\n### Generator Testing\n\nThe generator spec file includes boilerplate to help get started with testing. This includes setting up an empty workspace.\n\nThese tests should ensure that files within the tree (created with `createTreeWithEmptyWorkspace`) are in the correct place, and contain the right content.\n\nFull E2Es are supported (and recommended) and will run everything on the file system like a user would.\n\n## Executor\n\nThe default executor is set up to just emit a console log. Some examples of what an executor can do are:\n\n- Support different languages, (Java, Go, Python, C#)\n- Compile new UI framework components\n- Deploy an app on a CDN\n- Publish to NPM\n- and many more!\n\n### Adding more executors\n\nTo add more executors to the plugin, run the following command:\n`nx generate @nrwl/nx-plugin:executor [executor] --project=[pluginName]`.\n\nThis will scaffold out a new generator and update the necessary files to support it.\n\n### Executor testing\n\nThe executor spec file contains boilerplate to run the default exported function from the executor.\n\nThese tests should make sure that the executor is executing and calling the functions that it relies on.\n\nFull E2Es are supported (and recommended) and will run everything on the file system like a user would.\n\n## Testing your plugin\n\nOne of the biggest benefits that the Nx Plugin package provides is support for E2E and unit testing.\n\nWhen the E2E app runs, a temporary E2E directory is created in the root of the workspace. This directory is a blank Nx workspace, and will have the plugin's built package installed locally.\n\n### E2E Testing file\n\nWhen the plugin is generated, a test file is created in the `my-plugin-e2e` app. Inside this test file, there are already tests for making sure that the executor ran, checking if directories are created with the `--directory` option, and checking if tags are added to the project configuration.\n\nWe'll go over a few parts of a test file below:\n\n```typescript\nit('should create my-plugin', async (done) => {\n const plugin = uniq('my-plugin');\n ensureNxProject('@my-org/my-plugin', 'dist/packages/my-plugin');\n await runNxCommandAsync(`generate @my-org/my-plugin:myPlugin ${plugin}`);\n\n const result = await runNxCommandAsync(`build ${plugin}`);\n expect(result.stdout).toContain('Executor ran');\n\n done();\n});\n```\n\n- The `uniq` function creates a random name with the prefix and a random number.\n- The `ensureNxProject` is the function that will create the temporary directory. It takes two arguments, the plugin package name and the dist directory of when it's built.\n- The `runNxCommandAsync` will execute a `nx` command in the E2E directory.\n\nThere are additional functions that the `@nrwl/nx-plugin/testing` package exports. Most of them are file utilities to manipulate and read files in the E2E directory.\n\n## Including Assets\n\nSometimes you might want to include some assets with the plugin. This might be a image or some additional binaries.\n\nTo make sure that assets are copied to the dist folder, open the plugin's `project.json` file. Inside the `build` property, add additional assets. By default, all `.md` files in the root, all non-ts files in folders, and the `generators.json` and `executors.json` files are included.\n\n```json\n\"build\": {\n \"executor\": \"@nrwl/node:package\",\n \"options\": {\n // shortened...\n \"assets\": [\n \"packages/my-plugin/*.md\",\n {\n \"input\": \"./packages/my-plugin/src\",\n \"glob\": \"**/*.!(ts)\",\n \"output\": \"./src\"\n },\n {\n \"input\": \"./packages/my-plugin\",\n \"glob\": \"generators.json\",\n \"output\": \".\"\n },\n {\n \"input\": \"./packages/my-plugin\",\n \"glob\": \"executors.json\",\n \"output\": \".\"\n }\n ]\n }\n}\n```\n\n## Using your Nx Plugin\n\nTo use your plugin, simply list it in `nx.json` or use its generators and executors as you would for any other plugin. This could look like `nx g @my-org/my-plugin:lib` for generators or `\"executor\": \"@my-org/my-plugin:build\"` for executors. It should be usable in all of the same ways as published plugins in your local workspace immediately after generating it. This includes setting it up as the default collection in `nx.json`, which would allow you to run `nx g lib` and hit your plugin's generator.\n\n## Publishing your Nx Plugin\n\nIn order to use your plugin in other workspaces or share it with the community, you will need to publish it to an npm registry. To publish your plugin follow these steps:\n\n1. Build your plugin with the command `nx run my-plugin:build`\n1. `npm publish ./dist/package/my-plugin` and follow the prompts from npm.\n1. That's it!\n\n> Note: currently you will have to modify the `package.json` version by yourself or with a tool.\n\nAfter that, you can then install your plugin like any other npm package,\n`npm i -D @my-org/my-plugin` or `yarn add -D @my-org/my-plugin`.\n\n### Listing your Nx Plugin\n\nNx provides a utility (`nx list`) that lists both core and community plugins. To submit your plugin, please follow the steps below:\n\n- Fork the [Nx repo](https://github.com/nrwl/nx/fork) (if you haven't already)\n- Update the [`community/approved-plugins.json` file](https://github.com/nrwl/nx/blob/master/community/approved-plugins.json) with a new entry for your plugin that includes name, url and description\n- Use the following commit message template: `chore(core): nx plugin submission [PLUGIN_NAME]`\n- push your changes, and run `yarn submit-plugin`\n\n> The `yarn submit-plugin` command automatically opens the Github pull request process with the correct template.\n\nWe will then verify the plugin, offer suggestions or merge the pull request!\n\n## Preset\n\nA Preset is a customization option which you provide when creating a new workspace. TS, Node, React are some of the internal presets that Nx provides by default.\n\n\n \n### Custom Preset\n\nAt its core a preset is a generator, which we can create inside of a plugin.\nIf you **don't** have an existing plugin you can create one by running\n\n```bash\n npx create-nx-plugin my-org --pluginName my-plugin\n```\n\nTo create our preset inside of our plugin we can run\n\n```bash\n nx generate @nrwl/nx-plugin:generator --name=preset --project=happynrwl\n```\n\n> Note: the word `preset` is required for the name of this generator\n\nYou should have a similar structure to this:\n\n```treeview\nhappynrwl/\n\t├── e2e\n\t├── jest.config.js\n\t├── jest.preset.js\n\t├── nx.json\n\t├── package-lock.json\n\t├── package.json\n\t├── packages\n\t│ └── happynrwl\n\t│ ├── src\n\t│ │ ├── executors\n\t│ │ ├── generators\n\t│ │ │ ├── happynrwl\n\t│ │ │ └── preset \t\t// <------------- Here\n\t│ │ └── index.ts\n\t├── tools\n\t├── tsconfig.base.json\n\t└── workspace.json\n```\n\nAfter the command is finished, the preset generator is created under the folder named **preset**.\nThe **generator.ts** provides an entry point to the generator. This file contains a function that is called to perform manipulations on a tree that represents the file system. The **schema.json** provides a description of the generator, available options, validation information, and default values.\n\nHere is the sample generator function which you can customize to meet your needs.\n\n```typescript\nexport default async function (tree: Tree, options: PresetGeneratorSchema) {\n const normalizedOptions = normalizeOptions(tree, options);\n addProjectConfiguration(tree, normalizedOptions.projectName, {\n root: normalizedOptions.projectRoot,\n projectType: 'application',\n sourceRoot: `${normalizedOptions.projectRoot}/src`,\n targets: {\n exec: {\n executor: 'nx:run-commands',\n options: {\n command: `node ${projectRoot}/src/index.js`,\n },\n },\n },\n tags: normalizedOptions.parsedTags,\n });\n addFiles(tree, normalizedOptions);\n await formatFiles(tree);\n}\n```\n\nTo get an in-depth guide on customizing/running or debugging your generator see [workspace generators](https://nx.dev/generators/workspace-generators#running-a-workspace-generator).\n\n#### Usage\n\nBefore you are able to use your newly created preset you must package and publish it to a registry.\n\nAfter you have published your plugin to a registry you can now use your preset when creating a new workspace\n\n```bash\nnpx create-nx-workspace my-workspace --preset=my-plugin-name\n```\n" } diff --git a/docs/generated/packages/react-native.json b/docs/generated/packages/react-native.json index 1097f055b8..75f3f23cd3 100644 --- a/docs/generated/packages/react-native.json +++ b/docs/generated/packages/react-native.json @@ -8,6 +8,7 @@ { "id": "overview", "name": "Overview", + "path": "/packages/react-native", "file": "shared/react-native-plugin", "content": "![React Logo](/shared/react-logo.png)\n\nReact Native brings React's declarative UI framework to iOS and Android. With React Native, you use native UI controls and have full access to the native platform.\n\nThe Nx Plugin for React Native contains generators for managing React Native applications and libraries within an Nx workspace. It provides:\n\n- Integration with libraries such as Jest, Detox, and Storybook.\n- Scaffolding for creating buildable libraries that can be published to npm.\n- Utilities for automatic workspace refactoring.\n\n## Setting Up React Native\n\n### Create a New Workspace\n\nThe easiest way to create your workspace is via `npx`.\n\n```bash\nnpx create-nx-workspace your-workspace-name \\\n--preset=react-native \\\n--appName=your-app-name\n```\n\n**Note:** You can also run the command without arguments to go through the interactive prompts.\n\n```bash\nnpx create-nx-workspace your-workspace-name\n```\n\n### Adding React Native to an Existing Workspace\n\nFor existing Nx workspaces, install the `@nrwl/react-native` package to add React Native capabilities to it.\n\n```bash\nnpm install @nrwl/react-native --save-dev\n\n# Or with yarn\nyarn add @nrwl/react-native --dev\n```\n\n### Generating Applications\n\nTo create additional React Native apps run:\n\n```bash\nnx g @nrwl/react-native:app your-app-name\n```\n\n### Generating Libraries\n\nTo generate a new library run:\n\n```bash\nnpx nx g @nrwl/react-native:lib your-lib-name\n```\n\n### Generating Components\n\nTo generate a new component inside library run:\n\n```bash\nnpx nx g @nrwl/react-native:component your-component-name --project=your-lib-name --export\n```\n\nReplace `your-lib-name` with the app's name as defined in your workspace.json file.\n\n## Using React Native\n\n- [run-ios](/react-native/run-ios) - Builds your app and starts it on iOS simulator or device\n- [run-android](/react-native/run-android) - Builds your app and starts it on a connected Android emulator or device\n- [build-android](/react-native/build-android) - Release Build for Android\n- [start](/react-native/package) - Starts the server that communicates with connected devices\n- [bundle](/web/package) - Builds the JavaScript bundle for offline use\n- [sync-deps](/react-native/sync-deps) - Syncs dependencies to package.json (required for autolinking)\n- [ensure-symlink](/react-native/ensure-symlink) - Ensure workspace node_modules is symlink under app's node_modules folder\n\n## More Documentation\n\n- [Using Detox](/detox/overview)\n- [Using Jest](/jest/overview)\n" } diff --git a/docs/generated/packages/react.json b/docs/generated/packages/react.json index 28bc96bdb5..883713c0f1 100644 --- a/docs/generated/packages/react.json +++ b/docs/generated/packages/react.json @@ -8,6 +8,7 @@ { "name": "Overview", "id": "overview", + "path": "/packages/react", "file": "shared/react-plugin", "content": "![React Logo](/shared/react-logo.png)\n\nThe React plugin contains executors and generators for managing React applications and libraries within an Nx workspace.\nIt provides:\n\n- Integration with libraries such as Jest, Cypress, and Storybook.\n- Generators for applications, libraries, components, hooks, and more.\n- Library build support for publishing packages to npm or other registries.\n- Utilities for automatic workspace refactoring.\n\n## Setting Up React\n\nTo create a new workspace with React, run `npx create-nx-workspace@latest --preset=react`.\n\nTo add the React plugin to an existing workspace, run one of the following:\n\n```bash\n# For npm users\nnpm install -D @nrwl/react\n\n# For yarn users\nyarn add -D @nrwl/react\n```\n\n### Creating Applications and Libraries\n\nYou can add a new application with the following:\n\n```bash\nnx g @nrwl/react:app my-new-app\n```\n\nTo start the application in development mode, run `nx serve my-new-app`.\n\nAnd add a new library as follows:\n\n```bash\nnx g @nrwl/react:lib my-new-lib\n\n# If you want the library to be buildable or publishable to npm\nnx g @nrwl/react:lib my-new-lib --buildable\nnx g @nrwl/react:lib my-new-lib \\\n--publishable \\\n--importPath=@myorg/my-new-lib\n```\n\nRead more about [building and publishing libraries here](/structure/buildable-and-publishable-libraries).\n\n### Creating Components\n\nAdding a component to an existing project can be done with:\n\n```bash\nnx g @nrwl/react:component my-new-component \\\n--project=my-new-app\n\n# Note: If you want to export the component\n# from the library use --export\nnx g @nrwl/react:component my-new-component \\\n--project=my-new-lib \\\n--export\n```\n\nReplace `my-new-app` and `my-new-lib` with the name of your projects.\n\n### Creating Hooks\n\nIf you want to add a new hook, run the following\n\n```bash\nnx g @nrwl/react:hook my-new-hook --project=my-new-lib\n```\n\nReplace `my-new-lib` with the name of your project.\n\n## Using React\n\n### Testing Projects\n\nYou can run unit tests with:\n\n```bash\nnx test my-new-app\nnx test my-new-lib\n```\n\nReplace `my-new-app` with the name or your project. This command works for both applications and libraries.\n\nYou can also run E2E tests for applications:\n\n```bash\nnx e2e my-new-app-e2e\n```\n\nReplace `my-new-app-e2e` with the name or your project with `-e2e` appended.\n\n### Building Projects\n\nReact applications can be build with:\n\n```bash\nnx build my-new-app\n```\n\nAnd if you generated a library with `--buildable`, then you can build a library as well:\n\n```bash\nnx build my-new-lib\n```\n\nThe output is in the `dist` folder. You can customize the output folder by setting `outputPath` in the\nproject's `project.json` file.\n\nThe application in `dist` is deployable, and you can try it out locally with:\n\n```bash\nnpx http-server dist/apps/my-new-app\n```\n\nThe library in `dist` is publishable to npm or a private registry.\n\n## More Documentation\n\n- [Using Cypress](/cypress/overview)\n- [Using Jest](/jest/overview)\n- [Using Storybook](/storybook/overview-react)\n" } diff --git a/docs/generated/packages/storybook.json b/docs/generated/packages/storybook.json index 1f7febc3f6..d167a320fe 100644 --- a/docs/generated/packages/storybook.json +++ b/docs/generated/packages/storybook.json @@ -8,6 +8,7 @@ { "id": "overview", "name": "Overview Generic", + "path": "/packages/storybook", "file": "shared/guides/storybook/plugin-overview", "content": "![Storybook logo](/shared/storybook-logo.png)\n\nStorybook is a development environment for UI components. It allows you to browse a component library, view the different states of each component, and interactively develop and test components.\n\nThis guide will briefly walk you through using Storybook within an Nx workspace.\n\n## Setting Up Storybook\n\n### Add the Storybook plugin\n\n```bash\nyarn add --dev @nrwl/storybook\n```\n\n## Using Storybook\n\n### Generating Storybook Configuration\n\nYou can generate Storybook configuration for an individual project with this command:\n\n```bash\nnx g @nrwl/react:storybook-configuration project-name\n```\n\n### Running Storybook\n\nServe Storybook using this command:\n\n```bash\nnx run project-name:storybook\n```\n\n## More Documentation\n\nYou can find dedicated information for React and Angular:\n\n- [Overview Storybook For Angular](/storybook/overview-angular)\n- [Overview Storybook For React](/storybook/overview-react)\n\nFor more on using Storybook, see the [official Storybook documentation](https://storybook.js.org/docs/basics/introduction/).\n\n### Migration Scenarios\n\nHere's more information on common migration scenarios for Storybook with Nx. For Storybook specific migrations that are not automatically handled by Nx please refer to the [official Storybook page](https://storybook.js.org/)\n\n- [Upgrading to Storybook 6](/storybook/upgrade-storybook-v6-react)\n- [Migrate to the Nrwl React Storybook Preset](/storybook/migrate-webpack-final-react)\n" }, diff --git a/docs/generated/packages/web.json b/docs/generated/packages/web.json index 346c053425..945e153ad1 100644 --- a/docs/generated/packages/web.json +++ b/docs/generated/packages/web.json @@ -8,6 +8,7 @@ { "name": "Overview", "id": "overview", + "path": "/packages/web", "file": "shared/web-plugin", "content": "The Nx Plugin for Web Components contains generators for managing Web Component applications and libraries within an Nx workspace. It provides:\n\n- Integration with libraries such as Jest, Cypress, and Storybook.\n- Scaffolding for creating buildable libraries that can be published to npm.\n- Utilities for automatic workspace refactoring.\n\n## Setting Up Web\n\nTo create a new workspace with web, run `npx create-nx-workspace@latest --preset=web`.\n\nTo add the web plugin to an existing workspace, run one of the following:\n\n```bash\n# For npm users\nnpm install -D @nrwl/web\n\n# For yarn users\nyarn add -D @nrwl/web\n```\n\n### Creating Applications\n\nYou can add a new application with the following:\n\n```bash\nnx g @nrwl/web:app my-new-app\n```\n\nThe application uses no framework and generates with web components. You can add any framework you want on top of the default setup.\n\nTo start the application in development mode, run `nx serve my-new-app`.\n\n**Note:** If you are looking to add a React application, check out the [React plugin](/react/overview).\n\n### Creating Libraries\n\nTo create a generic TypeScript library (i.e. non-framework specific), use the [`@nrwl/js`](/js/overview) plugin.\n\n```bash\nnx g @nrwl/js:lib my-new-lib\n\n# If you want the library to be buildable or publishable to npm\nnx g @nrwl/web:lib my-new-lib --buildable\nnx g @nrwl/web:lib my-new-lib \\\n--publishable \\\n--importPath=@myorg/my-new-lib\n```\n\n## Using Web\n\n### Testing Projects\n\nYou can run unit tests with:\n\n```bash\nnx test my-new-app\nnx test my-new-lib\n```\n\nReplace `my-new-app` with the name or your project. This command works for both applications and libraries.\n\nYou can also run E2E tests for applications:\n\n```bash\nnx e2e my-new-app-e2e\n```\n\nReplace `my-new-app-e2e` with the name or your project with `-e2e` appended.\n\n### Building Projects\n\nReact applications can be build with:\n\n```bash\nnx build my-new-app\n```\n\nAnd if you generated a library with `--buildable`, then you can build a library as well:\n\n```bash\nnx build my-new-lib\n```\n\nThe output is in the `dist` folder. You can customize the output folder by setting `outputPath` in the project's `project.json` file.\n\nThe application in `dist` is deployable, and you can try it out locally with:\n\n```bash\nnpx http-server dist/apps/my-new-app\n```\n\nThe library in `dist` is publishable to npm or a private registry.\n\n## More Documentation\n\n- [Using Cypress](/cypress/overview)\n- [Using Jest](/cypress/overview)\n" } diff --git a/docs/generated/packages/workspace.json b/docs/generated/packages/workspace.json index a94e88cb69..dbe57ad88e 100644 --- a/docs/generated/packages/workspace.json +++ b/docs/generated/packages/workspace.json @@ -8,6 +8,7 @@ { "name": "Overview", "id": "overview", + "path": "/packages/workspace", "file": "shared/workspace-plugin", "content": "The workspace plugin contains executors and generators that are useful for any Nx workspace. It should be present in every Nx workspace and other plugins build on it.\n\n## Creating Workspace Generators\n\nCodifying your organization's best practices into workspace generators is a great way to ensure that the best practices are easy to follow and implement. Running `nx g @nrwl/workspace:workspace-generator feature` will create a workspace generator which is written the same way generators are written for Nx plugins. The workspace generator can then be run with `nx workspace-generator feature`.\n\n> See more about [workspace generators](/generators/workspace-generators)\n\n## Reorganizing Projects\n\nAfter some time of working within a workspace, projects might need to be moved or sometimes even removed.\nThe workspace plugin provides the [`@nrwl/workspace:move`](/workspace/move) and [`@nrwl/workspace:remove`](/workspace/remove) generators to help aid with this.\n\n### Moving Projects\n\nRunning `nx g @nrwl/workspace:move new/location/my-lib --projectName my-lib` will move the `my-lib` library to `libs/new/location/my-lib`.\n\nMoving the files manually can be done easily but a lot of steps are often missed when projects are moved. This generator will also handle the following:\n\n1. The project's files will be moved\n2. The project will be renamed to `new-location-my-lib`\n3. The path mapping in `tsconfig.base.json` will be changed to `@npmScope/new/location/my-lib`\n4. Imports in other projects will be changed to `@npmScope/new/location/my-lib`\n5. Paths in target options such as output path will be changed\n6. Other configuration will be updated too such as `extends` in `tsconfig.json`, the name of the project in `jest.config.js`, and the extends in `.eslintrc.json`\n\n> See more about [`@nrwl/workspace:move`](/workspace/move)\n\n### Removing Projects\n\nRunning `nx g @nrwl/workspace:remove my-lib` will remove the `my-lib` from the workspace. It is important to note that sometimes, projects cannot be removed if they are still depended on by other projects.\n\nLike when moving projects, some steps are often missed when removing projects. This generator will also handle the following:\n\n1. Checks if other projects depend on the project being removed. This can be ignored via the `--forceRemove` flag.\n2. The project's files will be deleted.\n3. The project's configuration will be removed.\n4. The path mapping in `tsconfig.base.json` will be removed.\n\n> See more about [`@nrwl/workspace:remove`](/workspace/remove)\n\n## Running custom commands\n\nExecutors provide an optimized way of running targets but unfortunately, not every target has an executor written for it. The [`nx:run-commands`](/packages/nx/executors/run-commands) executor is an executor that runs any command or multiple commands in the shell. This can be useful when integrating with other tools which do not have an executor provided. There is also a generator to help configure this executor.\n\nRunning `nx g nx:run-commands printhello --project my-feature-lib --command 'echo hello'` will create a `my-feature-lib:printhello` target that executes `echo hello` in the shell.\n\n> See more about [`nx:run-commands`](/packages/nx/executors/run-commands)\n" } diff --git a/docs/map.json b/docs/map.json index 4c887f5494..44793167d5 100644 --- a/docs/map.json +++ b/docs/map.json @@ -372,905 +372,6 @@ } ] }, - { - "name": "CLI", - "id": "cli", - "itemList": [ - { - "name": "create-nx-workspace", - "id": "create-nx-workspace", - "file": "generated/cli/create-nx-workspace" - }, - { - "name": "generate", - "id": "generate", - "file": "generated/cli/generate" - }, - { "name": "serve", "id": "serve", "file": "generated/cli/serve" }, - { "name": "build", "id": "build", "file": "generated/cli/build" }, - { "name": "test", "id": "test", "file": "generated/cli/test" }, - { "name": "lint", "id": "lint", "file": "generated/cli/lint" }, - { "name": "e2e", "id": "e2e", "file": "generated/cli/e2e" }, - { "name": "run", "id": "run", "file": "generated/cli/run" }, - { "name": "daemon", "id": "daemon", "file": "generated/cli/daemon" }, - { "name": "graph", "id": "dep-graph", "file": "generated/cli/graph" }, - { - "name": "run-many", - "id": "run-many", - "file": "generated/cli/run-many" - }, - { - "name": "affected", - "id": "affected", - "file": "generated/cli/affected" - }, - { - "name": "affected:graph", - "id": "affected-dep-graph", - "file": "generated/cli/affected-graph" - }, - { - "name": "affected:apps", - "id": "affected-apps", - "file": "generated/cli/affected-apps" - }, - { - "name": "affected:libs", - "id": "affected-libs", - "file": "generated/cli/affected-libs" - }, - { - "name": "print-affected", - "id": "print-affected", - "file": "generated/cli/print-affected" - }, - { - "name": "format:check", - "id": "format-check", - "file": "generated/cli/format-check" - }, - { - "name": "format:write", - "id": "format-write", - "file": "generated/cli/format-write" - }, - { - "name": "migrate", - "id": "migrate", - "file": "generated/cli/migrate" - }, - { "name": "report", "id": "report", "file": "generated/cli/report" }, - { "name": "list", "id": "list", "file": "generated/cli/list" }, - { - "name": "workspace-lint", - "id": "workspace-lint", - "file": "generated/cli/workspace-lint" - }, - { - "name": "workspace-generator", - "id": "workspace-generator", - "file": "generated/cli/workspace-generator" - }, - { - "name": "connect-to-nx-cloud", - "id": "connect-to-nx-cloud", - "file": "generated/cli/connect-to-nx-cloud" - }, - { "name": "reset", "id": "reset", "file": "generated/cli/reset" } - ] - }, - { - "name": "Workspace", - "id": "workspace", - "itemList": [ - { - "id": "nrwl-workspace-overview", - "name": "Overview", - "path": "/packages/workspace" - }, - { - "name": "library generator", - "id": "library", - "path": "/packages/workspace/generators/library" - }, - { - "name": "npm-package generator", - "id": "npm-package", - "path": "/packages/workspace/generators/npm-package" - }, - { - "name": "move generator", - "id": "move", - "path": "/packages/workspace/generators/move" - }, - { - "name": "remove generator", - "id": "remove", - "path": "/packages/workspace/generators/remove" - }, - { - "name": "run-commands generator", - "id": "run-commands-generator", - "path": "/packages/workspace/generators/run-commands" - }, - { - "name": "workspace-generator generator", - "id": "workspace-generator", - "path": "/packages/workspace/generators/workspace-generator" - }, - { - "name": "ci-workflow generator", - "id": "ci-workflow-generator", - "path": "/packages/workspace/generators/ci-workflow" - }, - { - "name": "convert-to-nx-project generator", - "id": "convert-to-nx-project-generator", - "path": "/packages/workspace/generators/convert-to-nx-project" - }, - { - "name": "run-commands executor", - "id": "run-commands-executor", - "path": "/packages/workspace/executors/run-commands" - }, - { - "name": "run-script executor", - "id": "run-script", - "path": "/packages/workspace/executors/run-script" - } - ] - }, - { - "name": "js", - "id": "js", - "itemList": [ - { - "name": "Overview", - "id": "overview", - "path": "/packages/js" - }, - { - "name": "library generator", - "id": "library", - "path": "/packages/js/generators/library" - }, - { - "name": "convert-to-swc generator", - "id": "convert-to-swc", - "path": "/packages/js/generators/convert-to-swc" - }, - { - "name": "tsc executor", - "id": "tsc", - "path": "/packages/js/executors/tsc" - }, - { - "name": "swc executor", - "id": "swc", - "path": "/packages/js/executors/swc" - } - ] - }, - { - "name": "web", - "id": "web", - "itemList": [ - { - "id": "overview", - "name": "Overview", - "path": "/packages/web" - }, - { - "name": "application generator", - "id": "application", - "path": "/packages/web/generators/application" - }, - { - "name": "build executor", - "id": "build", - "path": "/packages/web/executors/webpack" - }, - { - "name": "dev-server executor", - "id": "dev-server", - "path": "/packages/web/executors/dev-server" - }, - { - "name": "file-server executor", - "id": "file-server", - "path": "/packages/web/executors/file-server" - }, - { - "name": "package executor", - "id": "package", - "path": "/packages/web/executors/rollup" - } - ] - }, - { - "name": "angular", - "id": "angular", - "itemList": [ - { - "id": "overview", - "name": "Overview", - "path": "/packages/angular" - }, - { - "name": "application generator", - "id": "application", - "path": "/packages/angular/generators/application" - }, - { - "name": "component generator", - "id": "component", - "path": "/packages/angular/generators/component" - }, - { - "name": "convert-tslint-to-eslint", - "id": "convert-tslint-to-eslint", - "path": "/packages/angular/generators/convert-tslint-to-eslint" - }, - { - "name": "downgrade-module generator", - "id": "downgrade-module", - "path": "/packages/angular/generators/downgrade-module" - }, - { - "name": "karma generator", - "id": "karma", - "path": "/packages/angular/generators/karma" - }, - { - "name": "karma-project generator", - "id": "karma-project", - "path": "/packages/angular/generators/karma-project" - }, - { - "name": "library generator", - "id": "library", - "path": "/packages/angular/generators/library" - }, - { - "name": "library-secondary-entry-point generator", - "id": "library-secondary-entry-point", - "path": "/packages/angular/generators/library-secondary-entry-point" - }, - { - "name": "mfe-host generator", - "id": "mfe-host", - "path": "/packages/angular/generators/mfe-host" - }, - { - "name": "mfe-remote generator", - "id": "mfe-remote", - "path": "/packages/angular/generators/mfe-remote" - }, - { - "name": "move generator", - "id": "move", - "path": "/packages/angular/generators/move" - }, - { - "name": "convert-to-with-mf generator", - "id": "convert-to-with-mf", - "path": "/packages/angular/generators/convert-to-with-mf" - }, - { - "name": "ngrx generator", - "id": "ngrx", - "path": "/packages/angular/generators/ngrx" - }, - { - "name": "scam generator", - "id": "scam", - "path": "/packages/angular/generators/scam" - }, - { - "name": "scam-directive generator", - "id": "scam-directive", - "path": "/packages/angular/generators/scam-directive" - }, - { - "name": "scam-pipe generator", - "id": "scam-pipe", - "path": "/packages/angular/generators/scam-pipe" - }, - { - "name": "setup-mfe generator", - "id": "setup-mfe", - "path": "/packages/angular/generators/setup-mfe" - }, - { - "name": "setup-tailwind generator", - "id": "setup-tailwind", - "path": "/packages/angular/generators/setup-tailwind" - }, - { - "name": "stories generator", - "id": "stories", - "path": "/packages/angular/generators/stories" - }, - { - "name": "storybook-configuration generator", - "id": "storybook-configuration", - "path": "/packages/angular/generators/storybook-configuration" - }, - { - "name": "upgrade-module generator", - "id": "upgrade-module", - "path": "/packages/angular/generators/upgrade-module" - }, - { - "name": "web-worker generator", - "id": "web-worker", - "path": "/packages/angular/generators/web-worker" - }, - { - "name": "delegate-build executor", - "id": "delegate-build", - "path": "/packages/angular/executors/delegate-build" - }, - { - "name": "ng packagr lite executor", - "id": "ng-packagr-lite", - "path": "/packages/angular/executors/ng-packagr-lite" - }, - { - "name": "package executor", - "id": "package", - "path": "/packages/angular/executors/package" - }, - { - "name": "webpack-browser executor", - "id": "webpack-browser", - "path": "/packages/angular/executors/webpack-browser" - }, - { - "name": "webpack-server executor", - "id": "webpack-server", - "path": "/packages/angular/executors/webpack-server" - } - ] - }, - { - "name": "react", - "id": "react", - "itemList": [ - { - "id": "overview", - "name": "Overview", - "path": "/packages/react" - }, - { - "name": "application generator", - "id": "application", - "path": "/packages/react/generators/application" - }, - { - "name": "component generator", - "id": "component", - "path": "/packages/react/generators/component" - }, - { - "name": "component-cypress-spec generator", - "id": "component-cypress-spec", - "path": "/packages/react/generators/component-cypress-spec" - }, - { - "name": "component-story generator", - "id": "component-story", - "path": "/packages/react/generators/component-story" - }, - { - "name": "library generator", - "id": "library", - "path": "/packages/react/generators/library" - }, - { - "name": "redux generator", - "id": "redux", - "path": "/packages/react/generators/redux" - }, - { - "name": "stories generator", - "id": "stories", - "path": "/packages/react/generators/stories" - }, - { - "name": "storybook-configuration generator", - "id": "storybook-configuration", - "path": "/packages/react/generators/storybook-configuration" - }, - { - "name": "hook generator", - "id": "hook", - "path": "/packages/react/generators/hook" - } - ] - }, - { - "name": "jest", - "id": "jest", - "itemList": [ - { - "id": "overview", - "name": "Overview", - "path": "/packages/jest" - }, - { - "name": "jest executor", - "id": "jest", - "path": "/packages/jest/executors/jest" - } - ] - }, - { - "name": "cypress", - "id": "cypress", - "itemList": [ - { - "id": "overview", - "name": "Overview", - "path": "/packages/cypress" - }, - { - "name": "cypress executor", - "id": "cypress", - "path": "/packages/cypress/executors/cypress" - }, - { - "name": "cypress-project generator", - "id": "cypress-project", - "path": "/packages/cypress/generators/cypress-project" - } - ] - }, - { - "name": "storybook", - "id": "storybook", - "itemList": [ - { - "id": "overview", - "name": "Overview", - "path": "/packages/storybook" - }, - { - "id": "overview-react", - "name": "Overview (React)", - "file": "shared/guides/storybook/plugin-react" - }, - { - "id": "overview-angular", - "name": "Overview (Angular)", - "file": "shared/guides/storybook/plugin-angular" - }, - { - "id": "migrate-webpack-final-react", - "name": "Migrate to the Nrwl React Storybook Preset", - "file": "shared/guides/storybook/migrate-webpack-final-react" - }, - { - "id": "migrate-webpack-final-angular", - "name": "Migrate to the Nrwl Angular Storybook Preset", - "file": "shared/guides/storybook/migrate-webpack-final-angular" - }, - { - "id": "upgrade-storybook-v6-react", - "name": "Upgrading to Storybook 6 (React)", - "file": "shared/guides/storybook/storybook-v6-react" - }, - { - "id": "upgrade-storybook-v6-angular", - "name": "Upgrading to Storybook 6 (Angular)", - "file": "shared/guides/storybook/storybook-v6-angular" - }, - { - "id": "storybook-composition-setup", - "name": "Setting up Storybook Composition with Nx", - "file": "shared/guides/storybook/storybook-composition-setup" - }, - { - "name": "configuration generator", - "id": "configuration", - "path": "/packages/storybook/generators/configuration" - }, - { - "name": "cypress-project generator", - "id": "cypress-project", - "path": "/packages/storybook/generators/cypress-project" - }, - { - "name": "Executors: Build", - "id": "executors-build", - "path": "/packages/storybook/executors/build" - }, - { - "name": "Executors: Storybook", - "id": "executors-storybook", - "path": "/packages/storybook/executors/storybook" - } - ] - }, - { - "name": "linter", - "id": "linter", - "itemList": [ - { - "id": "overview", - "name": "Overview", - "path": "/packages/linter" - }, - { - "id": "eslint-plugin-nx", - "name": "eslint-plugin-nx", - "file": "shared/eslint-plugin-nx" - }, - { - "name": "eslint executor", - "id": "eslint", - "path": "/packages/linter/executors/eslint" - }, - { - "name": "lint executor", - "id": "lint", - "path": "/packages/linter/executors/lint" - }, - { - "name": "workspace-rule generator", - "id": "workspace-rule", - "path": "/packages/linter/generators/workspace-rule" - } - ] - }, - { - "name": "node", - "id": "node", - "itemList": [ - { - "id": "overview", - "name": "Overview", - "path": "/packages/node" - }, - { - "name": "application generator", - "id": "application", - "path": "/packages/node/generators/application" - }, - { - "name": "library generator", - "id": "library", - "path": "/packages/node/generators/library" - }, - { - "name": "webpack executor", - "id": "webpack", - "path": "/packages/node/executors/webpack" - }, - { - "name": "node executor", - "id": "node", - "path": "/packages/node/executors/node" - } - ] - }, - { - "name": "express", - "id": "express", - "itemList": [ - { - "id": "overview", - "name": "Overview", - "path": "/packages/express" - }, - { - "name": "application generator", - "id": "application", - "path": "/packages/express/generators/application" - } - ] - }, - { - "name": "nest", - "id": "nest", - "itemList": [ - { - "id": "overview", - "name": "Overview", - "path": "/packages/nest" - }, - { - "name": "application generator", - "id": "application", - "path": "/packages/nest/generators/application" - }, - { - "name": "class generator", - "id": "class", - "path": "/packages/nest/generators/class" - }, - { - "name": "controller generator", - "id": "controller", - "path": "/packages/nest/generators/controller" - }, - { - "name": "decorator generator", - "id": "decorator", - "path": "/packages/nest/generators/decorator" - }, - { - "name": "filter generator", - "id": "filter", - "path": "/packages/nest/generators/filter" - }, - { - "name": "gateway generator", - "id": "gateway", - "path": "/packages/nest/generators/gateway" - }, - { - "name": "guard generator", - "id": "guard", - "path": "/packages/nest/generators/guard" - }, - { - "name": "interceptor generator", - "id": "interceptor", - "path": "/packages/nest/generators/interceptor" - }, - { - "name": "interface generator", - "id": "interface", - "path": "/packages/nest/generators/interface" - }, - { - "name": "library generator", - "id": "library", - "path": "/packages/nest/generators/library" - }, - { - "name": "middleware generator", - "id": "middleware", - "path": "/packages/nest/generators/middleware" - }, - { - "name": "module generator", - "id": "module", - "path": "/packages/nest/generators/module" - }, - { - "name": "pipe generator", - "id": "pipe", - "path": "/packages/nest/generators/pipe" - }, - { - "name": "provider generator", - "id": "provider", - "path": "/packages/nest/generators/provider" - }, - { - "name": "resolver generator", - "id": "resolver", - "path": "/packages/nest/generators/resolver" - }, - { - "name": "resource generator", - "id": "resource", - "path": "/packages/nest/generators/resource" - }, - { - "name": "service generator", - "id": "service", - "path": "/packages/nest/generators/service" - }, - { - "name": "convert-tslint-to-eslint", - "id": "convert-tslint-to-eslint", - "path": "/packages/nest/generators/convert-tslint-to-eslint" - } - ] - }, - { - "name": "next", - "id": "next", - "itemList": [ - { - "id": "overview", - "name": "Overview", - "path": "/packages/next" - }, - { - "name": "application generator", - "id": "application", - "path": "/packages/next/generators/application" - }, - { - "name": "component generator", - "id": "component", - "path": "/packages/next/generators/component" - }, - { - "name": "page generator", - "id": "page", - "path": "/packages/next/generators/page" - }, - { - "name": "build executor", - "id": "build", - "path": "/packages/next/executors/build" - }, - { - "name": "server executor", - "id": "server", - "path": "/packages/next/executors/server" - }, - { - "name": "export executor", - "id": "export", - "path": "/packages/next/executors/export" - } - ] - }, - { - "name": "detox", - "id": "detox", - "itemList": [ - { - "id": "overview", - "name": "Overview", - "path": "/packages/detox" - }, - { - "name": "application generator", - "id": "application", - "path": "/packages/detox/generators/application" - }, - { - "name": "build executor", - "id": "build", - "path": "/packages/detox/executors/build" - }, - { - "name": "test executor", - "id": "test", - "path": "/packages/detox/executors/test" - } - ] - }, - { - "name": "react native", - "id": "react-native", - "itemList": [ - { - "id": "overview", - "name": "Overview", - "path": "/packages/react-native" - }, - { - "name": "application generator", - "id": "application", - "path": "/packages/react-native/generators/application" - }, - { - "name": "component generator", - "id": "component", - "path": "/packages/react-native/generators/component" - }, - { - "name": "library generator", - "id": "library", - "path": "/packages/react-native/generators/library" - }, - { - "name": "component-story generator", - "id": "component-story", - "path": "/packages/react-native/generators/component-story" - }, - { - "name": "stories generator", - "id": "stories", - "path": "/packages/react-native/generators/stories" - }, - { - "name": "storybook-configuration generator", - "id": "storybook-configuration", - "path": "/packages/react-native/generators/storybook-configuration" - }, - { - "name": "build android executor", - "id": "build-android", - "path": "/packages/react-native/executors/build-android" - }, - { - "name": "bundle executor", - "id": "bundle", - "path": "/packages/react-native/executors/bundle" - }, - { - "name": "ensure symlink executor", - "id": "ensure-symlink", - "path": "/packages/react-native/executors/ensure-symlink" - }, - { - "name": "run android executor", - "id": "run-android", - "path": "/packages/react-native/executors/run-android" - }, - { - "name": "run ios executor", - "id": "run-ios", - "path": "/packages/react-native/executors/run-ios" - }, - { - "name": "start executor", - "id": "start", - "path": "/packages/react-native/executors/start" - }, - { - "name": "storybook executor", - "id": "storybook", - "path": "/packages/react-native/executors/storybook" - }, - { - "name": "sync deps executor", - "id": "sync-deps", - "path": "/packages/react-native/executors/sync-deps" - } - ] - }, - { - "name": "Nx Plugin", - "id": "nx-plugin", - "itemList": [ - { - "id": "overview", - "name": "Overview", - "path": "/packages/nx-plugin" - }, - { - "name": "executor generator", - "id": "executor", - "path": "/packages/nx-plugin/generators/executor" - }, - { - "name": "migration generator", - "id": "migration", - "path": "/packages/nx-plugin/generators/migration" - }, - { - "name": "plugin generator", - "id": "plugin", - "path": "/packages/nx-plugin/generators/plugin" - }, - { - "name": "generator generator", - "id": "schematic", - "path": "/packages/nx-plugin/generators/generator" - }, - { - "name": "e2e executor", - "id": "e2e", - "path": "/packages/nx-plugin/executors/e2e" - } - ] - }, - { - "name": "Nx Devkit", - "id": "nx-devkit", - "itemList": [ - { - "id": "index", - "name": "Overview", - "file": "generated/api-nx-devkit/index" - }, - { - "id": "ngcli_adapter", - "name": "Ng CLI Adapter", - "file": "generated/api-nx-devkit/ngcli_adapter" - } - ] - }, { "name": "Executors / Builders", "id": "executors", @@ -1594,6 +695,93 @@ "name": "additional api references", "id": "additional-api-references", "itemList": [ + { + "name": "cli", + "id": "cli", + "itemList": [ + { + "name": "create-nx-workspace", + "id": "create-nx-workspace", + "file": "generated/cli/create-nx-workspace" + }, + { + "name": "generate", + "id": "generate", + "file": "generated/cli/generate" + }, + { "name": "serve", "id": "serve", "file": "generated/cli/serve" }, + { "name": "build", "id": "build", "file": "generated/cli/build" }, + { "name": "test", "id": "test", "file": "generated/cli/test" }, + { "name": "lint", "id": "lint", "file": "generated/cli/lint" }, + { "name": "e2e", "id": "e2e", "file": "generated/cli/e2e" }, + { "name": "run", "id": "run", "file": "generated/cli/run" }, + { "name": "daemon", "id": "daemon", "file": "generated/cli/daemon" }, + { "name": "graph", "id": "dep-graph", "file": "generated/cli/graph" }, + { + "name": "run-many", + "id": "run-many", + "file": "generated/cli/run-many" + }, + { + "name": "affected", + "id": "affected", + "file": "generated/cli/affected" + }, + { + "name": "affected:graph", + "id": "affected-dep-graph", + "file": "generated/cli/affected-graph" + }, + { + "name": "affected:apps", + "id": "affected-apps", + "file": "generated/cli/affected-apps" + }, + { + "name": "affected:libs", + "id": "affected-libs", + "file": "generated/cli/affected-libs" + }, + { + "name": "print-affected", + "id": "print-affected", + "file": "generated/cli/print-affected" + }, + { + "name": "format:check", + "id": "format-check", + "file": "generated/cli/format-check" + }, + { + "name": "format:write", + "id": "format-write", + "file": "generated/cli/format-write" + }, + { + "name": "migrate", + "id": "migrate", + "file": "generated/cli/migrate" + }, + { "name": "report", "id": "report", "file": "generated/cli/report" }, + { "name": "list", "id": "list", "file": "generated/cli/list" }, + { + "name": "workspace-lint", + "id": "workspace-lint", + "file": "generated/cli/workspace-lint" + }, + { + "name": "workspace-generator", + "id": "workspace-generator", + "file": "generated/cli/workspace-generator" + }, + { + "name": "connect-to-nx-cloud", + "id": "connect-to-nx-cloud", + "file": "generated/cli/connect-to-nx-cloud" + }, + { "name": "reset", "id": "reset", "file": "generated/cli/reset" } + ] + }, { "name": "workspace", "id": "workspace", @@ -1601,6 +789,7 @@ { "name": "Overview", "id": "overview", + "path": "/packages/workspace", "file": "shared/workspace-plugin" } ] @@ -1612,6 +801,7 @@ { "name": "Overview", "id": "overview", + "path": "/packages/js", "file": "shared/js-plugin" } ] @@ -1623,6 +813,7 @@ { "name": "Overview", "id": "overview", + "path": "/packages/web", "file": "shared/web-plugin" } ] @@ -1634,6 +825,7 @@ { "name": "Overview", "id": "overview", + "path": "/packages/angular", "file": "shared/angular-plugin" } ] @@ -1645,6 +837,7 @@ { "name": "Overview", "id": "overview", + "path": "/packages/react", "file": "shared/react-plugin" } ] @@ -1656,6 +849,7 @@ { "name": "Overview", "id": "overview", + "path": "/packages/jest", "file": "shared/jest-plugin" } ] @@ -1667,6 +861,7 @@ { "name": "Overview", "id": "overview", + "path": "/packages/cypress", "file": "shared/cypress-plugin" } ] @@ -1678,6 +873,7 @@ { "id": "overview", "name": "Overview Generic", + "path": "/packages/storybook", "file": "shared/guides/storybook/plugin-overview" }, { @@ -1724,6 +920,7 @@ { "id": "overview", "name": "Overview", + "path": "/packages/linter", "file": "shared/linter-plugin" }, { @@ -1733,6 +930,18 @@ } ] }, + { + "name": "eslint-plugin-nx", + "id": "eslint-plugin-nx", + "itemList": [ + { + "id": "overview", + "name": "Overview", + "path": "/packages/eslint-plugin-nx", + "file": "shared/eslint-plugin-nx" + } + ] + }, { "name": "node", "id": "node", @@ -1740,6 +949,7 @@ { "id": "overview", "name": "Overview", + "path": "/packages/node", "file": "shared/node-plugin" } ] @@ -1751,6 +961,7 @@ { "id": "overview", "name": "Overview", + "path": "/packages/express", "file": "shared/express-plugin" } ] @@ -1762,6 +973,7 @@ { "id": "overview", "name": "Overview", + "path": "/packages/nest", "file": "shared/nest-plugin" } ] @@ -1773,6 +985,7 @@ { "id": "overview", "name": "Overview", + "path": "/packages/next", "file": "shared/next-plugin" } ] @@ -1784,6 +997,7 @@ { "id": "overview", "name": "Overview", + "path": "/packages/detox", "file": "shared/detox-plugin" } ] @@ -1795,6 +1009,7 @@ { "id": "overview", "name": "Overview", + "path": "/packages/react-native", "file": "shared/react-native-plugin" } ] @@ -1806,6 +1021,7 @@ { "id": "overview", "name": "Overview", + "path": "/packages/nx-plugin", "file": "shared/nx-plugin" } ] diff --git a/nx-dev/data-access-documents/src/lib/documents.api.ts b/nx-dev/data-access-documents/src/lib/documents.api.ts index 3a782e8f24..de502122ed 100644 --- a/nx-dev/data-access-documents/src/lib/documents.api.ts +++ b/nx-dev/data-access-documents/src/lib/documents.api.ts @@ -9,15 +9,26 @@ export interface StaticDocumentPaths { } export class DocumentsApi { + private documents: DocumentMetadata; constructor( private readonly options: { publicDocsRoot: string; - documents: DocumentMetadata; + documentSources: DocumentMetadata[]; } ) { if (!options.publicDocsRoot) { throw new Error('public docs root cannot be undefined'); } + if (!options.documentSources) { + throw new Error('public document sources cannot be undefined'); + } + this.documents = { + id: 'documents', + name: 'documents', + itemList: options.documentSources.flatMap( + (x) => x.itemList + ) as DocumentMetadata[], + }; } getDocument(path: string[]): DocumentData { @@ -41,7 +52,7 @@ export class DocumentsApi { } getDocuments(): DocumentMetadata { - const docs = this.options.documents; + const docs = this.documents; if (docs) return docs; throw new Error(`Cannot find any documents`); } @@ -55,14 +66,6 @@ export class DocumentsApi { recur(ii, [...acc, curr.id]); }); } else { - /* - * Do not try to get paths for Packages (done by the PackagesApi). - * This should be removed when the packages/schemas menu is inferred directly from PackagesApi. - * TODO@ben: Remove this when packages schemas menu is auto-generated. - */ - if (!!curr['path'] && curr['path'].startsWith('/packages/')) - return void 0; // Do nothing - paths.push({ params: { segments: [...acc, curr.id], @@ -71,9 +74,9 @@ export class DocumentsApi { } } - if (!this.options.documents || !this.options.documents.itemList) + if (!this.documents || !this.documents.itemList) throw new Error(`Can't find any items`); - this.options.documents.itemList.forEach((item) => { + this.documents.itemList.forEach((item) => { recur(item, []); }); @@ -81,7 +84,7 @@ export class DocumentsApi { } private getFilePath(path: string[]): string { - let items = this.options.documents?.itemList; + let items = this.documents?.itemList; if (!items) { throw new Error(`Document not found`); diff --git a/nx-dev/data-access-documents/src/lib/menu.api.ts b/nx-dev/data-access-documents/src/lib/menu.api.ts deleted file mode 100644 index da70604881..0000000000 --- a/nx-dev/data-access-documents/src/lib/menu.api.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { DocumentMetadata } from '@nrwl/nx-dev/models-document'; -import { Menu } from '@nrwl/nx-dev/models-menu'; -import { - createMenuItems, - getApiSection, - getBasicSection, - getDeepDiveSection, -} from './menu.utils'; - -export class MenuApi { - private menuCache: Menu | null = null; - - constructor(private readonly documents: DocumentMetadata) {} - - getMenu(): Menu { - let menu = this.menuCache; - - if (!menu) { - const items = createMenuItems(this.documents); - if (items) { - menu = { - sections: [ - getBasicSection(items), - getDeepDiveSection(items), - getApiSection(items), - ], - }; - } else { - throw new Error(`Cannot find any documents`); - } - this.menuCache = menu; - } - - return menu; - } -} diff --git a/nx-dev/data-access-documents/src/node.index.ts b/nx-dev/data-access-documents/src/node.index.ts index a4524643df..63a7501b45 100644 --- a/nx-dev/data-access-documents/src/node.index.ts +++ b/nx-dev/data-access-documents/src/node.index.ts @@ -1,2 +1 @@ export * from './lib/documents.api'; -export * from './lib/menu.api'; diff --git a/nx-dev/data-access-menu/.babelrc b/nx-dev/data-access-menu/.babelrc new file mode 100644 index 0000000000..cf7ddd99c6 --- /dev/null +++ b/nx-dev/data-access-menu/.babelrc @@ -0,0 +1,3 @@ +{ + "presets": [["@nrwl/web/babel", { "useBuiltIns": "usage" }]] +} diff --git a/nx-dev/data-access-menu/.eslintrc.json b/nx-dev/data-access-menu/.eslintrc.json new file mode 100644 index 0000000000..9d9c0db55b --- /dev/null +++ b/nx-dev/data-access-menu/.eslintrc.json @@ -0,0 +1,18 @@ +{ + "extends": ["../../.eslintrc.json"], + "ignorePatterns": ["!**/*"], + "overrides": [ + { + "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], + "rules": {} + }, + { + "files": ["*.ts", "*.tsx"], + "rules": {} + }, + { + "files": ["*.js", "*.jsx"], + "rules": {} + } + ] +} diff --git a/nx-dev/data-access-menu/README.md b/nx-dev/data-access-menu/README.md new file mode 100644 index 0000000000..1d96ff10d3 --- /dev/null +++ b/nx-dev/data-access-menu/README.md @@ -0,0 +1,11 @@ +# nx-dev-data-access-menu + +This library was generated with [Nx](https://nx.dev). + +## Running unit tests + +Run `nx test nx-dev-data-access-menu` to execute the unit tests via [Jest](https://jestjs.io). + +## Running lint + +Run `nx lint nx-dev-data-access-menu` to execute the lint via [ESLint](https://eslint.org/). diff --git a/nx-dev/data-access-menu/jest.config.ts b/nx-dev/data-access-menu/jest.config.ts new file mode 100644 index 0000000000..1adbc8b4b5 --- /dev/null +++ b/nx-dev/data-access-menu/jest.config.ts @@ -0,0 +1,14 @@ +module.exports = { + displayName: 'nx-dev-data-access-menu', + preset: '../../jest.preset.ts', + globals: { + 'ts-jest': { + tsconfig: '/tsconfig.spec.json', + }, + }, + transform: { + '^.+\\.[tj]sx?$': 'ts-jest', + }, + moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'], + coverageDirectory: '../../coverage/nx-dev/data-access-menu', +}; diff --git a/nx-dev/data-access-menu/project.json b/nx-dev/data-access-menu/project.json new file mode 100644 index 0000000000..06071bb858 --- /dev/null +++ b/nx-dev/data-access-menu/project.json @@ -0,0 +1,22 @@ +{ + "sourceRoot": "nx-dev/data-access-menu/src", + "projectType": "library", + "targets": { + "lint": { + "executor": "@nrwl/linter:eslint", + "outputs": ["{options.outputFile}"], + "options": { + "lintFilePatterns": ["nx-dev/data-access-menu/**/*.ts"] + } + }, + "test": { + "executor": "@nrwl/jest:jest", + "outputs": ["coverage/nx-dev/data-access-menu"], + "options": { + "jestConfig": "nx-dev/data-access-menu/jest.config.ts", + "passWithNoTests": true + } + } + }, + "tags": [] +} diff --git a/nx-dev/data-access-menu/src/index.ts b/nx-dev/data-access-menu/src/index.ts new file mode 100644 index 0000000000..c9cab6d72f --- /dev/null +++ b/nx-dev/data-access-menu/src/index.ts @@ -0,0 +1 @@ +export * from './lib/menu.api'; diff --git a/nx-dev/data-access-menu/src/lib/menu.api.ts b/nx-dev/data-access-menu/src/lib/menu.api.ts new file mode 100644 index 0000000000..ff759b3467 --- /dev/null +++ b/nx-dev/data-access-menu/src/lib/menu.api.ts @@ -0,0 +1,51 @@ +import { DocumentMetadata } from '@nrwl/nx-dev/models-document'; +import { Menu, MenuSection } from '@nrwl/nx-dev/models-menu'; +import { + createMenuItems, + getBasicSection, + getDeepDiveSection, + getPackageApiSection, +} from './menu.utils'; + +export class MenuApi { + private menuCache: Menu | null = null; + + constructor( + private readonly documents: DocumentMetadata, + private readonly packageDocuments: DocumentMetadata[] + ) {} + + getMenu(): Menu { + let menu = this.menuCache; + + if (menu) return menu; + + const items = createMenuItems(this.documents); + if (items) { + menu = { + sections: [ + getBasicSection(items), + getDeepDiveSection(items), + // getApiSection(items), + this.getReferenceApiMenuSection(), + ], + }; + } else { + throw new Error(`Cannot find any documents`); + } + this.menuCache = menu; + + return menu; + } + + getReferenceApiMenuSection(): MenuSection { + const documents: DocumentMetadata = { + id: 'packages', + name: 'Packages', + itemList: this.packageDocuments, + }; + + const items = createMenuItems(documents); + return getPackageApiSection(items); + } +} diff --git a/nx-dev/data-access-documents/src/lib/menu.utils.ts b/nx-dev/data-access-menu/src/lib/menu.utils.ts similarity index 77% rename from nx-dev/data-access-documents/src/lib/menu.utils.ts rename to nx-dev/data-access-menu/src/lib/menu.utils.ts index bdc91802d9..012d5ab0ef 100644 --- a/nx-dev/data-access-documents/src/lib/menu.utils.ts +++ b/nx-dev/data-access-menu/src/lib/menu.utils.ts @@ -7,7 +7,7 @@ export function createMenuItems(root: DocumentMetadata): MenuItem[] { const createPathMetadata = (g: DocumentMetadata, parentId = ''): MenuItem => { const pathData = { ...g, - path: g['path'] ?? `/${parentId}/${g.id}`, + path: g.path ?? `/${parentId}/${g.id}`, }; if (Array.isArray(g.itemList)) { @@ -86,31 +86,18 @@ export function getDeepDiveSection(items: MenuItem[]): MenuSection { }; } -export function getApiSection(items: MenuItem[]): MenuSection { +export function getPackageApiSection(items: MenuItem[]): MenuSection { return { id: 'api', name: 'API / Reference', itemList: items.filter( (m) => - // m.id === 'plugins-overview' || - m.id === 'workspace' || - m.id === 'js' || - m.id === 'web' || - m.id === 'angular' || - m.id === 'react' || - m.id === 'jest' || - m.id === 'cypress' || - m.id === 'storybook' || - m.id === 'linter' || - m.id === 'node' || - m.id === 'express' || - m.id === 'nest' || - m.id === 'next' || - m.id === 'detox' || - m.id === 'react-native' || - m.id === 'nx-plugin' || - m.id === 'nx-devkit' || - m.id === 'cli' + m.id !== 'add-nx-to-monorepo' && + m.id !== 'cra-to-nx' && + m.id !== 'create-nx-plugin' && + m.id !== 'create-nx-workspace' && + m.id !== 'make-angular-cli-faster' && + m.id !== 'tao' ), }; } diff --git a/nx-dev/data-access-menu/tsconfig.json b/nx-dev/data-access-menu/tsconfig.json new file mode 100644 index 0000000000..e258886ffc --- /dev/null +++ b/nx-dev/data-access-menu/tsconfig.json @@ -0,0 +1,19 @@ +{ + "extends": "../../tsconfig.base.json", + "files": [], + "include": [], + "references": [ + { + "path": "./tsconfig.lib.json" + }, + { + "path": "./tsconfig.spec.json" + } + ], + "compilerOptions": { + "forceConsistentCasingInFileNames": true, + "strict": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true + } +} diff --git a/nx-dev/data-access-menu/tsconfig.lib.json b/nx-dev/data-access-menu/tsconfig.lib.json new file mode 100644 index 0000000000..b3f90c22fe --- /dev/null +++ b/nx-dev/data-access-menu/tsconfig.lib.json @@ -0,0 +1,10 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../dist/out-tsc", + "declaration": true, + "types": [] + }, + "include": ["**/*.ts"], + "exclude": ["jest.config.ts", "**/*.spec.ts"] +} diff --git a/nx-dev/data-access-menu/tsconfig.spec.json b/nx-dev/data-access-menu/tsconfig.spec.json new file mode 100644 index 0000000000..ff08addd60 --- /dev/null +++ b/nx-dev/data-access-menu/tsconfig.spec.json @@ -0,0 +1,20 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../dist/out-tsc", + "module": "commonjs", + "types": ["jest", "node"] + }, + "include": [ + "jest.config.ts", + "**/*.test.ts", + "**/*.spec.ts", + "**/*.test.tsx", + "**/*.spec.tsx", + "**/*.test.js", + "**/*.spec.js", + "**/*.test.jsx", + "**/*.spec.jsx", + "**/*.d.ts" + ] +} diff --git a/nx-dev/data-access-packages/src/lib/packages.api.ts b/nx-dev/data-access-packages/src/lib/packages.api.ts index 3402dd4a7a..f486ca58da 100644 --- a/nx-dev/data-access-packages/src/lib/packages.api.ts +++ b/nx-dev/data-access-packages/src/lib/packages.api.ts @@ -1,3 +1,4 @@ +import { DocumentMetadata } from '@nrwl/nx-dev/models-document'; import { PackageMetadata, SchemaMetadata } from '@nrwl/nx-dev/models-package'; import { readFileSync } from 'fs'; @@ -24,22 +25,21 @@ export class PackagesApi { } } - getPackage(name: string): PackageMetadata { + getPackage(id: string): PackageMetadata { const packagePath: string | null = - this.options.packagesIndex.find((p) => p.name === name)?.path ?? null; + this.options.packagesIndex.find((p) => p.name === id)?.path ?? null; - if (!packagePath) - throw new Error('Package name could not be found: ' + name); + if (!packagePath) throw new Error('Package name could not be found: ' + id); - if (!this.database[name]) - this.database[name] = JSON.parse( + if (!this.database[id]) + this.database[id] = JSON.parse( readFileSync( [this.options.publicPackagesRoot, packagePath].join('/'), 'utf-8' ) ); - return this.database[name]; + return this.database[id]; } getStaticPackagePaths(): StaticPackagePaths[] { @@ -69,6 +69,38 @@ export class PackagesApi { return paths; } + getPackageDocuments(): DocumentMetadata { + return { + id: 'packages', + name: 'packages', + itemList: this.options.packagesIndex.map((p) => ({ + id: p.name, + name: p.name.replace(/-/gi, ' '), + path: `/packages/${p.name}`, + itemList: this.getPackage(p.name) + .documentation.map((d) => ({ + id: d.id, + name: d.name, + path: d.path, + })) + .concat( + p.schemas.executors.map((e) => ({ + id: e, + name: e, + path: `/packages/${p.name}/executors/${e}`, + })) + ) + .concat( + p.schemas.generators.map((g) => ({ + id: g, + name: g, + path: `/packages/${p.name}/generators/${g}`, + })) + ), + })), + }; + } + getPackageSchema( packageName: string, type: 'executors' | 'generators', diff --git a/nx-dev/models-document/src/lib/documents.models.ts b/nx-dev/models-document/src/lib/documents.models.ts index 6569121e3f..d21f025b6f 100644 --- a/nx-dev/models-document/src/lib/documents.models.ts +++ b/nx-dev/models-document/src/lib/documents.models.ts @@ -9,5 +9,6 @@ export interface DocumentMetadata { id: string; name?: string; file?: string; + path?: string; itemList?: DocumentMetadata[]; } diff --git a/nx-dev/models-package/src/lib/package.models.ts b/nx-dev/models-package/src/lib/package.models.ts index 0843060ed5..156d293b25 100644 --- a/nx-dev/models-package/src/lib/package.models.ts +++ b/nx-dev/models-package/src/lib/package.models.ts @@ -8,7 +8,13 @@ export interface PackageMetadata { githubRoot: string; name: string; description: string; - documentation: { id: string; name: string; content: string; file: string }[]; + documentation: { + id: string; + name: string; + content: string; + file: string; + path: string; + }[]; root: string; source: string; generators: SchemaMetadata[]; diff --git a/nx-dev/nx-dev/lib/api.ts b/nx-dev/nx-dev/lib/api.ts index fa879c9c30..647d205b39 100644 --- a/nx-dev/nx-dev/lib/api.ts +++ b/nx-dev/nx-dev/lib/api.ts @@ -1,7 +1,5 @@ -import { - DocumentsApi, - MenuApi, -} from '@nrwl/nx-dev/data-access-documents/node-only'; +import { DocumentsApi } from '@nrwl/nx-dev/data-access-documents/node-only'; +import { MenuApi } from '@nrwl/nx-dev/data-access-menu'; import { PackagesApi } from '@nrwl/nx-dev/data-access-packages/node-only'; import { DocumentMetadata } from '@nrwl/nx-dev/models-document'; @@ -17,7 +15,13 @@ export const packagesApi = new PackagesApi({ export const documentsApi = new DocumentsApi({ publicDocsRoot: 'nx-dev/nx-dev/public/documentation', - documents: documents.find((x) => x.id === 'default') as DocumentMetadata, + documentSources: [ + documents.find((x) => x.id === 'default'), + documents.find((x) => x.id === 'additional-api-references'), + ].filter((x) => !!x) as DocumentMetadata[], }); -export const menuApi = new MenuApi(documentsApi.getDocuments()); +export const menuApi = new MenuApi( + documentsApi.getDocuments(), + packagesApi.getPackageDocuments().itemList as DocumentMetadata[] +); diff --git a/scripts/documentation/map-link-checker.ts b/scripts/documentation/map-link-checker.ts index 1a966b7ac1..cadac8bda2 100644 --- a/scripts/documentation/map-link-checker.ts +++ b/scripts/documentation/map-link-checker.ts @@ -7,11 +7,32 @@ console.log(`${chalk.blue('i')} Documentation Map Check`); const basePath = 'docs'; const sharedFilesPattern = 'shared/cli'; +// These are Overview documentation files showed at url like `/packages/:name` +const allowedOrphanFiles: string[] = [ + 'shared/angular-plugin.md', + 'shared/cypress-plugin.md', + 'shared/detox-plugin.md', + 'shared/express-plugin.md', + 'shared/guides/storybook/plugin-overview.md', + 'shared/jest-plugin.md', + 'shared/js-plugin.md', + 'shared/linter-plugin.md', + 'shared/nest-plugin.md', + 'shared/next-plugin.md', + 'shared/node-plugin.md', + 'shared/nx-plugin.md', + 'shared/react-native-plugin.md', + 'shared/react-plugin.md', + 'shared/web-plugin.md', + 'shared/workspace-plugin.md', +].map((x) => x.replace('.md', '')); + const readmePathList: string[] = glob .sync(`${basePath}/**/*.md`) .map((path: string) => path.split(basePath)[1]) .map((path: string) => path.slice(1, -3)) // Removing first `/` and `.md` - .filter((path: string) => !path.startsWith(sharedFilesPattern)); + .filter((path: string) => !path.startsWith(sharedFilesPattern)) + .filter((i) => !allowedOrphanFiles.includes(i)); // Removing the paths allowed to be orphans function pathExtractor( pathList: string[] = [], diff --git a/scripts/documentation/open-graph/generate-images.ts b/scripts/documentation/open-graph/generate-images.ts index 7c01dd4ca7..dd25a0b482 100644 --- a/scripts/documentation/open-graph/generate-images.ts +++ b/scripts/documentation/open-graph/generate-images.ts @@ -2,7 +2,13 @@ import { Canvas, Image, SKRSContext2D } from '@napi-rs/canvas'; import { readJSONSync, ensureDir, readFile, writeFileSync } from 'fs-extra'; import { resolve } from 'path'; -const documents: any[] = readJSONSync('./docs/map.json', 'utf8')[0]['itemList']; +const mapJson = readJSONSync('./docs/map.json', 'utf8'); + +const documents: any[] = [ + ...mapJson.find((x) => x.id === 'default')?.['itemList'], + ...mapJson.find((x) => x.id === 'additional-api-references')?.['itemList'], +].filter(Boolean); + const packages: { name: string; path: string; diff --git a/scripts/documentation/package-schemas/package-metadata.ts b/scripts/documentation/package-schemas/package-metadata.ts index 5c5460f307..57f084a731 100644 --- a/scripts/documentation/package-schemas/package-metadata.ts +++ b/scripts/documentation/package-schemas/package-metadata.ts @@ -107,6 +107,7 @@ export function getPackageMetadataList( documentation: !!hasDocumentation ? hasDocumentation.itemList.map((item) => ({ ...item, + path: item.path, file: item.file, content: readFileSync(join('docs', item.file + '.md'), 'utf8'), })) diff --git a/tsconfig.base.json b/tsconfig.base.json index f79815c8c6..63e65ae4b2 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -48,6 +48,7 @@ "@nrwl/nx-dev/data-access-documents/node-only": [ "./nx-dev/data-access-documents/src/node.index.ts" ], + "@nrwl/nx-dev/data-access-menu": ["nx-dev/data-access-menu/src/index.ts"], "@nrwl/nx-dev/data-access-packages": [ "./nx-dev/data-access-packages/src/index.ts" ], diff --git a/workspace.json b/workspace.json index 1959a69df6..060e9cf69a 100644 --- a/workspace.json +++ b/workspace.json @@ -46,6 +46,7 @@ "nx": "packages/nx", "nx-dev": "nx-dev/nx-dev", "nx-dev-data-access-documents": "nx-dev/data-access-documents", + "nx-dev-data-access-menu": "nx-dev/data-access-menu", "nx-dev-data-access-packages": "nx-dev/data-access-packages", "nx-dev-e2e": "nx-dev/nx-dev-e2e", "nx-dev-feature-analytics": "nx-dev/feature-analytics",