32 Commits

Author SHA1 Message Date
Alan Agius
c6fb34a092 fix(@schematics/angular): enable tsc downlevelIteration
We by default now use ES2015. Users can use ES2015 iterations however the ES5 build will fail.

Fixes #14697
2019-06-07 13:00:28 -07:00
Alan Agius
0531242f4b fix(@schematics/angular): move browserslist even when no sourceRoot is available
```
Using package manager: 'npm'
Collecting installed dependencies...
Found 36 dependencies.
    ** Executing migrations for package '@angular/cli' **
RENAME src/browserslist => /browserslist
UPDATE tslint.json (2800 bytes)
UPDATE package.json (1396 bytes)
UPDATE tsconfig.json (460 bytes)
UPDATE tsconfig.app.json (282 bytes)
UPDATE tsconfig.spec.json (256 bytes)
```

Fixes #14660
2019-06-06 14:31:32 -07:00
Alan
50c974a583 fix(@schematics/angular): add '@angular-devkit/build-webpack' package to the version 8 migration 2019-06-06 14:16:51 -07:00
Alan
89a122cd5c fix(@schematics/angular): update ng-packagr and tsickle when migrating to version 8 2019-06-06 14:16:51 -07:00
Alan Agius
576119f2ca fix(@schematics/angular): TypeScript related migrations should cater for BOM
In the CLI `UpdateRecorder` methods such as `insertLeft`, `remove` etc.. accepts positions which are not offset by a BOM. This is because when a file has a BOM a different recorder will be used https://github.com/angular/angular-cli/blob/master/packages/angular_devkit/schematics/src/tree/recorder.ts#L72 which caters for an addition offset/delta.

The main reason for this is that when a developer is writing a schematic they shouldn't need to compute the offset based if a file has a BOM or not and is handled out of the box.

Example
```ts
recorder.insertLeft(5, 'true');
```

However this is unfortunate in the case if a ts SourceFile is used and one uses `getWidth` and `getStart` method they will already be offset by 1, which at the end it results in a double offset and hence the problem.

Fixes #14551
2019-05-30 10:21:49 -07:00
Alan Agius
3afdab21a0 fix(@schematics/angular): add migration to update web-animations-js polyfill
Previous versions rely on `this` which breaks differential loading since it's `undefined` when using script tags with type module.

Fixes #14518
2019-05-28 13:32:53 -07:00
Alan Agius
4e693ef694 fix(@schematics/angular): update or add module and target to non extended tsconfig
Fixes #14436
2019-05-21 09:00:38 -04:00
Alan Agius
c81adbdad3 fix(@schematics/angular): polyfills migration leaving broken code in windows
Replacment of line endings should only happen to increase the hash matches as otherwise the recorder will fail to update the correct positions

Fixes #14443
2019-05-17 11:27:12 -07:00
Alan Agius
5125db38f8 fix(@schematics/angular): differential loading migration should run only for projects using @angular-devkit/build-angular:browser
Differential loading migration should run only when the project is using `@angular-devkit/build-angular:browser` as it's browser builder. Otherwise we might break applications that are using different builders.

Fixes #14389
2019-05-13 15:57:26 -07:00
Alan Agius
04b854956c fix(@schematics/angular): remove old GoogleBot browserslist setting
GoogleBot is now evergreen, we don't need to specialcase it: https://webmasters.googleblog.com/2019/05/the-new-evergreen-googlebot.html?m=1

