67 lines
9.4 KiB
JavaScript
67 lines
9.4 KiB
JavaScript
|
"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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi8uLi9wYWNrYWdlcy9zY2hlbWF0aWNzL2FuZ3VsYXIvbmctbmV3L2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQTs7Ozs7O0dBTUc7O0FBRUgsMkRBV29DO0FBQ3BDLDREQUkwQztBQUsxQyxtQkFBeUIsT0FBcUI7SUFDNUMsSUFBSSxDQUFDLE9BQU8sQ0FBQyxTQUFTLEVBQUU7UUFDdEIsdUVBQXVFO1FBQ3ZFLE9BQU8sQ0FBQyxTQUFTLEdBQUcsT0FBTyxDQUFDLElBQUksQ0FBQyxVQUFVLENBQUMsR0FBRyxDQUFDLENBQUMsQ0FBQyxDQUFDLE9BQU8sQ0FBQyxJQUFJLENBQUMsS0FBSyxDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQyxPQUFPLENBQUMsSUFBSSxDQUFDO0tBQ3pGO0lBRUQsTUFBTSxnQkFBZ0IsR0FBcUI7UUFDekMsSUFBSSxFQUFFLE9BQU8sQ0FBQyxJQUFJO1FBQ2xCLE9BQU8sRUFBRSxPQUFPLENBQU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