Revert "feat(core): remove leading arrow from output headlines" (#21800)

This commit is contained in:
James Henry 2024-02-13 18:40:24 +04:00 committed by GitHub
parent c2a09c5043
commit 30d10d72f7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
39 changed files with 562 additions and 532 deletions

View File

@ -89,7 +89,7 @@ The command below uses the `as-provided` directory flag behavior, which is the d
{% /callout %}
```{% command="nx g @nx/remix:app myapp --directory=apps/myapp" path="~/acme" %}
NX Generating @nx/remix:application
> NX Generating @nx/remix:application
✔ What unit test runner should be used? · vitest
@ -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:
@ -166,7 +166,7 @@ Duration 1.20s (transform 51ms, setup 139ms, collect 180ms, tests 10ms, environ
——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
NX Successfully ran target test for project myapp (2s)
> NX Successfully ran target test for project myapp (2s)
```
## Generating an Nx Library
@ -176,7 +176,7 @@ When developing your application, it often makes sense to split your codebase in
To generate a library to use in your Remix application run:
```{% command="nx g @nx/remix:lib login --directory=libs/login" path="~/acme" %}
NX Generating @nx/remix:library
> NX Generating @nx/remix:library
✔ What test runner should be used? · vitest
UPDATE nx.json
@ -223,7 +223,7 @@ You can also run test on your library:
To generate a route for your application:
```{% command="nx g @nx/remix:route admin --path=apps/myapp/app/routes" path="~/acme" %}
NX Generating @nx/remix:route
> NX Generating @nx/remix:route
CREATE apps/myapp/app/routes/admin.tsx
CREATE apps/myapp/app/styles/admin.css
@ -236,7 +236,7 @@ To use a Route Loader where the logic lives in your library, follow the steps be
1. Generate a loader for your route:
```{% command="nx g @nx/remix:loader admin --path=apps/myapp/app/routes" path="~/acme" %}
NX Generating @nx/remix:loader
> NX Generating @nx/remix:loader
UPDATE apps/myapp/app/routes/admin.tsx
```

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.
@ -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
@ -336,14 +336,8 @@ 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:
```{% command="pnpm nx connect" %}
$ nx g nx:connect-to-nx-cloud --quiet --no-interactive
NX Your Nx Cloud workspace is public
To restrict access, connect it to your Nx Cloud account:
- Push your changes
- Login at https://cloud.nx.app to connect your repository
```shell
pnpm nx connect
```
Click the link in the terminal to claim your workspace on [nx.app](https://nx.app).
@ -375,7 +369,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.
```

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.
@ -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
@ -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.
```

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
@ -497,7 +497,7 @@ Note that all of these targets are automatically cached by Nx. If you re-run a s
———————————————————————————————————————————————————————
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.
```
@ -514,9 +514,9 @@ Generators allow you to easily scaffold code, configuration or entire projects.
```{% command="npx nx list @nx/angular" path="myngapp" %}
NX Capabilities in @nx/angular:
> NX Capabilities in @nx/angular:
NX Capabilities in @nx/angular:
> NX Capabilities in @nx/angular:
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.
```{% command="npx nx g @nx/angular:component hello-world --directory=src/app/hello-world --standalone --dry-run" path="myngapp" %}
NX Generating @nx/angular:component
> NX Generating @nx/angular:component
CREATE src/app/hello-world/hello-world.component.css
CREATE src/app/hello-world/hello-world.component.html
@ -616,7 +616,7 @@ Build at: 2023-05-23T14:00:31.981Z - Hash: 9086e92ce0bfefca - Time: 5228ms
——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
Successfully ran target build for project myngapp (7s)
> NX 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.
@ -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]

View File

