43 Commits

Author SHA1 Message Date
Alan Agius
c0f1b5ea52 fix(@angular/cli): show error when using non-TTY terminal without passing --skip-confirmation during ng add
Closes #21512
2021-08-06 07:23:18 +02:00
Charles Lyding
9a828a4459 refactor(@angular/cli): convert npm-package-arg usage from require to import
The typings package was already present for `npm-package-arg` and the removal of require usage supports the eventual shift to an ESM output for the CLI package.
2021-07-27 12:52:02 -04:00
Charles Lyding
9afe185fc6 build: enable noImplicitOverride TypeScript option
The `noImplicitOverride` TypeScript option improves code quality by ensuring that properties from base classes are not accidentally overriden.
Reference: https://www.typescriptlang.org/tsconfig#noImplicitOverride
2021-07-02 06:40:36 -04:00
Alan Agius
6e34d1bf89 fix(@angular/cli): cannot locate bin for temporary package
This fixes an issue where the installation of the temporary Angular CLI failed with `Cannot locate bin for temporary package: @angular/cli.`
2021-05-14 13:10:56 +02:00
Alan Agius
d7ef0d0730 fix(@angular/cli): change package installation to async
With this change we change the package installation to async. This is needed as otherwise during `ng-add` the spinner gets stuck. With this change we also add the spinner in the installation methods.
2021-05-05 11:49:08 -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
4b0223b64e build: automate @angular/cli schema.json generation
With this change we automate the generation of `@angular/cli/lib/config/schema.json`. While on paper we could use quicktype for this. Quicktype doesn't handle `patternProperties` and `oneOf` that well.

How does this works?
Relative `$ref` will be resolved and inlined as part of the root schema definitions.

Example
```json
"@schematics/angular:enum": {
    "$ref": "../../../../schematics/angular/enum/schema.json"
},
```

Will be parsed and transformed to
```json
"@schematics/angular:enum": {
  "$ref": "#/definitions/SchematicsAngularEnumSchema"
},
"definitions: {
  "SchematicsAngularEnumSchema": {
    "title": "Angular Enum Options Schema",
    "type": "object",
    "description": "Generates a new, generic enum definition for the given or default project.",
    "properties": {...}
   }
}
```
2021-03-11 21:51:37 +01:00
Charles Lyding
985dc1a4c7 feat(@angular/cli): confirm ng add action before installation
BREAKING CHANGE:
The `ng add` command will now ask the user to confirm the package and version prior to installing and executing an uninstalled package.
This new behavior allows a user to abort the action if the version selected is not appropriate or if a typo occurred on the command line and an incorrect package would be installed.
A `--skip-confirmation` option has been added to skip the prompt and directly install and execute the package. This option is useful in CI and non-TTY scenarios such as automated scripts.
2021-03-11 08:54:07 +01:00
Alan Agius
cae2209ca8 fix(@angular/cli): only show incompatible NPM error when NPM is used as package manager 2021-02-05 12:40:47 -05:00
Charles Lyding
331f628139 fix(@angular/cli): temporarily limit npm to version 6
This change will display an error message if using npm 7 (or versions earlier than 6). This is a temporarily change while npm 7 usability concerns are addressed.
2021-02-04 14:59:40 -08:00
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
Charles Lyding
37686b684e fix(@angular/cli): skip searching deprecated packages with ng add
When attempting to add a package via the add command, packages that have been marked as deprecated will no longer be installed when the deprecated package's peer dependencies match the project's dependencies.
2020-10-20 18:48:00 +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
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
Charles Lyding
5275892f63 refactor(@angular/cli): remove any type usage 2020-08-24 07:50:01 -04:00
Keen Yee Liau
fa9136a971 build: minor fixes for google3 sync
This commit makes a few minor changes to enable syncing the CLI repository
into google3.

1. mark pkg_tar and pkg_npm as external
2. remove dependencies (marked as comment) which are stale in google3
3. remove TS files generated from JSON schema in BUILD files since these
   files are compiled and added to the g3 codebase at sync time
