UNPKG

ng-alain

Version:

Schematics specific to ng-alain

19 lines (13 loc) 618 B
import { chain, Rule, schematic } from '@angular-devkit/schematics'; import { Schema as CURDOptions } from './schema'; export default function (options: CURDOptions): Rule { const rules: Rule[] = []; const name = options.name || 'list'; delete options.name; [ { name: 'list', options: { name, modal: false, service: options.service } }, { name: 'edit', options: { name: 'edit', modal: true, target: name } }, { name: 'view', options: { name: 'view', modal: true, target: name } } ].forEach(item => rules.push(schematic(item.name, { ...options, ...item.options }))); return chain(rules); }