angular-docs-cn/packages/localize/schematics/ng-add
Pete Bacon Darwin 50f4d8a1ce fix(localize): install `@angular/localize` in `devDependencies` by default (#38680)
Previously this package was installed in the default `dependencies` section
of `package.json`, but this meant that its own dependencies are treated as
dependencies of the main project: Babel, for example.

Generally, $localize` is not used at runtime - it is compiled out by the
translation tooling, so there is no need for it to be a full dependency.
In fact, even if it is used at runtime, the package itself is only used
at dev-time since the runtime bits will be bundled into a distributable.
So putting this package in `devDependencies` would only prevent libraries
from bringing the package into application projects that used them. This
is probably good in itself, since it should be up to the downstream project
to decide if it wants to include `@angular/localize` at runtime.

This commit changes the default location of the package to be the
`devDependencies` section, but gives an option `useAtRuntime` to choose
otherwise.

Fixes #38329

PR Close #38680
2020-09-03 09:41:38 -07:00
..
BUILD.bazel build: derive ts_library dep from jasmine_node_test boostrap label if it ends in `_es5` (#34736) 2020-01-15 14:58:07 -05:00
README.md fix(localize): install `@angular/localize` in `devDependencies` by default (#38680) 2020-09-03 09:41:38 -07:00
index.ts fix(localize): install `@angular/localize` in `devDependencies` by default (#38680) 2020-09-03 09:41:38 -07:00
index_spec.ts fix(localize): install `@angular/localize` in `devDependencies` by default (#38680) 2020-09-03 09:41:38 -07:00
schema.d.ts fix(localize): install `@angular/localize` in `devDependencies` by default (#38680) 2020-09-03 09:41:38 -07:00
schema.json fix(localize): install `@angular/localize` in `devDependencies` by default (#38680) 2020-09-03 09:41:38 -07:00
tsconfig-build.json feat(ivy): support ng-add in localize package (#32791) 2019-09-27 13:15:02 -07:00

README.md

@angular/localize schematic for ng add

This schematic will be executed when an Angular CLI user runs ng add @angular/localize.

It will search their angular.json file, and find polyfills and main files for server builders. Then it will add the @angular/localize/init polyfill that @angular/localize needs to work.

If the user specifies that they want to use $localize at runtime then the dependency will be added to the depdendencies section of package.json rather than in the devDependencies which is the default.