48 Commits

Author SHA1 Message Date
Alan Agius
14f8f5c5ab fix(@schematics/angular): remove browserslist configuration
By default the defaults are now configured in ng-packagr

https://github.com/ng-packagr/ng-packagr/blob/main/src/lib/styles/stylesheet-processor.ts#L35-L47
2022-07-07 15:38:04 +02:00
alkavats1
d52697047a refactor: refactored the code and removed the code smells
refactored the code and removed the code smells
2022-05-06 11:11:13 -07:00
Alan Agius
37a7239458 fix(@schematics/angular): address eslint linting failures in test.ts
Closes #22171
2021-11-18 20:26:39 +01:00
Alan Agius
81531d1b64 fix(@schematics/angular): remove target and lib options for library tsconfig
The `target` option is set directly in ng-packagr binary and cannot be overridden, while the `lib` option is inherited from the root level tsconfig.
2021-10-08 14:40:54 +02:00
Alan Agius
585adacd06 fix(@schematics/angular): don't add destroyAfterEach in newly generated spec files
This is now enabled by default.

See https://github.com/angular/angular/pull/43353 for more context.
2021-10-06 14:33:42 -05:00
Alan Agius
732ef79852 fix(@schematics/angular): add browserslist configuration in library projects
Previously, browserslist configuration was not added in library projects. This in some cases caused a large number of CSS prefixes to be included in components stylesheets
2021-08-27 15:57:57 +02:00
Alan Agius
20fd33f6d4 feat(@schematics/angular): destroy test module after every test
In version 12.1, the framework added the `destroyAfterEach` an opt-in feature that improves tests performance and also addresses two long-standing issues.

The idea, is to have this enabled by default in the future.  Related PR: https://github.com/angular/angular/pull/42566

Closes #21280
2021-07-07 10:31:20 -04:00
Alan Agius
695a01ba02 feat(@schematics/angular): configure new libraries to be published in Ivy partial mode
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.
2021-04-09 18:40:39 -04:00
Alan Agius
226a8d274d feat(@schematics/angular): remove tslint and codelyzer from new projects
Both of these projects and the tslint builder are deprecated.

