"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const schematics_1 = require("@angular-devkit/schematics");
const schematics_core_1 = require("@iotize/schematics-core");
const lib_1 = require("../../lib");
function default_1(options) {
    return schematics_1.chain([
        (tree, context) => {
            const project = lib_1.loadProject(tree, context);
            const templateData = project.toTemplate();
            return schematics_1.chain([
                schematics_core_1.applyWithOverwriteRule(schematics_1.url('./files'), [
                    schematics_1.template(templateData)
                ], {
                    overwrite: options.overwrite,
                    format: true
                }),
                /**
                 * files-defaults resources will not be overwritten if they already exists
                 */
                schematics_core_1.applyWithOverwriteRule(schematics_1.url('./files-defaults'), [
                    schematics_1.template(templateData)
                ], {
                    overwrite: false,
                    ignoreIfExists: true,
                    format: true
                })
            ]);
        },
        schematics_1.schematic('app', {
            overwrite: options.overwrite
        }),
        schematics_1.schematic('app-lib', {
            overwrite: options.overwrite
        }),
        schematics_1.schematic('tap-api', {
            overwrite: options.overwrite
        }),
        schematics_1.schematic('logo', {
            overwrite: true,
            generate: false
        }),
        schematics_1.schematic('app-theme', {
            overwrite: options.overwrite
        }),
        schematics_1.schematic('color-theme', {
            overwrite: options.overwrite
        }),
        schematics_1.schematic('update-cordova-config', {
            // TODO it should not overwrite config as we lost version number for example...
            overwrite: options.overwrite,
            dryRun: options.dryRun,
            skipInstall: options.skipInstall
        }),
        schematics_1.schematic('pages', {
            overwrite: options.overwrite
        }),
        schematics_1.schematic('update-routing', {
            overwrite: options.overwrite
        }),
        schematics_1.schematic('update-dependencies', {
            overwrite: options.overwrite,
            dryRun: options.dryRun,
            skipInstall: options.skipInstall
        }),
        schematics_1.schematic('app-menu', {
            overwrite: options.overwrite
        })
    ]);
}
exports.default = default_1;
//# sourceMappingURL=index.js.map