From 9254cfb26ff330d7473218ffd25525c2c23a1f65 Mon Sep 17 00:00:00 2001 From: Pascal Hartig Date: Sat, 21 Sep 2013 17:04:53 +0100 Subject: [PATCH] style(generators): unify export syntax --- common/index.js | 6 ++---- constant/index.js | 6 ++---- controller/index.js | 6 ++---- directive/index.js | 6 ++---- factory/index.js | 6 ++---- filter/index.js | 6 ++---- main/index.js | 6 ++---- provider/index.js | 6 ++---- route/index.js | 7 +++---- script-base.js | 6 ++---- service/index.js | 6 ++---- value/index.js | 6 ++---- view/index.js | 6 ++---- 13 files changed, 27 insertions(+), 52 deletions(-) diff --git a/common/index.js b/common/index.js index d74910630..ff76074d6 100644 --- a/common/index.js +++ b/common/index.js @@ -4,11 +4,9 @@ var util = require('util'); var yeoman = require('yeoman-generator'); -module.exports = Generator; - -function Generator() { +var Generator = module.exports = function Generator() { yeoman.generators.Base.apply(this, arguments); -} +}; util.inherits(Generator, yeoman.generators.Base); diff --git a/constant/index.js b/constant/index.js index 44abcd031..f7382706e 100644 --- a/constant/index.js +++ b/constant/index.js @@ -5,11 +5,9 @@ var ScriptBase = require('../script-base.js'); var angularUtils = require('../util.js'); -module.exports = Generator; - -function Generator() { +var Generator = module.exports = function Generator() { ScriptBase.apply(this, arguments); -} +}; util.inherits(Generator, ScriptBase); diff --git a/controller/index.js b/controller/index.js index 6a49111d6..e4660de08 100644 --- a/controller/index.js +++ b/controller/index.js @@ -4,9 +4,7 @@ var util = require('util'); var ScriptBase = require('../script-base.js'); -module.exports = Generator; - -function Generator() { +var Generator = module.exports = function Generator() { ScriptBase.apply(this, arguments); // if the controller name is suffixed with ctrl, remove the suffix @@ -14,7 +12,7 @@ function Generator() { if (this.name && this.name.toLowerCase() !== 'ctrl' && this.name.substr(-4).toLowerCase() === 'ctrl') { this.name = this.name.slice(0, -4); } -} +}; util.inherits(Generator, ScriptBase); diff --git a/directive/index.js b/directive/index.js index be5f999b9..068c199d4 100644 --- a/directive/index.js +++ b/directive/index.js @@ -5,11 +5,9 @@ var ScriptBase = require('../script-base.js'); var angularUtils = require('../util.js'); -module.exports = Generator; - -function Generator() { +var Generator = module.exports = function Generator() { ScriptBase.apply(this, arguments); -} +}; util.inherits(Generator, ScriptBase); diff --git a/factory/index.js b/factory/index.js index 959ace579..f3753baab 100644 --- a/factory/index.js +++ b/factory/index.js @@ -5,11 +5,9 @@ var ScriptBase = require('../script-base.js'); var angularUtils = require('../util.js'); -module.exports = Generator; - -function Generator() { +var Generator = module.exports = function Generator() { ScriptBase.apply(this, arguments); -} +}; util.inherits(Generator, ScriptBase); diff --git a/filter/index.js b/filter/index.js index 7b9882a9c..ef9b2e193 100644 --- a/filter/index.js +++ b/filter/index.js @@ -5,11 +5,9 @@ var ScriptBase = require('../script-base.js'); var angularUtils = require('../util.js'); -module.exports = Generator; - -function Generator() { +var Generator = module.exports = function Generator() { ScriptBase.apply(this, arguments); -} +}; util.inherits(Generator, ScriptBase); diff --git a/main/index.js b/main/index.js index cf9dff6b7..1c87ad095 100644 --- a/main/index.js +++ b/main/index.js @@ -5,11 +5,9 @@ var ScriptBase = require('../script-base.js'); var yeoman = require('yeoman-generator'); -module.exports = Generator; - -function Generator() { +var Generator = module.exports = function Generator() { ScriptBase.apply(this, arguments); -} +}; util.inherits(Generator, ScriptBase); diff --git a/provider/index.js b/provider/index.js index 5deb351ed..2893b0055 100644 --- a/provider/index.js +++ b/provider/index.js @@ -5,11 +5,9 @@ var ScriptBase = require('../script-base.js'); var angularUtils = require('../util.js'); -module.exports = Generator; - -function Generator() { +var Generator = module.exports = function Generator() { ScriptBase.apply(this, arguments); -} +}; util.inherits(Generator, ScriptBase); diff --git a/route/index.js b/route/index.js index 55a7cf0b5..5909afe73 100644 --- a/route/index.js +++ b/route/index.js @@ -5,13 +5,12 @@ var ScriptBase = require('../script-base.js'); var angularUtils = require('../util.js'); -module.exports = Generator; - -function Generator() { +var Generator = module.exports = function Generator() { ScriptBase.apply(this, arguments); this.hookFor('angular:controller'); this.hookFor('angular:view'); -} +}; + util.inherits(Generator, ScriptBase); Generator.prototype.rewriteAppJs = function () { diff --git a/script-base.js b/script-base.js index cd090c9ed..9fa92986f 100644 --- a/script-base.js +++ b/script-base.js @@ -4,9 +4,7 @@ var path = require('path'); var yeoman = require('yeoman-generator'); var angularUtils = require('./util.js'); -module.exports = Generator; - -function Generator() { +var Generator = module.exports = function Generator() { yeoman.generators.NamedBase.apply(this, arguments); try { @@ -60,7 +58,7 @@ function Generator() { } this.sourceRoot(path.join(__dirname, sourceRoot)); -} +}; util.inherits(Generator, yeoman.generators.NamedBase); diff --git a/service/index.js b/service/index.js index a539329fb..b803b6b8e 100644 --- a/service/index.js +++ b/service/index.js @@ -5,11 +5,9 @@ var ScriptBase = require('../script-base.js'); var angularUtils = require('../util.js'); -module.exports = Generator; - -function Generator() { +var Generator = module.exports = function Generator() { ScriptBase.apply(this, arguments); -} +}; util.inherits(Generator, ScriptBase); diff --git a/value/index.js b/value/index.js index 4686ab848..7d21b50ea 100644 --- a/value/index.js +++ b/value/index.js @@ -5,11 +5,9 @@ var ScriptBase = require('../script-base.js'); var angularUtils = require('../util.js'); -module.exports = Generator; - -function Generator() { +var Generator = module.exports = function Generator() { ScriptBase.apply(this, arguments); -} +}; util.inherits(Generator, ScriptBase); diff --git a/view/index.js b/view/index.js index 774789738..6de914e8a 100644 --- a/view/index.js +++ b/view/index.js @@ -4,9 +4,7 @@ var util = require('util'); var yeoman = require('yeoman-generator'); -module.exports = Generator; - -function Generator() { +var Generator = module.exports = function Generator() { yeoman.generators.NamedBase.apply(this, arguments); this.sourceRoot(path.join(__dirname, '../templates')); @@ -16,7 +14,7 @@ function Generator() { } catch (e) {} this.env.options.appPath = this.env.options.appPath || 'app'; } -} +}; util.inherits(Generator, yeoman.generators.NamedBase);