@ -52,7 +52,7 @@ title="Tutorial: Standalone Angular Application"
Create a new Angular monorepo with the following command:
```{% command="npx create-nx-workspace@latest angular-monorepo --preset=angular-monorepo" path="~" %}
NX Let's create a new workspace [https://nx.dev/getting-started/intro]
> NX Let's create a new workspace [https://nx.dev/getting-started/intro]
✔ Application name · angular-store
✔ Which bundler would you like to use? · esbuild
@ -566,7 +566,7 @@ Nx plugins usually provide [generators](/features/generate-code) that allow you
```{% command="npx nx list @nx/angular" path="angular-monorepo" %}
NX Capabilities in @nx/angular:
> NX Capabilities in @nx/angular:
GENERATORS
@ -608,7 +608,7 @@ More info can be found in [the integrate with editors article](/features/integra
Run the following command to generate a new `inventory` application. Note how we append `--dry-run` to first check the output.
```{% command="npx nx g @nx/angular:app inventory --directory=apps/inventory --dry-run" path="angular-monorepo" %}
NX Generating @nx/angular:application
> NX Generating @nx/angular:application
✔ Would you like to configure routing for this application? (y/N) · false
✔ Would you like to use Standalone Components? (y/N) · true
@ -1009,6 +1009,7 @@ One thing to highlight is that Nx is able to [cache the tasks you run](/features
Note that all of these targets are automatically cached by Nx. If you re-run a single one or all of them again, you'll see that the task completes immediately. In addition, (as can be seen in the output example below) there will be a note that a matching cache result was found and therefore the task was not run again.
```{% command="nx run-many -t test lint e2e" path="angular-monorepo" %}
✔ nx run e2e:lint [existing outputs match the cache, left as is]
✔ nx run angular-store:lint [existing outputs match the cache, left as is]
✔ nx run angular-store:test [existing outputs match the cache, left as is]
@ -1016,7 +1017,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.
```
@ -1152,7 +1153,7 @@ nx graph --affected
If you're ready and want to ship your applications, you can build them using
```{% command="npx nx run-many -t build" path="angular-monorepo" %}
NX Generating @nx/angular:component
> NX Generating @nx/angular:component
CREATE libs/orders/src/lib/order-list/order-list.component.css
CREATE libs/orders/src/lib/order-list/order-list.component.html
@ -1166,7 +1167,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.
@ -1320,7 +1321,7 @@ export class ProductListComponent {}
If you lint your workspace you'll get an error now:
```{% command="nx run-many -t lint" %}
NX Running target lint for 7 projects
> NX Running target lint for 7 projects
✖ nx run products:lint
Linting "products"...
@ -1344,7 +1345,7 @@ NX Running target lint for 7 projects
———————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
NX Ran target lint for 7 projects (3s)
> NX Ran target lint for 7 projects (3s)
✔ 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

View File

@ -48,7 +48,7 @@ Update `packages/ascii/assets/cow.txt`:
```plaintext
_____
< moo >
< Hi! >
-----
\ ^__^
\ (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
```

View File

@ -103,7 +103,8 @@ ______________________________________________________
——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
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
```

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" %}
✔ Which generator would you like to use? · @nx/node:library
NX Generating @nx/node:library
> NX Generating @nx/node:library
? What should be the project name and where should it be generated? …
As provided:

View File

@ -27,17 +27,20 @@ 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
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.
NX Daemon Server - Stopped
NX Successfully reset the Nx workspace.
> NX Daemon Server - Stopped
> NX Successfully reset the Nx workspace.
> nx run header:build [remote cache]
@ -52,7 +55,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.

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="~" %}
NX Let's create a new workspace [https://nx.dev/getting-started/intro]
> NX Let's create a new workspace [https://nx.dev/getting-started/intro]
✔ Where would you like to create your workspace? · myorg
? Which stack do you want to use? …

View File

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

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
```{% command="npx create-nx-workspace acme --preset=apps" path="~/" %}
NX Let's create a new workspace [https://nx.dev/getting-started/intro]
> NX Let's create a new workspace [https://nx.dev/getting-started/intro]
✔ Do you want Nx Cloud to make your CI fast? · Yes
NX Creating your v16.3.2 workspace.
> NX Creating your v16.3.2 workspace.
To make sure the command works reliably in all environments, and that the preset is applied correctly,
Nx will run "npm install" several times. Please wait.
@ -20,7 +20,7 @@ Nx will run "npm install" several times. Please wait.
——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
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
```
@ -42,7 +42,7 @@ The command below uses the `as-provided` directory flag behavior, which is the d
{% /callout %}
```{% command="nx g @nx/remix:app myapp --directory=apps/myapp" path="~/acme" %}
NX Generating @nx/remix:application
> NX Generating @nx/remix:application
✔ What unit test runner should be used? · vitest
@ -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:
@ -119,7 +119,7 @@ Duration 1.20s (transform 51ms, setup 139ms, collect 180ms, tests 10ms, environ
——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
NX Successfully ran target test for project myapp (2s)
> NX Successfully ran target test for project myapp (2s)
```
## Generating an Nx Library
@ -129,7 +129,7 @@ When developing your application, it often makes sense to split your codebase in
To generate a library to use in your Remix application run:
```{% command="nx g @nx/remix:lib login --directory=libs/login" path="~/acme" %}
NX Generating @nx/remix:library
> NX Generating @nx/remix:library
✔ What test runner should be used? · vitest
UPDATE nx.json
@ -176,7 +176,7 @@ You can also run test on your library:
To generate a route for your application:
```{% command="nx g @nx/remix:route admin --path=apps/myapp/app/routes" path="~/acme" %}
NX Generating @nx/remix:route
> NX Generating @nx/remix:route
CREATE apps/myapp/app/routes/admin.tsx
CREATE apps/myapp/app/styles/admin.css
@ -189,7 +189,7 @@ To use a Route Loader where the logic lives in your library, follow the steps be
1. Generate a loader for your route:
```{% command="nx g @nx/remix:loader admin --path=apps/myapp/app/routes" path="~/acme" %}
NX Generating @nx/remix:loader
> NX Generating @nx/remix:loader
UPDATE apps/myapp/app/routes/admin.tsx
```

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
@ -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.
```

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.
@ -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.
```
@ -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.
@ -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" %}
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]
@ -271,7 +271,7 @@ NX Affected criteria defaulted to --base=main --head=HEAD
——————————————————————————————————————————————————————————————————————————————————————————————
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.
```

View File

@ -89,7 +89,7 @@ The command below uses the `as-provided` directory flag behavior, which is the d
{% /callout %}
```{% command="nx g @nx/remix:app myapp --directory=apps/myapp" path="~/acme" %}
NX Generating @nx/remix:application
> NX Generating @nx/remix:application
✔ What unit test runner should be used? · vitest
@ -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:
@ -166,7 +166,7 @@ Duration 1.20s (transform 51ms, setup 139ms, collect 180ms, tests 10ms, environ
——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
NX Successfully ran target test for project myapp (2s)
> NX Successfully ran target test for project myapp (2s)
```
## Generating an Nx Library
@ -176,7 +176,7 @@ When developing your application, it often makes sense to split your codebase in
To generate a library to use in your Remix application run:
```{% command="nx g @nx/remix:lib login --directory=libs/login" path="~/acme" %}
NX Generating @nx/remix:library
> NX Generating @nx/remix:library
✔ What test runner should be used? · vitest
UPDATE nx.json
@ -223,7 +223,7 @@ You can also run test on your library:
To generate a route for your application:
```{% command="nx g @nx/remix:route admin --path=apps/myapp/app/routes" path="~/acme" %}
NX Generating @nx/remix:route
> NX Generating @nx/remix:route
CREATE apps/myapp/app/routes/admin.tsx
CREATE apps/myapp/app/styles/admin.css
@ -236,7 +236,7 @@ To use a Route Loader where the logic lives in your library, follow the steps be
1. Generate a loader for your route:
```{% command="nx g @nx/remix:loader admin --path=apps/myapp/app/routes" path="~/acme" %}
NX Generating @nx/remix:loader
> NX Generating @nx/remix:loader
UPDATE apps/myapp/app/routes/admin.tsx
```

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
@ -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.
```
@ -257,7 +257,7 @@ You can just create new React components as you normally would. However, Nx plug
```{% command="npx nx list @nx/react" path="myreactapp" %}
NX Capabilities in @nx/react:
> NX Capabilities in @nx/react:
GENERATORS
@ -296,7 +296,7 @@ More info can be found in [the integrate with editors article](/features/integra
Run the following command to generate a new "hello-world" component. Note how we append `--dry-run` to first check the output.
```{% command="npx nx g @nx/react:component --directory=src/app/hello-world hello-world --dry-run" path="myreactapp" %}
NX Generating @nx/react:component
> NX Generating @nx/react:component
✔ Should this component be exported in the project? (y/N) · false
✔ Where should the component be generated? · src/app/hello-world/hello-world.tsx
@ -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.
@ -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]

