35 Commits

Author SHA1 Message Date
Alan Agius
05a52c8c59 refactor: clean up remove unused code 2021-06-25 07:46:22 +02:00
Alan Agius
f6135a20d1 fix(@angular/cli): don't display options multiple times in schematics help output
Previously, we disabled options in the help output multiple times.

Previous output
```
Generates and/or modifies files based on a schematic.
usage: ng generate c <name> [options]

arguments:
  schematic
    The schematic or collection:schematic to generate.
  name
    The name of the component.

options:
  --change-detection (-c)
    The change detection strategy to use in the new component.
  --defaults
    When true, disables interactive input prompts for options with a default.
  --display-block (-b)
    Specifies if the style will contain `:host { display: block; }`.
  --dry-run (-d)
    When true, runs through and reports activity without writing out results.
  --entry-component
    When true, the new component is the entry component of the declaring NgModule.
  --export
    When true, the declaring NgModule exports this component.
  --flat
    When true, creates the new files at the top level of the current project.
  --force (-f)
    When true, forces overwriting of existing files.
  --help
    Shows a help message for this command in the console.
  --inline-style (-s)
    When true, includes styles inline in the component.ts file. Only CSS styles can be included inline. By default, an external styles file is created and referenced in the component.ts file.
  --inline-template (-t)
    When true, includes template inline in the component.ts file. By default, an external template file is created and referenced in the component.ts file.
  --interactive
    When false, disables interactive input prompts.
  --lint-fix
    When true, applies lint fixes after generating the component.
  --module (-m)
    The declaring NgModule.
  --prefix (-p)
    The prefix to apply to the generated component selector.
  --project
    The name of the project.
  --selector
    The HTML selector to use for this component.
  --skip-import
    When true, does not import this component into the owning NgModule.
  --skip-selector
    Specifies if the component should have a selector or not.
  --skip-tests
    When true, does not create "spec.ts" test files for the new component.
  --style
    The file extension or preprocessor to use for style files.
  --type
    Adds a developer-defined type to the filename, in the format "name.type.ts".
  --view-encapsulation (-v)
    The view encapsulation strategy to use in the new component.

Help for schematic c
Creates a new generic component definition in the given or default project.
arguments:
  name
    The name of the component.

options:
  --change-detection (-c)
    The change detection strategy to use in the new component.
  --display-block (-b)
    Specifies if the style will contain `:host { display: block; }`.
  --entry-component
    When true, the new component is the entry component of the declaring NgModule.
  --export
    When true, the declaring NgModule exports this component.
  --flat
    When true, creates the new files at the top level of the current project.
  --inline-style (-s)
    When true, includes styles inline in the component.ts file. Only CSS styles can be included inline. By default, an external styles file is created and referenced in the component.ts file.
  --inline-template (-t)
    When true, includes template inline in the component.ts file. By default, an external template file is created and referenced in the component.ts file.
  --lint-fix
    When true, applies lint fixes after generating the component.
  --module (-m)
    The declaring NgModule.
  --prefix (-p)
    The prefix to apply to the generated component selector.
  --project
    The name of the project.
  --selector
    The HTML selector to use for this component.
  --skip-import
    When true, does not import this component into the owning NgModule.
  --skip-selector
    Specifies if the component should have a selector or not.
  --skip-tests
    When true, does not create "spec.ts" test files for the new component.
  --style
    The file extension or preprocessor to use for style files.
  --type
    Adds a developer-defined type to the filename, in the format "name.type.ts".
  --view-encapsulation (-v)
    The view encapsulation strategy to use in the new component.

To see help for a schematic run:
  ng generate <schematic> --help
```

New output
```
Generates and/or modifies files based on a schematic.
usage: ng generate c <name> [options]

arguments:
  schematic
    The schematic or collection:schematic to generate.
  name
    The name of the component.

options:
  --change-detection (-c)
    The change detection strategy to use in the new component.
  --defaults
    Disable interactive input prompts for options with a default.
  --display-block (-b)
    Specifies if the style will contain `:host { display: block; }`.
  --dry-run (-d)
    Run through and reports activity without writing out results.
  --export
    The declaring NgModule exports this component.
  --flat
    Create the new files at the top level of the current project.
  --force (-f)
    Force overwriting of existing files.
  --help
    Shows a help message for this command in the console.
  --inline-style (-s)
    Include styles inline in the component.ts file. Only CSS styles can be included inline. By default, an external styles file is created and referenced in the component.ts file.
  --inline-template (-t)
    Include template inline in the component.ts file. By default, an external template file is created and referenced in the component.ts file.
  --interactive
    Enable interactive input prompts.
  --lint-fix
    Apply lint fixes after generating the component.
  --module (-m)
    The declaring NgModule.
  --prefix (-p)
    The prefix to apply to the generated component selector.
  --project
    The name of the project.
  --selector
    The HTML selector to use for this component.
  --skip-import
    Do not import this component into the owning NgModule.
  --skip-selector
    Specifies if the component should have a selector or not.
  --skip-tests
    Do not create "spec.ts" test files for the new component.
  --style
    The file extension or preprocessor to use for style files.
  --type
    Adds a developer-defined type to the filename, in the format "name.type.ts".
  --view-encapsulation (-v)
    The view encapsulation strategy to use in the new component.

To see help for a schematic run:
  ng generate <schematic> --help
```
2021-05-03 11:39:23 -04: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
Charles Lyding
06335515eb fix(@angular/cli): avoid exceptions for expected errors in architect commands
Errors caused by invalid options or workspace configuration will now be presented as fatal console messages and the CLI will exit gracefully with an exit code of 1.
2021-03-10 08:19:42 -06:00
Alan Agius
2a2293cd2d fix(@angular/cli): dasherize names option names when using JSON help
This ensures that arguments listed in https://angular.io/cli help pages are all in kebab cases.

