From afc5b1dffbd5e02cc4fea1b52c400b5da170adb8 Mon Sep 17 00:00:00 2001 From: Hans Larsen Date: Sun, 28 Aug 2016 12:30:45 -0700 Subject: [PATCH] more fixes --- addon/ng2/commands/{init.js => init.ts} | 29 +++++++++++++----------- addon/ng2/commands/new.ts | 2 +- addon/ng2/index.js | 30 ++++++++++++------------- packages/ast-tools/src/ast-utils.ts | 1 + 4 files changed, 33 insertions(+), 29 deletions(-) rename addon/ng2/commands/{init.js => init.ts} (86%) diff --git a/addon/ng2/commands/init.js b/addon/ng2/commands/init.ts similarity index 86% rename from addon/ng2/commands/init.js rename to addon/ng2/commands/init.ts index 7c7fff8aa460..90db1e955323 100644 --- a/addon/ng2/commands/init.js +++ b/addon/ng2/commands/init.ts @@ -1,15 +1,17 @@ 'use strict'; -var Command = require('ember-cli/lib/models/command'); -var Promise = require('ember-cli/lib/ext/promise'); -var SilentError = require('silent-error'); -var validProjectName = require('ember-cli/lib/utilities/valid-project-name'); -var normalizeBlueprint = require('ember-cli/lib/utilities/normalize-blueprint-option'); -var GitInit = require('../tasks/git-init'); -var LinkCli = require('../tasks/link-cli'); -var NpmInstall = require('../tasks/npm-install'); - -module.exports = Command.extend({ +import LinkCli from '../tasks/link-cli'; + +const Command = require('ember-cli/lib/models/command'); +const Promise = require('ember-cli/lib/ext/promise'); +const SilentError = require('silent-error'); +const validProjectName = require('ember-cli/lib/utilities/valid-project-name'); +const normalizeBlueprint = require('ember-cli/lib/utilities/normalize-blueprint-option'); +const GitInit = require('../tasks/git-init'); +const NpmInstall = require('../tasks/npm-install'); + + +const InitCommand: any = Command.extend({ name: 'init', description: 'Creates a new angular-cli project in the current folder.', aliases: ['i'], @@ -39,7 +41,7 @@ module.exports = Command.extend({ } }, - run: function (commandOptions, rawArgs) { + run: function (commandOptions: any, rawArgs: string[]) { if (commandOptions.dryRun) { commandOptions.skipNpm = true; commandOptions.skipBower = true; @@ -94,7 +96,7 @@ module.exports = Command.extend({ return Promise.reject(new SilentError(message)); } - + var blueprintOpts = { dryRun: commandOptions.dryRun, blueprint: commandOptions.blueprint || this._defaultBlueprint(), @@ -146,4 +148,5 @@ module.exports = Command.extend({ } }); -module.exports.overrideCore = true; +InitCommand.overrideCore = true; +export default InitCommand; diff --git a/addon/ng2/commands/new.ts b/addon/ng2/commands/new.ts index 3b1580b98e54..0c0d518744c7 100644 --- a/addon/ng2/commands/new.ts +++ b/addon/ng2/commands/new.ts @@ -5,7 +5,7 @@ const SilentError = require('silent-error'); const validProjectName = require('ember-cli/lib/utilities/valid-project-name'); const normalizeBlueprint = require('ember-cli/lib/utilities/normalize-blueprint-option'); -const InitCommand = require('./init'); +import InitCommand from './init'; const NewCommand = Command.extend({ name: 'new', diff --git a/addon/ng2/index.js b/addon/ng2/index.js index 7ffc78e4a482..6fef4abd623a 100644 --- a/addon/ng2/index.js +++ b/addon/ng2/index.js @@ -12,25 +12,25 @@ module.exports = { includedCommands: function () { return { - 'build': require('./commands/build'), - 'serve': require('./commands/serve'), - 'new': require('./commands/new'), - 'generate': require('./commands/generate'), - 'init': require('./commands/init'), - 'test': require('./commands/test'), - 'e2e': require('./commands/e2e'), - 'lint': require('./commands/lint'), - 'version': require('./commands/version'), - 'completion': require('./commands/completion'), - 'doc': require('./commands/doc'), - 'github-pages-deploy': require('./commands/github-pages-deploy'), + 'build': require('./commands/build').default, + 'serve': require('./commands/serve').default, + 'new': require('./commands/new').default, + 'generate': require('./commands/generate').default, + 'init': require('./commands/init').default, + 'test': require('./commands/test').default, + 'e2e': require('./commands/e2e').default, + 'lint': require('./commands/lint').default, + 'version': require('./commands/version').default, + 'completion': require('./commands/completion').default, + 'doc': require('./commands/doc').default, + 'github-pages-deploy': require('./commands/github-pages-deploy').default, // Easter eggs. - 'make-this-awesome': require('./commands/easter-egg')('make-this-awesome'), + 'make-this-awesome': require('./commands/easter-egg').default, // Configuration. - 'set': require('./commands/set'), - 'get': require('./commands/get') + 'set': require('./commands/set').default, + 'get': require('./commands/get').default, }; } }; diff --git a/packages/ast-tools/src/ast-utils.ts b/packages/ast-tools/src/ast-utils.ts index c95ec2dae6cc..0ffe4c6d8580 100644 --- a/packages/ast-tools/src/ast-utils.ts +++ b/packages/ast-tools/src/ast-utils.ts @@ -204,6 +204,7 @@ function _addSymbolToNgModuleMetadata(ngModulePath: string, metadataField: strin }) .then((node: ts.Node) => { if (!node) { + /* eslint-disable no-console */ console.log('No app module found. Please add your new class to your component.'); return new NoopChange(); }