From baf20296ab82c0cb7d85d4fa5d8740a51aec094d Mon Sep 17 00:00:00 2001 From: Charles Lyding <19598772+clydin@users.noreply.github.com> Date: Sat, 23 Sep 2017 20:26:48 -0400 Subject: [PATCH] refactor(@angular/cli): remove intermediate init command --- packages/@angular/cli/commands/init.ts | 48 -------------------------- packages/@angular/cli/commands/new.ts | 14 ++++---- 2 files changed, 6 insertions(+), 56 deletions(-) delete mode 100644 packages/@angular/cli/commands/init.ts diff --git a/packages/@angular/cli/commands/init.ts b/packages/@angular/cli/commands/init.ts deleted file mode 100644 index b4c309d736..0000000000 --- a/packages/@angular/cli/commands/init.ts +++ /dev/null @@ -1,48 +0,0 @@ -const Command = require('../ember-cli/lib/models/command'); - -const InitCommand: any = Command.extend({ - name: 'init', - description: 'Creates a new Angular CLI project in the current folder.', - works: 'everywhere', - hidden: true, - - availableOptions: [ - { name: 'dry-run', type: Boolean, default: false, aliases: ['d'] }, - { name: 'verbose', type: Boolean, default: false, aliases: ['v'] }, - { name: 'link-cli', type: Boolean, default: false, aliases: ['lc'] }, - { name: 'skip-install', type: Boolean, default: false, aliases: ['si'] }, - { name: 'skip-git', type: Boolean, default: false, aliases: ['sg'] }, - { name: 'skip-tests', type: Boolean, default: false, aliases: ['st'] }, - { name: 'skip-commit', type: Boolean, default: false, aliases: ['sc'] }, - { name: 'name', type: String, default: '', aliases: ['n'] }, - { name: 'source-dir', type: String, default: 'src', aliases: ['sd'] }, - { name: 'style', type: String, default: 'css' }, - { name: 'prefix', type: String, default: 'app', aliases: ['p'] }, - { name: 'routing', type: Boolean, default: false }, - { name: 'inline-style', type: Boolean, default: false, aliases: ['is'] }, - { name: 'inline-template', type: Boolean, default: false, aliases: ['it'] }, - { - name: 'minimal', - type: Boolean, - default: false, - description: 'Should create a minimal app.' - } - ], - - anonymousOptions: [''], - - run: function (commandOptions: any, rawArgs: string[]) { - const InitTask = require('../tasks/init').default; - - const initTask = new InitTask({ - project: this.project, - tasks: this.tasks, - ui: this.ui, - }); - - return initTask.run(commandOptions, rawArgs); - } -}); - -InitCommand.overrideCore = true; -export default InitCommand; diff --git a/packages/@angular/cli/commands/new.ts b/packages/@angular/cli/commands/new.ts index af23667aa7..bc10a0a18c 100644 --- a/packages/@angular/cli/commands/new.ts +++ b/packages/@angular/cli/commands/new.ts @@ -2,14 +2,12 @@ import * as fs from 'fs'; import * as path from 'path'; import * as chalk from 'chalk'; -import InitCommand from './init'; import { CliConfig } from '../models/config'; import { validateProjectName } from '../utilities/validate-project-name'; import { oneLine } from 'common-tags'; import { SchematicAvailableOptions } from '../tasks/schematic-get-options'; const Command = require('../ember-cli/lib/models/command'); -const Project = require('../ember-cli/lib/models/project'); const SilentError = require('silent-error'); const NewCommand = Command.extend({ @@ -150,15 +148,15 @@ const NewCommand = Command.extend({ commandOptions.collectionName = this.getCollectionName(rawArgs); } - const initCommand = new InitCommand({ - ui: this.ui, + const InitTask = require('../tasks/init').default; + + const initTask = new InitTask({ + project: this.project, tasks: this.tasks, - project: Project.nullProject(this.ui, this.cli) + ui: this.ui, }); - return Promise.resolve() - .then(initCommand.run.bind(initCommand, commandOptions, rawArgs)); - + return initTask.run(commandOptions, rawArgs); } });