33 Commits

Author SHA1 Message Date
Alan Agius
4f31b57df3 fix(@angular/cli): disable version check when running ng completion commands
Running autocompletion with `14.0.1` installed globally in a `14.0.0` project logs the version warning in a very annoying fashion:

```
$ ng verYour global Angular CLI version (14.0.1) is greater than your local version (14.0.0). The local Angular CLI version is used.

To disable this warning use "ng config -g cli.warnings.versionMismatch false".
sion
```

This adds an exception for `ng completion` commands to avoid this edge case.
2022-06-16 13:32:39 +02:00
Charles Lyding
d78826353b fix(@angular/cli): ensure full process exit with older local CLI versions
Angular CLI versions prior to v14 may not exit correctly if not forcibly exited
via `process.exit`. When the local CLI version is less than v14, the CLI will now
use `process.exit` to ensure the process exits with these older CLI versions.

Fixes #23289
2022-06-07 16:22:38 -04:00
Alan Agius
f99c08ce00 fix(@angular/cli): ng doc doesn't open browser in Windows
In Windows, `process.exit` was being called prior of opening the browser which caused the browser never to open.

Closes #23105
2022-05-18 12:46:05 -04:00
Alan Agius
eef17b3fc5 refactor(@angular/cli): group and move all env variables into a single file 2022-03-18 13:52:07 -07:00
Alan Agius
10cce2c86e refactor(@angular/cli): re-organize the Angular CLI package folder structure 2022-03-09 17:18:53 +01:00
Alan Agius
2e0493130a refactor(@angular/cli): replace command line arguments parser
With this change we refactor the Angular CLI and replace the underlying args parser and command builder. We choose to use Yargs as our parser and command builder of choice. The main advantages of Yargs over other command builders are;

- Highly configurable.
- We already use it in other packages such as the compiler-cli/dev-infra etc..
- Commands and options can be added during runtime. This is a requirement that is needed to support architect and schematics commands.
- Outstanding documentation.
- The possibility to parse args without parser configuration (Free form).
- Commands are built lazily based on the arguments passed.

BREAKING CHANGE:

Several changes in the Angular CLI commands and arguments handling.

- `ng help` has been removed in favour of the `—-help` option.
- `ng —-version` has been removed in favour of `ng version` and `ng v`.
- Deprecated camel cased arguments are no longer supported. Ex. using `—-sourceMap` instead of `—-source-map` will result in an error.
- `ng update`, `—-migrate-only` option no longer accepts a string of migration name, instead use `—-migrate-only -—name <migration-name>`.
- `—-help json` help has been removed.

Closes #20976, closes #16614 and closes #16241
2022-03-09 17:18:53 +01:00
Alan Agius
1e9e890bb0 fix(@angular/cli): logic which determines which temp version of the CLI is to be download during ng update
Previously, when using an older version of the Angular CLI, during `ng update`, we download the temporary `latest` version to run the update. The ensured that when running that the runner used to run the update contains the latest bug fixes and improvements.

This however, can be problematic in some cases. Such as when there are API breaking changes, when running a relatively old schematic with the latest CLI can cause runtime issues, especially since those schematics were never meant to be executed on a CLI X major versions in the future.

With this change, we improve the logic to determine which version of the Angular CLI should be used to run the update.

Below is a summarization of this.

