74 Commits

Author SHA1 Message Date
Charles Lyding
bd040bd4d6 feat(@angular/cli): provide additional status messaging for ng add
This adds a spinner as well as shows more information regarding what package version was selected to be installed.

Closes #17983
2021-01-28 07:36:15 +01:00
minijus
5cdf4ccd1d fix(@schematics/update): update line end normalization for CA file read from .npmrc
Before only first line end was being replaced.
Also, the replace value was incorrectly escaped.

The CA read from cafile being corrupt resulted in broken updates
when using registry with self-signed certificate.

The workaround till this is merged is to use `ca` or `ca[]` properties in `.npmrc`.
2021-01-26 09:25:29 -06:00
Alan Agius
36889b6a76 fix(@angular/cli): update pacote to version 11
With this change Pacote is updated to version 11.1.13.

This also requires normalization of options because Pacote now passes the options to `npm-registry-fetch` which requires some options to be camelCased.

Partially addresses #19624
2020-12-16 13:57:08 +00:00
Alan Agius
d368bfd684 fix(@angular/cli): allow trailing commas in JSON files
Currently, both tsconfigs and workspace configuration files can contain trailing commas

Closes #19576
2020-12-09 09:52:35 -05:00
Alan Agius
3529fb4822 refactor(@angular/cli): handle undefined JSON AST Node 2020-11-16 12:59:06 -05:00
Alan Agius
a038699ec3 refactor(@angular/cli): remove usage of devkit core JsonParser 2020-11-05 08:31:02 +01:00
Charles Lyding
7cbc72e16f refactor(@angular/cli): use jsonc-parser for JSON configuration parsing 2020-10-30 10:17:49 -05:00
Charles Lyding
0a02ea55bb refactor(@angular/cli): remove NodeJsSyncHost from config utilities 2020-10-30 10:17:49 -05:00
Alan Agius
a09a2e4056 fix(@angular/cli): include deprecated option in JSON help
This option is used to mark deprecated options as such in AIO.
2020-10-20 16:54:05 +02:00
Alan Agius
212374a5f1 refactor(@angular/cli): remove install-package under utils
Remove the lone `install-package.ts` file from tasks to utilities
2020-10-19 19:28:13 +02:00
Alan Agius
4e22443321 refactor(@angular/cli): clean up getProjectDependencies and add return types 2020-10-14 10:07:39 -04:00
Alan Agius
a8b8b5f7ae fix(@angular/cli): resolve packages package.json from workspace directory
Unlike `require.resolve`, the `resolve` package `paths` is only used as a fallback when the package is not resolved from the `basedir`,

Previously this resulted in the temporary version of CLI being resolved here which resulted in `ng update` incorrectly stating that there are no updates.
2020-10-14 10:07:39 -04:00
Charles Lyding
b2b536789b refactor(@angular/cli): discover/load workspace on startup
Previously, the workspace configuration file was found and loaded by individual commands potentially multiple times.  This change moves the initial workspace location discovery and loading of the workspace to the CLI startup.  It also provides the workspace to each command so that the commands can reuse the already loaded and parsed workspace configuration.
2020-10-02 07:53:07 -04:00
Keen Yee Liau
297fc923ab build: remove experimental build event protocol 2020-09-11 13:24:38 -04:00
Alan Agius
622d08447d refactor: use ansi-colors instead of removed terminal utils 2020-09-10 20:19:33 +02:00
Andrei Alecu
d01d647431 refactor(@angular/cli): improve update package discovery 2020-09-03 18:21:06 +02:00
Charles Lyding
5275892f63 refactor(@angular/cli): remove any type usage 2020-08-24 07:50:01 -04:00
Alan Agius
951d99e979 feat(@angular/cli): show warning when using deprecated options
With this change we show a warning when a deprecated option is also defined in the workspace configuration file (angular.json).

Closes: #14966
2020-08-17 18:18:24 +02:00
Charles Lyding
97637abab4 refactor(@angular/cli): replace experimental workspace API with stable API
This change removes one of the last usages of the experimental workspace API.
2020-08-17 18:05:27 +02:00
Alan Agius
a85ba990eb refactor: clean up several files
Most of these changes are requires for TS 4 update
2020-07-22 12:56:34 +01:00
Charles Lyding
e221c9a147 fix(@angular/cli): directly remove ansi color codes when no color support
Third party libraries can attempt to write color codes to the output even though the CLI has already determined that color should not be used.  The previously implemented color removal code is no longer functional since the update of ansi-colors to 4.1.0.  While this appears to be a defect in the aforementioned package, the new CLI removal method not only bypasses the defect but also unneeded execution logic that the CLI does not need in this case.