This is a prerequisite to deprecate camel cased arguments.
2020-12-02 16:02:27 +01:00
Charles Lyding
acc22a399f refactor(@angular/cli): remove async from abstract functions
This is in preparation to support TypeScript 4.1.  Within TypeScript 4.1 abstract class members cannot be marked as async.
2020-11-05 08:31:35 +01:00
Alan Agius
90988aaf52 fix(@angular/cli): collect analytics option usage from workspace config and prompts
With this change we fix two analytics collection bugs:
- We now collect the usage of options defined in the workspace config (angular.json).
- We now also collect values set via schematic prompts.

Closes: #17900
2020-10-07 09:54:59 -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
Charles Lyding
5275892f63 refactor(@angular/cli): remove any type usage 2020-08-24 07:50:01 -04:00
Alan Agius
05588fcee1 refactor: clean up unused code and imports 2020-07-24 08:01:52 +02: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
Hans Larsen
ce4e9f1d80 fix(@angular/cli): pass in metrics to the pageview for commands
We might want to pass those later.
2019-06-28 10:49:27 -07:00
Charles Lyding
c4313f55e4 refactor(@angular/cli): unify color handling and support 2019-06-24 17:27:59 -07:00
Charles Lyding
7a72f2fb17 refactor(@angular/cli): avoid aggressive eager command loading
Currently, upon execution `ng` will load all description files AND code for all available commands.  This requires a large amount of unnecessary file access and processing since only at most one command will be executed.  This change limits the loading to only command being executed in the common case and a subset of commands in the event an alias is used.  The help command now loads all commands during its execution which is needed to gather command description information.  Further improvements are possible by only loading the necessary metadata instead of the execution code (and its dependencies) as well.
This change allows for savings of ~250ms per execution.

Examples:
Before -- `./node_modules/.bin/ng version  0.99s user 0.17s system 113% cpu 1.020 total`
After -- `./node_modules/.bin/ng version  0.70s user 0.13s system 110% cpu 0.749 total`

Before -- `./node_modules/.bin/ng g c a  1.91s user 0.30s system 111% cpu 1.996 total`
After -- `./node_modules/.bin/ng g c a  1.62s user 0.27s system 110% cpu 1.715 total`
2019-05-10 15:04:32 -07:00
Hans Larsen
600b0218fd feat(@angular/cli): add tracking for command duration 2019-03-28 13:28:41 -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
Alan Agius
31783140b8 fix(@angular/cli): show full path to project definition when already exists
Fixes #13138
2018-12-06 11:50:08 -08:00
Alan Agius
0dc4c40dd3 fix(@angular/cli): multiline help descriptions are not aligned 2018-10-23 12:00:30 -07:00
Charles Lyding
91cf2d7b9f fix(@angular/cli): allow global config command outside project
Fixes #12296
2018-09-25 17:05:15 -04:00
Hans
0b959d1233 * fix(@angular/cli): remove helpJson and help-json mentions (#12331)
* fix(@angular/cli): remove helpJson and help-json mentions

* ci: use proper --help=json for creating snapshot
2018-09-20 14:45:09 -07:00
Hans
f7f5b28dae feat(@angular/cli): if parsing comes accross an obvious error throw it
We accumulate errors this way, and throw only once at the end, with messages for
all errors.
2018-09-19 13:02:40 -07:00
Hans
fcbc7db54f feat(@angular/cli): remove --help-json and add format to help
--help now accepts a value which can be a boolean or a string. If the value
is not understood we simply show a message to the user that it was invalid.
2018-09-19 13:02:40 -07:00
Hans
34818b0346 feat(@angular/cli): add subcommand to options
SubCommands are not tied to the option that triggers them. They
contain a subset of a CommandDescription interface, with at least
a short and long description and usage notes. These are generated
from the subcommand schema (e.g. schematics in case of generate).
2018-09-19 13:02:40 -07:00
Hans Larsen
30b0cbda0d refactor(@angular/cli): automated JSON schema interface generation 2018-09-13 16:44:17 -07:00
Charles Lyding
57a32c2ef5 fix(@angular/cli): show an error if invalid global config file found
Fixes #12198
2018-09-12 16:00:04 -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
ff1baab7fc feat(@angular/cli): remove yargs-parser and implement parsing
This is fully backward compatible.
2018-09-06 07:37:48 -07:00
Hans
a7b9ee5856 refactor: cleanup and better documentation / comments (hidden from release log) 2018-08-13 20:58:47 -07:00
Mike Brocchi
ae9817b7ee feat(@angular/cli): Update commands to extract meta data into JSON 2018-08-13 20:58:47 -07:00
Hans
a0978b1db3 refactor: fix types to remove any
require() returns any so we were missing some typing errors.
2018-07-11 13:35:35 -07:00
Alex Eagle
d1e392fa78 refactor: add missing license headers under packages/angular/cli 2018-06-06 15:11:31 -07:00
Hans Larsen
44086c60ff build: move devkit repo back to angular-cli 2018-06-05 18:50:06 -07:00