[6a3a178] | 1 | "use strict";
|
---|
| 2 | /**
|
---|
| 3 | * @license
|
---|
| 4 | * Copyright Google LLC All Rights Reserved.
|
---|
| 5 | *
|
---|
| 6 | * Use of this source code is governed by an MIT-style license that can be
|
---|
| 7 | * found in the LICENSE file at https://angular.io/license
|
---|
| 8 | */
|
---|
| 9 | Object.defineProperty(exports, "__esModule", { value: true });
|
---|
| 10 | exports.NewCommand = void 0;
|
---|
| 11 | const schematic_command_1 = require("../models/schematic-command");
|
---|
| 12 | const version_1 = require("../models/version");
|
---|
| 13 | class NewCommand extends schematic_command_1.SchematicCommand {
|
---|
| 14 | constructor() {
|
---|
| 15 | super(...arguments);
|
---|
| 16 | this.allowMissingWorkspace = true;
|
---|
| 17 | this.schematicName = 'ng-new';
|
---|
| 18 | }
|
---|
| 19 | async initialize(options) {
|
---|
| 20 | this.collectionName = options.collection || (await this.getDefaultSchematicCollection());
|
---|
| 21 | return super.initialize(options);
|
---|
| 22 | }
|
---|
| 23 | async run(options) {
|
---|
| 24 | // Register the version of the CLI in the registry.
|
---|
| 25 | const version = version_1.VERSION.full;
|
---|
| 26 | this._workflow.registry.addSmartDefaultProvider('ng-cli-version', () => version);
|
---|
| 27 | return this.runSchematic({
|
---|
| 28 | collectionName: this.collectionName,
|
---|
| 29 | schematicName: this.schematicName,
|
---|
| 30 | schematicOptions: options['--'] || [],
|
---|
| 31 | debug: !!options.debug,
|
---|
| 32 | dryRun: !!options.dryRun,
|
---|
| 33 | force: !!options.force,
|
---|
| 34 | });
|
---|
| 35 | }
|
---|
| 36 | }
|
---|
| 37 | exports.NewCommand = NewCommand;
|
---|