Revert "feat(core): remove leading arrow from output headlines" (#21800)
This commit is contained in:
parent
c2a09c5043
commit
30d10d72f7
@ -89,7 +89,7 @@ The command below uses the `as-provided` directory flag behavior, which is the d
|
||||
{% /callout %}
|
||||
|
||||
```{% command="nx g @nx/remix:app myapp --directory=apps/myapp" path="~/acme" %}
|
||||
NX Generating @nx/remix:application
|
||||
> NX Generating @nx/remix:application
|
||||
|
||||
✔ What unit test runner should be used? · vitest
|
||||
|
||||
@ -135,9 +135,9 @@ Building Remix app in production mode...
|
||||
|
||||
Built in 857ms
|
||||
|
||||
——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
|
||||
——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
|
||||
|
||||
NX Successfully ran target build for project myapp (3s)
|
||||
> NX Successfully ran target build for project myapp (3s)
|
||||
```
|
||||
|
||||
2. To serve your application for use during development run:
|
||||
@ -155,18 +155,18 @@ Remix App Server started at http://localhost:3000 (http://192.168.0.14:3000)
|
||||
```{% command="nx test myapp" path="~/acme" %}
|
||||
> nx run myapp:test
|
||||
|
||||
RUN v0.31.4 /Users/columferry/dev/nrwl/issues/remixguide/acme/apps/myapp
|
||||
RUN v0.31.4 /Users/columferry/dev/nrwl/issues/remixguide/acme/apps/myapp
|
||||
stderr | app/routes/index.spec.ts > test > should render
|
||||
Warning: Functions are not valid as a React child. This may happen if you return a Component instead of <Component /> from render. Or maybe you meant to call this function rather than return it.
|
||||
✓ app/routes/index.spec.ts (1 test) 10ms
|
||||
Test Files 1 passed (1)
|
||||
✓ app/routes/index.spec.ts (1 test) 10ms
|
||||
Test Files 1 passed (1)
|
||||
Tests 1 passed (1)
|
||||
Start at 16:15:45
|
||||
Duration 1.20s (transform 51ms, setup 139ms, collect 180ms, tests 10ms, environment 379ms, prepare 103ms)
|
||||
Start at 16:15:45
|
||||
Duration 1.20s (transform 51ms, setup 139ms, collect 180ms, tests 10ms, environment 379ms, prepare 103ms)
|
||||
|
||||
——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
|
||||
——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
|
||||
|
||||
NX Successfully ran target test for project myapp (2s)
|
||||
> NX Successfully ran target test for project myapp (2s)
|
||||
```
|
||||
|
||||
## Generating an Nx Library
|
||||
@ -176,7 +176,7 @@ When developing your application, it often makes sense to split your codebase in
|
||||
To generate a library to use in your Remix application run:
|
||||
|
||||
```{% command="nx g @nx/remix:lib login --directory=libs/login" path="~/acme" %}
|
||||
NX Generating @nx/remix:library
|
||||
> NX Generating @nx/remix:library
|
||||
|
||||
✔ What test runner should be used? · vitest
|
||||
UPDATE nx.json
|
||||
@ -223,7 +223,7 @@ You can also run test on your library:
|
||||
To generate a route for your application:
|
||||
|
||||
```{% command="nx g @nx/remix:route admin --path=apps/myapp/app/routes" path="~/acme" %}
|
||||
NX Generating @nx/remix:route
|
||||
> NX Generating @nx/remix:route
|
||||
|
||||
CREATE apps/myapp/app/routes/admin.tsx
|
||||
CREATE apps/myapp/app/styles/admin.css
|
||||
@ -236,7 +236,7 @@ To use a Route Loader where the logic lives in your library, follow the steps be
|
||||
1. Generate a loader for your route:
|
||||
|
||||
```{% command="nx g @nx/remix:loader admin --path=apps/myapp/app/routes" path="~/acme" %}
|
||||
NX Generating @nx/remix:loader
|
||||
> NX Generating @nx/remix:loader
|
||||
|
||||
UPDATE apps/myapp/app/routes/admin.tsx
|
||||
```
|
||||
|
||||
@ -212,16 +212,16 @@ pnpm nx build landing-page
|
||||
Clearly this is not a scalable solution as it requires us to manually add every new app to the pipeline (and it doesn't include other tasks like `lint`, `test` etc). To improve this we can change the command to run the `build` for all projects like
|
||||
|
||||
```{% command="nx run-many -t build" %}
|
||||
✔ nx run shared-product-types:build (429ms)
|
||||
✔ nx run shared-product-ui:build (455ms)
|
||||
✔ nx run shared-header:build (467ms)
|
||||
✔ nx run landing-page:build:production (3s)
|
||||
✔ nx run admin:build:production (3s)
|
||||
✔ nx run cart:build:production (3s)
|
||||
✔ nx run shared-product-types:build (429ms)
|
||||
✔ nx run shared-product-ui:build (455ms)
|
||||
✔ nx run shared-header:build (467ms)
|
||||
✔ nx run landing-page:build:production (3s)
|
||||
✔ nx run admin:build:production (3s)
|
||||
✔ nx run cart:build:production (3s)
|
||||
|
||||
————————————————————————————————————————————————————————————————
|
||||
————————————————————————————————————————————————————————————————
|
||||
|
||||
NX Successfully ran target build for 6 projects (10s)
|
||||
> NX Successfully ran target build for 6 projects (10s)
|
||||
```
|
||||
|
||||
This change makes our CI pipeline configuration more maintainable. For a small repository, this might be good enough, but after a little bit of growth this approach will cause your CI times to become unmanageable.
|
||||
@ -229,14 +229,14 @@ This change makes our CI pipeline configuration more maintainable. For a small r
|
||||
Nx comes with a dedicated ["affected" command](/ci/features/affected) to help with that by only running tasks for projects that were affected by the changes in a given PR.
|
||||
|
||||
```{% command="nx affected -t build" %}
|
||||
✔ nx run shared-product-types:build (404ms)
|
||||
✔ nx run shared-product-ui:build (445ms)
|
||||
✔ nx run shared-header:build (465ms)
|
||||
✔ nx run cart:build:production (3s)
|
||||
✔ nx run shared-product-types:build (404ms)
|
||||
✔ nx run shared-product-ui:build (445ms)
|
||||
✔ nx run shared-header:build (465ms)
|
||||
✔ nx run cart:build:production (3s)
|
||||
|
||||
——————————————————————————————————————————————————————————————————————————————————————
|
||||
——————————————————————————————————————————————————————————————————————————————————————
|
||||
|
||||
NX Successfully ran target build for project cart and 3 tasks it depends on (4s)
|
||||
> NX Successfully ran target build for project cart and 3 tasks it depends on (4s)
|
||||
```
|
||||
|
||||
### Configuring the Comparison Range for Affected Commands
|
||||
@ -336,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).
|
||||
@ -366,18 +360,18 @@ What is more, if you run tasks locally, you will also get cache hits:
|
||||
|
||||
```{% command="nx run-many -t build" %}
|
||||
...
|
||||
✔ nx run express-legacy:build [remote cache]
|
||||
✔ nx run nx-plugin-legacy:build [remote cache]
|
||||
✔ nx run esbuild-legacy:build [remote cache]
|
||||
✔ nx run react-native-legacy:build [remote cache]
|
||||
✔ nx run angular-legacy:build [remote cache]
|
||||
✔ nx run remix-legacy:build [remote cache]
|
||||
✔ nx run express-legacy:build [remote cache]
|
||||
✔ nx run nx-plugin-legacy:build [remote cache]
|
||||
✔ nx run esbuild-legacy:build [remote cache]
|
||||
✔ nx run react-native-legacy:build [remote cache]
|
||||
✔ nx run angular-legacy:build [remote cache]
|
||||
✔ nx run remix-legacy:build [remote cache]
|
||||
|
||||
————————————————————————————————————————————————
|
||||
————————————————————————————————————————————————
|
||||
|
||||
NX Successfully ran target build for 58 projects and 62 tasks they depend on (1m)
|
||||
> NX Successfully ran target build for 58 projects and 62 tasks they depend on (1m)
|
||||
|
||||
Nx read the output from the cache instead of running the command for 116 out of 120 tasks.
|
||||
Nx read the output from the cache instead of running the command for 116 out of 120 tasks.
|
||||
```
|
||||
|
||||
You might also want to learn more about [how to fine-tune caching](/recipes/running-tasks/configure-inputs) to get even better results.
|
||||
|
||||
@ -207,16 +207,16 @@ pnpm nx build landing-page
|
||||
Clearly this is not a scalable solution as it requires us to manually add every new app to the pipeline (and it doesn't include other tasks like `lint`, `test` etc). To improve this we can change the command to run the `build` for all projects like
|
||||
|
||||
```{% command="nx run-many -t build" %}
|
||||
✔ nx run shared-product-types:build (429ms)
|
||||
✔ nx run shared-product-ui:build (455ms)
|
||||
✔ nx run shared-header:build (467ms)
|
||||
✔ nx run landing-page:build:production (3s)
|
||||
✔ nx run admin:build:production (3s)
|
||||
✔ nx run cart:build:production (3s)
|
||||
✔ nx run shared-product-types:build (429ms)
|
||||
✔ nx run shared-product-ui:build (455ms)
|
||||
✔ nx run shared-header:build (467ms)
|
||||
✔ nx run landing-page:build:production (3s)
|
||||
✔ nx run admin:build:production (3s)
|
||||
✔ nx run cart:build:production (3s)
|
||||
|
||||
————————————————————————————————————————————————————————————————
|
||||
————————————————————————————————————————————————————————————————
|
||||
|
||||
NX Successfully ran target build for 6 projects (10s)
|
||||
> NX Successfully ran target build for 6 projects (10s)
|
||||
```
|
||||
|
||||
This change makes our CI pipeline configuration more maintainable. For a small repository, this might be good enough, but after a little bit of growth this approach will cause your CI times to become unmanageable.
|
||||
@ -224,14 +224,14 @@ This change makes our CI pipeline configuration more maintainable. For a small r
|
||||
Nx comes with a dedicated ["affected" command](/ci/features/affected) to help with that by only running tasks for projects that were affected by the changes in a given PR.
|
||||
|
||||
```{% command="nx affected -t build" %}
|
||||
✔ nx run shared-product-types:build (404ms)
|
||||
✔ nx run shared-product-ui:build (445ms)
|
||||
✔ nx run shared-header:build (465ms)
|
||||
✔ nx run cart:build:production (3s)
|
||||
✔ nx run shared-product-types:build (404ms)
|
||||
✔ nx run shared-product-ui:build (445ms)
|
||||
✔ nx run shared-header:build (465ms)
|
||||
✔ nx run cart:build:production (3s)
|
||||
|
||||
——————————————————————————————————————————————————————————————————————————————————————
|
||||
——————————————————————————————————————————————————————————————————————————————————————
|
||||
|
||||
NX Successfully ran target build for project cart and 3 tasks it depends on (4s)
|
||||
> NX Successfully ran target build for project cart and 3 tasks it depends on (4s)
|
||||
```
|
||||
|
||||
### Configuring the Comparison Range for Affected Commands
|
||||
@ -345,18 +345,18 @@ What is more, if you run tasks locally, you will also get cache hits:
|
||||
|
||||
```{% command="nx run-many -t build" %}
|
||||
...
|
||||
✔ nx run express-legacy:build [remote cache]
|
||||
✔ nx run nx-plugin-legacy:build [remote cache]
|
||||
✔ nx run esbuild-legacy:build [remote cache]
|
||||
✔ nx run react-native-legacy:build [remote cache]
|
||||
✔ nx run angular-legacy:build [remote cache]
|
||||
✔ nx run remix-legacy:build [remote cache]
|
||||
✔ nx run express-legacy:build [remote cache]
|
||||
✔ nx run nx-plugin-legacy:build [remote cache]
|
||||
✔ nx run esbuild-legacy:build [remote cache]
|
||||
✔ nx run react-native-legacy:build [remote cache]
|
||||
✔ nx run angular-legacy:build [remote cache]
|
||||
✔ nx run remix-legacy:build [remote cache]
|
||||
|
||||
————————————————————————————————————————————————
|
||||
————————————————————————————————————————————————
|
||||
|
||||
NX Successfully ran target build for 58 projects and 62 tasks they depend on (1m)
|
||||
> NX Successfully ran target build for 58 projects and 62 tasks they depend on (1m)
|
||||
|
||||
Nx read the output from the cache instead of running the command for 116 out of 120 tasks.
|
||||
Nx read the output from the cache instead of running the command for 116 out of 120 tasks.
|
||||
```
|
||||
|
||||
You might also want to learn more about [how to fine-tune caching](/recipes/running-tasks/configure-inputs) to get even better results.
|
||||
|
||||
@ -470,14 +470,14 @@ More conveniently, we can also run them in parallel using the following syntax:
|
||||
|
||||
```{% command="nx run-many -t test lint e2e" path="myngapp" %}
|
||||
|
||||
✔ nx run e2e:lint (1s)
|
||||
✔ nx run myngapp:lint (1s)
|
||||
✔ nx run myngapp:test (2s)
|
||||
✔ nx run e2e:e2e (6s)
|
||||
✔ nx run e2e:lint (1s)
|
||||
✔ nx run myngapp:lint (1s)
|
||||
✔ nx run myngapp:test (2s)
|
||||
✔ nx run e2e:e2e (6s)
|
||||
|
||||
——————————————————————————————————————————————————————
|
||||
——————————————————————————————————————————————————————
|
||||
|
||||
NX Successfully ran targets test, lint, e2e for 2 projects (8s)
|
||||
> NX Successfully ran targets test, lint, e2e for 2 projects (8s)
|
||||
```
|
||||
|
||||
### Caching
|
||||
@ -490,16 +490,16 @@ Note that all of these targets are automatically cached by Nx. If you re-run a s
|
||||
|
||||
```{% command="nx run-many -t test lint e2e" path="myngapp" %}
|
||||
|
||||
✔ nx run myngapp:lint [existing outputs match the cache, left as is]
|
||||
✔ nx run e2e:lint [existing outputs match the cache, left as is]
|
||||
✔ nx run myngapp:test [existing outputs match the cache, left as is]
|
||||
✔ nx run e2e:e2e [existing outputs match the cache, left as is]
|
||||
✔ nx run myngapp:lint [existing outputs match the cache, left as is]
|
||||
✔ nx run e2e:lint [existing outputs match the cache, left as is]
|
||||
✔ nx run myngapp:test [existing outputs match the cache, left as is]
|
||||
✔ nx run e2e:e2e [existing outputs match the cache, left as is]
|
||||
|
||||
———————————————————————————————————————————————————————
|
||||
———————————————————————————————————————————————————————
|
||||
|
||||
Successfully ran targets test, lint, e2e for 2 projects (143ms)
|
||||
> NX Successfully ran targets test, lint, e2e for 2 projects (143ms)
|
||||
|
||||
Nx read the output from the cache instead of running the command for 4 out of 4 tasks.
|
||||
Nx read the output from the cache instead of running the command for 4 out of 4 tasks.
|
||||
```
|
||||
|
||||
Not all tasks might be cacheable though. You can configure the `cache` properties in the targets under `targetDefaults` in the `nx.json` file. You can also [learn more about how caching works](/features/cache-task-results).
|
||||
@ -514,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
|
||||
@ -614,9 +614,9 @@ styles.ef46db3751d8e999.css | styles | 0 bytes |
|
||||
|
||||
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.
|
||||
@ -1051,7 +1051,7 @@ export class ProductsComponent {}
|
||||
If you lint your workspace you'll get an error now:
|
||||
|
||||
```{% command="nx run-many -t lint" %}
|
||||
✖ nx run products:lint
|
||||
✖ nx run products:lint
|
||||
Linting "products"...
|
||||
|
||||
/Users/juri/nrwl/content/myngapp/modules/products/src/lib/products/products.component.ts
|
||||
@ -1061,18 +1061,18 @@ If you lint your workspace you'll get an error now:
|
||||
|
||||
Lint errors found in the listed files.
|
||||
|
||||
✔ nx run orders:lint (1s)
|
||||
✔ nx run myngapp:lint (1s)
|
||||
✔ nx run e2e:lint (682ms)
|
||||
✔ nx run shared-ui:lint (797ms)
|
||||
✔ nx run orders:lint (1s)
|
||||
✔ nx run myngapp:lint (1s)
|
||||
✔ nx run e2e:lint (682ms)
|
||||
✔ nx run shared-ui:lint (797ms)
|
||||
|
||||
—————————————————————————————————————————————————————————————————————
|
||||
—————————————————————————————————————————————————————————————————————
|
||||
|
||||
NX Ran target lint for 5 projects (2s)
|
||||
> NX Ran target lint for 5 projects (2s)
|
||||
|
||||
✔ 4/5 succeeded [0 read from cache]
|
||||
✔ 4/5 succeeded [0 read from cache]
|
||||
|
||||
✖ 1/5 targets failed, including the following:
|
||||
✖ 1/5 targets failed, including the following:
|
||||
- nx run products:lint
|
||||
|
||||
```
|
||||
|
||||
@ -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,16 +1009,17 @@ One thing to highlight is that Nx is able to [cache the tasks you run](/features
|
||||
Note that all of these targets are automatically cached by Nx. If you re-run a single one or all of them again, you'll see that the task completes immediately. In addition, (as can be seen in the output example below) there will be a note that a matching cache result was found and therefore the task was not run again.
|
||||
|
||||
```{% command="nx run-many -t test lint e2e" path="angular-monorepo" %}
|
||||
✔ nx run e2e:lint [existing outputs match the cache, left as is]
|
||||
✔ nx run angular-store:lint [existing outputs match the cache, left as is]
|
||||
✔ nx run angular-store:test [existing outputs match the cache, left as is]
|
||||
✔ nx run e2e:e2e [existing outputs match the cache, left as is]
|
||||
|
||||
——————————————————————————————————————————————————————
|
||||
✔ nx run e2e:lint [existing outputs match the cache, left as is]
|
||||
✔ nx run angular-store:lint [existing outputs match the cache, left as is]
|
||||
✔ nx run angular-store:test [existing outputs match the cache, left as is]
|
||||
✔ nx run e2e:e2e [existing outputs match the cache, left as is]
|
||||
|
||||
NX Successfully ran targets test, lint, e2e for 5 projects (54ms)
|
||||
——————————————————————————————————————————————————————
|
||||
|
||||
Nx read the output from the cache instead of running the command for 10 out of 10 tasks.
|
||||
> 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.
|
||||
```
|
||||
|
||||
Not all tasks might be cacheable though. You can configure `cacheableOperations` in the `nx.json` file. You can also [learn more about how caching works](/features/cache-task-results).
|
||||
@ -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
|
||||
@ -1161,12 +1162,12 @@ CREATE libs/orders/src/lib/order-list/order-list.component.ts
|
||||
UPDATE libs/orders/src/index.ts
|
||||
❯ nx run-many -t build
|
||||
|
||||
✔ nx run inventory:build:production (7s)
|
||||
✔ nx run angular-store:build:production (7s)
|
||||
✔ nx run inventory:build:production (7s)
|
||||
✔ nx run angular-store:build:production (7s)
|
||||
|
||||
———————————————————————————————————————————————————————————————————————
|
||||
———————————————————————————————————————————————————————————————————————
|
||||
|
||||
NX Successfully ran target build for 2 projects (7s)
|
||||
> NX Successfully ran target build for 2 projects (7s)
|
||||
```
|
||||
|
||||
All the required files will be placed in `dist/apps/angular-store` and `dist/apps/inventory` and can be deployed to your favorite hosting provider.
|
||||
@ -1320,8 +1321,8 @@ export class ProductListComponent {}
|
||||
If you lint your workspace you'll get an error now:
|
||||
|
||||
```{% command="nx run-many -t lint" %}
|
||||
NX Running target lint for 7 projects
|
||||
✖ nx run products:lint
|
||||
> NX Running target lint for 7 projects
|
||||
✖ nx run products:lint
|
||||
Linting "products"...
|
||||
|
||||
/Users/isaac/Documents/code/nx-recipes/angular-monorepo/libs/products/src/lib/product-list/product-list.component.ts
|
||||
@ -1335,20 +1336,20 @@ NX Running target lint for 7 projects
|
||||
Lint errors found in the listed files.
|
||||
|
||||
|
||||
✔ nx run orders:lint (1s)
|
||||
✔ nx run angular-store:lint (1s)
|
||||
✔ nx run angular-store-e2e:lint (689ms)
|
||||
✔ nx run inventory-e2e:lint (690ms)
|
||||
✔ nx run inventory:lint (858ms)
|
||||
✔ nx run shared-ui:lint (769ms)
|
||||
✔ nx run orders:lint (1s)
|
||||
✔ nx run angular-store:lint (1s)
|
||||
✔ nx run angular-store-e2e:lint (689ms)
|
||||
✔ nx run inventory-e2e:lint (690ms)
|
||||
✔ nx run inventory:lint (858ms)
|
||||
✔ nx run shared-ui:lint (769ms)
|
||||
|
||||
———————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
|
||||
———————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
|
||||
|
||||
NX Ran target lint for 7 projects (3s)
|
||||
> NX Ran target lint for 7 projects (3s)
|
||||
|
||||
✔ 6/7 succeeded [0 read from cache]
|
||||
✔ 6/7 succeeded [0 read from cache]
|
||||
|
||||
✖ 1/7 targets failed, including the following:
|
||||
✖ 1/7 targets failed, including the following:
|
||||
- nx run products:lint
|
||||
```
|
||||
|
||||
|
||||
@ -135,11 +135,11 @@ Hello, World!
|
||||
||----w |
|
||||
|| ||
|
||||
|
||||
—————————————————————————————————————————————————————————————————————————————————————————
|
||||
—————————————————————————————————————————————————————————————————————————————————————————
|
||||
|
||||
NX Successfully ran target serve for project cli (2s)
|
||||
> NX Successfully ran target serve for project cli (2s)
|
||||
|
||||
See Nx Cloud run details at https://nx.app/runs/THRW7SDRL9S
|
||||
See Nx Cloud run details at https://nx.app/runs/THRW7SDRL9S
|
||||
|
||||
```
|
||||
|
||||
|
||||
@ -48,7 +48,7 @@ Update `packages/ascii/assets/cow.txt`:
|
||||
|
||||
```plaintext
|
||||
_____
|
||||
< moo >
|
||||
< Hi! >
|
||||
-----
|
||||
\ ^__^
|
||||
\ (oo)\_______
|
||||
@ -66,14 +66,14 @@ Printing the affected projects can be handy, but usually you want to do somethin
|
||||
**Run `nx affected -t build` to rebuild only the projects affected by the change.**
|
||||
|
||||
```shell
|
||||
✔ nx run blog:build (1s)
|
||||
✔ nx run cli:build (2s)
|
||||
✔ nx run blog:build (1s)
|
||||
✔ nx run cli:build (2s)
|
||||
|
||||
——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
|
||||
——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
|
||||
|
||||
NX Successfully ran target build for 2 projects (2s)
|
||||
> NX Successfully ran target build for 2 projects (2s)
|
||||
|
||||
See Nx Cloud run details at https://nx.app/runs/XfhRFaOyGCE
|
||||
See Nx Cloud run details at https://nx.app/runs/XfhRFaOyGCE
|
||||
```
|
||||
|
||||
Note that Nx only built `blog` and `cli`. It didn't build `ascii` because there is no build script created for it.
|
||||
|
||||
@ -99,13 +99,14 @@ ______________________________________________________
|
||||
(__)\ )\/\
|
||||
||----w |
|
||||
|| ||
|
||||
Done in 0.14s.
|
||||
Done in 0.14s.
|
||||
|
||||
——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
|
||||
——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
|
||||
|
||||
NX Successfully ran target serve for project cow
|
||||
> NX Successfully ran target serve for project cow
|
||||
|
||||
See Nx Cloud run details at https://nx.app/runs/nZBYYBEuIfG
|
||||
|
||||
See Nx Cloud run details at https://nx.app/runs/nZBYYBEuIfG
|
||||
```
|
||||
|
||||
## View the Project Graph
|
||||
|
||||
@ -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:
|
||||
|
||||
@ -25,19 +25,22 @@ To see the remote cache in action, run:
|
||||
src/index.tsx → dist...
|
||||
created dist in 786ms
|
||||
|
||||
—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
|
||||
—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
|
||||
|
||||
NX Successfully ran target build for project header (2s)
|
||||
> NX Successfully ran target build for project header (2s)
|
||||
|
||||
See logs and investigate cache misses at https://cloud.nx.app/runs/k0HDHACpL8
|
||||
See logs and investigate cache misses at https://cloud.nx.app/runs/k0HDHACpL8
|
||||
|
||||
NX Resetting the Nx workspace cache and stopping the Nx Daemon.
|
||||
|
||||
This might take a few minutes.
|
||||
> NX Resetting the Nx workspace cache and stopping the Nx Daemon.
|
||||
|
||||
NX Daemon Server - Stopped
|
||||
This might take a few minutes.
|
||||
|
||||
NX Successfully reset the Nx workspace.
|
||||
|
||||
> NX Daemon Server - Stopped
|
||||
|
||||
|
||||
> NX Successfully reset the Nx workspace.
|
||||
|
||||
|
||||
> nx run header:build [remote cache]
|
||||
@ -50,13 +53,13 @@ NX Successfully reset the Nx workspace.
|
||||
src/index.tsx → dist...
|
||||
created dist in 786ms
|
||||
|
||||
—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
|
||||
—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
|
||||
|
||||
NX Successfully ran target build for project header (664ms)
|
||||
> NX Successfully ran target build for project header (664ms)
|
||||
|
||||
Nx read the output from the cache instead of running the command for 1 out of 1 tasks.
|
||||
Nx read the output from the cache instead of running the command for 1 out of 1 tasks.
|
||||
|
||||
Nx Cloud made it possible to reuse header: https://nx.app/runs/P0X6ZGTkqZ
|
||||
Nx Cloud made it possible to reuse header: https://nx.app/runs/P0X6ZGTkqZ
|
||||
```
|
||||
|
||||
## Skipping Cloud Cache
|
||||
|
||||
@ -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? …
|
||||
|
||||
@ -327,11 +327,11 @@ If you inspect the terminal output, you'll see something like this, even if you
|
||||
```shell
|
||||
> nx run about:build:development [existing outputs match the cache, left as is]
|
||||
|
||||
(snip)
|
||||
(snip)
|
||||
|
||||
NX Successfully ran target build for project about
|
||||
> NX Successfully ran target build for project about
|
||||
|
||||
Nx read the output from the cache instead of running the command for 1 out of 1 tasks.
|
||||
Nx read the output from the cache instead of running the command for 1 out of 1 tasks.
|
||||
|
||||
```
|
||||
|
||||
|
||||
@ -5,24 +5,24 @@ In this recipe, we'll show you how to create a [Remix](https://remix.run) applic
|
||||
## Create Nx Workspace
|
||||
|
||||
```{% command="npx create-nx-workspace acme --preset=apps" path="~/" %}
|
||||
NX Let's create a new workspace [https://nx.dev/getting-started/intro]
|
||||
> NX Let's create a new workspace [https://nx.dev/getting-started/intro]
|
||||
|
||||
✔ Do you want Nx Cloud to make your CI fast? · Yes
|
||||
|
||||
NX Creating your v16.3.2 workspace.
|
||||
> NX Creating your v16.3.2 workspace.
|
||||
|
||||
To make sure the command works reliably in all environments, and that the preset is applied correctly,
|
||||
Nx will run "npm install" several times. Please wait.
|
||||
To make sure the command works reliably in all environments, and that the preset is applied correctly,
|
||||
Nx will run "npm install" several times. Please wait.
|
||||
|
||||
✔ Installing dependencies with npm
|
||||
✔ Successfully created the workspace: acme.
|
||||
|
||||
——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
|
||||
——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
|
||||
|
||||
|
||||
NX First time using Nx? Check out this interactive Nx tutorial.
|
||||
> NX First time using Nx? Check out this interactive Nx tutorial.
|
||||
|
||||
https://nx.dev/tutorials/package-based-repo-tutorial
|
||||
https://nx.dev/tutorials/package-based-repo-tutorial
|
||||
```
|
||||
|
||||
## Install Nx Remix Plugin
|
||||
@ -42,7 +42,7 @@ The command below uses the `as-provided` directory flag behavior, which is the d
|
||||
{% /callout %}
|
||||
|
||||
```{% command="nx g @nx/remix:app myapp --directory=apps/myapp" path="~/acme" %}
|
||||
NX Generating @nx/remix:application
|
||||
> NX Generating @nx/remix:application
|
||||
|
||||
✔ What unit test runner should be used? · vitest
|
||||
|
||||
@ -88,9 +88,9 @@ Building Remix app in production mode...
|
||||
|
||||
Built in 857ms
|
||||
|
||||
——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
|
||||
——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
|
||||
|
||||
NX Successfully ran target build for project myapp (3s)
|
||||
> NX Successfully ran target build for project myapp (3s)
|
||||
```
|
||||
|
||||
2. To serve your application for use during development run:
|
||||
@ -108,18 +108,18 @@ Remix App Server started at http://localhost:3000 (http://192.168.0.14:3000)
|
||||
```{% command="nx test myapp" path="~/acme" %}
|
||||
> nx run myapp:test
|
||||
|
||||
RUN v0.31.4 /Users/columferry/dev/nrwl/issues/remixguide/acme/apps/myapp
|
||||
RUN v0.31.4 /Users/columferry/dev/nrwl/issues/remixguide/acme/apps/myapp
|
||||
stderr | app/routes/index.spec.ts > test > should render
|
||||
Warning: Functions are not valid as a React child. This may happen if you return a Component instead of <Component /> from render. Or maybe you meant to call this function rather than return it.
|
||||
✓ app/routes/index.spec.ts (1 test) 10ms
|
||||
Test Files 1 passed (1)
|
||||
✓ app/routes/index.spec.ts (1 test) 10ms
|
||||
Test Files 1 passed (1)
|
||||
Tests 1 passed (1)
|
||||
Start at 16:15:45
|
||||
Duration 1.20s (transform 51ms, setup 139ms, collect 180ms, tests 10ms, environment 379ms, prepare 103ms)
|
||||
Start at 16:15:45
|
||||
Duration 1.20s (transform 51ms, setup 139ms, collect 180ms, tests 10ms, environment 379ms, prepare 103ms)
|
||||
|
||||
——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
|
||||
——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
|
||||
|
||||
NX Successfully ran target test for project myapp (2s)
|
||||
> NX Successfully ran target test for project myapp (2s)
|
||||
```
|
||||
|
||||
## Generating an Nx Library
|
||||
@ -129,7 +129,7 @@ When developing your application, it often makes sense to split your codebase in
|
||||
To generate a library to use in your Remix application run:
|
||||
|
||||
```{% command="nx g @nx/remix:lib login --directory=libs/login" path="~/acme" %}
|
||||
NX Generating @nx/remix:library
|
||||
> NX Generating @nx/remix:library
|
||||
|
||||
✔ What test runner should be used? · vitest
|
||||
UPDATE nx.json
|
||||
@ -176,7 +176,7 @@ You can also run test on your library:
|
||||
To generate a route for your application:
|
||||
|
||||
```{% command="nx g @nx/remix:route admin --path=apps/myapp/app/routes" path="~/acme" %}
|
||||
NX Generating @nx/remix:route
|
||||
> NX Generating @nx/remix:route
|
||||
|
||||
CREATE apps/myapp/app/routes/admin.tsx
|
||||
CREATE apps/myapp/app/styles/admin.css
|
||||
@ -189,7 +189,7 @@ To use a Route Loader where the logic lives in your library, follow the steps be
|
||||
1. Generate a loader for your route:
|
||||
|
||||
```{% command="nx g @nx/remix:loader admin --path=apps/myapp/app/routes" path="~/acme" %}
|
||||
NX Generating @nx/remix:loader
|
||||
> NX Generating @nx/remix:loader
|
||||
|
||||
UPDATE apps/myapp/app/routes/admin.tsx
|
||||
```
|
||||
|
||||
@ -191,9 +191,9 @@ Run the same command a second time and you'll see the build cache is being used:
|
||||
Compiling TypeScript files for project "is-even"...
|
||||
Done compiling TypeScript files for project "is-even".
|
||||
|
||||
—————————————————————————————————————————————————————————————————————
|
||||
—————————————————————————————————————————————————————————————————————
|
||||
|
||||
NX Successfully ran target build for project is-even (713ms)
|
||||
> NX Successfully ran target build for project is-even (713ms)
|
||||
```
|
||||
|
||||
## Running Multiple Tasks
|
||||
@ -207,14 +207,14 @@ npx nx run-many -t build
|
||||
What you would get is the following:
|
||||
|
||||
```{% command="npx nx run-many -t build" %}
|
||||
✔ nx run is-even:build [existing outputs match the cache, left as is]
|
||||
✔ nx run is-odd:build (906ms)
|
||||
✔ nx run is-even:build [existing outputs match the cache, left as is]
|
||||
✔ nx run is-odd:build (906ms)
|
||||
|
||||
—————————————————————————————————————————————————————————————————
|
||||
—————————————————————————————————————————————————————————————————
|
||||
|
||||
NX Successfully ran target build for 2 projects (914ms)
|
||||
> NX Successfully ran target build for 2 projects (914ms)
|
||||
|
||||
Nx read the output from the cache instead of running the command for 1 out of 2 tasks.
|
||||
Nx read the output from the cache instead of running the command for 1 out of 2 tasks.
|
||||
```
|
||||
|
||||
Note how on the `is-even:build` it didn't run the build but rather pulled it out of the cache because the build has ran before. If you re-run the `run-many` command all of the builds would be cached.
|
||||
|
||||
@ -221,11 +221,11 @@ Run the command:
|
||||
> tsc index.ts --outDir dist
|
||||
|
||||
|
||||
——————————————————————————————————————————————————————————————————————————————————————————
|
||||
——————————————————————————————————————————————————————————————————————————————————————————
|
||||
|
||||
NX Successfully ran target build for project is-even (33ms)
|
||||
> NX Successfully ran target build for project is-even (33ms)
|
||||
|
||||
Nx read the output from the cache instead of running the command for 1 out of 1 tasks.
|
||||
Nx read the output from the cache instead of running the command for 1 out of 1 tasks.
|
||||
|
||||
```
|
||||
|
||||
@ -236,25 +236,25 @@ Note that the cache for the `build` script was already populated when we ran it
|
||||
To run the `build` target for all the packages in the workspace, use:
|
||||
|
||||
```{% command="npx nx run-many -t build" %}
|
||||
✔ nx run is-even:build [existing outputs match the cache, left as is]
|
||||
✔ nx run is-odd:build [existing outputs match the cache, left as is]
|
||||
✔ nx run is-even:build [existing outputs match the cache, left as is]
|
||||
✔ nx run is-odd:build [existing outputs match the cache, left as is]
|
||||
|
||||
————————————————————————————————————————————————————————————————————————————————————————
|
||||
————————————————————————————————————————————————————————————————————————————————————————
|
||||
|
||||
NX Successfully ran target build for 2 projects (35ms)
|
||||
> NX Successfully ran target build for 2 projects (35ms)
|
||||
|
||||
Nx read the output from the cache instead of running the command for 2 out of 2 tasks.
|
||||
Nx read the output from the cache instead of running the command for 2 out of 2 tasks.
|
||||
```
|
||||
|
||||
Notice that both builds are replayed from cache. We can skip the cache by adding the `--skip-nx-cache` option:
|
||||
|
||||
```{% command="npx nx run-many -t build --skip-nx-cache" %}
|
||||
✔ nx run is-even:build (1s)
|
||||
✔ nx run is-odd:build (1s)
|
||||
✔ nx run is-even:build (1s)
|
||||
✔ nx run is-odd:build (1s)
|
||||
|
||||
———————————————————————————————————————————————————————————————————————
|
||||
———————————————————————————————————————————————————————————————————————
|
||||
|
||||
NX Successfully ran target build for 2 projects (2s)
|
||||
> NX Successfully ran target build for 2 projects (2s)
|
||||
```
|
||||
|
||||
Notice that using this method, the `is-even` build ran before the `is-odd` build, and that the `is-even` build only happened once. This demonstrates how `run-many` is informed by the `targetDefaults` we set earlier.
|
||||
@ -263,17 +263,17 @@ You can also only run tasks on packages that got changed by using the command:
|
||||
|
||||
```{% command="npx nx affected -t build" %}
|
||||
|
||||
NX Affected criteria defaulted to --base=main --head=HEAD
|
||||
> NX Affected criteria defaulted to --base=main --head=HEAD
|
||||
|
||||
|
||||
✔ nx run is-even:build [existing outputs match the cache, left as is]
|
||||
✔ nx run is-odd:build [existing outputs match the cache, left as is]
|
||||
✔ nx run is-even:build [existing outputs match the cache, left as is]
|
||||
✔ nx run is-odd:build [existing outputs match the cache, left as is]
|
||||
|
||||
——————————————————————————————————————————————————————————————————————————————————————————————
|
||||
——————————————————————————————————————————————————————————————————————————————————————————————
|
||||
|
||||
NX Successfully ran target build for 2 projects (34ms)
|
||||
> NX Successfully ran target build for 2 projects (34ms)
|
||||
|
||||
Nx read the output from the cache instead of running the command for 2 out of 2 tasks.
|
||||
Nx read the output from the cache instead of running the command for 2 out of 2 tasks.
|
||||
```
|
||||
|
||||
Notice that the `base` and `head` options were populated with their default values. You could provide your own options here as needed. Notice too that the cache is also used with the `affected` command.
|
||||
|
||||
@ -89,7 +89,7 @@ The command below uses the `as-provided` directory flag behavior, which is the d
|
||||
{% /callout %}
|
||||
|
||||
```{% command="nx g @nx/remix:app myapp --directory=apps/myapp" path="~/acme" %}
|
||||
NX Generating @nx/remix:application
|
||||
> NX Generating @nx/remix:application
|
||||
|
||||
✔ What unit test runner should be used? · vitest
|
||||
|
||||
@ -135,9 +135,9 @@ Building Remix app in production mode...
|
||||
|
||||
Built in 857ms
|
||||
|
||||
——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
|
||||
——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
|
||||
|
||||
NX Successfully ran target build for project myapp (3s)
|
||||
> NX Successfully ran target build for project myapp (3s)
|
||||
```
|
||||
|
||||
2. To serve your application for use during development run:
|
||||
@ -155,18 +155,18 @@ Remix App Server started at http://localhost:3000 (http://192.168.0.14:3000)
|
||||
```{% command="nx test myapp" path="~/acme" %}
|
||||
> nx run myapp:test
|
||||
|
||||
RUN v0.31.4 /Users/columferry/dev/nrwl/issues/remixguide/acme/apps/myapp
|
||||
RUN v0.31.4 /Users/columferry/dev/nrwl/issues/remixguide/acme/apps/myapp
|
||||
stderr | app/routes/index.spec.ts > test > should render
|
||||
Warning: Functions are not valid as a React child. This may happen if you return a Component instead of <Component /> from render. Or maybe you meant to call this function rather than return it.
|
||||
✓ app/routes/index.spec.ts (1 test) 10ms
|
||||
Test Files 1 passed (1)
|
||||
✓ app/routes/index.spec.ts (1 test) 10ms
|
||||
Test Files 1 passed (1)
|
||||
Tests 1 passed (1)
|
||||
Start at 16:15:45
|
||||
Duration 1.20s (transform 51ms, setup 139ms, collect 180ms, tests 10ms, environment 379ms, prepare 103ms)
|
||||
Start at 16:15:45
|
||||
Duration 1.20s (transform 51ms, setup 139ms, collect 180ms, tests 10ms, environment 379ms, prepare 103ms)
|
||||
|
||||
——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
|
||||
——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
|
||||
|
||||
NX Successfully ran target test for project myapp (2s)
|
||||
> NX Successfully ran target test for project myapp (2s)
|
||||
```
|
||||
|
||||
## Generating an Nx Library
|
||||
@ -176,7 +176,7 @@ When developing your application, it often makes sense to split your codebase in
|
||||
To generate a library to use in your Remix application run:
|
||||
|
||||
```{% command="nx g @nx/remix:lib login --directory=libs/login" path="~/acme" %}
|
||||
NX Generating @nx/remix:library
|
||||
> NX Generating @nx/remix:library
|
||||
|
||||
✔ What test runner should be used? · vitest
|
||||
UPDATE nx.json
|
||||
@ -223,7 +223,7 @@ You can also run test on your library:
|
||||
To generate a route for your application:
|
||||
|
||||
```{% command="nx g @nx/remix:route admin --path=apps/myapp/app/routes" path="~/acme" %}
|
||||
NX Generating @nx/remix:route
|
||||
> NX Generating @nx/remix:route
|
||||
|
||||
CREATE apps/myapp/app/routes/admin.tsx
|
||||
CREATE apps/myapp/app/styles/admin.css
|
||||
@ -236,7 +236,7 @@ To use a Route Loader where the logic lives in your library, follow the steps be
|
||||
1. Generate a loader for your route:
|
||||
|
||||
```{% command="nx g @nx/remix:loader admin --path=apps/myapp/app/routes" path="~/acme" %}
|
||||
NX Generating @nx/remix:loader
|
||||
> NX Generating @nx/remix:loader
|
||||
|
||||
UPDATE apps/myapp/app/routes/admin.tsx
|
||||
```
|
||||
|
||||
@ -209,14 +209,14 @@ More conveniently, we can also run them in parallel using the following syntax:
|
||||
|
||||
```{% command="nx run-many -t test lint e2e" path="myreactapp" %}
|
||||
|
||||
✔ nx run e2e:lint (2s)
|
||||
✔ nx run myreactapp:lint (2s)
|
||||
✔ nx run myreactapp:test (2s)
|
||||
✔ nx run e2e:e2e (6s)
|
||||
✔ nx run e2e:lint (2s)
|
||||
✔ nx run myreactapp:lint (2s)
|
||||
✔ nx run myreactapp:test (2s)
|
||||
✔ nx run e2e:e2e (6s)
|
||||
|
||||
——————————————————————————————————————————————————————
|
||||
——————————————————————————————————————————————————————
|
||||
|
||||
NX Successfully ran targets test, lint, e2e for 2 projects (7s)
|
||||
> NX Successfully ran targets test, lint, e2e for 2 projects (7s)
|
||||
```
|
||||
|
||||
### Caching
|
||||
@ -227,16 +227,16 @@ Note that all of these targets are automatically cached by Nx. If you re-run a s
|
||||
|
||||
```{% command="nx run-many -t test lint e2e" path="myreactapp" %}
|
||||
|
||||
✔ nx run e2e:lint [existing outputs match the cache, left as is]
|
||||
✔ nx run myreactapp:lint [existing outputs match the cache, left as is]
|
||||
✔ nx run myreactapp:test [existing outputs match the cache, left as is]
|
||||
✔ nx run e2e:e2e [existing outputs match the cache, left as is]
|
||||
✔ nx run e2e:lint [existing outputs match the cache, left as is]
|
||||
✔ nx run myreactapp:lint [existing outputs match the cache, left as is]
|
||||
✔ nx run myreactapp:test [existing outputs match the cache, left as is]
|
||||
✔ nx run e2e:e2e [existing outputs match the cache, left as is]
|
||||
|
||||
——————————————————————————————————————————————————————
|
||||
——————————————————————————————————————————————————————
|
||||
|
||||
NX Successfully ran targets test, lint, e2e for 5 projects (54ms)
|
||||
> NX Successfully ran targets test, lint, e2e for 5 projects (54ms)
|
||||
|
||||
Nx read the output from the cache instead of running the command for 10 out of 10 tasks.
|
||||
Nx read the output from the cache instead of running the command for 10 out of 10 tasks.
|
||||
```
|
||||
|
||||
Not all tasks might be cacheable though. You can configure the `cache` properties in the targets under `targetDefaults` in the `nx.json` file. You can also [learn more about how caching works](/features/cache-task-results).
|
||||
@ -257,7 +257,7 @@ You can just create new React components as you normally would. However, Nx plug
|
||||
|
||||
```{% command="npx nx list @nx/react" path="myreactapp" %}
|
||||
|
||||
NX Capabilities in @nx/react:
|
||||
> NX Capabilities in @nx/react:
|
||||
|
||||
GENERATORS
|
||||
|
||||
@ -296,7 +296,7 @@ More info can be found in [the integrate with editors article](/features/integra
|
||||
Run the following command to generate a new "hello-world" component. Note how we append `--dry-run` to first check the output.
|
||||
|
||||
```{% command="npx nx g @nx/react:component --directory=src/app/hello-world hello-world --dry-run" path="myreactapp" %}
|
||||
NX Generating @nx/react:component
|
||||
> NX Generating @nx/react:component
|
||||
|
||||
✔ Should this component be exported in the project? (y/N) · false
|
||||
✔ Where should the component be generated? · src/app/hello-world/hello-world.tsx
|
||||
@ -338,9 +338,9 @@ dist/myreactapp/assets/index-e3b0c442.css 0.00 kB │ gzip: 0.02 kB
|
||||
dist/myreactapp/assets/index-378e8124.js 165.64 kB │ gzip: 51.63 kB
|
||||
✓ built in 496ms
|
||||
|
||||
——————————————————————————————————————————————————————————————————————————————————————————————————————————
|
||||
——————————————————————————————————————————————————————————————————————————————————————————————————————————
|
||||
|
||||
NX Successfully ran target build for project reactutorial (1s)
|
||||
> NX Successfully ran target build for project reactutorial (1s)
|
||||
```
|
||||
|
||||
All the required files will be placed in the `dist/myreactapp` folder and can be deployed to your favorite hosting provider.
|
||||
@ -806,11 +806,11 @@ export default ProductList;
|
||||
If you lint your workspace you'll get an error now:
|
||||
|
||||
```{% command="nx run-many -t lint" %}
|
||||
✔ nx run myreactapp:lint [existing outputs match the cache, left as is]
|
||||
✔ nx run e2e:lint [existing outputs match the cache, left as is]
|
||||
✔ nx run ui:lint (1s)
|
||||
✔ nx run myreactapp:lint [existing outputs match the cache, left as is]
|
||||
✔ nx run e2e:lint [existing outputs match the cache, left as is]
|
||||
✔ nx run ui:lint (1s)
|
||||
|
||||
✖ nx run products:lint
|
||||
✖ nx run products:lint
|
||||
Linting "products"...
|
||||
|
||||
/Users/.../myreactapp/modules/products/src/lib/product-list/product-list.tsx
|
||||
@ -820,15 +820,15 @@ If you lint your workspace you'll get an error now:
|
||||
|
||||
Lint errors found in the listed files.
|
||||
|
||||
✔ nx run orders:lint (1s)
|
||||
✔ nx run orders:lint (1s)
|
||||
|
||||
————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
|
||||
————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
|
||||
|
||||
NX Ran target lint for 5 projects (1s)
|
||||
> NX Ran target lint for 5 projects (1s)
|
||||
|
||||
✔ 4/5 succeeded [2 read from cache]
|
||||
✔ 4/5 succeeded [2 read from cache]
|
||||
|
||||
✖ 1/5 targets failed, including the following:
|
||||
✖ 1/5 targets failed, including the following:
|
||||
- nx run products:lint
|
||||
```
|
||||
|
||||
|
||||
@ -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,16 +704,17 @@ One thing to highlight is that Nx is able to [cache the tasks you run](/features
|
||||
Note that all of these targets are automatically cached by Nx. If you re-run a single one or all of them again, you'll see that the task completes immediately. In addition, (as can be seen in the output example below) there will be a note that a matching cache result was found and therefore the task was not run again.
|
||||
|
||||
```{% command="nx run-many -t test lint e2e" path="react-monorepo" %}
|
||||
✔ nx run e2e:lint [existing outputs match the cache, left as is]
|
||||
✔ nx run react-store:lint [existing outputs match the cache, left as is]
|
||||
✔ nx run react-store:test [existing outputs match the cache, left as is]
|
||||
✔ nx run e2e:e2e [existing outputs match the cache, left as is]
|
||||
|
||||
——————————————————————————————————————————————————————
|
||||
✔ nx run e2e:lint [existing outputs match the cache, left as is]
|
||||
✔ nx run react-store:lint [existing outputs match the cache, left as is]
|
||||
✔ nx run react-store:test [existing outputs match the cache, left as is]
|
||||
✔ nx run e2e:e2e [existing outputs match the cache, left as is]
|
||||
|
||||
NX Successfully ran targets test, lint, e2e for 5 projects (54ms)
|
||||
——————————————————————————————————————————————————————
|
||||
|
||||
Nx read the output from the cache instead of running the command for 10 out of 10 tasks.
|
||||
> 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.
|
||||
```
|
||||
|
||||
Not all tasks might be cacheable though. You can configure the `cache` settings in the `targetDefaults` property of the `nx.json` file. You can also [learn more about how caching works](/features/cache-task-results).
|
||||
@ -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
|
||||
@ -867,9 +869,9 @@ dist/react-store/assets/index-e3b0c442.css 0.00 kB │ gzip: 0.02 kB
|
||||
dist/react-store/assets/index-378e8124.js 165.64 kB │ gzip: 51.63 kB
|
||||
✓ built in 496ms
|
||||
|
||||
——————————————————————————————————————————————————————————————————————————————————————————————————————————
|
||||
——————————————————————————————————————————————————————————————————————————————————————————————————————————
|
||||
|
||||
NX Successfully ran target build for project reactutorial (1s)
|
||||
> NX Successfully ran target build for project reactutorial (1s)
|
||||
```
|
||||
|
||||
All the required files will be placed in `dist/react-store` and `dist/inventory` and can be deployed to your favorite hosting provider.
|
||||
@ -1027,8 +1029,8 @@ 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 run products:lint
|
||||
> NX Running target lint for 7 projects
|
||||
✖ nx run products:lint
|
||||
Linting "products"...
|
||||
|
||||
/Users/isaac/Documents/code/nx-recipes/react-monorepo/libs/products/src/lib/product-list/product-list.tsx
|
||||
@ -1042,20 +1044,20 @@ If you lint your workspace you'll get an error now:
|
||||
Lint errors found in the listed files.
|
||||
|
||||
|
||||
✔ nx run orders:lint (996ms)
|
||||
✔ nx run react-store:lint (1s)
|
||||
✔ nx run react-store-e2e:lint (581ms)
|
||||
✔ nx run inventory-e2e:lint (588ms)
|
||||
✔ nx run inventory:lint (836ms)
|
||||
✔ nx run shared-ui:lint (753ms)
|
||||
✔ nx run orders:lint (996ms)
|
||||
✔ nx run react-store:lint (1s)
|
||||
✔ nx run react-store-e2e:lint (581ms)
|
||||
✔ nx run inventory-e2e:lint (588ms)
|
||||
✔ nx run inventory:lint (836ms)
|
||||
✔ nx run shared-ui:lint (753ms)
|
||||
|
||||
————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
|
||||
————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
|
||||
|
||||
NX Ran target lint for 7 projects (2s)
|
||||
> NX Ran target lint for 7 projects (2s)
|
||||
|
||||
✔ 6/7 succeeded [0 read from cache]
|
||||
✔ 6/7 succeeded [0 read from cache]
|
||||
|
||||
✖ 1/7 targets failed, including the following:
|
||||
✖ 1/7 targets failed, including the following:
|
||||
- nx run products:lint
|
||||
```
|
||||
|
||||
|
||||
@ -30,22 +30,22 @@ npm create astro@latest
|
||||
We can leverage [`nx init`](/recipes/adopting-nx/adding-to-existing-project#installing-nx-on-a-non-monorepo-project) to add Nx to the Astro application.
|
||||
|
||||
```{% command="npx nx@latest init" path="~/astro-app"%}
|
||||
NX 🐳 Nx initialization
|
||||
> NX 🐳 Nx initialization
|
||||
|
||||
|
||||
NX 🧑🔧 Please answer the following questions about the scripts found in your package.json in order to generate task runner configuration
|
||||
> NX 🧑🔧 Please answer the following questions about the scripts found in your package.json in order to generate task runner configuration
|
||||
|
||||
✔ Which of the following scripts are cacheable? (Produce the same output given the same input, e.g. build, test and lint usually are, serve and start are not). You can use spacebar to select one or more scripts. · build
|
||||
|
||||
|
||||
✔ Would you like remote caching to make your build faster? · Yes
|
||||
|
||||
NX 📦 Installing dependencies
|
||||
> NX 📦 Installing dependencies
|
||||
|
||||
NX 🎉 Done!
|
||||
> NX 🎉 Done!
|
||||
|
||||
- Enabled computation caching!
|
||||
- Learn more at https://nx.dev/recipes/adopting-nx/adding-to-existing-project.
|
||||
- Enabled computation caching!
|
||||
- Learn more at https://nx.dev/recipes/adopting-nx/adding-to-existing-project.
|
||||
```
|
||||
|
||||
You can add a task as cacheable after the fact by updating the `cacheableOperations` in the `nx.json` file. Learn more about [caching task results](/recipes/adopting-nx/adding-to-existing-project#installing-nx-on-a-non-monorepo-project) or [how caching works](/features/cache-task-results).
|
||||
@ -93,7 +93,7 @@ The command below uses the `as-provided` directory flag behavior, which is the d
|
||||
{% /callout %}
|
||||
|
||||
```{% command="nx g @nx/js:lib ui --directory=libs/ui --simpleName --minimal" path="~/astro-app"}
|
||||
NX Generating @nx/js:library
|
||||
> NX Generating @nx/js:library
|
||||
|
||||
✔ Which unit test runner would you like to use? · none
|
||||
✔ Which bundler would you like to use to build the library? Choose 'none' to skip build setup. · none
|
||||
|
||||
@ -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'
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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".
|
||||
|
||||
@ -56,7 +56,7 @@ Nx Release will prompt you to pick a version bump for all the packages in the re
|
||||
|
||||
```{% command="nx release --first-release --dry-run" %}
|
||||
|
||||
NX Running release version for project: pkg-1
|
||||
> NX Running release version for project: pkg-1
|
||||
|
||||
pkg-1 🔍 Reading data for package "@myorg/pkg-1" from packages/pkg-1/package.json
|
||||
pkg-1 📄 Resolved the current version as 0.0.1 from packages/pkg-1/package.json
|
||||
@ -77,21 +77,21 @@ After this prompt, the command will finish, showing you the preview of changes t
|
||||
|
||||
```{% command="nx release --first-release --dry-run" %}
|
||||
|
||||
NX Running release version for project: pkg-1
|
||||
> NX Running release version for project: pkg-1
|
||||
|
||||
pkg-1 🔍 Reading data for package "@myorg/pkg-1" from packages/pkg-1/package.json
|
||||
pkg-1 📄 Resolved the current version as 0.0.1 from packages/pkg-1/package.json
|
||||
✔ What kind of change is this for the 3 matched projects(s)? · patch
|
||||
pkg-1 ✍️ New version 0.0.2 written to packages/pkg-1/package.json
|
||||
|
||||
NX Running release version for project: pkg-2
|
||||
> NX Running release version for project: pkg-2
|
||||
|
||||
pkg-2 🔍 Reading data for package "@myorg/pkg-2" from packages/pkg-2/package.json
|
||||
pkg-2 📄 Resolved the current version as 0.0.1 from packages/pkg-2/package.json
|
||||
pkg-2 ✍️ New version 0.0.2 written to packages/pkg-2/package.json
|
||||
pkg-2 ✍️ Applying new version 0.0.2 to 1 package which depends on pkg-2
|
||||
|
||||
NX Running release version for project: pkg-3
|
||||
> NX Running release version for project: pkg-3
|
||||
|
||||
pkg-3 🔍 Reading data for package "@myorg/pkg-3" from packages/pkg-3/package.json
|
||||
pkg-3 📄 Resolved the current version as 0.0.1 from packages/pkg-3/package.json
|
||||
@ -108,14 +108,14 @@ UPDATE packages/pkg-1/package.json [dry-run]
|
||||
+ "@myorg/pkg-2": "0.0.2"
|
||||
},
|
||||
|
||||
UPDATE packages/pkg-2/package.json [dry-run]
|
||||
UPDATE packages/pkg-2/package.json [dry-run]
|
||||
|
||||
"name": "@myorg/pkg-2",
|
||||
- "version": "0.0.1",
|
||||
+ "version": "0.0.2",
|
||||
"dependencies": {
|
||||
|
||||
UPDATE packages/pkg-3/package.json [dry-run]
|
||||
UPDATE packages/pkg-3/package.json [dry-run]
|
||||
|
||||
"name": "@myorg/pkg-3",
|
||||
- "version": "0.0.1",
|
||||
@ -123,15 +123,15 @@ UPDATE packages/pkg-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,13 +167,13 @@ The command will proceed as before, prompting for a version bump and showing a p
|
||||
|
||||
✔ Do you want to publish these versions? (y/N) · true
|
||||
|
||||
NX Running target nx-release-publish for 3 projects:
|
||||
> NX Running target nx-release-publish for 3 projects:
|
||||
|
||||
- pkg-1
|
||||
- pkg-2
|
||||
- pkg-3
|
||||
- pkg-1
|
||||
- pkg-2
|
||||
- pkg-3
|
||||
|
||||
—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
|
||||
—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
|
||||
|
||||
> nx run pkg-1:nx-release-publish
|
||||
|
||||
@ -241,9 +241,9 @@ total files: 12
|
||||
|
||||
Published to https://registry.npmjs.org with tag "latest"
|
||||
|
||||
—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
|
||||
—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
|
||||
|
||||
NX Successfully ran target nx-release-publish for 3 projects
|
||||
> NX Successfully ran target nx-release-publish for 3 projects
|
||||
|
||||
```
|
||||
|
||||
|
||||
@ -24,13 +24,13 @@ Skipped publishing packages.
|
||||
Nx Release provides a publishing subcommand that performs just the publishing step. Use this in your CI/CD pipeline to publish the packages.
|
||||
|
||||
```{% command="nx release publish" %}
|
||||
NX Running target nx-release-publish for 3 projects:
|
||||
> NX Running target nx-release-publish for 3 projects:
|
||||
|
||||
- pkg-1
|
||||
- pkg-2
|
||||
- pkg-3
|
||||
- pkg-1
|
||||
- pkg-2
|
||||
- pkg-3
|
||||
|
||||
—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
|
||||
—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
|
||||
|
||||
> nx run pkg-1:nx-release-publish
|
||||
|
||||
@ -98,9 +98,9 @@ total files: 12
|
||||
|
||||
Published to https://registry.npmjs.org with tag "latest"
|
||||
|
||||
—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
|
||||
—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
|
||||
|
||||
NX Successfully ran target nx-release-publish for 3 projects
|
||||
> NX Successfully ran target nx-release-publish for 3 projects
|
||||
```
|
||||
|
||||
## Publish in Github Actions
|
||||
|
||||
@ -47,9 +47,9 @@ yarn run v1.22.19
|
||||
$ node ./generateDocsSite.js
|
||||
Documentation site generated in /docs
|
||||
|
||||
————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
|
||||
————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
|
||||
|
||||
NX Successfully ran target docs for project myorg (5s)
|
||||
> NX Successfully ran target docs for project myorg (5s)
|
||||
```
|
||||
|
||||
## Configuring a Root-Level Target
|
||||
@ -89,11 +89,11 @@ yarn run v1.22.19
|
||||
$ node ./generateDocsSite.js
|
||||
Documentation site generated in /docs
|
||||
|
||||
————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
|
||||
————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
|
||||
|
||||
NX Successfully ran target docs for project myorg (31ms)
|
||||
> NX Successfully ran target docs for project myorg (31ms)
|
||||
|
||||
Nx read the output from the cache instead of running the command for 1 out of 1 tasks.
|
||||
Nx read the output from the cache instead of running the command for 1 out of 1 tasks.
|
||||
```
|
||||
|
||||
Read more about [cacheableOperations](/features/cache-task-results) and fine-tuning caching with [task inputs](/recipes/running-tasks/configure-inputs).
|
||||
|
||||
@ -26,16 +26,16 @@ Here's the source code of the final result for this tutorial.
|
||||
Create a new Vue application with the following command:
|
||||
|
||||
```{% command="npx create-nx-workspace@latest myvueapp --preset=vue-standalone" path="~" %}
|
||||
NX Let's create a new workspace [https://nx.dev/getting-started/intro]
|
||||
> NX Let's create a new workspace [https://nx.dev/getting-started/intro]
|
||||
|
||||
✔ Test runner to use for end to end (E2E) tests · cypress
|
||||
✔ Default stylesheet format · css
|
||||
✔ Set up CI with caching, distribution and test deflaking · github
|
||||
|
||||
NX Creating your v17.0.0 workspace.
|
||||
> NX Creating your v17.0.0 workspace.
|
||||
|
||||
To make sure the command works reliably in all environments, and that the preset is applied correctly,
|
||||
Nx will run "npm install" several times. Please wait.
|
||||
To make sure the command works reliably in all environments, and that the preset is applied correctly,
|
||||
Nx will run "npm install" several times. Please wait.
|
||||
```
|
||||
|
||||
You can also choose [Playwright](/nx-api/playwright) for your e2e tests or a different stylesheet format. In this tutorial we're going to use Cypress and css. The above command generates the following structure:
|
||||
@ -215,14 +215,14 @@ More conveniently, we can also run them in parallel using the following syntax:
|
||||
|
||||
```{% command="nx run-many -t test lint e2e" path="myvueapp" %}
|
||||
|
||||
✔ nx run e2e:lint (1s)
|
||||
✔ nx run myvueapp:lint (1s)
|
||||
✔ nx run myvueapp:test (2s)
|
||||
✔ nx run e2e:e2e (6s)
|
||||
✔ nx run e2e:lint (1s)
|
||||
✔ nx run myvueapp:lint (1s)
|
||||
✔ nx run myvueapp:test (2s)
|
||||
✔ nx run e2e:e2e (6s)
|
||||
|
||||
——————————————————————————————————————————————————————
|
||||
——————————————————————————————————————————————————————
|
||||
|
||||
NX Successfully ran targets test, lint, e2e for 2 projects (8s)
|
||||
> NX Successfully ran targets test, lint, e2e for 2 projects (8s)
|
||||
```
|
||||
|
||||
### Caching
|
||||
@ -235,16 +235,16 @@ Note that all of these targets are automatically cached by Nx. If you re-run a s
|
||||
|
||||
```{% command="nx run-many -t test lint e2e" path="myvueapp" %}
|
||||
|
||||
✔ nx run myvueapp:lint [existing outputs match the cache, left as is]
|
||||
✔ nx run e2e:lint [existing outputs match the cache, left as is]
|
||||
✔ nx run myvueapp:test [existing outputs match the cache, left as is]
|
||||
✔ nx run e2e:e2e [existing outputs match the cache, left as is]
|
||||
✔ nx run myvueapp:lint [existing outputs match the cache, left as is]
|
||||
✔ nx run e2e:lint [existing outputs match the cache, left as is]
|
||||
✔ nx run myvueapp:test [existing outputs match the cache, left as is]
|
||||
✔ nx run e2e:e2e [existing outputs match the cache, left as is]
|
||||
|
||||
———————————————————————————————————————————————————————
|
||||
———————————————————————————————————————————————————————
|
||||
|
||||
NX Successfully ran targets test, lint, e2e for 2 projects (143ms)
|
||||
> NX Successfully ran targets test, lint, e2e for 2 projects (143ms)
|
||||
|
||||
Nx read the output from the cache instead of running the command for 4 out of 4 tasks.
|
||||
Nx read the output from the cache instead of running the command for 4 out of 4 tasks.
|
||||
```
|
||||
|
||||
Not all tasks might be cacheable though. You can mark all targets of a certain type as cacheable by setting `cache` to `true` in the `targetDefaults` of the `nx.json` file. You can also [learn more about how caching works](/features/cache-task-results).
|
||||
@ -269,7 +269,7 @@ You can just create new Vue components as you normally would. However, Nx plugin
|
||||
|
||||
```{% command="npx nx list @nx/vue" path="myvueapp" %}
|
||||
|
||||
NX Capabilities in @nx/vue:
|
||||
> NX Capabilities in @nx/vue:
|
||||
|
||||
GENERATORS
|
||||
|
||||
@ -293,7 +293,7 @@ More info can be found in [the integrate with editors article](/features/integra
|
||||
Run the following command to generate a new "hello-world" component. Note how we append `--dry-run` to first check the output.
|
||||
|
||||
```{% command="npx nx g @nx/vue:component hello-world --no-export --unit-test-runner=vitest --directory=src/components --dry-run" path="myvueapp" %}
|
||||
NX Generating @nx/vue:component
|
||||
> NX Generating @nx/vue:component
|
||||
|
||||
CREATE src/components/hello-world.spec.ts
|
||||
CREATE src/components/hello-world.vue
|
||||
@ -324,16 +324,16 @@ If you're ready and want to ship your application, you can build it using
|
||||
```{% command="npx nx build" path="myvueapp" %}
|
||||
> nx run myvueapp:build:production
|
||||
|
||||
vite v4.3.9 building for production...
|
||||
✓ 15 modules transformed.
|
||||
dist/myvueapp/index.html 0.43 kB │ gzip: 0.29 kB
|
||||
dist/myvueapp/assets/index-a0201bbf.css 7.90 kB │ gzip: 1.78 kB
|
||||
dist/myvueapp/assets/index-46a11b5f.js 62.39 kB │ gzip: 24.35 kB
|
||||
✓ built in 502ms
|
||||
vite v4.3.9 building for production...
|
||||
✓ 15 modules transformed.
|
||||
dist/myvueapp/index.html 0.43 kB │ gzip: 0.29 kB
|
||||
dist/myvueapp/assets/index-a0201bbf.css 7.90 kB │ gzip: 1.78 kB
|
||||
dist/myvueapp/assets/index-46a11b5f.js 62.39 kB │ gzip: 24.35 kB
|
||||
✓ built in 502ms
|
||||
|
||||
—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
|
||||
—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
|
||||
|
||||
NX Successfully ran target build for project myvueapp (957ms)
|
||||
> NX Successfully ran target build for project myvueapp (957ms)
|
||||
```
|
||||
|
||||
All the required files will be placed in the `dist/myvueapp` folder and can be deployed to your favorite hosting provider.
|
||||
@ -827,8 +827,8 @@ import { Orders } from 'orders';
|
||||
If you lint your workspace you'll get an error now:
|
||||
|
||||
```{% command="nx run-many -t lint" %}
|
||||
NX Running target lint for 5 projects
|
||||
✖ nx run products:lint
|
||||
> NX Running target lint for 5 projects
|
||||
✖ nx run products:lint
|
||||
Linting "products"...
|
||||
|
||||
/Users/isaac/Documents/code/nx-recipes/vue-standalone/modules/products/src/lib/products.vue
|
||||
@ -842,18 +842,18 @@ NX Running target lint for 5 projects
|
||||
Lint errors found in the listed files.
|
||||
|
||||
|
||||
✔ nx run orders:lint (913ms)
|
||||
✔ nx run e2e:lint [existing outputs match the cache, left as is]
|
||||
✔ nx run myvueapp:lint (870ms)
|
||||
✔ nx run shared-ui:lint (688ms)
|
||||
✔ nx run orders:lint (913ms)
|
||||
✔ nx run e2e:lint [existing outputs match the cache, left as is]
|
||||
✔ nx run myvueapp:lint (870ms)
|
||||
✔ nx run shared-ui:lint (688ms)
|
||||
|
||||
——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
|
||||
——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
|
||||
|
||||
NX Ran target lint for 5 projects (2s)
|
||||
> NX Ran target lint for 5 projects (2s)
|
||||
|
||||
✔ 4/5 succeeded [1 read from cache]
|
||||
✔ 4/5 succeeded [1 read from cache]
|
||||
|
||||
✖ 1/5 targets failed, including the following:
|
||||
✖ 1/5 targets failed, including the following:
|
||||
- nx run products:lint
|
||||
|
||||
```
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
|
||||
|
||||
@ -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}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -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}
|
||||
|
||||
|
||||
@ -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.
|
||||
|
||||
|
||||
`);
|
||||
|
||||
@ -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;
|
||||
@ -74,7 +80,7 @@ class CLIOutput {
|
||||
color: string;
|
||||
title: string;
|
||||
}): void {
|
||||
this.writeToStdOut(`${this.applyCLIPrefix(color, title)}${EOL}`);
|
||||
this.writeToStdOut(` ${this.applyCLIPrefix(color, title)}${EOL}`);
|
||||
}
|
||||
|
||||
private writeOptionalOutputBody(bodyLines?: string[]): void {
|
||||
@ -82,7 +88,7 @@ class CLIOutput {
|
||||
return;
|
||||
}
|
||||
this.addNewline();
|
||||
bodyLines.forEach((bodyLine) => this.writeToStdOut(`${bodyLine}${EOL}`));
|
||||
bodyLines.forEach((bodyLine) => this.writeToStdOut(` ${bodyLine}${EOL}`));
|
||||
}
|
||||
|
||||
private cliName = 'NX';
|
||||
@ -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}`
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -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}`)
|
||||
);
|
||||
}
|
||||
|
||||
@ -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:')}`
|
||||
|
||||
@ -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 [];
|
||||
}
|
||||
|
||||
@ -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 ')));
|
||||
|
||||
|
||||
@ -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;
|
||||
@ -90,7 +95,7 @@ class CLIOutput {
|
||||
color: string;
|
||||
title: string;
|
||||
}): void {
|
||||
this.writeToStdOut(`${this.applyNxPrefix(color, title)}${EOL}`);
|
||||
this.writeToStdOut(` ${this.applyNxPrefix(color, title)}${EOL}`);
|
||||
}
|
||||
|
||||
private writeOptionalOutputBody(bodyLines?: string[]): void {
|
||||
@ -98,15 +103,19 @@ class CLIOutput {
|
||||
return;
|
||||
}
|
||||
this.addNewline();
|
||||
bodyLines.forEach((bodyLine) => this.writeToStdOut(`${bodyLine}${EOL}`));
|
||||
bodyLines.forEach((bodyLine) => this.writeToStdOut(` ${bodyLine}${EOL}`));
|
||||
}
|
||||
|
||||
applyNxPrefix(color = 'cyan', text: string): string {
|
||||
let nxPrefix = '';
|
||||
if (chalk[color]) {
|
||||
nxPrefix = chalk.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) {
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user