-
Notifications
You must be signed in to change notification settings - Fork 12k
Bug: Can't return Rule from Schematic - "Invalid rule result: Function()" #11759
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Remove node_modules folder & install @angular-cli again |
@mattezell, I'm able to run your example with any errors with the latest CLI. Had to rename/remove some parameters to make import {
Tree,
chain,
SchematicContext,
} from '@angular-devkit/schematics';
export default function(options: any) {
return chain([returnRule(options)]);
}
export function returnRule(_: any) {
return () => {
return chain([
(_: Tree, context: SchematicContext) => {
context.logger.info('here we go...')
}
])
}
} Version information:
I'm assuming this issue has been fixed at some point after the bug was filed. Please re-open if you are still seeing the error. |
@dgp1130 Yeah, perhaps I should have closed this some time back. I opened it on Ng 6 - we've since upgraded our app to Ng 7, Ng 8 and Ng 9 :) |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Bug Report or Feature Request (mark with an
x
)Command (mark with an
x
)Versions
Node 8.11.3
NPM 5.6.0
@angular/common/core/compiler 6.0.3
@angular-devkit/core 0.7.2
@angular-devkit/schematics 0.7.2
Repro steps
Excerpt from collection.json
test\index.ts
Install/add and attempt to use...
The log given by the failure
Invalid rule result: Function().
Desired functionality
https://github.com/angular/angular-cli/releases/tag/v6.1.0
According to the 6.1.0 release notes for @angular-devkit/schematics, a Rule should now be returnable from a schematic - yet I get this "Invalid Rule" error.. I originally encountered it when trying to copy/modify the component schematic from the Angular repo, which uses this new 'return a rule' approach - and since have reproduced the issue with the above basic test schematic...
Mention any other details that might be useful
Am I missing something - specifically comprehensive documentation and guidance examples? We adopted Schematics for an enterprise project due to Angular CLI's 'dog fooding' Schematics for the Angular projects - but we've found it very, very difficult to use due to the currently incomplete docs and sparse guidance to be found for non-trivial collections around the web... Is Schematics 'production ready', or would we be best served reverting to our old Gulp ways?
Thanks!
The text was updated successfully, but these errors were encountered: