fix(core): align terminal output padding and remove leading arrow (#21809)

This commit is contained in:
Miroslav Jonaš 2024-02-20 17:43:46 +01:00 committed by GitHub
parent 2c8c8d4f2a
commit ecf70adbce
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
42 changed files with 573 additions and 602 deletions

View File

@ -89,7 +89,7 @@ The command below uses the `as-provided` directory flag behavior, which is the d
{% /callout %} {% /callout %}
```{% command="nx g @nx/remix:app myapp --directory=apps/myapp" path="~/acme" %} ```{% 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 ✔ What unit test runner should be used? · vitest
@ -137,7 +137,7 @@ 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: 2. To serve your application for use during development run:
@ -166,7 +166,7 @@ Warning: Functions are not valid as a React child. This may happen if you return
—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— ——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
> NX Successfully ran target test for project myapp (2s) NX Successfully ran target test for project myapp (2s)
``` ```
## Generating an Nx Library ## 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: To generate a library to use in your Remix application run:
```{% command="nx g @nx/remix:lib login --directory=libs/login" path="~/acme" %} ```{% 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 ✔ What test runner should be used? · vitest
UPDATE nx.json UPDATE nx.json
@ -223,7 +223,7 @@ You can also run test on your library:
To generate a route for your application: To generate a route for your application:
```{% command="nx g @nx/remix:route admin --path=apps/myapp/app/routes" path="~/acme" %} ```{% 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/routes/admin.tsx
CREATE apps/myapp/app/styles/admin.css 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: 1. Generate a loader for your route:
```{% command="nx g @nx/remix:loader admin --path=apps/myapp/app/routes" path="~/acme" %} ```{% 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 UPDATE apps/myapp/app/routes/admin.tsx
``` ```

View File

@ -221,7 +221,7 @@ Clearly this is not a scalable solution as it requires us to manually add every
———————————————————————————————————————————————————————————————— ————————————————————————————————————————————————————————————————
> 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. 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.
@ -236,7 +236,7 @@ Nx comes with a dedicated ["affected" command](/ci/features/affected) to help wi
—————————————————————————————————————————————————————————————————————————————————————— ——————————————————————————————————————————————————————————————————————————————————————
> 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 ### 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: To manually connect your workspace to Nx Cloud, run the following command in your repository:
```shell ```{% command="pnpm nx connect" %}
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). Click the link in the terminal to claim your workspace on [nx.app](https://nx.app).
@ -369,7 +375,7 @@ What is more, if you run tasks locally, you will also get cache hits:
———————————————————————————————————————————————— ————————————————————————————————————————————————
> 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.
``` ```

View File

@ -216,7 +216,7 @@ Clearly this is not a scalable solution as it requires us to manually add every
———————————————————————————————————————————————————————————————— ————————————————————————————————————————————————————————————————
> 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. 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.
@ -231,7 +231,7 @@ Nx comes with a dedicated ["affected" command](/ci/features/affected) to help wi
—————————————————————————————————————————————————————————————————————————————————————— ——————————————————————————————————————————————————————————————————————————————————————
> 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 ### Configuring the Comparison Range for Affected Commands
@ -354,7 +354,7 @@ What is more, if you run tasks locally, you will also get cache hits:
———————————————————————————————————————————————— ————————————————————————————————————————————————
> 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.
``` ```

View File

@ -477,7 +477,7 @@ More conveniently, we can also run them in parallel using the following syntax:
—————————————————————————————————————————————————————— ——————————————————————————————————————————————————————
> NX Successfully ran targets test, lint, e2e for 2 projects (8s) NX Successfully ran targets test, lint, e2e for 2 projects (8s)
``` ```
### Caching ### Caching
@ -497,7 +497,7 @@ Note that all of these targets are automatically cached by Nx. If you re-run a s
——————————————————————————————————————————————————————— ———————————————————————————————————————————————————————
> 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.
``` ```
@ -514,9 +514,9 @@ Generators allow you to easily scaffold code, configuration or entire projects.
```{% command="npx nx list @nx/angular" path="myngapp" %} ```{% command="npx nx list @nx/angular" path="myngapp" %}
> NX Capabilities in @nx/angular: NX Capabilities in @nx/angular:
> NX Capabilities in @nx/angular: NX Capabilities in @nx/angular:
GENERATORS GENERATORS
@ -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. 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" %} ```{% 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.css
CREATE src/app/hello-world/hello-world.component.html CREATE src/app/hello-world/hello-world.component.html
@ -616,7 +616,7 @@ 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. All the required files will be placed in the `dist/myngapp` folder and can be deployed to your favorite hosting provider.
@ -1068,7 +1068,7 @@ If you lint your workspace you'll get an error now:
————————————————————————————————————————————————————————————————————— —————————————————————————————————————————————————————————————————————
> 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]

View File

@ -52,7 +52,7 @@ title="Tutorial: Standalone Angular Application"
Create a new Angular monorepo with the following command: Create a new Angular monorepo with the following command:
```{% command="npx create-nx-workspace@latest angular-monorepo --preset=angular-monorepo" path="~" %} ```{% 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 ✔ Application name · angular-store
✔ Which bundler would you like to use? · esbuild ✔ 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" %} ```{% command="npx nx list @nx/angular" path="angular-monorepo" %}
> NX Capabilities in @nx/angular: NX Capabilities in @nx/angular:
GENERATORS 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. 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" %} ```{% 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 configure routing for this application? (y/N) · false
✔ Would you like to use Standalone Components? (y/N) · true ✔ Would you like to use Standalone Components? (y/N) · true
@ -1009,7 +1009,6 @@ 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. 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" %} ```{% 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 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:lint [existing outputs match the cache, left as is]
✔ nx run angular-store:test [existing outputs match the cache, left as is] ✔ nx run angular-store:test [existing outputs match the cache, left as is]
@ -1017,7 +1016,7 @@ Note that all of these targets are automatically cached by Nx. If you re-run a s
—————————————————————————————————————————————————————— ——————————————————————————————————————————————————————
> 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.
``` ```
@ -1153,7 +1152,7 @@ nx graph --affected
If you're ready and want to ship your applications, you can build them using 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" %} ```{% 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.css
CREATE libs/orders/src/lib/order-list/order-list.component.html CREATE libs/orders/src/lib/order-list/order-list.component.html
@ -1167,7 +1166,7 @@ UPDATE libs/orders/src/index.ts
——————————————————————————————————————————————————————————————————————— ———————————————————————————————————————————————————————————————————————
> 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. 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,7 +1320,7 @@ export class ProductListComponent {}
If you lint your workspace you'll get an error now: If you lint your workspace you'll get an error now:
```{% command="nx run-many -t lint" %} ```{% command="nx run-many -t lint" %}
> NX Running target lint for 7 projects NX Running target lint for 7 projects
✖ nx run products:lint ✖ nx run products:lint
Linting "products"... Linting "products"...
@ -1345,7 +1344,7 @@ If you lint your workspace you'll get an error now:
——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— ———————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
> 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]

View File

@ -137,7 +137,7 @@ Hello, World!
————————————————————————————————————————————————————————————————————————————————————————— —————————————————————————————————————————————————————————————————————————————————————————
> 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

View File

@ -48,7 +48,7 @@ Update `packages/ascii/assets/cow.txt`:
```plaintext ```plaintext
_____ _____
< Hi! > < moo >
----- -----
\ ^__^ \ ^__^
\ (oo)\_______ \ (oo)\_______
@ -71,7 +71,7 @@ Printing the affected projects can be handy, but usually you want to do somethin
—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— ——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
> 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
``` ```

View File

@ -103,8 +103,7 @@ 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 File

@ -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" %} ```{% command="nx g lib my-lib --directory=shared/my-lib" path="~/myorg" %}
✔ Which generator would you like to use? · @nx/node:library ✔ 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? … ? What should be the project name and where should it be generated? …
As provided: As provided:

View File

@ -27,20 +27,17 @@ 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] > nx run header:build [remote cache]
@ -55,7 +52,7 @@ 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.

View File

@ -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="~" %} ```{% 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 ✔ Where would you like to create your workspace? · myorg
? Which stack do you want to use? … ? Which stack do you want to use? …

View File

@ -329,7 +329,7 @@ If you inspect the terminal output, you'll see something like this, even if you
(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.

View File

@ -5,11 +5,11 @@ In this recipe, we'll show you how to create a [Remix](https://remix.run) applic
## Create Nx Workspace ## Create Nx Workspace
```{% command="npx create-nx-workspace acme --preset=apps" path="~/" %} ```{% 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 ✔ 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, 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. Nx will run "npm install" several times. Please wait.
@ -20,7 +20,7 @@ In this recipe, we'll show you how to create a [Remix](https://remix.run) applic
—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— ——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
> 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
``` ```
@ -42,7 +42,7 @@ The command below uses the `as-provided` directory flag behavior, which is the d
{% /callout %} {% /callout %}
```{% command="nx g @nx/remix:app myapp --directory=apps/myapp" path="~/acme" %} ```{% 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 ✔ What unit test runner should be used? · vitest
@ -90,7 +90,7 @@ 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: 2. To serve your application for use during development run:
@ -119,7 +119,7 @@ Warning: Functions are not valid as a React child. This may happen if you return
—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— ——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
> NX Successfully ran target test for project myapp (2s) NX Successfully ran target test for project myapp (2s)
``` ```
## Generating an Nx Library ## 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: To generate a library to use in your Remix application run:
```{% command="nx g @nx/remix:lib login --directory=libs/login" path="~/acme" %} ```{% 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 ✔ What test runner should be used? · vitest
UPDATE nx.json UPDATE nx.json
@ -176,7 +176,7 @@ You can also run test on your library:
To generate a route for your application: To generate a route for your application:
```{% command="nx g @nx/remix:route admin --path=apps/myapp/app/routes" path="~/acme" %} ```{% 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/routes/admin.tsx
CREATE apps/myapp/app/styles/admin.css 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: 1. Generate a loader for your route:
```{% command="nx g @nx/remix:loader admin --path=apps/myapp/app/routes" path="~/acme" %} ```{% 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 UPDATE apps/myapp/app/routes/admin.tsx
``` ```

View File

@ -193,7 +193,7 @@ 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 ## Running Multiple Tasks
@ -212,7 +212,7 @@ What you would get is the following:
————————————————————————————————————————————————————————————————— —————————————————————————————————————————————————————————————————
> 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.
``` ```

View File

@ -223,7 +223,7 @@ Run the command:
—————————————————————————————————————————————————————————————————————————————————————————— ——————————————————————————————————————————————————————————————————————————————————————————
> 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.
@ -241,7 +241,7 @@ To run the `build` target for all the packages in the workspace, use:
———————————————————————————————————————————————————————————————————————————————————————— ————————————————————————————————————————————————————————————————————————————————————————
> 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.
``` ```
@ -254,7 +254,7 @@ Notice that both builds are replayed from cache. We can skip the cache by adding
——————————————————————————————————————————————————————————————————————— ———————————————————————————————————————————————————————————————————————
> 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. 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,7 +263,7 @@ You can also only run tasks on packages that got changed by using the command:
```{% command="npx nx affected -t build" %} ```{% 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-even:build [existing outputs match the cache, left as is]
@ -271,7 +271,7 @@ You can also only run tasks on packages that got changed by using the command:
—————————————————————————————————————————————————————————————————————————————————————————————— ——————————————————————————————————————————————————————————————————————————————————————————————
> 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.
``` ```

View File

@ -89,7 +89,7 @@ The command below uses the `as-provided` directory flag behavior, which is the d
{% /callout %} {% /callout %}
```{% command="nx g @nx/remix:app myapp --directory=apps/myapp" path="~/acme" %} ```{% 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 ✔ What unit test runner should be used? · vitest
@ -137,7 +137,7 @@ 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: 2. To serve your application for use during development run:
@ -166,7 +166,7 @@ Warning: Functions are not valid as a React child. This may happen if you return
—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— ——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
> NX Successfully ran target test for project myapp (2s) NX Successfully ran target test for project myapp (2s)
``` ```
## Generating an Nx Library ## 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: To generate a library to use in your Remix application run:
```{% command="nx g @nx/remix:lib login --directory=libs/login" path="~/acme" %} ```{% 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 ✔ What test runner should be used? · vitest
UPDATE nx.json UPDATE nx.json
@ -223,7 +223,7 @@ You can also run test on your library:
To generate a route for your application: To generate a route for your application:
```{% command="nx g @nx/remix:route admin --path=apps/myapp/app/routes" path="~/acme" %} ```{% 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/routes/admin.tsx
CREATE apps/myapp/app/styles/admin.css 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: 1. Generate a loader for your route:
```{% command="nx g @nx/remix:loader admin --path=apps/myapp/app/routes" path="~/acme" %} ```{% 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 UPDATE apps/myapp/app/routes/admin.tsx
``` ```

View File

@ -216,7 +216,7 @@ More conveniently, we can also run them in parallel using the following syntax:
—————————————————————————————————————————————————————— ——————————————————————————————————————————————————————
> NX Successfully ran targets test, lint, e2e for 2 projects (7s) NX Successfully ran targets test, lint, e2e for 2 projects (7s)
``` ```
### Caching ### Caching
@ -234,7 +234,7 @@ Note that all of these targets are automatically cached by Nx. If you re-run a s
—————————————————————————————————————————————————————— ——————————————————————————————————————————————————————
> 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.
``` ```
@ -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" %} ```{% command="npx nx list @nx/react" path="myreactapp" %}
> NX Capabilities in @nx/react: NX Capabilities in @nx/react:
GENERATORS 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. 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" %} ```{% 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 ✔ Should this component be exported in the project? (y/N) · false
✔ Where should the component be generated? · src/app/hello-world/hello-world.tsx ✔ Where should the component be generated? · src/app/hello-world/hello-world.tsx
@ -340,7 +340,7 @@ dist/myreactapp/assets/index-378e8124.js 165.64 kB │ gzip: 51.63 kB
—————————————————————————————————————————————————————————————————————————————————————————————————————————— ——————————————————————————————————————————————————————————————————————————————————————————————————————————
> 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. All the required files will be placed in the `dist/myreactapp` folder and can be deployed to your favorite hosting provider.
@ -824,7 +824,7 @@ If you lint your workspace you'll get an error now:
———————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— ————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
> 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]

View File

@ -54,7 +54,7 @@ title="Tutorial: Standalone React Application"
Create a new React monorepo with the following command: Create a new React monorepo with the following command:
```{% command="npx create-nx-workspace@latest react-monorepo --preset=react-monorepo" path="~" %} ```{% 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 ✔ Application name · react-store
✔ Which bundler would you like to use? · vite ✔ 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" %} ```{% command="npx nx list @nx/react" path="react-monorepo" %}
> NX Capabilities in @nx/react: NX Capabilities in @nx/react:
GENERATORS 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. 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" %} ```{% 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 ✔ Would you like to add React Router to this application? (y/N) · false
✔ Which E2E test runner would you like to use? · cypress ✔ Which E2E test runner would you like to use? · cypress
@ -704,7 +704,6 @@ 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. 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" %} ```{% 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 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:lint [existing outputs match the cache, left as is]
✔ nx run react-store:test [existing outputs match the cache, left as is] ✔ nx run react-store:test [existing outputs match the cache, left as is]
@ -712,7 +711,7 @@ Note that all of these targets are automatically cached by Nx. If you re-run a s
—————————————————————————————————————————————————————— ——————————————————————————————————————————————————————
> 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.
``` ```
@ -861,7 +860,6 @@ nx graph --affected
If you're ready and want to ship your applications, you can build them using 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" %} ```{% command="npx nx run-many -t build" path="react-monorepo" %}
// todo
vite v4.3.5 building for production... vite v4.3.5 building for production...
✓ 33 libs transformed. ✓ 33 libs transformed.
dist/react-store/index.html 0.48 kB │ gzip: 0.30 kB dist/react-store/index.html 0.48 kB │ gzip: 0.30 kB
@ -871,7 +869,7 @@ dist/react-store/assets/index-378e8124.js 165.64 kB │ gzip: 51.63 kB
—————————————————————————————————————————————————————————————————————————————————————————————————————————— ——————————————————————————————————————————————————————————————————————————————————————————————————————————
> 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. All the required files will be placed in `dist/react-store` and `dist/inventory` and can be deployed to your favorite hosting provider.
@ -1029,7 +1027,7 @@ export default ProductList;
If you lint your workspace you'll get an error now: If you lint your workspace you'll get an error now:
```{% command="nx run-many -t lint" %} ```{% command="nx run-many -t lint" %}
> NX Running target lint for 7 projects Running target lint for 7 projects
✖ nx run products:lint ✖ nx run products:lint
Linting "products"... Linting "products"...
@ -1053,7 +1051,7 @@ If you lint your workspace you'll get an error now:
———————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— ————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
> 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]

View File

@ -30,19 +30,19 @@ 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. 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"%} ```{% 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 ✔ 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 ✔ Would you like remote caching to make your build faster? · Yes
> NX 📦 Installing dependencies NX 📦 Installing dependencies
> NX 🎉 Done! NX 🎉 Done!
- Enabled computation caching! - Enabled computation caching!
- Learn more at https://nx.dev/recipes/adopting-nx/adding-to-existing-project. - Learn more at https://nx.dev/recipes/adopting-nx/adding-to-existing-project.
@ -93,7 +93,7 @@ The command below uses the `as-provided` directory flag behavior, which is the d
{% /callout %} {% /callout %}
```{% command="nx g @nx/js:lib ui --directory=libs/ui --simpleName --minimal" path="~/astro-app"} ```{% 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 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 ✔ Which bundler would you like to use to build the library? Choose 'none' to skip build setup. · none

View File

@ -163,17 +163,17 @@ It may take a few minutes.
✔ Do you want to update to TypeScript v5.0? (Y/n) · false ✔ 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 ✔ 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. - package.json has been updated.
- migrations.json has been generated. - 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', - Make sure package.json changes make sense and then run 'pnpm install --no-frozen-lockfile',
- Run 'pnpm exec nx migrate --run-migrations' - 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: - 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 - 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 - To learn more go to https://nx.dev/recipes/other/advanced-update
- You may run 'pnpm run nx connect' to get faster builds, GitHub integration, and more. Check out https://nx.app - You may run 'pnpm run nx connect' to get faster builds, GitHub integration, and more. Check out https://nx.app
``` ```

View File

@ -10,7 +10,7 @@ Run the following command with the options listed to create an empty workspace.
```{% command="npx create-nx-workspace@latest" path="~" %} ```{% 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 ✔ Where would you like to create your workspace? · myorg
✔ Which stack do you want to use? · none ✔ Which stack do you want to use? · none

View File

@ -20,7 +20,7 @@ To generate just a host application in your workspace, run the following command
{% tab label="React" %} {% tab label="React" %}
```{% command="nx g @nx/react:host shell --directory=apps/react/shell" %} ```{% 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/app/app.spec.tsx
CREATE apps/react/shell/src/assets/.gitkeep CREATE apps/react/shell/src/assets/.gitkeep
@ -50,7 +50,7 @@ CREATE apps/react/shell/webpack.config.prod.ts
{% tab label="Angular" %} {% tab label="Angular" %}
```{% command="nx g @nx/angular:host shell --directory=apps/angular/shell" %} ```{% 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/project.json
CREATE apps/angular/shell/src/assets/.gitkeep 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" %} {% tab label="React" %}
```{% command="nx g @nx/react:host shell-with-remotes --directory=apps/react/with-remotes/shell --remotes=remote1,remote2" %} ```{% 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/app/app.spec.tsx
CREATE apps/react/with-remotes/shell/src/assets/.gitkeep CREATE apps/react/with-remotes/shell/src/assets/.gitkeep

View File

@ -18,7 +18,7 @@ To generate a remote application in your workspace, run the following command:
{% tab label="React" %} {% tab label="React" %}
```{% command="nx g @nx/react:remote myremote --directory=apps/react/myremote" %} ```{% 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/app/app.spec.tsx
CREATE apps/react/myremote/src/assets/.gitkeep CREATE apps/react/myremote/src/assets/.gitkeep
@ -50,7 +50,7 @@ UPDATE tsconfig.base.json
{% tab label="Angular" %} {% tab label="Angular" %}
```{% command="nx g @nx/angular:remote myremote --directory=apps/angular/myremote" %} ```{% 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/project.json
CREATE apps/angular/myremote/src/assets/.gitkeep CREATE apps/angular/myremote/src/assets/.gitkeep
@ -126,7 +126,7 @@ The command would look like the following:
{% tab label="React" %} {% tab label="React" %}
```{% command="nx g @nx/react:remote myremote --directory=apps/react/myremote --host=shell" %} ```{% 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/app/app.spec.tsx
CREATE apps/react/myremote/src/assets/.gitkeep CREATE apps/react/myremote/src/assets/.gitkeep

View File

@ -59,14 +59,14 @@ An example partial output of running Nx Release with independent releases and co
```{% command="nx release" %} ```{% 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 🔍 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 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 📄 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 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 🔍 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". 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 ✍️ 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 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 🔍 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". pkg-3 📄 Resolved the current version as 0.4.0 from git tag "pkg-3@0.4.0".

View File

@ -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" %} ```{% 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 🔍 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 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" %} ```{% 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 🔍 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 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 ✔ 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 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 🔍 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 📄 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 ✍️ 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 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 🔍 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 pkg-3 📄 Resolved the current version as 0.0.1 from packages/pkg-3/package.json
@ -123,15 +123,15 @@ UPDATE packages/pkg-3/package.json [dry-run]
"dependencies": { "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. 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] 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. + 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. 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. Skipped publishing packages.
``` ```
@ -167,7 +167,7 @@ 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 ✔ 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-1
- pkg-2 - pkg-2
@ -243,7 +243,7 @@ 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
``` ```

View File

@ -24,7 +24,7 @@ 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. 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" %} ```{% 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-1
- pkg-2 - pkg-2
@ -100,7 +100,7 @@ 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 ## Publish in Github Actions

View File

@ -49,7 +49,7 @@ 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 ## Configuring a Root-Level Target
@ -91,7 +91,7 @@ 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.
``` ```

View File

@ -26,13 +26,13 @@ Here's the source code of the final result for this tutorial.
Create a new Vue application with the following command: Create a new Vue application with the following command:
```{% command="npx create-nx-workspace@latest myvueapp --preset=vue-standalone" path="~" %} ```{% 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 ✔ Test runner to use for end to end (E2E) tests · cypress
✔ Default stylesheet format · css ✔ Default stylesheet format · css
✔ Set up CI with caching, distribution and test deflaking · github ✔ 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, 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. Nx will run "npm install" several times. Please wait.
@ -222,7 +222,7 @@ More conveniently, we can also run them in parallel using the following syntax:
—————————————————————————————————————————————————————— ——————————————————————————————————————————————————————
> NX Successfully ran targets test, lint, e2e for 2 projects (8s) NX Successfully ran targets test, lint, e2e for 2 projects (8s)
``` ```
### Caching ### Caching
@ -242,7 +242,7 @@ Note that all of these targets are automatically cached by Nx. If you re-run a s
——————————————————————————————————————————————————————— ———————————————————————————————————————————————————————
> 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.
``` ```
@ -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" %} ```{% command="npx nx list @nx/vue" path="myvueapp" %}
> NX Capabilities in @nx/vue: NX Capabilities in @nx/vue:
GENERATORS 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. 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" %} ```{% 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.spec.ts
CREATE src/components/hello-world.vue CREATE src/components/hello-world.vue
@ -333,7 +333,7 @@ dist/myvueapp/assets/index-46a11b5f.js 62.39 kB │ gzip: 24.35 kB
————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— —————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
> 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. All the required files will be placed in the `dist/myvueapp` folder and can be deployed to your favorite hosting provider.
@ -827,7 +827,7 @@ import { Orders } from 'orders';
If you lint your workspace you'll get an error now: If you lint your workspace you'll get an error now:
```{% command="nx run-many -t lint" %} ```{% command="nx run-many -t lint" %}
> NX Running target lint for 5 projects NX Running target lint for 5 projects
✖ nx run products:lint ✖ nx run products:lint
Linting "products"... Linting "products"...
@ -849,7 +849,7 @@ If you lint your workspace you'll get an error now:
—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— ——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
> 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]

View File

@ -42,7 +42,7 @@ describe('Lerna Smoke Tests', () => {
result = result.replace(/.*\/node_modules\/.*\n/, ''); // yarn adds "$ /node_modules/.bin/lerna repair" to the output result = result.replace(/.*\/node_modules\/.*\n/, ''); // yarn adds "$ /node_modules/.bin/lerna repair" to the output
expect(result).toMatchInlineSnapshot(` 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

View File

@ -115,10 +115,10 @@ describe('nx release create github release', () => {
const result = runCLI('release patch -d --first-release --verbose'); const result = runCLI('release patch -d --first-release --verbose');
expect( expect(
result.match(new RegExp(`> NX Pushing to git remote`, 'g')).length result.match(new RegExp(`NX Pushing to git remote`, 'g')).length
).toEqual(1); ).toEqual(1);
expect( expect(
result.match(new RegExp(`> NX Creating GitHub Release`, 'g')).length result.match(new RegExp(`NX Creating GitHub Release`, 'g')).length
).toEqual(1); ).toEqual(1);
// should have two occurrences of each - one for the changelog file, one for the github release // should have two occurrences of each - one for the changelog file, one for the github release
@ -149,10 +149,10 @@ describe('nx release create github release', () => {
const result = runCLI('release -d --first-release --verbose'); const result = runCLI('release -d --first-release --verbose');
expect( expect(
result.match(new RegExp(`> NX Pushing to git remote`, 'g')).length result.match(new RegExp(`NX Pushing to git remote`, 'g')).length
).toEqual(1); ).toEqual(1);
expect( expect(
result.match(new RegExp(`> NX Creating GitHub Release`, 'g')).length result.match(new RegExp(`NX Creating GitHub Release`, 'g')).length
).toEqual(3); ).toEqual(3);
// should have one occurrence of each because files are disabled // should have one occurrence of each because files are disabled

View File

@ -120,12 +120,12 @@ describe('nx release - independent projects', () => {
); );
expect(versionPkg1Output).toMatchInlineSnapshot(` expect(versionPkg1Output).toMatchInlineSnapshot(`
> NX Your filter "{project-name}" matched the following projects: NX Your filter "{project-name}" matched the following projects:
- {project-name} - {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} 🔍 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 {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": { "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(` expect(versionPkg2Output).toMatchInlineSnapshot(`
> NX Your filter "{project-name}" matched the following projects: NX Your filter "{project-name}" matched the following projects:
- {project-name} - {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} 🔍 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 {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(` expect(versionPkg3Output).toMatchInlineSnapshot(`
> NX Your filter "{project-name}" matched the following projects: NX Your filter "{project-name}" matched the following projects:
- {project-name} - {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} 🔍 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 {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(` expect(versionWithGitActionsCLIOutput).toMatchInlineSnapshot(`
> NX Your filter "{project-name}" matched the following projects: NX Your filter "{project-name}" matched the following projects:
- {project-name} - {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} 🔍 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 {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": { "scripts": {
> NX Updating {package-manager} lock file NX Updating {package-manager} lock file
Updating {lock-file} with the following command: Updating {lock-file} with the following command:
{lock-file-command} {lock-file-command}
> NX Committing changes with git NX Committing changes with git
Staging files in git with the following command: Staging files in git with the following command:
git add {project-name}/package.json {lock-file} 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: 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 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: 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 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(` 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} 🔍 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} 📄 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} 📄 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 {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} 🔍 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} 📄 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} 📄 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 {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} 🔍 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 {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": { "scripts": {
> NX Updating {package-manager} lock file NX Updating {package-manager} lock file
Updating {lock-file} with the following command: Updating {lock-file} with the following command:
{lock-file-command} {lock-file-command}
> NX Updating {package-manager} lock file NX Updating {package-manager} lock file
Updating {lock-file} with the following command: Updating {lock-file} with the following command:
{lock-file-command} {lock-file-command}
> NX Committing changes with git NX Committing changes with git
Staging files in git with the following command: Staging files in git with the following command:
git add {project-name}/package.json {project-name}/package.json {project-name}/package.json {lock-file} 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: 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 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: 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 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(` expect(changelogPkg1Output).toMatchInlineSnapshot(`
> NX Your filter "{project-name}" matched the following projects: NX Your filter "{project-name}" matched the following projects:
- {project-name} - {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) + ## 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. + 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(` expect(changelogPkg2Output).toMatchInlineSnapshot(`
> NX Your filter "{project-name}" matched the following projects: NX Your filter "{project-name}" matched the following projects:
- {project-name} - {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) + ## 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. + 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(` expect(changelogPkg3Output).toMatchInlineSnapshot(`
> NX Your filter "{project-name}" matched the following projects: NX Your filter "{project-name}" matched the following projects:
- {project-name} - {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) + ## 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. + 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(` expect(versionWithGitActionsCLIOutput).toMatchInlineSnapshot(`
> NX Your filter "{project-name}" matched the following projects: NX Your filter "{project-name}" matched the following projects:
- {project-name} - {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) + ## 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. + 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: Staging files in git with the following command:
git add {project-name}/CHANGELOG.md git add {project-name}/CHANGELOG.md
@ -545,7 +545,7 @@ describe('nx release - independent projects', () => {
Committing files in git with the following command: 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 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: 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 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 // Should only contain 1 project
expect(runCLI(`release publish -p ${pkg1} -d`)).toMatchInlineSnapshot(` 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") - {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} - {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`)) expect(runCLI(`release publish -p ${pkg1} -p ${pkg3} -d`))
.toMatchInlineSnapshot(` .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 "group1")
- {project-name} (release group "group2") - {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} - {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} - {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 // Should only contain the 2 projects from group1
expect(runCLI(`release publish -g group1 -d`)).toMatchInlineSnapshot(` 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}
- {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 // Should only contain the 1 project from group2
expect(runCLI(`release publish -g group2 -d`)).toMatchInlineSnapshot(` 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} - {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}

View File

@ -104,12 +104,12 @@ describe('nx release - private JS packages', () => {
const publicPkg1PublishOutput = runCLI(`release publish -p ${publicPkg1}`); const publicPkg1PublishOutput = runCLI(`release publish -p ${publicPkg1}`);
expect(publicPkg1PublishOutput).toMatchInlineSnapshot(` 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} - {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} - {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}`); const publicPkg2PublishOutput = runCLI(`release publish -p ${publicPkg2}`);
expect(publicPkg2PublishOutput).toMatchInlineSnapshot(` 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} - {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} - {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(` 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} - {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} - {private-project-name}

View File

@ -173,7 +173,7 @@ ${JSON.stringify(
const changelogOutput = runCLI(`release changelog 999.9.9`); const changelogOutput = runCLI(`release changelog 999.9.9`);
expect(changelogOutput).toMatchInlineSnapshot(` 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) + ## 999.9.9 (YYYY-MM-DD)
@ -188,10 +188,10 @@ ${JSON.stringify(
+ - Test @{COMMIT_AUTHOR} + - 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`); const publishOutput = runCLI(`release publish`);
expect(publishOutput).toMatchInlineSnapshot(` 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}
- {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`); const publishOutput2 = runCLI(`${publishToNext} --dry-run`);
expect(publishOutput2).toMatchInlineSnapshot(` 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}
- {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); const publishOutput3 = runCLI(publishToNext);
expect(publishOutput3).toMatchInlineSnapshot(` 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}
- {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); const publishOutput3Repeat = runCLI(publishToNext);
expect(publishOutput3Repeat).toMatchInlineSnapshot(` 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}
- {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(` 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}
- {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(` 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 an entry in {project-name}/CHANGELOG.md for v1000.0.0-next.0 NX Previewing an entry in {project-name}/CHANGELOG.md for v1000.0.0-next.0
+ ## 1000.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. + This was a version bump only for {project-name} to align it with other projects, there were no code changes.
> NX Previewing an entry in {project-name}/CHANGELOG.md for v1000.0.0-next.0 NX Previewing an entry in {project-name}/CHANGELOG.md for v1000.0.0-next.0
+ ## 1000.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. + This was a version bump only for {project-name} to align it with other projects, there were no code changes.
> NX Previewing an entry in {project-name}/CHANGELOG.md for v1000.0.0-next.0 NX Previewing an entry in {project-name}/CHANGELOG.md for v1000.0.0-next.0
+ ## 1000.0.0-next.0 + ## 1000.0.0-next.0
@ -750,16 +750,16 @@ ${JSON.stringify(
+ This was a version bump only for {project-name} to align it with other projects, there were no code changes. + 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
> NX Pushing to git remote NX Pushing to git remote
> NX Creating GitHub Release NX Creating GitHub Release
+ ## 1000.0.0-next.0 + ## 1000.0.0-next.0
@ -767,7 +767,7 @@ ${JSON.stringify(
+ This was a version bump only for {project-name} to align it with other projects, there were no code changes. + This was a version bump only for {project-name} to align it with other projects, there were no code changes.
> NX Creating GitHub Release NX Creating GitHub Release
+ ## 1000.0.0-next.0 + ## 1000.0.0-next.0
@ -775,7 +775,7 @@ ${JSON.stringify(
+ This was a version bump only for {project-name} to align it with other projects, there were no code changes. + This was a version bump only for {project-name} to align it with other projects, there were no code changes.
> NX Creating GitHub Release NX Creating GitHub Release
+ ## 1000.0.0-next.0 + ## 1000.0.0-next.0
@ -1112,11 +1112,11 @@ ${JSON.stringify(
expect(releaseOutput4a).toMatchInlineSnapshot(` 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 {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.
`); `);

View File

@ -46,7 +46,7 @@ export async function setupNxCloud(
export function printNxCloudSuccessMessage(nxCloudOut: string) { export function printNxCloudSuccessMessage(nxCloudOut: string) {
// remove leading Nx carret and any new lines // remove leading Nx carret and any new lines
const logContent = nxCloudOut.split('> NX ')[1]; const logContent = nxCloudOut.split('NX ')[1];
const indexOfTitleEnd = logContent.indexOf('\n'); const indexOfTitleEnd = logContent.indexOf('\n');
const title = logContent.slice(0, logContent.indexOf('\n')).trim(); const title = logContent.slice(0, logContent.indexOf('\n')).trim();
const bodyLines = logContent const bodyLines = logContent

View File

@ -35,19 +35,13 @@ if (isCI()) {
} }
class CLIOutput { class CLIOutput {
readonly X_PADDING = ' ';
/** /**
* Longer dash character which forms more of a continuous line when place side to side * Longer dash character which forms more of a continuous line when place side to side
* with itself, unlike the standard dash character * with itself, unlike the standard dash character
*/ */
private get VERTICAL_SEPARATOR() { private get VERTICAL_SEPARATOR() {
let divider = ''; let divider = '';
for ( for (let i = 0; i < process.stdout.columns - 1; i++) {
let i = 0;
i < process.stdout.columns - this.X_PADDING.length * 2;
i++
) {
divider += '\u2014'; divider += '\u2014';
} }
return divider; return divider;
@ -100,13 +94,9 @@ class CLIOutput {
applyCLIPrefix(color = 'cyan', text: string): string { applyCLIPrefix(color = 'cyan', text: string): string {
let cliPrefix = ''; let cliPrefix = '';
if ((chalk as any)[color]) { if ((chalk as any)[color]) {
cliPrefix = `${(chalk as any)[color]('>')} ${( cliPrefix = (chalk as any).reset.inverse.bold[color](` ${this.cliName} `);
chalk as any
).reset.inverse.bold[color](` ${this.cliName} `)}`;
} else { } else {
cliPrefix = `${chalk.keyword(color)( cliPrefix = chalk.reset.inverse.bold.keyword(color)(` ${this.cliName} `);
'>'
)} ${chalk.reset.inverse.bold.keyword(color)(` ${this.cliName} `)}`;
} }
return `${cliPrefix} ${text}`; return `${cliPrefix} ${text}`;
} }
@ -123,9 +113,7 @@ class CLIOutput {
addVerticalSeparatorWithoutNewLines(color = 'gray') { addVerticalSeparatorWithoutNewLines(color = 'gray') {
this.writeToStdOut( this.writeToStdOut(
`${this.X_PADDING}${(chalk as any).dim[color]( `${(chalk as any).dim[color](this.VERTICAL_SEPARATOR)}${EOL}`
this.VERTICAL_SEPARATOR
)}${EOL}`
); );
} }

View File

@ -10,6 +10,9 @@ import { prettyTime } from './pretty-time';
import { formatFlags, formatTargetsAndProjects } from './formatting-utils'; import { formatFlags, formatTargetsAndProjects } from './formatting-utils';
import { viewLogsFooterRows } from './view-logs-utils'; import { viewLogsFooterRows } from './view-logs-utils';
const LEFT_PAD = ` `;
const EXTENDED_LEFT_PAD = ` `;
/** /**
* The following function is responsible for creating a life cycle with dynamic * The following function is responsible for creating a life cycle with dynamic
* outputs, meaning previous outputs can be rewritten or modified as new outputs * outputs, meaning previous outputs can be rewritten or modified as new outputs
@ -99,7 +102,7 @@ export async function createRunManyDynamicOutputRenderer({
// Create vertical breathing room for cursor position under the pinned footer // Create vertical breathing room for cursor position under the pinned footer
lines.push(''); lines.push('');
for (const line of lines) { for (const line of lines) {
output.overwriteLine(output.X_PADDING + line); output.overwriteLine(line);
} }
pinnedFooterNumLines = lines.length + additionalLines; pinnedFooterNumLines = lines.length + additionalLines;
// clear any possible text below the cursor's position // clear any possible text below the cursor's position
@ -194,7 +197,7 @@ export async function createRunManyDynamicOutputRenderer({
if (runningTasks.length > 0) { if (runningTasks.length > 0) {
additionalFooterRows.push( additionalFooterRows.push(
output.dim( output.dim(
` ${output.colors.cyan(figures.arrowRight)} Executing ${ `${LEFT_PAD}${output.colors.cyan(figures.arrowRight)} Executing ${
runningTasks.length runningTasks.length
}/${remainingTasks} remaining tasks${ }/${remainingTasks} remaining tasks${
runningTasks.length > 1 ? ' in parallel' : '' runningTasks.length > 1 ? ' in parallel' : ''
@ -204,7 +207,7 @@ export async function createRunManyDynamicOutputRenderer({
additionalFooterRows.push(''); additionalFooterRows.push('');
for (const runningTask of runningTasks) { for (const runningTask of runningTasks) {
additionalFooterRows.push( additionalFooterRows.push(
` ${output.dim.cyan( `${LEFT_PAD}${output.dim.cyan(
dots.frames[currentFrame] dots.frames[currentFrame]
)} ${output.formatCommand(runningTask.task.id)}` )} ${output.formatCommand(runningTask.task.id)}`
); );
@ -236,7 +239,7 @@ export async function createRunManyDynamicOutputRenderer({
if (totalSuccessfulTasks > 0) { if (totalSuccessfulTasks > 0) {
additionalFooterRows.push( additionalFooterRows.push(
` ${output.colors.green( `${LEFT_PAD}${output.colors.green(
figures.tick figures.tick
)} ${totalSuccessfulTasks}${`/${totalCompletedTasks}`} succeeded ${output.dim( )} ${totalSuccessfulTasks}${`/${totalCompletedTasks}`} succeeded ${output.dim(
`[${totalCachedTasks} read from cache]` `[${totalCachedTasks} read from cache]`
@ -246,7 +249,7 @@ export async function createRunManyDynamicOutputRenderer({
if (totalFailedTasks > 0) { if (totalFailedTasks > 0) {
additionalFooterRows.push( additionalFooterRows.push(
` ${output.colors.red( `${LEFT_PAD}${output.colors.red(
figures.cross figures.cross
)} ${totalFailedTasks}${`/${totalCompletedTasks}`} failed` )} ${totalFailedTasks}${`/${totalCompletedTasks}`} failed`
); );
@ -262,14 +265,13 @@ export async function createRunManyDynamicOutputRenderer({
)}`; )}`;
const taskOverridesRows = []; const taskOverridesRows = [];
if (Object.keys(overrides).length > 0) { if (Object.keys(overrides).length > 0) {
const leftPadding = `${output.X_PADDING} `;
taskOverridesRows.push(''); taskOverridesRows.push('');
taskOverridesRows.push( taskOverridesRows.push(
`${leftPadding}${output.dim.cyan('With additional flags:')}` `${EXTENDED_LEFT_PAD}${output.dim.cyan('With additional flags:')}`
); );
Object.entries(overrides) Object.entries(overrides)
.map(([flag, value]) => .map(([flag, value]) =>
output.dim.cyan(formatFlags(leftPadding, flag, value)) output.dim.cyan(formatFlags(EXTENDED_LEFT_PAD, flag, value))
) )
.forEach((arg) => taskOverridesRows.push(arg)); .forEach((arg) => taskOverridesRows.push(arg));
} }
@ -323,14 +325,13 @@ export async function createRunManyDynamicOutputRenderer({
)}`; )}`;
const taskOverridesRows = []; const taskOverridesRows = [];
if (Object.keys(overrides).length > 0) { if (Object.keys(overrides).length > 0) {
const leftPadding = `${output.X_PADDING} `;
taskOverridesRows.push(''); taskOverridesRows.push('');
taskOverridesRows.push( taskOverridesRows.push(
`${leftPadding}${output.dim.green('With additional flags:')}` `${EXTENDED_LEFT_PAD}${output.dim.green('With additional flags:')}`
); );
Object.entries(overrides) Object.entries(overrides)
.map(([flag, value]) => .map(([flag, value]) =>
output.dim.green(formatFlags(leftPadding, flag, value)) output.dim.green(formatFlags(EXTENDED_LEFT_PAD, flag, value))
) )
.forEach((arg) => taskOverridesRows.push(arg)); .forEach((arg) => taskOverridesRows.push(arg));
} }
@ -358,14 +359,13 @@ export async function createRunManyDynamicOutputRenderer({
)}`; )}`;
const taskOverridesRows = []; const taskOverridesRows = [];
if (Object.keys(overrides).length > 0) { if (Object.keys(overrides).length > 0) {
const leftPadding = `${output.X_PADDING} `;
taskOverridesRows.push(''); taskOverridesRows.push('');
taskOverridesRows.push( taskOverridesRows.push(
`${leftPadding}${output.dim.red('With additional flags:')}` `${EXTENDED_LEFT_PAD}${output.dim.red('With additional flags:')}`
); );
Object.entries(overrides) Object.entries(overrides)
.map(([flag, value]) => .map(([flag, value]) =>
output.dim.red(formatFlags(leftPadding, flag, value)) output.dim.red(formatFlags(EXTENDED_LEFT_PAD, flag, value))
) )
.forEach((arg) => taskOverridesRows.push(arg)); .forEach((arg) => taskOverridesRows.push(arg));
} }
@ -383,22 +383,22 @@ export async function createRunManyDynamicOutputRenderer({
...taskOverridesRows, ...taskOverridesRows,
'', '',
output.dim( output.dim(
` ${output.dim( `${LEFT_PAD}${output.dim(
figures.tick figures.tick
)} ${totalSuccessfulTasks}${`/${totalCompletedTasks}`} succeeded ${output.dim( )} ${totalSuccessfulTasks}${`/${totalCompletedTasks}`} succeeded ${output.dim(
`[${totalCachedTasks} read from cache]` `[${totalCachedTasks} read from cache]`
)}` )}`
), ),
'', '',
` ${output.colors.red( `${LEFT_PAD}${output.colors.red(
figures.cross figures.cross
)} ${totalFailedTasks}${`/${totalCompletedTasks}`} targets failed, including the following:`, )} ${totalFailedTasks}${`/${totalCompletedTasks}`} targets failed, including the following:`,
`${failedTasksForPrinting `${failedTasksForPrinting
.map( .map(
(t) => (t) =>
` ${output.colors.red('-')} ${output.formatCommand( `${EXTENDED_LEFT_PAD}${output.colors.red(
t.toString() '-'
)}` )} ${output.formatCommand(t.toString())}`
) )
.join('\n ')}`, .join('\n ')}`,
]; ];
@ -406,7 +406,9 @@ export async function createRunManyDynamicOutputRenderer({
if (failedTasks.size > numFailedToPrint) { if (failedTasks.size > numFailedToPrint) {
failureSummaryRows.push( failureSummaryRows.push(
output.dim( output.dim(
` ...and ${failedTasks.size - numFailedToPrint} more...` `${EXTENDED_LEFT_PAD}...and ${
failedTasks.size - numFailedToPrint
} more...`
) )
); );
} }
@ -467,8 +469,7 @@ export async function createRunManyDynamicOutputRenderer({
} }
function writeCompletedTaskResultLine(line: string) { function writeCompletedTaskResultLine(line: string) {
const additionalXPadding = ' '; output.overwriteLine(LEFT_PAD + line);
output.overwriteLine(output.X_PADDING + additionalXPadding + line);
} }
/** /**
@ -480,7 +481,6 @@ function writeCompletedTaskResultLine(line: string) {
function writeCommandOutputBlock(commandOutput: string) { function writeCommandOutputBlock(commandOutput: string) {
commandOutput = commandOutput || ''; commandOutput = commandOutput || '';
commandOutput = commandOutput.trimStart(); commandOutput = commandOutput.trimStart();
const additionalXPadding = ' ';
const lines = commandOutput.split(EOL); const lines = commandOutput.split(EOL);
let totalTrailingEmptyLines = 0; let totalTrailingEmptyLines = 0;
for (let i = lines.length - 1; i >= 0; i--) { for (let i = lines.length - 1; i >= 0; i--) {
@ -495,7 +495,5 @@ function writeCommandOutputBlock(commandOutput: string) {
} }
lines.push(''); lines.push('');
// Indent the command output to make it look more "designed" in the context of the dynamic output // Indent the command output to make it look more "designed" in the context of the dynamic output
lines.forEach((l) => lines.forEach((l) => output.overwriteLine(`${EXTENDED_LEFT_PAD}${l}`));
output.overwriteLine(`${output.X_PADDING}${additionalXPadding}${l}`)
);
} }

View File

@ -9,6 +9,9 @@ import { Task } from '../../config/task-graph';
import { formatFlags, formatTargetsAndProjects } from './formatting-utils'; import { formatFlags, formatTargetsAndProjects } from './formatting-utils';
import { viewLogsFooterRows } from './view-logs-utils'; import { viewLogsFooterRows } from './view-logs-utils';
const LEFT_PAD = ` `;
const EXTENDED_LEFT_PAD = ` `;
/** /**
* As tasks are completed the overall state moves from: * As tasks are completed the overall state moves from:
* 1. EXECUTING_DEPENDENT_TARGETS (dynamic lines, including a spinner are reprinted, task outputs not shown) * 1. EXECUTING_DEPENDENT_TARGETS (dynamic lines, including a spinner are reprinted, task outputs not shown)
@ -98,8 +101,7 @@ export async function createRunOneDynamicOutputRenderer({
const renderLines = ( const renderLines = (
lines: string[], lines: string[],
dividerColor = 'cyan', dividerColor = 'cyan',
renderDivider = true, renderDivider = true
skipPadding = false
) => { ) => {
let additionalLines = 0; let additionalLines = 0;
if (renderDivider) { if (renderDivider) {
@ -111,7 +113,7 @@ export async function createRunOneDynamicOutputRenderer({
lines.push(''); lines.push('');
} }
for (const line of lines) { for (const line of lines) {
output.overwriteLine((skipPadding ? '' : output.X_PADDING) + line); output.overwriteLine(line);
} }
dependentTargetsNumLines = lines.length + additionalLines; dependentTargetsNumLines = lines.length + additionalLines;
// clear any possible text below the cursor's position // clear any possible text below the cursor's position
@ -134,7 +136,7 @@ export async function createRunOneDynamicOutputRenderer({
case 'EXECUTING_DEPENDENT_TARGETS': case 'EXECUTING_DEPENDENT_TARGETS':
if (totalFailedTasks === 0) { if (totalFailedTasks === 0) {
linesToRender.push( linesToRender.push(
` ${output.colors.cyan( `${LEFT_PAD}${output.colors.cyan(
dots.frames[dependentTargetsCurrentFrame] dots.frames[dependentTargetsCurrentFrame]
)} ${output.dim( )} ${output.dim(
`Nx is waiting on ${remainingDependentTasksNotFromInitiatingProject} dependent project tasks before running tasks from` `Nx is waiting on ${remainingDependentTasksNotFromInitiatingProject} dependent project tasks before running tasks from`
@ -150,7 +152,7 @@ export async function createRunOneDynamicOutputRenderer({
if (totalFailedTasks > 0) { if (totalFailedTasks > 0) {
linesToRender.push( linesToRender.push(
output.colors.red.dim( output.colors.red.dim(
` ${output.colors.red( `${LEFT_PAD}${output.colors.red(
figures.cross figures.cross
)} ${totalFailedTasks}${`/${totalCompletedTasks}`} dependent project tasks failed (see below)` )} ${totalFailedTasks}${`/${totalCompletedTasks}`} dependent project tasks failed (see below)`
) )
@ -160,7 +162,7 @@ export async function createRunOneDynamicOutputRenderer({
if (totalSuccessfulTasks > 0) { if (totalSuccessfulTasks > 0) {
linesToRender.push( linesToRender.push(
output.dim( output.dim(
` ${output.dim( `${LEFT_PAD}${output.dim(
figures.tick figures.tick
)} ${totalSuccessfulTasks}${`/${totalCompletedTasks}`} dependent project tasks succeeded ${output.dim( )} ${totalSuccessfulTasks}${`/${totalCompletedTasks}`} dependent project tasks succeeded ${output.dim(
`[${totalCachedTasks} read from cache]` `[${totalCachedTasks} read from cache]`
@ -175,8 +177,7 @@ export async function createRunOneDynamicOutputRenderer({
renderLines( renderLines(
linesToRender, linesToRender,
'gray', 'gray',
renderDivider && state !== 'EXECUTING_DEPENDENT_TARGETS', renderDivider && state !== 'EXECUTING_DEPENDENT_TARGETS'
true
); );
} else { } else {
renderLines([]); renderLines([]);
@ -200,7 +201,7 @@ export async function createRunOneDynamicOutputRenderer({
if (totalDependentTasksNotFromInitiatingProject > 0) { if (totalDependentTasksNotFromInitiatingProject > 0) {
output.addNewline(); output.addNewline();
process.stdout.write( process.stdout.write(
` ${output.dim( `${LEFT_PAD}${output.dim(
'Hint: you can run the command with' 'Hint: you can run the command with'
)} --verbose ${output.dim( )} --verbose ${output.dim(
'to see the full dependent project outputs' 'to see the full dependent project outputs'
@ -280,14 +281,13 @@ export async function createRunOneDynamicOutputRenderer({
const taskOverridesLines = []; const taskOverridesLines = [];
if (Object.keys(overrides).length > 0) { if (Object.keys(overrides).length > 0) {
const leftPadding = `${output.X_PADDING} `;
taskOverridesLines.push(''); taskOverridesLines.push('');
taskOverridesLines.push( taskOverridesLines.push(
`${leftPadding}${output.dim.green('With additional flags:')}` `${EXTENDED_LEFT_PAD}${output.dim.green('With additional flags:')}`
); );
Object.entries(overrides) Object.entries(overrides)
.map(([flag, value]) => .map(([flag, value]) =>
output.dim.green(formatFlags(leftPadding, flag, value)) output.dim.green(formatFlags(EXTENDED_LEFT_PAD, flag, value))
) )
.forEach((arg) => taskOverridesLines.push(arg)); .forEach((arg) => taskOverridesLines.push(arg));
} }
@ -321,14 +321,13 @@ export async function createRunOneDynamicOutputRenderer({
const taskOverridesLines = []; const taskOverridesLines = [];
if (Object.keys(overrides).length > 0) { if (Object.keys(overrides).length > 0) {
const leftPadding = `${output.X_PADDING} `;
taskOverridesLines.push(''); taskOverridesLines.push('');
taskOverridesLines.push( taskOverridesLines.push(
`${leftPadding}${output.dim.red('With additional flags:')}` `${EXTENDED_LEFT_PAD}${output.dim.red('With additional flags:')}`
); );
Object.entries(overrides) Object.entries(overrides)
.map(([flag, value]) => .map(([flag, value]) =>
output.dim.red(formatFlags(leftPadding, flag, value)) output.dim.red(formatFlags(EXTENDED_LEFT_PAD, flag, value))
) )
.forEach((arg) => taskOverridesLines.push(arg)); .forEach((arg) => taskOverridesLines.push(arg));
} }
@ -343,10 +342,10 @@ export async function createRunOneDynamicOutputRenderer({
), ),
...taskOverridesLines, ...taskOverridesLines,
'', '',
` ${output.colors.red( `${LEFT_PAD}${output.colors.red(
figures.cross figures.cross
)} ${totalFailedTasks}${`/${totalCompletedTasks}`} failed`, )} ${totalFailedTasks}${`/${totalCompletedTasks}`} failed`,
` ${output.dim( `${LEFT_PAD}${output.dim(
figures.tick figures.tick
)} ${totalSuccessfulTasks}${`/${totalCompletedTasks}`} succeeded ${output.dim( )} ${totalSuccessfulTasks}${`/${totalCompletedTasks}`} succeeded ${output.dim(
`[${totalCachedTasks} read from cache]` `[${totalCachedTasks} read from cache]`

View File

@ -6,7 +6,7 @@ const VIEW_LOGS_MESSAGE = `Hint: Try "nx view-logs" to get structured, searchabl
export function viewLogsFooterRows(failedTasks: number) { export function viewLogsFooterRows(failedTasks: number) {
if (failedTasks >= 2 && !isNxCloudUsed(readNxJson())) { if (failedTasks >= 2 && !isNxCloudUsed(readNxJson())) {
return [``, output.dim(`${output.X_PADDING} ${VIEW_LOGS_MESSAGE}`)]; return [``, output.dim(` ${VIEW_LOGS_MESSAGE}`)];
} else { } else {
return []; return [];
} }

View File

@ -1,8 +1,6 @@
import * as chalk from 'chalk'; import * as chalk from 'chalk';
export const NX_PREFIX = `${chalk.cyan('>')} ${chalk.inverse( export const NX_PREFIX = chalk.inverse(chalk.bold(chalk.cyan(' NX ')));
chalk.bold(chalk.cyan(' NX '))
)}`;
export const NX_ERROR = chalk.inverse(chalk.bold(chalk.red(' ERROR '))); export const NX_ERROR = chalk.inverse(chalk.bold(chalk.red(' ERROR ')));

View File

@ -39,7 +39,6 @@ if (isCI() && !forceColor) {
} }
class CLIOutput { class CLIOutput {
readonly X_PADDING = ' ';
cliName = 'NX'; cliName = 'NX';
formatCommand = (taskId: string) => `${chalk.dim('nx run')} ${taskId}`; formatCommand = (taskId: string) => `${chalk.dim('nx run')} ${taskId}`;
@ -49,11 +48,7 @@ class CLIOutput {
*/ */
private get VERTICAL_SEPARATOR() { private get VERTICAL_SEPARATOR() {
let divider = ''; let divider = '';
for ( for (let i = 0; i < process.stdout.columns - 1; i++) {
let i = 0;
i < process.stdout.columns - this.X_PADDING.length * 2;
i++
) {
divider += '\u2014'; divider += '\u2014';
} }
return divider; return divider;
@ -109,13 +104,9 @@ class CLIOutput {
applyNxPrefix(color = 'cyan', text: string): string { applyNxPrefix(color = 'cyan', text: string): string {
let nxPrefix = ''; let nxPrefix = '';
if (chalk[color]) { if (chalk[color]) {
nxPrefix = `${chalk[color]('>')} ${chalk.reset.inverse.bold[color]( nxPrefix = chalk.reset.inverse.bold[color](` ${this.cliName} `);
` ${this.cliName} `
)}`;
} else { } else {
nxPrefix = `${chalk.keyword(color)( nxPrefix = chalk.reset.inverse.bold.keyword(color)(` ${this.cliName} `);
'>'
)} ${chalk.reset.inverse.bold.keyword(color)(` ${this.cliName} `)}`;
} }
return `${nxPrefix} ${text}`; return `${nxPrefix} ${text}`;
} }
@ -139,7 +130,7 @@ class CLIOutput {
} }
private getVerticalSeparator(color: string): string { 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) { error({ title, slug, bodyLines }: CLIErrorMessageConfig) {

View File

@ -30,9 +30,7 @@ if (process.env.CI === 'true') {
} }
class CLIOutput { class CLIOutput {
private readonly NX_PREFIX = `${chalk.cyan( private readonly NX_PREFIX = chalk.reset.inverse.bold.cyan(' NX ');
'>'
)} ${chalk.reset.inverse.bold.cyan(' NX ')}`;
/** /**
* Longer dash character which forms more of a continuous line when place side to side * Longer dash character which forms more of a continuous line when place side to side
* with itself, unlike the standard dash character * with itself, unlike the standard dash character