UNPKG

1.35 kBJavaScriptView Raw
1"use strict";
2/**
3 * @license
4 * Copyright Google Inc. 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 */
9Object.defineProperty(exports, "__esModule", { value: true });
10const schematic_command_1 = require("../models/schematic-command");
11class NewCommand extends schematic_command_1.SchematicCommand {
12 constructor() {
13 super(...arguments);
14 this.allowMissingWorkspace = true;
15 this.schematicName = 'ng-new';
16 }
17 async initialize(options) {
18 this.collectionName = options.collection || await this.getDefaultSchematicCollection();
19 return super.initialize(options);
20 }
21 async run(options) {
22 // Register the version of the CLI in the registry.
23 const packageJson = require('../package.json');
24 const version = packageJson.version;
25 this._workflow.registry.addSmartDefaultProvider('ng-cli-version', () => version);
26 return this.runSchematic({
27 collectionName: this.collectionName,
28 schematicName: this.schematicName,
29 schematicOptions: options['--'] || [],
30 debug: !!options.debug,
31 dryRun: !!options.dryRun,
32 force: !!options.force,
33 });
34 }
35}
36exports.NewCommand = NewCommand;