870 Commits

Author SHA1 Message Date
Renovate Bot
ebbb0adf56 build: update dependency ini to v3 2022-04-07 14:46:12 -07:00
Renovate Bot
4b05c44d4f build: update all non-major dependencies 2022-04-06 13:00:39 -04:00
Alan Agius
0316dea676 feat(@angular/cli): add prompts on missing builder targets
With this change we add prompts to `ng deploy` and `ng e2e` to facilitate adding packages that offer these capabalities.

We also add back `ng lint` prompt to add ESLint which was removed by mistake during the commands refactoring.
2022-04-06 10:41:07 -04:00
Alan Agius
3d77846dd7 refactor(@angular/cli): create a memoize decorator
With this change we clean up repeated caching code by creating a `memoize` decorator that can be used on get accessors and methods.
2022-04-01 12:16:34 -04:00
Alan Agius
f11fcaa634 refactor(@angular/cli): remove coercion from packages positional configuration
Configure the `packages` positional argument to be an array instead of using `coerce` method.
2022-03-31 16:32:30 -04:00
Alan Agius
94a9952963 refactor(@angular/cli): change workspace host to use async Node APIs 2022-03-30 20:45:35 +02:00
Alan Agius
811487f027 refactor(@angular/cli): remove unused testing option
This option is never set and doesn't provide any value, since typically when one wants to debug, you add a `debugger` statement where needed or use the `break on exception` option in the debugger.
2022-03-30 20:45:35 +02:00
Alan Agius
9807291162 refactor(@angular/cli): remove getProjectsByPath config util
We already have a similar method `getProjectByCwd` that does the same thing.
2022-03-30 20:45:35 +02:00
Alan Agius
09f8659ced fix(@angular/cli): display package manager during ng update
This also aligns the output to have the same style of `ng add`
2022-03-30 18:22:30 +02:00
Alan Agius
1bbabb24ca refactor(@angular/cli): create package manager util class
Apart from better code quality, this helps reduce the time of CLI bootstrapping time, as retrieving the package manager name is a rather expensive operator due to the number of process spawns.

The package manager name isn't always needed until we run a command and therefore in some cases we can see an improvement of around `~600ms`. Ex: `ng b --help`. From ` 1.34s` to `0.76s`.

This will be important when we eventually introduce auto complete as users will get faster loopback.
2022-03-30 17:33:37 +02:00
Alan Agius
746d0c596e refactor(@angular/cli): add global configuration in command context
With this change we add the angular configuration as part of the command context.
2022-03-30 17:33:37 +02:00
alkavats1
28721c3e64 refactor(@angular/cli): improved code quality
removed unused parameter and improved code quality
2022-03-30 17:17:27 +02:00
Renovate Bot
6a6386a1ef build: update all non-major dependencies 2022-03-30 17:17:15 +02:00
Alan Agius
efc3c32257 fix(@angular/cli): remove analytics prompt postinstall script
With this change we remove the postinstall hook that was used to prompt users to confirm if they'd like to share anonymous usage with the Angular team.

This post install hook was used to set the global configuration, which was mainly used for commands that run outside of a workspace such as `ng new`, `ng version` and ng `config`. We now prompt once the users runs the above mentioned commands instead of the post install.
2022-03-29 18:20:55 +02:00
Renovate Bot
17a7fdcd68 build: update all non-major dependencies 2022-03-26 08:25:40 +01:00
Alan Agius
797c652eb5 refactor(@angular/cli): clean up package-metadata retrieval logic
With this change we clean up the package-metadata retrieval logic and types by using public `@types/` packages.

Also, we lazily require `pacote` since this has a large set to dependencies which slows down module resolution.
2022-03-24 18:00:31 +01:00
Alan Agius
455aeea12d fix(@angular-devkit/core): add Angular CLI major version as analytics dimension
With this change we replace the custom dimension 8 `AOT Enabled`, with `Angular CLI Major Version`. The motivation behind replacing this dimension is that the there is already an `aot` dimension with id 13 which serves for the same purpose.

More information to why we need a new dimension for the Angular CLI major version can be found #22130

