"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const schematics_1 = require("@angular-devkit/schematics");
const lib_1 = require("../../lib");
const angular_utility_1 = require("../../lib/angular-utility");
// You don't have to export the function as default. You can also have more than one rule factory
// per file.
// This is the factory function 
function default_1(_options) {
    // Here we returns the rule
    // The tree is then virtual representation of every file in the workspace. 
    // Using a virtual tree instead of manipulating files directly comes with a couple of big advantages.
    return (tree, _context) => {
        const project = lib_1.loadProject(tree, _context);
        const { name, path } = lib_1.getAngularProjectPath('', tree, _options);
        const sourceTemplates = schematics_1.url('files');
        return angular_utility_1.applyWithOverwriteRule(sourceTemplates, [
            schematics_1.template(Object.assign({ name }, project.toTemplate())),
            schematics_1.move(path)
        ]);
    };
}
exports.default = default_1;
//# sourceMappingURL=index.js.map