4. Some minor typing changes
5. Remove duplicate licenses
6. mark dependencies which are not available in g3 as external
7. Immediately type the result of JSON.parse() as required by g3 linter.
   Otherwise, the type defaults to `any`.
2020-07-24 22:52:22 +02:00
Charles Lyding
f4127b5b43 fix(@angular/cli): fully use add command registry option when installing packages
Fixes: #16766
2020-02-10 16:02:05 -08:00
Alan Agius
23589ed00e fix(@angular/cli): inform user and error if schematics package is in unreachable location (#16466)
This is a workaround for the schematics runtime to support the requirement of packages containing migrations (or other schematics) to not have a direct/runtime dependency on the schematics package.

Closes: #16392
2020-01-02 11:27:04 -08:00
Charles Lyding
3f57956c32 fix(@angular/cli): verify package specifier when adding a package
Fixes #16029
2019-11-04 13:26:07 -08:00
Alan Agius
70e460d656 refactor: use require.resolve instead of custom resolve (#15906) 2019-10-23 09:59:36 -07: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
Keen Yee Liau
0662a8d774 build: g3 sync for packages/schematics and packages/angular
Fix all build errors in g3
2019-10-03 14:29:07 -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
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
3d1d225dd2 fix(@angular/cli): add verbose option to update and add
At the moment there is no way to turn on the verbose logging for `ng update` and `ng add`. This is useful for use so that when users report issues such as npmrc is not read we can see the lookup locations.

This also removes some reduncant that were being provided in `executeSchematic`.

Related to https://github.com/angular/angular-cli/issues/14993
2019-07-10 04:15:05 +08: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
Tiago Temporin
9805e8428d feat(@angular/cli): implement --registry for ng add (#14285)
Closes 14189
2019-05-07 12:34:27 -06:00
Charles Lyding
cfa1649fdd refactor(@angular/cli): use standard node resolution methods where possible 2019-03-30 18:36:22 -07:00
Hans Larsen
2ffbdfa86a build: add a validation script for the analytics.md tables
Also added enums to update when changing dimensions.
2019-03-28 13:28:41 -07:00
Hans Larsen
e9ee58a89e refactor(@angular/cli): move analytics constants to devkit core
They need to be shared with builders and schematics.
2019-03-28 13:28:41 -07:00
Hans Larsen
2e58fb33ca feat(@angular/cli): add custom implementation for analytics for commands
Some commands (like schematics) need to have custom reporting for
analytics. Schematics and Architect commands need to verify if the
schematic/architect builder run is in the safelist, for example.
2019-03-20 15:08:07 -07:00
Alan Agius
71c6cc506e refactor: add allowAdditionalArgs to be able to bypass extra params validations (#13556) 2019-02-05 21:13:45 -08:00
Keen Yee Liau
c53e875df0 fix(@angular/cli): ng-add should resolve package.json
ng-add checks if a specified collection is installed, and if not it'd
proceed to install the package. However, `isPackageInstalled` would, by
default, resolve the main field or the index of the package. Not all NPM
packages specify the main field or provide an index file. It should
be sufficient to just check the presence of `package.json` to detect
whether a package is installed or not.

For example, `ng add @angular/bazel` should not install the package if
it's already installed locally. `@angular/bazel` does not specify a main
field not an index file in its `package.json`.
2019-01-29 14:13:44 -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
clydin
5e354d17f1 feat(@angular/cli): autodetect default package manager (#12753) 2018-11-06 22:00:40 -08:00
Hans Larsen
30b0cbda0d refactor(@angular/cli): automated JSON schema interface generation 2018-09-13 16:44:17 -07:00
Hans
7ffd3b3033 refactor(@angular/cli): rename project to workspace and clean up
Removed unnecessary fields in interfaces, added some comments. Overall QoL.
2018-09-06 07:37:48 -07:00
Hans
de7ec84872 feat(@angular/cli): add --helpJson (or --help-json) too all commands
And other refactors.

The interface for the JSON is available in command.ts (the CommandDescription).
2018-09-06 07:37:48 -07:00
Hans
c75318b432 fix(@angular/cli): fix ci for new command formats 2018-08-13 20:58:47 -07:00