45 Commits

Author SHA1 Message Date
Charles Lyding
9280d87650 refactor(@angular-devkit/schematics): allow direct workflow option transforms
This change allows option transforms to be directly provided to the NodeWorkflow instead of needing to access the engine host inside the workflow after creation.  This also allows option transforms to affect the options prior to schema validation (if enabled).
2020-11-16 13:14:24 -05:00
Charles Lyding
0b0961c9c2 refactor(@angular-devkit/schematics): minor cleanup to reduce utility imports 2020-10-21 09:05:45 +02:00
Charles Lyding
34f769fcde refactor(@angular-devkit/schematics): use interface for NodeWorkflow options
This change removes the previously repeated type definitions for the options of the NodeWorkflow class.
2020-10-02 06:30:18 -04:00
Charles Lyding
5bc3616f30 feat(@angular-devkit/schematics): support schema validation in NodeWorkflow
This change provides an additional NodeWorkflow option `schemaValidation`.  When enabled, this new option will setup schema-based validation of a schematics options prior to schematic execution.  The schema registry provided with the NodeWorkflow is used to perform the validation.  This new option removes the need to manually configure validation of schematic options when initializing a schematic runtime.
2020-10-02 06:30:18 -04:00
Charles Lyding
017581cacb feat(@angular-devkit/schematics): allow using a root path with NodeWorkflow
This change allows the creation of a NodeWorkflow class with a path string instead of requiring a fully configured filesystem host object.  This reduces the amount of code necessary to setup a schematics runtime for common cases.
2020-10-02 06:30:18 -04:00
Charles Lyding
5ce621e371 fix(@angular-devkit/schematics): resolve external schematics from requesting collection
This change first attempts to resolve a schematic referenced via the external schematic rule from the requesting schematic collection.  This allows schematic packages that are direct dependencies of another schematic package to be used with the external schematic rule without manual package resolution code within the schematic.

Closes #18098
Closes #11026
2020-09-18 14:53:44 -05:00
Alan Agius
d1adba1347 build: update build_bazel_rules_nodejs to 2.0.2 2020-08-19 16:00:07 +02:00
Charles Lyding
165abc820b fix(@angular-devkit/schematics): verify filesystem createSourceFromUrl context before use 2020-08-12 19:27:38 +01:00
Alan Agius
05588fcee1 refactor: clean up unused code and imports 2020-07-24 08:01:52 +02:00
Filipe Silva
b51cf8d1e6 build: use ts_library macro with common defaults 2020-04-30 15:12:46 -07:00
Filipe Silva
9a28114f6b test: remove non-bazel test setup 2020-04-30 15:12:46 -07:00
Filipe Silva
eceb5cdaa6 build: use rules_nodejs 1.6.0 features
Contains fixes related to the symlink behaviour inside of bazel. Without it, webpack needs to be configured to be aware of symlinks and preserve the paths.
2020-04-30 15:12:46 -07:00
Keen Yee Liau
e5db6a8ccd build: BUILD files formatted to have load statements at the top 2020-04-23 10:31:56 -07:00
Alan Agius
b1a5f49540 refactor(@angular-devkit/schematics): remove deprecated FileSystemHost
BREAKING CHANGE
Deprecated `FileSystemHost` has been removed. Use `Host` directly instead.

Note: this change only effects direct `@angular-devkit/schematics` users and not the application developers.
2020-04-22 10:38:38 -07:00
Filipe Silva
60e92d54fb style: reformat bazel files 2020-04-07 09:07:19 -07:00
Filipe Silva
5f3f736936 build: move BUILD.bazel files for secondary entry points into own folder
Without this change, module names will be computed with incorrect paths containing duplicate path fragments (e.g. `@angular-devkit/architect/testing/testing/test-logger`).
2020-04-07 09:07:19 -07:00
Charles Lyding
ea3d9e0285 fix(@angular-devkit/schematics): fully resolve schematic entries within packages
Fixes: #17085
2020-03-30 10:21:28 -07:00
Charles Lyding
33656f7aa8 fix(@angular-devkit/schematics): allow custom registry for node package task 2020-02-10 16:02:05 -08:00
Charles Lyding
5df776780d fix(@angular-devkit/schematics): use NodeWorkflow root to resolve collections 2019-10-28 17:48:08 -07:00
Alan Agius
341b18d8a6 refactor(@angular-devkit/schematics): remove several deprecated APIs
BREAKING CHANGE:

Removed several deprecated APIs:

