UNPKG

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