Fixes #14364
2019-05-09 10:08:52 -07:00
Alan Agius
c1e65294e7 fix(@schematics/angular): older projects are not migrated to support differential loading
Fixes #14321
2019-05-07 16:14:50 -06:00
Charles Lyding
01e242487b fix(@schematics/angular): avoid tslint overhead for lazy module migration
By using a pure schematic based implementation the overhead of running tslint can be removed.  This also has the benefit of allowing direct control over the files loaded and to modify files only within the schematic tree context.
For a hello world application, there was a ~20% performance improvement for the CLI migration from 7.0 to 8.0 as well as a ~10% reduction in memory usage.
2019-05-07 15:47:37 -06:00
clydin
537bf5e2fa fix(@schematics/angular): reduce package installs for 8.0 migrations (#14324)
This provides a ~30% performance improvement for a hello world project.
2019-05-07 12:42:46 -06:00
Charles Lyding
f189596414 test(@schematics/angular): set CLI 8.0 codelyzer migration version to ^5.0.1 2019-04-26 12:13:44 -07:00
Charles Lyding
bd14306521 fix(@schematics/angular): set CLI 8.0 codelyzer migration version to ^5.0.1 2019-04-26 10:45:56 -07:00
Charles Lyding
72dc96bb04 fix(@schematics/angular): update zone.js version during CLI 8.0 migration
Fixes #14281
2019-04-26 10:28:56 -07:00
Charles Lyding
2acded4bdd fix(@schematics/angular): normalize differing TS AST versions in lazy module migration 2019-04-26 10:27:55 -07:00
Charles Lyding
576577784c fix(@schematics/angular): remove tsquery peer dependency warning
Replaces the usage of the tsquery package with a conditional based on TypeScript helper functions.  Since a TypeScript-subset is vendored within the package, a TypeScript peer dependency cannot be met even though the functionality is present.

Fixes #14270
2019-04-25 09:27:22 -07:00
Charles Lyding
74af88bf06 fix(@schematics/angular): avoid double header/comments in es6 polyfill migration
If a polyfills file is original, then replace completely with latest version of the file.  This removes the need to deeply analyze the file as well as ensuring all comments are up to date.  Also skips analysis if there is no mention of `core-js` of any form in the file.
The header re-addition check is also reduced in scope to account for varying versions of the header content.
2019-04-24 07:15:05 -10:00
Filipe Silva
785b4b1049 fix(@schematics/angular): workaround bug in recorder/update 2019-04-23 11:42:50 -07:00
Alan Agius
0a6df3e824 fix(@schematics/angular): move and update existing src/browserslist
Older projects have their `browserslist` file under the `src` folder.

Fixes #14232
2019-04-23 10:31:18 -04:00
Emilio Martinez
5f44e642ee fix(@schematics/angular): align differential loading migration to browserslist template
Modifies differential loading migration script to align with the changes in 4d7581d to support Googlebot in browserslist by default.
2019-04-23 10:29:41 -04:00
Filipe Silva
fea7117bd2 feat(@schematics/angular): drop @angular/http from dependencies 2019-04-23 10:28:00 -04:00
Charles Lyding
c80a92ac67 fix(@schematics/angular): skip E2E projects when migrating browserslist 2019-04-22 13:29:05 -07:00
Charles Lyding
9b5653b13e fix(@schematics/angular): ensure Angular builders are migrated to latest versions
The package group format required to automatically update the builder packages was not supported until CLI 7.2.  For older CLI versions performing the update, this new migration will update the builders instead.  Once the CLI is updated to at least 7.2, the update algorithm itself will handle the update.
2019-04-22 13:29:05 -07:00
Charles Lyding
458ba75e37 fix(@schematics/angular): migrate TS module type to esnext 2019-04-22 08:16:17 -07:00
Alan
b95933a57d fix(@schematics/angular): handle polyfill migration in non root applications 2019-04-18 11:48:47 -07:00
Craig Spence
77f99b535d feat(@schematics/angular): add lazy module path fixer 2019-04-16 09:38:55 -07:00
Alan Agius
359d4f97cc feat(@schematics/angular): migrate existing ES5 projects to support differential loading
With this change, differential loading will be enabled as we add an non ever green browser and change the tsconfig script target to es2015.
2019-04-15 11:30:20 -07:00
Alan Agius
19cb35473f refactor: don't drop zone.js from polyfills
We don't know yet if we are going to separate zone.js in a separate file. Hence, we should remove this for the time being and include it only when we remove zone.js from the main polyfills files
2019-04-03 16:28:37 +02:00
Minko Gechev
a355e7d693 feat(@schematics/angular): drop es6 from modern polyfills
1. Remove imports of es6 polyfills introduced by the CLI.
2. Refactor the migrations for version 8 by moving the codelyzer and
polyfill transforms into different files.

The PR drops all `core-js/es6` polyfills that we've introduced with the
CLI, except the commented ones. We do not remove commented imports,
since they are not part of the internal es6 polyfills.

The migration automatically drops the
associated comments with the removed imports since they are part of the node - under its
`jsDoc` property.
2019-03-29 18:06:01 -07:00
Minko Gechev
4b89fe21f4 feat(@schematics/angular): tslint migration for 8
Migration of the `tslint.json` and `package.json` files required by the refactoring of
codelyzer. For more information check this PR
https://github.com/mgechev/codelyzer/pull/754.
2019-03-27 12:24:21 -07:00