import { getWorkspace } from '@schematics/angular/utility/config';
import { chain, externalSchematic } from '@angular-devkit/schematics';
export function momentumApp(options) {
    return (host, context) => {
        setupOptions(host, options);
        const workspace = getWorkspace(host);
        options.project = 'application';
        var project = workspace.projects[options.project];
        context.logger.info(`MOMENTUM OPTIONS: ${JSON.stringify(options)}...`);
        return chain([
            externalSchematic('ng-momentum', 'ng-add', {
            // project: options.project
            }),
            externalSchematic('ng-momentum', 'scaffold', {
                spec: false,
                force: true
            })
        ]);
    };
}
function setupOptions(host, options) {
    var lcuFile = host.get('lcu.json');
    var lcuJson = lcuFile ? JSON.parse(lcuFile.content.toString('utf8')) : {};
    const workspace = getWorkspace(host);
    options.scope = lcuJson.templates.scope;
    options.workspace = lcuJson.templates.workspace;
    options.project = options.project ? options.project :
        workspace.defaultProject ? workspace.defaultProject : Object.keys(workspace.projects)[0];
    options.name = options.name;
    return host;
}
//# sourceMappingURL=index.js.map