Closes #20105 and closes #18465
2021-03-16 15:49:46 +01:00
Alan Agius
bb38f85202 feat(@schematics/angular): use new zone.js entry-points 2021-02-17 12:44:43 -06:00
cexbrayat
5a0940e62d fix(@schematics/angular): document jasmine options
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.
2020-11-20 11:37:19 +00:00
cexbrayat
53193eaf77 fix(@schematics/angular): remove duplicated Karma traces
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
```
2020-11-13 15:53:01 -05:00
cexbrayat
8e8a51c3fa fix(@schematics/angular): remove trailing comma in karma conf
We usually don't have trailing commas in the generated code of the CLI (and this one makes the linter/formatter angry).
2020-11-12 13:16:40 -05:00
Alan Agius
9768230b4d docs: update further help section in readme 2020-10-21 14:15:24 +02:00
cexbrayat
8303681123 style(@schematics/angular): fix formatting of coverage reporters 2020-09-14 12:34:33 -04:00
Alan Agius
0d7bbd82f6 refactor(@schematics/angular): remove lcov from coverage reporters
In many users will not use lcov reports, also  this reporter generates an HTML report, which we are already generating using the html reporter.\
2020-09-11 15:17:23 -04:00
Keen Yee Liau
8995e49f0b feat(@angular-devkit/build-angular): Switch to karma-coverage
This commit switches coverage tooling from karma-coverage-istanbul-reporter
to karma-coverage since it's better supported.

Closes #17757
2020-09-06 12:22:25 +02:00
Alan Agius
8b96e52d83 fix(@schematics/angular): remove solution style tsconfig from new projects
Following the issues highlighted in https://docs.google.com/document/d/1eB6cGCG_2ircfS5GzpDC9dBgikeYYcMxghVH5sDESHw/edit?usp=sharing and discussions held with the TypeScript team. The best course of action is to rollback this feature.

In future, it is not excluded that solution style tsconfigs are re-introduced..

Closes #18040 and closes #18170
2020-08-12 19:26:12 +01:00
Alan Agius
76f525cec2 fix(@schematics/angular): add links to generated tsconfig files
We now add a link to generated tsconfig.json to make is easier for users to find relevant information.
2020-06-15 08:48:14 +02:00
Alan Agius
17dbaeb1fa feat(@schematics/angular): emit declaration maps for local library builds
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
2020-06-12 19:39:58 +02:00
Alan Agius
ade3f491fe fix(@schematics/angular): remove node typings from tsconfig.spec.json 2020-05-27 14:17:05 +02:00
Alan Agius
bede23226a feat(@schematics/angular): add solutions style tsconfig structure
In version 3.9, TypeScript introduced the concept of "Solutions Style" tsconfig to improve developer experience.

More info: https://devblogs.microsoft.com/typescript/announcing-typescript-3-9-rc/#solution-style-tsconfig

Closes #17493 and closes #8138
2020-05-20 12:12:33 -07:00
Alan Agius
a042290726 fix(@schematics/angular): update to tslib 2.0.0
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
2020-05-20 11:25:31 +01:00
Cyrille Tuzi
ee589d9116 fix(@schematics/angular): add compliance with no-any lint rule 2020-01-29 10:19:36 -08:00
Alan Agius
a384a983fa feat(@schematics/angular): add tslib as a peerDependencies in library package.json
This is to align with https://github.com/angular/angular/pull/32167
2019-10-22 13:26:38 -07:00
Alan Agius
745670fa6a feat(@schematics/angular): remove dependency on tsickle (#15603)
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.
2019-09-18 14:50:29 +01:00
Alan
beb7070ac8 feat(@schematics/angular): introduce Ivy libraries for development
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.
2019-08-16 09:31:02 -07:00
Wataru.Kasahara
4cbf59beb2 fix(@schematics/angular): add text-summary to code coverage reporter 2019-07-10 04:16:27 +08:00
Charles Lyding
635de55982 fix(@schematics/angular): enable tsickle for library compilation
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.
2019-05-23 19:12:40 +02:00
Charles Lyding
6b28d3ac51 fix(@schematics/angular): remove emitDecoratorMetadata TS option for new applications 2019-05-23 19:12:40 +02:00
Charles Lyding
a0a583adaa fix(@schematics/angular): remove unused core-js dependency from new projects
Required polyfills are now managed directly by the build system.  If additional polyfills are required, packages can be manually added as needed.
2019-04-04 09:28:02 -07:00
Alan Agius
9e18cf240e fix(@schematics/angular): kebab case prefix causes lint errors in new directives
`Component` selectors are always kekabed while `Directive` selectors are always camelized. This updates the lint rules to convert the prefix to the appropiate case

Fixes #13796
2019-03-04 09:35:22 -08:00
Alan Agius
a139243644 refactor: clean up library tsconfig
These properties are already defined in the root tsconfig
2019-02-14 20:58:59 +08:00
Charles Lyding
91d457af73 refactor(@schematics/angular): remove redundant branchAndMerge rules 2019-02-13 15:21:37 -08:00
Luis Confraria
1f9c84f98c fix(@schematics/angular): set restartOnFileChange to true in karma.conf templates
Fix #13542
2019-02-08 16:12:19 -08:00
Alan Agius
6ae1752891 feat(@schematics/angular): remove annotateForClosureCompiler in libraries tsconfig (#13546)
Users outside of Google don't usually need closure annotations.

We should also follow up with ng-packagr to remove tsickle from peerDependency and afterwards, we be able to remove tsickle from the added dependencies when running this schematic
2019-01-30 11:24:04 -08:00
Alan Agius
36eba0c9fc refactor: use .template suffix for all schematic files
Currently when using `ivy-ngcc` it will print out a warning

```
Failed to read entry point info from //node_modules/@schematics/angular/workspace/files/package.json with error SyntaxError: Unexpected token < in JSON at position 1121.
```

Fixes #13378
2019-01-16 10:29:56 -08:00
Amadou Sall
3e14158283 fix(@schematics/angular): generate coverage for libs in their own folder 2019-01-14 10:57:51 -08:00
Klaus Kazlauskas
100cf47cb9 feat(@schematics/angular): generate a library with a README.md file
Fixes #13296
2019-01-08 13:45:18 -08:00
Sibiraj
96be267815 style: fix indentation in tslint.json 2018-10-31 21:01:59 -07:00
Alan Agius
8bbba9d0ac fix(@schematics/angular): update @angular peerDependencies for new libraries 2018-10-19 15:58:12 -07:00
Christian Liebel
e72d1c3ed7 feat(@schematics/angular): update tsconfig.json libs to include es2018
Update the lib property in tsconfig.json files for Angular libraries and workspaces to include es2018.
2018-09-25 16:38:43 -04:00
Alan Agius
718ee15b9a refactor: remove flatModuleId and flatModuleOutFile from library tsconfig
The autogenerated fiellds are no longer required following this PR https://github.com/dherges/ng-packagr/pull/1024

This has been released in `ng-packagr` `v4.1.0`
2018-08-21 10:16:38 -07:00
Alan Agius
50fc7214c4 feat(@schematics/angular): add support for watch when building a library
`ng-packagr` version `4.0.0-rc.3`, lands the incremental builds feature.

More info:  https://github.com/dherges/ng-packagr/blob/master/CHANGELOG.md#400-rc2-2018-06-23

`enableResourceInlining` needs to be enabled for libraries that contain components

Closes: #11100
2018-07-30 06:41:28 -07:00
Alan Agius
10eb83d660 feat(@schematics/angular): update ng-packagr to version 4 2018-07-25 22:54:22 +01:00
Alan Agius
76f46bc00a fix(@schematics/angular): add module option in library tsconfig
When not specified the `commonjs` will be used which will cause erros when consuming the library `Module not found: Error: Can't resolve ' commonjs-proxy:../file`

https://github.com/dherges/ng-packagr/issues/944

Closes #11255
2018-06-17 10:36:58 -04:00
Filipe Silva
b8cecbbb3c feat(@schematics/angular): use es2015 modules overall
This change helps to keep the behaviour of build/serve/test consistent by using the same import semantics in all of them.
2018-06-13 22:33:32 +01:00
Hans Larsen
44086c60ff build: move devkit repo back to angular-cli 2018-06-05 18:50:06 -07:00