"use strict"; /** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ Object.defineProperty(exports, "__esModule", { value: true }); const schematics_1 = require("@angular-devkit/schematics"); const tasks_1 = require("@angular-devkit/schematics/tasks"); function default_1(options) { if (!options.directory) { // If scoped project (i.e. "@foo/bar"), convert directory to "foo/bar". options.directory = options.name.startsWith('@') ? options.name.slice(1) : options.name; } const workspaceOptions = { name: options.name, version: options.version, newProjectRoot: options.newProjectRoot, minimal: options.minimal, strict: options.strict, packageManager: options.packageManager, }; const applicationOptions = { projectRoot: '', name: options.name, inlineStyle: options.inlineStyle, inlineTemplate: options.inlineTemplate, prefix: options.prefix, viewEncapsulation: options.viewEncapsulation, routing: options.routing, style: options.style, skipTests: options.skipTests, skipPackageJson: false, // always 'skipInstall' here, so that we do it after the move skipInstall: true, strict: options.strict, minimal: options.minimal, standalone: options.standalone, }; return (0, schematics_1.chain)([ (0, schematics_1.mergeWith)((0, schematics_1.apply)((0, schematics_1.empty)(), [ (0, schematics_1.schematic)('workspace', workspaceOptions), options.createApplication ? (0, schematics_1.schematic)('application', applicationOptions) : schematics_1.noop, (0, schematics_1.move)(options.directory), ])), (_host, context) => { let packageTask; if (!options.skipInstall) { packageTask = context.addTask(new tasks_1.NodePackageInstallTask({ workingDirectory: options.directory, packageManager: options.packageManager, })); if (options.linkCli) { packageTask = context.addTask(new tasks_1.NodePackageLinkTask('@angular/cli', options.directory), [packageTask]); } } if (!options.skipGit) { const commit = typeof options.commit == 'object' ? options.commit : options.commit ? {} : false; context.addTask(new tasks_1.RepositoryInitializerTask(options.directory, commit), packageTask ? [packageTask] : []); } }, ]); } exports.default = default_1; //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi8uLi9wYWNrYWdlcy9zY2hlbWF0aWNz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G9wdGlvbnMuY29tbWl0ID8ge30gOiBmYWxzZTtcblxuICAgICAgICBjb250ZXh0LmFkZFRhc2soXG4gICAgICAgICAgbmV3IFJlcG9zaXRvcnlJbml0aWFsaXplclRhc2sob3B0aW9ucy5kaXJlY3RvcnksIGNvbW1pdCksXG4gICAgICAgICAgcGFja2FnZVRhc2sgPyBbcGFja2FnZVRhc2tdIDogW10sXG4gICAgICAgICk7XG4gICAgICB9XG4gICAgfSxcbiAgXSk7XG59XG4iXX0=