237 Commits

Author SHA1 Message Date
Alan Agius
c2c4cac13c test(@angular-devkit/build-angular): remove invalid project extensions from test projects
This causes logs to be printed during test runs.
2022-07-22 12:48:25 -04:00
Alan Agius
ab8ab30c87 fix(@schematics/angular): use sourceRoot instead of src in universal schematic
With this change we remove the usage of hard coded `src` directory and instead infer this from the `sourceRoot` project option.

We also remove the `angularCompilerOptions.entryModule` property in the server tsconfig as this is no longer needed with Ivy.

Closes #12104
2022-06-29 08:56:11 -04:00
Renovate Bot
45b6954174 build: update angular 2022-06-03 15:15:13 -04: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
Paul Gschwendtner
156f15e47f build: cleanup references to old master branch
Cleans up all referneces to the old `master` branch.
2022-05-04 09:55:54 -07:00
Alan Agius
561df27e36 test(@angular-devkit/build-angular): disable html karma coverage reporter
Under bazel this causes the below error.

```
Unexpected error while generating coverage report. [Error: EEXIST: file already exists, mkdir
```
2022-02-10 14:16:24 +01:00
Alan Agius
73746faee9 refactor(@angular/cli): remove support for legacy Angular CLI version 1 configurations
Remove references to legacy Angular CLI version 1 configurations. By now users should have been migrated to use the new configuration.
2022-02-07 10:53:18 +00:00
Alan Agius
69ecddaa7d feat(@schematics/angular): update new and existing projects compilation target to ES2020
With this change we update the TypeScript compilation target to `ES2020` for both new and existing projects. This is because all browsers that Angular supports (https://angular.io/guide/browser-support) support `ES2020` features without the need for polyfills.
2022-01-28 11:01:09 -08:00
Renovate Bot
0d864a4239 build: update angular 2021-11-04 12:16:49 -04: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
94c00afbf3 fix(@schematics/angular): don't export renderModuleFactory from server file
Using `renderModuleFactory` is no longer needed since this was used for ViewEngine.
2021-10-07 18:50:54 +02:00
Charles Lyding
93ae204047 test(@angular-devkit/build-angular): correctly disable caching in unit-tests
The unit-tests where intended to not use build caching to better ensure test isolation. However, the configuration format was incorrect and did not disable the build caching.
2021-10-06 19:10:24 -04: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
7ff8c5350e feat(@schematics/angular): add /.angular/cache to .gitignore
With this change we add `/.angular/cache` to `.gitignore`. This folder will primary be used to store the build disk cache artifacts.
2021-10-06 08:02:22 -05:00
Alan Agius
5904afd1de feat(@angular-devkit/build-angular): enable disk cache by default and provide configurable options
Persistent disk build cache is now enabled by default. A number of options have been added to allow fine tuning of the cache.

The options can be configuration in `cli.cache` section in the `angular.json` as shown below.

- `enabled`: Configure whether disk caching is enabled. Defaults to `true`
- `environment`: Configure in which environment disk cache is enabled. Valid values `ci`, `local` or `all`. Defaults to: `local`
- `path`: cache base path. Defaults to `.angular/cache`

DEPRECATED: `NG_BUILD_CACHE` environment variable option will be removed in the next major version. Configure `cli.cache` in the workspace configuration instead.

BREAKING CHANGE:  `NG_PERSISTENT_BUILD_CACHE` environment variable option no longer  have effect. Configure `cli.cache` in the workspace configuration instead.

```json
{
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
  "version": 1,
  "cli": {
    "cache": {
      "enabled": true,
      "path": ".custom-cache-path",
      "environment": "all"
    }
  }
  ...
}
```
2021-10-06 08:02:22 -05:00
Alan Agius
20e48a33c1 feat(@angular-devkit/build-angular): remove deprecated options
BREAKING CHANGE:

With this change we removed several deprecated builder options
- `extractCss` has been removed from the browser builder. CSS is now always extracted.
- `servePathDefaultWarning` and `hmrWarning` have been removed from the dev-server builder. These options had no effect.
2021-08-03 15:07:04 +01:00
Alan Agius
e78f6ab5d8 feat(@angular-devkit/build-angular): remove deprecated tslint builder
BREAKING CHANGE:

Deprecated `@angular-devkit/build-angular:tslint` builder has been removed. Use https://github.com/angular-eslint/angular-eslint instead.
2021-08-02 16:57:56 +01: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
494cca6426 build: update Webpack to version 5.38.1
With this change we update to `webpack` to `5.38.1`, this also updates `webpack-sources` to `2.3.0`, The latter is causing OOM errors on our CI, but it in real projects the memory usage only increased by a small fraction. Also, the OOM errors don't manifest themselves when the entire test suit is run locally.

Therefore with this change we also disable sourcemap genertation for most of the browser builds to speed up the tests and reduce memery usage.
2021-05-31 12:49:55 +01:00
Renovate Bot
458723cdbb build: update angular 2021-05-13 06:53:01 +02:00
Joey Perrott
003854257c build: migrate all file header to use Google LLC rather than Google Inc 2021-04-27 08:35:22 +02:00
Alan Agius
0a74d0d28d fix(@angular-devkit/build-angular): change several builder options defaults
BREAKING CHANGE:

A number of browser and server builder options have had their default values changed. The aim of these changes is to reduce the configuration complexity and support the new "production builds by default" initiative.

**Browser builder**
| Option                                 | Previous default value    | New default value |
|----------------------------------------|---------------------------|-------------------|
| optimization                           | false                     | true              |
| aot                                    | false                     | true              |
| buildOptimizer                         | false                     | true              |
| sourceMap                              | true                      | false             |
| extractLicenses                        | false                     | true              |
| namedChunks                            | true                      | false             |
| vendorChunk                            | true                      | false             |

**Server builder**
| Option        | Previous default value | New default value |
|---------------|------------------------|-------------------|
| optimization  | false                  | true              |
| sourceMap     | true                   | false             |
2021-04-21 12:39:01 -07: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
Charles Lyding
aeebd14f04 perf(@ngtools/webpack): only check affected files for Angular semantic diagnostics
This change improves the performance of incremental type checking of Angular templates by reducing the number of calls to retrieve the diagnostics.
Only the set of affected files will be queried on a rebuild. The affected set includes files TypeScript deems affected, files that
are required to be emitted by the Angular compiler, and the original file for any TTC shim file that TypeScript deems affected.
2021-03-29 08:16:36 -06:00
Alan Agius
74537a11d4 test(@angular-devkit/build-angular): update tests to reflect the change in ES targets 2021-03-15 20:31:25 +01:00
Alan Agius
5e2c45c8db test(@angular-devkit/build-angular): change test to use await/async 2021-02-22 12:43:31 +01:00
Alan Agius
f309516bcd refactor(@angular-devkit/build-angular): drop support for zone.js 0.10
BREAKING CHANGE:

Minimum supported `zone.js` version is `0.11.4`
2021-02-17 12:44:43 -06:00
Alan Agius
eb30a92e8a feat(@angular-devkit/build-angular): enable inlining of critical CSS optimizations
This is another feature that we mentioned in the Eliminate Render Blocking Requests RFC (#18730)

Inlining of critical CSS is turned off by default. To opt-in this feature set `inlineCritical` to `true`.

Example:
```json
"configurations": {
  "production": {
    "fileReplacements": [
      {
        "replace": "src/environments/environment.ts",
        "with": "src/environments/environment.prod.ts"
      }
    ],
    "optimization": {
      "styles": {
        "minify": true,
        "inlineCritical": true,
       }
    },
```

To learn more about critical CSS see;
https://web.dev/defer-non-critical-css
https://web.dev/extract-critical-css/

In a future version of the Angular CLI `inlineCritical` will be enabled by default.

Closes: #17966
Closes: #11395
Closes: #19445
2020-12-04 15:41:29 -05: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
Renovate Bot
251b53672e build: update angular packages 2020-11-12 17:13:22 -05:00
Alan Agius
58dfe228f0 build: remove @types/jasminewd2 from repo devDependencies 2020-10-26 10:13:05 -04:00
Alan Agius
bda8bc8b70 test(@angular-devkit/build-angular): fix unit test setup to be able to run new Ivy extraction 2020-09-28 21:24:10 +02:00
Alan Agius
155a6f6f88 test: disable progress during extract-i18n 2020-09-28 15:58:26 +02: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
ba7f6e8cf2 test(@angular-devkit/build-angular): add ng-packagr test application in build-angular 2020-08-14 15:38:12 +02:00
Alan Agius
fc5d2b3ff2 test: remove tsconfig.base.json from test cases 2020-08-12 19:26:12 +01:00
Charles Lyding
872bd48bbf test: update generated tests to not use async helper function 2020-07-15 12:36:48 -04:00
Alan Agius
d50a2fef2f fix(@schematics/angular): use ES2016 as syntax target for server bundles
The supported versions of Node.js support up to ES2018, the only reason why we don't use ES2017+ is because native `async` and `await` don't work with zone.js

See: https://github.com/angular/angular/issues/31730

With this change, we also ensure that we don't downlevel the server bundle to ES5 which is unnecessary.

Closes: #17794
2020-06-01 14:53:37 -04:00
Alan Agius
ade3f491fe fix(@schematics/angular): remove node typings from tsconfig.spec.json 2020-05-27 14:17:05 +02:00
Alan Agius
93e253bc93 refactor: rename tsconfig.json to tsconfig.base.json 2020-05-20 12:12:33 -07:00
Alan Agius
0fd3c550b5 feat(@schematics/angular): update compiler options target and module settings
With this change we update the target and module settings of various compilation units.

- We replace ES5 target in protractor. Protractor runs on Node.Js which support ES2018
- For applications we now use `ES2020` instead of `ESNext` as a module to avoid unexpected changes in behaviour

This changes also adds a migration to update existing projects and also removes `module` from the Universal tsconfig as per #17352 to enable lazy loading on the server.
2020-05-06 11:42:35 -07:00
Filipe Silva
9a28114f6b test: remove non-bazel test setup 2020-04-30 15:12:46 -07:00
Filipe Silva
ef7a07050a test(@angular-devkit/build-angular): build and test with Bazel 2020-04-30 15:12:46 -07:00
Alan Agius
8fb7e586cc refactor(@angular-devkit/build-angular): remove deprecated evalSourceMap, vendorSourceMap, profile and skipAppShell options
BREAKING CHANGE:

The following deprecated devkit builders options have been removed:
- `skipAppShell:` This has no effect
- `evalSourceMap`: This done to improve performance in older versions of the CLI and is no longer needed
- `vendorSourceMap`: Use `sourceMap.vendor` instead
- `profile`: Use `NG_BUILD_PROFILING` environment variable instead
2020-04-27 15:08:15 -07:00
Charles Lyding
254994db85 fix(@angular-devkit/build-angular): ensure webpack tilde resolve behavior for stylesheet resources 2020-04-27 11:07:58 -07:00
Charles Lyding
c034477dc5 feat(@angular-devkit/build-angular): rebase relative stylesheet assets when using preprocessors
Previously, when using a preprocessor, resources (e.g., `url(./my-image.jpg)`) referenced in a stylesheet that was imported into another stylesheet would retain the exact URL.  This would be problematic as the resource would not be at the relative location within the new combined stylesheet.  With this change the resource URLs will now be adjusted to reference the origin location of the resource.  This allows the resources to be found without any additional changes to the application or build process.
CSS and Less already functioned in this manner. This change brings Sass and Stylus to parity.

Fixes: #12797
2020-04-27 11:07:58 -07:00
Charles Lyding
06e9955743 test(@angular-devkit/build-angular): ensure autoprefixed global CSS imports 2020-04-27 11:07:58 -07:00
Alan Agius
710cf5656e fix(@angular-devkit/build-angular): retain css declarations order when using extractCss and @import rule
Relevant code:
239e43d1f3/src/plugins/postcss-import-parser.js (L9)

239e43d1f3/src/index.js (L132-L150)

Fixes #9475
2020-04-10 09:56:55 -07:00
Alan Agius
10e7eb2c24 test: change browserslist file name to .browserslistrc 2020-04-06 09:58:42 -07:00
Alan Agius
b7a612f14a feat(@schematics/angular): change browserslist file name to .browserslistrc
Closes: #15961
2020-04-06 09:58:42 -07:00