diff --git a/packages/angular-cli/ember-cli/lib/cli/index.js b/packages/angular-cli/ember-cli/lib/cli/index.js index 2843a0599578..1e5025ee53f8 100644 --- a/packages/angular-cli/ember-cli/lib/cli/index.js +++ b/packages/angular-cli/ember-cli/lib/cli/index.js @@ -3,11 +3,8 @@ var path = require('path'); // Main entry point var Project = require('../models/project'); -var requireAsHash = require('../utilities/require-as-hash'); -var Command = require('../models/command'); -var commands = requireAsHash(path.join(__dirname, '../commands/*.js'), Command); -var Task = require('../models/task'); -var tasks = requireAsHash(path.join(__dirname, '../tasks/*.js'), Task); +var commands = require('../commands'); +var tasks = require('../tasks'); var CLI = require('./cli'); var packageConfig = require('../../../package.json'); var debug = require('debug')('ember-cli:cli/index'); diff --git a/packages/angular-cli/ember-cli/lib/commands.js b/packages/angular-cli/ember-cli/lib/commands.js new file mode 100644 index 000000000000..801330451d53 --- /dev/null +++ b/packages/angular-cli/ember-cli/lib/commands.js @@ -0,0 +1,2 @@ + +module.exports = { 'Unknown': require('./commands/unknown') }; diff --git a/packages/angular-cli/ember-cli/lib/tasks.js b/packages/angular-cli/ember-cli/lib/tasks.js new file mode 100644 index 000000000000..d8016a453791 --- /dev/null +++ b/packages/angular-cli/ember-cli/lib/tasks.js @@ -0,0 +1,12 @@ + +module.exports = { + CreateAndStepIntoDirectory: require('./tasks/create-and-step-into-directory'), + DestroyFromBlueprint: require('./tasks/destroy-from-blueprint'), + GenerateFromBlueprint: require('./tasks/generate-from-blueprint'), + GitInit: require('./tasks/git-init'), + InstallBlueprint: require('./tasks/install-blueprint'), + NpmInstall: require('./tasks/npm-install'), + NpmTask: require('./tasks/npm-task'), + NpmUninstall: require('./tasks/npm-uninstall'), + Update: require('./tasks/update') +}; diff --git a/packages/angular-cli/ember-cli/lib/utilities/attempt-never-index.js b/packages/angular-cli/ember-cli/lib/utilities/attempt-never-index.js deleted file mode 100644 index d2ec53254958..000000000000 --- a/packages/angular-cli/ember-cli/lib/utilities/attempt-never-index.js +++ /dev/null @@ -1,20 +0,0 @@ -'use strict'; - -var isDarwin = /darwin/i.test(require('os').type()); -var debug = require('debug')('ember-cli:utilities/attempt-metadata-index-file'); - -module.exports = function(dir) { - var path = dir + '/.metadata_never_index'; - - if (!isDarwin) { - debug('not darwin, skipping %s (which hints to spotlight to prevent indexing)', path); - return; - } - - debug('creating: %s (to prevent spotlight indexing)', path); - - var fs = require('fs-extra'); - - fs.mkdirsSync(dir); - fs.writeFileSync(path); -}; diff --git a/packages/angular-cli/ember-cli/lib/utilities/deprecate.js b/packages/angular-cli/ember-cli/lib/utilities/deprecate.js deleted file mode 100644 index 35be01d66568..000000000000 --- a/packages/angular-cli/ember-cli/lib/utilities/deprecate.js +++ /dev/null @@ -1,19 +0,0 @@ -'use strict'; - -var chalk = require('chalk'); - -module.exports = function(message, test) { - if (test) { - console.log(chalk.yellow('DEPRECATION: ' + message)); - } -}; - -module.exports.deprecateUI = function(ui) { - return function(message, test) { - ui.writeDeprecateLine('The deprecateUI utility has been deprecated in favor of ui.writeDeprecateLine'); - - test = !test; - - ui.writeDeprecateLine(message, test); - }; -}; diff --git a/packages/angular-cli/ember-cli/lib/utilities/doc-generator.js b/packages/angular-cli/ember-cli/lib/utilities/doc-generator.js deleted file mode 100644 index b9cb89f56666..000000000000 --- a/packages/angular-cli/ember-cli/lib/utilities/doc-generator.js +++ /dev/null @@ -1,24 +0,0 @@ -'use strict'; - -var versionUtils = require('./version-utils'); -var emberCLIVersion = versionUtils.emberCLIVersion; -var fs = require('fs'); - -function DocGenerator(options) { - options = options || {}; - this.exec = options.exec || require('child_process').exec; -} - -DocGenerator.prototype.generate = function() { - var command = 'cd docs && ' + fs.realpathSync('./node_modules/.bin/yuidoc') + - ' -q --project-version ' + emberCLIVersion(); // add '-p' flag to produce only JSON and not HTML - - console.log('Executing command: ' + command); - this.exec(command, function(error) { // stdout, stderr - if (error !== null) { - console.log('Error: ' + error); - } - }); -}; - -module.exports = DocGenerator; diff --git a/packages/angular-cli/ember-cli/lib/utilities/find-build-file.js b/packages/angular-cli/ember-cli/lib/utilities/find-build-file.js deleted file mode 100644 index 4ebbc0655654..000000000000 --- a/packages/angular-cli/ember-cli/lib/utilities/find-build-file.js +++ /dev/null @@ -1,28 +0,0 @@ -'use strict'; - -var findUp = require('findup').sync; -var path = require('path'); - -module.exports = function(file) { - var buildFilePath = findUp(file); - - // Note - // In the future this should throw - if (buildFilePath === null) { - return null; - } - - var baseDir = path.dirname(buildFilePath); - - process.chdir(baseDir); - - var buildFile = null; - try { - buildFile = require(buildFilePath); - } catch (err) { - err.message = 'Could not require \'' + file + '\': ' + err.message; - throw err; - } - - return buildFile; -}; diff --git a/packages/angular-cli/ember-cli/lib/utilities/json-generator.js b/packages/angular-cli/ember-cli/lib/utilities/json-generator.js deleted file mode 100644 index 0307d3aaa442..000000000000 --- a/packages/angular-cli/ember-cli/lib/utilities/json-generator.js +++ /dev/null @@ -1,100 +0,0 @@ -'use strict'; - -var lookupCommand = require('../cli/lookup-command'); -var stringUtils = require('ember-cli-string-utils'); -var assign = require('lodash/assign'); -var GenerateCommand = require('../commands/generate'); -var RootCommand = require('./root-command'); -var versionUtils = require('./version-utils'); -var emberCLIVersion = versionUtils.emberCLIVersion; - -function JsonGenerator(options) { - options = options || {}; - - this.ui = options.ui; - this.project = options.project; - this.commands = options.commands; - this.tasks = options.tasks; -} - -JsonGenerator.prototype.generate = function(commandOptions, rawArgs) { - var rootCommand = new RootCommand({ - ui: this.ui, - project: this.project, - commands: this.commands, - tasks: this.tasks - }); - - var json = rootCommand.getJson(commandOptions); - json.version = emberCLIVersion(); - json.commands = []; - json.addons = []; - - if (rawArgs.length === 0) { - Object.keys(this.commands).forEach(function(commandName) { - this._addCommandHelpToJson(commandName, false, commandOptions, json); - }, this); - - if (this.project.eachAddonCommand) { - this.project.eachAddonCommand(function(addonName, commands) { - this.commands = commands; - - var addonJson = { name: addonName }; - addonJson.commands = []; - json.addons.push(addonJson); - - Object.keys(this.commands).forEach(function(commandName) { - this._addCommandHelpToJson(commandName, false, commandOptions, addonJson); - }, this); - }.bind(this)); - } - } else { - // If args were passed to the help command, - // attempt to look up the command for each of them. - - if (this.project.eachAddonCommand) { - this.project.eachAddonCommand(function(addonName, commands) { - assign(this.commands, commands); - }.bind(this)); - } - - var multipleCommands = [GenerateCommand.prototype.name].concat(GenerateCommand.prototype.aliases); - if (multipleCommands.indexOf(rawArgs[0]) > -1) { - var command = rawArgs.shift(); - if (rawArgs.length > 0) { - commandOptions.rawArgs = rawArgs; - } - rawArgs = [command]; - } - - // Iterate through each arg beyond the initial 'help' command, - // and try to display usage instructions. - rawArgs.forEach(function(commandName) { - this._addCommandHelpToJson(commandName, true, commandOptions, json); - }, this); - } - - return json; -}; - - -JsonGenerator.prototype._addCommandHelpToJson = function(commandName, single, options, json) { - var command = this._lookupCommand(commandName); - if ((!command.skipHelp || single) && !command.unknown) { - json.commands.push(command.getJson(options)); - } -}; - -JsonGenerator.prototype._lookupCommand = function(commandName) { - var Command = this.commands[stringUtils.classify(commandName)] || - lookupCommand(this.commands, commandName); - - return new Command({ - ui: this.ui, - project: this.project, - commands: this.commands, - tasks: this.tasks - }); -}; - -module.exports = JsonGenerator; diff --git a/packages/angular-cli/ember-cli/lib/utilities/root-command.js b/packages/angular-cli/ember-cli/lib/utilities/root-command.js deleted file mode 100644 index 785048094c6e..000000000000 --- a/packages/angular-cli/ember-cli/lib/utilities/root-command.js +++ /dev/null @@ -1,12 +0,0 @@ -'use strict'; - -var Command = require('../models/command'); - -module.exports = Command.extend({ - isRoot: true, - name: 'ember', - - anonymousOptions: [ - '' - ] -}); diff --git a/packages/angular-cli/models/webpack-config.ts b/packages/angular-cli/models/webpack-config.ts index d605305bc96c..2b9b65b56c2c 100644 --- a/packages/angular-cli/models/webpack-config.ts +++ b/packages/angular-cli/models/webpack-config.ts @@ -4,13 +4,14 @@ import { } from './webpack-build-typescript'; const webpackMerge = require('webpack-merge'); import { CliConfig } from './config'; +import { getWebpackCommonConfig } from './webpack-build-common'; +import { getWebpackDevConfigPartial } from './webpack-build-development'; +import { getWebpackProdConfigPartial } from './webpack-build-production'; import { - getWebpackCommonConfig, - getWebpackDevConfigPartial, - getWebpackProdConfigPartial, getWebpackMobileConfigPartial, getWebpackMobileProdConfigPartial -} from './'; +} from './webpack-build-mobile'; + export class NgCliWebpackConfig { // TODO: When webpack2 types are finished lets replace all these any types