With this change we configure new libraries to be published using Ivy partial compilation instead of the deprecated View Engine rendering engine, we also remove several view engine specific `angularCompilerOptions`.
New libraries can be published using this format, as they are not depend upon by View Engine libraries or application.
Previously, `addSymbolToNgModuleMetadata()` assumed that the added
symbol would not span multiple lines. In most cases, the added symbol is
a single word, so this assumption was correct. In some cases, however,
we might want to add a mutli-line string, such as a static method of an
`@NgModule`:
```ts
imports: [
SomeModule.staticMethod({
prop1: 'val1',
prop2: 'val2'
})
]
```
This commit allows `addSymbolToNgModuleMetadata()` to correctly handle
multi-line strings by ensuring that added metadata symbols are always
put on a new line (even if the array is empty) and each line in the
string is indented as necessary.
With this change we do several changes to the `angular.json` configuration for `build` , `server` and `app-shell` targets so that these are `production` by default.
- build, server and app-shell targets are configured to run production by default.
- We add a new configuration named `development` to run the mentioned builder targets in development. Ex: `ng build --configuration development`.
- When adding `universal` or `app-shell`, we generate the full set of configurations as per the `buiid` target. Previously, we only generated the `production` configuration.
- We added a helper script in `package.json` to run build in watch mode. `npm run watch` which is a shortcut for `ng build --watch --configuration development`
It's confusing and redundant to use `When true` and `when false` in descriptions for a CLI arguments because specifying false/true is redundant in a command line argument flag and in most cases users will not do it.
Example:
`--foo=true` is the same as `--foo`
`--foo=false` is the same as `--no-foo`
Currently it can be hard to find how to configure Jasmine in the Karma config.
For example, a developer might want to reproduce a randomly failing test with a specific seed.
This commit adds some information that may be helpful to beginners.
Currently, Karma is reporting a failed test and the total twice in a bare CLI project:
```
12 11 2020 13:59:46.666:INFO [launcher]: Starting browser Chrome
✔ Browser application bundle generation complete.
12 11 2020 13:59:50.457:INFO [Chrome 86.0.4240.198 (Mac OS 10.15.7)]: Connected on socket F0ehOBWL6BYFqXfbAAAA with id 69358036
Chrome 86.0.4240.198 (Mac OS 10.15.7) AppComponent should render title FAILED
Error: Expected 'ponyracer app is running!' to contain 'other'.
at <Jasmine>
at UserContext.<anonymous> (src/app/app.component.spec.ts:29:65)
at ZoneDelegate.invoke (node_modules/zone.js/dist/zone-evergreen.js:364:1)
at ProxyZoneSpec.push.QpwO.ProxyZoneSpec.onInvoke (node_modules/zone.js/dist/zone-testing.js:292:1)
Chrome 86.0.4240.198 (Mac OS 10.15.7): Executed 2 of 3 (1 FAILED) (0 secs / 0.231 secs)
Chrome 86.0.4240.198 (Mac OS 10.15.7) AppComponent should render title FAILED
Error: Expected 'ponyracer app is running!' to contain 'other'.
at <Jasmine>
at UserContext.<anonymous> (src/app/app.component.spec.ts:29:65)
at ZoneDelegate.invoke (node_modules/zone.js/dist/zone-evergreen.js:364:1)
Chrome 86.0.4240.198 (Mac OS 10.15.7): Executed 3 of 3 (1 FAILED) (0.309 secs / 0.242 secs)
TOTAL: 1 FAILED, 2 SUCCESS
TOTAL: 1 FAILED, 2 SUCCESS
```
This is a bit annoying when you have several tests failing, and tend to confuse beginners.
This commit configures the Karma HTML reporter to suppress the duplicates (both error and success), which results in only one reporter showing the failed test and total:
```
12 11 2020 14:01:43.002:INFO [launcher]: Starting browser Chrome
✔ Browser application bundle generation complete.
12 11 2020 14:01:58.728:INFO [Chrome 86.0.4240.198 (Mac OS 10.15.7)]: Connected on socket Pc0xPggxJPdC8E_LAAAA with id 54797430
Chrome 86.0.4240.198 (Mac OS 10.15.7) AppComponent should render title FAILED
Error: Expected 'ponyracer app is running!' to contain 'other'.
at <Jasmine>
at UserContext.<anonymous> (src/app/app.component.spec.ts:29:65)
at ZoneDelegate.invoke (node_modules/zone.js/dist/zone-evergreen.js:364:1)
at ProxyZoneSpec.push.QpwO.ProxyZoneSpec.onInvoke (node_modules/zone.js/dist/zone-testing.js:292:1)
Chrome 86.0.4240.198 (Mac OS 10.15.7): Executed 3 of 3 (1 FAILED) (0.331 secs / 0.252 secs)
TOTAL: 1 FAILED, 2 SUCCESS
```
Since will remove lintFix usage warnings when the option is set by a default of another schematic.
Example when executing
```
ng generate module customers --route customers --module app.module
```
The lintFix default of the module schematic will be passed down to the component schematic which would cause a warning to be shown.
Closes#19169
With this change we enable emitting declaration maps when building libraries to be consumed locally as this improved DX as this will allow editors to go to the original typescript file when using `Go to Definition`.
For production builds, declaration maps are disabled because they are not useful since the source files are not included in the distributable package.
Closes#17888
TypeScript 3.9 requires tslib 2.0.0, with this change we;
- Update tslib existing and new workspaces to use tslib 2.0.0
- Update new and existing libraries to use tslib 2.0.0 as a direct depedency.
Tslib version is bound to the TypeScript version used to compile the library. Thus, we shouldn't list `tslib` as a `peerDependencies`. This is because, a user can install libraries which have been compiled with older versions of TypeScript and thus require multiple `tslib` versions to be installed.
Closes: #17753
Reference: TOOL-1374
* fix(@schematics/angular): regression tsconfig.json
fix(@schematics/angular): regression tsconfig.json …
Unverified
0e318ae
Regression in tsconfig.json set `"outDir": "./dist/out-tsc"` for problems in VSCode TS(2307) when building library referred in tsconfig "paths"
Closes: #16708
* fix(@schematics/angular): regression tsconfig.json
Improve paths in root tsconfig.json for better DX experience when using auto imports in IDE's.
Closes#16709
* fix(@schematics/angular): regression tsconfig.json
Improve paths in root tsconfig.json for better DX experience when using auto imports in IDE's.
Fix code lint.
Closes#16709
* fix(@schematics/angular): regression tsconfig.json
Improve paths in root tsconfig.json for better DX experience when using auto imports in IDE's.
Fix test code to conform new behaviour.
Closes#16709
Currently the library schematic doesn't support adding a secondary entry-point and having deep imports is not recommanded.
It's best if paths are more stricter when having a secondary entry-point instead of a wildcard.
Instead of :
```
"lib/*": [
"dist/lib/*"
]
```
Users should configure:
```
"lib/secondary": [
"dist/lib/secondary"
]
```
This would allow a better DX experience when using auto imports in IDE's.
Closes: #15952
With this change we remove the requirement to add tsickle as a dependency when having a workspace library.
Since the CTOR downlevel transformer which was previously provided via tsickle is now in ng-packagr version 5.5.1+ We migrate existing libraries to remove the need for tsickle.
Since `NGCC` is non incremental and in library projects we have the original TS sources
we don't need to build a library using the `VE` and transform it using `NGCC`. Instead we can build the library using `NGTSC` (Ivy) directly
as this enables faster incremental compilations and a better development experience.
Libraries now have a `production` configuration, which enabled `VE` compilations. As it is not recommended to publish NGTSC (Ivy)
built libraries to NPM repositories, since Ivy libraries are not backwards compatible with the legacy View Engine.
This is required to support forward references in ES2015 target code. tsickle provides the constructor parameter downlevel logic that removes the runtime TDZ error that would otherwise be encountered.
When `newProjectRoot` the paths are prefixed with an `/` example `/project-name/tsconfig.lib.json` which results in these being marked as absolute paths, which causes build failures.
Fixes#14108