Fixes: #17053
2020-02-24 12:39:15 -08:00
Alan Agius
66b218c5f6 fix(@angular/cli): print ng update errors stack to log file
When an error occurs during ng update we currently discard the stack trace which in some cases made it hard to identify the cause of the error.

Now, we print the stack trace to a log file similarly to unhandled exceptions.

Example of CMD output;
```cmd
** Executing migrations of package '@angular/core' **

> Static flag migration.
  Removes the `static` flag from dynamic queries.
  As of Angular 9, the "static" flag defaults to false and is no longer required for your view and content queries.
  Read more about this here: https://v9.angular.io/guide/migration-dynamic-flag
× Migration failed: x
  See "C:\Users\alag\AppData\Local\Temp\ng-NgmC1G\angular-errors.log" for further details.
```

Example of log file contents:
```txt
[error] Error: x
    at UpdateCommand.executeSchematic (C:\git\angular-cli\test\node_modules\@angular\cli\commands\update-impl.js:98:19)
    at UpdateCommand.executePackageMigrations (C:\git\angular-cli\test\node_modules\@angular\cli\commands\update-impl.js:167:39)
    at UpdateCommand.executeMigrations (C:\git\angular-cli\test\node_modules\@angular\cli\commands\update-impl.js:161:21)
    at UpdateCommand.run (C:\git\angular-cli\test\node_modules\@angular\cli\commands\update-impl.js:394:38)
    at async UpdateCommand.validateAndRun (C:\git\angular-cli\test\node_modules\@angular\cli\models\command.js:134:28)
    at async Object.runCommand (C:\git\angular-cli\test\node_modules\@angular\cli\models\command-runner.js:201:24)
    at async default_1 (C:\git\angular-cli\test\node_modules\@angular\cli\lib\cli\index.js:62:31)
```
2020-02-18 12:43:35 -08:00
Alan Agius
12868b3b4f refactor(@angular/cli): use isJsonObject helper in to read config 2019-11-27 13:41:57 -08:00
Murad
8e81c6aa95 feat(@angular/cli): Support XDG Base Directory Specfication
Explained here: https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html

Current change affects reading of global config from `.angular-config.json`. By default it will be created in user's home directory. If user moves it manually to `$HOME/.config/angular/.angular-config.json`, it will be subsequently read from new location.
2019-11-12 11:50:22 -08:00
Alan Agius
e8135babd4 refactor: update pacote to version 10 2019-11-06 10:51:35 -08:00
Alan Agius
b0dcfd08a0 fix(@angular/cli): logic to determine if the installed CLI is out of date
With this change we now check if the current CLI version is the latest published version. If it is not, we install a temporary version to run the `ng update` with.
2019-10-22 13:13:54 -07:00
Alan Agius
d133ba68c0 feat(@angular/cli): add support for ng-add packages that should not be saved as dependencies
With this change the CLI offers a way for a package authors to specify if during `ng add` the package should be saved as a `dependencies`, `devDependencies` or not saved at all.

Such config needs to be specified in `package.json`

Example:
```json
  "ng-add": {
    "save": false
  }
```

Possible values are;
- false - Don't add the package to `package.json`
- true - Add the package to the `dependencies`
- `dependencies` - Add the package to the `dependencies`
- `devDependencies` - Add the package to the `devDependencies`

