Nx 6.2: Angular 6.1 and Better State Management

Jason Jean
Nx Devtools
Published in
3 min readAug 6, 2018

--

We released Nx 6.1 in June. Today we are happy to announce Nx 6.2, which brings improvements to the NgRx schematics, a shared karma configuration, and bug fixes.

Nx is a set of extensible dev tools for monorpepos, which we at Nrwl developed based on our experience working at Google and helping the Fortune 500 build ambitious applications.

Updated Angular and NgRx

Nx 6.2 brings in Angular 6.1 and the latest version of NgRx 6.x. For more information, see:

Try out Nx 6.2 today using our Quick Start Guide.

Better State Management with NgRx Facades

Prior to Nx 6.2, the Nx schematics already provided scalable state management with NgRx.

# See help for the Nx `ngrx` schematicng g ngrx -h

Now there is a new option when generating NgRx files to also generate a facade on top of your state management to help you work even better at scale.

Use the latest Nx schematics to generate your NgRx files with an associated Facade implementation:

# Generate ngrx files in the 'cars' libraryng g ngrx cars --module=libs/cars/src/lib/cars.module.ts --facade

By default the facade classes are not generated with ng g ngrx

Use the --facade flag to include scaffolding for Facades.

For details on NgRx and Facades, read the article Ngrx + Facades: Better State Management.

Quick Links:

Shared Karma Configuration

Every project, every app and lib, in Angular CLI 6 has its own Karma configuration. This provides a lot of flexibility, but at the same time creates redundant boilerplate.

With Nx 6.2, we are introducing a shared karma.conf.js which gets extended by projects’ karma files. So you get the flexibility without the boilerplate.

Note: To avoid any breaking changes, existing karma configuration files will not be updated when upgrading from Nx 6.1 to Nx 6.2. You will have to update them yourself.

Quick-Start to using Nx:

Creating a new workspace

Install the new version of Nx and create a workspace myorg by running:

yarn global add @nrwl/schematicscreate-nx-workspace myorg --yarn

or (if you are using npm)

npm install -g @nrwl/schematicscreate-nx-workspace myorg

Add Nx to an existing Angular CLI workspace

To add Nx on top of an existing Angular CLI 6.x workspace, run the following.

ng add @nrwl/schematics

Updating an existing Nx workspace

If you are already onNx 6.0, upgrade your workspace to Nx 6.2 by running the following.

ng update @nrwl/schematics@6.2.0

If you are already on Nx 6.1, you can also use

yarn update# or if you are using 'npm'
npm run update

Updating from Nx 1.x

If you are already an Nx 1.x user, you can update by first installing the latest version of Nrwl Nx via:

yarn add @nrwl/schematics@latest --devyarn update

or (if you are using npm)

npm install @nrwl/schematics@latest --save-devnpm run update

Special Thanks

We’d like to extend a special thanks to the following individuals who also contributed to this release:

Let us know what you think

If you have any issues with Nx, please file an issue on our GitHub.

Learn more

If your company or team is experiencing challenges with architecting and engineering Angular applications at scale, the team at Nrwl can help! Visit https://nrwl.io to learn more and to get in touch.

--

--