diff --git a/docs/generated/packages/remix/documents/overview.md b/docs/generated/packages/remix/documents/overview.md index c1d822bb6df3f..fbe2b09502338 100644 --- a/docs/generated/packages/remix/documents/overview.md +++ b/docs/generated/packages/remix/documents/overview.md @@ -89,7 +89,7 @@ The command below uses the `as-provided` directory flag behavior, which is the d {% /callout %} ```{% command="nx g @nx/remix:app myapp --directory=apps/myapp" path="~/acme" %} -> NX Generating @nx/remix:application +NX Generating @nx/remix:application ✔ What unit test runner should be used? · vitest @@ -135,9 +135,9 @@ Building Remix app in production mode... Built in 857ms - —————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— +—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— - > NX Successfully ran target build for project myapp (3s) +NX Successfully ran target build for project myapp (3s) ``` 2. To serve your application for use during development run: @@ -155,18 +155,18 @@ Remix App Server started at http://localhost:3000 (http://192.168.0.14:3000) ```{% command="nx test myapp" path="~/acme" %} > nx run myapp:test - RUN v0.31.4 /Users/columferry/dev/nrwl/issues/remixguide/acme/apps/myapp +RUN v0.31.4 /Users/columferry/dev/nrwl/issues/remixguide/acme/apps/myapp stderr | app/routes/index.spec.ts > test > should render Warning: Functions are not valid as a React child. This may happen if you return a Component instead of from render. Or maybe you meant to call this function rather than return it. - ✓ app/routes/index.spec.ts (1 test) 10ms - Test Files 1 passed (1) - Tests 1 passed (1) - Start at 16:15:45 - Duration 1.20s (transform 51ms, setup 139ms, collect 180ms, tests 10ms, environment 379ms, prepare 103ms) +✓ app/routes/index.spec.ts (1 test) 10ms +Test Files 1 passed (1) + Tests 1 passed (1) +Start at 16:15:45 +Duration 1.20s (transform 51ms, setup 139ms, collect 180ms, tests 10ms, environment 379ms, prepare 103ms) - —————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— +—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— - > NX Successfully ran target test for project myapp (2s) +NX Successfully ran target test for project myapp (2s) ``` ## Generating an Nx Library @@ -176,7 +176,7 @@ When developing your application, it often makes sense to split your codebase in To generate a library to use in your Remix application run: ```{% command="nx g @nx/remix:lib login --directory=libs/login" path="~/acme" %} -> NX Generating @nx/remix:library +NX Generating @nx/remix:library ✔ What test runner should be used? · vitest UPDATE nx.json @@ -223,7 +223,7 @@ You can also run test on your library: To generate a route for your application: ```{% command="nx g @nx/remix:route admin --path=apps/myapp/app/routes" path="~/acme" %} -> NX Generating @nx/remix:route +NX Generating @nx/remix:route CREATE apps/myapp/app/routes/admin.tsx CREATE apps/myapp/app/styles/admin.css @@ -236,7 +236,7 @@ To use a Route Loader where the logic lives in your library, follow the steps be 1. Generate a loader for your route: ```{% command="nx g @nx/remix:loader admin --path=apps/myapp/app/routes" path="~/acme" %} -> NX Generating @nx/remix:loader +NX Generating @nx/remix:loader UPDATE apps/myapp/app/routes/admin.tsx ``` diff --git a/docs/nx-cloud/tutorial/circle.md b/docs/nx-cloud/tutorial/circle.md index 465381cefde4c..3a2b7710916fe 100644 --- a/docs/nx-cloud/tutorial/circle.md +++ b/docs/nx-cloud/tutorial/circle.md @@ -212,16 +212,16 @@ pnpm nx build landing-page Clearly this is not a scalable solution as it requires us to manually add every new app to the pipeline (and it doesn't include other tasks like `lint`, `test` etc). To improve this we can change the command to run the `build` for all projects like ```{% command="nx run-many -t build" %} - ✔ nx run shared-product-types:build (429ms) - ✔ nx run shared-product-ui:build (455ms) - ✔ nx run shared-header:build (467ms) - ✔ nx run landing-page:build:production (3s) - ✔ nx run admin:build:production (3s) - ✔ nx run cart:build:production (3s) +✔ nx run shared-product-types:build (429ms) +✔ nx run shared-product-ui:build (455ms) +✔ nx run shared-header:build (467ms) +✔ nx run landing-page:build:production (3s) +✔ nx run admin:build:production (3s) +✔ nx run cart:build:production (3s) - ———————————————————————————————————————————————————————————————— +———————————————————————————————————————————————————————————————— - > NX Successfully ran target build for 6 projects (10s) +NX Successfully ran target build for 6 projects (10s) ``` This change makes our CI pipeline configuration more maintainable. For a small repository, this might be good enough, but after a little bit of growth this approach will cause your CI times to become unmanageable. @@ -229,14 +229,14 @@ This change makes our CI pipeline configuration more maintainable. For a small r Nx comes with a dedicated ["affected" command](/ci/features/affected) to help with that by only running tasks for projects that were affected by the changes in a given PR. ```{% command="nx affected -t build" %} - ✔ nx run shared-product-types:build (404ms) - ✔ nx run shared-product-ui:build (445ms) - ✔ nx run shared-header:build (465ms) - ✔ nx run cart:build:production (3s) +✔ nx run shared-product-types:build (404ms) +✔ nx run shared-product-ui:build (445ms) +✔ nx run shared-header:build (465ms) +✔ nx run cart:build:production (3s) - —————————————————————————————————————————————————————————————————————————————————————— +—————————————————————————————————————————————————————————————————————————————————————— - > NX Successfully ran target build for project cart and 3 tasks it depends on (4s) +NX Successfully ran target build for project cart and 3 tasks it depends on (4s) ``` ### Configuring the Comparison Range for Affected Commands @@ -336,8 +336,14 @@ This wires up all the CI for you and configures access. Folks who can see your r To manually connect your workspace to Nx Cloud, run the following command in your repository: -```shell -pnpm nx connect +```{% command="pnpm nx connect" %} +$ nx g nx:connect-to-nx-cloud --quiet --no-interactive + +NX Your Nx Cloud workspace is public + +To restrict access, connect it to your Nx Cloud account: +- Push your changes +- Login at https://cloud.nx.app to connect your repository ``` Click the link in the terminal to claim your workspace on [nx.app](https://nx.app). @@ -360,18 +366,18 @@ What is more, if you run tasks locally, you will also get cache hits: ```{% command="nx run-many -t build" %} ... - ✔ nx run express-legacy:build [remote cache] - ✔ nx run nx-plugin-legacy:build [remote cache] - ✔ nx run esbuild-legacy:build [remote cache] - ✔ nx run react-native-legacy:build [remote cache] - ✔ nx run angular-legacy:build [remote cache] - ✔ nx run remix-legacy:build [remote cache] +✔ nx run express-legacy:build [remote cache] +✔ nx run nx-plugin-legacy:build [remote cache] +✔ nx run esbuild-legacy:build [remote cache] +✔ nx run react-native-legacy:build [remote cache] +✔ nx run angular-legacy:build [remote cache] +✔ nx run remix-legacy:build [remote cache] - ———————————————————————————————————————————————— +———————————————————————————————————————————————— - > NX Successfully ran target build for 58 projects and 62 tasks they depend on (1m) +NX Successfully ran target build for 58 projects and 62 tasks they depend on (1m) - Nx read the output from the cache instead of running the command for 116 out of 120 tasks. +Nx read the output from the cache instead of running the command for 116 out of 120 tasks. ``` You might also want to learn more about [how to fine-tune caching](/recipes/running-tasks/configure-inputs) to get even better results. diff --git a/docs/nx-cloud/tutorial/github-actions.md b/docs/nx-cloud/tutorial/github-actions.md index 0ea90355e4a2b..71a0a1660c0ff 100644 --- a/docs/nx-cloud/tutorial/github-actions.md +++ b/docs/nx-cloud/tutorial/github-actions.md @@ -207,16 +207,16 @@ pnpm nx build landing-page Clearly this is not a scalable solution as it requires us to manually add every new app to the pipeline (and it doesn't include other tasks like `lint`, `test` etc). To improve this we can change the command to run the `build` for all projects like ```{% command="nx run-many -t build" %} - ✔ nx run shared-product-types:build (429ms) - ✔ nx run shared-product-ui:build (455ms) - ✔ nx run shared-header:build (467ms) - ✔ nx run landing-page:build:production (3s) - ✔ nx run admin:build:production (3s) - ✔ nx run cart:build:production (3s) +✔ nx run shared-product-types:build (429ms) +✔ nx run shared-product-ui:build (455ms) +✔ nx run shared-header:build (467ms) +✔ nx run landing-page:build:production (3s) +✔ nx run admin:build:production (3s) +✔ nx run cart:build:production (3s) - ———————————————————————————————————————————————————————————————— +———————————————————————————————————————————————————————————————— - > NX Successfully ran target build for 6 projects (10s) +NX Successfully ran target build for 6 projects (10s) ``` This change makes our CI pipeline configuration more maintainable. For a small repository, this might be good enough, but after a little bit of growth this approach will cause your CI times to become unmanageable. @@ -224,14 +224,14 @@ This change makes our CI pipeline configuration more maintainable. For a small r Nx comes with a dedicated ["affected" command](/ci/features/affected) to help with that by only running tasks for projects that were affected by the changes in a given PR. ```{% command="nx affected -t build" %} - ✔ nx run shared-product-types:build (404ms) - ✔ nx run shared-product-ui:build (445ms) - ✔ nx run shared-header:build (465ms) - ✔ nx run cart:build:production (3s) +✔ nx run shared-product-types:build (404ms) +✔ nx run shared-product-ui:build (445ms) +✔ nx run shared-header:build (465ms) +✔ nx run cart:build:production (3s) - —————————————————————————————————————————————————————————————————————————————————————— +—————————————————————————————————————————————————————————————————————————————————————— - > NX Successfully ran target build for project cart and 3 tasks it depends on (4s) +NX Successfully ran target build for project cart and 3 tasks it depends on (4s) ``` ### Configuring the Comparison Range for Affected Commands @@ -345,18 +345,18 @@ What is more, if you run tasks locally, you will also get cache hits: ```{% command="nx run-many -t build" %} ... - ✔ nx run express-legacy:build [remote cache] - ✔ nx run nx-plugin-legacy:build [remote cache] - ✔ nx run esbuild-legacy:build [remote cache] - ✔ nx run react-native-legacy:build [remote cache] - ✔ nx run angular-legacy:build [remote cache] - ✔ nx run remix-legacy:build [remote cache] +✔ nx run express-legacy:build [remote cache] +✔ nx run nx-plugin-legacy:build [remote cache] +✔ nx run esbuild-legacy:build [remote cache] +✔ nx run react-native-legacy:build [remote cache] +✔ nx run angular-legacy:build [remote cache] +✔ nx run remix-legacy:build [remote cache] - ———————————————————————————————————————————————— +———————————————————————————————————————————————— - > NX Successfully ran target build for 58 projects and 62 tasks they depend on (1m) +NX Successfully ran target build for 58 projects and 62 tasks they depend on (1m) - Nx read the output from the cache instead of running the command for 116 out of 120 tasks. +Nx read the output from the cache instead of running the command for 116 out of 120 tasks. ``` You might also want to learn more about [how to fine-tune caching](/recipes/running-tasks/configure-inputs) to get even better results. diff --git a/docs/shared/angular-standalone-tutorial/angular-standalone.md b/docs/shared/angular-standalone-tutorial/angular-standalone.md index 774609e23bbbb..44a3cf12ba6d8 100644 --- a/docs/shared/angular-standalone-tutorial/angular-standalone.md +++ b/docs/shared/angular-standalone-tutorial/angular-standalone.md @@ -470,14 +470,14 @@ More conveniently, we can also run them in parallel using the following syntax: ```{% command="nx run-many -t test lint e2e" path="myngapp" %} - ✔ nx run e2e:lint (1s) - ✔ nx run myngapp:lint (1s) - ✔ nx run myngapp:test (2s) - ✔ nx run e2e:e2e (6s) +✔ nx run e2e:lint (1s) +✔ nx run myngapp:lint (1s) +✔ nx run myngapp:test (2s) +✔ nx run e2e:e2e (6s) - —————————————————————————————————————————————————————— +—————————————————————————————————————————————————————— - > NX Successfully ran targets test, lint, e2e for 2 projects (8s) +NX Successfully ran targets test, lint, e2e for 2 projects (8s) ``` ### Caching @@ -490,16 +490,16 @@ Note that all of these targets are automatically cached by Nx. If you re-run a s ```{% command="nx run-many -t test lint e2e" path="myngapp" %} - ✔ nx run myngapp:lint [existing outputs match the cache, left as is] - ✔ nx run e2e:lint [existing outputs match the cache, left as is] - ✔ nx run myngapp:test [existing outputs match the cache, left as is] - ✔ nx run e2e:e2e [existing outputs match the cache, left as is] +✔ nx run myngapp:lint [existing outputs match the cache, left as is] +✔ nx run e2e:lint [existing outputs match the cache, left as is] +✔ nx run myngapp:test [existing outputs match the cache, left as is] +✔ nx run e2e:e2e [existing outputs match the cache, left as is] - ——————————————————————————————————————————————————————— +——————————————————————————————————————————————————————— - > NX Successfully ran targets test, lint, e2e for 2 projects (143ms) + Successfully ran targets test, lint, e2e for 2 projects (143ms) - Nx read the output from the cache instead of running the command for 4 out of 4 tasks. +Nx read the output from the cache instead of running the command for 4 out of 4 tasks. ``` Not all tasks might be cacheable though. You can configure the `cache` properties in the targets under `targetDefaults` in the `nx.json` file. You can also [learn more about how caching works](/features/cache-task-results). @@ -514,44 +514,44 @@ Generators allow you to easily scaffold code, configuration or entire projects. ```{% command="npx nx list @nx/angular" path="myngapp" %} - > NX Capabilities in @nx/angular: - -> NX Capabilities in @nx/angular: - - GENERATORS - - add-linting : Adds linting configuration to an Angular project. - application : Creates an Angular application. - component : Generate an Angular Component. - ... - library : Creates an Angular library. - library-secondary-entry-point : Creates a secondary entry point for an Angular publishable library. - remote : Generate a Remote Angular Module Federation Application. - move : Moves an Angular application or library to another folder within the workspace and updates the project configuration. - convert-to-with-mf : Converts an old micro frontend configuration... - host : Generate a Host Angular Module Federation Application. - ng-add : Migrates an Angular CLI workspace to Nx or adds the Angular plugin to an Nx workspace. - ngrx : Adds NgRx support to an application or library. - scam-to-standalone : Convert an existing Single Component Angular Module (SCAM) to a Standalone Component. - scam : Generate a component with an accompanying Single Component Angular Module (SCAM). - scam-directive : Generate a directive with an accompanying Single Component Angular Module (SCAM). - scam-pipe : Generate a pipe with an accompanying Single Component Angular Module (SCAM). - setup-mf : Generate a Module Federation configuration for a given Angular application. - setup-ssr : Generate Angular Universal (SSR) setup for an Angular application. - setup-tailwind : Configures Tailwind CSS for an application or a buildable/publishable library. - stories : Creates stories/specs for all components declared in a project. - storybook-configuration : Adds Storybook configuration to a project. - cypress-component-configuration : Setup Cypress component testing for a project. - web-worker : Creates a Web Worker. - directive : Generate an Angular directive. - ngrx-feature-store : Adds an NgRx Feature Store to an application or library. - ngrx-root-store : Adds an NgRx Root Store to an application. - pipe : Generate an Angular Pipe - - EXECUTORS/BUILDERS/ - - delegate-build : Delegates the build to a different target while supporting incremental builds. - ... +NX Capabilities in @nx/angular: + +NX Capabilities in @nx/angular: + + GENERATORS + + add-linting : Adds linting configuration to an Angular project. + application : Creates an Angular application. + component : Generate an Angular Component. + ... + library : Creates an Angular library. + library-secondary-entry-point : Creates a secondary entry point for an Angular publishable library. + remote : Generate a Remote Angular Module Federation Application. + move : Moves an Angular application or library to another folder within the workspace and updates the project configuration. + convert-to-with-mf : Converts an old micro frontend configuration... + host : Generate a Host Angular Module Federation Application. + ng-add : Migrates an Angular CLI workspace to Nx or adds the Angular plugin to an Nx workspace. + ngrx : Adds NgRx support to an application or library. + scam-to-standalone : Convert an existing Single Component Angular Module (SCAM) to a Standalone Component. + scam : Generate a component with an accompanying Single Component Angular Module (SCAM). + scam-directive : Generate a directive with an accompanying Single Component Angular Module (SCAM). + scam-pipe : Generate a pipe with an accompanying Single Component Angular Module (SCAM). + setup-mf : Generate a Module Federation configuration for a given Angular application. + setup-ssr : Generate Angular Universal (SSR) setup for an Angular application. + setup-tailwind : Configures Tailwind CSS for an application or a buildable/publishable library. + stories : Creates stories/specs for all components declared in a project. + storybook-configuration : Adds Storybook configuration to a project. + cypress-component-configuration : Setup Cypress component testing for a project. + web-worker : Creates a Web Worker. + directive : Generate an Angular directive. + ngrx-feature-store : Adds an NgRx Feature Store to an application or library. + ngrx-root-store : Adds an NgRx Root Store to an application. + pipe : Generate an Angular Pipe + + EXECUTORS/BUILDERS/ + + delegate-build : Delegates the build to a different target while supporting incremental builds. + ... ``` {% callout type="info" title="Prefer a more visual UI?" %} @@ -565,7 +565,7 @@ More info can be found in [the integrate with editors article](/features/integra Run the following command to generate a new "hello-world" component. Note how we append `--dry-run` to first check the output. ```{% command="npx nx g @nx/angular:component hello-world --directory=src/app/hello-world --standalone --dry-run" path="myngapp" %} -> NX Generating @nx/angular:component +NX Generating @nx/angular:component CREATE src/app/hello-world/hello-world.component.css CREATE src/app/hello-world/hello-world.component.html @@ -614,9 +614,9 @@ styles.ef46db3751d8e999.css | styles | 0 bytes | Build at: 2023-05-23T14:00:31.981Z - Hash: 9086e92ce0bfefca - Time: 5228ms - —————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— +—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— - > NX Successfully ran target build for project myngapp (7s) +Successfully ran target build for project myngapp (7s) ``` All the required files will be placed in the `dist/myngapp` folder and can be deployed to your favorite hosting provider. @@ -1051,29 +1051,29 @@ export class ProductsComponent {} If you lint your workspace you'll get an error now: ```{% command="nx run-many -t lint" %} - ✖ nx run products:lint - Linting "products"... +✖ nx run products:lint + Linting "products"... - /Users/juri/nrwl/content/myngapp/modules/products/src/lib/products/products.component.ts - 3:1 error A project tagged with "scope:products" can only depend on libs tagged with "scope:products", "scope:shared" @nx/enforce-module-boundaries + /Users/juri/nrwl/content/myngapp/modules/products/src/lib/products/products.component.ts + 3:1 error A project tagged with "scope:products" can only depend on libs tagged with "scope:products", "scope:shared" @nx/enforce-module-boundaries - ✖ 1 problem (1 error, 0 warnings) + ✖ 1 problem (1 error, 0 warnings) - Lint errors found in the listed files. + Lint errors found in the listed files. - ✔ nx run orders:lint (1s) - ✔ nx run myngapp:lint (1s) - ✔ nx run e2e:lint (682ms) - ✔ nx run shared-ui:lint (797ms) +✔ nx run orders:lint (1s) +✔ nx run myngapp:lint (1s) +✔ nx run e2e:lint (682ms) +✔ nx run shared-ui:lint (797ms) - ————————————————————————————————————————————————————————————————————— +————————————————————————————————————————————————————————————————————— - > NX Ran target lint for 5 projects (2s) +NX Ran target lint for 5 projects (2s) - ✔ 4/5 succeeded [0 read from cache] +✔ 4/5 succeeded [0 read from cache] - ✖ 1/5 targets failed, including the following: - - nx run products:lint +✖ 1/5 targets failed, including the following: + - nx run products:lint ``` diff --git a/docs/shared/angular-tutorial/angular-monorepo.md b/docs/shared/angular-tutorial/angular-monorepo.md index dcdf99f61dc1e..bb71b717a7db9 100644 --- a/docs/shared/angular-tutorial/angular-monorepo.md +++ b/docs/shared/angular-tutorial/angular-monorepo.md @@ -52,7 +52,7 @@ title="Tutorial: Standalone Angular Application" Create a new Angular monorepo with the following command: ```{% command="npx create-nx-workspace@latest angular-monorepo --preset=angular-monorepo" path="~" %} - > NX Let's create a new workspace [https://nx.dev/getting-started/intro] +NX Let's create a new workspace [https://nx.dev/getting-started/intro] ✔ Application name · angular-store ✔ Which bundler would you like to use? · esbuild @@ -566,7 +566,7 @@ Nx plugins usually provide [generators](/features/generate-code) that allow you ```{% command="npx nx list @nx/angular" path="angular-monorepo" %} - > NX Capabilities in @nx/angular: +NX Capabilities in @nx/angular: GENERATORS @@ -608,7 +608,7 @@ More info can be found in [the integrate with editors article](/features/integra Run the following command to generate a new `inventory` application. Note how we append `--dry-run` to first check the output. ```{% command="npx nx g @nx/angular:app inventory --directory=apps/inventory --dry-run" path="angular-monorepo" %} -> NX Generating @nx/angular:application +NX Generating @nx/angular:application ✔ Would you like to configure routing for this application? (y/N) · false ✔ Would you like to use Standalone Components? (y/N) · true @@ -1009,17 +1009,16 @@ One thing to highlight is that Nx is able to [cache the tasks you run](/features Note that all of these targets are automatically cached by Nx. If you re-run a single one or all of them again, you'll see that the task completes immediately. In addition, (as can be seen in the output example below) there will be a note that a matching cache result was found and therefore the task was not run again. ```{% command="nx run-many -t test lint e2e" path="angular-monorepo" %} +✔ nx run e2e:lint [existing outputs match the cache, left as is] +✔ nx run angular-store:lint [existing outputs match the cache, left as is] +✔ nx run angular-store:test [existing outputs match the cache, left as is] +✔ nx run e2e:e2e [existing outputs match the cache, left as is] - ✔ nx run e2e:lint [existing outputs match the cache, left as is] - ✔ nx run angular-store:lint [existing outputs match the cache, left as is] - ✔ nx run angular-store:test [existing outputs match the cache, left as is] - ✔ nx run e2e:e2e [existing outputs match the cache, left as is] +—————————————————————————————————————————————————————— - —————————————————————————————————————————————————————— +NX Successfully ran targets test, lint, e2e for 5 projects (54ms) - > NX Successfully ran targets test, lint, e2e for 5 projects (54ms) - - Nx read the output from the cache instead of running the command for 10 out of 10 tasks. +Nx read the output from the cache instead of running the command for 10 out of 10 tasks. ``` Not all tasks might be cacheable though. You can configure `cacheableOperations` in the `nx.json` file. You can also [learn more about how caching works](/features/cache-task-results). @@ -1153,7 +1152,7 @@ nx graph --affected If you're ready and want to ship your applications, you can build them using ```{% command="npx nx run-many -t build" path="angular-monorepo" %} -> NX Generating @nx/angular:component +NX Generating @nx/angular:component CREATE libs/orders/src/lib/order-list/order-list.component.css CREATE libs/orders/src/lib/order-list/order-list.component.html @@ -1162,12 +1161,12 @@ CREATE libs/orders/src/lib/order-list/order-list.component.ts UPDATE libs/orders/src/index.ts ❯ nx run-many -t build - ✔ nx run inventory:build:production (7s) - ✔ nx run angular-store:build:production (7s) +✔ nx run inventory:build:production (7s) +✔ nx run angular-store:build:production (7s) - ——————————————————————————————————————————————————————————————————————— +——————————————————————————————————————————————————————————————————————— - > NX Successfully ran target build for 2 projects (7s) +NX Successfully ran target build for 2 projects (7s) ``` All the required files will be placed in `dist/apps/angular-store` and `dist/apps/inventory` and can be deployed to your favorite hosting provider. @@ -1321,36 +1320,36 @@ export class ProductListComponent {} If you lint your workspace you'll get an error now: ```{% command="nx run-many -t lint" %} - > NX Running target lint for 7 projects - ✖ nx run products:lint - Linting "products"... +NX Running target lint for 7 projects +✖ nx run products:lint + Linting "products"... - /Users/isaac/Documents/code/nx-recipes/angular-monorepo/libs/products/src/lib/product-list/product-list.component.ts - 5:1 error A project tagged with "scope:products" can only depend on libs tagged with "scope:products", "scope:shared" @nx/enforce-module-boundaries - 5:10 warning 'OrderListComponent' is defined but never used @typescript-eslint/no-unused-vars + /Users/isaac/Documents/code/nx-recipes/angular-monorepo/libs/products/src/lib/product-list/product-list.component.ts + 5:1 error A project tagged with "scope:products" can only depend on libs tagged with "scope:products", "scope:shared" @nx/enforce-module-boundaries + 5:10 warning 'OrderListComponent' is defined but never used @typescript-eslint/no-unused-vars - ✖ 2 problems (1 error, 1 warning) + ✖ 2 problems (1 error, 1 warning) - Lint warnings found in the listed files. + Lint warnings found in the listed files. - Lint errors found in the listed files. + Lint errors found in the listed files. - ✔ nx run orders:lint (1s) - ✔ nx run angular-store:lint (1s) - ✔ nx run angular-store-e2e:lint (689ms) - ✔ nx run inventory-e2e:lint (690ms) - ✔ nx run inventory:lint (858ms) - ✔ nx run shared-ui:lint (769ms) +✔ nx run orders:lint (1s) +✔ nx run angular-store:lint (1s) +✔ nx run angular-store-e2e:lint (689ms) +✔ nx run inventory-e2e:lint (690ms) +✔ nx run inventory:lint (858ms) +✔ nx run shared-ui:lint (769ms) - ——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— +——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— - > NX Ran target lint for 7 projects (3s) +NX Ran target lint for 7 projects (3s) - ✔ 6/7 succeeded [0 read from cache] +✔ 6/7 succeeded [0 read from cache] - ✖ 1/7 targets failed, including the following: - - nx run products:lint +✖ 1/7 targets failed, including the following: + - nx run products:lint ``` If you have the ESLint plugin installed in your IDE you should immediately see an error: diff --git a/docs/shared/core-tutorial/02-create-cli.md b/docs/shared/core-tutorial/02-create-cli.md index b85f1df0cf233..0bd7e839b1090 100644 --- a/docs/shared/core-tutorial/02-create-cli.md +++ b/docs/shared/core-tutorial/02-create-cli.md @@ -135,11 +135,11 @@ Hello, World! ||----w | || || - ————————————————————————————————————————————————————————————————————————————————————————— +————————————————————————————————————————————————————————————————————————————————————————— - > NX Successfully ran target serve for project cli (2s) +NX Successfully ran target serve for project cli (2s) - See Nx Cloud run details at https://nx.app/runs/THRW7SDRL9S +See Nx Cloud run details at https://nx.app/runs/THRW7SDRL9S ``` diff --git a/docs/shared/core-tutorial/04-build-affected-projects.md b/docs/shared/core-tutorial/04-build-affected-projects.md index f904ba15b267f..590f2c4aaf7db 100644 --- a/docs/shared/core-tutorial/04-build-affected-projects.md +++ b/docs/shared/core-tutorial/04-build-affected-projects.md @@ -48,7 +48,7 @@ Update `packages/ascii/assets/cow.txt`: ```plaintext _____ -< Hi! > +< moo > ----- \ ^__^ \ (oo)\_______ @@ -66,14 +66,14 @@ Printing the affected projects can be handy, but usually you want to do somethin **Run `nx affected -t build` to rebuild only the projects affected by the change.** ```shell - ✔ nx run blog:build (1s) - ✔ nx run cli:build (2s) +✔ nx run blog:build (1s) +✔ nx run cli:build (2s) - —————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— +—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— - > NX Successfully ran target build for 2 projects (2s) +NX Successfully ran target build for 2 projects (2s) - See Nx Cloud run details at https://nx.app/runs/XfhRFaOyGCE +See Nx Cloud run details at https://nx.app/runs/XfhRFaOyGCE ``` Note that Nx only built `blog` and `cli`. It didn't build `ascii` because there is no build script created for it. diff --git a/docs/shared/core-tutorial/05-auto-detect-dependencies.md b/docs/shared/core-tutorial/05-auto-detect-dependencies.md index 6c0206ec46dc8..b1eb46445c92f 100644 --- a/docs/shared/core-tutorial/05-auto-detect-dependencies.md +++ b/docs/shared/core-tutorial/05-auto-detect-dependencies.md @@ -99,14 +99,13 @@ ______________________________________________________ (__)\ )\/\ ||----w | || || -Done in 0.14s. + Done in 0.14s. - —————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— +—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— - > NX Successfully ran target serve for project cow +NX Successfully ran target serve for project cow - - See Nx Cloud run details at https://nx.app/runs/nZBYYBEuIfG +See Nx Cloud run details at https://nx.app/runs/nZBYYBEuIfG ``` ## View the Project Graph diff --git a/docs/shared/deprecated/as-provided-vs-derived.md b/docs/shared/deprecated/as-provided-vs-derived.md index 62e8350ef816c..535a61768b9b1 100644 --- a/docs/shared/deprecated/as-provided-vs-derived.md +++ b/docs/shared/deprecated/as-provided-vs-derived.md @@ -24,7 +24,7 @@ To mitigate the impact of this change of direction, Nx will prompt you when runn ```{% command="nx g lib my-lib --directory=shared/my-lib" path="~/myorg" %} ✔ Which generator would you like to use? · @nx/node:library -> NX Generating @nx/node:library +NX Generating @nx/node:library ? What should be the project name and where should it be generated? … ❯ As provided: diff --git a/docs/shared/features/remote-cache.md b/docs/shared/features/remote-cache.md index 298e3a0d64aa1..cf235932b78ae 100644 --- a/docs/shared/features/remote-cache.md +++ b/docs/shared/features/remote-cache.md @@ -25,22 +25,19 @@ To see the remote cache in action, run: src/index.tsx → dist... created dist in 786ms - ————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— +————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— - > NX Successfully ran target build for project header (2s) +NX Successfully ran target build for project header (2s) - See logs and investigate cache misses at https://cloud.nx.app/runs/k0HDHACpL8 +See logs and investigate cache misses at https://cloud.nx.app/runs/k0HDHACpL8 +NX Resetting the Nx workspace cache and stopping the Nx Daemon. - > NX Resetting the Nx workspace cache and stopping the Nx Daemon. +This might take a few minutes. - This might take a few minutes. +NX Daemon Server - Stopped - - > NX Daemon Server - Stopped - - - > NX Successfully reset the Nx workspace. +NX Successfully reset the Nx workspace. > nx run header:build [remote cache] @@ -53,13 +50,13 @@ created dist in 786ms src/index.tsx → dist... created dist in 786ms - ————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— +————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— - > NX Successfully ran target build for project header (664ms) +NX Successfully ran target build for project header (664ms) - Nx read the output from the cache instead of running the command for 1 out of 1 tasks. +Nx read the output from the cache instead of running the command for 1 out of 1 tasks. - Nx Cloud made it possible to reuse header: https://nx.app/runs/P0X6ZGTkqZ +Nx Cloud made it possible to reuse header: https://nx.app/runs/P0X6ZGTkqZ ``` ## Skipping Cloud Cache diff --git a/docs/shared/getting-started/installation.md b/docs/shared/getting-started/installation.md index 9a106d544ab94..d6347af73c872 100644 --- a/docs/shared/getting-started/installation.md +++ b/docs/shared/getting-started/installation.md @@ -30,7 +30,7 @@ This will guide you through the setup, asking whether you want a monorepo or a s ```{% command="npx create-nx-workspace" path="~" %} - > NX Let's create a new workspace [https://nx.dev/getting-started/intro] +NX Let's create a new workspace [https://nx.dev/getting-started/intro] ✔ Where would you like to create your workspace? · myorg ? Which stack do you want to use? … diff --git a/docs/shared/guides/module-federation/faster-builds.md b/docs/shared/guides/module-federation/faster-builds.md index f504bae95386a..ce63dd9fc5fe9 100644 --- a/docs/shared/guides/module-federation/faster-builds.md +++ b/docs/shared/guides/module-federation/faster-builds.md @@ -327,11 +327,11 @@ If you inspect the terminal output, you'll see something like this, even if you ```shell > nx run about:build:development [existing outputs match the cache, left as is] - (snip) +(snip) - > NX Successfully ran target build for project about +NX Successfully ran target build for project about - Nx read the output from the cache instead of running the command for 1 out of 1 tasks. +Nx read the output from the cache instead of running the command for 1 out of 1 tasks. ``` diff --git a/docs/shared/guides/remix.md b/docs/shared/guides/remix.md index 6a49c3393903f..3adf9222b5ce9 100644 --- a/docs/shared/guides/remix.md +++ b/docs/shared/guides/remix.md @@ -5,24 +5,24 @@ In this recipe, we'll show you how to create a [Remix](https://remix.run) applic ## Create Nx Workspace ```{% command="npx create-nx-workspace acme --preset=apps" path="~/" %} - > NX Let's create a new workspace [https://nx.dev/getting-started/intro] +NX Let's create a new workspace [https://nx.dev/getting-started/intro] ✔ Do you want Nx Cloud to make your CI fast? · Yes - > NX Creating your v16.3.2 workspace. +NX Creating your v16.3.2 workspace. - To make sure the command works reliably in all environments, and that the preset is applied correctly, - Nx will run "npm install" several times. Please wait. +To make sure the command works reliably in all environments, and that the preset is applied correctly, +Nx will run "npm install" several times. Please wait. ✔ Installing dependencies with npm ✔ Successfully created the workspace: acme. - —————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— +—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— - > NX First time using Nx? Check out this interactive Nx tutorial. +NX First time using Nx? Check out this interactive Nx tutorial. - https://nx.dev/tutorials/package-based-repo-tutorial +https://nx.dev/tutorials/package-based-repo-tutorial ``` ## Install Nx Remix Plugin @@ -42,7 +42,7 @@ The command below uses the `as-provided` directory flag behavior, which is the d {% /callout %} ```{% command="nx g @nx/remix:app myapp --directory=apps/myapp" path="~/acme" %} -> NX Generating @nx/remix:application +NX Generating @nx/remix:application ✔ What unit test runner should be used? · vitest @@ -88,9 +88,9 @@ Building Remix app in production mode... Built in 857ms - —————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— +—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— - > NX Successfully ran target build for project myapp (3s) +NX Successfully ran target build for project myapp (3s) ``` 2. To serve your application for use during development run: @@ -108,18 +108,18 @@ Remix App Server started at http://localhost:3000 (http://192.168.0.14:3000) ```{% command="nx test myapp" path="~/acme" %} > nx run myapp:test - RUN v0.31.4 /Users/columferry/dev/nrwl/issues/remixguide/acme/apps/myapp +RUN v0.31.4 /Users/columferry/dev/nrwl/issues/remixguide/acme/apps/myapp stderr | app/routes/index.spec.ts > test > should render Warning: Functions are not valid as a React child. This may happen if you return a Component instead of from render. Or maybe you meant to call this function rather than return it. - ✓ app/routes/index.spec.ts (1 test) 10ms - Test Files 1 passed (1) - Tests 1 passed (1) - Start at 16:15:45 - Duration 1.20s (transform 51ms, setup 139ms, collect 180ms, tests 10ms, environment 379ms, prepare 103ms) +✓ app/routes/index.spec.ts (1 test) 10ms +Test Files 1 passed (1) + Tests 1 passed (1) +Start at 16:15:45 +Duration 1.20s (transform 51ms, setup 139ms, collect 180ms, tests 10ms, environment 379ms, prepare 103ms) - —————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— +—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— - > NX Successfully ran target test for project myapp (2s) +NX Successfully ran target test for project myapp (2s) ``` ## Generating an Nx Library @@ -129,7 +129,7 @@ When developing your application, it often makes sense to split your codebase in To generate a library to use in your Remix application run: ```{% command="nx g @nx/remix:lib login --directory=libs/login" path="~/acme" %} -> NX Generating @nx/remix:library +NX Generating @nx/remix:library ✔ What test runner should be used? · vitest UPDATE nx.json @@ -176,7 +176,7 @@ You can also run test on your library: To generate a route for your application: ```{% command="nx g @nx/remix:route admin --path=apps/myapp/app/routes" path="~/acme" %} -> NX Generating @nx/remix:route +NX Generating @nx/remix:route CREATE apps/myapp/app/routes/admin.tsx CREATE apps/myapp/app/styles/admin.css @@ -189,7 +189,7 @@ To use a Route Loader where the logic lives in your library, follow the steps be 1. Generate a loader for your route: ```{% command="nx g @nx/remix:loader admin --path=apps/myapp/app/routes" path="~/acme" %} -> NX Generating @nx/remix:loader +NX Generating @nx/remix:loader UPDATE apps/myapp/app/routes/admin.tsx ``` diff --git a/docs/shared/npm-tutorial/integrated.md b/docs/shared/npm-tutorial/integrated.md index f07e704fc63cc..505e195e24ecb 100644 --- a/docs/shared/npm-tutorial/integrated.md +++ b/docs/shared/npm-tutorial/integrated.md @@ -191,9 +191,9 @@ Run the same command a second time and you'll see the build cache is being used: Compiling TypeScript files for project "is-even"... Done compiling TypeScript files for project "is-even". - ————————————————————————————————————————————————————————————————————— +————————————————————————————————————————————————————————————————————— - > NX Successfully ran target build for project is-even (713ms) +NX Successfully ran target build for project is-even (713ms) ``` ## Running Multiple Tasks @@ -207,14 +207,14 @@ npx nx run-many -t build What you would get is the following: ```{% command="npx nx run-many -t build" %} - ✔ nx run is-even:build [existing outputs match the cache, left as is] - ✔ nx run is-odd:build (906ms) +✔ nx run is-even:build [existing outputs match the cache, left as is] +✔ nx run is-odd:build (906ms) - ————————————————————————————————————————————————————————————————— +————————————————————————————————————————————————————————————————— - > NX Successfully ran target build for 2 projects (914ms) +NX Successfully ran target build for 2 projects (914ms) - Nx read the output from the cache instead of running the command for 1 out of 2 tasks. +Nx read the output from the cache instead of running the command for 1 out of 2 tasks. ``` Note how on the `is-even:build` it didn't run the build but rather pulled it out of the cache because the build has ran before. If you re-run the `run-many` command all of the builds would be cached. diff --git a/docs/shared/npm-tutorial/package-based.md b/docs/shared/npm-tutorial/package-based.md index 1fa758da7bcad..c6f9b6de28aef 100644 --- a/docs/shared/npm-tutorial/package-based.md +++ b/docs/shared/npm-tutorial/package-based.md @@ -221,11 +221,11 @@ Run the command: > tsc index.ts --outDir dist - —————————————————————————————————————————————————————————————————————————————————————————— +—————————————————————————————————————————————————————————————————————————————————————————— - > NX Successfully ran target build for project is-even (33ms) +NX Successfully ran target build for project is-even (33ms) - Nx read the output from the cache instead of running the command for 1 out of 1 tasks. +Nx read the output from the cache instead of running the command for 1 out of 1 tasks. ``` @@ -236,25 +236,25 @@ Note that the cache for the `build` script was already populated when we ran it To run the `build` target for all the packages in the workspace, use: ```{% command="npx nx run-many -t build" %} - ✔ nx run is-even:build [existing outputs match the cache, left as is] - ✔ nx run is-odd:build [existing outputs match the cache, left as is] +✔ nx run is-even:build [existing outputs match the cache, left as is] +✔ nx run is-odd:build [existing outputs match the cache, left as is] - ———————————————————————————————————————————————————————————————————————————————————————— +———————————————————————————————————————————————————————————————————————————————————————— - > NX Successfully ran target build for 2 projects (35ms) +NX Successfully ran target build for 2 projects (35ms) - Nx read the output from the cache instead of running the command for 2 out of 2 tasks. +Nx read the output from the cache instead of running the command for 2 out of 2 tasks. ``` Notice that both builds are replayed from cache. We can skip the cache by adding the `--skip-nx-cache` option: ```{% command="npx nx run-many -t build --skip-nx-cache" %} - ✔ nx run is-even:build (1s) - ✔ nx run is-odd:build (1s) +✔ nx run is-even:build (1s) +✔ nx run is-odd:build (1s) - ——————————————————————————————————————————————————————————————————————— +——————————————————————————————————————————————————————————————————————— - > NX Successfully ran target build for 2 projects (2s) +NX Successfully ran target build for 2 projects (2s) ``` Notice that using this method, the `is-even` build ran before the `is-odd` build, and that the `is-even` build only happened once. This demonstrates how `run-many` is informed by the `targetDefaults` we set earlier. @@ -263,17 +263,17 @@ You can also only run tasks on packages that got changed by using the command: ```{% command="npx nx affected -t build" %} - > NX Affected criteria defaulted to --base=main --head=HEAD +NX Affected criteria defaulted to --base=main --head=HEAD - ✔ nx run is-even:build [existing outputs match the cache, left as is] - ✔ nx run is-odd:build [existing outputs match the cache, left as is] +✔ nx run is-even:build [existing outputs match the cache, left as is] +✔ nx run is-odd:build [existing outputs match the cache, left as is] - —————————————————————————————————————————————————————————————————————————————————————————————— +—————————————————————————————————————————————————————————————————————————————————————————————— - > NX Successfully ran target build for 2 projects (34ms) +NX Successfully ran target build for 2 projects (34ms) - Nx read the output from the cache instead of running the command for 2 out of 2 tasks. +Nx read the output from the cache instead of running the command for 2 out of 2 tasks. ``` Notice that the `base` and `head` options were populated with their default values. You could provide your own options here as needed. Notice too that the cache is also used with the `affected` command. diff --git a/docs/shared/packages/remix/remix-plugin.md b/docs/shared/packages/remix/remix-plugin.md index c1d822bb6df3f..fbe2b09502338 100644 --- a/docs/shared/packages/remix/remix-plugin.md +++ b/docs/shared/packages/remix/remix-plugin.md @@ -89,7 +89,7 @@ The command below uses the `as-provided` directory flag behavior, which is the d {% /callout %} ```{% command="nx g @nx/remix:app myapp --directory=apps/myapp" path="~/acme" %} -> NX Generating @nx/remix:application +NX Generating @nx/remix:application ✔ What unit test runner should be used? · vitest @@ -135,9 +135,9 @@ Building Remix app in production mode... Built in 857ms - —————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— +—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— - > NX Successfully ran target build for project myapp (3s) +NX Successfully ran target build for project myapp (3s) ``` 2. To serve your application for use during development run: @@ -155,18 +155,18 @@ Remix App Server started at http://localhost:3000 (http://192.168.0.14:3000) ```{% command="nx test myapp" path="~/acme" %} > nx run myapp:test - RUN v0.31.4 /Users/columferry/dev/nrwl/issues/remixguide/acme/apps/myapp +RUN v0.31.4 /Users/columferry/dev/nrwl/issues/remixguide/acme/apps/myapp stderr | app/routes/index.spec.ts > test > should render Warning: Functions are not valid as a React child. This may happen if you return a Component instead of from render. Or maybe you meant to call this function rather than return it. - ✓ app/routes/index.spec.ts (1 test) 10ms - Test Files 1 passed (1) - Tests 1 passed (1) - Start at 16:15:45 - Duration 1.20s (transform 51ms, setup 139ms, collect 180ms, tests 10ms, environment 379ms, prepare 103ms) +✓ app/routes/index.spec.ts (1 test) 10ms +Test Files 1 passed (1) + Tests 1 passed (1) +Start at 16:15:45 +Duration 1.20s (transform 51ms, setup 139ms, collect 180ms, tests 10ms, environment 379ms, prepare 103ms) - —————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— +—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— - > NX Successfully ran target test for project myapp (2s) +NX Successfully ran target test for project myapp (2s) ``` ## Generating an Nx Library @@ -176,7 +176,7 @@ When developing your application, it often makes sense to split your codebase in To generate a library to use in your Remix application run: ```{% command="nx g @nx/remix:lib login --directory=libs/login" path="~/acme" %} -> NX Generating @nx/remix:library +NX Generating @nx/remix:library ✔ What test runner should be used? · vitest UPDATE nx.json @@ -223,7 +223,7 @@ You can also run test on your library: To generate a route for your application: ```{% command="nx g @nx/remix:route admin --path=apps/myapp/app/routes" path="~/acme" %} -> NX Generating @nx/remix:route +NX Generating @nx/remix:route CREATE apps/myapp/app/routes/admin.tsx CREATE apps/myapp/app/styles/admin.css @@ -236,7 +236,7 @@ To use a Route Loader where the logic lives in your library, follow the steps be 1. Generate a loader for your route: ```{% command="nx g @nx/remix:loader admin --path=apps/myapp/app/routes" path="~/acme" %} -> NX Generating @nx/remix:loader +NX Generating @nx/remix:loader UPDATE apps/myapp/app/routes/admin.tsx ``` diff --git a/docs/shared/react-standalone-tutorial/react-standalone.md b/docs/shared/react-standalone-tutorial/react-standalone.md index f0b2cc09e57eb..3bd22a5e627bd 100644 --- a/docs/shared/react-standalone-tutorial/react-standalone.md +++ b/docs/shared/react-standalone-tutorial/react-standalone.md @@ -209,14 +209,14 @@ More conveniently, we can also run them in parallel using the following syntax: ```{% command="nx run-many -t test lint e2e" path="myreactapp" %} - ✔ nx run e2e:lint (2s) - ✔ nx run myreactapp:lint (2s) - ✔ nx run myreactapp:test (2s) - ✔ nx run e2e:e2e (6s) +✔ nx run e2e:lint (2s) +✔ nx run myreactapp:lint (2s) +✔ nx run myreactapp:test (2s) +✔ nx run e2e:e2e (6s) - —————————————————————————————————————————————————————— +—————————————————————————————————————————————————————— - > NX Successfully ran targets test, lint, e2e for 2 projects (7s) +NX Successfully ran targets test, lint, e2e for 2 projects (7s) ``` ### Caching @@ -227,16 +227,16 @@ Note that all of these targets are automatically cached by Nx. If you re-run a s ```{% command="nx run-many -t test lint e2e" path="myreactapp" %} - ✔ nx run e2e:lint [existing outputs match the cache, left as is] - ✔ nx run myreactapp:lint [existing outputs match the cache, left as is] - ✔ nx run myreactapp:test [existing outputs match the cache, left as is] - ✔ nx run e2e:e2e [existing outputs match the cache, left as is] +✔ nx run e2e:lint [existing outputs match the cache, left as is] +✔ nx run myreactapp:lint [existing outputs match the cache, left as is] +✔ nx run myreactapp:test [existing outputs match the cache, left as is] +✔ nx run e2e:e2e [existing outputs match the cache, left as is] - —————————————————————————————————————————————————————— +—————————————————————————————————————————————————————— - > NX Successfully ran targets test, lint, e2e for 5 projects (54ms) +NX Successfully ran targets test, lint, e2e for 5 projects (54ms) - Nx read the output from the cache instead of running the command for 10 out of 10 tasks. +Nx read the output from the cache instead of running the command for 10 out of 10 tasks. ``` Not all tasks might be cacheable though. You can configure the `cache` properties in the targets under `targetDefaults` in the `nx.json` file. You can also [learn more about how caching works](/features/cache-task-results). @@ -257,7 +257,7 @@ You can just create new React components as you normally would. However, Nx plug ```{% command="npx nx list @nx/react" path="myreactapp" %} - > NX Capabilities in @nx/react: +NX Capabilities in @nx/react: GENERATORS @@ -296,7 +296,7 @@ More info can be found in [the integrate with editors article](/features/integra Run the following command to generate a new "hello-world" component. Note how we append `--dry-run` to first check the output. ```{% command="npx nx g @nx/react:component --directory=src/app/hello-world hello-world --dry-run" path="myreactapp" %} -> NX Generating @nx/react:component +NX Generating @nx/react:component ✔ Should this component be exported in the project? (y/N) · false ✔ Where should the component be generated? · src/app/hello-world/hello-world.tsx @@ -338,9 +338,9 @@ dist/myreactapp/assets/index-e3b0c442.css 0.00 kB │ gzip: 0.02 kB dist/myreactapp/assets/index-378e8124.js 165.64 kB │ gzip: 51.63 kB ✓ built in 496ms - —————————————————————————————————————————————————————————————————————————————————————————————————————————— +—————————————————————————————————————————————————————————————————————————————————————————————————————————— - > NX Successfully ran target build for project reactutorial (1s) +NX Successfully ran target build for project reactutorial (1s) ``` All the required files will be placed in the `dist/myreactapp` folder and can be deployed to your favorite hosting provider. @@ -806,30 +806,30 @@ export default ProductList; If you lint your workspace you'll get an error now: ```{% command="nx run-many -t lint" %} - ✔ nx run myreactapp:lint [existing outputs match the cache, left as is] - ✔ nx run e2e:lint [existing outputs match the cache, left as is] - ✔ nx run ui:lint (1s) +✔ nx run myreactapp:lint [existing outputs match the cache, left as is] +✔ nx run e2e:lint [existing outputs match the cache, left as is] +✔ nx run ui:lint (1s) - ✖ nx run products:lint - Linting "products"... +✖ nx run products:lint + Linting "products"... - /Users/.../myreactapp/modules/products/src/lib/product-list/product-list.tsx - 3:1 error A project tagged with "scope:products" can only depend on libs tagged with "scope:products", "scope:shared" @nx/enforce-module-boundaries + /Users/.../myreactapp/modules/products/src/lib/product-list/product-list.tsx + 3:1 error A project tagged with "scope:products" can only depend on libs tagged with "scope:products", "scope:shared" @nx/enforce-module-boundaries - ✖ 1 problem (1 error, 0 warnings) + ✖ 1 problem (1 error, 0 warnings) - Lint errors found in the listed files. + Lint errors found in the listed files. - ✔ nx run orders:lint (1s) +✔ nx run orders:lint (1s) - ———————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— +———————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— - > NX Ran target lint for 5 projects (1s) +NX Ran target lint for 5 projects (1s) - ✔ 4/5 succeeded [2 read from cache] +✔ 4/5 succeeded [2 read from cache] - ✖ 1/5 targets failed, including the following: - - nx run products:lint +✖ 1/5 targets failed, including the following: + - nx run products:lint ``` If you have the ESLint plugin installed in your IDE you should immediately see an error: diff --git a/docs/shared/react-tutorial/react-monorepo.md b/docs/shared/react-tutorial/react-monorepo.md index 35791c2bd2405..e0b8e38310b88 100644 --- a/docs/shared/react-tutorial/react-monorepo.md +++ b/docs/shared/react-tutorial/react-monorepo.md @@ -54,7 +54,7 @@ title="Tutorial: Standalone React Application" Create a new React monorepo with the following command: ```{% command="npx create-nx-workspace@latest react-monorepo --preset=react-monorepo" path="~" %} - > NX Let's create a new workspace [https://nx.dev/getting-started/intro] +NX Let's create a new workspace [https://nx.dev/getting-started/intro] ✔ Application name · react-store ✔ Which bundler would you like to use? · vite @@ -234,7 +234,7 @@ Nx plugins usually provide [generators](/features/generate-code) that allow you ```{% command="npx nx list @nx/react" path="react-monorepo" %} - > NX Capabilities in @nx/react: +NX Capabilities in @nx/react: GENERATORS @@ -273,7 +273,7 @@ More info can be found in [the integrate with editors article](/features/integra Run the following command to generate a new `inventory` application. Note how we append `--dry-run` to first check the output. ```{% command="npx nx g @nx/react:app inventory --directory=apps/inventory --dry-run" path="react-monorepo" %} -> NX Generating @nx/react:application +NX Generating @nx/react:application ✔ Would you like to add React Router to this application? (y/N) · false ✔ Which E2E test runner would you like to use? · cypress @@ -704,17 +704,16 @@ One thing to highlight is that Nx is able to [cache the tasks you run](/features Note that all of these targets are automatically cached by Nx. If you re-run a single one or all of them again, you'll see that the task completes immediately. In addition, (as can be seen in the output example below) there will be a note that a matching cache result was found and therefore the task was not run again. ```{% command="nx run-many -t test lint e2e" path="react-monorepo" %} +✔ nx run e2e:lint [existing outputs match the cache, left as is] +✔ nx run react-store:lint [existing outputs match the cache, left as is] +✔ nx run react-store:test [existing outputs match the cache, left as is] +✔ nx run e2e:e2e [existing outputs match the cache, left as is] - ✔ nx run e2e:lint [existing outputs match the cache, left as is] - ✔ nx run react-store:lint [existing outputs match the cache, left as is] - ✔ nx run react-store:test [existing outputs match the cache, left as is] - ✔ nx run e2e:e2e [existing outputs match the cache, left as is] +—————————————————————————————————————————————————————— - —————————————————————————————————————————————————————— +NX Successfully ran targets test, lint, e2e for 5 projects (54ms) - > NX Successfully ran targets test, lint, e2e for 5 projects (54ms) - - Nx read the output from the cache instead of running the command for 10 out of 10 tasks. +Nx read the output from the cache instead of running the command for 10 out of 10 tasks. ``` Not all tasks might be cacheable though. You can configure the `cache` settings in the `targetDefaults` property of the `nx.json` file. You can also [learn more about how caching works](/features/cache-task-results). @@ -861,7 +860,6 @@ nx graph --affected If you're ready and want to ship your applications, you can build them using ```{% command="npx nx run-many -t build" path="react-monorepo" %} -// todo vite v4.3.5 building for production... ✓ 33 libs transformed. dist/react-store/index.html 0.48 kB │ gzip: 0.30 kB @@ -869,9 +867,9 @@ dist/react-store/assets/index-e3b0c442.css 0.00 kB │ gzip: 0.02 kB dist/react-store/assets/index-378e8124.js 165.64 kB │ gzip: 51.63 kB ✓ built in 496ms - —————————————————————————————————————————————————————————————————————————————————————————————————————————— +—————————————————————————————————————————————————————————————————————————————————————————————————————————— - > NX Successfully ran target build for project reactutorial (1s) +NX Successfully ran target build for project reactutorial (1s) ``` All the required files will be placed in `dist/react-store` and `dist/inventory` and can be deployed to your favorite hosting provider. @@ -1029,36 +1027,36 @@ export default ProductList; If you lint your workspace you'll get an error now: ```{% command="nx run-many -t lint" %} -> NX Running target lint for 7 projects - ✖ nx run products:lint - Linting "products"... + Running target lint for 7 projects +✖ nx run products:lint + Linting "products"... - /Users/isaac/Documents/code/nx-recipes/react-monorepo/libs/products/src/lib/product-list/product-list.tsx - 4:1 error A project tagged with "scope:products" can only depend on libs tagged with "scope:products", "scope:shared" @nx/enforce-module-boundaries - 4:10 warning 'OrderList' is defined but never used @typescript-eslint/no-unused-vars + /Users/isaac/Documents/code/nx-recipes/react-monorepo/libs/products/src/lib/product-list/product-list.tsx + 4:1 error A project tagged with "scope:products" can only depend on libs tagged with "scope:products", "scope:shared" @nx/enforce-module-boundaries + 4:10 warning 'OrderList' is defined but never used @typescript-eslint/no-unused-vars - ✖ 2 problems (1 error, 1 warning) + ✖ 2 problems (1 error, 1 warning) - Lint warnings found in the listed files. + Lint warnings found in the listed files. - Lint errors found in the listed files. + Lint errors found in the listed files. - ✔ nx run orders:lint (996ms) - ✔ nx run react-store:lint (1s) - ✔ nx run react-store-e2e:lint (581ms) - ✔ nx run inventory-e2e:lint (588ms) - ✔ nx run inventory:lint (836ms) - ✔ nx run shared-ui:lint (753ms) +✔ nx run orders:lint (996ms) +✔ nx run react-store:lint (1s) +✔ nx run react-store-e2e:lint (581ms) +✔ nx run inventory-e2e:lint (588ms) +✔ nx run inventory:lint (836ms) +✔ nx run shared-ui:lint (753ms) - ———————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— +———————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— - > NX Ran target lint for 7 projects (2s) +NX Ran target lint for 7 projects (2s) - ✔ 6/7 succeeded [0 read from cache] +✔ 6/7 succeeded [0 read from cache] - ✖ 1/7 targets failed, including the following: - - nx run products:lint +✖ 1/7 targets failed, including the following: + - nx run products:lint ``` If you have the ESLint plugin installed in your IDE you should immediately see an error: diff --git a/docs/shared/recipes/add-stack/add-astro.md b/docs/shared/recipes/add-stack/add-astro.md index 4952fc7498937..a61f0086165fb 100644 --- a/docs/shared/recipes/add-stack/add-astro.md +++ b/docs/shared/recipes/add-stack/add-astro.md @@ -30,22 +30,22 @@ npm create astro@latest We can leverage [`nx init`](/recipes/adopting-nx/adding-to-existing-project#installing-nx-on-a-non-monorepo-project) to add Nx to the Astro application. ```{% command="npx nx@latest init" path="~/astro-app"%} - > NX 🐳 Nx initialization +NX 🐳 Nx initialization - > NX 🧑‍🔧 Please answer the following questions about the scripts found in your package.json in order to generate task runner configuration +NX 🧑‍🔧 Please answer the following questions about the scripts found in your package.json in order to generate task runner configuration ✔ Which of the following scripts are cacheable? (Produce the same output given the same input, e.g. build, test and lint usually are, serve and start are not). You can use spacebar to select one or more scripts. · build ✔ Would you like remote caching to make your build faster? · Yes - > NX 📦 Installing dependencies +NX 📦 Installing dependencies - > NX 🎉 Done! +NX 🎉 Done! - - Enabled computation caching! - - Learn more at https://nx.dev/recipes/adopting-nx/adding-to-existing-project. +- Enabled computation caching! +- Learn more at https://nx.dev/recipes/adopting-nx/adding-to-existing-project. ``` You can add a task as cacheable after the fact by updating the `cacheableOperations` in the `nx.json` file. Learn more about [caching task results](/recipes/adopting-nx/adding-to-existing-project#installing-nx-on-a-non-monorepo-project) or [how caching works](/features/cache-task-results). @@ -93,7 +93,7 @@ The command below uses the `as-provided` directory flag behavior, which is the d {% /callout %} ```{% command="nx g @nx/js:lib ui --directory=libs/ui --simpleName --minimal" path="~/astro-app"} -> NX Generating @nx/js:library +NX Generating @nx/js:library ✔ Which unit test runner would you like to use? · none ✔ Which bundler would you like to use to build the library? Choose 'none' to skip build setup. · none diff --git a/docs/shared/recipes/advanced-update.md b/docs/shared/recipes/advanced-update.md index 47084cdfac298..1e0613a1d606d 100644 --- a/docs/shared/recipes/advanced-update.md +++ b/docs/shared/recipes/advanced-update.md @@ -163,19 +163,19 @@ It may take a few minutes. ✔ Do you want to update to TypeScript v5.0? (Y/n) · false ✔ Do you want to update the Angular version to v16? (Y/n) · false - > NX The migrate command has run successfully. +NX The migrate command has run successfully. - - package.json has been updated. - - migrations.json has been generated. + - package.json has been updated. + - migrations.json has been generated. - > NX Next steps: +NX Next steps: - - Make sure package.json changes make sense and then run 'pnpm install --no-frozen-lockfile', - - Run 'pnpm exec nx migrate --run-migrations' - - You opted out of some migrations for now. Write the following command down somewhere to apply these migrations later: - nx migrate 16.5.3 --from nx@16.1.0-beta.0 --exclude-applied-migrations - - To learn more go to https://nx.dev/recipes/other/advanced-update - - You may run 'pnpm run nx connect-to-nx-cloud' to get faster builds, GitHub integration, and more. Check out https://nx.app + - Make sure package.json changes make sense and then run 'pnpm install --no-frozen-lockfile', + - Run 'pnpm exec nx migrate --run-migrations' + - You opted out of some migrations for now. Write the following command down somewhere to apply these migrations later: + nx migrate 16.5.3 --from nx@16.1.0-beta.0 --exclude-applied-migrations + - To learn more go to https://nx.dev/recipes/other/advanced-update + - You may run 'pnpm run nx connect-to-nx-cloud' to get faster builds, GitHub integration, and more. Check out https://nx.app ``` You can see in the "Next steps" section a suggested command to run to apply the skipped package updates. Make sure to store that information somewhere so you can later remember from which version you need to run the migration to apply the skipped package updates. diff --git a/docs/shared/recipes/module-federation-with-ssr.md b/docs/shared/recipes/module-federation-with-ssr.md index 5815b77238f3c..f37b75abd05f2 100644 --- a/docs/shared/recipes/module-federation-with-ssr.md +++ b/docs/shared/recipes/module-federation-with-ssr.md @@ -10,7 +10,7 @@ Run the following command with the options listed to create an empty workspace. ```{% command="npx create-nx-workspace@latest" path="~" %} - > NX Let's create a new workspace [https://nx.dev/getting-started/intro] +NX Let's create a new workspace [https://nx.dev/getting-started/intro] ✔ Where would you like to create your workspace? · myorg ✔ Which stack do you want to use? · none diff --git a/docs/shared/recipes/module-federation/creating-a-host.md b/docs/shared/recipes/module-federation/creating-a-host.md index 99b04faee0bb3..f861639842ac2 100644 --- a/docs/shared/recipes/module-federation/creating-a-host.md +++ b/docs/shared/recipes/module-federation/creating-a-host.md @@ -20,7 +20,7 @@ To generate just a host application in your workspace, run the following command {% tab label="React" %} ```{% command="nx g @nx/react:host shell --directory=apps/react/shell" %} -> NX Generating @nx/react:host +NX Generating @nx/react:host CREATE apps/react/shell/src/app/app.spec.tsx CREATE apps/react/shell/src/assets/.gitkeep @@ -50,7 +50,7 @@ CREATE apps/react/shell/webpack.config.prod.ts {% tab label="Angular" %} ```{% command="nx g @nx/angular:host shell --directory=apps/angular/shell" %} -> NX Generating @nx/angular:host +NX Generating @nx/angular:host CREATE apps/angular/shell/project.json CREATE apps/angular/shell/src/assets/.gitkeep @@ -88,7 +88,7 @@ To scaffold a host application along with remote applications in your workspace, {% tab label="React" %} ```{% command="nx g @nx/react:host shell-with-remotes --directory=apps/react/with-remotes/shell --remotes=remote1,remote2" %} -> NX Generating @nx/react:host +NX Generating @nx/react:host CREATE apps/react/with-remotes/shell/src/app/app.spec.tsx CREATE apps/react/with-remotes/shell/src/assets/.gitkeep diff --git a/docs/shared/recipes/module-federation/creating-a-remote.md b/docs/shared/recipes/module-federation/creating-a-remote.md index d2d2ff2c2bae9..60f4c334bbce3 100644 --- a/docs/shared/recipes/module-federation/creating-a-remote.md +++ b/docs/shared/recipes/module-federation/creating-a-remote.md @@ -18,7 +18,7 @@ To generate a remote application in your workspace, run the following command: {% tab label="React" %} ```{% command="nx g @nx/react:remote myremote --directory=apps/react/myremote" %} -> NX Generating @nx/react:remote +NX Generating @nx/react:remote CREATE apps/react/myremote/src/app/app.spec.tsx CREATE apps/react/myremote/src/assets/.gitkeep @@ -50,7 +50,7 @@ UPDATE tsconfig.base.json {% tab label="Angular" %} ```{% command="nx g @nx/angular:remote myremote --directory=apps/angular/myremote" %} -> NX Generating @nx/angular:host +NX Generating @nx/angular:host CREATE apps/angular/myremote/project.json CREATE apps/angular/myremote/src/assets/.gitkeep @@ -126,7 +126,7 @@ The command would look like the following: {% tab label="React" %} ```{% command="nx g @nx/react:remote myremote --directory=apps/react/myremote --host=shell" %} -> NX Generating @nx/react:remote +NX Generating @nx/react:remote CREATE apps/react/myremote/src/app/app.spec.tsx CREATE apps/react/myremote/src/assets/.gitkeep diff --git a/docs/shared/recipes/nx-release/automatically-version-with-conventional-commits.md b/docs/shared/recipes/nx-release/automatically-version-with-conventional-commits.md index e2ccee3f9175b..8c0205343a54d 100644 --- a/docs/shared/recipes/nx-release/automatically-version-with-conventional-commits.md +++ b/docs/shared/recipes/nx-release/automatically-version-with-conventional-commits.md @@ -59,14 +59,14 @@ An example partial output of running Nx Release with independent releases and co ```{% command="nx release" %} - > NX Running release version for project: pkg-1 +NX Running release version for project: pkg-1 pkg-1 🔍 Reading data for package "@myorg/pkg-1" from packages/pkg-1/package.json pkg-1 📄 Resolved the current version as 0.4.0 from git tag "pkg-1@0.4.0". pkg-1 📄 Resolved the specifier as "minor" using git history and the conventional commits standard. pkg-1 ✍️ New version 0.5.0 written to packages/pkg-1/package.json - > NX Running release version for project: pkg-2 +NX Running release version for project: pkg-2 pkg-2 🔍 Reading data for package "@myorg/pkg-2" from packages/pkg-2/package.json pkg-2 📄 Resolved the current version as 0.4.0 from git tag "pkg-2@0.4.0". @@ -74,7 +74,7 @@ pkg-2 📄 Resolved the specifier as "patch" using git history and the conventio pkg-2 ✍️ New version 0.4.1 written to packages/pkg-2/package.json pkg-2 ✍️ Applying new version 0.4.1 to 1 package which depends on pkg-2 - > NX Running release version for project: pkg-3 +NX Running release version for project: pkg-3 pkg-3 🔍 Reading data for package "@myorg/pkg-3" from packages/pkg-3/package.json pkg-3 📄 Resolved the current version as 0.4.0 from git tag "pkg-3@0.4.0". diff --git a/docs/shared/recipes/nx-release/get-started-with-nx-release.md b/docs/shared/recipes/nx-release/get-started-with-nx-release.md index 5fd8c5c7dde38..a9f16e7f2bf5c 100644 --- a/docs/shared/recipes/nx-release/get-started-with-nx-release.md +++ b/docs/shared/recipes/nx-release/get-started-with-nx-release.md @@ -56,7 +56,7 @@ Nx Release will prompt you to pick a version bump for all the packages in the re ```{% command="nx release --first-release --dry-run" %} - > NX Running release version for project: pkg-1 +NX Running release version for project: pkg-1 pkg-1 🔍 Reading data for package "@myorg/pkg-1" from packages/pkg-1/package.json pkg-1 📄 Resolved the current version as 0.0.1 from packages/pkg-1/package.json @@ -77,21 +77,21 @@ After this prompt, the command will finish, showing you the preview of changes t ```{% command="nx release --first-release --dry-run" %} - > NX Running release version for project: pkg-1 +NX Running release version for project: pkg-1 pkg-1 🔍 Reading data for package "@myorg/pkg-1" from packages/pkg-1/package.json pkg-1 📄 Resolved the current version as 0.0.1 from packages/pkg-1/package.json ✔ What kind of change is this for the 3 matched projects(s)? · patch pkg-1 ✍️ New version 0.0.2 written to packages/pkg-1/package.json - > NX Running release version for project: pkg-2 +NX Running release version for project: pkg-2 pkg-2 🔍 Reading data for package "@myorg/pkg-2" from packages/pkg-2/package.json pkg-2 📄 Resolved the current version as 0.0.1 from packages/pkg-2/package.json pkg-2 ✍️ New version 0.0.2 written to packages/pkg-2/package.json pkg-2 ✍️ Applying new version 0.0.2 to 1 package which depends on pkg-2 - > NX Running release version for project: pkg-3 +NX Running release version for project: pkg-3 pkg-3 🔍 Reading data for package "@myorg/pkg-3" from packages/pkg-3/package.json pkg-3 📄 Resolved the current version as 0.0.1 from packages/pkg-3/package.json @@ -108,14 +108,14 @@ UPDATE packages/pkg-1/package.json [dry-run] + "@myorg/pkg-2": "0.0.2" }, -UPDATE packages/pkg-2/package.json [dry-run] + UPDATE packages/pkg-2/package.json [dry-run] "name": "@myorg/pkg-2", - "version": "0.0.1", + "version": "0.0.2", "dependencies": { -UPDATE packages/pkg-3/package.json [dry-run] + UPDATE packages/pkg-3/package.json [dry-run] "name": "@myorg/pkg-3", - "version": "0.0.1", @@ -123,15 +123,15 @@ UPDATE packages/pkg-3/package.json [dry-run] "dependencies": { - > NX Updating npm lock file +NX Updating npm lock file - > NX Staging changed files with git +NX Staging changed files with git NOTE: The "dryRun" flag means no changes were made. - > NX Previewing an entry in CHANGELOG.md for v0.0.2 +NX Previewing an entry in CHANGELOG.md for v0.0.2 CREATE CHANGELOG.md [dry-run] @@ -139,15 +139,15 @@ CREATE CHANGELOG.md [dry-run] + + This was a version bump only, there were no code changes. - > NX Staging changed files with git +NX Staging changed files with git NOTE: The "dryRun" flag means no changelogs were actually created. - > NX Committing changes with git +NX Committing changes with git - > NX Tagging commit with git +NX Tagging commit with git Skipped publishing packages. ``` @@ -167,13 +167,13 @@ The command will proceed as before, prompting for a version bump and showing a p ✔ Do you want to publish these versions? (y/N) · true - > NX Running target nx-release-publish for 3 projects: +NX Running target nx-release-publish for 3 projects: - - pkg-1 - - pkg-2 - - pkg-3 +- pkg-1 +- pkg-2 +- pkg-3 - ————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— +————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— > nx run pkg-1:nx-release-publish @@ -241,9 +241,9 @@ total files: 12 Published to https://registry.npmjs.org with tag "latest" - ————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— +————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— - > NX Successfully ran target nx-release-publish for 3 projects +NX Successfully ran target nx-release-publish for 3 projects ``` diff --git a/docs/shared/recipes/nx-release/publish-in-ci-cd.md b/docs/shared/recipes/nx-release/publish-in-ci-cd.md index 9658569ba172b..3e25a4ec8a57e 100644 --- a/docs/shared/recipes/nx-release/publish-in-ci-cd.md +++ b/docs/shared/recipes/nx-release/publish-in-ci-cd.md @@ -24,13 +24,13 @@ Skipped publishing packages. Nx Release provides a publishing subcommand that performs just the publishing step. Use this in your CI/CD pipeline to publish the packages. ```{% command="nx release publish" %} - > NX Running target nx-release-publish for 3 projects: +NX Running target nx-release-publish for 3 projects: - - pkg-1 - - pkg-2 - - pkg-3 +- pkg-1 +- pkg-2 +- pkg-3 - ————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— +————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— > nx run pkg-1:nx-release-publish @@ -98,9 +98,9 @@ total files: 12 Published to https://registry.npmjs.org with tag "latest" - ————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— +————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— - > NX Successfully ran target nx-release-publish for 3 projects +NX Successfully ran target nx-release-publish for 3 projects ``` ## Publish in Github Actions diff --git a/docs/shared/recipes/running-tasks/root-level-scripts.md b/docs/shared/recipes/running-tasks/root-level-scripts.md index fb998242a0a30..1712891297d25 100644 --- a/docs/shared/recipes/running-tasks/root-level-scripts.md +++ b/docs/shared/recipes/running-tasks/root-level-scripts.md @@ -47,9 +47,9 @@ yarn run v1.22.19 $ node ./generateDocsSite.js Documentation site generated in /docs - ———————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— +———————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— - > NX Successfully ran target docs for project myorg (5s) +NX Successfully ran target docs for project myorg (5s) ``` ## Configuring a Root-Level Target @@ -89,11 +89,11 @@ yarn run v1.22.19 $ node ./generateDocsSite.js Documentation site generated in /docs - ———————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— +———————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— - > NX Successfully ran target docs for project myorg (31ms) +NX Successfully ran target docs for project myorg (31ms) - Nx read the output from the cache instead of running the command for 1 out of 1 tasks. +Nx read the output from the cache instead of running the command for 1 out of 1 tasks. ``` Read more about [cacheableOperations](/features/cache-task-results) and fine-tuning caching with [task inputs](/recipes/running-tasks/configure-inputs). diff --git a/docs/shared/vue-standalone-tutorial/vue-standalone.md b/docs/shared/vue-standalone-tutorial/vue-standalone.md index 950a414ae787f..eaa19a2cb9c5c 100644 --- a/docs/shared/vue-standalone-tutorial/vue-standalone.md +++ b/docs/shared/vue-standalone-tutorial/vue-standalone.md @@ -26,16 +26,16 @@ Here's the source code of the final result for this tutorial. Create a new Vue application with the following command: ```{% command="npx create-nx-workspace@latest myvueapp --preset=vue-standalone" path="~" %} - > NX Let's create a new workspace [https://nx.dev/getting-started/intro] +NX Let's create a new workspace [https://nx.dev/getting-started/intro] ✔ Test runner to use for end to end (E2E) tests · cypress ✔ Default stylesheet format · css ✔ Set up CI with caching, distribution and test deflaking · github - > NX Creating your v17.0.0 workspace. +NX Creating your v17.0.0 workspace. - To make sure the command works reliably in all environments, and that the preset is applied correctly, - Nx will run "npm install" several times. Please wait. +To make sure the command works reliably in all environments, and that the preset is applied correctly, +Nx will run "npm install" several times. Please wait. ``` You can also choose [Playwright](/nx-api/playwright) for your e2e tests or a different stylesheet format. In this tutorial we're going to use Cypress and css. The above command generates the following structure: @@ -215,14 +215,14 @@ More conveniently, we can also run them in parallel using the following syntax: ```{% command="nx run-many -t test lint e2e" path="myvueapp" %} - ✔ nx run e2e:lint (1s) - ✔ nx run myvueapp:lint (1s) - ✔ nx run myvueapp:test (2s) - ✔ nx run e2e:e2e (6s) +✔ nx run e2e:lint (1s) +✔ nx run myvueapp:lint (1s) +✔ nx run myvueapp:test (2s) +✔ nx run e2e:e2e (6s) - —————————————————————————————————————————————————————— +—————————————————————————————————————————————————————— - > NX Successfully ran targets test, lint, e2e for 2 projects (8s) +NX Successfully ran targets test, lint, e2e for 2 projects (8s) ``` ### Caching @@ -235,16 +235,16 @@ Note that all of these targets are automatically cached by Nx. If you re-run a s ```{% command="nx run-many -t test lint e2e" path="myvueapp" %} - ✔ nx run myvueapp:lint [existing outputs match the cache, left as is] - ✔ nx run e2e:lint [existing outputs match the cache, left as is] - ✔ nx run myvueapp:test [existing outputs match the cache, left as is] - ✔ nx run e2e:e2e [existing outputs match the cache, left as is] +✔ nx run myvueapp:lint [existing outputs match the cache, left as is] +✔ nx run e2e:lint [existing outputs match the cache, left as is] +✔ nx run myvueapp:test [existing outputs match the cache, left as is] +✔ nx run e2e:e2e [existing outputs match the cache, left as is] - ——————————————————————————————————————————————————————— +——————————————————————————————————————————————————————— - > NX Successfully ran targets test, lint, e2e for 2 projects (143ms) +NX Successfully ran targets test, lint, e2e for 2 projects (143ms) - Nx read the output from the cache instead of running the command for 4 out of 4 tasks. +Nx read the output from the cache instead of running the command for 4 out of 4 tasks. ``` Not all tasks might be cacheable though. You can mark all targets of a certain type as cacheable by setting `cache` to `true` in the `targetDefaults` of the `nx.json` file. You can also [learn more about how caching works](/features/cache-task-results). @@ -269,7 +269,7 @@ You can just create new Vue components as you normally would. However, Nx plugin ```{% command="npx nx list @nx/vue" path="myvueapp" %} -> NX Capabilities in @nx/vue: +NX Capabilities in @nx/vue: GENERATORS @@ -293,7 +293,7 @@ More info can be found in [the integrate with editors article](/features/integra Run the following command to generate a new "hello-world" component. Note how we append `--dry-run` to first check the output. ```{% command="npx nx g @nx/vue:component hello-world --no-export --unit-test-runner=vitest --directory=src/components --dry-run" path="myvueapp" %} -> NX Generating @nx/vue:component +NX Generating @nx/vue:component CREATE src/components/hello-world.spec.ts CREATE src/components/hello-world.vue @@ -324,16 +324,16 @@ If you're ready and want to ship your application, you can build it using ```{% command="npx nx build" path="myvueapp" %} > nx run myvueapp:build:production -vite v4.3.9 building for production... -✓ 15 modules transformed. -dist/myvueapp/index.html 0.43 kB │ gzip: 0.29 kB -dist/myvueapp/assets/index-a0201bbf.css 7.90 kB │ gzip: 1.78 kB -dist/myvueapp/assets/index-46a11b5f.js 62.39 kB │ gzip: 24.35 kB -✓ built in 502ms + vite v4.3.9 building for production... + ✓ 15 modules transformed. + dist/myvueapp/index.html 0.43 kB │ gzip: 0.29 kB + dist/myvueapp/assets/index-a0201bbf.css 7.90 kB │ gzip: 1.78 kB + dist/myvueapp/assets/index-46a11b5f.js 62.39 kB │ gzip: 24.35 kB + ✓ built in 502ms - ————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— +————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— - > NX Successfully ran target build for project myvueapp (957ms) +NX Successfully ran target build for project myvueapp (957ms) ``` All the required files will be placed in the `dist/myvueapp` folder and can be deployed to your favorite hosting provider. @@ -827,34 +827,34 @@ import { Orders } from 'orders'; If you lint your workspace you'll get an error now: ```{% command="nx run-many -t lint" %} - > NX Running target lint for 5 projects - ✖ nx run products:lint - Linting "products"... +NX Running target lint for 5 projects +✖ nx run products:lint + Linting "products"... - /Users/isaac/Documents/code/nx-recipes/vue-standalone/modules/products/src/lib/products.vue - 5:1 error A project tagged with "scope:products" can only depend on libs tagged with "scope:products", "scope:shared" @nx/enforce-module-boundaries - 5:10 warning 'Orders' is defined but never used @typescript-eslint/no-unused-vars + /Users/isaac/Documents/code/nx-recipes/vue-standalone/modules/products/src/lib/products.vue + 5:1 error A project tagged with "scope:products" can only depend on libs tagged with "scope:products", "scope:shared" @nx/enforce-module-boundaries + 5:10 warning 'Orders' is defined but never used @typescript-eslint/no-unused-vars - ✖ 2 problems (1 error, 1 warning) + ✖ 2 problems (1 error, 1 warning) - Lint warnings found in the listed files. + Lint warnings found in the listed files. - Lint errors found in the listed files. + Lint errors found in the listed files. - ✔ nx run orders:lint (913ms) - ✔ nx run e2e:lint [existing outputs match the cache, left as is] - ✔ nx run myvueapp:lint (870ms) - ✔ nx run shared-ui:lint (688ms) +✔ nx run orders:lint (913ms) +✔ nx run e2e:lint [existing outputs match the cache, left as is] +✔ nx run myvueapp:lint (870ms) +✔ nx run shared-ui:lint (688ms) - —————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— +—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— - > NX Ran target lint for 5 projects (2s) +NX Ran target lint for 5 projects (2s) - ✔ 4/5 succeeded [1 read from cache] +✔ 4/5 succeeded [1 read from cache] - ✖ 1/5 targets failed, including the following: - - nx run products:lint +✖ 1/5 targets failed, including the following: + - nx run products:lint ``` diff --git a/e2e/lerna-smoke-tests/src/lerna-smoke-tests.test.ts b/e2e/lerna-smoke-tests/src/lerna-smoke-tests.test.ts index db4d11cadf9ad..878276ac696f6 100644 --- a/e2e/lerna-smoke-tests/src/lerna-smoke-tests.test.ts +++ b/e2e/lerna-smoke-tests/src/lerna-smoke-tests.test.ts @@ -42,7 +42,7 @@ describe('Lerna Smoke Tests', () => { result = result.replace(/.*\/node_modules\/.*\n/, ''); // yarn adds "$ /node_modules/.bin/lerna repair" to the output expect(result).toMatchInlineSnapshot(` - > Lerna No changes were necessary. This workspace is up to date! + Lerna No changes were necessary. This workspace is up to date! `); @@ -75,7 +75,7 @@ describe('Lerna Smoke Tests', () => { - > Lerna (powered by Nx) Successfully ran target print-name for project package-1 + Lerna (powered by Nx) Successfully ran target print-name for project package-1 diff --git a/e2e/release/src/independent-projects.test.ts b/e2e/release/src/independent-projects.test.ts index 8779ac3010ef7..3f980b23fc38b 100644 --- a/e2e/release/src/independent-projects.test.ts +++ b/e2e/release/src/independent-projects.test.ts @@ -120,12 +120,12 @@ describe('nx release - independent projects', () => { ); expect(versionPkg1Output).toMatchInlineSnapshot(` - > NX Your filter "{project-name}" matched the following projects: + NX Your filter "{project-name}" matched the following projects: - {project-name} - > NX Running release version for project: {project-name} + NX Running release version for project: {project-name} {project-name} 🔍 Reading data for package "@proj/{project-name}" from {project-name}/package.json {project-name} 📄 Resolved the current version as 0.0.0 from {project-name}/package.json @@ -139,10 +139,10 @@ describe('nx release - independent projects', () => { "scripts": { - > NX Updating {package-manager} lock file + NX Updating {package-manager} lock file - > NX Staging changed files with git + NX Staging changed files with git `); @@ -152,12 +152,12 @@ describe('nx release - independent projects', () => { ); expect(versionPkg2Output).toMatchInlineSnapshot(` - > NX Your filter "{project-name}" matched the following projects: + NX Your filter "{project-name}" matched the following projects: - {project-name} - > NX Running release version for project: {project-name} + NX Running release version for project: {project-name} {project-name} 🔍 Reading data for package "@proj/{project-name}" from {project-name}/package.json {project-name} 📄 Resolved the current version as 0.0.0 from {project-name}/package.json @@ -174,10 +174,10 @@ describe('nx release - independent projects', () => { + - > NX Updating {package-manager} lock file + NX Updating {package-manager} lock file - > NX Staging changed files with git + NX Staging changed files with git `); @@ -187,12 +187,12 @@ describe('nx release - independent projects', () => { ); expect(versionPkg3Output).toMatchInlineSnapshot(` - > NX Your filter "{project-name}" matched the following projects: + NX Your filter "{project-name}" matched the following projects: - {project-name} - > NX Running release version for project: {project-name} + NX Running release version for project: {project-name} {project-name} 🔍 Reading data for package "@proj/{project-name}" from {project-name}/package.json {project-name} 📄 Resolved the current version as 0.0.0 from {project-name}/package.json @@ -213,10 +213,10 @@ describe('nx release - independent projects', () => { } - > NX Updating {package-manager} lock file + NX Updating {package-manager} lock file - > NX Staging changed files with git + NX Staging changed files with git `); @@ -236,12 +236,12 @@ describe('nx release - independent projects', () => { ); expect(versionWithGitActionsCLIOutput).toMatchInlineSnapshot(` - > NX Your filter "{project-name}" matched the following projects: + NX Your filter "{project-name}" matched the following projects: - {project-name} - > NX Running release version for project: {project-name} + NX Running release version for project: {project-name} {project-name} 🔍 Reading data for package "@proj/{project-name}" from {project-name}/package.json {project-name} 📄 Resolved the current version as 999.9.9-version-git-operations-test.1 from {project-name}/package.json @@ -255,12 +255,12 @@ describe('nx release - independent projects', () => { "scripts": { - > NX Updating {package-manager} lock file + NX Updating {package-manager} lock file Updating {lock-file} with the following command: {lock-file-command} - > NX Committing changes with git + NX Committing changes with git Staging files in git with the following command: git add {project-name}/package.json {lock-file} @@ -268,7 +268,7 @@ describe('nx release - independent projects', () => { Committing files in git with the following command: git commit --message chore(release): publish --message - project: {project-name} 999.9.9-version-git-operations-test.2 - > NX Tagging commit with git + NX Tagging commit with git Tagging the current commit in git with the following command: git tag --annotate {project-name}@999.9.9-version-git-operations-test.2 --message {project-name}@999.9.9-version-git-operations-test.2 @@ -323,21 +323,21 @@ describe('nx release - independent projects', () => { ); expect(versionWithGitActionsConfigOutput).toMatchInlineSnapshot(` - > NX Running release version for project: {project-name} + NX Running release version for project: {project-name} {project-name} 🔍 Reading data for package "@proj/{project-name}" from {project-name}/package.json {project-name} 📄 Resolved the current version as 999.9.9-version-git-operations-test.2 from {project-name}/package.json {project-name} 📄 Using the provided version specifier "999.9.9-version-git-operations-test.3". {project-name} ✍️ New version 999.9.9-version-git-operations-test.3 written to {project-name}/package.json - > NX Running release version for project: {project-name} + NX Running release version for project: {project-name} {project-name} 🔍 Reading data for package "@proj/{project-name}" from {project-name}/package.json {project-name} 📄 Resolved the current version as 999.9.9-package.2 from {project-name}/package.json {project-name} 📄 Using the provided version specifier "999.9.9-version-git-operations-test.3". {project-name} ✍️ New version 999.9.9-version-git-operations-test.3 written to {project-name}/package.json - > NX Running release version for project: {project-name} + NX Running release version for project: {project-name} {project-name} 🔍 Reading data for package "@proj/{project-name}" from {project-name}/package.json {project-name} 📄 Resolved the current version as 999.9.9-package.3 from {project-name}/package.json @@ -363,17 +363,17 @@ describe('nx release - independent projects', () => { "scripts": { - > NX Updating {package-manager} lock file + NX Updating {package-manager} lock file Updating {lock-file} with the following command: {lock-file-command} - > NX Updating {package-manager} lock file + NX Updating {package-manager} lock file Updating {lock-file} with the following command: {lock-file-command} - > NX Committing changes with git + NX Committing changes with git Staging files in git with the following command: git add {project-name}/package.json {project-name}/package.json {project-name}/package.json {lock-file} @@ -381,7 +381,7 @@ describe('nx release - independent projects', () => { Committing files in git with the following command: git commit --message chore(release): publish --message - project: {project-name} 999.9.9-version-git-operations-test.3 --message - project: {project-name} 999.9.9-version-git-operations-test.3 --message - release-group: fixed 999.9.9-version-git-operations-test.3 - > NX Tagging commit with git + NX Tagging commit with git Tagging the current commit in git with the following command: git tag --annotate {project-name}@999.9.9-version-git-operations-test.3 --message {project-name}@999.9.9-version-git-operations-test.3 @@ -437,12 +437,12 @@ describe('nx release - independent projects', () => { ); expect(changelogPkg1Output).toMatchInlineSnapshot(` - > NX Your filter "{project-name}" matched the following projects: + NX Your filter "{project-name}" matched the following projects: - {project-name} - > NX Previewing an entry in {project-name}/CHANGELOG.md for {project-name}@999.9.9-package.1 + NX Previewing an entry in {project-name}/CHANGELOG.md for {project-name}@999.9.9-package.1 + ## 999.9.9-package.1 (YYYY-MM-DD) @@ -450,10 +450,10 @@ describe('nx release - independent projects', () => { + This was a version bump only for {project-name} to align it with other projects, there were no code changes. - > NX Committing changes with git + NX Committing changes with git - > NX Tagging commit with git + NX Tagging commit with git `); @@ -464,12 +464,12 @@ describe('nx release - independent projects', () => { ); expect(changelogPkg2Output).toMatchInlineSnapshot(` - > NX Your filter "{project-name}" matched the following projects: + NX Your filter "{project-name}" matched the following projects: - {project-name} - > NX Previewing an entry in {project-name}/CHANGELOG.md for {project-name}@999.9.9-package.2 + NX Previewing an entry in {project-name}/CHANGELOG.md for {project-name}@999.9.9-package.2 + ## 999.9.9-package.2 (YYYY-MM-DD) @@ -477,10 +477,10 @@ describe('nx release - independent projects', () => { + This was a version bump only for {project-name} to align it with other projects, there were no code changes. - > NX Committing changes with git + NX Committing changes with git - > NX Tagging commit with git + NX Tagging commit with git `); @@ -491,12 +491,12 @@ describe('nx release - independent projects', () => { ); expect(changelogPkg3Output).toMatchInlineSnapshot(` - > NX Your filter "{project-name}" matched the following projects: + NX Your filter "{project-name}" matched the following projects: - {project-name} - > NX Previewing an entry in {project-name}/CHANGELOG.md for {project-name}@999.9.9-package.3 + NX Previewing an entry in {project-name}/CHANGELOG.md for {project-name}@999.9.9-package.3 + ## 999.9.9-package.3 (YYYY-MM-DD) @@ -504,10 +504,10 @@ describe('nx release - independent projects', () => { + This was a version bump only for {project-name} to align it with other projects, there were no code changes. - > NX Committing changes with git + NX Committing changes with git - > NX Tagging commit with git + NX Tagging commit with git `); @@ -524,12 +524,12 @@ describe('nx release - independent projects', () => { ); expect(versionWithGitActionsCLIOutput).toMatchInlineSnapshot(` - > NX Your filter "{project-name}" matched the following projects: + NX Your filter "{project-name}" matched the following projects: - {project-name} - > NX Generating an entry in {project-name}/CHANGELOG.md for {project-name}@999.9.9-changelog-git-operations-test.1 + NX Generating an entry in {project-name}/CHANGELOG.md for {project-name}@999.9.9-changelog-git-operations-test.1 + ## 999.9.9-changelog-git-operations-test.1 (YYYY-MM-DD) @@ -537,7 +537,7 @@ describe('nx release - independent projects', () => { + This was a version bump only for {project-name} to align it with other projects, there were no code changes. - > NX Committing changes with git + NX Committing changes with git Staging files in git with the following command: git add {project-name}/CHANGELOG.md @@ -545,7 +545,7 @@ describe('nx release - independent projects', () => { Committing files in git with the following command: git commit --message chore(release): publish --message - project: {project-name} 999.9.9-changelog-git-operations-test.1 - > NX Tagging commit with git + NX Tagging commit with git Tagging the current commit in git with the following command: git tag --annotate {project-name}@999.9.9-changelog-git-operations-test.1 --message {project-name}@999.9.9-changelog-git-operations-test.1 @@ -642,12 +642,12 @@ describe('nx release - independent projects', () => { // Should only contain 1 project expect(runCLI(`release publish -p ${pkg1} -d`)).toMatchInlineSnapshot(` - > NX Your filter "{project-name}" matched the following projects: + NX Your filter "{project-name}" matched the following projects: - {project-name} (release group "group1") - > NX Running target nx-release-publish for project {project-name}: + NX Running target nx-release-publish for project {project-name}: - {project-name} @@ -680,7 +680,7 @@ describe('nx release - independent projects', () => { - > NX Successfully ran target nx-release-publish for project {project-name} + NX Successfully ran target nx-release-publish for project {project-name} @@ -690,13 +690,13 @@ describe('nx release - independent projects', () => { expect(runCLI(`release publish -p ${pkg1} -p ${pkg3} -d`)) .toMatchInlineSnapshot(` - > NX Your filter "{project-name},{project-name}" matched the following projects: + NX Your filter "{project-name},{project-name}" matched the following projects: - {project-name} (release group "group1") - {project-name} (release group "group2") - > NX Running target nx-release-publish for project {project-name}: + NX Running target nx-release-publish for project {project-name}: - {project-name} @@ -729,11 +729,11 @@ describe('nx release - independent projects', () => { - > NX Successfully ran target nx-release-publish for project {project-name} + NX Successfully ran target nx-release-publish for project {project-name} - > NX Running target nx-release-publish for project {project-name}: + NX Running target nx-release-publish for project {project-name}: - {project-name} @@ -766,7 +766,7 @@ describe('nx release - independent projects', () => { - > NX Successfully ran target nx-release-publish for project {project-name} + NX Successfully ran target nx-release-publish for project {project-name} @@ -777,7 +777,7 @@ describe('nx release - independent projects', () => { // Should only contain the 2 projects from group1 expect(runCLI(`release publish -g group1 -d`)).toMatchInlineSnapshot(` - > NX Running target nx-release-publish for 2 projects: + NX Running target nx-release-publish for 2 projects: - {project-name} - {project-name} @@ -833,7 +833,7 @@ describe('nx release - independent projects', () => { - > NX Successfully ran target nx-release-publish for 2 projects + NX Successfully ran target nx-release-publish for 2 projects @@ -842,7 +842,7 @@ describe('nx release - independent projects', () => { // Should only contain the 1 project from group2 expect(runCLI(`release publish -g group2 -d`)).toMatchInlineSnapshot(` - > NX Running target nx-release-publish for project {project-name}: + NX Running target nx-release-publish for project {project-name}: - {project-name} @@ -875,7 +875,7 @@ describe('nx release - independent projects', () => { - > NX Successfully ran target nx-release-publish for project {project-name} + NX Successfully ran target nx-release-publish for project {project-name} diff --git a/e2e/release/src/private-js-packages.test.ts b/e2e/release/src/private-js-packages.test.ts index c091f827a7a8d..46f46dcf76d15 100644 --- a/e2e/release/src/private-js-packages.test.ts +++ b/e2e/release/src/private-js-packages.test.ts @@ -104,12 +104,12 @@ describe('nx release - private JS packages', () => { const publicPkg1PublishOutput = runCLI(`release publish -p ${publicPkg1}`); expect(publicPkg1PublishOutput).toMatchInlineSnapshot(` - > NX Your filter "{public-project-name}" matched the following projects: + NX Your filter "{public-project-name}" matched the following projects: - {public-project-name} - > NX Running target nx-release-publish for project {public-project-name}: + NX Running target nx-release-publish for project {public-project-name}: - {public-project-name} @@ -138,7 +138,7 @@ describe('nx release - private JS packages', () => { - > NX Successfully ran target nx-release-publish for project {public-project-name} + NX Successfully ran target nx-release-publish for project {public-project-name} @@ -148,12 +148,12 @@ describe('nx release - private JS packages', () => { const publicPkg2PublishOutput = runCLI(`release publish -p ${publicPkg2}`); expect(publicPkg2PublishOutput).toMatchInlineSnapshot(` - > NX Your filter "{public-project-name}" matched the following projects: + NX Your filter "{public-project-name}" matched the following projects: - {public-project-name} - > NX Running target nx-release-publish for project {public-project-name}: + NX Running target nx-release-publish for project {public-project-name}: - {public-project-name} @@ -182,7 +182,7 @@ describe('nx release - private JS packages', () => { - > NX Successfully ran target nx-release-publish for project {public-project-name} + NX Successfully ran target nx-release-publish for project {public-project-name} @@ -193,12 +193,12 @@ describe('nx release - private JS packages', () => { }); expect(privatePkgPublishOutput).toMatchInlineSnapshot(` - > NX Your filter "{private-project-name}" matched the following projects: + NX Your filter "{private-project-name}" matched the following projects: - {private-project-name} - > NX Based on your config, the following projects were matched for publishing but do not have the "nx-release-publish" target specified: + NX Based on your config, the following projects were matched for publishing but do not have the "nx-release-publish" target specified: - {private-project-name} diff --git a/e2e/release/src/release.test.ts b/e2e/release/src/release.test.ts index 4be781c5978e5..aca210ff6130a 100644 --- a/e2e/release/src/release.test.ts +++ b/e2e/release/src/release.test.ts @@ -173,7 +173,7 @@ ${JSON.stringify( const changelogOutput = runCLI(`release changelog 999.9.9`); expect(changelogOutput).toMatchInlineSnapshot(` - > NX Generating an entry in CHANGELOG.md for v999.9.9 + NX Generating an entry in CHANGELOG.md for v999.9.9 + ## 999.9.9 (YYYY-MM-DD) @@ -188,10 +188,10 @@ ${JSON.stringify( + - Test @{COMMIT_AUTHOR} - > NX Committing changes with git + NX Committing changes with git - > NX Tagging commit with git + NX Tagging commit with git `); @@ -218,7 +218,7 @@ ${JSON.stringify( const publishOutput = runCLI(`release publish`); expect(publishOutput).toMatchInlineSnapshot(` - > NX Running target nx-release-publish for 3 projects: + NX Running target nx-release-publish for 3 projects: - {project-name} - {project-name} @@ -291,7 +291,7 @@ ${JSON.stringify( - > NX Successfully ran target nx-release-publish for 3 projects + NX Successfully ran target nx-release-publish for 3 projects @@ -391,7 +391,7 @@ ${JSON.stringify( const publishOutput2 = runCLI(`${publishToNext} --dry-run`); expect(publishOutput2).toMatchInlineSnapshot(` - > NX Running target nx-release-publish for 3 projects: + NX Running target nx-release-publish for 3 projects: - {project-name} - {project-name} @@ -469,7 +469,7 @@ ${JSON.stringify( - > NX Successfully ran target nx-release-publish for 3 projects + NX Successfully ran target nx-release-publish for 3 projects @@ -496,7 +496,7 @@ ${JSON.stringify( const publishOutput3 = runCLI(publishToNext); expect(publishOutput3).toMatchInlineSnapshot(` - > NX Running target nx-release-publish for 3 projects: + NX Running target nx-release-publish for 3 projects: - {project-name} - {project-name} @@ -573,7 +573,7 @@ ${JSON.stringify( - > NX Successfully ran target nx-release-publish for 3 projects + NX Successfully ran target nx-release-publish for 3 projects @@ -583,7 +583,7 @@ ${JSON.stringify( const publishOutput3Repeat = runCLI(publishToNext); expect(publishOutput3Repeat).toMatchInlineSnapshot(` - > NX Running target nx-release-publish for 3 projects: + NX Running target nx-release-publish for 3 projects: - {project-name} - {project-name} @@ -609,7 +609,7 @@ ${JSON.stringify( - > NX Successfully ran target nx-release-publish for 3 projects + NX Successfully ran target nx-release-publish for 3 projects @@ -621,7 +621,7 @@ ${JSON.stringify( ); expect(publishOutput3NewDistTags).toMatchInlineSnapshot(` - > NX Running target nx-release-publish for 3 projects: + NX Running target nx-release-publish for 3 projects: - {project-name} - {project-name} @@ -650,7 +650,7 @@ ${JSON.stringify( - > NX Successfully ran target nx-release-publish for 3 projects + NX Successfully ran target nx-release-publish for 3 projects @@ -713,7 +713,7 @@ ${JSON.stringify( ); expect(changelogDryRunOutput).toMatchInlineSnapshot(` - > NX Previewing an entry in CHANGELOG.md for v1000.0.0-next.0 + NX Previewing an entry in CHANGELOG.md for v1000.0.0-next.0 @@ -726,7 +726,7 @@ ${JSON.stringify( - > NX Previewing a GitHub release and an entry in {project-name}/CHANGELOG.md for v1000.0.0-next.0 + NX Previewing a GitHub release and an entry in {project-name}/CHANGELOG.md for v1000.0.0-next.0 + ## 1000.0.0-next.0 @@ -734,7 +734,7 @@ ${JSON.stringify( + This was a version bump only for {project-name} to align it with other projects, there were no code changes. - > NX Previewing a GitHub release and an entry in {project-name}/CHANGELOG.md for v1000.0.0-next.0 + NX Previewing a GitHub release and an entry in {project-name}/CHANGELOG.md for v1000.0.0-next.0 + ## 1000.0.0-next.0 @@ -742,7 +742,7 @@ ${JSON.stringify( + This was a version bump only for {project-name} to align it with other projects, there were no code changes. - > NX Previewing a GitHub release and an entry in {project-name}/CHANGELOG.md for v1000.0.0-next.0 + NX Previewing a GitHub release and an entry in {project-name}/CHANGELOG.md for v1000.0.0-next.0 + ## 1000.0.0-next.0 @@ -750,10 +750,10 @@ ${JSON.stringify( + This was a version bump only for {project-name} to align it with other projects, there were no code changes. - > NX Committing changes with git + NX Committing changes with git - > NX Tagging commit with git + NX Tagging commit with git `); @@ -1085,11 +1085,11 @@ ${JSON.stringify( expect(releaseOutput4a).toMatchInlineSnapshot(` - > NX Running release version for project: {project-name} + NX Running release version for project: {project-name} {project-name} 🔍 Reading data for package "@proj/{project-name}" from {project-name}/package.json - > NX No git tags matching pattern ">{version}" for project "{project-name}" were found. You will need to create an initial matching tag to use as a base for determining the next version. Alternatively, you can use the --first-release option or set "release.version.generatorOptions.fallbackCurrentVersionResolver" to "disk" in order to fallback to the version on disk when no matching git tags are found. + NX No git tags matching pattern ">{version}" for project "{project-name}" were found. You will need to create an initial matching tag to use as a base for determining the next version. Alternatively, you can use the --first-release option or set "release.version.generatorOptions.fallbackCurrentVersionResolver" to "disk" in order to fallback to the version on disk when no matching git tags are found. `); diff --git a/packages/create-nx-workspace/src/utils/output.ts b/packages/create-nx-workspace/src/utils/output.ts index 3f1bf07ac1b5f..fb712aa1621bd 100644 --- a/packages/create-nx-workspace/src/utils/output.ts +++ b/packages/create-nx-workspace/src/utils/output.ts @@ -35,19 +35,13 @@ if (isCI()) { } class CLIOutput { - readonly X_PADDING = ' '; - /** * Longer dash character which forms more of a continuous line when place side to side * with itself, unlike the standard dash character */ private get VERTICAL_SEPARATOR() { let divider = ''; - for ( - let i = 0; - i < process.stdout.columns - this.X_PADDING.length * 2; - i++ - ) { + for (let i = 0; i < process.stdout.columns - 1; i++) { divider += '\u2014'; } return divider; @@ -80,7 +74,7 @@ class CLIOutput { color: string; title: string; }): void { - this.writeToStdOut(` ${this.applyCLIPrefix(color, title)}${EOL}`); + this.writeToStdOut(`${this.applyCLIPrefix(color, title)}${EOL}`); } private writeOptionalOutputBody(bodyLines?: string[]): void { @@ -88,7 +82,7 @@ class CLIOutput { return; } this.addNewline(); - bodyLines.forEach((bodyLine) => this.writeToStdOut(` ${bodyLine}${EOL}`)); + bodyLines.forEach((bodyLine) => this.writeToStdOut(`${bodyLine}${EOL}`)); } private cliName = 'NX'; @@ -100,13 +94,9 @@ class CLIOutput { applyCLIPrefix(color = 'cyan', text: string): string { let cliPrefix = ''; if ((chalk as any)[color]) { - cliPrefix = `${(chalk as any)[color]('>')} ${( - chalk as any - ).reset.inverse.bold[color](` ${this.cliName} `)}`; + cliPrefix = (chalk as any).reset.inverse.bold[color](` ${this.cliName} `); } else { - cliPrefix = `${chalk.keyword(color)( - '>' - )} ${chalk.reset.inverse.bold.keyword(color)(` ${this.cliName} `)}`; + cliPrefix = chalk.reset.inverse.bold.keyword(color)(` ${this.cliName} `); } return `${cliPrefix} ${text}`; } @@ -123,9 +113,7 @@ class CLIOutput { addVerticalSeparatorWithoutNewLines(color = 'gray') { this.writeToStdOut( - `${this.X_PADDING}${(chalk as any).dim[color]( - this.VERTICAL_SEPARATOR - )}${EOL}` + `${(chalk as any).dim[color](this.VERTICAL_SEPARATOR)}${EOL}` ); } diff --git a/packages/nx/src/tasks-runner/life-cycles/dynamic-run-many-terminal-output-life-cycle.ts b/packages/nx/src/tasks-runner/life-cycles/dynamic-run-many-terminal-output-life-cycle.ts index 47daee36e7079..ebe27b79f82c6 100644 --- a/packages/nx/src/tasks-runner/life-cycles/dynamic-run-many-terminal-output-life-cycle.ts +++ b/packages/nx/src/tasks-runner/life-cycles/dynamic-run-many-terminal-output-life-cycle.ts @@ -99,7 +99,7 @@ export async function createRunManyDynamicOutputRenderer({ // Create vertical breathing room for cursor position under the pinned footer lines.push(''); for (const line of lines) { - output.overwriteLine(output.X_PADDING + line); + output.overwriteLine(line); } pinnedFooterNumLines = lines.length + additionalLines; // clear any possible text below the cursor's position @@ -262,7 +262,7 @@ export async function createRunManyDynamicOutputRenderer({ )}`; const taskOverridesRows = []; if (Object.keys(overrides).length > 0) { - const leftPadding = `${output.X_PADDING} `; + const leftPadding = ` `; taskOverridesRows.push(''); taskOverridesRows.push( `${leftPadding}${output.dim.cyan('With additional flags:')}` @@ -323,7 +323,7 @@ export async function createRunManyDynamicOutputRenderer({ )}`; const taskOverridesRows = []; if (Object.keys(overrides).length > 0) { - const leftPadding = `${output.X_PADDING} `; + const leftPadding = ` `; taskOverridesRows.push(''); taskOverridesRows.push( `${leftPadding}${output.dim.green('With additional flags:')}` @@ -358,7 +358,7 @@ export async function createRunManyDynamicOutputRenderer({ )}`; const taskOverridesRows = []; if (Object.keys(overrides).length > 0) { - const leftPadding = `${output.X_PADDING} `; + const leftPadding = ` `; taskOverridesRows.push(''); taskOverridesRows.push( `${leftPadding}${output.dim.red('With additional flags:')}` @@ -468,7 +468,7 @@ export async function createRunManyDynamicOutputRenderer({ function writeCompletedTaskResultLine(line: string) { const additionalXPadding = ' '; - output.overwriteLine(output.X_PADDING + additionalXPadding + line); + output.overwriteLine(additionalXPadding + line); } /** @@ -495,7 +495,5 @@ function writeCommandOutputBlock(commandOutput: string) { } lines.push(''); // Indent the command output to make it look more "designed" in the context of the dynamic output - lines.forEach((l) => - output.overwriteLine(`${output.X_PADDING}${additionalXPadding}${l}`) - ); + lines.forEach((l) => output.overwriteLine(`${additionalXPadding}${l}`)); } diff --git a/packages/nx/src/tasks-runner/life-cycles/dynamic-run-one-terminal-output-life-cycle.ts b/packages/nx/src/tasks-runner/life-cycles/dynamic-run-one-terminal-output-life-cycle.ts index d4d135f62092e..0aa0240867283 100644 --- a/packages/nx/src/tasks-runner/life-cycles/dynamic-run-one-terminal-output-life-cycle.ts +++ b/packages/nx/src/tasks-runner/life-cycles/dynamic-run-one-terminal-output-life-cycle.ts @@ -98,8 +98,7 @@ export async function createRunOneDynamicOutputRenderer({ const renderLines = ( lines: string[], dividerColor = 'cyan', - renderDivider = true, - skipPadding = false + renderDivider = true ) => { let additionalLines = 0; if (renderDivider) { @@ -111,7 +110,7 @@ export async function createRunOneDynamicOutputRenderer({ lines.push(''); } for (const line of lines) { - output.overwriteLine((skipPadding ? '' : output.X_PADDING) + line); + output.overwriteLine(line); } dependentTargetsNumLines = lines.length + additionalLines; // clear any possible text below the cursor's position @@ -175,8 +174,7 @@ export async function createRunOneDynamicOutputRenderer({ renderLines( linesToRender, 'gray', - renderDivider && state !== 'EXECUTING_DEPENDENT_TARGETS', - true + renderDivider && state !== 'EXECUTING_DEPENDENT_TARGETS' ); } else { renderLines([]); @@ -280,7 +278,7 @@ export async function createRunOneDynamicOutputRenderer({ const taskOverridesLines = []; if (Object.keys(overrides).length > 0) { - const leftPadding = `${output.X_PADDING} `; + const leftPadding = ` `; taskOverridesLines.push(''); taskOverridesLines.push( `${leftPadding}${output.dim.green('With additional flags:')}` @@ -321,7 +319,7 @@ export async function createRunOneDynamicOutputRenderer({ const taskOverridesLines = []; if (Object.keys(overrides).length > 0) { - const leftPadding = `${output.X_PADDING} `; + const leftPadding = ` `; taskOverridesLines.push(''); taskOverridesLines.push( `${leftPadding}${output.dim.red('With additional flags:')}` diff --git a/packages/nx/src/tasks-runner/life-cycles/view-logs-utils.ts b/packages/nx/src/tasks-runner/life-cycles/view-logs-utils.ts index 5ac0c5a0ef0ab..dbeeabb660b06 100644 --- a/packages/nx/src/tasks-runner/life-cycles/view-logs-utils.ts +++ b/packages/nx/src/tasks-runner/life-cycles/view-logs-utils.ts @@ -6,7 +6,7 @@ const VIEW_LOGS_MESSAGE = `Hint: Try "nx view-logs" to get structured, searchabl export function viewLogsFooterRows(failedTasks: number) { if (failedTasks >= 2 && !isNxCloudUsed(readNxJson())) { - return [``, output.dim(`${output.X_PADDING} ${VIEW_LOGS_MESSAGE}`)]; + return [``, output.dim(` ${VIEW_LOGS_MESSAGE}`)]; } else { return []; } diff --git a/packages/nx/src/utils/logger.ts b/packages/nx/src/utils/logger.ts index 16ea72492071c..8096d5dc478bf 100644 --- a/packages/nx/src/utils/logger.ts +++ b/packages/nx/src/utils/logger.ts @@ -1,8 +1,6 @@ import * as chalk from 'chalk'; -export const NX_PREFIX = `${chalk.cyan('>')} ${chalk.inverse( - chalk.bold(chalk.cyan(' NX ')) -)}`; +export const NX_PREFIX = chalk.inverse(chalk.bold(chalk.cyan(' NX '))); export const NX_ERROR = chalk.inverse(chalk.bold(chalk.red(' ERROR '))); diff --git a/packages/nx/src/utils/output.ts b/packages/nx/src/utils/output.ts index 3149fedecd317..0b6f7b7c29e59 100644 --- a/packages/nx/src/utils/output.ts +++ b/packages/nx/src/utils/output.ts @@ -39,7 +39,6 @@ if (isCI() && !forceColor) { } class CLIOutput { - readonly X_PADDING = ' '; cliName = 'NX'; formatCommand = (taskId: string) => `${chalk.dim('nx run')} ${taskId}`; @@ -49,11 +48,7 @@ class CLIOutput { */ private get VERTICAL_SEPARATOR() { let divider = ''; - for ( - let i = 0; - i < process.stdout.columns - this.X_PADDING.length * 2; - i++ - ) { + for (let i = 0; i < process.stdout.columns - 1; i++) { divider += '\u2014'; } return divider; @@ -95,7 +90,7 @@ class CLIOutput { color: string; title: string; }): void { - this.writeToStdOut(` ${this.applyNxPrefix(color, title)}${EOL}`); + this.writeToStdOut(`${this.applyNxPrefix(color, title)}${EOL}`); } private writeOptionalOutputBody(bodyLines?: string[]): void { @@ -103,19 +98,15 @@ class CLIOutput { return; } this.addNewline(); - bodyLines.forEach((bodyLine) => this.writeToStdOut(` ${bodyLine}${EOL}`)); + bodyLines.forEach((bodyLine) => this.writeToStdOut(`${bodyLine}${EOL}`)); } applyNxPrefix(color = 'cyan', text: string): string { let nxPrefix = ''; if (chalk[color]) { - nxPrefix = `${chalk[color]('>')} ${chalk.reset.inverse.bold[color]( - ` ${this.cliName} ` - )}`; + nxPrefix = chalk.reset.inverse.bold[color](` ${this.cliName} `); } else { - nxPrefix = `${chalk.keyword(color)( - '>' - )} ${chalk.reset.inverse.bold.keyword(color)(` ${this.cliName} `)}`; + nxPrefix = chalk.reset.inverse.bold.keyword(color)(` ${this.cliName} `); } return `${nxPrefix} ${text}`; } @@ -139,7 +130,7 @@ class CLIOutput { } private getVerticalSeparator(color: string): string { - return `${this.X_PADDING}${chalk.dim[color](this.VERTICAL_SEPARATOR)}`; + return chalk.dim[color](this.VERTICAL_SEPARATOR); } error({ title, slug, bodyLines }: CLIErrorMessageConfig) { diff --git a/packages/workspace/src/utils/output.ts b/packages/workspace/src/utils/output.ts index 01398095f91e4..cb4cf27d7703e 100644 --- a/packages/workspace/src/utils/output.ts +++ b/packages/workspace/src/utils/output.ts @@ -30,9 +30,7 @@ if (process.env.CI === 'true') { } class CLIOutput { - private readonly NX_PREFIX = `${chalk.cyan( - '>' - )} ${chalk.reset.inverse.bold.cyan(' NX ')}`; + private readonly NX_PREFIX = chalk.reset.inverse.bold.cyan(' NX '); /** * Longer dash character which forms more of a continuous line when place side to side * with itself, unlike the standard dash character