Closes #12003 , closes #15764 and closes #13237
2019-10-14 13:40:31 -07:00
Charles Lyding
0abeadbc10 refactor(@angular/cli): use canonical npm logic to determine update package version 2019-09-19 14:41:04 -07:00
Charles Lyding
2565077dbe fix(@angular/cli): correctly account for linked packages in update
Fixes #15511
Fixes #15294
2019-09-11 10:10:48 -07:00
Adam Vigneaux
87b01ffd6a feat(@angular/cli): add support for custom npmrc paths
According to [the npm config
docs](https://docs.npmjs.com/misc/config#npmrc-files), a user can
specify the path to their `npmrc` files using the environment
variables `NPM_CONFIG_USERCONFIG` and `NPM_CONFIG_GLOBALCONFIG`. When
set, these variables should override the default paths.
2019-08-29 23:47:22 +05:30
Charles Lyding
b630317b4b refactor(@angular/cli): convert workspace access to async
This is in preparation for conversion from the experimental workspace API to the stable workspace API.
2019-08-16 09:32:04 -07:00
vikerman
4287d57a32
fix(@angular/cli): typo in error message
Fixes #15208
2019-07-30 14:34:29 -07:00
Filipe Silva
e8dff5718f build: update to TS 3.5 2019-07-29 10:15:23 -07:00
Alan Agius
15ef15e94a style: remove redundant max-line-length disables and fix other lint issues 2019-07-24 19:06:21 -07:00
Alan Agius
a57e98662c fix(@angular/cli): display a more detailed error message when workspace cannot be loaded
Closes #15023, closes #10757, closes #14933 and closes #11204
2019-07-10 04:37:06 +08:00
Hans Larsen
51c30e5def refactor(@angular/cli): refactor isTTY() function
It was really hard to read with double negatives and such.
2019-06-26 11:22:19 -07:00
Charles Lyding
c4313f55e4 refactor(@angular/cli): unify color handling and support 2019-06-24 17:27:59 -07:00
Charles Lyding
2334a7c030 fix(@angular/cli): use recommended TTY check logic
`stdin` can be redirected/piped by various shells but still be interactive.  Node.js recommends only testing `stdout`: https://nodejs.org/api/tty.html#tty_tty

Fixes #14640
2019-06-06 14:28:36 -07:00
Charles Lyding
410b56e107 fix(@angular/cli): check for CI environment variable in tty helper
Fixes #14563
2019-05-30 12:32:01 +02:00
Charles Lyding
57189f6eca fix(@angular/cli): standardize TTY checks 2019-05-22 10:02:58 +02:00
Charles Lyding
b7fc6125e5 fix(@angular/cli): improve error handling of update command
This adds extensive option checking and error handling with the goal to catch user errors as early in the process as possible.  Bad option combinations and/or values will result in actionable information and stop the process before network access and processing occurs.
2019-05-15 14:34:03 -07:00
Hans Larsen
cf5cf19bb5 feat(@angular/cli): add analytic support to commands and command-runner
This is only reporting commands and their flags right now, and not
schematics or project analytics.
2019-03-20 15:08:07 -07:00
Charles Lyding
be5e2fbfe5 fix(@angular/cli): remove redundant typescript/compiler-cli compatibility check
Angular 5.0+ has a full peer dependencies setup (with 6.0+ also having a configurable runtime error check) to ensure that an appropriate version of typescript is available for compilation.  Angular CLI 8.0+ does not support Angular versions prior to these and therefore the warning is redundant.  For the case where the developer wishes to use an unsupported TypeScript version, the developer would need to adjust two similar but differently name settings in two different configuration files.
2019-02-20 10:36:52 -08:00
Charles Lyding
b956db6262 fix(@angular/cli): 'ng add' selects supported version via peer dependencies
If no version specifier is supplied `ng add` will now try to find the most recent version of the package that has peer dependencies that match the package versions supplied in the project's package.json
2019-01-21 20:27:20 -08:00
Hans
3a28d4c142 feat(@angular-devkit/core): add a new JsonSchema type
A Schema is either an Object or a boolean. We could reduce JsonSchema scope further
by adding properties, but a schema is a really complex type so its not worth the
effort.
2018-12-14 10:55:04 -08:00
Charles Lyding
f066e99e3a feat(@angular/cli): initial minimal BEP support 2018-12-11 11:58:05 -08:00
Charles Lyding
00141868ce fix(@angular/cli): silence package manager not found messages
Fixes #12939
2018-11-14 12:40:22 -08:00
Hans Larsen
456614828f feat(@angular/cli): allow flags to have deprecation
The feature comes from the "x-deprecated" field in schemas (any schema that is used
to parse arguments), and can be a boolean or a string.

The parser now takes a logger and will warn users when encountering a deprecated
option. These options will also appear in JSON help.
2018-11-14 10:29:07 -08:00
clydin
5e354d17f1 feat(@angular/cli): autodetect default package manager (#12753) 2018-11-06 22:00:40 -08:00
Filipe Silva
298faa129a test(@angular/cli): fix implicit import
This lint error resulted from the interaction between https://github.com/angular/angular-cli/pull/12554 and https://github.com/angular/angular-cli/pull/12515.
2018-11-01 10:07:48 -07:00