I'm trying to build an Angular Schematics to help me and my team create NgRx actions fast. This is the schematics function, most of it is copied from various tutorials:
export default (options: CCSchematicsAction): Rule => {
return (tree: Tree, _context: SchematicContext) => {
const modulePath = options.modulePath.replace(/-?module$/, ""); // "shared/application-tools"
const moduleFolder = normalize("src/app/" + modulePath); // "src/app/shared/application-tools"
const modulePathComponents = modulePath.split("/"); // ["shared", "application-tools"]
const moduleIdentifier = modulePathComponents
.map(part => classify(part))
.join(".")
+ ".Action"; // "Shared.ApplicationTools.Action"
const action = options.name.replace(/-?action$/, "");
const path = normalize(moduleFolder + "/action/" + action) + "/";
const templateSource = apply(url("./files"), [
template({
action: action,
moduleIdentifier: moduleIdentifier
}),
move(path)
]);
return chain([
mergeWith(templateSource)
])(tree, _context);
};
}
I invoke the schematics with
schematics cc-generate:action load-stuff-action --modulePath shared/ui
and get the following, which I can't even find any info to on the web:
TypeError: trustedSubscriber._addParentTeardownLogic is not a function
at MergeMapSubscriber.Subscriber [as constructor] (/Users/voss/Development/cc/cc-schematics/node_modules/rxjs/internal/Subscriber.js:45:43)
at MergeMapSubscriber.OuterSubscriber [as constructor] (/Users/voss/Development/cc/cc-schematics/node_modules/rxjs/internal/OuterSubscriber.js:20:42)
at new MergeMapSubscriber (/Users/voss/Development/cc/cc-schematics/node_modules/rxjs/internal/operators/mergeMap.js:48:28)
at MergeMapOperator.call (/Users/voss/Development/cc/cc-schematics/node_modules/rxjs/internal/operators/mergeMap.js:39:33)
at Observable.subscribe (/Users/voss/Development/cc/cc-schematics/node_modules/rxjs/internal/Observable.js:24:22)
at DefaultIfEmptyOperator.call (/usr/local/lib/node_modules/@angular-devkit/schematics-cli/node_modules/rxjs/internal/operators/defaultIfEmpty.js:24:23)
at Observable.subscribe (/Users/voss/Development/cc/cc-schematics/node_modules/rxjs/internal/Observable.js:24:22)
at TakeLastOperator.call (/usr/local/lib/node_modules/@angular-devkit/schematics-cli/node_modules/rxjs/internal/operators/takeLast.js:35:23)
at Observable.subscribe (/Users/voss/Development/cc/cc-schematics/node_modules/rxjs/internal/Observable.js:24:22)
at DoOperator.call (/usr/local/lib/node_modules/@angular-devkit/schematics-cli/node_modules/rxjs/internal/operators/tap.js:29:23)
Edit:
When I remove everything and just return an empty chain, the error stays.
export default (_options: CCSchematicsAction): Rule => {
return (tree: Tree, _context: SchematicContext) => {
return chain([noop()])(tree, _context);
};
}
So what's wrong with the chain function?