- EngineHost `listSchematics` has been removed in favour of `listSchematicNames`.
- `FileSystemSink` - Use the new virtualFs.Host classes from `@angular-devkit/core`.
- `optimize` function has been remove as trees are automaticlly optimized.
- `DryRunSink` deprecated constructor that allowed to provide a directory path has been removed. Provide a `virtualFs.Host` instead.
2019-10-24 16:02:21 -07:00
Alan Agius
70e460d656 refactor: use require.resolve instead of custom resolve (#15906) 2019-10-23 09:59:36 -07:00
Filipe Silva
e8dff5718f build: update to TS 3.5 2019-07-29 10:15:23 -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
Paul Gschwendtner
a57f053867 fix(@angular/cli): ng-update migrations not running with --migrate-only
With Angular CLI version 8, migrations cannot be re-run with the
`--migrate-only` flag as there was a recent regression introduced
in e406f00909 (diff-0d0a748fb9a38a7ccde08d9b42e70bce) as it now passes
a normalized platform path to the `engine.createCollection` call.

This breaks as there is incorrect logic within
`node-modules-engine-host` that causes the schematic collection to be
searched within the `package.json#schematics` entry. This is incorrect
as migration schematics specify their migration schematics in a separate
schematic collection file which is part of `package.json#ng-update`.

Fixes #14565
2019-05-30 10:19:16 -07:00
Charles Lyding
48e6060e02 fix(@angular-devkit/schematics): use rxjs version of isObservable 2019-05-13 15:57:54 -07:00
Hans Larsen
15032aa2e8 feat(@angular-devkit/schematics): add support for analytics
Schematics context now have an (optional) analytics field that, if set,
should be used to report usage. This can be set even in some cases where
analytics is disabled (to a noop analytics).
2019-03-20 15:08:07 -07:00
Charles Lyding
8d177e8789 feat(@angular-devkit/schematics): support calling a task by file path when using a FileSystemEngineHost 2019-01-14 12:52:27 -08:00
Yi Qi
e36a259a45 fix(@angular/cli): fix issues in google3 2018-09-13 14:08:04 -07:00
Alan Agius
54f7ea2b1d fix(@angular-devkit/schematics): throw InvalidCollectionJsonException when collection file is invalid
Closes #11818
2018-09-06 10:49:50 -07:00
Hans
0070ea46e6 fix(@angular-devkit/schematics): fix task executor on Windows
Before we did not denormalize the paths, but were expecting to get paths as options.
2018-09-06 07:37:48 -07:00
Hans
9517677158 feat(@angular-devkit/core): remove addUndefinedDefaults as default post transform
And various bug fixes.
2018-09-06 07:37:48 -07:00
Charles Lyding
cdbc1988f2 feat(@angular-devkit/schematics): allow schematic rules to control interactivity 2018-08-29 09:25:56 -07:00
Filipe Silva
9b7d076e2b fix(@angular-devkit/schematics): correctly resolve absolute windows paths 2018-08-22 16:36:10 -07:00
Filipe Silva
9720077a4b build: make resolution logic compatible with Bazel 2018-08-22 16:36:10 -07:00
Filipe Silva
e17cc66f93 test(@angular-devkit/schematics): add bazel tests 2018-08-22 16:36:10 -07:00
Mike Brocchi
ae9817b7ee feat(@angular/cli): Update commands to extract meta data into JSON 2018-08-13 20:58:47 -07:00
qiyi
cd8801ca7b fix(@angular-devkit/schematics): fix issues in google (#11857)
1. update the return type of 'validateOptionsWithSchema' to make it
conform the signature of engineHost.registerOptionsTransform
2. fix minor naming issue
2018-08-13 12:31:26 -07:00
Yi Qi
02de5cd3ad fix(@angular-devkit/schematics): Fix issues for file-syetem-engine running in google3
Pass 'name' as part of FileSystemCollectionDesc when creating
collection description.
2018-08-02 16:02:21 -04:00
Hans Larsen
2ba1f16295 refactor(@angular-devkit/schematics): add a BaseWorkflow which implements logic
And receives in its constructor the enginehost and registry. This simplifies the creation
of the NodeWorkflow, or later on the Google3Workflow etc, since all the duplicate logic
is now in a single base class.

This is yak shaving for internal stuff.
2018-08-01 11:41:49 -04:00
Hans
91e7c3eb96 test: remove unused test directory and remove @ from paths 2018-07-12 09:26:36 -07:00
Hans Larsen
483cbe2665 refactor: add tslint-sonarts and a lot of tslint rules
This should clean up the code a bit.

Note: at first I added the no-useless-cast rule, but after getting frustrated
with it (as it has many false positive), I decided to remove the rule but some
useless casts were removed so I let those in the PR.
2018-07-10 15:07:36 -07:00
Charles Lyding
61d2181f85 fix(@angular-devkit/schematics): support VirtualTree/HostTree interop 2018-07-03 12:52:22 -04:00
Hans Larsen
5c1cafe750 fix(@angular-devkit/schematics): fix declaring multiple aliases
Fix #11389
2018-07-02 08:21:41 -04:00
Hans Larsen
44086c60ff build: move devkit repo back to angular-cli 2018-06-05 18:50:06 -07:00