38 Commits

Author SHA1 Message Date
Alan Agius
0bc15970ad refactor(@schematics/angular): use jsonc-parser instead of devkit parser 2020-11-05 08:31:02 +01:00
eranshmil
5d75699134 fix(@schematics/angular): remove solution style throw an error
remove-solution-style-tsconfig migration fail when upgrading from version 10.0.* to 10.1.* with the following error:
[error] Error: Could not read 'tsconfig.json'
2020-09-24 00:07:48 +03:00
Alan Agius
f3d54ee670 fix(@schematics/angular): change extends from tsconfig.base.json to tsconfig.json
Closes: #18534
2020-08-17 18:12:55 +02:00
Alan Agius
9511f82fa4 test: update remove solutions style tsconfig test to extend tsconfig.base.json 2020-08-17 18:12:55 +02:00
Alan Agius
da9825ceb2 refactor(@schematics/angular): use ng-packagr builder from build-angular 2020-08-14 15:38:12 +02:00
Alan Agius
3730b3cb5c build: update karma-jasmine to version ~4.0.0 2020-08-13 10:13:47 +02:00
Alan Agius
8fb52596a0 feat(@schematics/angular): add migration to remove solution style tsconfig
Following the issues highlighted in https://docs.google.com/document/d/1eB6cGCG_2ircfS5GzpDC9dBgikeYYcMxghVH5sDESHw/edit?usp=sharing and discussions held with the TypeScript team. Together with the TypeScript team it was decided that 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, closes #18130 and closes #18170
2020-08-12 19:26:12 +01: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
Charles Lyding
196b3b9f29 fix(@schematics/angular): improve compiler options migration error reporting
This change provides more fine-grained warnings during the `update-module-and-target-compiler-options` migration for V10.0 in the event a TypeScript configuration file could not be updated.  The `JSONFile` utility class was also augmented to directly throw when created to ensure that the `content` property is always initialized.
2020-08-10 09:43:11 +01:00
Alan Agius
5a42104798 fix(@schematics/angular): show info message when depending on rxjs-compat 2020-07-27 20:04:10 +02:00
Alan Agius
05588fcee1 refactor: clean up unused code and imports 2020-07-24 08:01:52 +02:00
Alan Agius
2039f286d8 fix(@schematics/angular): provide more context on offending invalid JSON file
Closes: #18120
2020-07-07 15:06:25 +02:00
Alan Agius
d1623c6b0c refactor(@schematics/angular): refactor some schematics to use the new JSON parser 2020-07-07 08:45:17 +02:00
Alan Agius
7df079a062 fix(@schematics/angular): migrate tsconfig.base.json module and target options
Closes #18073
2020-07-01 14:04:25 +01:00
Alan Agius
96111ad092 fix(@schematics/angular): don't error out on blank JSON files during migrations
During the solution-style-tsconfig migration we are unexpectedly erroring out when encounter a blank JSON file. This PR fixes this behaviour and also prints the file path when an error occurs when parsing JSON contents.

Closes: #18012
2020-06-26 11:24:19 +01:00
Charles Lyding
0972487e22 fix(@schematics/angular): disable v10 side effect package.json migration 2020-06-15 16:29:51 -07:00
Alan Agius
5b5a37ad54 fix(@schematics/angular): add links to generated app package.json files
We now add a link to generated app package.json to make is easier for users to find relevant information.
2020-06-15 08:48:14 +02: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
00c8644aa5 fix(@schematics/angular): don't visit dot folders when running migrations 2020-06-03 15:11:14 -04:00
Alan Agius
a61ef8bbf5 fix(@schematics/angular): update several testing dev dependencies 2020-06-02 12:56:11 -04:00
Alan Agius
617f46fb57 build: update to karma-jasmine to 3.3.0 2020-06-01 15:02:15 -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
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
Charles Lyding
8cc566dbec fix(@schematics/angular): add migration to ensure tslint deprecation rule
This ensures that projects will be warned when deprecated APIs are used when linted.
2020-05-20 09:59:08 +01:00
Alan Agius
5395cecf59 refactor: remove deprecate protractor elementExplorer
Protractor `elementExplorer` debugger and element explorer cannot be used for Node.js 8+ since it relied on `_debugger` module.

