import { Rule, SchematicContext, Tree } from '@angular-devkit/schematics'; import { NodePackageInstallTask } from '@angular-devkit/schematics/tasks'; // Just return the tree export default function (options: any): Rule { return (tree: Tree, context: SchematicContext) => { //创建一个文件 tree.create('tea.json', options.category); tree.create('index.html', options.locale); context.addTask(new NodePackageInstallTask()); return tree; }; }