40 Commits

Author SHA1 Message Date
Marvin
ecf43090d1
feat(@angular-devkit/schematics-cli): auto detect package manager (#24305)
* feat(@angular-devkit/schematics-cli): auto detect package manager

* refactor(@angular-devkit/schematics-cli): code formatting

* refactor(@angular-devkit/schematics-cli): linting
2023-01-25 14:50:07 +00:00
Alan Agius
a69000407c refactor: clean up old ansi-colors castings
This has been fixed in https://github.com/doowb/ansi-colors/pull/44
2022-06-28 08:49:44 -04:00
Charles Lyding
6a3c0b0db5 refactor(@angular-devkit/schematics-cli): assert catch clause variable type before usage
Prepares the `@angular-devkit/schematics-cli` package for the eventual change of enabling the
TypeScript `useUnknownInCatchVariables` option. This option provides additional
code safety by ensuring that the catch clause variable is the proper type before
attempting to access its properties. Similar changes will be needed in the other
packages in the repository prior to enabling `useUnknownInCatchVariables`.
2022-06-14 11:28:21 +02:00
Tobias Speicher
137651645c refactor: replace deprecated String.prototype.substr()
.substr() is deprecated so we replace it with .slice() which works similarily but isn't deprecated

Signed-off-by: Tobias Speicher <rootcommander@gmail.com>
2022-03-21 12:27:52 -07:00
Alan Agius
ac98f25a31 build: update @types/yargs-parser to 21.0.0 2022-03-03 07:25:24 +01:00
Alan Agius
5330d52aee refactor(@angular-devkit/schematics-cli): replace parser with yargs-parser
BREAKING CHANGE: camel case arguments are no longer allowed.

Closes #13544, closes #12150, closes #22173
2022-03-02 10:28:37 -08:00
Charles Lyding
b9e7f89589 fix(@angular-devkit/schematics-cli): log when in debug and/or dry run modes
When using the schematics-cli with a local collection, the debug mode is enabled by default. Debug mode also enables dry run mode by default. This can result in a confusing situation when developing a schematic locally as files will not be written to disk but no messages are present explaining why. To improve the developer experience, messages will now be shown both when debug mode is enabled and when dry run is enabled. If either is enabled by default the reason will also be shown.
2021-08-05 06:49:14 +02:00
Charles Lyding
b3d7080147 build: enable esModuleInterop TypeScript option
The `esModuleInterop` option is recommended to be enable by TypeScript and corrects several assumptions TypeScript would otherwise make when importing CommonJS files.
This option change helps ensure compatibility as packages move towards ESM.
Reference: https://www.typescriptlang.org/tsconfig#esModuleInterop
2021-06-13 11:45:55 -04:00
Alan Agius
e992c9a70b build: update files to be fix eslint header/header failures 2021-05-04 09:59:40 -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
Joey Perrott
003854257c build: migrate all file header to use Google LLC rather than Google Inc 2021-04-27 08:35:22 +02:00
mzocateli
48701a9708 fix(@angular-devkit/schematics-cli): accept windows like paths for schematics
correctly identify schematics paths like 'C:/dir/collection.json:schematic' that used to return 'C' as collection
2021-04-22 09:54:08 +02:00
Keen Yee Liau
07bf174759 docs(@angular-devkit/schematics-cli): Add README
This commit adds a README for the package.
2021-04-14 12:30:18 -04:00
Alan Agius
f6e1fd84a2 refactor(@angular-devkit/schematics-cli): move @schematics/schematics into this package
This change removes the need for the `@schematics/schematics` package and moves it inside `@angular-devkit/schematics-cli`.
2021-04-02 08:09:07 +02:00
Alan Agius
7a39938cd0 fix(@angular-devkit/schematics-cli): remove _ property from options
Closes #19416
2020-11-18 13:18:27 -05:00
Charles Lyding
433a4152ef refactor(@angular-devkit/schematics-cli): use new NodeWorkflow features
This change reduces the amount of schematic runtime setup code by leveraging the new options for the root path and schema validation in the NodeWorkflow class.
2020-10-02 06:30:18 -04:00
Charles Lyding
fa6b4772be style(@angular-devkit/schematics-cli): minor type and import cleanup 2020-10-02 06:30:18 -04:00
Alan Agius
64cc005f0b refactor: change UPDATE action color to cyan 2020-09-14 16:36:30 -04:00
Alan Agius
622d08447d refactor: use ansi-colors instead of removed terminal utils 2020-09-10 20:19:33 +02:00
Alan Agius
439385fef6 fix(@angular-devkit/schematics-cli): use workflow to list schematics
Closes #18548
2020-08-17 18:20:25 +02:00
Alan Agius
a838835bd4 feat(@angular-devkit/schematics-cli): show warning when using deprecated options 2020-08-17 18:18:24 +02:00
Alan Agius
797bcf9944 feat(@angular-devkit/core): add useXDeprecatedProvider to SchemaRegistry
Use the new provider to record usage of options which have the `x-deprecated` keyword.
2020-08-17 18:18:24 +02:00
Alan Agius
5bb853f1d5 build: update @types/inquirer to 7.3.0 2020-07-23 23:30:22 +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
Alan Agius
3d9f2a30ec fix(@angular-devkit/schematics-cli): only show prompts in TTY terminals 2020-07-08 16:09:14 +02:00
Alan Agius
111e9cc383 fix(@angular-devkit/schematics-cli): provide resolvePaths to NodeWorkflow
Closes #17067
2020-02-25 10:27:50 -08:00
Alan Agius
35ca3901ac refactor: strip leading slash to prevent confusion 2019-12-02 10:10:34 -08:00
Alan Agius
e40f23007b fix(@angular-devkit/schematics): use error logger method when there is a workflow error 2019-10-30 13:38:53 -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
Minko Gechev
d274add7b4
fix(@angular/cli): use correct schematic defaults considering workspace (#15041)
Fix #14986

This PR includes some refactoring to simplify the interaction
of the `NodeWorkflow` and the `BaseWorkflow` with the registry.

We were registering redundant `addPostTransform`s. Some of them in
the constructor of the `BaseWorkflow`, which did not allow us to
intercept `addUndefinedDefaults`.

Additionally, we were setting the `validateOptionsWithSchema` transform
multiple times unnecessarily.

An issue left to fix is support for the `--project` option in
schematic commands. Currently, `getProjectName` does not know about
this option, since `createWorkflow` does not know how to parse the
command line arguments. The parsing logic is implemented partially
by the concrete implementation of the `SchematicCommand` template
method.
2019-07-16 09:58:01 -07:00
Michael O'Keefe
db0fc7759b feat(@angular/cli): Added support for multiselect list prompt (#13031)
* feat(@angular/cli): Added support for multiselect list prompt

* If multiselect option is true use the checkbox
   inquirer prompt type, otherwise use list.

* feat(@angular-devkit/core): Added support for multiselect list prompt

* Added multiselect to PromptDefinition interface and usages
2018-11-30 12:01:57 -08:00
Hans
34d7e9d240 feat(@angular-devkit/schematics-cli): add prompt support using Inquirer 2018-11-16 11:36:36 -08:00
Alan Agius
eddad5698a fix(@angular-devkit/schematics-cli): dryRun is not set by default when using a local collection
Fixes #12815
2018-11-01 08:33:24 -07:00
Alan Agius
0b4f3c10e8 fix(@angular-devkit/schematics-cli): inconsistency in referencing collection
Fixes #12600
2018-10-23 11:57:22 -07:00
Alan Agius
bb01cce06a feat(@angular-devkit/schematics-cli): add support for camelCase arguments
At the moment, only kebab case args works, and this might be misleading if you come from the Angular CLI. As for instance `--dryRun` will have no effect.

Fixes #12599
2018-10-23 10:23:17 -07:00
Alan Agius
40129ccebd refactor: make the cli testable 2018-09-18 11:33:11 -07:00
Alan Agius
8fac6a7ceb fix(@angular-devkit/schematics-cli): fix list-schematics is not printing anything
Usage:
```
$  schematics @schematics/angular: --list-schematics
$  schematics --list-schematics
```

When no colon is specified, it means that that you are passing a schematic name to be looked up in the default collection.

Closes #12220
2018-09-18 11:33:11 -07:00
Alan Agius
d77304b700 refactor: remove extra . in error message 2018-08-03 14:32:44 -04:00
Hans Larsen
44086c60ff build: move devkit repo back to angular-cli 2018-06-05 18:50:06 -07:00