In protractor version 5, this resulted in the below error:
```
** Angular Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **
: Compiled successfully.
[10:25:35] I/direct - Using ChromeDriver directly...
[10:25:37] I/protractor -
[10:25:37] I/protractor - ------- Element Explorer -------
[10:25:37] I/protractor - Starting WebDriver debugger in a child process. Element Explorer is still beta, please report issues at github.com/angular/protractor
[10:25:37] I/protractor -
[10:25:37] I/protractor - Type <tab> to see a list of locator strategies.
[10:25:37] I/protractor - Use the `list` helper function to find elements by strategy:
[10:25:37] I/protractor -   e.g., list(by.binding('')) gets all bindings.
[10:25:37] I/protractor -
***********************************************************
* WARNING: _debugger module not available on Node.js 8    *
* and higher.                                             *
*                                                         *
* Use 'debugger' keyword instead:                       *
* https://goo.gl/MvWqFh                                   *
***********************************************************
/Users/alanagius/cli-repos/demo-several/node_modules/protractor/built/debugger/debuggerCommons.js:14
  throw e;
  ^

Error: Cannot find module '_debugger'
Require stack:
- /Users/alanagius/cli-repos/demo-several/node_modules/protractor/built/debugger/debuggerCommons.js
- /Users/alanagius/cli-repos/demo-several/node_modules/protractor/built/debugger/clients/explorer.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:980:15)
    at Function.Module._load (internal/modules/cjs/loader.js:862:27)
    at Module.require (internal/modules/cjs/loader.js:1042:19)
    at require (internal/modules/cjs/helpers.js:77:18)
    at Object.<anonymous> (/Users/alanagius/cli-repos/demo-several/node_modules/protractor/built/debugger/debuggerCommons.js:3:18)
    at Module._compile (internal/modules/cjs/loader.js:1156:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1176:10)
    at Module.load (internal/modules/cjs/loader.js:1000:32)
    at Function.Module._load (internal/modules/cjs/loader.js:899:14)
    at Module.require (internal/modules/cjs/loader.js:1042:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/Users/alanagius/cli-repos/demo-several/node_modules/protractor/built/debugger/debuggerCommons.js',
    '/Users/alanagius/cli-repos/demo-several/node_modules/protractor/built/debugger/clients/explorer.js'
  ]
}
```

but in protractor version 7, this logic was removed.

BREAKING CHANGE:
Protractor builder elementExplorer option has been removed. This was not compatable with the Node.Js versions that the Angular CLI supports. See: https://github.com/angular/protractor/blob/master/docs/debugging.md#enabled-control-flow for an alternative debugging methods.
2020-05-15 14:44:45 +01:00
Alan Agius
56bba34d75 fix(@schematics/angular): address vulnerability in protractor
potractor <7 contains a low severity vulnerability due to one of its dependencies (yargs-parser)

See: https://npmjs.com/advisories/1500

Fixes #17642
2020-05-15 14:44:45 +01:00
Alan Agius
28f87cb312 refactor(@angular/cli): remove deprecated typescriptMismatch
BREAKING CHANGE:
Removed deprecated `typescriptMismatch` warning option. Users will be migrated off this option automatically. Users wishing to disable TypeScript version checks should use the Angular compiler option `disableTypeScriptVersionCheck`, see https://angular.io/guide/angular-compiler-options#disabletypescriptversioncheck for more information.
2020-05-07 10:37:48 -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
Alan Agius
cbf0feb005 feat(@schematics/angular): enable stricter type checking and optimization effective coding rules
With this change we enable stricter type checking and optimization effective coding rules when using the `--strict` option.

Changes in schematics
- `ng-new`: A prompt for the `--strict` option was added. This option is a proxy and will be passed to the application and workspace schematics.
- `application`: A `package.json` was added in the `app` folder, to tell the bundlers whether the application is free from side-effect code. When `strict` is `true`. the `sideEffects` will be set `false`.
- `workspace` When `strict` is true, we add stricter TypeScript and Angular type-checking options.

Note: AIO is already using these strict TypeScript compiler settings. PR to enable `strictTemplates`  https://github.com/angular/angular/pull/36391

Reference: TOOL-1366
2020-05-05 11:44:19 -07:00
Alan Agius
25fafcc92b feat(@schematics/angular): add migration to remove deprecated server options 2020-05-05 10:50:15 -07:00
Alan Agius
5855c14e76 feat(@schematics/angular): add migration for evalSourceMap, vendorSourceMap profile and skipAppShell options. 2020-04-27 15:08:15 -07:00
Alan Agius
bbfd05cff7 feat(@schematics/angular): add migration to remove deprecated es5BrowserSupport option 2020-04-22 10:38:19 -07:00
Alan Agius
f0e6a69250 feat(@schematics/angular): update karma to 5.0.0
Related to: https://github.com/angular/angular-cli/pull/17435
2020-04-13 11:32:38 -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
Alan Agius
d4548d418a fix(@schematics/angular): clarify tslint:recommended warning message
Closes: #17311
2020-03-30 10:23:34 -07:00
Alan Agius
a144e82eb7 feat(@schematics/angular): add migration to update tslint to version 6
In tslint version 6, several recommanded rules have been removed in the following PRs:
https://github.com/palantir/tslint/pull/4871 https://github.com/palantir/tslint/pull/4312

With this migration we update the tslint depedency to 6+ and add back these rules in the user workspace `tslint.json` also we remove some deprecated rules.

Until version 10, this is an opt-in migration and users will need to run this manually with the below command:
```
ng update @angular/cli --migrate-only tslint-version-6
```

Closes: #17117
Reference: TOOL-1348
2020-03-16 21:41:48 -07:00