Closes #22130
2022-03-24 08:53:10 +01:00
Alan Agius
e4f7b5e9b2 refactor(@angular/cli): call package manager supports method async
With this change we call the `supports` method for Yarn, NPM and PNPM asynchronous
2022-03-23 12:58:35 -07:00
Alan Agius
933b3cabd4 refactor(@angular/cli): lazy import inquirer
`inquirer` has a number of depedencies which slow down module resolution when importing (~138ms) by lazy loading this module we remove this overhead when prompts are not needed.
2022-03-23 12:58:35 -07:00
Alan Agius
366cabc66c feat(@angular/cli): add support for multiple schematics collections
The `schematicCollections` can be placed under the `cli` option in the global `.angular.json` configuration, at the root or at project level in `angular.json` .

```jsonc
{
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
  "version": 1,
  "cli": {
    "schematicCollections": ["@schematics/angular", "@angular/material"]
  }
  // ...
}
```

**Rationale**
When this option is not configured and a user would like to run a schematic which is not part of `@schematics/angular`,
the collection name needs to be provided to `ng generate` command in the form of `[collection-name:schematic-name]`. This make the `ng generate` command too verbose for repeated usages.

This is where `schematicCollections` comes handle. When adding `@angular/material` to the list of `schematicCollections`, the generate command will try to locate the schematic in the specified collections.

```
ng generate navigation
```

is equivalent to:

```
ng generate @angular/material:navigation
```

**Conflicting schematic names**
When multiple collections have a schematic with the same name. Both `ng generate` and `ng new` will run the first schematic matched based on the ordering (as specified) of `schematicCollections`.

DEPRECATED:

The `defaultCollection` workspace option has been deprecated in favor of `schematicCollections`.

Before
```json
"defaultCollection": "@angular/material"
```

After
```json
"schematicCollections": ["@angular/material"]
```

Closes #12157
2022-03-22 09:37:57 -07:00
Renovate Bot
e5a7bb17d8 build: update all non-major dependencies 2022-03-21 12:28:37 -07:00
Alan Agius
036327e9ca feat(@angular/cli): deprecated defaultProject option
With this change we deprecate the angular.json `defaultProject` option.

DEPRECATED:

The `defaultProject` workspace option has been deprecated. The project to use will be determined from the current working directory.

Closes #20661
2022-03-21 12:28:15 -07:00
Alan Agius
e5bf35ea30 feat(@angular/cli): add ng cache command
With this change we create a new command `ng cache` that can be used control and check the disk cache settings.

This command has 4 subcommands
 - `ng cache enable` which can be used to enable the cache.
 - `ng cache disable` which can be used to disable the cache.
 - `ng cache clean` which can be used to delete the cache from disk.
 - `ng cache info` which will print statistics and information about the cache.
2022-03-18 13:52:07 -07: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
Renovate Bot
becd7b6ed9 build: update all non-major dependencies 2022-03-18 11:45:03 -07:00
Alan Agius
8a396de6a8 fix(@angular/cli): print entire config when no positional args are provided to ng config
This fixes a regression were when no positional args are provided to `ng config` the entire config file should to be printed in the console.
2022-03-18 11:44:46 -07:00
Alan Agius
5a8bdeb434 fix(@angular/cli): hide private schematics from ng g help output
With this change we don't display private schematic in `ng generate` help output.
2022-03-18 11:44:12 -07:00
Alan Agius
8e66c9188b fix(@angular/cli): ng g show descrption from collection.json if not present in schema.json
Wiht this change we show the descrption from `collection.json` if not present in schematic `schema.json` in  `ng generate` help output
2022-03-18 11:44:12 -07:00
Alan Agius
a497d12a6b refactor(@angular/cli): remove hasAnalyticsConfig analytics logic
With this change we clean up further the analytics code and re-use the `getAnalytics` to determine if the config is set or not.

Also, this change inclused a refactor to the `createAnalytics` method to make it more readable.
2022-03-16 11:36:10 -07:00
Renovate Bot
1a36fd94a8 build: update all non-major dependencies 2022-03-16 14:15:50 -04:00
Alan Agius
c0fe0626d5 build: handle default sub command in json help output
This change is needed to handle default subcommands which are used in `ng generate` default subcommands are prefixed with `$0` or `*`.

