"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const config_1 = require("@schematics/angular/utility/config");
const schematics_1 = require("@angular-devkit/schematics");
function testing(options) {
    return (host, context) => {
        setupOptions(host, options);
        const workspace = config_1.getWorkspace(host);
        context.logger.info(`OPTIONS: ${JSON.stringify(options)}...`);
        return schematics_1.chain([
            schematics_1.externalSchematic('@briebug/cypress-schematic', 'ng-add', {
                addCypressTestScripts: true
            })
        ]);
    };
}
exports.testing = testing;
function setupOptions(host, options) {
    var lcuFile = host.get('lcu.json');
    var lcuJson = lcuFile ? JSON.parse(lcuFile.content.toString('utf8')) : {};
    const workspace = config_1.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.testPlatform = options.testPlatform || 'Cypress.io';
    return host;
}
//# sourceMappingURL=index.js.map