diff --git a/docs/generated/manifests/menus.json b/docs/generated/manifests/menus.json index 81d7ee3d849e1e..2a8c79244816a7 100644 --- a/docs/generated/manifests/menus.json +++ b/docs/generated/manifests/menus.json @@ -6700,39 +6700,6 @@ "isExternal": false, "disableCollapsible": false }, - { - "id": "executors", - "path": "/packages/workspace/executors", - "name": "executors", - "children": [ - { - "id": "run-commands", - "path": "/packages/workspace/executors/run-commands", - "name": "run-commands", - "children": [], - "isExternal": false, - "disableCollapsible": false - }, - { - "id": "counter", - "path": "/packages/workspace/executors/counter", - "name": "counter", - "children": [], - "isExternal": false, - "disableCollapsible": false - }, - { - "id": "run-script", - "path": "/packages/workspace/executors/run-script", - "name": "run-script", - "children": [], - "isExternal": false, - "disableCollapsible": false - } - ], - "isExternal": false, - "disableCollapsible": false - }, { "id": "generators", "path": "/packages/workspace/generators", diff --git a/docs/generated/manifests/packages.json b/docs/generated/manifests/packages.json index f27d3dc71566ff..1f07c8c68a7452 100644 --- a/docs/generated/manifests/packages.json +++ b/docs/generated/manifests/packages.json @@ -2928,35 +2928,7 @@ }, "root": "/packages/workspace", "source": "/packages/workspace/src", - "executors": { - "/packages/workspace/executors/run-commands": { - "description": "Run any custom commands with Nx.", - "file": "generated/packages/workspace/executors/run-commands.json", - "hidden": false, - "name": "run-commands", - "originalFilePath": "/packages/workspace/src/executors/run-commands/schema.json", - "path": "/packages/workspace/executors/run-commands", - "type": "executor" - }, - "/packages/workspace/executors/counter": { - "description": "A dummy executor useful for E2E tests.", - "file": "generated/packages/workspace/executors/counter.json", - "hidden": true, - "name": "counter", - "originalFilePath": "/packages/workspace/src/executors/counter/schema.json", - "path": "/packages/workspace/executors/counter", - "type": "executor" - }, - "/packages/workspace/executors/run-script": { - "description": "Run an NPM script using Nx.", - "file": "generated/packages/workspace/executors/run-script.json", - "hidden": false, - "name": "run-script", - "originalFilePath": "/packages/workspace/src/executors/run-script/schema.json", - "path": "/packages/workspace/executors/run-script", - "type": "executor" - } - }, + "executors": {}, "generators": { "/packages/workspace/generators/preset": { "description": "Create application in an empty workspace.", diff --git a/docs/generated/packages-metadata.json b/docs/generated/packages-metadata.json index 47fadabbb437a4..10976547aa398c 100644 --- a/docs/generated/packages-metadata.json +++ b/docs/generated/packages-metadata.json @@ -2897,35 +2897,7 @@ "originalFilePath": "shared/packages/workspace/nx-compatibility-matrix" } ], - "executors": [ - { - "description": "Run any custom commands with Nx.", - "file": "generated/packages/workspace/executors/run-commands.json", - "hidden": false, - "name": "run-commands", - "originalFilePath": "/packages/workspace/src/executors/run-commands/schema.json", - "path": "workspace/executors/run-commands", - "type": "executor" - }, - { - "description": "A dummy executor useful for E2E tests.", - "file": "generated/packages/workspace/executors/counter.json", - "hidden": true, - "name": "counter", - "originalFilePath": "/packages/workspace/src/executors/counter/schema.json", - "path": "workspace/executors/counter", - "type": "executor" - }, - { - "description": "Run an NPM script using Nx.", - "file": "generated/packages/workspace/executors/run-script.json", - "hidden": false, - "name": "run-script", - "originalFilePath": "/packages/workspace/src/executors/run-script/schema.json", - "path": "workspace/executors/run-script", - "type": "executor" - } - ], + "executors": [], "generators": [ { "description": "Create application in an empty workspace.", diff --git a/docs/generated/packages/angular/generators/downgrade-module.json b/docs/generated/packages/angular/generators/downgrade-module.json deleted file mode 100644 index b3656ef5254a67..00000000000000 --- a/docs/generated/packages/angular/generators/downgrade-module.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "name": "downgrade-module", - "factory": "./src/generators/downgrade-module/downgrade-module", - "schema": { - "$schema": "http://json-schema.org/schema", - "$id": "NxDowngradeModuleGenerator", - "title": "Generates downgradeModule setup.", - "description": "Sets up a Downgrade Module for using AngularJS and Angular.", - "cli": "nx", - "type": "object", - "properties": { - "project": { - "type": "string", - "description": "The name of the project.", - "x-priority": "important" - }, - "name": { - "type": "string", - "description": "The name of the main AngularJS module.", - "$default": { "$source": "argv", "index": 0 }, - "x-priority": "important" - }, - "angularJsImport": { - "type": "string", - "description": "Import expression of the AngularJS application (e.g., `--angularJsImport=some_node_module/my_app`)." - }, - "skipFormat": { - "type": "boolean", - "description": "Skip formatting files.", - "default": false, - "x-priority": "internal" - }, - "skipPackageJson": { - "type": "boolean", - "description": "Do not add `@angular/upgrade` to `package.json` (e.g., `--skipPackageJson`).", - "default": false, - "x-priority": "internal" - } - }, - "additionalProperties": false, - "required": ["name", "project"], - "examplesFile": "## Examples\n\nBelow are some examples of how to generate configuration and setup for using `ngUpgrade`'s `DowngradeModule` for your application.\n\n{% tabs %}\n\n{% tab label=\"Basic Usage\" %}\n\n```bash\nnx g @nrwl/angular:downgrade-module --name=myAngularJsModule --project=myapp\n```\n\n{% /tab %}\n\n{% tab label=\"Setup Router\" %}\n\nAllow a setup that configures routing for `DowngradeModule`.\n\n```bash\nnx g @nrwl/angular:downgrade-module --name=myAngularJsModule --project=myapp --router=true\n```\n\n{% /tab %}\n\n{% /tabs %}\n", - "presets": [] - }, - "description": "Sets up a Downgrade Module.", - "implementation": "/packages/angular/src/generators/downgrade-module/downgrade-module.ts", - "aliases": [], - "hidden": false, - "path": "/packages/angular/src/generators/downgrade-module/schema.json", - "type": "generator" -} diff --git a/docs/generated/packages/angular/generators/karma-project.json b/docs/generated/packages/angular/generators/karma-project.json deleted file mode 100644 index 67dd000bfacdf7..00000000000000 --- a/docs/generated/packages/angular/generators/karma-project.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "name": "karma-project", - "factory": "./src/generators/karma-project/karma-project", - "schema": { - "$schema": "http://json-schema.org/schema", - "$id": "NxKarmaProjectGenerator", - "title": "Create Karma Configuration for a project", - "description": "Add Karma configuration to an angular project.", - "cli": "nx", - "type": "object", - "properties": { - "project": { - "type": "string", - "description": "The name of the project.", - "x-dropdown": "projects", - "x-priority": "important" - }, - "skipFormat": { - "description": "Skip formatting files.", - "type": "boolean", - "default": false, - "x-priority": "internal" - }, - "skipPackageJson": { - "description": "Skip updating package.json.", - "type": "boolean", - "default": false, - "x-priority": "internal" - } - }, - "additionalProperties": false, - "required": ["project"], - "examplesFile": "## Examples\n\n{% tabs %}\n\n{% tab label=\"Basic Usage\" %}\n\nTo add karma to project, run the following command.\n\n```bash\nnx g @nrwl/angular:karma-project --project=myapp\n```\n\n{% /tab %}\n\n{% /tabs %}\n", - "presets": [] - }, - "description": "Adds Karma configuration to a project.", - "implementation": "/packages/angular/src/generators/karma-project/karma-project.ts", - "aliases": [], - "hidden": false, - "path": "/packages/angular/src/generators/karma-project/schema.json", - "type": "generator" -} diff --git a/docs/generated/packages/angular/generators/karma.json b/docs/generated/packages/angular/generators/karma.json deleted file mode 100644 index c49a85a47b8d22..00000000000000 --- a/docs/generated/packages/angular/generators/karma.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "name": "karma", - "factory": "./src/generators/karma/karma", - "schema": { - "$schema": "http://json-schema.org/schema", - "$id": "NxAngularKarmaGenerator", - "title": "Add Karma Configuration to the workspace.", - "description": "Add Karma configuration to an Nx workspace.", - "cli": "nx", - "type": "object", - "examples": [ - { - "command": "nx g @nrwl/angular:karma", - "description": "Add a base karma configuration to the workspace." - } - ], - "properties": { - "skipPackageJson": { - "type": "boolean", - "default": false, - "description": "Do not add dependencies to `package.json`.", - "x-priority": "internal" - } - }, - "additionalProperties": false, - "required": [], - "presets": [] - }, - "description": "Adds Karma configuration to a workspace.", - "implementation": "/packages/angular/src/generators/karma/karma.ts", - "aliases": [], - "hidden": false, - "path": "/packages/angular/src/generators/karma/schema.json", - "type": "generator" -} diff --git a/docs/generated/packages/angular/generators/upgrade-module.json b/docs/generated/packages/angular/generators/upgrade-module.json deleted file mode 100644 index 5c5109b762a49c..00000000000000 --- a/docs/generated/packages/angular/generators/upgrade-module.json +++ /dev/null @@ -1,61 +0,0 @@ -{ - "name": "upgrade-module", - "factory": "./src/generators/upgrade-module/upgrade-module", - "schema": { - "$schema": "http://json-schema.org/schema", - "$id": "NxUpgradeModuleGenerator", - "title": "Generates UpgradeModule setup.", - "description": "Sets up an Upgrade Module.", - "cli": "nx", - "type": "object", - "properties": { - "project": { - "type": "string", - "description": "The name of the project.", - "x-priority": "important" - }, - "name": { - "type": "string", - "description": "The name of the main AngularJS module.", - "$default": { "$source": "argv", "index": 0 }, - "x-priority": "important" - }, - "angularJsImport": { - "type": "string", - "description": "Import expression of the AngularJS application (e.g., `--angularJsImport=some_node_module/my_app`)." - }, - "angularJsCmpSelector": { - "type": "string", - "description": "The selector of an AngularJS component (e.g., `--angularJsCmpSelector=myComponent`)." - }, - "skipFormat": { - "type": "boolean", - "description": "Skip formatting files.", - "default": false, - "x-priority": "internal" - }, - "skipPackageJson": { - "type": "boolean", - "description": "Do not add `@angular/upgrade` to `package.json` (e.g., `--skipPackageJson`).", - "default": false, - "x-priority": "internal" - }, - "router": { - "type": "boolean", - "description": "Sets up router synchronization (e.g., `--router`).", - "default": false, - "x-priority": "important" - } - }, - "additionalProperties": false, - "required": ["name", "project"], - "examplesFile": "## Examples\n\nBelow are some examples of how to generate configuration and setup for using `ngUpgrade`'s `UpgradeModule` for your application.\n\n{% tabs %}\n\n{% tab label=\"Basic Usage\" %}\n\n```bash\nnx g @nrwl/angular:upgrade-module --name=myAngularJsModule --project=myapp\n```\n\n{% /tab %}\n\n{% tab label=\"Setup Router\" %}\n\nAllow a setup that configures routing for `UpgradeModule`.\n\n```bash\nnx g @nrwl/angular:upgrade-module --name=myAngularJsModule --project=myapp --router=true\n```\n\n{% /tab %}\n\n{% /tabs %}\n", - "presets": [] - }, - "description": "Sets up an Upgrade Module.", - "implementation": "/packages/angular/src/generators/upgrade-module/upgrade-module.ts", - "aliases": [], - "hidden": false, - "path": "/packages/angular/src/generators/upgrade-module/schema.json", - "type": "generator" -} diff --git a/docs/generated/packages/storybook/documents/migrate-storybook-7.md b/docs/generated/packages/storybook/documents/migrate-storybook-7.md deleted file mode 100644 index 0c815104c729ff..00000000000000 --- a/docs/generated/packages/storybook/documents/migrate-storybook-7.md +++ /dev/null @@ -1,258 +0,0 @@ ---- -title: Migrate your Nx workspace to Storybook version 7 -description: This guide explains how migrate your Nx workspace to Storybook version 7. ---- - -# Migrate your Nx workspace to Storybook version 7 - -{% callout type="info" title="Available on Nx v15.5" %} -This is a new feature available on Nx v15.5.0. If you are using an older version of Nx, please [upgrade](/packages/nx/documents/migrate). -{% /callout %} - -{% callout type="warning" title="Storybook 7 is in beta" %} -[Storybook version 7 is still in beta](https://storybook.js.org/blog/7-0-beta/), and so is the Nx support for it. Things are evolving dynamically, so it would be better to _avoid using in production_ on Nx. If you want to use the stable, [6.5 version](https://storybook.js.org/releases/6.5), please go to the [Storybook plugin overview guide](/packages/storybook) to get started. -{% /callout %} - -{% callout type="info" title="Setting up Storybook 7 in a new workspace" %} -For setting up Storybook version 7 in a new Nx workspace, or a workspace that does NOT already have Storybook configured already, please refer to our [Storybook 7 setup guide](/packages/storybook/documents/storybook-7-setup). -{% /callout %} - -Storybook 7 is a major release that brings a lot of new features and improvements. You can read more about it in the [Storybook 7 beta announcement blog post](https://storybook.js.org/blog/7-0-beta/). Apart from the new features and improvements it introduces, it also brings some breaking changes. You can read more about them in the [Storybook 7 migration docs](https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#from-version-65x-to-700) and the [Storybook 7 migration guide](https://chromatic-ui.notion.site/Storybook-7-migration-guide-dbf41fa347304eb2a5e9c69b34503937). Do note that _version 7 is still in beta_, and so is the Nx support for it. Things are evolving dynamically, so it would be better to _avoid using in production_ on Nx. - -You can now migrate your existing Nx workspace with Storybook configuration to use Storybook version 7. This guide will show you how to do that. - -## Use the Storybook CLI to upgrade - -You can take advantage of the Storybook CLI to automatically migrate some settings of your Storybook setup on your Nx workspace. For a full guide to migration using the Storybook CLI, please refer to the [Storybook 7 migration guide](https://chromatic-ui.notion.site/Storybook-7-migration-guide-dbf41fa347304eb2a5e9c69b34503937). - -The Storybook migration scripts do not work perfectly on Nx workspaces, however we can use them to get the latest beta versions of our packages, remove some unused packages and get a hint of some settings that we will need to change manually, eventually. - -{% callout type="warning" title="Don't use in production" %} -Please take extra care when migrating your existing Storybook setup to version 7 on your Nx workspace. Do not use in production, since it's still in beta, and the Nx support is not stable yet. -{% /callout %} - -Let's see the steps we can make to migrate our Storybook setup to version 7. - -### 1. Run the `upgrade` command of the Storybook CLI - -```bash -npx storybook@next upgrade --prerelease -``` - -This will: - -- Upgrade your dependencies to the latest prerelease version -- Run a number of migration scripts (code generators and modifiers) - upon approval - -For more info, see [here](https://chromatic-ui.notion.site/Storybook-7-migration-guide-dbf41fa347304eb2a5e9c69b34503937). - -### 2. Say `yes` to the automigration prompts - -The Storybook CLI will prompt you to run some code generators and modifiers. - -Say `yes` to the following: - -- `mainjsFramework`: It will try to add the `framework` field in your project's `.storybook/main.js|ts` file. -- `eslintPlugin`: installs the `eslint-plugin-storybook` -- `storybook-binary`: installs Storybook's `storybook` binary -- `newFrameworks`: removes unused dependencies (eg. `@storybook/builder-webpack5`, `@storybook/manager-webpack5`, `@storybook/builder-vite`) - -Say `no` to the following: - -- `autodocsTrue`: we don't need it and it can potentially cause issues with missing dependencies on your Nx workspace - -### 3. Edit all the project-level `.storybook/main.js|ts` files - -Find all your project-level `.storybook/main.js|ts` files and edit them to add the `framework` option. While you are at it, remove the `builder` from `core` options. - -#### Remove builder - -In your project-level `.storybook/main.js|ts` files, remove the `builder` from `core` options. - -Your core options most probably look like this: - -```ts -core: { builder: '@storybook/builder-vite' }, -``` - -You must remove the `builder`, or you can also delete the `core` object entirely. - -#### Add framework - -Choose the `framework` carefully. The list of available frameworks is: - -- `@storybook/angular` -- `@storybook/html-webpack5` -- `@storybook/nextjs` -- `@storybook/preact-webpack5` -- `@storybook/react-webpack5` -- `@storybook/react-vite` -- `@storybook/server-webpack5` -- `@storybook/svelte-webpack5` -- `@storybook/svelte-vite` -- `@storybook/sveltekit` -- `@storybook/vue-webpack5` -- `@storybook/vue-vite` -- `@storybook/vue3-webpack5` -- `@storybook/vue3-vite` -- `@storybook/web-components-webpack5` -- `@storybook/web-components-vite` - -#### For Angular projects - -Choose the `@storybook/angular` framework. So add this in your project-level `.storybook/main.js|ts` file: - -```ts - framework: { - name: '@storybook/angular', - options: {} - } -``` - -#### For React projects using `'@storybook/builder-vite'` - -Choose the `@storybook/react-vite` framework. You must also point the builder to the Vite configuration file path, so that it can read the settings from there. If your project's root path is `apps/my-app` and it's using a Vite configuration file at `apps/my-app/vite.config.ts`, then you must add this in your project-level `.storybook/main.js|ts` file: - -```ts - framework: { - name: '@storybook/react-vite', - options: { - builder: { - viteConfigPath: 'apps/my-app/vite.config.ts', - }, - } - } -``` - -#### For React projects using `'@storybook/builder-webpack5'` - -Choose the `@storybook/react-webpack5` framework. So add this in your project-level `.storybook/main.js|ts` file: - -```ts - framework: { - name: '@storybook/react-webpack5', - options: {} - } -``` - -#### For Next.js projects - -Choose the `@storybook/nextjs` framework. So add this in your project-level `.storybook/main.js|ts` file: - -```ts - framework: { - name: '@storybook/nextjs', - options: {} - } -``` - -#### For Web Components projects using `'@storybook/builder-vite'` - -Choose the `@storybook/web-components-vite` framework. You must also point the builder to the Vite configuration file path, so that it can read the settings from there. If your project's root path is `apps/my-app` and it's using a Vite configuration file at `apps/my-app/vite.config.ts`, then you must add this in your project-level `.storybook/main.js|ts` file: - -```ts - framework: { - name: '@storybook/web-components-vite', - options: { - builder: { - viteConfigPath: 'apps/my-app/vite.config.ts', - }, - } - } -``` - -#### For Web Components projects using `'@storybook/builder-webpack5'` - -Choose the `@storybook/web-components-webpack5` framework. So add this in your project-level `.storybook/main.js|ts` file: - -```ts - framework: { - name: '@storybook/web-components-webpack5', - options: {} - } -``` - -#### For the rest of the projects - -You can easily find the correct framework by looking at the `builder` option in your project-level `.storybook/main.js|ts` file. - -### 4. Check result of project-level `.storybook/main.js|ts` file - -#### Full example for Angular projects - -Here is an example of a project-level `.storybook/main.js|ts` file for an Angular project: - -```ts {% fileName="apps/my-angular-app/.storybook/main.js" %} -const config = { - stories: ['../src/app/**/*.stories.@(js|jsx|ts|tsx|mdx)'], - addons: ['@storybook/addon-essentials'], - framework: { - name: '@storybook/angular', - options: {}, - }, -}; - -export default config; -``` - -#### Full example for React projects with Vite - -Here is an example of a project-level `.storybook/main.js|ts` file for a React project using Vite: - -```ts {% fileName="apps/my-react-app/.storybook/main.js" %} -const config = { - stories: ['../src/app/**/*.stories.@(js|jsx|ts|tsx|mdx)'], - addons: ['@storybook/addon-essentials'], - framework: { - name: '@storybook/react-vite', - options: { - builder: { - viteConfigPath: 'apps/rv1/vite.config.ts', - }, - }, - }, -}; - -export default config; -``` - -### 5. Remove `uiFramework` from `project.json` - -You can now remove the `uiFramework` option from your `storybook` and `build-storybook` targets in your project's `project.json` file. - -So, for example, this is what a resulting `storybook` target would look for a non-Angular project: - -```json {% fileName="apps/my-react-app/project.json" %} -{ - ... - "targets": { - ... - "storybook": { - "executor": "@nrwl/storybook:storybook", - "options": { - "port": 4400, - "configDir": "apps/my-react-app/.storybook" - }, - "configurations": { - ... - } - }, -``` - -## Use Storybook 7 beta - -You can now use Storybook 7 beta! 🎉 - -```bash -npx nx build-storybook PROJECT_NAME -``` - -and - -```bash -npx nx storybook PROJECT_NAME -``` - -## Report any issues and bugs - -Since this is a beta version, and the Nx support is still evolving, there are bound to be some issues and bugs. Please report any issues and bugs you find [on the Nx GitHub page](https://github.com/nrwl/nx/issues/new/choose) or on the [Storybook GitHub page](https://github.com/storybookjs/storybook/issues/new/choose). diff --git a/docs/generated/packages/workspace/executors/counter.json b/docs/generated/packages/workspace/executors/counter.json deleted file mode 100644 index 812d22d0391605..00000000000000 --- a/docs/generated/packages/workspace/executors/counter.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "name": "counter", - "implementation": "/packages/workspace/src/executors/counter/counter.impl.ts", - "batchImplementation": "./src/executors/counter/counter.impl#batchCounter", - "schema": { - "version": 2, - "title": "Counter", - "description": "A dummy executor useful for E2E tests.", - "type": "object", - "cli": "nx", - "outputCapture": "pipe", - "properties": { - "to": { "type": "number", "description": "Count to this number." }, - "result": { "type": "boolean", "description": "Final result." } - }, - "additionalProperties": true, - "required": ["to"], - "presets": [] - }, - "description": "A dummy executor useful for E2E tests.", - "hidden": true, - "aliases": [], - "path": "/packages/workspace/src/executors/counter/schema.json", - "type": "executor" -} diff --git a/docs/generated/packages/workspace/executors/run-commands.json b/docs/generated/packages/workspace/executors/run-commands.json deleted file mode 100644 index a4b91726306993..00000000000000 --- a/docs/generated/packages/workspace/executors/run-commands.json +++ /dev/null @@ -1,131 +0,0 @@ -{ - "name": "run-commands", - "implementation": "/packages/workspace/src/executors/run-commands/run-commands.impl.ts", - "schema": { - "version": 2, - "title": "Run Commands", - "description": "Run any custom commands with Nx.", - "type": "object", - "cli": "nx", - "outputCapture": "pipe", - "presets": [ - { "name": "Arguments forwarding", "keys": ["commands"] }, - { "name": "Custom done conditions", "keys": ["commands", "readyWhen"] }, - { "name": "Setting the cwd", "keys": ["commands", "cwd"] } - ], - "properties": { - "commands": { - "type": "array", - "description": "Commands to run in child process.", - "items": { - "oneOf": [ - { - "type": "object", - "properties": { - "command": { - "type": "string", - "description": "Command to run in child process." - }, - "forwardAllArgs": { - "type": "boolean", - "description": "Whether arguments should be forwarded when interpolation is not present." - }, - "prefix": { - "type": "string", - "description": "Prefix in front of every line out of the output" - }, - "color": { - "type": "string", - "description": "Color of the output", - "enum": [ - "black", - "red", - "green", - "yellow", - "blue", - "magenta", - "cyan", - "white" - ] - }, - "bgColor": { - "type": "string", - "description": "Background color of the output", - "enum": [ - "bgBlack", - "bgRed", - "bgGreen", - "bgYellow", - "bgBlue", - "bgMagenta", - "bgCyan", - "bgWhite" - ] - }, - "description": { - "type": "string", - "description": "An optional description useful for inline documentation purposes. It is not used as part of the execution of the command." - } - }, - "additionalProperties": false, - "required": ["command"] - }, - { "type": "string" } - ] - } - }, - "command": { - "type": "string", - "description": "Command to run in child process." - }, - "parallel": { - "type": "boolean", - "description": "Run commands in parallel.", - "default": true - }, - "readyWhen": { - "type": "string", - "description": "String to appear in `stdout` or `stderr` that indicates that the task is done. When running multiple commands, this option can only be used when `parallel` is set to `true`. If not specified, the task is done when all the child processes complete." - }, - "args": { - "type": "string", - "description": "Extra arguments. You can pass them as follows: nx run project:target --args='--wait=100'. You can then use {args.wait} syntax to interpolate them in the workspace config file. See example [above](#chaining-commands-interpolating-args-and-setting-the-cwd)" - }, - "envFile": { - "type": "string", - "description": "You may specify a custom .env file path." - }, - "color": { - "type": "boolean", - "description": "Use colors when showing output of command.", - "default": false - }, - "outputPath": { - "description": "Allows you to specify where the build artifacts are stored. This allows Nx Cloud to pick them up correctly, in the case that the build artifacts are placed somewhere other than the top level dist folder.", - "oneOf": [ - { "type": "string" }, - { "type": "array", "items": { "type": "string" } } - ] - }, - "cwd": { - "type": "string", - "description": "Current working directory of the commands. If it's not specified the commands will run in the workspace root, if a relative path is specified the commands will run in that path relative to the workspace root and if it's an absolute path the commands will run in that path." - }, - "__unparsed__": { - "hidden": true, - "type": "array", - "items": { "type": "string" }, - "$default": { "$source": "unparsed" } - } - }, - "additionalProperties": true, - "oneOf": [{ "required": ["commands"] }, { "required": ["command"] }], - "examplesFile": "`workspace.json`:\n\n```json\n//...\n\"frontend\": {\n \"targets\": {\n //...\n \"ls-project-root\": {\n \"executor\": \"nx:run-commands\",\n \"options\": {\n \"command\": \"ls apps/frontend/src\"\n }\n }\n }\n}\n```\n\n```bash\nnx run frontend:ls-project-root\n```\n\n##### Chaining commands, interpolating args and setting the cwd\n\nLet's say each of our workspace projects has some custom bash scripts in a `scripts` folder.\nWe want a simple way to create empty bash script files for a given project, that have the execute permissions already set.\n\nGiven that Nx knows our workspace structure, we should be able to give it a project and the name of our script, and it should take care of the rest.\n\nThe `commands` option accepts as many commands as you want. By default, they all run in parallel.\nYou can run them sequentially by setting `parallel: false`:\n\n```json\n\"create-script\": {\n \"executor\": \"nx:run-commands\",\n \"options\": {\n \"commands\": [\n \"mkdir -p scripts\",\n \"touch scripts/{args.name}.sh\",\n \"chmod +x scripts/{args.name}.sh\"\n ],\n \"cwd\": \"apps/frontend\",\n \"parallel\": false\n }\n}\n```\n\nBy setting the `cwd` option, each command will run in the `apps/frontend` folder.\n\nWe run the above with:\n\n```bash\nnx run frontend:create-script --args=\"--name=example\"\n```\n\nor simply with:\n\n```bash\nnx run frontend:create-script --name=example\n```\n\n##### Arguments forwarding\n\nWhen interpolation is not present in the command, all arguments are forwarded to the command by default.\n\nThis is useful when you need to pass raw argument strings to your command.\n\nFor example, when you run:\n\nnx run frontend:webpack --args=\"--config=example.config.js\"\n\n```json\n\"webpack\": {\n \"executor\": \"nx:run-commands\",\n \"options\": {\n \"command\": \"webpack\"\n }\n}\n```\n\nThe above command will execute: `webpack --config=example.config.js`\n\nThis functionality can be disabled by using `commands` and expanding each `command` into an object\nthat sets the `forwardAllArgs` option to `false` as shown below:\n\n```json\n\"webpack\": {\n \"executor\": \"nx:run-commands\",\n \"options\": {\n \"commands\": [\n {\n \"command\": \"webpack\",\n \"forwardAllArgs\": false\n }\n ]\n }\n}\n```\n\n##### Custom **done** conditions\n\nNormally, `run-commands` considers the commands done when all of them have finished running. If you don't need to wait until they're all done, you can set a special string that considers the commands finished the moment the string appears in `stdout` or `stderr`:\n\n```json\n\"finish-when-ready\": {\n \"executor\": \"nx:run-commands\",\n \"options\": {\n \"commands\": [\n \"sleep 5 && echo 'FINISHED'\",\n \"echo 'READY'\"\n ],\n \"readyWhen\": \"READY\",\n \"parallel\": true\n }\n}\n```\n\n```bash\nnx run frontend:finish-when-ready\n```\n\nThe above commands will finish immediately, instead of waiting for 5 seconds.\n\n##### Nx Affected\n\nThe true power of `run-commands` comes from the fact that it runs through `nx`, which knows about your project graph. So you can run **custom commands** only for the projects that have been affected by a change.\n\nWe can create some configurations to generate docs, and if run using `nx affected`, it will only generate documentation for the projects that have been changed:\n\n```bash\nnx affected --target=generate-docs\n```\n\n```json\n//...\n\"frontend\": {\n \"targets\": {\n //...\n \"generate-docs\": {\n \"executor\": \"nx:run-commands\",\n \"options\": {\n \"command\": \"npx compodoc -p apps/frontend/tsconfig.app.json\"\n }\n }\n }\n},\n\"api\": {\n \"targets\": {\n //...\n \"generate-docs\": {\n \"executor\": \"nx:run-commands\",\n \"options\": {\n \"command\": \"npx compodoc -p apps/api/tsconfig.app.json\"\n }\n }\n }\n}\n```\n" - }, - "description": "Run any custom commands with Nx.", - "x-deprecated": "Use nx:run-commands instead. This will be removed in v16.", - "aliases": [], - "hidden": false, - "path": "/packages/workspace/src/executors/run-commands/schema.json", - "type": "executor" -} diff --git a/docs/generated/packages/workspace/executors/run-script.json b/docs/generated/packages/workspace/executors/run-script.json deleted file mode 100644 index 9bc1d4da6d9d32..00000000000000 --- a/docs/generated/packages/workspace/executors/run-script.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "name": "run-script", - "implementation": "/packages/workspace/src/executors/run-script/run-script.impl.ts", - "schema": { - "version": 2, - "title": "Run Script", - "description": "Run any NPM script of a project in the project's root directory.", - "type": "object", - "cli": "nx", - "outputCapture": "pipe", - "properties": { - "script": { - "type": "string", - "description": "An npm script name in the `package.json` file of the project (e.g., `build`)." - }, - "__unparsed__": { - "hidden": true, - "type": "array", - "items": { "type": "string" }, - "$default": { "$source": "unparsed" } - } - }, - "additionalProperties": true, - "required": ["script"], - "examplesFile": "`workspace.json`:\n\n```json\n\"frontend\": {\n \"root\": \"packages/frontend\",\n \"targets\": {\n \"build\": {\n \"executor\": \"nx:run-script\",\n \"options\": {\n \"script\": \"build-my-project\"\n }\n }\n }\n}\n```\n\n```bash\nnx run frontend:build\n```\n\nThe `build` target is going to run `npm run build-my-project` (or `yarn build-my-project`) in the `packages/frontend` directory.\n\n#### Caching Artifacts\n\nBy default, Nx is going to cache `dist/packages/frontend`, `packages/frontend/dist`, `packages/frontend/build`, `packages/frontend/public`. If your npm script writes files to other places, you can override the list of cached outputs as follows:\n\n```json\n\"frontend\": {\n \"root\": \"packages/frontend\",\n \"targets\": {\n \"build\": {\n \"executor\": \"nx:run-script\",\n \"outputs\": [\"{projectRoot}/dist\", \"{projectRoot}/docs\"],\n \"options\": {\n \"script\": \"build-my-project\"\n }\n }\n }\n}\n```\n", - "presets": [] - }, - "description": "Run an NPM script using Nx.", - "x-deprecated": "Use nx:run-script instead. This will be removed in v16.", - "aliases": [], - "hidden": false, - "path": "/packages/workspace/src/executors/run-script/schema.json", - "type": "executor" -} diff --git a/docs/generated/packages/workspace/generators/library.json b/docs/generated/packages/workspace/generators/library.json deleted file mode 100644 index abfc5317dab3c3..00000000000000 --- a/docs/generated/packages/workspace/generators/library.json +++ /dev/null @@ -1,122 +0,0 @@ -{ - "name": "library", - "factory": "./src/generators/library/library#libraryGenerator", - "schema": { - "$schema": "http://json-schema.org/schema", - "$id": "NxTypescriptLibrary", - "cli": "nx", - "title": "Create a TypeScript Library", - "description": "Create a TypeScript Library.", - "type": "object", - "examples": [ - { - "command": "nx g lib mylib --directory=myapp", - "description": "Generate `libs/myapp/mylib`" - } - ], - "properties": { - "name": { - "type": "string", - "description": "Library name.", - "$default": { "$source": "argv", "index": 0 }, - "x-prompt": "What name would you like to use for the library?", - "pattern": "^[a-zA-Z].*$" - }, - "directory": { - "type": "string", - "description": "A directory where the lib is placed.", - "x-priority": "important" - }, - "linter": { - "description": "The tool to use for running lint checks.", - "type": "string", - "enum": ["eslint"], - "default": "eslint" - }, - "unitTestRunner": { - "type": "string", - "enum": ["jest", "none"], - "description": "Test runner to use for unit tests.", - "default": "jest" - }, - "tags": { - "type": "string", - "description": "Add tags to the library (used for linting)." - }, - "skipFormat": { - "description": "Skip formatting files.", - "type": "boolean", - "default": false, - "x-priority": "internal" - }, - "skipTsConfig": { - "type": "boolean", - "description": "Do not update `tsconfig.json` for development experience.", - "default": false - }, - "testEnvironment": { - "type": "string", - "enum": ["jsdom", "node"], - "description": "The test environment to use if `unitTestRunner` is set to `jest`.", - "default": "jsdom" - }, - "importPath": { - "type": "string", - "description": "The library name used to import it, like `@myorg/my-awesome-lib`.", - "x-priority": "important" - }, - "babelJest": { - "type": "boolean", - "description": "Use `babel` instead `ts-jest`.", - "default": false - }, - "pascalCaseFiles": { - "type": "boolean", - "description": "Use pascal case file names.", - "alias": "P", - "default": false - }, - "js": { - "type": "boolean", - "description": "Generate JavaScript files rather than TypeScript files.", - "default": false - }, - "strict": { - "type": "boolean", - "description": "Whether to enable `tsconfig` strict mode or not.", - "default": true - }, - "skipBabelrc": { - "type": "boolean", - "description": "Do not generate `.babelrc` file. Useful for Node libraries that are not compiled by Babel.", - "default": false - }, - "buildable": { - "type": "boolean", - "default": false, - "description": "Generate a buildable library." - }, - "setParserOptionsProject": { - "type": "boolean", - "description": "Whether or not to configure the ESLint `parserOptions.project` option. We do not do this by default for lint performance reasons.", - "default": false - }, - "standaloneConfig": { - "description": "Split the project configuration into `/project.json` rather than including it inside `workspace.json`.", - "type": "boolean", - "default": true, - "x-deprecated": "Nx only supports standaloneConfig" - } - }, - "required": ["name"], - "presets": [] - }, - "aliases": ["lib"], - "x-type": "library", - "description": "Create a library.", - "x-deprecated": "Use @nrwl/js:lib instead. This will be removed in Nx v16.", - "implementation": "/packages/workspace/src/generators/library/library#libraryGenerator.ts", - "hidden": false, - "path": "/packages/workspace/src/generators/library/schema.json", - "type": "generator" -} diff --git a/packages/workspace/executors.json b/packages/workspace/executors.json index 1286353cc41925..f80c007a99b866 100644 --- a/packages/workspace/executors.json +++ b/packages/workspace/executors.json @@ -1,35 +1,11 @@ { - "builders": { - "run-commands": { - "implementation": "./src/executors/run-commands/compat", - "schema": "./src/executors/run-commands/schema.json", - "description": "Run any custom commands with Nx." - }, - "run-script": { - "implementation": "./src/executors/run-script/compat", - "schema": "./src/executors/run-script/schema.json", - "description": "Run an NPM script using Nx." - } - }, "executors": { - "run-commands": { - "implementation": "./src/executors/run-commands/run-commands.impl", - "schema": "./src/executors/run-commands/schema.json", - "description": "Run any custom commands with Nx.", - "x-deprecated": "Use nx:run-commands instead. This will be removed in v16." - }, "counter": { "implementation": "./src/executors/counter/counter.impl", "batchImplementation": "./src/executors/counter/counter.impl#batchCounter", "schema": "./src/executors/counter/schema.json", "description": "A dummy executor useful for E2E tests.", "hidden": true - }, - "run-script": { - "implementation": "./src/executors/run-script/run-script.impl", - "schema": "./src/executors/run-script/schema.json", - "description": "Run an NPM script using Nx.", - "x-deprecated": "Use nx:run-script instead. This will be removed in v16." } } } diff --git a/packages/workspace/src/executors/run-commands/compat.ts b/packages/workspace/src/executors/run-commands/compat.ts deleted file mode 100644 index c9d7cf04d19b5e..00000000000000 --- a/packages/workspace/src/executors/run-commands/compat.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { convertNxExecutor } from '@nrwl/devkit'; - -import { default as runCommandsExecutor } from './run-commands.impl'; - -export default convertNxExecutor(runCommandsExecutor); diff --git a/packages/workspace/src/executors/run-commands/run-commands.impl.ts b/packages/workspace/src/executors/run-commands/run-commands.impl.ts deleted file mode 100644 index dfb87417fc82fc..00000000000000 --- a/packages/workspace/src/executors/run-commands/run-commands.impl.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { logger } from '@nrwl/devkit'; -import runCommands from 'nx/src/executors/run-commands/run-commands.impl'; - -logger.warn( - '@nrwl/workspace:run-commands is deprecated and will be removed in Nx 16. Please switch to nx:run-commands' -); - -export { RunCommandsOptions } from 'nx/src/executors/run-commands/run-commands.impl'; - -export default runCommands; diff --git a/packages/workspace/src/executors/run-commands/schema.json b/packages/workspace/src/executors/run-commands/schema.json deleted file mode 100644 index 08c163dc8ea224..00000000000000 --- a/packages/workspace/src/executors/run-commands/schema.json +++ /dev/null @@ -1,150 +0,0 @@ -{ - "version": 2, - "title": "Run Commands", - "description": "Run any custom commands with Nx.", - "type": "object", - "cli": "nx", - "outputCapture": "pipe", - "presets": [ - { - "name": "Arguments forwarding", - "keys": ["commands"] - }, - { - "name": "Custom done conditions", - "keys": ["commands", "readyWhen"] - }, - { - "name": "Setting the cwd", - "keys": ["commands", "cwd"] - } - ], - "properties": { - "commands": { - "type": "array", - "description": "Commands to run in child process.", - "items": { - "oneOf": [ - { - "type": "object", - "properties": { - "command": { - "type": "string", - "description": "Command to run in child process." - }, - "forwardAllArgs": { - "type": "boolean", - "description": "Whether arguments should be forwarded when interpolation is not present." - }, - "prefix": { - "type": "string", - "description": "Prefix in front of every line out of the output" - }, - "color": { - "type": "string", - "description": "Color of the output", - "enum": [ - "black", - "red", - "green", - "yellow", - "blue", - "magenta", - "cyan", - "white" - ] - }, - "bgColor": { - "type": "string", - "description": "Background color of the output", - "enum": [ - "bgBlack", - "bgRed", - "bgGreen", - "bgYellow", - "bgBlue", - "bgMagenta", - "bgCyan", - "bgWhite" - ] - }, - "description": { - "type": "string", - "description": "An optional description useful for inline documentation purposes. It is not used as part of the execution of the command." - } - }, - "additionalProperties": false, - "required": ["command"] - }, - { - "type": "string" - } - ] - } - }, - "command": { - "type": "string", - "description": "Command to run in child process." - }, - "parallel": { - "type": "boolean", - "description": "Run commands in parallel.", - "default": true - }, - "readyWhen": { - "type": "string", - "description": "String to appear in `stdout` or `stderr` that indicates that the task is done. When running multiple commands, this option can only be used when `parallel` is set to `true`. If not specified, the task is done when all the child processes complete." - }, - "args": { - "type": "string", - "description": "Extra arguments. You can pass them as follows: nx run project:target --args='--wait=100'. You can then use {args.wait} syntax to interpolate them in the workspace config file. See example [above](#chaining-commands-interpolating-args-and-setting-the-cwd)" - }, - "envFile": { - "type": "string", - "description": "You may specify a custom .env file path." - }, - "color": { - "type": "boolean", - "description": "Use colors when showing output of command.", - "default": false - }, - "outputPath": { - "description": "Allows you to specify where the build artifacts are stored. This allows Nx Cloud to pick them up correctly, in the case that the build artifacts are placed somewhere other than the top level dist folder.", - "oneOf": [ - { - "type": "string" - }, - { - "type": "array", - "items": { - "type": "string" - } - } - ] - }, - "cwd": { - "type": "string", - "description": "Current working directory of the commands. If it's not specified the commands will run in the workspace root, if a relative path is specified the commands will run in that path relative to the workspace root and if it's an absolute path the commands will run in that path." - }, - "__unparsed__": { - "hidden": true, - "type": "array", - "items": { - "type": "string" - }, - "$default": { - "$source": "unparsed" - } - } - }, - "additionalProperties": true, - "oneOf": [ - { - "required": ["commands"] - }, - { - "required": ["command"] - } - ], - "examplesFile": "../../../docs/run-commands-examples.md" -} diff --git a/packages/workspace/src/executors/run-script/compat.ts b/packages/workspace/src/executors/run-script/compat.ts deleted file mode 100644 index 3cb0469557bc19..00000000000000 --- a/packages/workspace/src/executors/run-script/compat.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { convertNxExecutor } from '@nrwl/devkit'; - -import { default as runScriptExecutor } from './run-script.impl'; - -export default convertNxExecutor(runScriptExecutor); diff --git a/packages/workspace/src/executors/run-script/run-script.impl.ts b/packages/workspace/src/executors/run-script/run-script.impl.ts deleted file mode 100644 index 384ca4aa81072e..00000000000000 --- a/packages/workspace/src/executors/run-script/run-script.impl.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { logger } from '@nrwl/devkit'; -import runScript from 'nx/src/executors/run-script/run-script.impl'; - -logger.warn( - '@nrwl/workspace:run-script is deprecated and will be removed in Nx 16. Please switch to nx:run-script' -); - -export { RunScriptOptions } from 'nx/src/executors/run-script/run-script.impl'; - -export default runScript; diff --git a/packages/workspace/src/executors/run-script/schema.json b/packages/workspace/src/executors/run-script/schema.json deleted file mode 100644 index 511ad9deb1000f..00000000000000 --- a/packages/workspace/src/executors/run-script/schema.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "version": 2, - "title": "Run Script", - "description": "Run any NPM script of a project in the project's root directory.", - "type": "object", - "cli": "nx", - "outputCapture": "pipe", - "properties": { - "script": { - "type": "string", - "description": "An npm script name in the `package.json` file of the project (e.g., `build`)." - }, - "__unparsed__": { - "hidden": true, - "type": "array", - "items": { - "type": "string" - }, - "$default": { - "$source": "unparsed" - } - } - }, - "additionalProperties": true, - "required": ["script"], - "examplesFile": "../../../docs/run-script-examples.md" -} diff --git a/packages/workspace/src/utilities/typescript.ts b/packages/workspace/src/utilities/typescript.ts index b1e5d10575dda2..4f233a0c2ad8db 100644 --- a/packages/workspace/src/utilities/typescript.ts +++ b/packages/workspace/src/utilities/typescript.ts @@ -4,7 +4,6 @@ import type * as ts from 'typescript'; import { typescriptVersion } from '../utils/versions'; export { compileTypeScript } from './typescript/compilation'; export type { TypeScriptCompilationOptions } from './typescript/compilation'; -export { findNodes } from './typescript/find-nodes'; // TODO(v16): remove this export { getSourceNodes } from './typescript/get-source-nodes'; const normalizedAppRoot = workspaceRoot.replace(/\\/g, '/'); diff --git a/packages/workspace/src/utilities/typescript/find-nodes.ts b/packages/workspace/src/utilities/typescript/find-nodes.ts deleted file mode 100644 index 32169f92dbcec4..00000000000000 --- a/packages/workspace/src/utilities/typescript/find-nodes.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { findNodes as _findNodes } from 'nx/src/utils/typescript'; -import type { Node, SyntaxKind } from 'typescript'; - -// TODO(v16): This should be removed. - -/** - * @deprecated This function is deprecated and no longer supported. - */ -export function findNodes( - node: Node, - kind: SyntaxKind | SyntaxKind[], - max = Infinity -) { - console.warn('"findNodes" is deprecated and no longer supported.'); - return _findNodes(node, kind, max); -}