refactor(@angular/cli): remove intermediate init command

This commit is contained in:
Charles Lyding 2017-09-23 20:26:48 -04:00 committed by Filipe Silva
parent a3622c54a2
commit baf20296ab
2 changed files with 6 additions and 56 deletions

View File

@ -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: ['<glob-pattern>'],
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;

View File

@ -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);
}
});