More info: https://github.com/yargs/yargs/blob/main/docs/advanced.md#default-commands
2022-03-16 10:07:44 -04:00
Alan Agius
d560e23d67 refactor(@angular/cli): remove old CommandModule and SchematicCommand implementations
Use the newly implemented `CommandModule` and `SchematicsCommandModule`.
2022-03-16 10:07:44 -04:00
Alan Agius
154236501f refactor(@angular/cli): add package manager in command context 2022-03-16 10:07:44 -04:00
Alan Agius
7ab22ed40d feat(@angular/cli): add disable/enable aliases for off/on ng analytics command
`ng analytics enable/disable`better aligns with `ng cache enable/disable` that will be available in the future.
2022-03-15 16:31:07 -04:00
Alan Agius
46a7be3af4 refactor(@angular/cli): clean up analytics methods
Re-use methods were possible.
2022-03-15 16:31:07 -04:00
Alan Agius
bb550436a4 feat(@angular/cli): add ng analytics info command
With this change we add a subcommand to `ng analytics`. This command can be used tp display analytics gathering and reporting configuration.

Example:
```
$ ng analytics info
Global setting: disabled
Local setting: enabled
Effective status: disabled
```
2022-03-15 16:31:07 -04:00
Alan Agius
afafa5788f feat(@angular/cli): add --global option to ng analytics command
With this change we add a `--global` option to `ng analytics` command.

BREAKING CHANGE:

Several changes to the `ng analytics` command syntax.

- `ng analytics project <setting>` has been replaced with `ng analytics <setting>`
- `ng analytics <setting>` has been replaced with `ng analytics <setting> --global`
2022-03-15 16:31:07 -04:00
Renovate Bot
9c8b3a16f6 build: update all non-major dependencies 2022-03-15 11:06:45 -04:00
Alan Agius
054ae02c2f fix(@angular/cli): favor project in cwd when running architect commands
When running architect command such as `ng build`, `ng test`, `ng lint`... and no project is provided as a positional argument. The project in the current working directory is favored instead of the configured as default project.
2022-03-14 15:36:08 -04:00
Alan Agius
ca401255f4 fix(@angular/cli): sort commands in help output 2022-03-14 15:26:49 -04:00
Alan Agius
b1885856a7 docs(@angular/cli): improve several ng update option descriptions 2022-03-14 10:20:48 -04:00
Alan Agius
a49cdfbfef fix(@angular/cli): don't prompt for analytics when running ng analytics
This addresses the issue  when trying to disable analytics the prompt will be shown

```
ng analytics off
Would you like to share anonymous usage data about this project with the Angular Team at Google under Google’s Privacy Policy at https://policies.google.com/privacy? For more details and how to change this setting, see http://angular.io/analytics. (y/N)
```

Closes #16784

(cherry picked from commit 9a9bd3f2ac22211dc6e8a47be582c5e1390189d7)
2022-03-14 10:20:32 -04:00
Alan Agius
96a0d92da2 fix(@angular/cli): remove JSON serialized description from help output
With this change we remove the JSON serialized description from the help output and also align the description properties between commands and subcommands.
2022-03-10 15:36:03 -05:00
Alan Agius
9edeb86146 fix(@angular/cli): add long description to ng update
The long-description.md was not referenced in `UpdateCommandModule`.
2022-03-10 15:35:52 -05:00
Alan Agius
6d37ffcd66 refactor(@angular/cli): replace longDescription line endings with \n
Needed to fix Windows CI
2022-03-10 14:43:33 -05:00
Alan Agius
a6d78a961a refactor(@angular/cli): always use posix separator in longDescriptionRelativePath
Needed for consistency that will fix a Windows CI failure
2022-03-09 21:59:26 +01:00
Renovate Bot
8673e3d36b build: update all non-major dependencies 2022-03-09 17:43:38 +01:00
Alan Agius
92528b1df3 refactor(@angular/cli): several small refactoring and code quality improvements
This PR brings a number of small refactors to improve code quality in the new args parser implementation.
2022-03-09 17:18:53 +01:00
Alan Agius
33ec5e7a04 refactor(@angular/cli): remove unnecessary castings and types 2022-03-09 17:18:53 +01:00
Alan Agius
98984bfcb8 refactor(@angular/cli): move move architect common logic into a base class 2022-03-09 17:18:53 +01:00