Releases: angular/angular-cli
v6.0.0 - Hamilton
CLI Version 6 – Hamilton
Hello y'all, CLI team again.
This is a really big release for us, and listing each changes individually would be too much information for you. As such we're going to summarize the new features and changes that are included, from a higher point of view.
Also, please note that there is a blog post for version 6 here.
ng eject
The 'eject' command has been temporarily disabled, as it is not yet compatible with the new
angular.json format. The new configuration format provides further flexibility to modify the
configuration of your workspace without ejecting. Ejection will be re-enabled in a future
release of the CLI.
In the meantime, you can eject with 1.7.4, then update your project and keep using webpack to build.
ng update
A new Angular CLI command to help simplify keeping your projects up to date with the latest versions. Packages can define logic which will be applied to your projects to ensure usage of latest features as well as making changes to reduce or eliminate the impact related to breaking changes.
Configuration information for ng update can be found here
ng add
A new Angular CLI command provides package authors the ability to include dynamic setup instructions as part of the installation procedures. When a user installs a package via ng add
and that package includes a schematic named "ng-add" logic will run to set up that package within your project.
For package owners:
ng-add
is powered by a single schematic named "ng-add" within your package's schematics collection. Options will be passed through to your schematic when running the schematic to allow for further configuration options.
PWA Support
Progressive Web Apps have grown in popularity and support with all major browswers supporting service workers. Adding the configuration and assets to configure your applications as PWAs can be confusing and time consuming, to simplify the process you can now run ng add @angular/pwa --project [project-name]
to configure the supplied project as a progressive web application.
Angular Workspace
The .angular-cli.json
configuration file is replaced with angular.json
workspace file, a new file the lays the foundation for multiple projects in a single workspace.
In this file you can find every configuration item and default that Angular CLI uses. Having all configuration on file allows you to avoid typing out multiple configuration flags on each command and npm
script.
If your editor has JSON schema support, you will be able to see auto-completion with suggestions and defaults for each property in the angular.json
file.
Read more about the Angular Workspace here.
Build improvements
The build system Angular CLI uses has been overhauled to be faster and more easily configurable.
We have upgrade to Webpack 4 which comes with several performance and bundling improvements.
Angular Workspaces will also allow you to configure each build exactly the way you need instead of using lengthy npm
scripts:
"configurations": {
"production": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true
}
}
Multi application support
Angular CLI now supports multiple individual applications within one workspace, each with separate configurations and defaults.
To create another app you can use the following command:
ng generate application my-other-app
The new application will be generated inside projects/my-other-app
.
Now we can serve
either application by passing the project name with the command:
ng serve my-other-app
Library Support
Angular CLI now comes with library support via ng-packagr plugged into the build system we use in Angular CLI, together with schematics for generating a library.
You can create a library in a existing workspace by running the following commands:
ng generate library my-lib
You should now have a library inside projects/my-lib
. It contains a component and a service inside a NgModule.
Read more about library creation here.
Schematic Defaults
Default values for schematics can be configured for any schematic property in any schematic collection. In previous versions the Angular CLI only provided access to configure defaults for certain properties of the default schematics.
Values can be provided at the root level:
// angular.json
{
...
"schematics": {
"@schematics/angular:component.inlineTemplate": true
}
}
Or at the project level:
// angular.json
{
"projects": {
"my-project": {
"schematics": {
"@schematics/angular:component.inlineTemplate": true
}
}
}
}
Or even at the global level, same as at the root level, except in a file located here:
[homedir]/.angular-config.json
Smart Defaults
Smart defaults is a new feature within Schematics which grants authors of schematics more control about how their values are parsed. An example is to specify how arguments (unnamed options) are parsed from the command line.
This example will set the value of the name option to the first argument. As you see defined in the $default
value.
"name": {
"type": "string",
"description": "The name option.",
"$default": {
"$source": "argv",
"index": 0
}
}
Breaking changes
The allowOutsideOutDir
option in assets has been removed.
The serve
option in ng e2e
is replaced with devServerTarget
. It allows you to specify which server target to use, and if it is set to empty string nothing will be served.
The completion
command has been removed as the functionality no longer aligns with this version.
The environment
option in build related commands is replaced with fileReplacements
, please see the wiki for how it can be used.
Special thanks to everyone who participated in this release:
Charles Lyding, Filipe Silva, Hans Larsen, Mike Brocchi, Alan Agius, Rahul Bhooteshwar, Cyrille Tuzi, Noel Mace, Christofer Steingrefer, Vikram Subramanian, Sébastien Cevey, Maxim Salnikov, Jose E, Cédric Exbrayat, sergey.sokolov, Yaroslav Admin, Will 保哥, Sylvain Dumont, Suguru Inatomi, Steven Enten, Stephen Fluin, Shai Reznik, PhilippeMorier, Miles Malerba, Michael Prentice, Matthias Lischka, Luke Chatton, Luis Confraria, Kasidit Iamthong, Jiaren Liu, GerbetMikhaël, George Kalpakas, Evan Carroll, Danny, Brandon, Alan
v6.0.0-rc.2
The Angular CLI just wanted to jump in real quick with an update while we prepare the final 6.0.0 release. There are going to be a lot of changes in this release, and listing them all here would not be the best for you. So we're working on proper Release Notes that will be easier to understand and digest. These are not ready yet.
Just wanted to lay out the large lines here for the moment:
- Library support! That was one of the most requested feature. You can generate a new library in your project by using
ng generate library <name>
. ng update
! You can now update your project's dependencies, for dependencies that support it, including the CLI itself.- New configuration format. The new file can be found at
angular.json
(but.angular.json
is also accepted). Runningng update
on a CLI 1.7 project will move you to the new configuration. - New way to structure your configuration. Your build information and schematics default can now be configured by project.
- Build flags now have a 1-to-1 representation in the configuration.
- Smaller package globally (and to a certain extent locally). We now only publish what the CLI needs, and include what your project needs (build and schematics) inside your project's package.json. This leads to a much smaller global package for the CLI itself (23M, and we keep improving).
ng config
now replaces both set and get. You can get values with (e.g.)ng config cli.packageManager
, and you can set a value with (e.g.)ng config -g cli.packageManager '"yarn"'
.- Build results in smaller packages in general, mostly due to webpack 4 now being fully supported.
And of course, much much more.
Cheers!
- The CLI Team.
1.7.4
v6.0.0-beta.5
Bug Fixes
- @angular/cli: when a schematic fails on commit errors fail the command (a9bbe2a)
- @ngtools/webpack: ensure webpack errors are actually an Error (9c4f9e9)
- @ngtools/webpack: prevent relative request path mapping (5dee617)
Features
- @angular/cli: add the add command (093e4ea)
- @angular/cli: allow commands to reparse options if needed (88fc93f)
- @angular/cli: Clean up generate options (12e10e3)
- @angular/cli: Update command runner. (9f77c86)
- @ngtools/webpack: prevent build failure in case of custom locale (0e46942)
BREAKING CHANGES
- @angular/cli: Removed collection and lint-fix options
v1.7.3
v6.0.0-beta.4
Bug Fixes
- @angular/cli: correct CSS extraction in prod with dynamic imports (2543d4f)
- @angular/cli: disable webpack performance hints (4a00f00)
- @angular/cli: prevent greedy CSS url function capture (6f72e28)
- @angular/cli: remove forced commonjs (d5192da)
Code Refactoring
- @angular/cli: remove webpack nodeJS globals shimming (c7a8b61)
Features
- update to webpack 4 (aeb8ea2)
- @angular/cli: add index html plugin (0393429)
- @angular/cli: extract all license types when enabled (7dde757)
- @angular/cli: shorten output filenames (dc7a4d8)
- @angular/cli: Support xliff2 for xi18n (#7734) (2067ff0)
- @angular/cli: update to webpack 4.0 final (af0080d)
- @angular/cli: update webpack-dev-server to 3.0 (80c3edc)
- @ngtools/webpack: add forkTypeChecker option (7c44a64)
- @ngtools/webpack: support webpack 4 plugin system (1dbff83)
BREAKING CHANGES
- @angular/cli: Libraries/Packages must contain a web version if not web specific.
- @ngtools/webpack: Webpack ^4.0.0 is now required as a peer dependency.
v1.7.2
v6.0.0-beta.3
Bug Fixes
- @angular/cli: correct lint failure aggregation (ecf0ccc)
- @angular/cli: fix ng help. (27106b6), closes #9412
- @angular/cli: improve processing multi-line url() CSS rules (1ec8cb3)
- @angular/cli: resolve dev server entrypoint (cc90755)
- @angular/cli: shut down after first Ctrl+C received (78d48be), closes #9647
- @angular/cli: work around npm peerdep issue (bc10dd2)
- @ngtools/webpack: account for shorthand properties when import eliding (a20b314)
- @ngtools/webpack: directly use single path mappings (595168e)
- @ngtools/webpack: normalize lazy route names and paths (2a2dc1e)
Code Refactoring
- set minimum node version to 8.9 (29338bc)
Features
- @angular/cli: support additional application lazy modules (3be17e7)
- @ngtools/webpack: add additional lazy module plugin option (7ce6523)
BREAKING CHANGES
- @angular/cli, @ngtools/webpack, @ngtools/logger, and @ngtools/json-schema now require NodeJS 8.9+
v1.7.1
Bug Fixes
- @angular/cli: correct lint failure aggregation (5b66371)
- @angular/cli: improve processing multi-line url() CSS rules (dea244f)
- @angular/cli: resolve dev server entrypoint (cb349b0)
- @angular/cli: shut down after first Ctrl+C received (c5ec36e), closes #9647
- @angular/cli: work around npm peerdep issue (ffc2e98)
- @ngtools/webpack: account for shorthand properties when import eliding (bbcc581)
- @ngtools/webpack: directly use single path mappings (d5a9895)
v6.0.0-beta.2
Bug Fixes
- @angular/cli: allow set prefix with no tslint config (5fc9b28)
- @angular/cli: allow usage of hidden command options (29d457d)
- @angular/cli: ensure external component styles are optimized (eed5794)
- @angular/cli: Fix help for generate command. (fab269a), closes #9412
- @angular/cli: prevent corruption of binary CSS resources (f19c5f7)
- @angular/cli: remove double console logs with different reporters (a161377), closes #9528
- @angular/cli: support empty index base href attribute (214be80)
- @angular/cli: support major versions greater than 1 (7d7897e)
- @angular/cli: update minimum version of copy-webpack-plugin (63044e5)
- @angular/cli: update Webpack to support empty array elements in optimizations (9af0c3f)