View File

@ -54,7 +54,7 @@ title="Tutorial: Standalone React Application"
Create a new React monorepo with the following command:
```{% command="npx create-nx-workspace@latest react-monorepo --preset=react-monorepo" path="~" %}
NX Let's create a new workspace [https://nx.dev/getting-started/intro]
> NX Let's create a new workspace [https://nx.dev/getting-started/intro]
✔ Application name · react-store
✔ Which bundler would you like to use? · vite
@ -234,7 +234,7 @@ Nx plugins usually provide [generators](/features/generate-code) that allow you
```{% command="npx nx list @nx/react" path="react-monorepo" %}
NX Capabilities in @nx/react:
> NX Capabilities in @nx/react:
GENERATORS
@ -273,7 +273,7 @@ More info can be found in [the integrate with editors article](/features/integra
Run the following command to generate a new `inventory` application. Note how we append `--dry-run` to first check the output.
```{% command="npx nx g @nx/react:app inventory --directory=apps/inventory --dry-run" path="react-monorepo" %}
NX Generating @nx/react:application
> NX Generating @nx/react:application
✔ Would you like to add React Router to this application? (y/N) · false
✔ Which E2E test runner would you like to use? · cypress
@ -704,6 +704,7 @@ One thing to highlight is that Nx is able to [cache the tasks you run](/features
Note that all of these targets are automatically cached by Nx. If you re-run a single one or all of them again, you'll see that the task completes immediately. In addition, (as can be seen in the output example below) there will be a note that a matching cache result was found and therefore the task was not run again.
```{% command="nx run-many -t test lint e2e" path="react-monorepo" %}
✔ nx run e2e:lint [existing outputs match the cache, left as is]
✔ nx run react-store:lint [existing outputs match the cache, left as is]
✔ nx run react-store:test [existing outputs match the cache, left as is]
@ -711,7 +712,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.
```
@ -860,6 +861,7 @@ nx graph --affected
If you're ready and want to ship your applications, you can build them using
```{% command="npx nx run-many -t build" path="react-monorepo" %}
// todo
vite v4.3.5 building for production...
✓ 33 libs transformed.
dist/react-store/index.html 0.48 kB │ gzip: 0.30 kB
@ -869,7 +871,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.
@ -1027,7 +1029,7 @@ export default ProductList;
If you lint your workspace you'll get an error now:
```{% command="nx run-many -t lint" %}
Running target lint for 7 projects
> NX Running target lint for 7 projects
✖ nx run products:lint
Linting "products"...
@ -1051,7 +1053,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]

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.
```{% command="npx nx@latest init" path="~/astro-app"%}
NX 🐳 Nx initialization
> NX 🐳 Nx initialization
NX 🧑‍🔧 Please answer the following questions about the scripts found in your package.json in order to generate task runner configuration
> NX 🧑‍🔧 Please answer the following questions about the scripts found in your package.json in order to generate task runner configuration
✔ Which of the following scripts are cacheable? (Produce the same output given the same input, e.g. build, test and lint usually are, serve and start are not). You can use spacebar to select one or more scripts. · build
✔ Would you like remote caching to make your build faster? · Yes
NX 📦 Installing dependencies
> NX 📦 Installing dependencies
NX 🎉 Done!
> NX 🎉 Done!
- Enabled computation caching!
- Learn more at https://nx.dev/recipes/adopting-nx/adding-to-existing-project.
@ -93,7 +93,7 @@ The command below uses the `as-provided` directory flag behavior, which is the d
{% /callout %}
```{% command="nx g @nx/js:lib ui --directory=libs/ui --simpleName --minimal" path="~/astro-app"}
NX Generating @nx/js:library
> NX Generating @nx/js:library
✔ Which unit test runner would you like to use? · none
✔ Which bundler would you like to use to build the library? Choose 'none' to skip build setup. · none

View File

@ -163,12 +163,12 @@ It may take a few minutes.
✔ Do you want to update to TypeScript v5.0? (Y/n) · false
✔ Do you want to update the Angular version to v16? (Y/n) · false
NX The migrate command has run successfully.
> NX The migrate command has run successfully.
- package.json has been updated.
- migrations.json has been generated.
NX Next steps:
> NX Next steps:
- Make sure package.json changes make sense and then run 'pnpm install --no-frozen-lockfile',
- Run 'pnpm exec nx migrate --run-migrations'

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="~" %}
NX Let's create a new workspace [https://nx.dev/getting-started/intro]
> NX Let's create a new workspace [https://nx.dev/getting-started/intro]
✔ Where would you like to create your workspace? · myorg
✔ Which stack do you want to use? · none

View File

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

View File

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

View File

@ -59,14 +59,14 @@ An example partial output of running Nx Release with independent releases and co
```{% command="nx release" %}
NX Running release version for project: pkg-1
> NX Running release version for project: pkg-1
pkg-1 🔍 Reading data for package "@myorg/pkg-1" from packages/pkg-1/package.json
pkg-1 📄 Resolved the current version as 0.4.0 from git tag "pkg-1@0.4.0".
pkg-1 📄 Resolved the specifier as "minor" using git history and the conventional commits standard.
pkg-1 ✍️ New version 0.5.0 written to packages/pkg-1/package.json
NX Running release version for project: pkg-2
> NX Running release version for project: pkg-2
pkg-2 🔍 Reading data for package "@myorg/pkg-2" from packages/pkg-2/package.json
pkg-2 📄 Resolved the current version as 0.4.0 from git tag "pkg-2@0.4.0".
@ -74,7 +74,7 @@ pkg-2 📄 Resolved the specifier as "patch" using git history and the conventio
pkg-2 ✍️ New version 0.4.1 written to packages/pkg-2/package.json
pkg-2 ✍️ Applying new version 0.4.1 to 1 package which depends on pkg-2
NX Running release version for project: pkg-3
> NX Running release version for project: pkg-3
pkg-3 🔍 Reading data for package "@myorg/pkg-3" from packages/pkg-3/package.json
pkg-3 📄 Resolved the current version as 0.4.0 from git tag "pkg-3@0.4.0".

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" %}
NX Running release version for project: pkg-1
> NX Running release version for project: pkg-1
pkg-1 🔍 Reading data for package "@myorg/pkg-1" from packages/pkg-1/package.json
pkg-1 📄 Resolved the current version as 0.0.1 from packages/pkg-1/package.json
@ -77,21 +77,21 @@ After this prompt, the command will finish, showing you the preview of changes t
```{% command="nx release --first-release --dry-run" %}
NX Running release version for project: pkg-1
> NX Running release version for project: pkg-1
pkg-1 🔍 Reading data for package "@myorg/pkg-1" from packages/pkg-1/package.json
pkg-1 📄 Resolved the current version as 0.0.1 from packages/pkg-1/package.json
✔ What kind of change is this for the 3 matched projects(s)? · patch
pkg-1 ✍️ New version 0.0.2 written to packages/pkg-1/package.json
NX Running release version for project: pkg-2
> NX Running release version for project: pkg-2
pkg-2 🔍 Reading data for package "@myorg/pkg-2" from packages/pkg-2/package.json
pkg-2 📄 Resolved the current version as 0.0.1 from packages/pkg-2/package.json
pkg-2 ✍️ New version 0.0.2 written to packages/pkg-2/package.json
pkg-2 ✍️ Applying new version 0.0.2 to 1 package which depends on pkg-2
NX Running release version for project: pkg-3
> NX Running release version for project: pkg-3
pkg-3 🔍 Reading data for package "@myorg/pkg-3" from packages/pkg-3/package.json
pkg-3 📄 Resolved the current version as 0.0.1 from packages/pkg-3/package.json
@ -123,15 +123,15 @@ UPDATE packages/pkg-1/package.json [dry-run]
"dependencies": {
NX Updating npm lock file
> NX Updating npm lock file
NX Staging changed files with git
> NX Staging changed files with git
NOTE: The "dryRun" flag means no changes were made.
NX Previewing an entry in CHANGELOG.md for v0.0.2
> NX Previewing an entry in CHANGELOG.md for v0.0.2
CREATE CHANGELOG.md [dry-run]
@ -139,15 +139,15 @@ CREATE CHANGELOG.md [dry-run]
+
+ This was a version bump only, there were no code changes.
NX Staging changed files with git
> NX Staging changed files with git
NOTE: The "dryRun" flag means no changelogs were actually created.
NX Committing changes with git
> NX Committing changes with git
NX Tagging commit with git
> NX Tagging commit with git
Skipped publishing packages.
```
@ -167,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
NX Running target nx-release-publish for 3 projects:
> NX Running target nx-release-publish for 3 projects:
- pkg-1
- 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.
```{% command="nx release publish" %}
NX Running target nx-release-publish for 3 projects:
> NX Running target nx-release-publish for 3 projects:
- pkg-1
- pkg-2
@ -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

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
@ -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.
```

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:
```{% command="npx create-nx-workspace@latest myvueapp --preset=vue-standalone" path="~" %}
NX Let's create a new workspace [https://nx.dev/getting-started/intro]
> NX Let's create a new workspace [https://nx.dev/getting-started/intro]
✔ Test runner to use for end to end (E2E) tests · cypress
✔ Default stylesheet format · css
✔ Set up CI with caching, distribution and test deflaking · github
NX Creating your v17.0.0 workspace.
> NX Creating your v17.0.0 workspace.
To make sure the command works reliably in all environments, and that the preset is applied correctly,
Nx will run "npm install" several times. Please wait.
@ -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
@ -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.
```
@ -269,7 +269,7 @@ You can just create new Vue components as you normally would. However, Nx plugin
```{% command="npx nx list @nx/vue" path="myvueapp" %}
NX Capabilities in @nx/vue:
> NX Capabilities in @nx/vue:
GENERATORS
@ -293,7 +293,7 @@ More info can be found in [the integrate with editors article](/features/integra
Run the following command to generate a new "hello-world" component. Note how we append `--dry-run` to first check the output.
```{% command="npx nx g @nx/vue:component hello-world --no-export --unit-test-runner=vitest --directory=src/components --dry-run" path="myvueapp" %}
NX Generating @nx/vue:component
> NX Generating @nx/vue:component
CREATE src/components/hello-world.spec.ts
CREATE src/components/hello-world.vue
@ -333,7 +333,7 @@ If you're ready and want to ship your application, you can build it using
—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
NX Successfully ran target build for project myvueapp (957ms)
> NX Successfully ran target build for project myvueapp (957ms)
```
All the required files will be placed in the `dist/myvueapp` folder and can be deployed to your favorite hosting provider.
@ -827,7 +827,7 @@ import { Orders } from 'orders';
If you lint your workspace you'll get an error now:
```{% command="nx run-many -t lint" %}
NX Running target lint for 5 projects
> NX Running target lint for 5 projects
✖ nx run products:lint
Linting "products"...
@ -849,7 +849,7 @@ NX Running target lint for 5 projects
——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
NX Ran target lint for 5 projects (2s)
> NX Ran target lint for 5 projects (2s)
✔ 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
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

@ -120,12 +120,12 @@ describe('nx release - independent projects', () => {
);
expect(versionPkg1Output).toMatchInlineSnapshot(`
NX Your filter "{project-name}" matched the following projects:
> NX Your filter "{project-name}" matched the following projects:
- {project-name}
NX Running release version for project: {project-name}
> NX Running release version for project: {project-name}
{project-name} 🔍 Reading data for package "@proj/{project-name}" from {project-name}/package.json
{project-name} 📄 Resolved the current version as 0.0.0 from {project-name}/package.json
@ -139,10 +139,10 @@ describe('nx release - independent projects', () => {
"scripts": {
NX Updating {package-manager} lock file
> NX Updating {package-manager} lock file
NX Staging changed files with git
> NX Staging changed files with git
`);
@ -152,12 +152,12 @@ describe('nx release - independent projects', () => {
);
expect(versionPkg2Output).toMatchInlineSnapshot(`
NX Your filter "{project-name}" matched the following projects:
> NX Your filter "{project-name}" matched the following projects:
- {project-name}
NX Running release version for project: {project-name}
> NX Running release version for project: {project-name}
{project-name} 🔍 Reading data for package "@proj/{project-name}" from {project-name}/package.json
{project-name} 📄 Resolved the current version as 0.0.0 from {project-name}/package.json
@ -174,10 +174,10 @@ describe('nx release - independent projects', () => {
+
NX Updating {package-manager} lock file
> NX Updating {package-manager} lock file
NX Staging changed files with git
> NX Staging changed files with git
`);
@ -187,12 +187,12 @@ describe('nx release - independent projects', () => {
);
expect(versionPkg3Output).toMatchInlineSnapshot(`
NX Your filter "{project-name}" matched the following projects:
> NX Your filter "{project-name}" matched the following projects:
- {project-name}
NX Running release version for project: {project-name}
> NX Running release version for project: {project-name}
{project-name} 🔍 Reading data for package "@proj/{project-name}" from {project-name}/package.json
{project-name} 📄 Resolved the current version as 0.0.0 from {project-name}/package.json
@ -213,10 +213,10 @@ describe('nx release - independent projects', () => {
}
NX Updating {package-manager} lock file
> NX Updating {package-manager} lock file
NX Staging changed files with git
> NX Staging changed files with git
`);
@ -236,12 +236,12 @@ describe('nx release - independent projects', () => {
);
expect(versionWithGitActionsCLIOutput).toMatchInlineSnapshot(`
NX Your filter "{project-name}" matched the following projects:
> NX Your filter "{project-name}" matched the following projects:
- {project-name}
NX Running release version for project: {project-name}
> NX Running release version for project: {project-name}
{project-name} 🔍 Reading data for package "@proj/{project-name}" from {project-name}/package.json
{project-name} 📄 Resolved the current version as 999.9.9-version-git-operations-test.1 from {project-name}/package.json
@ -255,12 +255,12 @@ describe('nx release - independent projects', () => {
"scripts": {
NX Updating {package-manager} lock file
> NX Updating {package-manager} lock file
Updating {lock-file} with the following command:
{lock-file-command}
NX Committing changes with git
> NX Committing changes with git
Staging files in git with the following command:
git add {project-name}/package.json {lock-file}
@ -268,7 +268,7 @@ describe('nx release - independent projects', () => {
Committing files in git with the following command:
git commit --message chore(release): publish --message - project: {project-name} 999.9.9-version-git-operations-test.2
NX Tagging commit with git
> NX Tagging commit with git
Tagging the current commit in git with the following command:
git tag --annotate {project-name}@999.9.9-version-git-operations-test.2 --message {project-name}@999.9.9-version-git-operations-test.2
@ -323,21 +323,21 @@ describe('nx release - independent projects', () => {
);
expect(versionWithGitActionsConfigOutput).toMatchInlineSnapshot(`
NX Running release version for project: {project-name}
> NX Running release version for project: {project-name}
{project-name} 🔍 Reading data for package "@proj/{project-name}" from {project-name}/package.json
{project-name} 📄 Resolved the current version as 999.9.9-version-git-operations-test.2 from {project-name}/package.json
{project-name} 📄 Using the provided version specifier "999.9.9-version-git-operations-test.3".
{project-name} New version 999.9.9-version-git-operations-test.3 written to {project-name}/package.json
NX Running release version for project: {project-name}
> NX Running release version for project: {project-name}
{project-name} 🔍 Reading data for package "@proj/{project-name}" from {project-name}/package.json
{project-name} 📄 Resolved the current version as 999.9.9-package.2 from {project-name}/package.json
{project-name} 📄 Using the provided version specifier "999.9.9-version-git-operations-test.3".
{project-name} New version 999.9.9-version-git-operations-test.3 written to {project-name}/package.json
NX Running release version for project: {project-name}
> NX Running release version for project: {project-name}
{project-name} 🔍 Reading data for package "@proj/{project-name}" from {project-name}/package.json
{project-name} 📄 Resolved the current version as 999.9.9-package.3 from {project-name}/package.json
@ -363,17 +363,17 @@ describe('nx release - independent projects', () => {
"scripts": {
NX Updating {package-manager} lock file
> NX Updating {package-manager} lock file
Updating {lock-file} with the following command:
{lock-file-command}
NX Updating {package-manager} lock file
> NX Updating {package-manager} lock file
Updating {lock-file} with the following command:
{lock-file-command}
NX Committing changes with git
> NX Committing changes with git
Staging files in git with the following command:
git add {project-name}/package.json {project-name}/package.json {project-name}/package.json {lock-file}
@ -381,7 +381,7 @@ describe('nx release - independent projects', () => {
Committing files in git with the following command:
git commit --message chore(release): publish --message - project: {project-name} 999.9.9-version-git-operations-test.3 --message - project: {project-name} 999.9.9-version-git-operations-test.3 --message - release-group: fixed 999.9.9-version-git-operations-test.3
NX Tagging commit with git
> NX Tagging commit with git
Tagging the current commit in git with the following command:
git tag --annotate {project-name}@999.9.9-version-git-operations-test.3 --message {project-name}@999.9.9-version-git-operations-test.3
@ -437,12 +437,12 @@ describe('nx release - independent projects', () => {
);
expect(changelogPkg1Output).toMatchInlineSnapshot(`
NX Your filter "{project-name}" matched the following projects:
> NX Your filter "{project-name}" matched the following projects:
- {project-name}
NX Previewing an entry in {project-name}/CHANGELOG.md for {project-name}@999.9.9-package.1
> NX Previewing an entry in {project-name}/CHANGELOG.md for {project-name}@999.9.9-package.1
+ ## 999.9.9-package.1 (YYYY-MM-DD)
@ -450,10 +450,10 @@ describe('nx release - independent projects', () => {
+ This was a version bump only for {project-name} to align it with other projects, there were no code changes.
NX Committing changes with git
> NX Committing changes with git
NX Tagging commit with git
> NX Tagging commit with git
`);
@ -464,12 +464,12 @@ describe('nx release - independent projects', () => {
);
expect(changelogPkg2Output).toMatchInlineSnapshot(`
NX Your filter "{project-name}" matched the following projects:
> NX Your filter "{project-name}" matched the following projects:
- {project-name}
NX Previewing an entry in {project-name}/CHANGELOG.md for {project-name}@999.9.9-package.2
> NX Previewing an entry in {project-name}/CHANGELOG.md for {project-name}@999.9.9-package.2
+ ## 999.9.9-package.2 (YYYY-MM-DD)
@ -477,10 +477,10 @@ describe('nx release - independent projects', () => {
+ This was a version bump only for {project-name} to align it with other projects, there were no code changes.
NX Committing changes with git
> NX Committing changes with git
NX Tagging commit with git
> NX Tagging commit with git
`);
@ -491,12 +491,12 @@ describe('nx release - independent projects', () => {
);
expect(changelogPkg3Output).toMatchInlineSnapshot(`
NX Your filter "{project-name}" matched the following projects:
> NX Your filter "{project-name}" matched the following projects:
- {project-name}
NX Previewing an entry in {project-name}/CHANGELOG.md for {project-name}@999.9.9-package.3
> NX Previewing an entry in {project-name}/CHANGELOG.md for {project-name}@999.9.9-package.3
+ ## 999.9.9-package.3 (YYYY-MM-DD)
@ -504,10 +504,10 @@ describe('nx release - independent projects', () => {
+ This was a version bump only for {project-name} to align it with other projects, there were no code changes.
NX Committing changes with git
> NX Committing changes with git
NX Tagging commit with git
> NX Tagging commit with git
`);
@ -524,12 +524,12 @@ describe('nx release - independent projects', () => {
);
expect(versionWithGitActionsCLIOutput).toMatchInlineSnapshot(`
NX Your filter "{project-name}" matched the following projects:
> NX Your filter "{project-name}" matched the following projects:
- {project-name}
NX Generating an entry in {project-name}/CHANGELOG.md for {project-name}@999.9.9-changelog-git-operations-test.1
> NX Generating an entry in {project-name}/CHANGELOG.md for {project-name}@999.9.9-changelog-git-operations-test.1
+ ## 999.9.9-changelog-git-operations-test.1 (YYYY-MM-DD)
@ -537,7 +537,7 @@ describe('nx release - independent projects', () => {
+ This was a version bump only for {project-name} to align it with other projects, there were no code changes.
NX Committing changes with git
> NX Committing changes with git
Staging files in git with the following command:
git add {project-name}/CHANGELOG.md
@ -545,7 +545,7 @@ describe('nx release - independent projects', () => {
Committing files in git with the following command:
git commit --message chore(release): publish --message - project: {project-name} 999.9.9-changelog-git-operations-test.1
NX Tagging commit with git
> NX Tagging commit with git
Tagging the current commit in git with the following command:
git tag --annotate {project-name}@999.9.9-changelog-git-operations-test.1 --message {project-name}@999.9.9-changelog-git-operations-test.1
@ -642,12 +642,12 @@ describe('nx release - independent projects', () => {
// Should only contain 1 project
expect(runCLI(`release publish -p ${pkg1} -d`)).toMatchInlineSnapshot(`
NX Your filter "{project-name}" matched the following projects:
> NX Your filter "{project-name}" matched the following projects:
- {project-name} (release group "group1")
NX Running target nx-release-publish for project {project-name}:
> NX Running target nx-release-publish for project {project-name}:
- {project-name}
@ -680,7 +680,7 @@ describe('nx release - independent projects', () => {
NX Successfully ran target nx-release-publish for project {project-name}
> NX Successfully ran target nx-release-publish for project {project-name}
@ -690,13 +690,13 @@ describe('nx release - independent projects', () => {
expect(runCLI(`release publish -p ${pkg1} -p ${pkg3} -d`))
.toMatchInlineSnapshot(`
NX Your filter "{project-name},{project-name}" matched the following projects:
> NX Your filter "{project-name},{project-name}" matched the following projects:
- {project-name} (release group "group1")
- {project-name} (release group "group2")
NX Running target nx-release-publish for project {project-name}:
> NX Running target nx-release-publish for project {project-name}:
- {project-name}
@ -729,11 +729,11 @@ describe('nx release - independent projects', () => {
NX Successfully ran target nx-release-publish for project {project-name}
> NX Successfully ran target nx-release-publish for project {project-name}
NX Running target nx-release-publish for project {project-name}:
> NX Running target nx-release-publish for project {project-name}:
- {project-name}
@ -766,7 +766,7 @@ describe('nx release - independent projects', () => {
NX Successfully ran target nx-release-publish for project {project-name}
> NX Successfully ran target nx-release-publish for project {project-name}
@ -777,7 +777,7 @@ describe('nx release - independent projects', () => {
// Should only contain the 2 projects from group1
expect(runCLI(`release publish -g group1 -d`)).toMatchInlineSnapshot(`
NX Running target nx-release-publish for 2 projects:
> NX Running target nx-release-publish for 2 projects:
- {project-name}
- {project-name}
@ -833,7 +833,7 @@ describe('nx release - independent projects', () => {
NX Successfully ran target nx-release-publish for 2 projects
> NX Successfully ran target nx-release-publish for 2 projects
@ -842,7 +842,7 @@ describe('nx release - independent projects', () => {
// Should only contain the 1 project from group2
expect(runCLI(`release publish -g group2 -d`)).toMatchInlineSnapshot(`
NX Running target nx-release-publish for project {project-name}:
> NX Running target nx-release-publish for project {project-name}:
- {project-name}
@ -875,7 +875,7 @@ describe('nx release - independent projects', () => {
NX Successfully ran target nx-release-publish for project {project-name}
> NX Successfully ran target nx-release-publish for project {project-name}

View File

@ -104,12 +104,12 @@ describe('nx release - private JS packages', () => {
const publicPkg1PublishOutput = runCLI(`release publish -p ${publicPkg1}`);
expect(publicPkg1PublishOutput).toMatchInlineSnapshot(`
NX Your filter "{public-project-name}" matched the following projects:
> NX Your filter "{public-project-name}" matched the following projects:
- {public-project-name}
NX Running target nx-release-publish for project {public-project-name}:
> NX Running target nx-release-publish for project {public-project-name}:
- {public-project-name}
@ -138,7 +138,7 @@ describe('nx release - private JS packages', () => {
NX Successfully ran target nx-release-publish for project {public-project-name}
> NX Successfully ran target nx-release-publish for project {public-project-name}
@ -148,12 +148,12 @@ describe('nx release - private JS packages', () => {
const publicPkg2PublishOutput = runCLI(`release publish -p ${publicPkg2}`);
expect(publicPkg2PublishOutput).toMatchInlineSnapshot(`
NX Your filter "{public-project-name}" matched the following projects:
> NX Your filter "{public-project-name}" matched the following projects:
- {public-project-name}
NX Running target nx-release-publish for project {public-project-name}:
> NX Running target nx-release-publish for project {public-project-name}:
- {public-project-name}
@ -182,7 +182,7 @@ describe('nx release - private JS packages', () => {
NX Successfully ran target nx-release-publish for project {public-project-name}
> NX Successfully ran target nx-release-publish for project {public-project-name}
@ -193,12 +193,12 @@ describe('nx release - private JS packages', () => {
});
expect(privatePkgPublishOutput).toMatchInlineSnapshot(`
NX Your filter "{private-project-name}" matched the following projects:
> NX Your filter "{private-project-name}" matched the following projects:
- {private-project-name}
NX Based on your config, the following projects were matched for publishing but do not have the "nx-release-publish" target specified:
> NX Based on your config, the following projects were matched for publishing but do not have the "nx-release-publish" target specified:
- {private-project-name}

View File

@ -173,7 +173,7 @@ ${JSON.stringify(
const changelogOutput = runCLI(`release changelog 999.9.9`);
expect(changelogOutput).toMatchInlineSnapshot(`
NX Generating an entry in CHANGELOG.md for v999.9.9
> NX Generating an entry in CHANGELOG.md for v999.9.9
+ ## 999.9.9 (YYYY-MM-DD)
@ -188,10 +188,10 @@ ${JSON.stringify(
+ - Test @{COMMIT_AUTHOR}
NX Committing changes with git
> NX Committing changes with git
NX Tagging commit with git
> NX Tagging commit with git
`);
@ -218,7 +218,7 @@ ${JSON.stringify(
const publishOutput = runCLI(`release publish`);
expect(publishOutput).toMatchInlineSnapshot(`
NX Running target nx-release-publish for 3 projects:
> NX Running target nx-release-publish for 3 projects:
- {project-name}
- {project-name}
@ -291,7 +291,7 @@ ${JSON.stringify(
NX Successfully ran target nx-release-publish for 3 projects
> NX Successfully ran target nx-release-publish for 3 projects
@ -391,7 +391,7 @@ ${JSON.stringify(
const publishOutput2 = runCLI(`${publishToNext} --dry-run`);
expect(publishOutput2).toMatchInlineSnapshot(`
NX Running target nx-release-publish for 3 projects:
> NX Running target nx-release-publish for 3 projects:
- {project-name}
- {project-name}
@ -469,7 +469,7 @@ ${JSON.stringify(
NX Successfully ran target nx-release-publish for 3 projects
> NX Successfully ran target nx-release-publish for 3 projects
@ -496,7 +496,7 @@ ${JSON.stringify(
const publishOutput3 = runCLI(publishToNext);
expect(publishOutput3).toMatchInlineSnapshot(`
NX Running target nx-release-publish for 3 projects:
> NX Running target nx-release-publish for 3 projects:
- {project-name}
- {project-name}
@ -573,7 +573,7 @@ ${JSON.stringify(
NX Successfully ran target nx-release-publish for 3 projects
> NX Successfully ran target nx-release-publish for 3 projects
@ -583,7 +583,7 @@ ${JSON.stringify(
const publishOutput3Repeat = runCLI(publishToNext);
expect(publishOutput3Repeat).toMatchInlineSnapshot(`
NX Running target nx-release-publish for 3 projects:
> NX Running target nx-release-publish for 3 projects:
- {project-name}
- {project-name}
@ -609,7 +609,7 @@ ${JSON.stringify(
NX Successfully ran target nx-release-publish for 3 projects
> NX Successfully ran target nx-release-publish for 3 projects
@ -621,7 +621,7 @@ ${JSON.stringify(
);
expect(publishOutput3NewDistTags).toMatchInlineSnapshot(`
NX Running target nx-release-publish for 3 projects:
> NX Running target nx-release-publish for 3 projects:
- {project-name}
- {project-name}
@ -650,7 +650,7 @@ ${JSON.stringify(
NX Successfully ran target nx-release-publish for 3 projects
> NX Successfully ran target nx-release-publish for 3 projects
@ -713,7 +713,7 @@ ${JSON.stringify(
);
expect(changelogDryRunOutput).toMatchInlineSnapshot(`
NX Previewing an entry in CHANGELOG.md for v1000.0.0-next.0
> NX Previewing an entry in CHANGELOG.md for v1000.0.0-next.0
@ -726,7 +726,7 @@ ${JSON.stringify(
NX Previewing a GitHub release and an entry in {project-name}/CHANGELOG.md for v1000.0.0-next.0
> NX Previewing a GitHub release and an entry in {project-name}/CHANGELOG.md for v1000.0.0-next.0
+ ## 1000.0.0-next.0
@ -734,7 +734,7 @@ ${JSON.stringify(
+ This was a version bump only for {project-name} to align it with other projects, there were no code changes.
NX Previewing a GitHub release and an entry in {project-name}/CHANGELOG.md for v1000.0.0-next.0
> NX Previewing a GitHub release and an entry in {project-name}/CHANGELOG.md for v1000.0.0-next.0
+ ## 1000.0.0-next.0
@ -742,7 +742,7 @@ ${JSON.stringify(
+ This was a version bump only for {project-name} to align it with other projects, there were no code changes.
NX Previewing a GitHub release and an entry in {project-name}/CHANGELOG.md for v1000.0.0-next.0
> NX Previewing a GitHub release and an entry in {project-name}/CHANGELOG.md for v1000.0.0-next.0
+ ## 1000.0.0-next.0
@ -750,10 +750,10 @@ ${JSON.stringify(
+ This was a version bump only for {project-name} to align it with other projects, there were no code changes.
NX Committing changes with git
> NX Committing changes with git
NX Tagging commit with git
> NX Tagging commit with git
`);
@ -1085,11 +1085,11 @@ ${JSON.stringify(
expect(releaseOutput4a).toMatchInlineSnapshot(`
NX Running release version for project: {project-name}
> NX Running release version for project: {project-name}
{project-name} 🔍 Reading data for package "@proj/{project-name}" from {project-name}/package.json
NX No git tags matching pattern ">{version}" for project "{project-name}" were found. You will need to create an initial matching tag to use as a base for determining the next version. Alternatively, you can use the --first-release option or set "release.version.generatorOptions.fallbackCurrentVersionResolver" to "disk" in order to fallback to the version on disk when no matching git tags are found.
> NX No git tags matching pattern ">{version}" for project "{project-name}" were found. You will need to create an initial matching tag to use as a base for determining the next version. Alternatively, you can use the --first-release option or set "release.version.generatorOptions.fallbackCurrentVersionResolver" to "disk" in order to fallback to the version on disk when no matching git tags are found.
`);

View File

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

View File

@ -99,7 +99,7 @@ export async function createRunManyDynamicOutputRenderer({
// Create vertical breathing room for cursor position under the pinned footer
lines.push('');
for (const line of lines) {
output.overwriteLine(line);
output.overwriteLine(output.X_PADDING + line);
}
pinnedFooterNumLines = lines.length + additionalLines;
// clear any possible text below the cursor's position
@ -262,7 +262,7 @@ export async function createRunManyDynamicOutputRenderer({
)}`;
const taskOverridesRows = [];
if (Object.keys(overrides).length > 0) {
const leftPadding = ` `;
const leftPadding = `${output.X_PADDING} `;
taskOverridesRows.push('');
taskOverridesRows.push(
`${leftPadding}${output.dim.cyan('With additional flags:')}`
@ -323,7 +323,7 @@ export async function createRunManyDynamicOutputRenderer({
)}`;
const taskOverridesRows = [];
if (Object.keys(overrides).length > 0) {
const leftPadding = ` `;
const leftPadding = `${output.X_PADDING} `;
taskOverridesRows.push('');
taskOverridesRows.push(
`${leftPadding}${output.dim.green('With additional flags:')}`
@ -358,7 +358,7 @@ export async function createRunManyDynamicOutputRenderer({
)}`;
const taskOverridesRows = [];
if (Object.keys(overrides).length > 0) {
const leftPadding = ` `;
const leftPadding = `${output.X_PADDING} `;
taskOverridesRows.push('');
taskOverridesRows.push(
`${leftPadding}${output.dim.red('With additional flags:')}`
@ -468,7 +468,7 @@ export async function createRunManyDynamicOutputRenderer({
function writeCompletedTaskResultLine(line: string) {
const additionalXPadding = ' ';
output.overwriteLine(additionalXPadding + line);
output.overwriteLine(output.X_PADDING + additionalXPadding + line);
}
/**
@ -495,5 +495,7 @@ function writeCommandOutputBlock(commandOutput: string) {
}
lines.push('');
// Indent the command output to make it look more "designed" in the context of the dynamic output
lines.forEach((l) => output.overwriteLine(`${additionalXPadding}${l}`));
lines.forEach((l) =>
output.overwriteLine(`${output.X_PADDING}${additionalXPadding}${l}`)
);
}

View File

@ -98,7 +98,8 @@ export async function createRunOneDynamicOutputRenderer({
const renderLines = (
lines: string[],
dividerColor = 'cyan',
renderDivider = true
renderDivider = true,
skipPadding = false
) => {
let additionalLines = 0;
if (renderDivider) {
@ -110,7 +111,7 @@ export async function createRunOneDynamicOutputRenderer({
lines.push('');
}
for (const line of lines) {
output.overwriteLine(line);
output.overwriteLine((skipPadding ? '' : output.X_PADDING) + line);
}
dependentTargetsNumLines = lines.length + additionalLines;
// clear any possible text below the cursor's position
@ -174,7 +175,8 @@ export async function createRunOneDynamicOutputRenderer({
renderLines(
linesToRender,
'gray',
renderDivider && state !== 'EXECUTING_DEPENDENT_TARGETS'
renderDivider && state !== 'EXECUTING_DEPENDENT_TARGETS',
true
);
} else {
renderLines([]);
@ -278,7 +280,7 @@ export async function createRunOneDynamicOutputRenderer({
const taskOverridesLines = [];
if (Object.keys(overrides).length > 0) {
const leftPadding = ` `;
const leftPadding = `${output.X_PADDING} `;
taskOverridesLines.push('');
taskOverridesLines.push(
`${leftPadding}${output.dim.green('With additional flags:')}`
@ -319,7 +321,7 @@ export async function createRunOneDynamicOutputRenderer({
const taskOverridesLines = [];
if (Object.keys(overrides).length > 0) {
const leftPadding = ` `;
const leftPadding = `${output.X_PADDING} `;
taskOverridesLines.push('');
taskOverridesLines.push(
`${leftPadding}${output.dim.red('With additional flags:')}`

View File

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

View File

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

View File

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

View File

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