- When using the `--next` command line argument, the `@next` version of the CLI will be used to run the update.
- When updating an `@angular/` or `@nguniversal/` package, the target version will be used to run the update. Example: `ng update @angular/core@12`,  the update will run on most recent patch version of `@angular/cli` of that major version `@12.2.6`.
- When updating an `@angular/` or `@nguniversal/` and no target version is specified. Example: `ng update @angular/core` the update will run on most latest version of the `@angular/cli`.
- When updating a third-party package, the most recent patch version of the installed `@angular/cli` will be used to run the update. Example if `13.0.0` is installed and `13.1.1` is available on NPM, the latter will be used.
2021-11-23 07:44:53 +01:00
Charles Lyding
a2cecf05a9 refactor(@angular/cli): remove outdated performance profiling code 2021-06-22 17:39:38 +01:00
Charles Lyding
c1623c429e refactor(@angular/cli): use version class instead of requiring package.json
The CLI contains a helper class instance that provides the version of the executing CLI. By using this helper throughtout the code, repeat `require` calls are no longer necessary.
2021-06-22 17:39:38 +01:00
Charles Lyding
c1512e4274 build: update files to be eslint compliant
All TypeScript files have been updated to pass the new eslint-based linting checks. eslint compatible disabling comments have also been added in place of the previous tslint comments.
2021-05-03 07:31:02 -04:00
Charles Lyding
37a06a7c37 build: format all files
All files are now formatted using the ng-dev tools via prettier.
2021-04-28 16:05:49 -07:00
Charles Lyding
203f9626df refactor(@angular/cli): correct various uncaught code style issues
This change cleans up some of the code by removing unused variables/imports, unnecessary double negation, and some long line lengths.
2021-04-28 09:58:15 +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
aedfcc1862 build: update to @types/node version 12 2021-02-08 14:07:24 -05:00
Charles Lyding
13f375d199 fix(@angular/cli): use newer update command if global version is newer
This allows improvements and bugfixes in later versions of the update command to be used in projects with older versions of the Angular CLI that do not have bootstrapping (<8.3.13).
2020-10-21 17:10:48 +02:00
Charles Lyding
18fdb0139f refactor(@angular/cli): remove node module directory assumption during initialization
This also does some minor code cleanup to the version mismatch check logic which contained the node modules directory reference.
2020-09-03 08:35:40 +02:00
Charles Lyding
5275892f63 refactor(@angular/cli): remove any type usage 2020-08-24 07:50:01 -04: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
Alan Agius
344ec857ce style: add tslint:disable-next-line no-console 2020-01-08 10:24:40 -08:00
Alan Agius
7d9c0c7227 fix(@angular/cli): disable Browserslist old data warning
Set the `BROWSERSLIST_IGNORE_OLD_DATA` enviorment variable to disable Browserslist old data warning

`Browserslist: caniuse-lite is outdated. Please run next command `npm update`

See: 819c433745/node.js (L324)
2020-01-08 10:24:40 -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
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
Alan
70a4cbe306 style: enable no-debugger and no-console tslint rules 2019-06-27 09:28:35 -07:00
Charles Lyding
c4313f55e4 refactor(@angular/cli): unify color handling and support 2019-06-24 17:27:59 -07:00
Charles Lyding
cfa1649fdd refactor(@angular/cli): use standard node resolution methods where possible 2019-03-30 18:36:22 -07:00
Alan Agius
a613a9759e style: add spacing to error message 2018-12-06 11:49:20 -08:00
Noel Mace
317602e40d refactor(@angular/cli): remove v8-profiler typings
Remove dependency to the @types/v8-profiler Profiler type as we don't want to depend on it.

See https://github.com/angular/angular-cli/pull/12411#discussion_r221688065
2018-10-03 16:35:54 -07:00
Noel Mace
93ccb82341 style: disable no-implicit-dependency v8-profiler
We only use @types/v8-profiler, which is a repository dev dependency, and v8-profiler-node8
is a "when needed" dependency.
2018-10-03 16:35:54 -07:00
Noel Mace
42f827ba36 build: add v8-profiler typings
After some refactoring on the angular/cli init, v8-profiler typing is required
in order to fix a no-any lint error.
2018-10-03 16:35:54 -07:00
Noel Mace
3de49db38e fix(@angular/cli): capture CPU profile
Replace the v8-profiler dependency with v8-profiler-node8 as the first one
doesn't support node 8 and 10, and that @angular/cli support only node 8
and 10.
2018-10-03 16:35:54 -07:00
Hans Larsen
20b5d916d2 feat(@angular/cli): use STDERR to report warnings 2018-08-21 09:57:34 -07:00
Charles Lyding
598c5da777 fix(@angular/cli): properly bootstrap 1.x from global 6.x 2018-07-27 11:41:56 -07:00
Hans Larsen
44086c60ff build: move devkit repo back to angular-cli 2018-06-05 18:50:06 -07:00