From 9513589c020067481df571322cc1f5303c875f37 Mon Sep 17 00:00:00 2001
From: Andrew Koroluk
Date: Tue, 1 Sep 2015 12:02:15 -0400
Subject: [PATCH 0001/1129] refactor(server:auth): use import syntax
---
app/templates/server/auth(auth)/auth.service.js | 14 +++++++-------
.../auth(auth)/facebook(facebookAuth)/index.js | 6 +++---
.../auth(auth)/facebook(facebookAuth)/passport.js | 4 ++--
.../server/auth(auth)/google(googleAuth)/index.js | 6 +++---
.../auth(auth)/google(googleAuth)/passport.js | 4 ++--
app/templates/server/auth(auth)/index.js | 10 +++++-----
app/templates/server/auth(auth)/local/index.js | 6 +++---
app/templates/server/auth(auth)/local/passport.js | 4 ++--
.../auth(auth)/twitter(twitterAuth)/index.js | 6 +++---
.../auth(auth)/twitter(twitterAuth)/passport.js | 6 +++---
10 files changed, 33 insertions(+), 33 deletions(-)
diff --git a/app/templates/server/auth(auth)/auth.service.js b/app/templates/server/auth(auth)/auth.service.js
index 6cd885313..edd16506a 100644
--- a/app/templates/server/auth(auth)/auth.service.js
+++ b/app/templates/server/auth(auth)/auth.service.js
@@ -1,12 +1,12 @@
'use strict';
-var passport = require('passport');
-var config = require('../config/environment');
-var jwt = require('jsonwebtoken');
-var expressJwt = require('express-jwt');
-var compose = require('composable-middleware');<% if (filters.mongooseModels) { %>
-var User = require('../api/user/user.model');<% } %><% if (filters.sequelizeModels) { %>
-var User = require('../sqldb').User;<% } %>
+import passport from 'passport';
+import config from '../config/environment';
+import jwt from 'jsonwebtoken';
+import expressJwt from 'express-jwt';
+import compose from 'composable-middleware';<% if (filters.mongooseModels) { %>
+import User from '../api/user/user.model';<% } %><% if (filters.sequelizeModels) { %>
+import {User} from'../sqldb';<% } %>
var validateJwt = expressJwt({
secret: config.secrets.session
});
diff --git a/app/templates/server/auth(auth)/facebook(facebookAuth)/index.js b/app/templates/server/auth(auth)/facebook(facebookAuth)/index.js
index f13d463e1..3605cba5b 100644
--- a/app/templates/server/auth(auth)/facebook(facebookAuth)/index.js
+++ b/app/templates/server/auth(auth)/facebook(facebookAuth)/index.js
@@ -1,8 +1,8 @@
'use strict';
-var express = require('express');
-var passport = require('passport');
-var auth = require('../auth.service');
+import express from 'express';
+import passport from 'passport';
+import auth from '../auth.service';
var router = express.Router();
diff --git a/app/templates/server/auth(auth)/facebook(facebookAuth)/passport.js b/app/templates/server/auth(auth)/facebook(facebookAuth)/passport.js
index 00b87a226..341e46535 100644
--- a/app/templates/server/auth(auth)/facebook(facebookAuth)/passport.js
+++ b/app/templates/server/auth(auth)/facebook(facebookAuth)/passport.js
@@ -1,5 +1,5 @@
-var passport = require('passport');
-var FacebookStrategy = require('passport-facebook').Strategy;
+import passport from 'passport';
+import {Strategy as FacebookStrategy} from 'passport-facebook';
exports.setup = function(User, config) {
passport.use(new FacebookStrategy({
diff --git a/app/templates/server/auth(auth)/google(googleAuth)/index.js b/app/templates/server/auth(auth)/google(googleAuth)/index.js
index 7789def92..906493e7d 100644
--- a/app/templates/server/auth(auth)/google(googleAuth)/index.js
+++ b/app/templates/server/auth(auth)/google(googleAuth)/index.js
@@ -1,8 +1,8 @@
'use strict';
-var express = require('express');
-var passport = require('passport');
-var auth = require('../auth.service');
+import express from 'express';
+import passport from 'passport';
+import auth from '../auth.service';
var router = express.Router();
diff --git a/app/templates/server/auth(auth)/google(googleAuth)/passport.js b/app/templates/server/auth(auth)/google(googleAuth)/passport.js
index f74594c12..97abc3fdf 100644
--- a/app/templates/server/auth(auth)/google(googleAuth)/passport.js
+++ b/app/templates/server/auth(auth)/google(googleAuth)/passport.js
@@ -1,5 +1,5 @@
-var passport = require('passport');
-var GoogleStrategy = require('passport-google-oauth').OAuth2Strategy;
+import passport from 'passport';
+import {OAuth2Strategy as GoogleStrategy} from 'passport-google-oauth';
exports.setup = function(User, config) {
passport.use(new GoogleStrategy({
diff --git a/app/templates/server/auth(auth)/index.js b/app/templates/server/auth(auth)/index.js
index 75ddfdcb8..513a403b1 100644
--- a/app/templates/server/auth(auth)/index.js
+++ b/app/templates/server/auth(auth)/index.js
@@ -1,10 +1,10 @@
'use strict';
-var express = require('express');
-var passport = require('passport');
-var config = require('../config/environment');<% if (filters.mongooseModels) { %>
-var User = require('../api/user/user.model');<% } %><% if (filters.sequelizeModels) { %>
-var User = require('../sqldb').User;<% } %>
+import express from 'express';
+import passport from 'passport';
+import config from '../config/environment';<% if (filters.mongooseModels) { %>
+import User from '../api/user/user.model';<% } %><% if (filters.sequelizeModels) { %>
+import {User} from '../sqldb';<% } %>
// Passport Configuration
require('./local/passport').setup(User, config);<% if (filters.facebookAuth) { %>
diff --git a/app/templates/server/auth(auth)/local/index.js b/app/templates/server/auth(auth)/local/index.js
index e94d0da1a..62ccc4204 100644
--- a/app/templates/server/auth(auth)/local/index.js
+++ b/app/templates/server/auth(auth)/local/index.js
@@ -1,8 +1,8 @@
'use strict';
-var express = require('express');
-var passport = require('passport');
-var auth = require('../auth.service');
+import express from 'express';
+import passport from 'passport';
+import auth from '../auth.service';
var router = express.Router();
diff --git a/app/templates/server/auth(auth)/local/passport.js b/app/templates/server/auth(auth)/local/passport.js
index 2bd3366f8..df12bf45a 100644
--- a/app/templates/server/auth(auth)/local/passport.js
+++ b/app/templates/server/auth(auth)/local/passport.js
@@ -1,5 +1,5 @@
-var passport = require('passport');
-var LocalStrategy = require('passport-local').Strategy;
+import passport from 'passport';
+import {Strategy as LocalStrategy} from 'passport-local';
function localAuthenticate(User, email, password, done) {
<% if (filters.mongooseModels) { %>User.findOneAsync({
diff --git a/app/templates/server/auth(auth)/twitter(twitterAuth)/index.js b/app/templates/server/auth(auth)/twitter(twitterAuth)/index.js
index 8e6f32b5d..1810eadc1 100644
--- a/app/templates/server/auth(auth)/twitter(twitterAuth)/index.js
+++ b/app/templates/server/auth(auth)/twitter(twitterAuth)/index.js
@@ -1,8 +1,8 @@
'use strict';
-var express = require('express');
-var passport = require('passport');
-var auth = require('../auth.service');
+import express from 'express';
+import passport from 'passport';
+import auth from '../auth.service';
var router = express.Router();
diff --git a/app/templates/server/auth(auth)/twitter(twitterAuth)/passport.js b/app/templates/server/auth(auth)/twitter(twitterAuth)/passport.js
index bf23bd3ba..8c7f341be 100644
--- a/app/templates/server/auth(auth)/twitter(twitterAuth)/passport.js
+++ b/app/templates/server/auth(auth)/twitter(twitterAuth)/passport.js
@@ -1,7 +1,7 @@
-exports.setup = function(User, config) {
- var passport = require('passport');
- var TwitterStrategy = require('passport-twitter').Strategy;
+import passport from 'passport';
+import {Strategy as TwitterStrategy} from 'passport-twitter';
+exports.setup = function(User, config) {
passport.use(new TwitterStrategy({
consumerKey: config.twitter.clientID,
consumerSecret: config.twitter.clientSecret,
From 8e0ab2d88aff9c2ccbc8c461db54bb059882d1cd Mon Sep 17 00:00:00 2001
From: Andrew Koroluk
Date: Tue, 1 Sep 2015 12:13:51 -0400
Subject: [PATCH 0002/1129] refactor(server:config): use import syntax
---
app/templates/server/config/express.js | 36 ++++++++++---------
app/templates/server/config/seed(models).js | 16 ++++-----
.../server/config/socketio(socketio).js | 2 +-
3 files changed, 27 insertions(+), 27 deletions(-)
diff --git a/app/templates/server/config/express.js b/app/templates/server/config/express.js
index de7505759..e8748499b 100644
--- a/app/templates/server/config/express.js
+++ b/app/templates/server/config/express.js
@@ -4,23 +4,25 @@
'use strict';
-var express = require('express');
-var favicon = require('serve-favicon');
-var morgan = require('morgan');
-var compression = require('compression');
-var bodyParser = require('body-parser');
-var methodOverride = require('method-override');
-var cookieParser = require('cookie-parser');
-var errorHandler = require('errorhandler');
-var path = require('path');
-var lusca = require('lusca');
-var config = require('./environment');<% if (filters.auth) { %>
-var passport = require('passport');<% } %>
-var session = require('express-session');<% if (filters.mongoose) { %>
-var mongoStore = require('connect-mongo')(session);
-var mongoose = require('mongoose');<% } else if(filters.sequelize) { %>
-var sqldb = require('../sqldb');
-var Store = require('express-sequelize-session')(session.Store);<% } %>
+import express from 'express';
+import favicon from 'serve-favicon';
+import morgan from 'morgan';
+import compression from 'compression';
+import bodyParser from 'body-parser';
+import methodOverride from 'method-override';
+import cookieParser from 'cookie-parser';
+import errorHandler from 'errorhandler';
+import path from 'path';
+import lusca from 'lusca';
+import config from './environment';<% if (filters.auth) { %>
+import passport from 'passport';<% } %>
+import session from 'express-session';<% if (filters.mongoose) { %>
+import connectMongo from 'connect-mongo';
+import mongoose from 'mongoose';
+var mongoStore = connectMongo(session);<% } else if(filters.sequelize) { %>
+import sqldb from '../sqldb';
+import expressSequelizeSession from 'express-sequelize-session';
+var Store = expressSequelizeSession(session.Store);<% } %>
module.exports = function(app) {
var env = app.get('env');
diff --git a/app/templates/server/config/seed(models).js b/app/templates/server/config/seed(models).js
index 374278125..a0e5edb76 100644
--- a/app/templates/server/config/seed(models).js
+++ b/app/templates/server/config/seed(models).js
@@ -3,15 +3,13 @@
* to disable, edit config/environment/index.js, and set `seedDB: false`
*/
-'use strict';
-<% if (filters.mongooseModels) { %>
-var Thing = require('../api/thing/thing.model');
-<% if (filters.auth) { %>var User = require('../api/user/user.model');<% } %>
-<% } %><% if (filters.sequelizeModels) { %>
-var sqldb = require('../sqldb');
-var Thing = sqldb.Thing;
-<% if (filters.auth) { %>var User = sqldb.User;<% } %>
-<% } %>
+'use strict';<% if (filters.mongooseModels) { %>
+import Thing from '../api/thing/thing.model';<% if (filters.auth) { %>
+import User from '../api/user/user.model';<% } %><% } %><% if (filters.sequelizeModels) { %>
+import sqldb from '../sqldb';
+var Thing = sqldb.Thing;<% if (filters.auth) { %>
+var User = sqldb.User;<% } %><% } %>
+
<% if (filters.mongooseModels) { %>Thing.find({}).removeAsync()<% }
if (filters.sequelizeModels) { %>Thing.sync()
.then(function() {
diff --git a/app/templates/server/config/socketio(socketio).js b/app/templates/server/config/socketio(socketio).js
index dbd117851..0035b55fe 100644
--- a/app/templates/server/config/socketio(socketio).js
+++ b/app/templates/server/config/socketio(socketio).js
@@ -4,7 +4,7 @@
'use strict';
-var config = require('./environment');
+import config from './environment';
// When the user disconnects.. perform this
function onDisconnect(socket) {
From 9fd53137d62c956c7626e7f0a2d263beb6af4879 Mon Sep 17 00:00:00 2001
From: Andrew Koroluk
Date: Tue, 1 Sep 2015 12:14:20 -0400
Subject: [PATCH 0003/1129] refactor(server:sqldb): use import syntax
---
app/templates/server/sqldb(sequelize)/index.js | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/app/templates/server/sqldb(sequelize)/index.js b/app/templates/server/sqldb(sequelize)/index.js
index 2500a2213..c79688a0e 100644
--- a/app/templates/server/sqldb(sequelize)/index.js
+++ b/app/templates/server/sqldb(sequelize)/index.js
@@ -4,10 +4,9 @@
'use strict';
-var path = require('path');
-var config = require('../config/environment');
-
-var Sequelize = require('sequelize');
+import path from 'path';
+import config from '../config/environment';
+import Sequelize from 'sequelize';
var db = {
Sequelize: Sequelize,
From b81292f0e9c4a9fcd96eaef5fc55283a6ccaa180 Mon Sep 17 00:00:00 2001
From: kingcody
Date: Wed, 2 Sep 2015 06:10:08 -0400
Subject: [PATCH 0004/1129] refactor(gen): improve `generator-base` and `util`
wiring
---
app/generator.js | 19 ++++-------------
endpoint/generator.js | 19 ++++++++++-------
generator-base.js | 49 +++++++++++++++++++++++++++++++++++++++++++
script-base.js | 45 ---------------------------------------
util.js | 8 ++++---
5 files changed, 70 insertions(+), 70 deletions(-)
create mode 100644 generator-base.js
delete mode 100644 script-base.js
diff --git a/app/generator.js b/app/generator.js
index 7751af8fe..591984d98 100644
--- a/app/generator.js
+++ b/app/generator.js
@@ -4,7 +4,7 @@ import fs from 'fs';
import path from 'path';
import chalk from 'chalk';
import {Base} from 'yeoman-generator';
-import * as genUtils from '../util';
+import {genBase} from '../generator-base';
export default class Generator extends Base {
@@ -25,22 +25,11 @@ export default class Generator extends Base {
return {
init: function () {
- this.appname = this.name || path.basename(process.cwd());
- this.appname = this._.camelize(this._.slugify(this._.humanize(this.appname)));
-
- this.scriptAppName = this.appname + genUtils.appSuffix(this);
- this.appPath = this.env.options.appPath;
this.pkg = require('../package.json');
-
this.filters = {};
- // dynamic assertion statements
- this.expect = function() {
- return this.filters.expect ? 'expect(' : '';
- }.bind(this);
- this.to = function() {
- return this.filters.expect ? ').to' : '.should';
- }.bind(this);
+ // init shared generator properies and methods
+ genBase(this);
},
info: function () {
@@ -394,7 +383,7 @@ export default class Generator extends Base {
generateProject: function() {
this.sourceRoot(path.join(__dirname, './templates'));
- genUtils.processDirectory(this, '.', '.');
+ this.processDirectory('.', '.');
},
generateEndpoint: function() {
diff --git a/endpoint/generator.js b/endpoint/generator.js
index 0d6d3217d..169dec3d8 100644
--- a/endpoint/generator.js
+++ b/endpoint/generator.js
@@ -1,10 +1,10 @@
'use strict';
import path from 'path';
-import ScriptBase from '../script-base';
-import * as genUtils from '../util';
+import {NamedBase} from 'yeoman-generator';
+import {genNamedBase} from '../generator-base';
-export default class Generator extends ScriptBase {
+export default class Generator extends NamedBase {
constructor(...args) {
super(...args);
@@ -25,6 +25,11 @@ export default class Generator extends ScriptBase {
});
}
+ initializing() {
+ // init shared generator properies and methods
+ genNamedBase(this);
+ }
+
prompting() {
var done = this.async();
var promptCb = function (props) {
@@ -103,7 +108,7 @@ export default class Generator extends ScriptBase {
writing() {
this.sourceRoot(path.join(__dirname, './templates'));
- genUtils.processDirectory(this, '.', this.routeDest);
+ this.processDirectory('.', this.routeDest);
}
end() {
@@ -117,7 +122,7 @@ export default class Generator extends ScriptBase {
"app.use(\'" + this.route +"\', require(\'" + reqPath + "\'));"
]
};
- genUtils.rewriteFile(routeConfig);
+ this.rewriteFile(routeConfig);
}
if (this.filters.socketio && this.config.get('insertSockets')) {
@@ -131,7 +136,7 @@ export default class Generator extends ScriptBase {
"require(\'" + reqPath + "\').register(socket);"
]
};
- genUtils.rewriteFile(socketConfig);
+ this.rewriteFile(socketConfig);
}
if (this.filters.sequelize && this.config.get('insertModels')) {
@@ -145,7 +150,7 @@ export default class Generator extends ScriptBase {
"db." + this.classedName + " = db.sequelize.import(\'" + reqPath +"\');"
]
};
- genUtils.rewriteFile(modelConfig);
+ this.rewriteFile(modelConfig);
}
}
}
diff --git a/generator-base.js b/generator-base.js
new file mode 100644
index 000000000..fbe4be437
--- /dev/null
+++ b/generator-base.js
@@ -0,0 +1,49 @@
+'use strict';
+
+import util from 'util';
+import path from 'path';
+import * as genUtils from './util';
+
+export function genBase(self) {
+ self = self || this;
+
+ try {
+ self.appname = require(path.join(process.cwd(), 'bower.json')).name;
+ } catch (e) {
+ self.appname = self.name || path.basename(process.cwd());
+ }
+ self.appname = self._.camelize(self._.slugify(self._.humanize(self.appname)));
+ self.scriptAppName = self.appname + genUtils.appSuffix(self);
+
+ self.filters = self.filters || self.config.get('filters');
+
+ // dynamic assertion statements
+ self.expect = function() {
+ return self.filters.expect ? 'expect(' : '';
+ };
+ self.to = function() {
+ return self.filters.expect ? ').to' : '.should';
+ };
+
+ // dynamic relative require path
+ self.relativeRequire = genUtils.relativeRequire.bind(self);
+ // process template directory
+ self.processDirectory = genUtils.processDirectory.bind(self);
+ // rewrite a file in place
+ self.rewriteFile = genUtils.rewriteFile;
+}
+
+export function genNamedBase(self) {
+ self = self || this;
+
+ // extend genBase
+ genBase(self);
+
+ var name = self.name.replace(/\//g, '-');
+
+ self.cameledName = self._.camelize(name);
+ self.classedName = self._.classify(name);
+
+ self.basename = path.basename(self.name);
+ self.dirname = (self.name.indexOf('/') >= 0) ? path.dirname(self.name) : self.name;
+}
diff --git a/script-base.js b/script-base.js
deleted file mode 100644
index 0c9fc299e..000000000
--- a/script-base.js
+++ /dev/null
@@ -1,45 +0,0 @@
-'use strict';
-
-import util from 'util';
-import path from 'path';
-import {NamedBase} from 'yeoman-generator';
-import * as genUtils from './util';
-
-export default class ScriptBase extends NamedBase {
- constructor(...args) {
- super(...args);
-
- try {
- this.appname = require(path.join(process.cwd(), 'bower.json')).name;
- } catch (e) {
- this.appname = path.basename(process.cwd());
- }
- this.appname = this._.slugify(this._.humanize(this.appname));
- this.scriptAppName = this._.camelize(this.appname) + genUtils.appSuffix(this);
-
- var name = this.name.replace(/\//g, '-');
-
- this.cameledName = this._.camelize(name);
- this.classedName = this._.classify(name);
-
- this.basename = path.basename(this.name);
- this.dirname = (this.name.indexOf('/') >= 0) ? path.dirname(this.name) : this.name;
-
- // dynamic assertion statements
- this.expect = function() {
- return this.filters.expect ? 'expect(' : '';
- }.bind(this);
- this.to = function() {
- return this.filters.expect ? ').to' : '.should';
- }.bind(this);
-
- // dynamic relative require path
- this.relativeRequire = function(to, fr) {
- fr = fr || this.filePath;
- return genUtils.relativeRequire(this, to, fr);
- }.bind(this);
-
- this.filters = this.config.get('filters');
- this.sourceRoot(path.join(__dirname, '/templates'));
- }
-}
diff --git a/util.js b/util.js
index 64cf5c647..d23e7f693 100644
--- a/util.js
+++ b/util.js
@@ -68,8 +68,9 @@ function destinationPath(self, filepath) {
return filepath;
}
-export function relativeRequire(self, to, fr) {
- fr = destinationPath(self, fr);
+export function relativeRequire(to, fr) {
+ var self = this;
+ fr = destinationPath(self, fr || self.filePath);
to = destinationPath(self, to);
return path.relative(path.dirname(fr), to)
.replace(/\\/g, '/') // convert win32 separator to posix
@@ -105,7 +106,8 @@ function templateIsUsable(self, filteredFile) {
return true;
}
-export function processDirectory(self, source, destination) {
+export function processDirectory(source, destination) {
+ var self = this;
var root = self.isPathAbsolute(source) ? source : path.join(self.sourceRoot(), source);
var files = self.expandFiles('**', { dot: true, cwd: root });
var dest, src;
From 8d504e87b749b88551ad34f23abdba96c77ffd94 Mon Sep 17 00:00:00 2001
From: Andrew Koroluk
Date: Tue, 1 Sep 2015 12:43:02 -0400
Subject: [PATCH 0005/1129] refactor(api:users): use import syntax
---
app/templates/server/api/user(auth)/index.js | 6 +++---
.../server/api/user(auth)/user.controller.js | 11 +++++------
app/templates/server/api/user(auth)/user.events.js | 6 +++---
.../server/api/user(auth)/user.integration.js | 8 ++++----
.../api/user(auth)/user.model(mongooseModels).js | 4 ++--
.../api/user(auth)/user.model(sequelizeModels).js | 2 +-
.../api/user(auth)/user.model.spec(mongooseModels).js | 4 ++--
.../user(auth)/user.model.spec(sequelizeModels).js | 4 ++--
8 files changed, 22 insertions(+), 23 deletions(-)
diff --git a/app/templates/server/api/user(auth)/index.js b/app/templates/server/api/user(auth)/index.js
index be6fd3af3..f887500de 100644
--- a/app/templates/server/api/user(auth)/index.js
+++ b/app/templates/server/api/user(auth)/index.js
@@ -1,8 +1,8 @@
'use strict';
-var express = require('express');
-var controller = require('./user.controller');
-var auth = require('../../auth/auth.service');
+import express from 'express';
+import controller from './user.controller';
+import auth from '../../auth/auth.service';
var router = express.Router();
diff --git a/app/templates/server/api/user(auth)/user.controller.js b/app/templates/server/api/user(auth)/user.controller.js
index 059216b4c..ad30b5b3b 100644
--- a/app/templates/server/api/user(auth)/user.controller.js
+++ b/app/templates/server/api/user(auth)/user.controller.js
@@ -1,11 +1,10 @@
'use strict';
<% if (filters.mongooseModels) { %>
-var User = require('./user.model');<% } %><% if (filters.sequelizeModels) { %>
-var sqldb = require('../../sqldb');
-var User = sqldb.User;<% } %>
-var passport = require('passport');
-var config = require('../../config/environment');
-var jwt = require('jsonwebtoken');
+import User from './user.model';<% } %><% if (filters.sequelizeModels) { %>
+import {User} from '../../sqldb';<% } %>
+import passport from 'passport';
+import config from '../../config/environment';
+import jwt from 'jsonwebtoken';
function validationError(res, statusCode) {
statusCode = statusCode || 422;
diff --git a/app/templates/server/api/user(auth)/user.events.js b/app/templates/server/api/user(auth)/user.events.js
index 102fd5d55..42137933d 100644
--- a/app/templates/server/api/user(auth)/user.events.js
+++ b/app/templates/server/api/user(auth)/user.events.js
@@ -4,9 +4,9 @@
'use strict';
-var EventEmitter = require('events').EventEmitter;<% if (filters.mongooseModels) { %>
-var User = require('./user.model');<% } if (filters.sequelizeModels) { %>
-var User = require('../../sqldb').User;<% } %>
+import {EventEmitter} from 'events';<% if (filters.mongooseModels) { %>
+import User from './user.model';<% } if (filters.sequelizeModels) { %>
+import {User} from '../../sqldb';<% } %>
var UserEvents = new EventEmitter();
// Set max event listeners (0 == unlimited)
diff --git a/app/templates/server/api/user(auth)/user.integration.js b/app/templates/server/api/user(auth)/user.integration.js
index 0abae3b89..5c7c652b3 100644
--- a/app/templates/server/api/user(auth)/user.integration.js
+++ b/app/templates/server/api/user(auth)/user.integration.js
@@ -1,9 +1,9 @@
'use strict';
-var app = require('../..');<% if (filters.mongooseModels) { %>
-var User = require('./user.model');<% } %><% if (filters.sequelizeModels) { %>
-var User = require('../../sqldb').User;<% } %>
-var request = require('supertest');
+import app from '../..';<% if (filters.mongooseModels) { %>
+import User from './user.model';<% } %><% if (filters.sequelizeModels) { %>
+import {User} from '../../sqldb';<% } %>
+import request from 'supertest';
describe('User API:', function() {
var user;
diff --git a/app/templates/server/api/user(auth)/user.model(mongooseModels).js b/app/templates/server/api/user(auth)/user.model(mongooseModels).js
index f8fa923cf..e97da090f 100644
--- a/app/templates/server/api/user(auth)/user.model(mongooseModels).js
+++ b/app/templates/server/api/user(auth)/user.model(mongooseModels).js
@@ -1,8 +1,8 @@
'use strict';
+import crypto from 'crypto';
var mongoose = require('bluebird').promisifyAll(require('mongoose'));
-var Schema = mongoose.Schema;
-var crypto = require('crypto');<% if (filters.oauth) { %>
+var Schema = mongoose.Schema;<% if (filters.oauth) { %>
var authTypes = ['github', 'twitter', 'facebook', 'google'];<% } %>
var UserSchema = new Schema({
diff --git a/app/templates/server/api/user(auth)/user.model(sequelizeModels).js b/app/templates/server/api/user(auth)/user.model(sequelizeModels).js
index 776eafc3e..500f6b81f 100644
--- a/app/templates/server/api/user(auth)/user.model(sequelizeModels).js
+++ b/app/templates/server/api/user(auth)/user.model(sequelizeModels).js
@@ -1,6 +1,6 @@
'use strict';
-var crypto = require('crypto');<% if (filters.oauth) { %>
+import crypto from 'crypto';<% if (filters.oauth) { %>
var authTypes = ['github', 'twitter', 'facebook', 'google'];<% } %>
var validatePresenceOf = function(value) {
diff --git a/app/templates/server/api/user(auth)/user.model.spec(mongooseModels).js b/app/templates/server/api/user(auth)/user.model.spec(mongooseModels).js
index 478fd74d8..4cff951fd 100644
--- a/app/templates/server/api/user(auth)/user.model.spec(mongooseModels).js
+++ b/app/templates/server/api/user(auth)/user.model.spec(mongooseModels).js
@@ -1,7 +1,7 @@
'use strict';
-var app = require('../..');
-var User = require('./user.model');
+import app from '../..';
+import User from './user.model';
var user;
var genUser = function() {
user = new User({
diff --git a/app/templates/server/api/user(auth)/user.model.spec(sequelizeModels).js b/app/templates/server/api/user(auth)/user.model.spec(sequelizeModels).js
index d231514be..ec4196a03 100644
--- a/app/templates/server/api/user(auth)/user.model.spec(sequelizeModels).js
+++ b/app/templates/server/api/user(auth)/user.model.spec(sequelizeModels).js
@@ -1,7 +1,7 @@
'use strict';
-var app = require('../..');
-var User = require('../../sqldb').User;
+import app from '../..';
+import {User} from '../../sqldb';
var user;
var genUser = function() {
user = User.build({
From ab20456e899454e1d8b4d60fe058ca5a20765c1f Mon Sep 17 00:00:00 2001
From: Andrew Koroluk
Date: Tue, 1 Sep 2015 12:43:26 -0400
Subject: [PATCH 0006/1129] refactor(server): use import syntax on app.js and
routes.js
---
app/templates/server/app.js | 11 ++++++-----
app/templates/server/routes.js | 4 ++--
2 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/app/templates/server/app.js b/app/templates/server/app.js
index ca1e4ca78..1b28cdb11 100644
--- a/app/templates/server/app.js
+++ b/app/templates/server/app.js
@@ -7,10 +7,11 @@
// Set default node environment to development
process.env.NODE_ENV = process.env.NODE_ENV || 'development';
-var express = require('express');<% if (filters.mongoose) { %>
-var mongoose = require('mongoose');<% } %><% if (filters.sequelize) { %>
-var sqldb = require('./sqldb');<% } %>
-var config = require('./config/environment');
+import express from 'express';<% if (filters.mongoose) { %>
+import mongoose from 'mongoose';<% } %><% if (filters.sequelize) { %>
+import sqldb from './sqldb';<% } %>
+import config from './config/environment';
+import http from 'http';
<% if (filters.mongoose) { %>
// Connect to MongoDB
mongoose.connect(config.mongo.uri, config.mongo.options);
@@ -24,7 +25,7 @@ if (config.seedDB) { require('./config/seed'); }
<% } %>
// Setup server
var app = express();
-var server = require('http').createServer(app);<% if (filters.socketio) { %>
+var server = http.createServer(app);<% if (filters.socketio) { %>
var socketio = require('socket.io')(server, {
serveClient: config.env !== 'production',
path: '/socket.io-client'
diff --git a/app/templates/server/routes.js b/app/templates/server/routes.js
index 23e902765..977829165 100644
--- a/app/templates/server/routes.js
+++ b/app/templates/server/routes.js
@@ -4,8 +4,8 @@
'use strict';
-var errors = require('./components/errors');
-var path = require('path');
+import errors from './components/errors';
+import path from 'path';
module.exports = function(app) {
From c39078bdcd89f6b1938cb16aa200c9485a02979c Mon Sep 17 00:00:00 2001
From: Andrew Koroluk
Date: Wed, 2 Sep 2015 13:39:55 -0400
Subject: [PATCH 0007/1129] chore(npm): update author and add contributors
---
package.json | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/package.json b/package.json
index e88584a8b..f8b1ff312 100644
--- a/package.json
+++ b/package.json
@@ -17,7 +17,15 @@
],
"homepage": "https://github.com/DaftMonk/generator-angular-fullstack",
"bugs": "https://github.com/DaftMonk/generator-angular-fullstack/issues",
- "author": "Tyler Henkel",
+ "author": "Tyler Henkel (http://tylerhenkel.com/)",
+ "contributors": [
+ "Andrew Koroluk (http://andrewk.me/)",
+ "Cody Mize (http://codymize.com/)",
+ "Brian Ford (http://briantford.com/)",
+ "Pascal Hartig (http://passy.me/)",
+ "Eddie Monge (http://eddiemonge.com)",
+ "Sindre Sorhus (https://twitter.com/sindresorhus)"
+ ],
"repository": {
"type": "git",
"url": "git://github.com/DaftMonk/generator-angular-fullstack.git"
From b9de25d75f547d60545a94c16bf838ce54d58d18 Mon Sep 17 00:00:00 2001
From: kingcody
Date: Wed, 2 Sep 2015 15:39:15 -0400
Subject: [PATCH 0008/1129] chore(gen): remove deprecated generators
---
generators/constant/index.js | 14 --------------
generators/deploy/index.js | 15 ---------------
generators/readme.md | 1 -
generators/value/index.js | 14 --------------
generators/view/index.js | 14 --------------
5 files changed, 58 deletions(-)
delete mode 100644 generators/constant/index.js
delete mode 100644 generators/deploy/index.js
delete mode 100644 generators/readme.md
delete mode 100644 generators/value/index.js
delete mode 100644 generators/view/index.js
diff --git a/generators/constant/index.js b/generators/constant/index.js
deleted file mode 100644
index 4524a8eed..000000000
--- a/generators/constant/index.js
+++ /dev/null
@@ -1,14 +0,0 @@
-'use strict';
-var chalk = require('chalk');
-var yeoman = require('yeoman-generator');
-var util = require('util');
-
-var Generator = module.exports = function Generator() {
- yeoman.generators.Base.apply(this, arguments);
-};
-
-util.inherits(Generator, yeoman.generators.Base);
-
-Generator.prototype.deprecated = function deprecated() {
- this.log(chalk.yellow('This sub-generator is deprecated. \n'));
-};
diff --git a/generators/deploy/index.js b/generators/deploy/index.js
deleted file mode 100644
index 7fb3452fa..000000000
--- a/generators/deploy/index.js
+++ /dev/null
@@ -1,15 +0,0 @@
-'use strict';
-var chalk = require('chalk');
-var yeoman = require('yeoman-generator');
-var util = require('util');
-
-var Generator = module.exports = function Generator() {
- yeoman.generators.Base.apply(this, arguments);
-};
-
-util.inherits(Generator, yeoman.generators.NamedBase);
-
-Generator.prototype.deprecated = function deprecated() {
- this.log(chalk.yellow(chalk.bold('yo angular-fullstack:deploy') + ' is deprecated, instead use: \n') +
- chalk.green('yo angular-fullstack:heroku') + ' or ' + chalk.green('yo angular-fullstack:openshift'));
-};
diff --git a/generators/readme.md b/generators/readme.md
deleted file mode 100644
index d56c72138..000000000
--- a/generators/readme.md
+++ /dev/null
@@ -1 +0,0 @@
-This folder is for deprecated generators only.
diff --git a/generators/value/index.js b/generators/value/index.js
deleted file mode 100644
index 4524a8eed..000000000
--- a/generators/value/index.js
+++ /dev/null
@@ -1,14 +0,0 @@
-'use strict';
-var chalk = require('chalk');
-var yeoman = require('yeoman-generator');
-var util = require('util');
-
-var Generator = module.exports = function Generator() {
- yeoman.generators.Base.apply(this, arguments);
-};
-
-util.inherits(Generator, yeoman.generators.Base);
-
-Generator.prototype.deprecated = function deprecated() {
- this.log(chalk.yellow('This sub-generator is deprecated. \n'));
-};
diff --git a/generators/view/index.js b/generators/view/index.js
deleted file mode 100644
index 4524a8eed..000000000
--- a/generators/view/index.js
+++ /dev/null
@@ -1,14 +0,0 @@
-'use strict';
-var chalk = require('chalk');
-var yeoman = require('yeoman-generator');
-var util = require('util');
-
-var Generator = module.exports = function Generator() {
- yeoman.generators.Base.apply(this, arguments);
-};
-
-util.inherits(Generator, yeoman.generators.Base);
-
-Generator.prototype.deprecated = function deprecated() {
- this.log(chalk.yellow('This sub-generator is deprecated. \n'));
-};
From acf61395b36411c2070b9884689f3d1f0ab350ea Mon Sep 17 00:00:00 2001
From: Andrew Koroluk
Date: Wed, 2 Sep 2015 16:26:03 -0400
Subject: [PATCH 0009/1129] fix(tests): run babel register hook in protractor
`onPrepare`
---
app/templates/protractor.conf.js | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/app/templates/protractor.conf.js b/app/templates/protractor.conf.js
index 6178c1a76..ceebb85b2 100644
--- a/app/templates/protractor.conf.js
+++ b/app/templates/protractor.conf.js
@@ -64,7 +64,8 @@ var config = {
serverConfig: require('./server/config/environment')
},
- onPrepare: function() {<% if (filters.mocha) { %>
+ onPrepare: function() {
+ require('babel-core/register');<% if (filters.mocha) { %>
// Load Mocha and Chai + plugins
require('./mocha.conf');
From a4ba9647452bfbee2a38b905d7bebfa515826055 Mon Sep 17 00:00:00 2001
From: kingcody
Date: Fri, 4 Sep 2015 13:10:10 -0400
Subject: [PATCH 0010/1129] fix(gen): allow generator to be transpiled as a
node_module
closes #1244
---
app/index.js | 4 +++-
endpoint/index.js | 4 +++-
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/app/index.js b/app/index.js
index 994cdee97..11dde883e 100644
--- a/app/index.js
+++ b/app/index.js
@@ -1,7 +1,9 @@
'use strict';
// Register the Babel require hook
-require('babel-core/register');
+require('babel-core/register')({
+ only: /generator-angular-fullstack\/(?!node_modules)/
+});
// Export the generator
exports = module.exports = require('./generator');
diff --git a/endpoint/index.js b/endpoint/index.js
index 994cdee97..11dde883e 100644
--- a/endpoint/index.js
+++ b/endpoint/index.js
@@ -1,7 +1,9 @@
'use strict';
// Register the Babel require hook
-require('babel-core/register');
+require('babel-core/register')({
+ only: /generator-angular-fullstack\/(?!node_modules)/
+});
// Export the generator
exports = module.exports = require('./generator');
From b7647165a38492f1eb269d7c43bc5467554d1b3e Mon Sep 17 00:00:00 2001
From: kingcody
Date: Thu, 3 Sep 2015 18:44:20 -0400
Subject: [PATCH 0011/1129] feat(gen): add angular-fullstack-deps submodule
---
.gitmodules | 3 +++
.travis.yml | 2 ++
angular-fullstack-deps | 1 +
3 files changed, 6 insertions(+)
create mode 100644 .gitmodules
create mode 160000 angular-fullstack-deps
diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 000000000..ff287e31c
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,3 @@
+[submodule "angular-fullstack-deps"]
+ path = angular-fullstack-deps
+ url = git@github.com:angular-fullstack/angular-fullstack-deps.git
diff --git a/.travis.yml b/.travis.yml
index 814f378a3..82f95fde5 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -24,3 +24,5 @@ notifications:
on_success: change # options: [always|never|change] default: always
on_failure: always # options: [always|never|change] default: always
on_start: false # default: false
+git:
+ submodules: false
diff --git a/angular-fullstack-deps b/angular-fullstack-deps
new file mode 160000
index 000000000..45f8b0937
--- /dev/null
+++ b/angular-fullstack-deps
@@ -0,0 +1 @@
+Subproject commit 45f8b093793dfb562db32777f897d538a403bfc4
From 4f8f8b6d3d91f44a1b01ef222bdf1470ed6db88d Mon Sep 17 00:00:00 2001
From: kingcody
Date: Thu, 3 Sep 2015 18:50:47 -0400
Subject: [PATCH 0012/1129] feat(gen): extend `updateFixtures` task to populate
`angular-fullstack-deps`
Usage:
```bash
$ grunt updateFixtures:deps`
```
---
Gruntfile.js | 32 +++++++++++++++++---------------
1 file changed, 17 insertions(+), 15 deletions(-)
diff --git a/Gruntfile.js b/Gruntfile.js
index 38fc08efc..4c4bbb7e3 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -220,21 +220,23 @@ module.exports = function (grunt) {
}
});
- grunt.registerTask('updateFixtures', 'updates package and bower fixtures', function() {
- var packageJson = fs.readFileSync(path.resolve('app/templates/_package.json'), 'utf8');
- var bowerJson = fs.readFileSync(path.resolve('app/templates/_bower.json'), 'utf8');
-
- // replace package name
- packageJson = packageJson.replace(/"name": "<%(.*)%>"/g, '"name": "tempApp"');
- packageJson = packageJson.replace(/<%(.*)%>/g, '');
-
- // remove all ejs conditionals
- bowerJson = bowerJson.replace(/"name": "<%(.*)%>"/g, '"name": "tempApp"');
- bowerJson = bowerJson.replace(/<%(.*)%>/g, '');
-
- // save files
- fs.writeFileSync(path.resolve(__dirname + '/test/fixtures/package.json'), packageJson);
- fs.writeFileSync(path.resolve(__dirname + '/test/fixtures/bower.json'), bowerJson);
+ grunt.registerTask('updateFixtures', 'updates package and bower fixtures', function(target) {
+ var genVer = require('./package.json').version;
+ var dest = __dirname + ((target === 'deps') ? '/angular-fullstack-deps/' : '/test/fixtures/');
+ var appName = (target === 'deps') ? 'angular-fullstack-deps' : 'tempApp';
+
+ var processJson = function(s, d) {
+ // read file, strip all ejs conditionals, and parse as json
+ var json = JSON.parse(fs.readFileSync(path.resolve(s), 'utf8').replace(/<%(.*)%>/g, ''));
+ // set properties
+ json.name = appName, json.version = genVer;
+ if (target === 'deps') { json.private = false; }
+ // stringify json and write it to the destination
+ fs.writeFileSync(path.resolve(d), JSON.stringify(json, null, 2));
+ };
+
+ processJson('app/templates/_package.json', dest + 'package.json');
+ processJson('app/templates/_bower.json', dest + 'bower.json');
});
grunt.registerTask('installFixtures', 'install package and bower fixtures', function() {
From 940a7c670c2c387bcd9e276541422b65fa384a79 Mon Sep 17 00:00:00 2001
From: kingcody
Date: Thu, 3 Sep 2015 19:31:32 -0400
Subject: [PATCH 0013/1129] feat(docs): add `angular-fullstack-deps` dependency
badges
[ci skip]
---
readme.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/readme.md b/readme.md
index f5f37e9e1..618dea68c 100644
--- a/readme.md
+++ b/readme.md
@@ -1,6 +1,6 @@
# AngularJS Full-Stack generator
[](http://travis-ci.org/DaftMonk/generator-angular-fullstack) [](http://badge.fury.io/js/generator-angular-fullstack) [](https://david-dm.org/daftmonk/generator-angular-fullstack) [](https://gitter.im/DaftMonk/generator-angular-fullstack)
-
+#### Generated project: [](https://david-dm.org/angular-fullstack/angular-fullstack-deps) [](https://david-dm.org/angular-fullstack/angular-fullstack-deps#info=devDependencies)
> Yeoman generator for creating MEAN stack applications, using MongoDB, Express, AngularJS, and Node - lets you quickly set up a project following best practices.
## Example project
From 87b31362f99d73c26487d731207a2fe59729c357 Mon Sep 17 00:00:00 2001
From: kingcody
Date: Fri, 4 Sep 2015 11:43:18 -0400
Subject: [PATCH 0014/1129] feat(gen): update release task for current workflow
---
Gruntfile.js | 66 +++++++++++++++++++++++++++++++---------------------
package.json | 1 -
2 files changed, 39 insertions(+), 28 deletions(-)
diff --git a/Gruntfile.js b/Gruntfile.js
index 4c4bbb7e3..64198cda7 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -1,6 +1,5 @@
'use strict';
-var semver = require('semver');
var shell = require('shelljs');
var child_process = require('child_process');
var Q = require('q');
@@ -28,15 +27,26 @@ module.exports = function (grunt) {
},
release: {
options: {
+ bump: false, // remove after 3.0.0 release
commitMessage: '<%= version %>',
- tagName: 'v<%= version %>',
- bump: false, // we have our own bump
- file: 'package.json'
+ tagName: '<%= version %>',
+ file: 'package.json',
+ afterBump: ['updateFixtures:deps', 'commitNgFullstackDeps'],
+ beforeRelease: ['stage'],
+ push: false,
+ pushTags: false,
+ npm: false
+ }
+ },
+ commitNgFullstackDeps: {
+ options: {
+ cwd: 'angular-fullstack-deps',
+ files: ['package.json', 'bower.json']
}
},
stage: {
options: {
- files: ['CHANGELOG.md']
+ files: ['CHANGELOG.md', 'angular-fullstack-deps']
}
},
buildcontrol: {
@@ -103,32 +113,34 @@ module.exports = function (grunt) {
}
});
- grunt.registerTask('bump', 'bump manifest version', function (type) {
- var options = this.options({
- file: grunt.config('pkgFile') || 'package.json'
- });
-
- function setup(file, type) {
- var pkg = grunt.file.readJSON(file);
- var newVersion = pkg.version = semver.inc(pkg.version, type || 'patch');
- return {
- file: file,
- pkg: pkg,
- newVersion: newVersion
- };
- }
-
- var config = setup(options.file, type);
- grunt.file.write(config.file, JSON.stringify(config.pkg, null, ' ') + '\n');
- grunt.log.ok('Version bumped to ' + config.newVersion);
- });
-
grunt.registerTask('stage', 'git add files before running the release task', function () {
- var files = this.options().files;
+ var files = grunt.config('stage.options').files, done = this.async();
grunt.util.spawn({
cmd: process.platform === 'win32' ? 'git.cmd' : 'git',
args: ['add'].concat(files)
- }, grunt.task.current.async());
+ }, done);
+ });
+
+ grunt.registerTask('commitNgFullstackDeps', function() {
+ grunt.config.requires(
+ 'commitNgFullstackDeps.options.files',
+ 'commitNgFullstackDeps.options.cwd'
+ );
+ var ops = grunt.config.get('commitNgFullstackDeps').options;
+ var version = require('./package.json').version || 'NO VERSION SET';
+ if (Array.isArray(ops.files) && ops.files.length > 0) {
+ var done = this.async();
+ var cwd = path.resolve(__dirname, ops.cwd);
+ grunt.util.spawn({
+ cmd: process.platform === 'win32' ? 'git.cmd' : 'git',
+ args: ['commit', '-m', version].concat(ops.files),
+ opts: {
+ cwd: cwd
+ }
+ }, done);
+ } else {
+ grunt.log.writeln('No files were commited');
+ }
});
grunt.registerTask('generateDemo', 'generate demo', function () {
diff --git a/package.json b/package.json
index f8b1ff312..c36bf2d50 100644
--- a/package.json
+++ b/package.json
@@ -54,7 +54,6 @@
"mocha": "^2.2.5",
"q": "^1.0.1",
"recursive-readdir": "^1.2.0",
- "semver": "^5.0.1",
"shelljs": "^0.5.3",
"underscore.string": "^3.1.1"
},
From bfd9fce85a39d202321547bbd8cb98429425d8f4 Mon Sep 17 00:00:00 2001
From: kingcody
Date: Sat, 5 Sep 2015 04:17:00 -0400
Subject: [PATCH 0015/1129] feat(app): use grunt config for `server` location
---
app/templates/Gruntfile.js | 33 +++++++++++++++++----------------
1 file changed, 17 insertions(+), 16 deletions(-)
diff --git a/app/templates/Gruntfile.js b/app/templates/Gruntfile.js
index 5e56ff203..94e2aabbf 100644
--- a/app/templates/Gruntfile.js
+++ b/app/templates/Gruntfile.js
@@ -31,6 +31,7 @@ module.exports = function (grunt) {
yeoman: {
// configurable paths
client: require('./bower.json').appPath || 'client',
+ server: 'server',
dist: 'dist'
},
express: {
@@ -39,13 +40,13 @@ module.exports = function (grunt) {
},
dev: {
options: {
- script: 'server',
+ script: '<%%= yeoman.server %>',
debug: true
}
},
prod: {
options: {
- script: 'dist/server'
+ script: '<%%= yeoman.dist %>/<%%= yeoman.server %>'
}
}
},
@@ -71,7 +72,7 @@ module.exports = function (grunt) {
tasks: ['injector:css']
},
mochaTest: {
- files: ['server/**/*.{spec,integration}.js'],
+ files: ['<%%= yeoman.server %>/**/*.{spec,integration}.js'],
tasks: ['env:test', 'mochaTest']
},
jsTest: {
@@ -128,7 +129,7 @@ module.exports = function (grunt) {
}
},
express: {
- files: ['server/**/*.{js,json}'],
+ files: ['<%%= yeoman.server %>/**/*.{js,json}'],
tasks: ['express:dev', 'wait'],
options: {
livereload: true,
@@ -149,15 +150,15 @@ module.exports = function (grunt) {
},
server: {
options: {
- jshintrc: 'server/.jshintrc'
+ jshintrc: '<%%= yeoman.server %>/.jshintrc'
},
- src: ['server/**/!(*.spec|*.integration).js']
+ src: ['<%%= yeoman.server %>/**/!(*.spec|*.integration).js']
},
serverTest: {
options: {
- jshintrc: 'server/.jshintrc-spec'
+ jshintrc: '<%%= yeoman.server %>/.jshintrc-spec'
},
- src: ['server/**/*.{spec,integration}.js']
+ src: ['<%%= yeoman.server %>/**/*.{spec,integration}.js']
},
all: ['<%%= yeoman.client %>/{app,components}/**/!(*.spec|*.mock).js'],
test: {
@@ -173,7 +174,7 @@ module.exports = function (grunt) {
files: {
src: [
'<%%= yeoman.client %>/app/**/*.js',
- 'server/**/*.js'
+ '<%%= yeoman.server %>/**/*.js'
]
}
}
@@ -223,7 +224,7 @@ module.exports = function (grunt) {
// Use nodemon to run server in debug mode with an initial breakpoint
nodemon: {
debug: {
- script: 'server',
+ script: '<%%= yeoman.server %>',
options: {
nodeArgs: ['--debug-brk'],
env: {
@@ -393,7 +394,7 @@ module.exports = function (grunt) {
dest: '<%%= yeoman.dist %>',
src: [
'package.json',
- 'server/**/*'
+ '<%%= yeoman.server %>/**/*'
]
}]
},
@@ -407,7 +408,7 @@ module.exports = function (grunt) {
buildcontrol: {
options: {
- dir: 'dist',
+ dir: '<%%= yeoman.dist %>',
commit: true,
push: true,
connectCommits: false,
@@ -480,10 +481,10 @@ module.exports = function (grunt) {
timeout: 5000 // set default mocha spec timeout
},
unit: {
- src: ['server/**/*.spec.js']
+ src: ['<%%= yeoman.server %>/**/*.spec.js']
},
integration: {
- src: ['server/**/*.integration.js']
+ src: ['<%%= yeoman.server %>/**/*.integration.js']
}
},
@@ -496,7 +497,7 @@ module.exports = function (grunt) {
mask: '**/*.spec.js',
coverageFolder: 'coverage/server/unit'
},
- src: 'server'
+ src: '<%%= yeoman.server %>'
},
integration: {
options: {
@@ -506,7 +507,7 @@ module.exports = function (grunt) {
mask: '**/*.integration.js',
coverageFolder: 'coverage/server/integration'
},
- src: 'server'
+ src: '<%%= yeoman.server %>'
}
},
From b855c248dcbfa62f6e07363affeb3e3b0217feba Mon Sep 17 00:00:00 2001
From: kingcody
Date: Sat, 5 Sep 2015 18:48:03 -0400
Subject: [PATCH 0016/1129] feat(gen): ignore angular-fullstack-deps and test
for npm publish
This will reduce the published size quite a bit since `test/fixtures` was previously being published
[ci skip]
---
.npmignore | 2 ++
1 file changed, 2 insertions(+)
create mode 100644 .npmignore
diff --git a/.npmignore b/.npmignore
new file mode 100644
index 000000000..ec6ff802d
--- /dev/null
+++ b/.npmignore
@@ -0,0 +1,2 @@
+angular-fullstack-deps
+test
From 15fdd0f821ba9ca7f741f128b414b89ebd93b1c3 Mon Sep 17 00:00:00 2001
From: kingcody
Date: Thu, 3 Sep 2015 03:17:06 -0400
Subject: [PATCH 0017/1129] chore(gen): update yeoman-generator to `~0.19.2`
---
app/generator.js | 4 +-
app/templates/README.md | 2 +-
app/templates/_bower.json | 2 +-
app/templates/_package.json | 2 +-
.../components/navbar/navbar(html).html | 2 +-
.../components/navbar/navbar(jade).jade | 2 +-
app/templates/server/config/_local.env.js | 2 +-
.../server/config/_local.env.sample.js | 2 +-
.../server/config/environment/development.js | 2 +-
.../server/config/environment/index.js | 2 +-
.../server/config/environment/production.js | 2 +-
.../server/config/environment/test.js | 2 +-
app/templates/server/config/express.js | 2 +-
generator-base.js | 15 ++++++--
heroku/index.js | 5 ++-
openshift/index.js | 5 ++-
package.json | 8 +++-
test/test-file-creation.js | 37 +++++++++++--------
util.js | 17 +++++++--
19 files changed, 72 insertions(+), 43 deletions(-)
diff --git a/app/generator.js b/app/generator.js
index 591984d98..22b46dfe8 100644
--- a/app/generator.js
+++ b/app/generator.js
@@ -33,7 +33,7 @@ export default class Generator extends Base {
},
info: function () {
- this.log(this.welcome);
+ this.log(this.yoWelcome);
this.log('Out of the box I create an AngularJS app with an Express server.\n');
},
@@ -49,7 +49,7 @@ export default class Generator extends Base {
}], function (answers) {
this.skipConfig = answers.skipConfig;
- this.filters = this._.defaults(this.config.get('filters'), {
+ this.filters = this.lodash.defaults(this.config.get('filters'), {
bootstrap: true,
uibootstrap: true,
jasmine: true
diff --git a/app/templates/README.md b/app/templates/README.md
index 958834120..e5ec70428 100644
--- a/app/templates/README.md
+++ b/app/templates/README.md
@@ -1,4 +1,4 @@
-# <%= _.slugify(_.humanize(appname)) %>
+# <%= lodash.slugify(lodash.humanize(appname)) %>
This project was generated with the [Angular Full-Stack Generator](https://github.com/DaftMonk/generator-angular-fullstack) version <%= pkg.version %>.
diff --git a/app/templates/_bower.json b/app/templates/_bower.json
index 1d41b39d1..85e8835ed 100644
--- a/app/templates/_bower.json
+++ b/app/templates/_bower.json
@@ -1,5 +1,5 @@
{
- "name": "<%= _.slugify(_.humanize(appname)) %>",
+ "name": "<%= lodash.slugify(lodash.humanize(appname)) %>",
"version": "0.0.0",
"dependencies": {
"angular": "~1.4.0",
diff --git a/app/templates/_package.json b/app/templates/_package.json
index 67760246d..3187a8ae1 100644
--- a/app/templates/_package.json
+++ b/app/templates/_package.json
@@ -1,5 +1,5 @@
{
- "name": "<%= _.slugify(_.humanize(appname)) %>",
+ "name": "<%= lodash.slugify(lodash.humanize(appname)) %>",
"version": "0.0.0",
"main": "server/app.js",
"dependencies": {
diff --git a/app/templates/client/components/navbar/navbar(html).html b/app/templates/client/components/navbar/navbar(html).html
index ec9e4682d..eda46b07a 100644
--- a/app/templates/client/components/navbar/navbar(html).html
+++ b/app/templates/client/components/navbar/navbar(html).html
@@ -7,7 +7,7 @@
- <%= _.slugify(_.humanize(appname)) %>
+ <%= lodash.slugify(lodash.humanize(appname)) %>
diff --git a/app/templates/client/components/navbar/navbar(jade).jade b/app/templates/client/components/navbar/navbar(jade).jade
index e20a8fffa..a6f5fe919 100644
--- a/app/templates/client/components/navbar/navbar(jade).jade
+++ b/app/templates/client/components/navbar/navbar(jade).jade
@@ -6,7 +6,7 @@ div.navbar.navbar-default.navbar-static-top(ng-controller='NavbarCtrl')
span.icon-bar
span.icon-bar
span.icon-bar
- a.navbar-brand(href='http://github.com/') <%= _.slugify(_.humanize(appname)) %>
+ a.navbar-brand(href='http://github.com/') <%= lodash.slugify(lodash.humanize(appname)) %>
div#navbar-main.navbar-collapse.collapse(collapse='isCollapsed')
ul.nav.navbar-nav
diff --git a/app/templates/server/config/_local.env.js b/app/templates/server/config/_local.env.js
index 12b78192e..82195c471 100644
--- a/app/templates/server/config/_local.env.js
+++ b/app/templates/server/config/_local.env.js
@@ -7,7 +7,7 @@
module.exports = {
DOMAIN: 'http://localhost:9000/',
- SESSION_SECRET: '<%= _.slugify(appname) + "-secret" %>',<% if (filters.facebookAuth) { %>
+ SESSION_SECRET: '<%= lodash.slugify(appname) + "-secret" %>',<% if (filters.facebookAuth) { %>
FACEBOOK_ID: 'app-id',
FACEBOOK_SECRET: 'secret',<% } if (filters.twitterAuth) { %>
diff --git a/app/templates/server/config/_local.env.sample.js b/app/templates/server/config/_local.env.sample.js
index ac5a52a2e..8106cf731 100644
--- a/app/templates/server/config/_local.env.sample.js
+++ b/app/templates/server/config/_local.env.sample.js
@@ -7,7 +7,7 @@
module.exports = {
DOMAIN: 'http://localhost:9000/',
- SESSION_SECRET: '<%= _.slugify(appname) + "-secret" %>',<% if (filters.facebookAuth) { %>
+ SESSION_SECRET: '<%= lodash.slugify(appname) + "-secret" %>',<% if (filters.facebookAuth) { %>
FACEBOOK_ID: 'app-id',
FACEBOOK_SECRET: 'secret',<% } if (filters.twitterAuth) { %>
diff --git a/app/templates/server/config/environment/development.js b/app/templates/server/config/environment/development.js
index 20656595b..d79b250b3 100644
--- a/app/templates/server/config/environment/development.js
+++ b/app/templates/server/config/environment/development.js
@@ -5,7 +5,7 @@
module.exports = {
// MongoDB connection options
mongo: {
- uri: 'mongodb://localhost/<%= _.slugify(appname) %>-dev'
+ uri: 'mongodb://localhost/<%= lodash.slugify(appname) %>-dev'
},
sequelize: {
uri: 'sqlite://',
diff --git a/app/templates/server/config/environment/index.js b/app/templates/server/config/environment/index.js
index 547f6bbac..98c892d32 100644
--- a/app/templates/server/config/environment/index.js
+++ b/app/templates/server/config/environment/index.js
@@ -29,7 +29,7 @@ var all = {
// Secret for session, you will want to change this and make it an environment variable
secrets: {
- session: '<%= _.slugify(_.humanize(appname)) + '-secret' %>'
+ session: '<%= lodash.slugify(lodash.humanize(appname)) + '-secret' %>'
},
// List of user roles
diff --git a/app/templates/server/config/environment/production.js b/app/templates/server/config/environment/production.js
index e0b77bf97..abdda30a3 100644
--- a/app/templates/server/config/environment/production.js
+++ b/app/templates/server/config/environment/production.js
@@ -19,6 +19,6 @@ module.exports = {
process.env.MONGOHQ_URL ||
process.env.OPENSHIFT_MONGODB_DB_URL +
process.env.OPENSHIFT_APP_NAME ||
- 'mongodb://localhost/<%= _.slugify(appname) %>'
+ 'mongodb://localhost/<%= lodash.slugify(appname) %>'
}
};
diff --git a/app/templates/server/config/environment/test.js b/app/templates/server/config/environment/test.js
index 021938424..ea7d65096 100644
--- a/app/templates/server/config/environment/test.js
+++ b/app/templates/server/config/environment/test.js
@@ -5,7 +5,7 @@
module.exports = {
// MongoDB connection options
mongo: {
- uri: 'mongodb://localhost/<%= _.slugify(appname) %>-test'
+ uri: 'mongodb://localhost/<%= lodash.slugify(appname) %>-test'
},
sequelize: {
uri: 'sqlite://',
diff --git a/app/templates/server/config/express.js b/app/templates/server/config/express.js
index e8748499b..7ecf10888 100644
--- a/app/templates/server/config/express.js
+++ b/app/templates/server/config/express.js
@@ -46,7 +46,7 @@ module.exports = function(app) {
saveUninitialized: true<% if (filters.mongoose) { %>,
store: new mongoStore({
mongooseConnection: mongoose.connection,
- db: '<%= _.slugify(_.humanize(appname)) %>'
+ db: '<%= lodash.slugify(lodash.humanize(appname)) %>'
})<% } else if(filters.sequelize) { %>,
store: new Store(sqldb.sequelize)<% } %>
}));
diff --git a/generator-base.js b/generator-base.js
index fbe4be437..2abbaa0f7 100644
--- a/generator-base.js
+++ b/generator-base.js
@@ -2,17 +2,26 @@
import util from 'util';
import path from 'path';
+import lodash from 'lodash';
+import s from 'underscore.string';
+import yoWelcome from 'yeoman-welcome';
import * as genUtils from './util';
+// extend lodash with underscore.string
+lodash.mixin(s.exports());
+
export function genBase(self) {
self = self || this;
+ self.lodash = lodash;
+ self.yoWelcome = yoWelcome;
+
try {
self.appname = require(path.join(process.cwd(), 'bower.json')).name;
} catch (e) {
self.appname = self.name || path.basename(process.cwd());
}
- self.appname = self._.camelize(self._.slugify(self._.humanize(self.appname)));
+ self.appname = lodash.camelize(lodash.slugify(lodash.humanize(self.appname)));
self.scriptAppName = self.appname + genUtils.appSuffix(self);
self.filters = self.filters || self.config.get('filters');
@@ -41,8 +50,8 @@ export function genNamedBase(self) {
var name = self.name.replace(/\//g, '-');
- self.cameledName = self._.camelize(name);
- self.classedName = self._.classify(name);
+ self.cameledName = lodash.camelize(name);
+ self.classedName = lodash.classify(name);
self.basename = path.basename(self.name);
self.dirname = (self.name.indexOf('/') >= 0) ? path.dirname(self.name) : self.name;
diff --git a/heroku/index.js b/heroku/index.js
index 689833d26..dd3670473 100644
--- a/heroku/index.js
+++ b/heroku/index.js
@@ -4,6 +4,7 @@ var yeoman = require('yeoman-generator');
var exec = require('child_process').exec;
var chalk = require('chalk');
var path = require('path');
+var s = require('underscore.string');
var Generator = module.exports = function Generator() {
yeoman.generators.Base.apply(this, arguments);
@@ -14,7 +15,7 @@ var Generator = module.exports = function Generator() {
} catch (e) {
this.appname = path.basename(process.cwd());
}
- this.appname = this._.slugify(this.appname);
+ this.appname = s.slugify(this.appname);
this.filters = this.config.get('filters') || {};
};
@@ -29,7 +30,7 @@ Generator.prototype.askForName = function askForName() {
}];
this.prompt(prompts, function (props) {
- this.deployedName = this._.slugify(props.deployedName);
+ this.deployedName = s.slugify(props.deployedName);
done();
}.bind(this));
};
diff --git a/openshift/index.js b/openshift/index.js
index 7929c0e09..c0f8f171f 100644
--- a/openshift/index.js
+++ b/openshift/index.js
@@ -4,6 +4,7 @@ var yeoman = require('yeoman-generator');
var childProcess = require('child_process');
var chalk = require('chalk');
var path = require('path');
+var s = require('underscore.string');
var exec = childProcess.exec;
var spawn = childProcess.spawn;
@@ -16,7 +17,7 @@ var Generator = module.exports = function Generator() {
} catch (e) {
this.appname = path.basename(process.cwd());
}
- this.appname = this._.slugify(this.appname).split('-').join('');
+ this.appname = s.slugify(this.appname).split('-').join('');
this.filters = this.config.get('filters') || {};
};
@@ -32,7 +33,7 @@ Generator.prototype.askForName = function askForName() {
}];
this.prompt(prompts, function (props) {
- this.deployedName = this._.slugify(props.deployedName).split('-').join('');
+ this.deployedName = s.slugify(props.deployedName).split('-').join('');
done();
}.bind(this));
};
diff --git a/package.json b/package.json
index c36bf2d50..45c91f865 100644
--- a/package.json
+++ b/package.json
@@ -37,7 +37,11 @@
"babel-core": "^5.8.23",
"chalk": "^1.1.0",
"generator-ng-component": "~0.1.0",
- "yeoman-generator": "~0.18.10"
+ "glob": "^5.0.14",
+ "lodash": "^3.10.1",
+ "underscore.string": "^3.1.1",
+ "yeoman-generator": "~0.19.2",
+ "yeoman-welcome": "^1.0.1"
},
"devDependencies": {
"chai": "^3.2.0",
@@ -55,7 +59,7 @@
"q": "^1.0.1",
"recursive-readdir": "^1.2.0",
"shelljs": "^0.5.3",
- "underscore.string": "^3.1.1"
+ "yeoman-assert": "^2.0.0"
},
"engines": {
"node": ">=0.12.0",
diff --git a/test/test-file-creation.js b/test/test-file-creation.js
index 7850fc9e4..1f2162142 100644
--- a/test/test-file-creation.js
+++ b/test/test-file-creation.js
@@ -4,6 +4,7 @@ var path = require('path');
var fs = require('fs');
var exec = require('child_process').exec;
var helpers = require('yeoman-generator').test;
+var assert = require('yeoman-assert');
var chai = require('chai');
var expect = chai.expect;
var recursiveReadDir = require('recursive-readdir');
@@ -31,7 +32,9 @@ describe('angular-fullstack generator', function () {
gen.run(function () {
var afGenerator;
var deps = [path.join('../..', generatorType)];
- afGenerator = helpers.createGenerator('angular-fullstack:' + generatorType, deps, [name]);
+ afGenerator = helpers.createGenerator('angular-fullstack:' + generatorType, deps, [name], {
+ skipInstall: true
+ });
helpers.mockPrompt(afGenerator, mockPrompt);
afGenerator.run(function () {
@@ -328,8 +331,9 @@ describe('angular-fullstack generator', function () {
return done(err);
}
- gen = helpers.createGenerator('angular-fullstack:app', deps);
- gen.options['skip-install'] = true;
+ gen = helpers.createGenerator('angular-fullstack:app', deps, [], {
+ skipInstall: true
+ });
done();
}.bind(this));
});
@@ -337,13 +341,13 @@ describe('angular-fullstack generator', function () {
describe('making sure test fixtures are present', function() {
it('should have package.json in fixtures', function() {
- helpers.assertFile([
+ assert.file([
path.join(__dirname, 'fixtures', 'package.json')
]);
});
it('should have bower.json in fixtures', function() {
- helpers.assertFile([
+ assert.file([
path.join(__dirname, 'fixtures', 'bower.json')
]);
});
@@ -355,7 +359,7 @@ describe('angular-fullstack generator', function () {
deps = deps.map(function(dep) {
return path.join(__dirname, 'fixtures', 'node_modules', dep);
});
- helpers.assertFile(deps);
+ assert.file(deps);
});
it('should have all bower packages in fixtures/bower_components', function() {
@@ -365,7 +369,7 @@ describe('angular-fullstack generator', function () {
deps = deps.map(function(dep) {
return path.join(__dirname, 'fixtures', 'bower_components', dep);
});
- helpers.assertFile(deps);
+ assert.file(deps);
});
});
@@ -429,7 +433,7 @@ describe('angular-fullstack generator', function () {
it('should generate expected files with path name endpoint', function(done) {
runTest('(exit 0)', this, function() {
- helpers.assertFile([
+ assert.file([
'server/api/foo/bar/index.js',
'server/api/foo/bar/index.spec.js',
'server/api/foo/bar/bar.controller.js',
@@ -452,13 +456,14 @@ describe('angular-fullstack generator', function () {
helpers.createDummyGenerator(),
'ng-component:app'
]
- ]);
- gen.options['skip-install'] = true;
+ ], [], {
+ skipInstall: true
+ });
helpers.mockPrompt(gen, {
skipConfig: true
});
gen.run(function () {
- helpers.assertFile([
+ assert.file([
'client/app/main/main.less',
'client/app/main/main.coffee',
'server/auth/google/passport.js'
@@ -469,7 +474,7 @@ describe('angular-fullstack generator', function () {
it('should generate expected files', function (done) {
gen.run(function () {
- helpers.assertFile(genFiles(defaultOptions));
+ assert.file(genFiles(defaultOptions));
done();
});
});
@@ -540,7 +545,7 @@ describe('angular-fullstack generator', function () {
it('should generate expected files', function (done) {
gen.run(function () {
- helpers.assertFile(genFiles(testOptions));
+ assert.file(genFiles(testOptions));
done();
});
});
@@ -612,7 +617,7 @@ describe('angular-fullstack generator', function () {
it('should generate expected files', function (done) {
gen.run(function () {
- helpers.assertFile(genFiles(testOptions));
+ assert.file(genFiles(testOptions));
done();
});
});
@@ -686,7 +691,7 @@ describe('angular-fullstack generator', function () {
it('should generate expected files', function (done) {
gen.run(function () {
- helpers.assertFile(genFiles(testOptions));
+ assert.file(genFiles(testOptions));
done();
});
});
@@ -747,7 +752,7 @@ describe('angular-fullstack generator', function () {
it('should generate expected files', function (done) {
gen.run(function () {
- helpers.assertFile(genFiles(testOptions));
+ assert.file(genFiles(testOptions));
done();
});
});
diff --git a/util.js b/util.js
index d23e7f693..ce7b7733b 100644
--- a/util.js
+++ b/util.js
@@ -2,6 +2,15 @@
import path from 'path';
import fs from 'fs';
+import glob from 'glob';
+
+function expandFiles(pattern, options) {
+ options = options || {};
+ var cwd = options.cwd || process.cwd();
+ return glob.sync(pattern, options).filter(function (filepath) {
+ return fs.statSync(path.join(cwd, filepath)).isFile();
+ });
+}
export function rewriteFile(args) {
args.path = args.path || process.cwd();
@@ -56,7 +65,7 @@ export function rewrite(args) {
export function appSuffix(self) {
var suffix = self.options['app-suffix'];
- return (typeof suffix === 'string') ? self._.classify(suffix) : '';
+ return (typeof suffix === 'string') ? self.lodash.classify(suffix) : '';
}
function destinationPath(self, filepath) {
@@ -98,7 +107,7 @@ function templateIsUsable(self, filteredFile) {
for(var key in filters) {
if(filters[key]) enabledFilters.push(key);
}
- var matchedFilters = self._.intersection(filteredFile.filters, enabledFilters);
+ var matchedFilters = self.lodash.intersection(filteredFile.filters, enabledFilters);
// check that all filters on file are matched
if(filteredFile.filters.length && matchedFilters.length !== filteredFile.filters.length) {
return false;
@@ -108,8 +117,8 @@ function templateIsUsable(self, filteredFile) {
export function processDirectory(source, destination) {
var self = this;
- var root = self.isPathAbsolute(source) ? source : path.join(self.sourceRoot(), source);
- var files = self.expandFiles('**', { dot: true, cwd: root });
+ var root = path.isAbsolute(source) ? source : path.join(self.sourceRoot(), source);
+ var files = expandFiles('**', { dot: true, cwd: root });
var dest, src;
files.forEach(function(f) {
From 49c6a26b3df180f48439ff84cb27219e08d993b6 Mon Sep 17 00:00:00 2001
From: kingcody
Date: Wed, 2 Sep 2015 19:04:40 -0400
Subject: [PATCH 0018/1129] fix(gen): expose `skip-install` option and improve
usage docs
closes #1230
---
app/USAGE | 23 +++++++++++++++++++++--
app/generator.js | 7 ++++++-
readme.md | 30 ++++++++++++++++++++++++++++++
3 files changed, 57 insertions(+), 3 deletions(-)
diff --git a/app/USAGE b/app/USAGE
index 721ce199b..22bfcb18d 100644
--- a/app/USAGE
+++ b/app/USAGE
@@ -1,5 +1,24 @@
Description:
- Creates an full-stack AngularJS + Node app
+ Creates a Full-Stack AngularJS + Node app
Example:
- yo angular-fullstack
+ yo angular-fullstack
+
+Sub Generators:
+
+ Server Side:
+ angular-fullstack:endpoint
+
+ Client Side:
+ angular-fullstack:route
+ angular-fullstack:controller
+ angular-fullstack:filter
+ angular-fullstack:directive
+ angular-fullstack:service
+ angular-fullstack:provider
+ angular-fullstack:factory
+ angular-fullstack:decorator
+
+ Deployment:
+ angular-fullstack:openshift
+ angular-fullstack:heroku
diff --git a/app/generator.js b/app/generator.js
index 591984d98..e120de49c 100644
--- a/app/generator.js
+++ b/app/generator.js
@@ -13,10 +13,15 @@ export default class Generator extends Base {
this.argument('name', { type: String, required: false });
+ this.option('skip-install', {
+ desc: 'Do not install dependencies',
+ type: Boolean,
+ defaults: false
+ });
+
this.option('app-suffix', {
desc: 'Allow a custom suffix to be added to the module name',
type: String,
- required: 'false',
defaults: 'App'
});
}
diff --git a/readme.md b/readme.md
index 618dea68c..dcceaeebc 100644
--- a/readme.md
+++ b/readme.md
@@ -84,6 +84,21 @@ Available generators:
### App
Sets up a new AngularJS + Express app, generating all the boilerplate you need to get started.
+Usage:
+```bash
+Usage:
+ yo angular-fullstack:app [options] []
+
+Options:
+ -h, --help # Print the generator's options and usage
+ --skip-cache # Do not remember prompt answers Default: false
+ --skip-install # Do not install dependencies Default: false
+ --app-suffix # Allow a custom suffix to be added to the module name Default: App
+
+Arguments:
+ name Type: String Required: false
+```
+
Example:
```bash
yo angular-fullstack
@@ -92,6 +107,21 @@ yo angular-fullstack
### Endpoint
Generates a new API endpoint.
+Usage:
+```bash
+Usage:
+ yo angular-fullstack:endpoint [options]
+
+Options:
+ -h, --help # Print the generator's options and usage
+ --skip-cache # Do not remember prompt answers Default: false
+ --route # URL for the endpoint
+ --models # Specify which model(s) to use
+ --endpointDirectory # Parent directory for enpoints
+
+Arguments:
+ name Type: String Required: true
+```
Example:
```bash
From 2668771828f603f699b3c4a1e639346d6cf5e43e Mon Sep 17 00:00:00 2001
From: kingcody
Date: Sat, 5 Sep 2015 19:51:08 -0400
Subject: [PATCH 0019/1129] chore(app): update autoprefixer to `^6.0.0`
---
app/templates/Gruntfile.js | 2 +-
app/templates/_package.json | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/templates/Gruntfile.js b/app/templates/Gruntfile.js
index 94e2aabbf..cac1f2618 100644
--- a/app/templates/Gruntfile.js
+++ b/app/templates/Gruntfile.js
@@ -199,7 +199,7 @@ module.exports = function (grunt) {
options: {
map: true,
processors: [
- require('autoprefixer-core')({browsers: ['last 1 version']})
+ require('autoprefixer')({browsers: ['last 2 version']})
]
},
dist: {
diff --git a/app/templates/_package.json b/app/templates/_package.json
index 67760246d..aa2fecd39 100644
--- a/app/templates/_package.json
+++ b/app/templates/_package.json
@@ -36,7 +36,7 @@
"serve-favicon": "^2.3.0"
},
"devDependencies": {
- "autoprefixer-core": "^5.2.1",
+ "autoprefixer": "^6.0.0",
"grunt": "~0.4.5",
"grunt-wiredep": "^2.0.0",
"grunt-concurrent": "^2.0.1",
From b8255857e83ffc913d67cbcf9178c36fe94570fb Mon Sep 17 00:00:00 2001
From: kingcody
Date: Sun, 6 Sep 2015 03:15:40 -0400
Subject: [PATCH 0020/1129] fix(gen): denote images as binaries in
.gitattributes
[ci skip]
---
.gitattributes | 6 ++++++
app/templates/.gitattributes | 6 ++++++
2 files changed, 12 insertions(+)
diff --git a/.gitattributes b/.gitattributes
index fcadb2cf9..f49b99cfa 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -1 +1,7 @@
* text eol=lf
+
+# Denote all files that are truly binary and should not be modified.
+*.png binary
+*.gif binary
+*.jpg binary
+*.jpeg binary
diff --git a/app/templates/.gitattributes b/app/templates/.gitattributes
index fcadb2cf9..f49b99cfa 100644
--- a/app/templates/.gitattributes
+++ b/app/templates/.gitattributes
@@ -1 +1,7 @@
* text eol=lf
+
+# Denote all files that are truly binary and should not be modified.
+*.png binary
+*.gif binary
+*.jpg binary
+*.jpeg binary
From 8afc83cdc2bf920ffcdaacc4c3e1eba5cde77e6d Mon Sep 17 00:00:00 2001
From: Cody Mize
Date: Sat, 5 Sep 2015 19:21:04 -0400
Subject: [PATCH 0021/1129] chore(gen): use svg badges in `README.md`
[ci skip]
---
readme.md | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/readme.md b/readme.md
index dcceaeebc..c1a5793f6 100644
--- a/readme.md
+++ b/readme.md
@@ -1,6 +1,12 @@
# AngularJS Full-Stack generator
-[](http://travis-ci.org/DaftMonk/generator-angular-fullstack) [](http://badge.fury.io/js/generator-angular-fullstack) [](https://david-dm.org/daftmonk/generator-angular-fullstack) [](https://gitter.im/DaftMonk/generator-angular-fullstack)
-#### Generated project: [](https://david-dm.org/angular-fullstack/angular-fullstack-deps) [](https://david-dm.org/angular-fullstack/angular-fullstack-deps#info=devDependencies)
+[](http://travis-ci.org/DaftMonk/generator-angular-fullstack)
+[](http://badge.fury.io/js/generator-angular-fullstack)
+[](https://david-dm.org/daftmonk/generator-angular-fullstack)
+[](https://david-dm.org/daftmonk/generator-angular-fullstack#info=devDependencies)
+[](https://gitter.im/DaftMonk/generator-angular-fullstack)
+#### Generated project:
+[](https://david-dm.org/angular-fullstack/angular-fullstack-deps)
+[](https://david-dm.org/angular-fullstack/angular-fullstack-deps#info=devDependencies)
> Yeoman generator for creating MEAN stack applications, using MongoDB, Express, AngularJS, and Node - lets you quickly set up a project following best practices.
## Example project
From 8b708e2efad6ec5088d824172e337c2a7750351d Mon Sep 17 00:00:00 2001
From: kingcody
Date: Sat, 5 Sep 2015 03:58:40 -0400
Subject: [PATCH 0022/1129] feat(app): compile server with babel-runtime
---
app/templates/Gruntfile.js | 18 +++++++++++++++---
app/templates/_package.json | 3 ++-
app/templates/server/app.js | 3 ---
app/templates/server/index.js | 9 +++++++--
4 files changed, 24 insertions(+), 9 deletions(-)
diff --git a/app/templates/Gruntfile.js b/app/templates/Gruntfile.js
index cac1f2618..15e544a5a 100644
--- a/app/templates/Gruntfile.js
+++ b/app/templates/Gruntfile.js
@@ -581,13 +581,13 @@ module.exports = function (grunt) {
ext: '.js'
}]
}
- },<% } if(filters.babel) { %>
+ },<% } %>
// Compiles ES6 to JavaScript using Babel
babel: {
options: {
sourceMap: true
- },
+ },<% if(filters.babel) { %>
client: {
files: [{
expand: true,
@@ -595,8 +595,19 @@ module.exports = function (grunt) {
src: ['{app,components}/**/!(*.spec).js'],
dest: '.tmp'
}]
+ },<% } %>
+ server: {
+ options: {
+ optional: ['runtime']
+ },
+ files: [{
+ expand: true,
+ cwd: '<%%= yeoman.server %>',
+ src: ['**/*.{js,json}'],
+ dest: '<%%= yeoman.dist %>/<%%= yeoman.server %>'
+ }]
}
- },<% } if(filters.stylus) { %>
+ },<% if(filters.stylus) { %>
// Compiles Stylus to CSS
stylus: {
@@ -902,6 +913,7 @@ module.exports = function (grunt) {
'concat',
'ngAnnotate',
'copy:dist',
+ 'babel:server',
'cdnify',
'cssmin',
'uglify',
diff --git a/app/templates/_package.json b/app/templates/_package.json
index 523dd7c53..cfecfbbd6 100644
--- a/app/templates/_package.json
+++ b/app/templates/_package.json
@@ -14,7 +14,7 @@
"composable-middleware": "^0.3.0",
"lodash": "^3.10.1",
"lusca": "^1.3.0",
- "babel-core": "^5.6.4",<% if (filters.jade) { %>
+ "babel-runtime": "^5.8.20",<% if (filters.jade) { %>
"jade": "^1.11.0",<% } %><% if (filters.html) { %>
"ejs": "^2.3.3",<% } %><% if (filters.mongoose) { %>
"mongoose": "^4.1.2",
@@ -37,6 +37,7 @@
},
"devDependencies": {
"autoprefixer": "^6.0.0",
+ "babel-core": "^5.6.4",
"grunt": "~0.4.5",
"grunt-wiredep": "^2.0.0",
"grunt-concurrent": "^2.0.1",
diff --git a/app/templates/server/app.js b/app/templates/server/app.js
index 1b28cdb11..d6280f1e7 100644
--- a/app/templates/server/app.js
+++ b/app/templates/server/app.js
@@ -4,9 +4,6 @@
'use strict';
-// Set default node environment to development
-process.env.NODE_ENV = process.env.NODE_ENV || 'development';
-
import express from 'express';<% if (filters.mongoose) { %>
import mongoose from 'mongoose';<% } %><% if (filters.sequelize) { %>
import sqldb from './sqldb';<% } %>
diff --git a/app/templates/server/index.js b/app/templates/server/index.js
index fc65cd5f4..7a1b65b99 100644
--- a/app/templates/server/index.js
+++ b/app/templates/server/index.js
@@ -1,7 +1,12 @@
'use strict';
-// Register the Babel require hook
-require('babel-core/register');
+// Set default node environment to development
+var env = process.env.NODE_ENV = process.env.NODE_ENV || 'development';
+
+if (env === 'production' || env === 'test') {
+ // Register the Babel require hook
+ require('babel-core/register');
+}
// Export the application
exports = module.exports = require('./app');
From e768c586e9eb8208d9f2a389c2fe4df588ceb221 Mon Sep 17 00:00:00 2001
From: kingcody
Date: Sun, 6 Sep 2015 10:38:54 -0400
Subject: [PATCH 0023/1129] fix(app): express-session requires `resave` config
to be set
---
app/templates/server/config/express.js | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/app/templates/server/config/express.js b/app/templates/server/config/express.js
index 7ecf10888..5c613de9b 100644
--- a/app/templates/server/config/express.js
+++ b/app/templates/server/config/express.js
@@ -43,7 +43,8 @@ module.exports = function(app) {
// oauth 1.0 strategy, and Lusca depends on sessions
app.use(session({
secret: config.secrets.session,
- saveUninitialized: true<% if (filters.mongoose) { %>,
+ saveUninitialized: true,
+ resave: false<% if (filters.mongoose) { %>,
store: new mongoStore({
mongooseConnection: mongoose.connection,
db: '<%= lodash.slugify(lodash.humanize(appname)) %>'
From bbc270360250c7035da035d69cc42906e62d4ee6 Mon Sep 17 00:00:00 2001
From: Andrew Koroluk
Date: Sun, 6 Sep 2015 21:59:35 -0400
Subject: [PATCH 0024/1129] chore(npm): update genrator-ng-component to ~0.1.1
---
package.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/package.json b/package.json
index 45c91f865..5cf9f2284 100644
--- a/package.json
+++ b/package.json
@@ -36,7 +36,7 @@
"dependencies": {
"babel-core": "^5.8.23",
"chalk": "^1.1.0",
- "generator-ng-component": "~0.1.0",
+ "generator-ng-component": "~0.1.1",
"glob": "^5.0.14",
"lodash": "^3.10.1",
"underscore.string": "^3.1.1",
From b370180eab26cca1a7c963b0fb2bca31881c8da0 Mon Sep 17 00:00:00 2001
From: kingcody
Date: Sat, 5 Sep 2015 23:52:16 -0400
Subject: [PATCH 0025/1129] fix(gen): force config update when it exists and
`skipConfig == false`
Requires DaftMonk/generator-ng-component#21
---
app/generator.js | 22 ++++++++++++----------
1 file changed, 12 insertions(+), 10 deletions(-)
diff --git a/app/generator.js b/app/generator.js
index 715c1f4b3..43913c852 100644
--- a/app/generator.js
+++ b/app/generator.js
@@ -44,8 +44,9 @@ export default class Generator extends Base {
checkForConfig: function() {
var cb = this.async();
+ var existingFilters = this.config.get('filters');
- if(this.config.get('filters')) {
+ if(existingFilters) {
this.prompt([{
type: 'confirm',
name: 'skipConfig',
@@ -54,14 +55,14 @@ export default class Generator extends Base {
}], function (answers) {
this.skipConfig = answers.skipConfig;
- this.filters = this.lodash.defaults(this.config.get('filters'), {
- bootstrap: true,
- uibootstrap: true,
- jasmine: true
- });
-
- this.config.set('filters', this.filters);
- this.config.forceSave();
+ if (this.skipConfig) {
+ this.filters = existingFilters;
+ } else {
+ this.filters = {};
+ this.forceConfig = true;
+ this.config.set('filters', this.filters);
+ this.config.forceSave();
+ }
cb();
}.bind(this));
@@ -357,7 +358,8 @@ export default class Generator extends Base {
'serviceDirectory': appPath,
'filters': filters,
'extensions': extensions,
- 'basePath': 'client'
+ 'basePath': 'client',
+ 'forceConfig': this.forceConfig
}
}, { local: require.resolve('generator-ng-component/app/index.js') });
},
From e1b1c6d9caf4ee092b0f8ed7bf70495bebd7c5ce Mon Sep 17 00:00:00 2001
From: Andrew Koroluk
Date: Mon, 7 Sep 2015 17:52:20 -0400
Subject: [PATCH 0026/1129] 3.0.0-rc7
---
package.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/package.json b/package.json
index 5cf9f2284..3c7fad767 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "generator-angular-fullstack",
- "version": "3.0.0-rc6",
+ "version": "3.0.0-rc7",
"description": "Yeoman generator for creating MEAN stack applications, using MongoDB, Express, AngularJS, and Node",
"keywords": [
"yeoman-generator",
From 72e046a4a3af1776f7c0375a0c1d2944518da8f7 Mon Sep 17 00:00:00 2001
From: Cody Mize
Date: Tue, 8 Sep 2015 00:37:06 -0400
Subject: [PATCH 0027/1129] fix(app): load babel if development or test env
---
app/templates/server/index.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/templates/server/index.js b/app/templates/server/index.js
index 7a1b65b99..371600910 100644
--- a/app/templates/server/index.js
+++ b/app/templates/server/index.js
@@ -3,7 +3,7 @@
// Set default node environment to development
var env = process.env.NODE_ENV = process.env.NODE_ENV || 'development';
-if (env === 'production' || env === 'test') {
+if (env === 'development' || env === 'test') {
// Register the Babel require hook
require('babel-core/register');
}
From ac39051b6349eb5eba8b2d347261c4358ac6e740 Mon Sep 17 00:00:00 2001
From: kingcody
Date: Mon, 7 Sep 2015 20:19:45 -0400
Subject: [PATCH 0028/1129] feat(auth): add confirm password to signup and
settings
Originally submitted by @thomporter
Closes #484
---
app/generator.js | 1 +
app/templates/_bower.json | 9 +++++----
.../settings/settings(html).html | 14 ++++++++++++++
.../settings/settings(jade).jade | 19 +++++++++++++++++--
.../account(auth)/signup/signup(html).html | 12 ++++++++++++
.../account(auth)/signup/signup(jade).jade | 17 ++++++++++++++++-
.../e2e/account(auth)/signup/signup.po.js | 1 +
.../signup/signup.spec(jasmine).js | 5 ++++-
.../signup/signup.spec(mocha).js | 5 ++++-
9 files changed, 74 insertions(+), 9 deletions(-)
diff --git a/app/generator.js b/app/generator.js
index 43913c852..f8721854b 100644
--- a/app/generator.js
+++ b/app/generator.js
@@ -374,6 +374,7 @@ export default class Generator extends Base {
if(this.filters.socketio) angModules.push("'btford.socket-io'");
if(this.filters.uirouter) angModules.push("'ui.router'");
if(this.filters.uibootstrap) angModules.push("'ui.bootstrap'");
+ if(this.filters.auth) angModules.push("'validation.match'");
this.angularModules = '\n ' + angModules.join(',\n ') +'\n';
}
diff --git a/app/templates/_bower.json b/app/templates/_bower.json
index 85e8835ed..71d2f97a3 100644
--- a/app/templates/_bower.json
+++ b/app/templates/_bower.json
@@ -4,18 +4,19 @@
"dependencies": {
"angular": "~1.4.0",
"json3": "~3.3.1",
- "es5-shim": "~3.0.1",<% if(filters.bootstrap) { %><% if (filters.sass) { %>
+ "es5-shim": "~3.0.1",<% if(filters.bootstrap) { if (filters.sass) { %>
"bootstrap-sass-official": "~3.1.1",<% } %>
"bootstrap": "~3.1.1",<% } %>
"angular-resource": "~1.4.0",
"angular-cookies": "~1.4.0",
"angular-sanitize": "~1.4.0",<% if (filters.ngroute) { %>
- "angular-route": "~1.4.0",<% } %><% if (filters.uibootstrap) { %>
+ "angular-route": "~1.4.0",<% } if (filters.uibootstrap) { %>
"angular-bootstrap": "~0.13.0",<% } %>
"font-awesome": ">=4.1.0",
"lodash": "~2.4.1"<% if(filters.socketio) { %>,
- "angular-socket-io": "~0.7.0"<% } %><% if(filters.uirouter) { %>,
- "angular-ui-router": "~0.2.15"<% } %>
+ "angular-socket-io": "~0.7.0"<% } if (filters.uirouter) { %>,
+ "angular-ui-router": "~0.2.15"<% } if (filters.auth) { %>,
+ "angular-validation-match": "~1.5.2"<% } %>
},
"devDependencies": {
"angular-mocks": "~1.4.0"
diff --git a/app/templates/client/app/account(auth)/settings/settings(html).html b/app/templates/client/app/account(auth)/settings/settings(html).html
index ec4e2d820..92ee40aa4 100644
--- a/app/templates/client/app/account(auth)/settings/settings(html).html
+++ b/app/templates/client/app/account(auth)/settings/settings(html).html
@@ -30,6 +30,20 @@ Change Password
+
+
{{ message }}
diff --git a/app/templates/client/app/account(auth)/settings/settings(jade).jade b/app/templates/client/app/account(auth)/settings/settings(jade).jade
index 96340b522..701215380 100644
--- a/app/templates/client/app/account(auth)/settings/settings(jade).jade
+++ b/app/templates/client/app/account(auth)/settings/settings(jade).jade
@@ -7,14 +7,29 @@ navbar
form.form(name='form', ng-submit='changePassword(form)', novalidate='')
.form-group
label Current Password
- input.form-control(type='password', name='password', ng-model='user.oldPassword', mongoose-error='')
+ input.form-control(type='password'
+ name='password'
+ ng-model='user.oldPassword'
+ mongoose-error='')
p.help-block(ng-show='form.password.$error.mongoose')
| {{ errors.other }}
.form-group
label New Password
- input.form-control(type='password', name='newPassword', ng-model='user.newPassword', ng-minlength='3', required='')
+ input.form-control(type='password'
+ name='newPassword'
+ ng-model='user.newPassword'
+ ng-minlength='3', required='')
p.help-block(ng-show='(form.newPassword.$error.minlength || form.newPassword.$error.required) && (form.newPassword.$dirty || submitted)')
| Password must be at least 3 characters.
+ .form-group
+ label Confirm New Password
+ input.form-control(type='password'
+ name='confirmPassword'
+ ng-model='user.confirmPassword'
+ match="user.newPassword"
+ ng-minlength='3', required='')
+ p.help-block(ng-show='form.confirmPassword.$error.match && submitted')
+ | Passwords must match.
p.help-block {{ message }}
diff --git a/app/templates/client/app/account(auth)/signup/signup(html).html b/app/templates/client/app/account(auth)/signup/signup(html).html
index 5052a02ee..0a95a7546 100644
--- a/app/templates/client/app/account(auth)/signup/signup(html).html
+++ b/app/templates/client/app/account(auth)/signup/signup(html).html
@@ -54,6 +54,18 @@ Sign up
+
+
-<% if (filters.oauth) {%>
-
-
diff --git a/app/templates/client/app/account(auth)/login/login(jade).jade b/app/templates/client/app/account(auth)/login/login(jade).jade
index 7ef7c0134..2352e8fad 100644
--- a/app/templates/client/app/account(auth)/login/login(jade).jade
+++ b/app/templates/client/app/account(auth)/login/login(jade).jade
@@ -39,16 +39,8 @@ navbar
<% if (filters.oauth) {%>
hr
- div<% if (filters.facebookAuth) {%>
- a.btn.btn-facebook(href='', ng-click='loginOauth("facebook")')
- i.fa.fa-facebook
- | Connect with Facebook
- = ' '<% } %><% if (filters.googleAuth) {%>
- a.btn.btn-google-plus(href='', ng-click='loginOauth("google")')
- i.fa.fa-google-plus
- | Connect with Google+
- = ' '<% } %><% if (filters.twitterAuth) {%>
- a.btn.btn-twitter(href='', ng-click='loginOauth("twitter")')
- i.fa.fa-twitter
- | Connect with Twitter<% } %><% } %>
+ .row
+ .col-sm-4.col-md-3
+ oauth-buttons(classes='btn-block')
+<% } %>
hr
diff --git a/app/templates/client/app/account(auth)/login/login(less).less b/app/templates/client/app/account(auth)/login/login(less).less
deleted file mode 100644
index 6eaecd90c..000000000
--- a/app/templates/client/app/account(auth)/login/login(less).less
+++ /dev/null
@@ -1,30 +0,0 @@
-<% if (filters.bootstrap) { %>// Colors
-// --------------------------------------------------
-
-@btnText: #fff;
-@btnTextAlt: #000;<% if (filters.oauth) { %>
-<% if (filters.facebookAuth) { %>
-@btnFacebookBackground: #3B5998;
-@btnFacebookBackgroundHighlight: #133783;<% } if (filters.twitterAuth) { %>
-@btnTwitterBackground: #2daddc;
-@btnTwitterBackgroundHighlight: #0271bf;<% } if (filters.googleAuth) { %>
-@btnGooglePlusBackground: #dd4b39;
-@btnGooglePlusBackgroundHighlight: #c53727;<% } %>
-@btnGithubBackground: #fafafa;
-@btnGithubBackgroundHighlight: #ccc;
-
-// Social buttons
-// --------------------------------------------------
-<% if (filters.facebookAuth) { %>
-.btn-facebook {
- .button-variant(@btnText; @btnFacebookBackgroundHighlight; @btnFacebookBackgroundHighlight);
-}<% } if (filters.twitterAuth) { %>
-.btn-twitter {
- .button-variant(@btnText; @btnTwitterBackground; @btnTwitterBackgroundHighlight);
-}<% } if (filters.googleAuth) { %>
-.btn-google-plus {
- .button-variant(@btnText; @btnGooglePlusBackground; @btnGooglePlusBackgroundHighlight);
-}<% } %>
-.btn-github {
- .button-variant(@btnTextAlt; @btnGithubBackground; @btnGithubBackgroundHighlight);
-}<% } %><% } %>
diff --git a/app/templates/client/app/account(auth)/login/login(sass).scss b/app/templates/client/app/account(auth)/login/login(sass).scss
deleted file mode 100644
index 5b6956124..000000000
--- a/app/templates/client/app/account(auth)/login/login(sass).scss
+++ /dev/null
@@ -1,30 +0,0 @@
-<% if (filters.bootstrap) { %>// Colors
-// --------------------------------------------------
-
-$btnText: #fff;
-$btnTextAlt: #000;<% if (filters.oauth) { %>
-<% if (filters.facebookAuth) { %>
-$btnFacebookBackground: #3B5998;
-$btnFacebookBackgroundHighlight: #133783;<% } if (filters.twitterAuth) { %>
-$btnTwitterBackground: #2daddc;
-$btnTwitterBackgroundHighlight: #0271bf;<% } if (filters.googleAuth) { %>
-$btnGooglePlusBackground: #dd4b39;
-$btnGooglePlusBackgroundHighlight: #c53727;<% } %>
-$btnGithubBackground: #fafafa;
-$btnGithubBackgroundHighlight: #ccc;
-
-// Social buttons
-// --------------------------------------------------
-<% if (filters.facebookAuth) { %>
-.btn-facebook {
- @include button-variant($btnText, $btnFacebookBackgroundHighlight, $btnFacebookBackgroundHighlight);
-}<% } if (filters.twitterAuth) { %>
-.btn-twitter {
- @include button-variant($btnText, $btnTwitterBackground, $btnTwitterBackgroundHighlight);
-}<% } if (filters.googleAuth) { %>
-.btn-google-plus {
- @include button-variant($btnText, $btnGooglePlusBackground, $btnGooglePlusBackgroundHighlight);
-}<% } %>
-.btn-github {
- @include button-variant($btnTextAlt, $btnGithubBackground, $btnGithubBackgroundHighlight);
-}<% } %><% } %>
diff --git a/app/templates/client/app/account(auth)/login/login(stylus).styl b/app/templates/client/app/account(auth)/login/login(stylus).styl
deleted file mode 100644
index 3dc78ee9d..000000000
--- a/app/templates/client/app/account(auth)/login/login(stylus).styl
+++ /dev/null
@@ -1,22 +0,0 @@
-<% if (filters.oauth) { %>// Social buttons
-// --------------------------------------------------
-<% if (filters.facebookAuth) { %>
-.btn-facebook
- color: #fff;
- background-color: #3B5998;
- border-color: #133783;
-<% } if (filters.twitterAuth) { %>
-.btn-twitter
- color: #fff;
- background-color: #2daddc;
- border-color: #0271bf;
-<% } if (filters.googleAuth) { %>
-.btn-google-plus
- color: #fff;
- background-color: #dd4b39;
- border-color: #c53727;
-<% } %>
-.btn-github
- color: #fff;
- background-color: #fafafa;
- border-color: #ccc;<% } %>
diff --git a/app/templates/client/app/account(auth)/login/login.controller(coffee).coffee b/app/templates/client/app/account(auth)/login/login.controller(coffee).coffee
index 7bcb69969..2ba501a42 100644
--- a/app/templates/client/app/account(auth)/login/login.controller(coffee).coffee
+++ b/app/templates/client/app/account(auth)/login/login.controller(coffee).coffee
@@ -1,7 +1,7 @@
'use strict'
angular.module '<%= scriptAppName %>'
-.controller 'LoginCtrl', ($scope, Auth<% if (filters.ngroute) { %>, $location<% } %><% if (filters.uirouter) { %>, $state<% } %><% if (filters.oauth) {%>, $window<% } %>) ->
+.controller 'LoginCtrl', ($scope, Auth<% if (filters.ngroute) { %>, $location<% } %><% if (filters.uirouter) { %>, $state<% } %>) ->
$scope.user = {}
$scope.errors = {}
$scope.login = (form) ->
@@ -18,6 +18,3 @@ angular.module '<%= scriptAppName %>'
.catch (err) ->
$scope.errors.other = err.message
-<% if (filters.oauth) {%>
- $scope.loginOauth = (provider) ->
- $window.location.href = '/auth/' + provider<% } %>
diff --git a/app/templates/client/app/account(auth)/login/login.controller(js).js b/app/templates/client/app/account(auth)/login/login.controller(js).js
index 2417e62f4..6e9d5fd7b 100644
--- a/app/templates/client/app/account(auth)/login/login.controller(js).js
+++ b/app/templates/client/app/account(auth)/login/login.controller(js).js
@@ -1,7 +1,7 @@
'use strict';
angular.module('<%= scriptAppName %>')
- .controller('LoginCtrl', function($scope, Auth<% if (filters.ngroute) { %>, $location<% } %><% if (filters.uirouter) { %>, $state<% } %><% if (filters.oauth) { %>, $window<% } %>) {
+ .controller('LoginCtrl', function($scope, Auth<% if (filters.ngroute) { %>, $location<% } %><% if (filters.uirouter) { %>, $state<% } %>) {
$scope.user = {};
$scope.errors = {};
@@ -22,8 +22,5 @@ angular.module('<%= scriptAppName %>')
});
}
};
-<% if (filters.oauth) {%>
- $scope.loginOauth = function(provider) {
- $window.location.href = '/auth/' + provider;
- };<% } %>
+
});
diff --git a/app/templates/client/app/account(auth)/signup/signup(html).html b/app/templates/client/app/account(auth)/signup/signup(html).html
index 0a95a7546..84f4451e0 100644
--- a/app/templates/client/app/account(auth)/signup/signup(html).html
+++ b/app/templates/client/app/account(auth)/signup/signup(html).html
@@ -74,18 +74,12 @@ Sign up
Login
-<% if (filters.oauth) {%>
-
-
diff --git a/app/templates/client/app/account(auth)/signup/signup(jade).jade b/app/templates/client/app/account(auth)/signup/signup(jade).jade
index 2b9fda0c5..139dd2941 100644
--- a/app/templates/client/app/account(auth)/signup/signup(jade).jade
+++ b/app/templates/client/app/account(auth)/signup/signup(jade).jade
@@ -53,20 +53,11 @@ navbar
= ' '
a.btn.btn-default.btn-lg.btn-login(<% if (filters.uirouter) { %>ui-sref='login'<% } else { %>href='http://github.com/login'<% } %>)
| Login
-
<% if (filters.oauth) {%>
hr
- div<% if (filters.facebookAuth) {%>
- a.btn.btn-facebook(href='', ng-click='loginOauth("facebook")')
- i.fa.fa-facebook
- | Connect with Facebook
- = ' '<% } %><% if (filters.googleAuth) {%>
- a.btn.btn-google-plus(href='', ng-click='loginOauth("google")')
- i.fa.fa-google-plus
- | Connect with Google+
- = ' '<% } %><% if (filters.twitterAuth) {%>
- a.btn.btn-twitter(href='', ng-click='loginOauth("twitter")')
- i.fa.fa-twitter
- | Connect with Twitter<% } %><% } %>
+ .row
+ .col-sm-4.col-md-3
+ oauth-buttons(classes='btn-block')
+<% } %>
hr
diff --git a/app/templates/client/app/account(auth)/signup/signup.controller(coffee).coffee b/app/templates/client/app/account(auth)/signup/signup.controller(coffee).coffee
index d167b7e30..68952a74d 100644
--- a/app/templates/client/app/account(auth)/signup/signup.controller(coffee).coffee
+++ b/app/templates/client/app/account(auth)/signup/signup.controller(coffee).coffee
@@ -1,7 +1,7 @@
'use strict'
angular.module '<%= scriptAppName %>'
-.controller 'SignupCtrl', ($scope, Auth<% if (filters.ngroute) { %>, $location<% } %><% if (filters.uirouter) { %>, $state<% } %><% if (filters.oauth) {%>, $window<% } %>) ->
+.controller 'SignupCtrl', ($scope, Auth<% if (filters.ngroute) { %>, $location<% } %><% if (filters.uirouter) { %>, $state<% } %>) ->
$scope.user = {}
$scope.errors = {}
$scope.register = (form) ->
@@ -31,6 +31,3 @@ angular.module '<%= scriptAppName %>'
angular.forEach err.fields, (field) ->
form[field].$setValidity 'mongoose', false
$scope.errors[field] = err.message<% } %>
-<% if (filters.oauth) {%>
- $scope.loginOauth = (provider) ->
- $window.location.href = '/auth/' + provider<% } %>
diff --git a/app/templates/client/app/account(auth)/signup/signup.controller(js).js b/app/templates/client/app/account(auth)/signup/signup.controller(js).js
index 346eb7ea7..405461a1f 100644
--- a/app/templates/client/app/account(auth)/signup/signup.controller(js).js
+++ b/app/templates/client/app/account(auth)/signup/signup.controller(js).js
@@ -1,7 +1,7 @@
'use strict';
angular.module('<%= scriptAppName %>')
- .controller('SignupCtrl', function($scope, Auth<% if (filters.ngroute) { %>, $location<% } %><% if (filters.uirouter) { %>, $state<% } %><% if (filters.oauth) { %>, $window<% } %>) {
+ .controller('SignupCtrl', function($scope, Auth<% if (filters.ngroute) { %>, $location<% } %><% if (filters.uirouter) { %>, $state<% } %>) {
$scope.user = {};
$scope.errors = {};
@@ -38,8 +38,5 @@ angular.module('<%= scriptAppName %>')
});
}
};
-<% if (filters.oauth) {%>
- $scope.loginOauth = function(provider) {
- $window.location.href = '/auth/' + provider;
- };<% } %>
+
});
diff --git a/app/templates/client/app/app(less).less b/app/templates/client/app/app(less).less
index cbfffbe88..9cfcfdb16 100644
--- a/app/templates/client/app/app(less).less
+++ b/app/templates/client/app/app(less).less
@@ -1,5 +1,6 @@
-<% if (filters.bootstrap) { %>@import 'http://github.com/bower_components/bootstrap/less/bootstrap.less';<% } %>
-@import 'http://github.com/bower_components/font-awesome/less/font-awesome.less';
+<% if (filters.bootstrap) { %>@import 'http://github.com/bower_components/bootstrap/less/bootstrap.less';
+<% if(filters.oauth) { %>@import 'http://github.com/bower_components/bootstrap-social/bootstrap-social.less';
+<% }} %>@import 'http://github.com/bower_components/font-awesome/less/font-awesome.less';
<% if (filters.bootstrap) { %>@icon-font-path: '../bower_components/bootstrap/fonts/';<% } %>
@fa-font-path: '../bower_components/font-awesome/fonts';
diff --git a/app/templates/client/app/app(sass).scss b/app/templates/client/app/app(sass).scss
index 889878aee..e20f3f0ad 100644
--- a/app/templates/client/app/app(sass).scss
+++ b/app/templates/client/app/app(sass).scss
@@ -1,7 +1,7 @@
-<% if (filters.bootstrap) { %>$icon-font-path: "../bower_components/bootstrap-sass-official/vendor/assets/fonts/bootstrap/";<% } %>
-$fa-font-path: "../bower_components/font-awesome/fonts";
-<% if (filters.bootstrap) { %>
-@import 'http://github.com/bower_components/bootstrap-sass-official/vendor/assets/stylesheets/bootstrap';<% } %>
+<% if (filters.bootstrap) { %>$icon-font-path: "../bower_components/bootstrap-sass-official/vendor/assets/fonts/bootstrap/";
+@import 'http://github.com/bower_components/bootstrap-sass-official/vendor/assets/stylesheets/bootstrap';
+<% if(filters.oauth) { %>@import 'http://github.com/bower_components/bootstrap-social/bootstrap-social.scss';
+<% }} %>$fa-font-path: "../bower_components/font-awesome/fonts";
@import 'http://github.com/bower_components/font-awesome/scss/font-awesome';
/**
diff --git a/app/templates/client/app/app(stylus).styl b/app/templates/client/app/app(stylus).styl
index d25cdfc59..de156ca97 100644
--- a/app/templates/client/app/app(stylus).styl
+++ b/app/templates/client/app/app(stylus).styl
@@ -1,6 +1,7 @@
@import "http://github.com/bower_components/font-awesome/css/font-awesome.css"
<% if (filters.bootstrap) { %>@import "http://github.com/bower_components/bootstrap/dist/css/bootstrap.css"
-
+<% if (filters.oauth) { %>@import "http://github.com/bower_components/bootstrap-social/bootstrap-social.css"
+<% } %>
//
// Bootstrap Fonts
//
diff --git a/app/templates/client/components/oauth-buttons(oauth)/oath-buttons(html).html b/app/templates/client/components/oauth-buttons(oauth)/oath-buttons(html).html
new file mode 100644
index 000000000..5ea19425f
--- /dev/null
+++ b/app/templates/client/components/oauth-buttons(oauth)/oath-buttons(html).html
@@ -0,0 +1,12 @@
+<% if(filters.facebookAuth) { %>
+
+ Connect with Facebook
+
+<% } if (filters.googleAuth) { %>
+
+ Connect with Google+
+
+<% } if (filters.twitterAuth) { %><% } %>
diff --git a/app/templates/client/app/account(auth)/login/login(css).css b/app/templates/client/components/oauth-buttons(oauth)/oauth-buttons(css).css
similarity index 61%
rename from app/templates/client/app/account(auth)/login/login(css).css
rename to app/templates/client/components/oauth-buttons(oauth)/oauth-buttons(css).css
index 7c865ffc6..be33316e0 100644
--- a/app/templates/client/app/account(auth)/login/login(css).css
+++ b/app/templates/client/components/oauth-buttons(oauth)/oauth-buttons(css).css
@@ -1,22 +1,19 @@
-<% if (filters.oauth) { %><% if (filters.facebookAuth) { %>.btn-facebook {
+<% if (!filters.bootstrap) { if (filters.facebookAuth) { %>.btn-facebook {
color: #fff;
background-color: #3B5998;
border-color: #133783;
}
-<% } if (filters.twitterAuth) { %>
-.btn-twitter {
- color: #fff;
- background-color: #2daddc;
- border-color: #0271bf;
-}
-<% } if (filters.googleAuth) { %>
-.btn-google-plus {
+<% } if (filters.googleAuth) { %>.btn-google {
color: #fff;
background-color: #dd4b39;
border-color: #c53727;
}
-<% } %>
-.btn-github {
+<% } if (filters.twitterAuth) { %>.btn-twitter {
+ color: #fff;
+ background-color: #2daddc;
+ border-color: #0271bf;
+}
+<% } %>.btn-github {
color: #fff;
background-color: #fafafa;
border-color: #ccc;
diff --git a/app/templates/client/components/oauth-buttons(oauth)/oauth-buttons(jade).jade b/app/templates/client/components/oauth-buttons(oauth)/oauth-buttons(jade).jade
new file mode 100644
index 000000000..fd5030bd7
--- /dev/null
+++ b/app/templates/client/components/oauth-buttons(oauth)/oauth-buttons(jade).jade
@@ -0,0 +1,14 @@
+<% if(filters.facebookAuth) { %>a.btn<% if (filters.bootstrap) { %>.btn-social<% } %>.btn-facebook(ng-class='classes'
+ ng-click='OauthButtons.loginOauth("facebook")')
+ i.fa.fa-facebook
+ | Connect with Facebook
+
+<% } if(filters.googleAuth) { %>a.btn<% if (filters.bootstrap) { %>.btn-social<% } %>.btn-google(ng-class='classes'
+ ng-click='OauthButtons.loginOauth("google")')
+ i.fa.fa-google-plus
+ | Connect with Google+
+
+<% } if(filters.twitterAuth) { %>a.btn<% if (filters.bootstrap) { %>.btn-social<% } %>.btn-twitter(ng-class='classes'
+ ng-click='OauthButtons.loginOauth("twitter")')
+ i.fa.fa-twitter
+ | Connect with Twitter<% } %>
diff --git a/app/templates/client/components/oauth-buttons(oauth)/oauth-buttons(less).less b/app/templates/client/components/oauth-buttons(oauth)/oauth-buttons(less).less
new file mode 100644
index 000000000..be33316e0
--- /dev/null
+++ b/app/templates/client/components/oauth-buttons(oauth)/oauth-buttons(less).less
@@ -0,0 +1,20 @@
+<% if (!filters.bootstrap) { if (filters.facebookAuth) { %>.btn-facebook {
+ color: #fff;
+ background-color: #3B5998;
+ border-color: #133783;
+}
+<% } if (filters.googleAuth) { %>.btn-google {
+ color: #fff;
+ background-color: #dd4b39;
+ border-color: #c53727;
+}
+<% } if (filters.twitterAuth) { %>.btn-twitter {
+ color: #fff;
+ background-color: #2daddc;
+ border-color: #0271bf;
+}
+<% } %>.btn-github {
+ color: #fff;
+ background-color: #fafafa;
+ border-color: #ccc;
+}<% } %>
diff --git a/app/templates/client/components/oauth-buttons(oauth)/oauth-buttons(sass).scss b/app/templates/client/components/oauth-buttons(oauth)/oauth-buttons(sass).scss
new file mode 100644
index 000000000..be33316e0
--- /dev/null
+++ b/app/templates/client/components/oauth-buttons(oauth)/oauth-buttons(sass).scss
@@ -0,0 +1,20 @@
+<% if (!filters.bootstrap) { if (filters.facebookAuth) { %>.btn-facebook {
+ color: #fff;
+ background-color: #3B5998;
+ border-color: #133783;
+}
+<% } if (filters.googleAuth) { %>.btn-google {
+ color: #fff;
+ background-color: #dd4b39;
+ border-color: #c53727;
+}
+<% } if (filters.twitterAuth) { %>.btn-twitter {
+ color: #fff;
+ background-color: #2daddc;
+ border-color: #0271bf;
+}
+<% } %>.btn-github {
+ color: #fff;
+ background-color: #fafafa;
+ border-color: #ccc;
+}<% } %>
diff --git a/app/templates/client/components/oauth-buttons(oauth)/oauth-buttons(stylus).styl b/app/templates/client/components/oauth-buttons(oauth)/oauth-buttons(stylus).styl
new file mode 100644
index 000000000..995d4c766
--- /dev/null
+++ b/app/templates/client/components/oauth-buttons(oauth)/oauth-buttons(stylus).styl
@@ -0,0 +1,16 @@
+<% if (!filters.bootstrap) { if (filters.facebookAuth) { %>.btn-facebook
+ color #fff
+ background-color #3B5998
+ border-color #133783
+<% } if (filters.googleAuth) { %>.btn-google
+ color #fff
+ background-color #dd4b39
+ border-color #c53727
+<% } if (filters.twitterAuth) { %>.btn-twitter
+ color #fff
+ background-color #2daddc
+ border-color #0271bf
+<% } %>.btn-github
+ color #fff
+ background-color #fafafa
+ border-color #ccc<% } %>
diff --git a/app/templates/client/components/oauth-buttons(oauth)/oauth-buttons.controller(coffee).coffee b/app/templates/client/components/oauth-buttons(oauth)/oauth-buttons.controller(coffee).coffee
new file mode 100644
index 000000000..4dca2832f
--- /dev/null
+++ b/app/templates/client/components/oauth-buttons(oauth)/oauth-buttons.controller(coffee).coffee
@@ -0,0 +1,7 @@
+'use strict'
+
+angular.module('<%= scriptAppName %>')
+.controller 'OauthButtonsCtrl', ($window) ->
+ @loginOauth = (provider) ->
+ $window.location.href = '/auth/' + provider
+ return;
diff --git a/app/templates/client/components/oauth-buttons(oauth)/oauth-buttons.controller(js).js b/app/templates/client/components/oauth-buttons(oauth)/oauth-buttons.controller(js).js
new file mode 100644
index 000000000..36d5d6467
--- /dev/null
+++ b/app/templates/client/components/oauth-buttons(oauth)/oauth-buttons.controller(js).js
@@ -0,0 +1,8 @@
+'use strict';
+
+angular.module('<%= scriptAppName %>')
+ .controller('OauthButtonsCtrl', function($window) {
+ this.loginOauth = function(provider) {
+ $window.location.href = '/auth/' + provider;
+ };
+ });
diff --git a/app/templates/client/components/oauth-buttons(oauth)/oauth-buttons.controller.spec(coffee).coffee b/app/templates/client/components/oauth-buttons(oauth)/oauth-buttons.controller.spec(coffee).coffee
new file mode 100644
index 000000000..59b4dd9e4
--- /dev/null
+++ b/app/templates/client/components/oauth-buttons(oauth)/oauth-buttons.controller.spec(coffee).coffee
@@ -0,0 +1,20 @@
+'use strict'
+
+describe 'Controller: OauthButtonsCtrl', ->
+ # load the controller's module
+ beforeEach module('<%= scriptAppName %>')
+
+ OauthButtonsCtrl = null
+ $window = null
+
+ # Initialize the controller and a mock $window
+ beforeEach inject ($controller) ->
+ $window = location: {}
+ OauthButtonsCtrl = $controller 'OauthButtonsCtrl', $window: $window
+ return
+
+ it 'should attach loginOauth', -><% if (filters.jasmine) { %>
+ expect(OauthButtonsCtrl.loginOauth).toEqual jasmine.any Function<% } if (filters.mocha) { %>
+ <%= expect() %>OauthButtonsCtrl.loginOauth<%= to() %>.be.a 'function' <% } %>
+ return
+ return
diff --git a/app/templates/client/components/oauth-buttons(oauth)/oauth-buttons.controller.spec(js).js b/app/templates/client/components/oauth-buttons(oauth)/oauth-buttons.controller.spec(js).js
new file mode 100644
index 000000000..144745e5e
--- /dev/null
+++ b/app/templates/client/components/oauth-buttons(oauth)/oauth-buttons.controller.spec(js).js
@@ -0,0 +1,25 @@
+'use strict';
+
+describe('Controller: OauthButtonsCtrl', function() {
+
+ // load the controller's module
+ beforeEach(module('<%= scriptAppName %>'));
+
+ var OauthButtonsCtrl, $window;
+
+ // Initialize the controller and a mock $window
+ beforeEach(inject(function($controller) {
+ $window = {
+ location: {}
+ };
+
+ OauthButtonsCtrl = $controller('OauthButtonsCtrl', {
+ $window: $window
+ });
+ }));
+
+ it('should attach loginOauth', function() {<% if (filters.jasmine) { %>
+ expect(OauthButtonsCtrl.loginOauth).toEqual(jasmine.any(Function));<% } if (filters.mocha) { %>
+ <%= expect() %>OauthButtonsCtrl.loginOauth<%= to() %>.be.a('function');<% } %>
+ });
+});
diff --git a/app/templates/client/components/oauth-buttons(oauth)/oauth-buttons.directive(coffee).coffee b/app/templates/client/components/oauth-buttons(oauth)/oauth-buttons.directive(coffee).coffee
new file mode 100644
index 000000000..f009e5b1d
--- /dev/null
+++ b/app/templates/client/components/oauth-buttons(oauth)/oauth-buttons.directive(coffee).coffee
@@ -0,0 +1,9 @@
+'use strict'
+
+angular.module('<%= scriptAppName %>')
+.directive 'oauthButtons', ->
+ templateUrl: 'components/oauth-buttons/oauth-buttons.html'
+ restrict: 'EA'
+ controller: 'OauthButtonsCtrl'
+ controllerAs: 'OauthButtons'
+ scope: classes: '@'
diff --git a/app/templates/client/components/oauth-buttons(oauth)/oauth-buttons.directive(js).js b/app/templates/client/components/oauth-buttons(oauth)/oauth-buttons.directive(js).js
new file mode 100644
index 000000000..401f669e3
--- /dev/null
+++ b/app/templates/client/components/oauth-buttons(oauth)/oauth-buttons.directive(js).js
@@ -0,0 +1,14 @@
+'use strict';
+
+angular.module('<%= scriptAppName %>')
+ .directive('oauthButtons', function() {
+ return {
+ templateUrl: 'components/oauth-buttons/oauth-buttons.html',
+ restrict: 'EA',
+ controller: 'OauthButtonsCtrl',
+ controllerAs: 'OauthButtons',
+ scope: {
+ classes: '@'
+ }
+ };
+ });
diff --git a/app/templates/client/components/oauth-buttons(oauth)/oauth-buttons.directive.spec(coffee).coffee b/app/templates/client/components/oauth-buttons(oauth)/oauth-buttons.directive.spec(coffee).coffee
new file mode 100644
index 000000000..903d05476
--- /dev/null
+++ b/app/templates/client/components/oauth-buttons(oauth)/oauth-buttons.directive.spec(coffee).coffee
@@ -0,0 +1,51 @@
+'use strict'
+
+describe 'Directive: oauthButtons', ->
+ # load the directive's module and view
+ beforeEach module('<%= scriptAppName %>')
+ beforeEach module('components/oauth-buttons/oauth-buttons.html')
+
+ element = null
+ parentScope = null
+ elementScope = null
+
+ compileDirective = (template) ->
+ inject ($compile) ->
+ element = angular.element template
+ element = $compile(element) parentScope
+ parentScope.$digest()
+ elementScope = element.isolateScope()
+
+ beforeEach inject ($rootScope) ->
+ parentScope = $rootScope.$new()
+
+ it 'should contain anchor buttons', ->
+ compileDirective ''<% if (filters.jasmine) { %>
+ expect(element.find('a.btn<% if (filters.bootstrap) { %>.btn-social<% } %>').length).toBeGreaterThan 0<% } if (filters.mocha) { %>
+ <%= expect() %>element.find('a.btn<% if (filters.bootstrap) { %>.btn-social<% } %>').length<%= to() %>.be.at.least 1<% } %>
+ return
+
+ it 'should evaluate and bind the classes attribute to scope.classes', ->
+ parentScope.scopedClass = 'scopedClass1'
+ compileDirective ''<% if (filters.jasmine) { %>
+ expect(elementScope.classes).toEqual 'testClass1 scopedClass1'<% } if (filters.mocha) { %>
+ <%= expect() %>elementScope.classes<%= to() %>.equal 'testClass1 scopedClass1'<% } %>
+ return
+
+ it 'should bind scope.classes to class names on the anchor buttons', ->
+ compileDirective ''
+
+ # Add classes
+ elementScope.classes = 'testClass1 testClass2'
+ elementScope.$digest()<% if (filters.jasmine) { %>
+ expect(element.find('a.btn<% if (filters.bootstrap) { %>.btn-social<% } %>.testClass1.testClass2').length).toBeGreaterThan 0<% } if (filters.mocha) { %>
+ <%= expect() %>element.find('a.btn<% if (filters.bootstrap) { %>.btn-social<% } %>.testClass1.testClass2').length<%= to() %>.be.at.least 1<% } %>
+
+ # Remove classes
+ elementScope.classes = ''
+ elementScope.$digest()<% if (filters.jasmine) { %>
+ expect(element.find('a.btn<% if (filters.bootstrap) { %>.btn-social<% } %>.testClass1.testClass2').length).toEqual 0<% } if (filters.mocha) { %>
+ <%= expect() %>element.find('a.btn<% if (filters.bootstrap) { %>.btn-social<% } %>.testClass1.testClass2').length<%= to() %>.equal 0<% } %>
+
+ return
+ return
diff --git a/app/templates/client/components/oauth-buttons(oauth)/oauth-buttons.directive.spec(js).js b/app/templates/client/components/oauth-buttons(oauth)/oauth-buttons.directive.spec(js).js
new file mode 100644
index 000000000..14682cc6e
--- /dev/null
+++ b/app/templates/client/components/oauth-buttons(oauth)/oauth-buttons.directive.spec(js).js
@@ -0,0 +1,51 @@
+'use strict';
+
+describe('Directive: oauthButtons', function() {
+
+ // load the directive's module and view
+ beforeEach(module('<%= scriptAppName %>'));
+ beforeEach(module('components/oauth-buttons/oauth-buttons.html'));
+
+ var element, parentScope, elementScope;
+
+ var compileDirective = function(template) {
+ inject(function($compile) {
+ element = angular.element(template);
+ element = $compile(element)(parentScope);
+ parentScope.$digest();
+ elementScope = element.isolateScope();
+ });
+ };
+
+ beforeEach(inject(function($rootScope) {
+ parentScope = $rootScope.$new();
+ }));
+
+ it('should contain anchor buttons', function() {
+ compileDirective('');<% if (filters.jasmine) { %>
+ expect(element.find('a.btn<% if (filters.bootstrap) { %>.btn-social<% } %>').length).toBeGreaterThan(0);<% } if (filters.mocha) { %>
+ <%= expect() %>element.find('a.btn<% if (filters.bootstrap) { %>.btn-social<% } %>').length<%= to() %>.be.at.least(1);<% } %>
+ });
+
+ it('should evaluate and bind the classes attribute to scope.classes', function() {
+ parentScope.scopedClass = 'scopedClass1';
+ compileDirective('');<% if (filters.jasmine) { %>
+ expect(elementScope.classes).toEqual('testClass1 scopedClass1');<% } if (filters.mocha) { %>
+ <%= expect() %>elementScope.classes<%= to() %>.equal('testClass1 scopedClass1');<% } %>
+ });
+
+ it('should bind scope.classes to class names on the anchor buttons', function() {
+ compileDirective('');
+ // Add classes
+ elementScope.classes = 'testClass1 testClass2';
+ elementScope.$digest();<% if (filters.jasmine) { %>
+ expect(element.find('a.btn<% if (filters.bootstrap) { %>.btn-social<% } %>.testClass1.testClass2').length).toBeGreaterThan(0);<% } if (filters.mocha) { %>
+ <%= expect() %>element.find('a.btn<% if (filters.bootstrap) { %>.btn-social<% } %>.testClass1.testClass2').length<%= to() %>.be.at.least(1);<% } %>
+
+ // Remove classes
+ elementScope.classes = '';
+ elementScope.$digest();<% if (filters.jasmine) { %>
+ expect(element.find('a.btn<% if (filters.bootstrap) { %>.btn-social<% } %>.testClass1.testClass2').length).toEqual(0);<% } if (filters.mocha) { %>
+ <%= expect() %>element.find('a.btn<% if (filters.bootstrap) { %>.btn-social<% } %>.testClass1.testClass2').length<%= to() %>.equal(0);<% } %>
+ });
+});
diff --git a/app/templates/e2e/account(auth)/login/login.po.js b/app/templates/e2e/account(auth)/login/login.po.js
index 1186cdb6b..045204754 100644
--- a/app/templates/e2e/account(auth)/login/login.po.js
+++ b/app/templates/e2e/account(auth)/login/login.po.js
@@ -6,20 +6,21 @@
'use strict';
var LoginPage = function() {
- this.form = element(by.css('.form'));
- this.form.email = this.form.element(by.model('user.email'));
- this.form.password = this.form.element(by.model('user.password'));
- this.form.submit = this.form.element(by.css('.btn-login'));
+ var form = this.form = element(by.css('.form'));
+ form.email = form.element(by.model('user.email'));
+ form.password = form.element(by.model('user.password'));
+ form.submit = form.element(by.css('.btn-login'));<% if (filters.oauth) { %>
+ form.oauthButtons = require('../../components/oauth-buttons/oauth-buttons.po').oauthButtons;<% } %>
this.login = function(data) {
for (var prop in data) {
- var formElem = this.form[prop];
+ var formElem = form[prop];
if (data.hasOwnProperty(prop) && formElem && typeof formElem.sendKeys === 'function') {
formElem.sendKeys(data[prop]);
}
}
- this.form.submit.click();
+ form.submit.click();
};
};
diff --git a/app/templates/e2e/account(auth)/login/login.spec(jasmine).js b/app/templates/e2e/account(auth)/login/login.spec(jasmine).js
index 568074ccc..6a65fc7cb 100644
--- a/app/templates/e2e/account(auth)/login/login.spec(jasmine).js
+++ b/app/templates/e2e/account(auth)/login/login.spec(jasmine).js
@@ -36,7 +36,16 @@ describe('Login View', function() {
expect(page.form.password.getAttribute('name')).toBe('password');
expect(page.form.submit.getAttribute('type')).toBe('submit');
expect(page.form.submit.getText()).toBe('Login');
- });
+ });<% if (filters.oauth) { %>
+
+ it('should include oauth buttons with correct classes applied', function() {<% if (filters.facebookAuth) { %>
+ expect(page.form.oauthButtons.facebook.getText()).toBe('Connect with Facebook');
+ expect(page.form.oauthButtons.facebook.getAttribute('class')).toMatch('btn-block');<% } if (filters.googleAuth) { %>
+ expect(page.form.oauthButtons.google.getText()).toBe('Connect with Google+');
+ expect(page.form.oauthButtons.google.getAttribute('class')).toMatch('btn-block');<% } if (filters.twitterAuth) { %>
+ expect(page.form.oauthButtons.twitter.getText()).toBe('Connect with Twitter');
+ expect(page.form.oauthButtons.twitter.getAttribute('class')).toMatch('btn-block');<% } %>
+ });<% } %>
describe('with local auth', function() {
diff --git a/app/templates/e2e/account(auth)/login/login.spec(mocha).js b/app/templates/e2e/account(auth)/login/login.spec(mocha).js
index 94268a12e..1fefea5d0 100644
--- a/app/templates/e2e/account(auth)/login/login.spec(mocha).js
+++ b/app/templates/e2e/account(auth)/login/login.spec(mocha).js
@@ -41,7 +41,16 @@ describe('Login View', function() {
<%= expect() %>page.form.password.getAttribute('name')<%= to() %>.eventually.equal('password');
<%= expect() %>page.form.submit.getAttribute('type')<%= to() %>.eventually.equal('submit');
<%= expect() %>page.form.submit.getText()<%= to() %>.eventually.equal('Login');
- });
+ });<% if (filters.oauth) { %>
+
+ it('should include oauth buttons with correct classes applied', function() {<% if (filters.facebookAuth) { %>
+ <%= expect() %>page.form.oauthButtons.facebook.getText()<%= to() %>.eventually.equal('Connect with Facebook');
+ <%= expect() %>page.form.oauthButtons.facebook.getAttribute('class')<%= to() %>.eventually.contain('btn-block');<% } if (filters.googleAuth) { %>
+ <%= expect() %>page.form.oauthButtons.google.getText()<%= to() %>.eventually.equal('Connect with Google+');
+ <%= expect() %>page.form.oauthButtons.google.getAttribute('class')<%= to() %>.eventually.contain('btn-block');<% } if (filters.twitterAuth) { %>
+ <%= expect() %>page.form.oauthButtons.twitter.getText()<%= to() %>.eventually.equal('Connect with Twitter');
+ <%= expect() %>page.form.oauthButtons.twitter.getAttribute('class')<%= to() %>.eventually.contain('btn-block');<% } %>
+ });<% } %>
describe('with local auth', function() {
diff --git a/app/templates/e2e/account(auth)/signup/signup.po.js b/app/templates/e2e/account(auth)/signup/signup.po.js
index e57536915..3a812266c 100644
--- a/app/templates/e2e/account(auth)/signup/signup.po.js
+++ b/app/templates/e2e/account(auth)/signup/signup.po.js
@@ -6,22 +6,23 @@
'use strict';
var SignupPage = function() {
- this.form = element(by.css('.form'));
- this.form.name = this.form.element(by.model('user.name'));
- this.form.email = this.form.element(by.model('user.email'));
- this.form.password = this.form.element(by.model('user.password'));
- this.form.confirmPassword = this.form.element(by.model('user.confirmPassword'))
- this.form.submit = this.form.element(by.css('.btn-register'));
+ var form = this.form = element(by.css('.form'));
+ form.name = form.element(by.model('user.name'));
+ form.email = form.element(by.model('user.email'));
+ form.password = form.element(by.model('user.password'));
+ form.confirmPassword = form.element(by.model('user.confirmPassword'));
+ form.submit = form.element(by.css('.btn-register'));<% if (filters.oauth) { %>
+ form.oauthButtons = require('../../components/oauth-buttons/oauth-buttons.po').oauthButtons;<% } %>
this.signup = function(data) {
for (var prop in data) {
- var formElem = this.form[prop];
+ var formElem = form[prop];
if (data.hasOwnProperty(prop) && formElem && typeof formElem.sendKeys === 'function') {
formElem.sendKeys(data[prop]);
}
}
- this.form.submit.click();
+ form.submit.click();
};
};
diff --git a/app/templates/e2e/account(auth)/signup/signup.spec(jasmine).js b/app/templates/e2e/account(auth)/signup/signup.spec(jasmine).js
index b86749330..903c89817 100644
--- a/app/templates/e2e/account(auth)/signup/signup.spec(jasmine).js
+++ b/app/templates/e2e/account(auth)/signup/signup.spec(jasmine).js
@@ -35,7 +35,16 @@ describe('Signup View', function() {
expect(page.form.confirmPassword.getAttribute('name')).toBe('confirmPassword');
expect(page.form.submit.getAttribute('type')).toBe('submit');
expect(page.form.submit.getText()).toBe('Sign up');
- });
+ });<% if (filters.oauth) { %>
+
+ it('should include oauth buttons with correct classes applied', function() {<% if (filters.facebookAuth) { %>
+ expect(page.form.oauthButtons.facebook.getText()).toBe('Connect with Facebook');
+ expect(page.form.oauthButtons.facebook.getAttribute('class')).toMatch('btn-block');<% } if (filters.googleAuth) { %>
+ expect(page.form.oauthButtons.google.getText()).toBe('Connect with Google+');
+ expect(page.form.oauthButtons.google.getAttribute('class')).toMatch('btn-block');<% } if (filters.twitterAuth) { %>
+ expect(page.form.oauthButtons.twitter.getText()).toBe('Connect with Twitter');
+ expect(page.form.oauthButtons.twitter.getAttribute('class')).toMatch('btn-block');<% } %>
+ });<% } %>
describe('with local auth', function() {
diff --git a/app/templates/e2e/account(auth)/signup/signup.spec(mocha).js b/app/templates/e2e/account(auth)/signup/signup.spec(mocha).js
index e15385192..7578d2796 100644
--- a/app/templates/e2e/account(auth)/signup/signup.spec(mocha).js
+++ b/app/templates/e2e/account(auth)/signup/signup.spec(mocha).js
@@ -40,7 +40,16 @@ describe('Signup View', function() {
<%= expect() %>page.form.confirmPassword.getAttribute('name')<%= to() %>.eventually.equal('confirmPassword');
<%= expect() %>page.form.submit.getAttribute('type')<%= to() %>.eventually.equal('submit');
<%= expect() %>page.form.submit.getText()<%= to() %>.eventually.equal('Sign up');
- });
+ });<% if (filters.oauth) { %>
+
+ it('should include oauth buttons with correct classes applied', function() {<% if (filters.facebookAuth) { %>
+ <%= expect() %>page.form.oauthButtons.facebook.getText()<%= to() %>.eventually.equal('Connect with Facebook');
+ <%= expect() %>page.form.oauthButtons.facebook.getAttribute('class')<%= to() %>.eventually.contain('btn-block');<% } if (filters.googleAuth) { %>
+ <%= expect() %>page.form.oauthButtons.google.getText()<%= to() %>.eventually.equal('Connect with Google+');
+ <%= expect() %>page.form.oauthButtons.google.getAttribute('class')<%= to() %>.eventually.contain('btn-block');<% } if (filters.twitterAuth) { %>
+ <%= expect() %>page.form.oauthButtons.twitter.getText()<%= to() %>.eventually.equal('Connect with Twitter');
+ <%= expect() %>page.form.oauthButtons.twitter.getAttribute('class')<%= to() %>.eventually.contain('btn-block');<% } %>
+ });<% } %>
describe('with local auth', function() {
diff --git a/app/templates/e2e/components/oauth-buttons(oauth)/oauth-buttons.po.js b/app/templates/e2e/components/oauth-buttons(oauth)/oauth-buttons.po.js
new file mode 100644
index 000000000..c25d2b994
--- /dev/null
+++ b/app/templates/e2e/components/oauth-buttons(oauth)/oauth-buttons.po.js
@@ -0,0 +1,15 @@
+/**
+ * This file uses the Page Object pattern to define the main page for tests
+ * https://docs.google.com/presentation/d/1B6manhG0zEXkC-H-tPo2vwU06JhL8w9-XCF9oehXzAQ
+ */
+
+'use strict';
+
+var OauthButtons = function() {
+ var oauthButtons = this.oauthButtons = element(by.css('oauth-buttons'));<% if (filters.facebookAuth) { %>
+ oauthButtons.facebook = oauthButtons.element(by.css('.btn<% if (filters.bootstrap) { %>.btn-social<% } %>.btn-facebook'));<% } if (filters.googleAuth) { %>
+ oauthButtons.google = oauthButtons.element(by.css('.btn<% if (filters.bootstrap) { %>.btn-social<% } %>.btn-google'));<% } if (filters.twitterAuth) { %>
+ oauthButtons.twitter = oauthButtons.element(by.css('.btn<% if (filters.bootstrap) { %>.btn-social<% } %>.btn-twitter'));<% } %>
+};
+
+module.exports = new OauthButtons();
diff --git a/test/test-file-creation.js b/test/test-file-creation.js
index 1f2162142..cca66a78f 100644
--- a/test/test-file-creation.js
+++ b/test/test-file-creation.js
@@ -258,7 +258,6 @@ describe('angular-fullstack generator', function () {
files = files.concat([
'client/app/account/account.' + script,
'client/app/account/login/login.' + markup,
- 'client/app/account/login/login.' + stylesheet,
'client/app/account/login/login.controller.' + script,
'client/app/account/settings/settings.' + markup,
'client/app/account/settings/settings.controller.' + script,
@@ -290,11 +289,22 @@ describe('angular-fullstack generator', function () {
]);
}
- /* OAuth (see oauthFiles function above) */
- if (ops.oauth) {
+ if (ops.oauth && ops.oauth.length) {
+ /* OAuth (see oauthFiles function above) */
ops.oauth.forEach(function(type, i) {
files = files.concat(oauthFiles(type.replace('Auth', '')));
});
+
+
+ files = files.concat([
+ 'client/components/oauth-buttons/oauth-buttons.' + stylesheet,
+ 'client/components/oauth-buttons/oauth-buttons.' + markup,
+ 'client/components/oauth-buttons/oauth-buttons.controller.' + script,
+ 'client/components/oauth-buttons/oauth-buttons.controller.spec.' + script,
+ 'client/components/oauth-buttons/oauth-buttons.directive.' + script,
+ 'client/components/oauth-buttons/oauth-buttons.directive.spec.' + script,
+ 'e2e/components/oauth-buttons/oauth-buttons.po.js'
+ ]);
}
/* Socket.IO */
From 8e21ce983daa839bbeb6429957a16006fbf07a45 Mon Sep 17 00:00:00 2001
From: kingcody
Date: Tue, 8 Sep 2015 17:14:27 -0400
Subject: [PATCH 0030/1129] fix(app): add `jasmine` to `.jshintrc` globals
---
app/templates/client/.jshintrc | 3 ++-
app/templates/server/.jshintrc-spec | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/app/templates/client/.jshintrc b/app/templates/client/.jshintrc
index 8c5c42c0a..07b9d3793 100644
--- a/app/templates/client/.jshintrc
+++ b/app/templates/client/.jshintrc
@@ -22,7 +22,8 @@
"console": true,
"$": true,
"_": true,
- "moment": true,
+ "moment": true,<% if (filters.jasmine) { %>
+ "jasmine": true,<% } %>
"describe": true,
"beforeEach": true,
"module": true,
diff --git a/app/templates/server/.jshintrc-spec b/app/templates/server/.jshintrc-spec
index b9390c374..8c9871ce0 100644
--- a/app/templates/server/.jshintrc-spec
+++ b/app/templates/server/.jshintrc-spec
@@ -1,6 +1,7 @@
{
"extends": ".jshintrc",
- "globals": {
+ "globals": {<% if (filters.jasmine) { %>
+ "jasmine": true,<% } %>
"describe": true,
"it": true,
"before": true,
From 53e9a22f92b5139bcd78f7ad1819ae4268fe1bab Mon Sep 17 00:00:00 2001
From: Andrew Koroluk
Date: Tue, 8 Sep 2015 19:39:31 -0400
Subject: [PATCH 0031/1129] 3.0.0-rc7-patch.0
---
package.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/package.json b/package.json
index 3c7fad767..7c388605e 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "generator-angular-fullstack",
- "version": "3.0.0-rc7",
+ "version": "3.0.0-rc7-patch.0",
"description": "Yeoman generator for creating MEAN stack applications, using MongoDB, Express, AngularJS, and Node",
"keywords": [
"yeoman-generator",
From 36593a533f6d868553f7a08dae93bd9b5e389c43 Mon Sep 17 00:00:00 2001
From: kingcody
Date: Tue, 8 Sep 2015 20:34:58 -0400
Subject: [PATCH 0032/1129] feat(gen): add `updateSubmodules` task and run it
`beforeBump`
---
Gruntfile.js | 59 +++++++++++++++++++++++++++++++++++++++++-----------
1 file changed, 47 insertions(+), 12 deletions(-)
diff --git a/Gruntfile.js b/Gruntfile.js
index 64198cda7..47b889e8f 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -31,6 +31,7 @@ module.exports = function (grunt) {
commitMessage: '<%= version %>',
tagName: '<%= version %>',
file: 'package.json',
+ beforeBump: ['updateSubmodules'],
afterBump: ['updateFixtures:deps', 'commitNgFullstackDeps'],
beforeRelease: ['stage'],
push: false,
@@ -38,6 +39,11 @@ module.exports = function (grunt) {
npm: false
}
},
+ updateSubmodules: {
+ options: {
+ modules: ['angular-fullstack-deps']
+ }
+ },
commitNgFullstackDeps: {
options: {
cwd: 'angular-fullstack-deps',
@@ -113,12 +119,47 @@ module.exports = function (grunt) {
}
});
- grunt.registerTask('stage', 'git add files before running the release task', function () {
- var files = grunt.config('stage.options').files, done = this.async();
+ function gitCmd(args, opts, done) {
grunt.util.spawn({
cmd: process.platform === 'win32' ? 'git.cmd' : 'git',
- args: ['add'].concat(files)
+ args: args,
+ opts: opts || {}
}, done);
+ }
+ function gitCmdAsync(args, opts) {
+ return function() {
+ var deferred = Q.defer();
+ gitCmd(args, opts, function(err) {
+ if (err) { return deferred.reject(err); }
+ deferred.resolve();
+ });
+ return deferred.promise;
+ };
+ }
+
+ grunt.registerTask('stage', 'git add files before running the release task', function () {
+ var files = grunt.config('stage.options').files;
+ gitCmd(['add'].concat(files), {}, this.async());
+ });
+
+ grunt.registerTask('updateSubmodules', function() {
+ grunt.config.requires('updateSubmodules.options.modules');
+ var modules = grunt.config.get('updateSubmodules').options.modules;
+
+ Q()
+ .then(gitCmdAsync(['submodule', 'update', '--init', '--recursive']))
+ .then(function() {
+ var thens = [];
+ for (var i = 0, modulesLength = modules.length; i < modulesLength; i++) {
+ var opts = {cwd: modules[i]};
+ thens.push(gitCmdAsync(['checkout', 'master'], opts));
+ thens.push(gitCmdAsync(['fetch'], opts));
+ thens.push(gitCmdAsync(['pull'], opts));
+ }
+ return thens.reduce(Q.when, Q());
+ })
+ .catch(grunt.fail.fatal.bind(grunt.fail))
+ .finally(this.async());
});
grunt.registerTask('commitNgFullstackDeps', function() {
@@ -129,15 +170,9 @@ module.exports = function (grunt) {
var ops = grunt.config.get('commitNgFullstackDeps').options;
var version = require('./package.json').version || 'NO VERSION SET';
if (Array.isArray(ops.files) && ops.files.length > 0) {
- var done = this.async();
- var cwd = path.resolve(__dirname, ops.cwd);
- grunt.util.spawn({
- cmd: process.platform === 'win32' ? 'git.cmd' : 'git',
- args: ['commit', '-m', version].concat(ops.files),
- opts: {
- cwd: cwd
- }
- }, done);
+ gitCmd(['commit', '-m', version].concat(ops.files), {
+ cwd: path.resolve(__dirname, ops.cwd)
+ }, this.async());
} else {
grunt.log.writeln('No files were commited');
}
From f554c0dd0f465a499c73cc896241375284fc9978 Mon Sep 17 00:00:00 2001
From: Cody Mize
Date: Tue, 8 Sep 2015 20:52:05 -0400
Subject: [PATCH 0033/1129] docs(gen): add releasing section
---
contributing.md | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/contributing.md b/contributing.md
index b46bd1c63..037a6b78f 100644
--- a/contributing.md
+++ b/contributing.md
@@ -70,3 +70,29 @@ reference GitHub issues that this commit **Closes**.
A detailed explanation can be found in this [document][commit-message-format].
[commit-message-format]: https://docs.google.com/document/d/1QrDFcIiPjSLDn3EL15IJygNPiHORgU1_OOAqWjiDU5Y
+
+# Releasing
+*(for contributors with push access)*
+
+The `grunt release` task will do most of the work for you, see [`grunt-release`](https://github.com/geddski/grunt-release) for semver usage.
+
+* Manually bump `package.json` version.
+
+*note: this step will be removed once `3.0.0` is released*
+
+* Run the release task `grunt release`.
+
+*note: once `3.0.0` is released you will need to use a valid `grunt-release` target, see [here](https://github.com/geddski/grunt-release#using-grunt-release)*
+
+* Push and publish the `angular-fullstack-deps` submodule.
+```bash
+$ cd angular-fullstack-deps
+$ git push && npm publish
+$ cd ..
+```
+
+* Push and publish `generator-angular-fullstack`.
+```bash
+$ git push && git push --tags
+$ npm publish
+```
From 4de144aabca9d1b3e0ea2c9ee803e8c46eb64e72 Mon Sep 17 00:00:00 2001
From: kingcody
Date: Tue, 8 Sep 2015 22:30:39 -0400
Subject: [PATCH 0034/1129] chore(all): update grunt-build-control to `^0.6.0`
---
app/templates/_package.json | 2 +-
package.json | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/templates/_package.json b/app/templates/_package.json
index cfecfbbd6..8017603f3 100644
--- a/app/templates/_package.json
+++ b/app/templates/_package.json
@@ -68,7 +68,7 @@
"grunt-protractor-runner": "^2.0.0",
"grunt-injector": "^0.6.0",
"grunt-karma": "~0.12.0",
- "grunt-build-control": "^0.5.0",<% if(filters.sass) { %>
+ "grunt-build-control": "^0.6.0",<% if(filters.sass) { %>
"grunt-contrib-sass": "^0.9.0",<% } %><% if(filters.stylus) { %>
"grunt-contrib-stylus": "latest",<% } %>
"jit-grunt": "^0.9.1",
diff --git a/package.json b/package.json
index 7c388605e..f8e004ed3 100644
--- a/package.json
+++ b/package.json
@@ -46,7 +46,7 @@
"devDependencies": {
"chai": "^3.2.0",
"grunt": "~0.4.1",
- "grunt-build-control": "^0.5.0",
+ "grunt-build-control": "^0.6.0",
"grunt-contrib-clean": "^0.6.0",
"grunt-contrib-jshint": "^0.11.2",
"grunt-conventional-changelog": "~1.0.0",
From ed974c23515d886d4c6549376ff5fe071053912a Mon Sep 17 00:00:00 2001
From: kingcody
Date: Tue, 8 Sep 2015 21:59:49 -0400
Subject: [PATCH 0035/1129] chore(gen): ensure description is above the fold
[ci skip]
---
readme.md | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/readme.md b/readme.md
index c1a5793f6..f4ccb9ba7 100644
--- a/readme.md
+++ b/readme.md
@@ -4,10 +4,11 @@
[](https://david-dm.org/daftmonk/generator-angular-fullstack)
[](https://david-dm.org/daftmonk/generator-angular-fullstack#info=devDependencies)
[](https://gitter.im/DaftMonk/generator-angular-fullstack)
+> Yeoman generator for creating MEAN stack applications, using MongoDB, Express, AngularJS, and Node - lets you quickly set up a project following best practices.
+
#### Generated project:
[](https://david-dm.org/angular-fullstack/angular-fullstack-deps)
[](https://david-dm.org/angular-fullstack/angular-fullstack-deps#info=devDependencies)
-> Yeoman generator for creating MEAN stack applications, using MongoDB, Express, AngularJS, and Node - lets you quickly set up a project following best practices.
## Example project
From eabd140bd3d483a26697949b2b0a919222414b75 Mon Sep 17 00:00:00 2001
From: Andrew Koroluk
Date: Wed, 9 Sep 2015 00:25:26 -0400
Subject: [PATCH 0036/1129] fix(grunt): remove old duplicate 'test' task
---
Gruntfile.js | 5 -----
1 file changed, 5 deletions(-)
diff --git a/Gruntfile.js b/Gruntfile.js
index 64198cda7..62df55738 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -275,11 +275,6 @@ module.exports = function (grunt) {
});
});
- grunt.registerTask('test', [
- 'updateFixtures',
- 'installFixtures',
- 'mochaTest'
- ]);
grunt.registerTask('test', function(target, option) {
if (target === 'fast') {
grunt.task.run([
From 2c98c914ad00f44f147464576119333e47044ece Mon Sep 17 00:00:00 2001
From: kingcody
Date: Wed, 9 Sep 2015 03:15:53 -0400
Subject: [PATCH 0037/1129] chore(gen): update yeoman-generator to `~0.20.3`
---
app/generator.js | 1 -
app/templates/Gruntfile.js | 2 +-
app/templates/README.md | 2 +-
app/templates/client/app/app(coffee).coffee | 2 +-
app/templates/client/app/app(js).js | 2 +-
.../client/components/footer/footer(html).html | 2 +-
.../client/components/footer/footer(jade).jade | 2 +-
generator-base.js | 9 +++------
package.json | 2 +-
util.js | 18 ++++--------------
10 files changed, 14 insertions(+), 28 deletions(-)
diff --git a/app/generator.js b/app/generator.js
index f8721854b..915d5d380 100644
--- a/app/generator.js
+++ b/app/generator.js
@@ -30,7 +30,6 @@ export default class Generator extends Base {
return {
init: function () {
- this.pkg = require('../package.json');
this.filters = {};
// init shared generator properies and methods
diff --git a/app/templates/Gruntfile.js b/app/templates/Gruntfile.js
index 483be9b3e..e480ee3ea 100644
--- a/app/templates/Gruntfile.js
+++ b/app/templates/Gruntfile.js
@@ -1,4 +1,4 @@
-// Generated on <%= (new Date).toISOString().split('T')[0] %> using <%= pkg.name %> <%= pkg.version %>
+// Generated on <%= (new Date).toISOString().split('T')[0] %> using <%= rootGeneratorName() %> <%= rootGeneratorVersion() %>
'use strict';
module.exports = function (grunt) {
diff --git a/app/templates/README.md b/app/templates/README.md
index e5ec70428..6cf5065f8 100644
--- a/app/templates/README.md
+++ b/app/templates/README.md
@@ -1,6 +1,6 @@
# <%= lodash.slugify(lodash.humanize(appname)) %>
-This project was generated with the [Angular Full-Stack Generator](https://github.com/DaftMonk/generator-angular-fullstack) version <%= pkg.version %>.
+This project was generated with the [Angular Full-Stack Generator](https://github.com/DaftMonk/generator-angular-fullstack) version <%= rootGeneratorVersion() %>.
## Getting Started
diff --git a/app/templates/client/app/app(coffee).coffee b/app/templates/client/app/app(coffee).coffee
index f0c1bd129..6458ca920 100644
--- a/app/templates/client/app/app(coffee).coffee
+++ b/app/templates/client/app/app(coffee).coffee
@@ -1,6 +1,6 @@
'use strict'
-angular.module '<%= scriptAppName %>', [<%= angularModules %>]
+angular.module '<%= scriptAppName %>', [<%- angularModules %>]
<% if (filters.ngroute) { %>.config ($routeProvider, $locationProvider<% if (filters.auth) { %>, $httpProvider<% } %>) ->
$routeProvider
.otherwise
diff --git a/app/templates/client/app/app(js).js b/app/templates/client/app/app(js).js
index 27410af8a..0c8ec39e8 100644
--- a/app/templates/client/app/app(js).js
+++ b/app/templates/client/app/app(js).js
@@ -1,6 +1,6 @@
'use strict';
-angular.module('<%= scriptAppName %>', [<%= angularModules %>])
+angular.module('<%= scriptAppName %>', [<%- angularModules %>])
<% if (filters.ngroute) { %>.config(function($routeProvider, $locationProvider<% if (filters.auth) { %>, $httpProvider<% } %>) {
$routeProvider
.otherwise({
diff --git a/app/templates/client/components/footer/footer(html).html b/app/templates/client/components/footer/footer(html).html
index 3f9f7ffb9..35225475d 100644
--- a/app/templates/client/components/footer/footer(html).html
+++ b/app/templates/client/components/footer/footer(html).html
@@ -1,5 +1,5 @@
-
Angular Fullstack v<%= pkg.version %> |
+
Angular Fullstack v<%= rootGeneratorVersion() %> |
@tyhenkel |
Issues
diff --git a/app/templates/client/components/footer/footer(jade).jade b/app/templates/client/components/footer/footer(jade).jade
index a0bd84a1d..31c5ca960 100644
--- a/app/templates/client/components/footer/footer(jade).jade
+++ b/app/templates/client/components/footer/footer(jade).jade
@@ -1,6 +1,6 @@
.container
p
- | Angular Fullstack v<%= pkg.version %>
+ | Angular Fullstack v<%= rootGeneratorVersion() %>
= ' | '
a(href='https://twitter.com/tyhenkel') @tyhenkel
= ' | '
diff --git a/generator-base.js b/generator-base.js
index 2abbaa0f7..30a43e643 100644
--- a/generator-base.js
+++ b/generator-base.js
@@ -16,12 +16,9 @@ export function genBase(self) {
self.lodash = lodash;
self.yoWelcome = yoWelcome;
- try {
- self.appname = require(path.join(process.cwd(), 'bower.json')).name;
- } catch (e) {
- self.appname = self.name || path.basename(process.cwd());
- }
- self.appname = lodash.camelize(lodash.slugify(lodash.humanize(self.appname)));
+ self.appname = lodash.camelize(lodash.slugify(
+ lodash.humanize(self.determineAppname())
+ ));
self.scriptAppName = self.appname + genUtils.appSuffix(self);
self.filters = self.filters || self.config.get('filters');
diff --git a/package.json b/package.json
index f8e004ed3..6c10dbd61 100644
--- a/package.json
+++ b/package.json
@@ -40,7 +40,7 @@
"glob": "^5.0.14",
"lodash": "^3.10.1",
"underscore.string": "^3.1.1",
- "yeoman-generator": "~0.19.2",
+ "yeoman-generator": "~0.20.3",
"yeoman-welcome": "^1.0.1"
},
"devDependencies": {
diff --git a/util.js b/util.js
index ce7b7733b..529920364 100644
--- a/util.js
+++ b/util.js
@@ -68,19 +68,9 @@ export function appSuffix(self) {
return (typeof suffix === 'string') ? self.lodash.classify(suffix) : '';
}
-function destinationPath(self, filepath) {
- filepath = path.normalize(filepath);
- if (!path.isAbsolute(filepath)) {
- filepath = path.join(self.destinationRoot(), filepath);
- }
-
- return filepath;
-}
-
export function relativeRequire(to, fr) {
- var self = this;
- fr = destinationPath(self, fr || self.filePath);
- to = destinationPath(self, to);
+ fr = this.destinationPath(fr || this.filePath);
+ to = this.destinationPath(to);
return path.relative(path.dirname(fr), to)
.replace(/\\/g, '/') // convert win32 separator to posix
.replace(/^(?!\.\.)(.*)/, './$1') // prefix non parent path with ./
@@ -148,10 +138,10 @@ export function processDirectory(source, destination) {
if(templateIsUsable(self, filteredFile)) {
if(copy) {
- self.copy(src, dest);
+ self.fs.copy(src, dest);
} else {
self.filePath = dest;
- self.template(src, dest);
+ self.fs.copyTpl(src, dest, self);
delete self.filePath;
}
}
From a43e7127eed02fc294331d7c51853667e36008ac Mon Sep 17 00:00:00 2001
From: kingcody
Date: Wed, 9 Sep 2015 06:43:55 -0400
Subject: [PATCH 0038/1129] chore(gen): update grunt-conventional-changelog to
`^4.1.0`
---
Gruntfile.js | 41 ++++++-------
package.json | 2 +-
task-utils/changelog-templates/commit.hbs | 6 ++
task-utils/grunt.js | 73 +++++++++++++++++++++++
4 files changed, 98 insertions(+), 24 deletions(-)
create mode 100644 task-utils/changelog-templates/commit.hbs
create mode 100644 task-utils/grunt.js
diff --git a/Gruntfile.js b/Gruntfile.js
index 1004f931d..e776b3c48 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -4,14 +4,17 @@ var shell = require('shelljs');
var child_process = require('child_process');
var Q = require('q');
var helpers = require('yeoman-generator').test;
+var gruntUtils = require('./task-utils/grunt');
var fs = require('fs');
var path = require('path');
+var gitCmd = gruntUtils.gitCmd;
+var gitCmdAsync = gruntUtils.gitCmdAsync;
+
module.exports = function (grunt) {
// Load grunt tasks automatically, when needed
require('jit-grunt')(grunt, {
- buildcontrol: 'grunt-build-control',
- changelog: 'grunt-conventional-changelog'
+ buildcontrol: 'grunt-build-control'
});
grunt.initConfig({
@@ -19,10 +22,20 @@ module.exports = function (grunt) {
demo: 'demo'
},
pkg: grunt.file.readJSON('package.json'),
- changelog: {
+ conventionalChangelog: {
options: {
- dest: 'CHANGELOG.md',
- versionFile: 'package.json'
+ changelogOpts: {
+ // conventional-changelog options go here
+ preset: 'angular'
+ },
+ writerOpts: {
+ // conventional-changelog-writer options go here
+ finalizeContext: gruntUtils.conventionalChangelog.finalizeContext,
+ commitPartial: gruntUtils.conventionalChangelog.commitPartial
+ }
+ },
+ release: {
+ src: 'CHANGELOG.md'
}
},
release: {
@@ -119,24 +132,6 @@ module.exports = function (grunt) {
}
});
- function gitCmd(args, opts, done) {
- grunt.util.spawn({
- cmd: process.platform === 'win32' ? 'git.cmd' : 'git',
- args: args,
- opts: opts || {}
- }, done);
- }
- function gitCmdAsync(args, opts) {
- return function() {
- var deferred = Q.defer();
- gitCmd(args, opts, function(err) {
- if (err) { return deferred.reject(err); }
- deferred.resolve();
- });
- return deferred.promise;
- };
- }
-
grunt.registerTask('stage', 'git add files before running the release task', function () {
var files = grunt.config('stage.options').files;
gitCmd(['add'].concat(files), {}, this.async());
diff --git a/package.json b/package.json
index f8e004ed3..ce601b42f 100644
--- a/package.json
+++ b/package.json
@@ -49,7 +49,7 @@
"grunt-build-control": "^0.6.0",
"grunt-contrib-clean": "^0.6.0",
"grunt-contrib-jshint": "^0.11.2",
- "grunt-conventional-changelog": "~1.0.0",
+ "grunt-conventional-changelog": "^4.1.0",
"grunt-david": "~0.5.0",
"grunt-env": "^0.4.1",
"grunt-mocha-test": "^0.12.7",
diff --git a/task-utils/changelog-templates/commit.hbs b/task-utils/changelog-templates/commit.hbs
new file mode 100644
index 000000000..2438d8d3d
--- /dev/null
+++ b/task-utils/changelog-templates/commit.hbs
@@ -0,0 +1,6 @@
+{{#if subScope}} {{/if}}*{{#if scope}}{{#unless subScope}} **{{index}}{{scope}}:**{{/unless}}{{/if}} {{#unless leadScope}}{{#if subject}}{{subject}}{{else}}{{header}}{{/if}}{{/unless}}{{#if leadScope}}{{#if subject}}
+ * {{subject}}{{else}}{{header}}{{/if}}{{/if}}
+
+{{~!-- commit hash --}} {{#if @root.linkReferences}}([{{hash}}]({{@root.host}}/{{#if @root.owner}}{{@root.owner}}/{{/if}}{{@root.repository}}/{{@root.commit}}/{{hash}})){{else}}{{hash~}}{{/if}}
+
+{{~!-- commit references --}}{{#if references}}, closes{{~#each references}} {{#if @root.linkReferences}}[{{#if this.owner}}{{this.owner}}/{{/if}}{{this.repository}}#{{this.issue}}]({{@root.host}}/{{#if this.repository}}{{#if this.owner}}{{this.owner}}/{{/if}}{{this.repository}}{{else}}{{#if @root.owner}}{{@root.owner}}/{{/if}}{{@root.repository}}{{/if}}/{{@root.issue}}/{{this.issue}}){{else}}{{this.repository}}#{{this.issue}}{{/if}}{{/each}}{{/if}}
diff --git a/task-utils/grunt.js b/task-utils/grunt.js
new file mode 100644
index 000000000..70a598b8b
--- /dev/null
+++ b/task-utils/grunt.js
@@ -0,0 +1,73 @@
+'use strict';
+
+var path = require('path');
+var fs = require('fs');
+
+exports = module.exports = {
+ gitCmd: function gitCmd(args, opts, done) {
+ grunt.util.spawn({
+ cmd: process.platform === 'win32' ? 'git.cmd' : 'git',
+ args: args,
+ opts: opts || {}
+ }, done);
+ },
+
+ gitCmdAsync: function gitCmdAsync(args, opts) {
+ return function() {
+ var deferred = Q.defer();
+ gitCmd(args, opts, function(err) {
+ if (err) { return deferred.reject(err); }
+ deferred.resolve();
+ });
+ return deferred.promise;
+ };
+ },
+
+ conventionalChangelog: {
+ finalizeContext: function(context, writerOpts, commits, keyCommit) {
+ var gitSemverTags = context.gitSemverTags;
+ var commitGroups = context.commitGroups;
+
+ if ((!context.currentTag || !context.previousTag) && keyCommit) {
+ var match = /tag:\s*(.+?)[,\)]/gi.exec(keyCommit.gitTags);
+ var currentTag = context.currentTag = context.currentTag || match ? match[1] : null;
+ var index = gitSemverTags.indexOf(currentTag);
+ var previousTag = context.previousTag = gitSemverTags[index + 1];
+
+ if (!previousTag) {
+ if (options.append) {
+ context.previousTag = context.previousTag || commits[0] ? commits[0].hash : null;
+ } else {
+ context.previousTag = context.previousTag || commits[commits.length - 1] ? commits[commits.length - 1].hash : null;
+ }
+ }
+ } else {
+ context.previousTag = context.previousTag || gitSemverTags[0];
+ context.currentTag = context.currentTag || 'v' + context.version;
+ }
+
+ if (typeof context.linkCompare !== 'boolean' && context.previousTag && context.currentTag) {
+ context.linkCompare = true;
+ }
+
+ if (Array.isArray(commitGroups)) {
+ for (var i = 0, commitGroupsLength = commitGroups.length; i < commitGroupsLength; i++) {
+ var commits = commitGroups[i].commits;
+ if (Array.isArray(commits)) {
+ for (var n = 1, commitsLength = commits.length; n < commitsLength; n++) {
+ var commit = commits[n], prevCommit = commits[n - 1];
+ if (commit.scope && commit.scope === prevCommit.scope) {
+ commit.subScope = true;
+ if (prevCommit.scope && !prevCommit.subScope) {
+ prevCommit.leadScope = true;
+ }
+ }
+ }
+ }
+ }
+ }
+ return context;
+ },
+ commitPartial: fs.readFileSync(path.resolve(__dirname, 'changelog-templates', 'commit.hbs')).toString()
+ }
+};
From 83385d65c9222a598147663453dffe88f35e4eb8 Mon Sep 17 00:00:00 2001
From: kingcody
Date: Wed, 9 Sep 2015 07:24:51 -0400
Subject: [PATCH 0039/1129] chore(gen): update `CHANGELOG.md`
---
CHANGELOG.md | 340 ++++++++++++++++++++++++++++++++-------------------
1 file changed, 217 insertions(+), 123 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9d265082f..0b47eb6f1 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,196 +1,290 @@
-
-## v2.1.1 (2015-07-29)
+
+## [2.1.1](https://github.com/DaftMonk/generator-angular-fullstack/compare/2.1.0...2.1.1) (2015-07-29)
-#### Bug Fixes
+### Bug Fixes
-* **app:** use 0.0.0.0 for default IP ([2cd1c24d](http://github.com/DaftMonk/generator-angular-fullstack/commit/2cd1c24d2224e46fa68f8da834e86ac3ed80de8e))
+* **app:**
+ * correct grunt clean glob ([8e8ae96](https://github.com/DaftMonk/generator-angular-fullstack/commit/8e8ae96))
+ * ensure all files end with a newline ([8511260](https://github.com/DaftMonk/generator-angular-fullstack/commit/8511260))
+ * fix folder depth in rev and usemin globs ([18f8d31](https://github.com/DaftMonk/generator-angular-fullstack/commit/18f8d31))
+ * update sequelize syntax in seed.js ([a9372a1](https://github.com/DaftMonk/generator-angular-fullstack/commit/a9372a1))
+ * use 0.0.0.0 for default IP ([2cd1c24](https://github.com/DaftMonk/generator-angular-fullstack/commit/2cd1c24)), closes [DaftMonk/generator-angular-fullstack#1071](https://github.com/DaftMonk/generator-angular-fullstack/issues/1071)
+* **app:test:** include `client/components` in babel preprocessing ([6b575d1](https://github.com/DaftMonk/generator-angular-fullstack/commit/6b575d1)), closes [DaftMonk/generator-angular-fullstack#1081](https://github.com/DaftMonk/generator-angular-fullstack/issues/1081)
+* **build:** exclued `bower_components` from the grunt rev and usemin blocks ([7ae43ae](https://github.com/DaftMonk/generator-angular-fullstack/commit/7ae43ae)), closes [#522](https://github.com/DaftMonk/generator-angular-fullstack/issues/522)
+* **test:**
+ * update protractor test for angular 1.4 ([f5acad0](https://github.com/DaftMonk/generator-angular-fullstack/commit/f5acad0))
+ * use proper controlFlow in protractor tests ([8dce663](https://github.com/DaftMonk/generator-angular-fullstack/commit/8dce663))
+
+### Features
-
-## v2.1.0 (2015-07-15)
+* **app:**
+ * improve `Gruntfile.js` file globbing ([5874dfd](https://github.com/DaftMonk/generator-angular-fullstack/commit/5874dfd))
+ * merge H5BP updates to index.html ([4a88551](https://github.com/DaftMonk/generator-angular-fullstack/commit/4a88551))
+ * watch integration tests for changes ([a81aeb1](https://github.com/DaftMonk/generator-angular-fullstack/commit/a81aeb1))
+* **build:** switch to grunt-filerev ([cd28298](https://github.com/DaftMonk/generator-angular-fullstack/commit/cd28298))
+* **test:** add jasmine-spec-reporter ([f34e8f3](https://github.com/DaftMonk/generator-angular-fullstack/commit/f34e8f3))
-#### Bug Fixes
-* **app:** missing event.preventDefault ([c90d7621](http://github.com/DaftMonk/generator-angular-fullstack/commit/c90d7621b8f17f6e74f8a59f02fd78a8fcf628aa))
-* **demo:** include bootstrap in demo ([19e21331](http://github.com/DaftMonk/generator-angular-fullstack/commit/19e213319ecdf27041948133fe4c9642184133d8))
-* **express:** support new options of updated connect-mongo ([727d6616](http://github.com/DaftMonk/generator-angular-fullstack/commit/727d661642441d5ee76e4fba9ebcbba134e43058))
-* **jshint:** Removed 'regexp' from server and client jshintrc (I couldn't find it in the docs ([e02f0940](http://github.com/DaftMonk/generator-angular-fullstack/commit/e02f09405de2423d7be92e5ca0f9be740becb693))
-* **travis:**
- * Remove unicode stuff from file creation test expectations, and add nodejs 0.12 t ([bf9a9737](http://github.com/DaftMonk/generator-angular-fullstack/commit/bf9a9737721d1ea72f3f7b9689d6781e78b4c606))
- * Add nodejs 12 to travis.yml ([acecde9d](http://github.com/DaftMonk/generator-angular-fullstack/commit/acecde9d0e02b579d4b0a2a33d7c0f24067258ec))
+
+# [2.1.0](https://github.com/DaftMonk/generator-angular-fullstack/compare/v2.0.13...2.1.0) (2015-07-15)
-#### Features
+### Bug Fixes
-* **app:**
- * additional app generator option for ES6 preprocessing using babel ([cbb06a48](http://github.com/DaftMonk/generator-angular-fullstack/commit/cbb06a48e28c594a53f61e49857cbb711bd74ce9))
- * additional app generator option for ES6 preprocessing using babel ([bc03aba9](http://github.com/DaftMonk/generator-angular-fullstack/commit/bc03aba9ee82812f29f4ec9f86daf3b8d1c531b8))
- * add mongodb error handling to quit app if unable to connect with mongodb server ([31bee73c](http://github.com/DaftMonk/generator-angular-fullstack/commit/31bee73c1085c3a3f3c8e4e6f1f45db28fa9f94b))
-* **build:** add gitter webhook for travis ([6b88efdf](http://github.com/DaftMonk/generator-angular-fullstack/commit/6b88efdfb1d6b3b2dcbf47e0517bfc5117247d12))
-* **gen:** Remove global jQuery dependency ([a9230ca2](http://github.com/DaftMonk/generator-angular-fullstack/commit/a9230ca2ba1b2727abdc466a11096ec513fd7085))
-* **readme:** add david-dm badge & move badges to new line ([f8f32f4f](http://github.com/DaftMonk/generator-angular-fullstack/commit/f8f32f4f67938a5f7416e2a07d7b24d71a12585f))
+* **app:** missing event.preventDefault ([c90d762](https://github.com/DaftMonk/generator-angular-fullstack/commit/c90d762))
+* **app-logout:** add blank templates to logout route/state ([650d244](https://github.com/DaftMonk/generator-angular-fullstack/commit/650d244)), closes [#570](https://github.com/DaftMonk/generator-angular-fullstack/issues/570)
+* **app-signup:** switch button classes ([5898e0c](https://github.com/DaftMonk/generator-angular-fullstack/commit/5898e0c))
+* **demo:** include bootstrap in demo ([19e2133](https://github.com/DaftMonk/generator-angular-fullstack/commit/19e2133))
+* **deps:** use angular ~1.2 before migrated to 1.3 ([6a196e2](https://github.com/DaftMonk/generator-angular-fullstack/commit/6a196e2)), closes [#654](https://github.com/DaftMonk/generator-angular-fullstack/issues/654)
+* **endpoint:**
+ * fully support sequelize models ([df82d17](https://github.com/DaftMonk/generator-angular-fullstack/commit/df82d17))
+ * refactor handleError for promise use ([0af7c3e](https://github.com/DaftMonk/generator-angular-fullstack/commit/0af7c3e))
+* **endpoint:thing:** use Express 4 syntax ([c7b48a5](https://github.com/DaftMonk/generator-angular-fullstack/commit/c7b48a5))
+* **endpoint:user:** refactor validationError for promise use ([c98cb5d](https://github.com/DaftMonk/generator-angular-fullstack/commit/c98cb5d))
+* **express:** support new options of updated connect-mongo ([727d661](https://github.com/DaftMonk/generator-angular-fullstack/commit/727d661))
+* **gen:**
+ * camelCase endpoint name when used in variable name ([7362080](https://github.com/DaftMonk/generator-angular-fullstack/commit/7362080)), closes [#540](https://github.com/DaftMonk/generator-angular-fullstack/issues/540)
+ * Check that answers.odms exists ([342606c](https://github.com/DaftMonk/generator-angular-fullstack/commit/342606c))
+ * filter `client/components/socket` js files ([49d5bbd](https://github.com/DaftMonk/generator-angular-fullstack/commit/49d5bbd)), closes [#530](https://github.com/DaftMonk/generator-angular-fullstack/issues/530)
+* **gen:build:** Adds missing slash ([bb4d92e](https://github.com/DaftMonk/generator-angular-fullstack/commit/bb4d92e))
+* **gen:endpoint:** Fix JSCS stuff and use Express 4 syntax ([1bcffd6](https://github.com/DaftMonk/generator-angular-fullstack/commit/1bcffd6))
+* **git:** Remove old text=auto ([e0350cc](https://github.com/DaftMonk/generator-angular-fullstack/commit/e0350cc))
+* **jshint:** Removed 'regexp' from server and client jshintrc (I couldn't find it in the docs ([e02f094](https://github.com/DaftMonk/generator-angular-fullstack/commit/e02f094))
+* **model:** fix update bugs with mongoose and sequelize ([1805975](https://github.com/DaftMonk/generator-angular-fullstack/commit/1805975))
+* **npm:** Remove git diff comment ([349b6d3](https://github.com/DaftMonk/generator-angular-fullstack/commit/349b6d3))
+* **oauth:**
+ * Facebook API updated ([f6e7a12](https://github.com/DaftMonk/generator-angular-fullstack/commit/f6e7a12))
+ * Google scopes deprecated ([136f15e](https://github.com/DaftMonk/generator-angular-fullstack/commit/136f15e))
+* return a 404 when no user is found fixes #711 ([38c0d7c](https://github.com/DaftMonk/generator-angular-fullstack/commit/38c0d7c)), closes [#711](https://github.com/DaftMonk/generator-angular-fullstack/issues/711)
+* **openshift:** fix processing of rhc app show output ([dedf46c](https://github.com/DaftMonk/generator-angular-fullstack/commit/dedf46c))
+* **server:** server should launch in dev mode if production env var is not specified ([9cdcc90](https://github.com/DaftMonk/generator-angular-fullstack/commit/9cdcc90)), closes [#590](https://github.com/DaftMonk/generator-angular-fullstack/issues/590)
+* **server-tests:** `test:coverage` task ([5198685](https://github.com/DaftMonk/generator-angular-fullstack/commit/5198685))
+* **test:**
+ * change `protractor.getInstance` to `browser` ([c7f6c36](https://github.com/DaftMonk/generator-angular-fullstack/commit/c7f6c36))
+ * remove package.json and bower.json ([0ec2e18](https://github.com/DaftMonk/generator-angular-fullstack/commit/0ec2e18))
+ * update sequelize destroy usage ([8df9992](https://github.com/DaftMonk/generator-angular-fullstack/commit/8df9992))
+* **travis:**
+ * Add nodejs 12 to travis.yml ([acecde9](https://github.com/DaftMonk/generator-angular-fullstack/commit/acecde9))
+ * remove node v0.11 from testing ([dae69cf](https://github.com/DaftMonk/generator-angular-fullstack/commit/dae69cf))
+ * Remove unicode stuff from file creation test expectations, and add nodejs 0.12 t ([bf9a973](https://github.com/DaftMonk/generator-angular-fullstack/commit/bf9a973))
+
+### Features
-
-### v2.0.13 (2014-08-29)
+* **app:**
+ * add grunt jscs task for maintaining consistent code style ([8a1a245](https://github.com/DaftMonk/generator-angular-fullstack/commit/8a1a245))
+ * add mongodb error handling to quit app if unable to connect with mongodb server ([31bee73](https://github.com/DaftMonk/generator-angular-fullstack/commit/31bee73))
+ * additional app generator option for ES6 preprocessing using babel ([bc03aba](https://github.com/DaftMonk/generator-angular-fullstack/commit/bc03aba))
+ * additional app generator option for ES6 preprocessing using babel ([cbb06a4](https://github.com/DaftMonk/generator-angular-fullstack/commit/cbb06a4))
+ * implement footer as directive ([cf298a7](https://github.com/DaftMonk/generator-angular-fullstack/commit/cf298a7))
+ * implement navbar as directive ([24171aa](https://github.com/DaftMonk/generator-angular-fullstack/commit/24171aa))
+* **app-auth:** Improve client-side Auth service ([65d03fc](https://github.com/DaftMonk/generator-angular-fullstack/commit/65d03fc)), closes [#456](https://github.com/DaftMonk/generator-angular-fullstack/issues/456)
+* **app-routing:** improve app routing ([6aadee6](https://github.com/DaftMonk/generator-angular-fullstack/commit/6aadee6)), closes [#331](https://github.com/DaftMonk/generator-angular-fullstack/issues/331)
+* **build:** add gitter webhook for travis ([6b88efd](https://github.com/DaftMonk/generator-angular-fullstack/commit/6b88efd))
+* **gen:**
+ * add README.md ([f07b09c](https://github.com/DaftMonk/generator-angular-fullstack/commit/f07b09c))
+ * Remove global jQuery dependency ([a9230ca](https://github.com/DaftMonk/generator-angular-fullstack/commit/a9230ca)), closes [#547](https://github.com/DaftMonk/generator-angular-fullstack/issues/547)
+ * unify testing framework ([654de87](https://github.com/DaftMonk/generator-angular-fullstack/commit/654de87))
+ * use common endpoint templates for thing route ([6dc8130](https://github.com/DaftMonk/generator-angular-fullstack/commit/6dc8130))
+* **generator:** use sauce labs for running e2e tests with travis CI ([50ca41d](https://github.com/DaftMonk/generator-angular-fullstack/commit/50ca41d)), closes [#572](https://github.com/DaftMonk/generator-angular-fullstack/issues/572)
+* **model:** abstract model events to a standard EventEmitter ([91657d7](https://github.com/DaftMonk/generator-angular-fullstack/commit/91657d7)), closes [#857](https://github.com/DaftMonk/generator-angular-fullstack/issues/857) [#490](https://github.com/DaftMonk/generator-angular-fullstack/issues/490)
+* **readme:** add david-dm badge & move badges to new line ([f8f32f4](https://github.com/DaftMonk/generator-angular-fullstack/commit/f8f32f4))
+* **server:**
+ * add support for sequelize ([943120e](https://github.com/DaftMonk/generator-angular-fullstack/commit/943120e)), closes [#414](https://github.com/DaftMonk/generator-angular-fullstack/issues/414)
+ * implement server-side ES6 via babel ([60334a8](https://github.com/DaftMonk/generator-angular-fullstack/commit/60334a8))
+* **server-tests:** code coverage and e2e ([dbbaa20](https://github.com/DaftMonk/generator-angular-fullstack/commit/dbbaa20))
+* **travis-ci:** enable container builds and caching ([00317a8](https://github.com/DaftMonk/generator-angular-fullstack/commit/00317a8))
-#### Bug Fixes
-* **gen:**
- * use bool for bootstrap filters ([a5decbc3](http://github.com/DaftMonk/generator-angular-fullstack/commit/a5decbc36e933f94c69d9e9bb58bd8e07148c34d), closes [#496](http://github.com/DaftMonk/generator-angular-fullstack/issues/496))
- * fix build when not selecting socket.io ([fdf063c6](http://github.com/DaftMonk/generator-angular-fullstack/commit/fdf063c6cc2ec4eeef252f13b2e0d301931fa83c))
+
+## [2.0.13](https://github.com/DaftMonk/generator-angular-fullstack/compare/v2.0.12...v2.0.13) (2014-08-29)
-
-### v2.0.12 (2014-08-25)
-#### Bug Fixes
+### Bug Fixes
-* revert multiple strategies per account, which shouldn't go in a patch release
+* **gen:**
+ * fix build when not selecting socket.io ([fdf063c](https://github.com/DaftMonk/generator-angular-fullstack/commit/fdf063c))
+ * use bool for bootstrap filters ([a5decbc](https://github.com/DaftMonk/generator-angular-fullstack/commit/a5decbc)), closes [#496](https://github.com/DaftMonk/generator-angular-fullstack/issues/496)
-
-### v2.0.11 (2014-08-25)
+### Features
+* **auth:** make crypto async ([6aecdf7](https://github.com/DaftMonk/generator-angular-fullstack/commit/6aecdf7))
-#### Bug Fixes
-* **app:** Use parentheses to fix string concat in config ([c6a50ce7](http://github.com/DaftMonk/generator-angular-fullstack/commit/c6a50ce791ab633a17654ce9b0090007d7152463), closes [#466](http://github.com/DaftMonk/generator-angular-fullstack/issues/466))
- * improve jshint usage ([35fcf490](http://github.com/DaftMonk/generator-angular-fullstack/commit/35fcf4902dbbdab2ca6b394ab87ef8e3cc3d052b), closes [#463](http://github.com/DaftMonk/generator-angular-fullstack/issues/463), [#486](http://github.com/DaftMonk/generator-angular-fullstack/issues/486))
-* **gen:** use more restrictive version range for ng-component ([19698973](http://github.com/DaftMonk/generator-angular-fullstack/commit/196989730c8922fa5e1dc9caa45eb85052535e30))
+
+## [2.0.11](https://github.com/DaftMonk/generator-angular-fullstack/compare/v2.0.10...v2.0.11) (2014-08-26)
-#### Features
-* **socket.io:** build socket.io into vendor.js ([06f2e46e](http://github.com/DaftMonk/generator-angular-fullstack/commit/06f2e46ef382b5af1691f34b6cf504f1e5640b86))
-* **docs:** Inform users/developers of the `canary` branch ([74693623](http://github.com/DaftMonk/generator-angular-fullstack/commit/74693623eb23c9399495a3baff7e3479a1d9f3ba))
-* **gen:** make generator tests faster, and easier to run ([84acb744](http://github.com/DaftMonk/generator-angular-fullstack/commit/84acb7448ccc7c55b72bdd19bfae50c33d527296))
-* **app:** add additional node version to travis.yml ([e4f00b08](http://github.com/DaftMonk/generator-angular-fullstack/commit/e4f00b083a880713ca563e3447b9fb3f56a54ebc))
-* **uibootstrap:** add basic modal service and template when using uibootstrap ([7c14bed4](http://github.com/DaftMonk/generator-angular-fullstack/commit/7c14bed4873b92124bcbe422fed918836b8f5df5))
+### Bug Fixes
-
-### v2.0.10 (2014-08-16)
+* **app-config:** Use parentheses to fix string concat in config ([c6a50ce](https://github.com/DaftMonk/generator-angular-fullstack/commit/c6a50ce)), closes [#466](https://github.com/DaftMonk/generator-angular-fullstack/issues/466)
+* **app-jshint:** improve jshint usage ([35fcf49](https://github.com/DaftMonk/generator-angular-fullstack/commit/35fcf49)), closes [#463](https://github.com/DaftMonk/generator-angular-fullstack/issues/463) [#486](https://github.com/DaftMonk/generator-angular-fullstack/issues/486)
+* **gen:** use more restrictive version range for ng-component ([1969897](https://github.com/DaftMonk/generator-angular-fullstack/commit/1969897))
+### Features
-#### Bug Fixes
+* **app-socket.io:** build socket.io into vendor.js ([06f2e46](https://github.com/DaftMonk/generator-angular-fullstack/commit/06f2e46))
+* **docs:** Inform users/developers of the `canary` branch ([7469362](https://github.com/DaftMonk/generator-angular-fullstack/commit/7469362))
+* **gen:** make generator tests faster, and easier to run ([84acb74](https://github.com/DaftMonk/generator-angular-fullstack/commit/84acb74))
+* **gen-travis:** add additional node version to travis.yml ([e4f00b0](https://github.com/DaftMonk/generator-angular-fullstack/commit/e4f00b0))
-* **server:** undefined domain env variable causing issues ([cb683dde](http://github.com/DaftMonk/generator-angular-fullstack/commit/cb683dde6814959328a58267215ce477aa723e35))
-
-### v2.0.9 (2014-08-15)
+
+## [2.0.10](https://github.com/DaftMonk/generator-angular-fullstack/compare/v2.0.9...v2.0.10) (2014-08-16)
-#### Bug Fixes
-* **app:**
- * add .idea folder to gitignore ([2e1f1182](http://github.com/DaftMonk/generator-angular-fullstack/commit/2e1f1182684594300ac5ca85ffab175bfcafd3ec))
- * Missing user response code ([c1766604](http://github.com/DaftMonk/generator-angular-fullstack/commit/c1766604d7ae7ab1eb8713f37285d13341dc8ae1))
- * use `''` instead `null` as URL to open ioSocket ([0f0d0fdc](http://github.com/DaftMonk/generator-angular-fullstack/commit/0f0d0fdce38d42f04f71d9e1174400adfb699061))
- * save the version of the generator that was used ([2b76b17b](http://github.com/DaftMonk/generator-angular-fullstack/commit/2b76b17bb5fa1980b449498beec87ab58ceee012))
-* **gruntfile:** incorrect path to index.html for cdnify ([0ad646cb](http://github.com/DaftMonk/generator-angular-fullstack/commit/0ad646cbd48dbb2f65fc00b930a9f243174611be))
-* **openshift:** fix issues with openshift deployment ([ace07238](http://github.com/DaftMonk/generator-angular-fullstack/commit/ace07238e3299d6002337ba12f7862ce84beafd8))
+### Bug Fixes
+* **server:** undefined domain env variable causing issues ([cb683dd](https://github.com/DaftMonk/generator-angular-fullstack/commit/cb683dd))
-#### Features
-* **gen:** add automatic demo releases with grunt task ([44852233](http://github.com/DaftMonk/generator-angular-fullstack/commit/44852233fcf28d5ff8681fcabc3bfb4130778a22))
-* **gruntfile:** add grunt buildcontrol tasks to app, for easier deployment ([036478df](http://github.com/DaftMonk/generator-angular-fullstack/commit/036478dfd7067d38ab19ca86c0c5196678412799))
-* **heroku:** provide prompt to set the deployment region ([13cd5e7d](http://github.com/DaftMonk/generator-angular-fullstack/commit/13cd5e7d42f2845268f38ba19e0d253ae675c594))
-* **server:** add sample env config file that can be tracked by git ([c9f80bcd](http://github.com/DaftMonk/generator-angular-fullstack/commit/c9f80bcd67d6e3eef2c78ccbceff78f763ae88d1))
-
-### v2.0.8 (2014-07-31)
+
+## [2.0.9](https://github.com/DaftMonk/generator-angular-fullstack/compare/v2.0.8...v2.0.9) (2014-08-16)
-#### Bug Fixes
+### Bug Fixes
-* **coffee:** update socket service to match javascript version ([c27cefe2](http://github.com/DaftMonk/generator-angular-fullstack/commit/c27cefe24d8ec64d905f908c66a56bf602303dce))
-* **gen:** Fixed missing `oauth` property in `.yo-rc.json` after 2.0.5 update ([11d324b9](http://github.com/DaftMonk/generator-angular-fullstack/commit/11d324b95992b68bd19f402401e98f5936cdb343))
-* **travis:** install sass gem if sass is enabled ([ceeac27b](http://github.com/DaftMonk/generator-angular-fullstack/commit/ceeac27b8f912aa6dec2caf3bf20dd7551f2d754))
-* **twitter:** revert mongoose connection change ([8675a002](http://github.com/DaftMonk/generator-angular-fullstack/commit/8675a002e301957569374fdcad87aab0bff6b3b4))
+* **app:**
+ * add .idea folder to gitignore ([2e1f118](https://github.com/DaftMonk/generator-angular-fullstack/commit/2e1f118))
+ * save the version of the generator that was used ([2b76b17](https://github.com/DaftMonk/generator-angular-fullstack/commit/2b76b17))
+* **app:api:user:** Missing user response code ([c176660](https://github.com/DaftMonk/generator-angular-fullstack/commit/c176660)), closes [#438](https://github.com/DaftMonk/generator-angular-fullstack/issues/438)
+* **gen:app:socket:** use `''` instead `null` as URL to open ioSocket ([0f0d0fd](https://github.com/DaftMonk/generator-angular-fullstack/commit/0f0d0fd))
+* **gruntfile:** incorrect path to index.html for cdnify ([0ad646c](https://github.com/DaftMonk/generator-angular-fullstack/commit/0ad646c))
+* **openshift:** fix issues with openshift deployment ([ace0723](https://github.com/DaftMonk/generator-angular-fullstack/commit/ace0723))
+### Features
-#### Features
+* **gen:** add automatic demo releases with grunt task ([4485223](https://github.com/DaftMonk/generator-angular-fullstack/commit/4485223))
+* **server:** add sample env config file that can be tracked by git ([c9f80bc](https://github.com/DaftMonk/generator-angular-fullstack/commit/c9f80bc))
+* **uibootstrap-modal:** add basic modal service and template when using uibootstrap ([7c14bed](https://github.com/DaftMonk/generator-angular-fullstack/commit/7c14bed))
-* **user-management:** use the User $resource to populate users for the admin page ([708f0729](http://github.com/DaftMonk/generator-angular-fullstack/commit/708f07290d98d6bd73723f9db49cce7758c3d12b))
-
-### v2.0.7 (2014-07-27)
+
+## [2.0.8](https://github.com/DaftMonk/generator-angular-fullstack/compare/v2.0.7...v2.0.8) (2014-07-31)
-#### Bug Fixes
-* **gruntfile:** grunt tasks should run if no local config exists ([422d6bca](http://github.com/DaftMonk/generator-angular-fullstack/commit/422d6bca07283057b0fa275dba0de447c9f4f167))
-* **server:** fix setting TTL index on collection : sessions error ([0581ed09](http://github.com/DaftMonk/generator-angular-fullstack/commit/0581ed094b2c6141ab9e0c016eda22aa49e1d075))
+### Bug Fixes
-
-### v2.0.6 (2014-07-27)
+* **coffee:** update socket service to match javascript version ([c27cefe](https://github.com/DaftMonk/generator-angular-fullstack/commit/c27cefe))
+* **gen:** Fixed missing `oauth` property in `.yo-rc.json` after 2.0.5 update ([11d324b](https://github.com/DaftMonk/generator-angular-fullstack/commit/11d324b))
+* **travis:** install sass gem if sass is enabled ([ceeac27](https://github.com/DaftMonk/generator-angular-fullstack/commit/ceeac27))
+* **twitter:** revert mongoose connection change ([8675a00](https://github.com/DaftMonk/generator-angular-fullstack/commit/8675a00))
+### Features
-#### Bug Fixes
+* **user-management:** use the User $resource to populate users for the admin page ([708f072](https://github.com/DaftMonk/generator-angular-fullstack/commit/708f072))
-* **app:**
- * `things` made a little bit more responsive ([58aa7a48](http://github.com/DaftMonk/generator-angular-fullstack/commit/58aa7a489ae28c22be59b3a61db027ccf2f1ae46))
-* **dependencies:** change ngmin to ng-annotate ([dd023fa5](http://github.com/DaftMonk/generator-angular-fullstack/commit/dd023fa5fd90b8b541b8cc60c87186ee619e4844))
-* **bootstrap:** removed styles breaking responsiveness for high-res screens ([053fedb8](http://github.com/DaftMonk/generator-angular-fullstack/commit/053fedb89f64294a55538ad9b806b2d7de4d1c7f))
-* **socketio:** fallback for servers where `socket.handshake.address` is not provided ([f6a19348](http://github.com/DaftMonk/generator-angular-fullstack/commit/f6a19348ad404aa72c31eef8dc84aac8db0e904a))
-* **stylus:** remove bootstrap css import in stylus when bootstrap is not selected ([f7c3d0ad](http://github.com/DaftMonk/generator-angular-fullstack/commit/f7c3d0ad41da5f0072c2cf64ff5c9a894052d194), closes [#368](http://github.com/DaftMonk/generator-angular-fullstack/issues/368))
-#### Features
+
+## [2.0.7](https://github.com/DaftMonk/generator-angular-fullstack/compare/v2.0.6...v2.0.7) (2014-07-28)
-* **oauth:** remove code according to user prompts ([316bd9dd](http://github.com/DaftMonk/generator-angular-fullstack/commit/316bd9dd3632622b0fb434cacfc4150f01d18e4c))
-
-### v2.0.5 (2014-07-17)
+### Bug Fixes
-#### Bug Fixes
+* **gruntfile:** grunt tasks should run if no local config exists ([422d6bc](https://github.com/DaftMonk/generator-angular-fullstack/commit/422d6bc))
+* **server:** fix setting TTL index on collection : sessions error ([0581ed0](https://github.com/DaftMonk/generator-angular-fullstack/commit/0581ed0))
-* **account:** add authentication requirement for settings view ([9105c0fd](http://github.com/DaftMonk/generator-angular-fullstack/commit/9105c0fdbabdbde68fb6cf0fe0d6993ead6e7095), closes [#327](http://github.com/DaftMonk/generator-angular-fullstack/issues/327))
-* **app:**
- * use correct path for font awesome and glyphicons ([1917ba31](http://github.com/DaftMonk/generator-angular-fullstack/commit/1917ba31264fc90bea0fce36b8d144f897e8bf08))
- * wait for currentUser to resolve before checking if logged in on route changes ([6d6090d9](http://github.com/DaftMonk/generator-angular-fullstack/commit/6d6090d9c4dcd5d8a1f6ecb2cf5dc0bb4c8598fe))
- * bootstrap glyphicons not correctly linked on grunt build ([53d193d0](http://github.com/DaftMonk/generator-angular-fullstack/commit/53d193d011c7c1ea8c9477e8f17ad56cc4214362))
-* **dependencies:** include certain dependencies only when answering yes to their respective prompts ([040c57de](http://github.com/DaftMonk/generator-angular-fullstack/commit/040c57de8689f2e0fc35410d0b6935363aaa8458))
-* **server:**
- * fix seeding of db in test mode causing tests to randomly fail ([05f7f433](http://github.com/DaftMonk/generator-angular-fullstack/commit/05f7f43372bc3bd54bead811952b775adeec1f05))
- * make user tests run more consistently ([addb5061](http://github.com/DaftMonk/generator-angular-fullstack/commit/addb5061f62696c7a0078a8d2c7443d428e69376))
- * warnings that express was using deprecated features ([8dc2f1e4](http://github.com/DaftMonk/generator-angular-fullstack/commit/8dc2f1e48503c27cbd2aac3c455adac7781a6539))
- * missing `res` param for handleError ([eb7d50c8](http://github.com/DaftMonk/generator-angular-fullstack/commit/eb7d50c8d27820a6b26caf2a1aaa0e4fa8eee367))
-#### Features
+
+## [2.0.6](https://github.com/DaftMonk/generator-angular-fullstack/compare/v2.0.5...v2.0.6) (2014-07-27)
+
+
+### Bug Fixes
+
+* **app-dependency:** change ngmin to ng-annotate ([dd023fa](https://github.com/DaftMonk/generator-angular-fullstack/commit/dd023fa))
+* **bootstrap:** removed styles breaking responsiveness for high-res screens ([053fedb](https://github.com/DaftMonk/generator-angular-fullstack/commit/053fedb))
+* **responsive:** `things` made a little bit more responsive ([58aa7a4](https://github.com/DaftMonk/generator-angular-fullstack/commit/58aa7a4))
+* **socketio:** fallback for servers where `socket.handshake.address` is not provided ([f6a1934](https://github.com/DaftMonk/generator-angular-fullstack/commit/f6a1934))
+* **stylus:** remove bootstrap css import in stylus when bootstrap is not selected ([f7c3d0a](https://github.com/DaftMonk/generator-angular-fullstack/commit/f7c3d0a)), closes [#368](https://github.com/DaftMonk/generator-angular-fullstack/issues/368)
+
+### Features
+
+* **heroku:** provide prompt to set the deployment region ([13cd5e7](https://github.com/DaftMonk/generator-angular-fullstack/commit/13cd5e7))
+* **oauth:** multiple strategies per account; changeable email ([ef06272](https://github.com/DaftMonk/generator-angular-fullstack/commit/ef06272))
+
+
+
+
+## [2.0.5](https://github.com/DaftMonk/generator-angular-fullstack/compare/v2.0.4...v2.0.5) (2014-07-18)
+
+
+### Bug Fixes
+
+* **account:** add authentication requirement for settings view ([9105c0f](https://github.com/DaftMonk/generator-angular-fullstack/commit/9105c0f)), closes [#327](https://github.com/DaftMonk/generator-angular-fullstack/issues/327)
* **app:**
- * added oath buttons to signup page ([a408f58e](http://github.com/DaftMonk/generator-angular-fullstack/commit/a408f58edb923cd14bf7c7b3411b874dce5f0724))
- * upgrade socket.io to use v1.0.6
-* **gen:**
- * add option for Stylus as a preprocessor ([1b90c448](http://github.com/DaftMonk/generator-angular-fullstack/commit/1b90c448fbf374287fe07f782f9788dfb9a23613))
- * make bootstrap and bootstrap ui optional ([f50d0942](http://github.com/DaftMonk/generator-angular-fullstack/commit/f50d094226fdbf6a7e65ba3783a26efc8544ba08))
+ * bootstrap glyphicons not correctly linked on grunt build ([53d193d](https://github.com/DaftMonk/generator-angular-fullstack/commit/53d193d)), closes [#333](https://github.com/DaftMonk/generator-angular-fullstack/issues/333)
+ * wait for currentUser to resolve before checking if logged in on route changes ([6d6090d](https://github.com/DaftMonk/generator-angular-fullstack/commit/6d6090d)), closes [#306](https://github.com/DaftMonk/generator-angular-fullstack/issues/306) [#294](https://github.com/DaftMonk/generator-angular-fullstack/issues/294)
+* **app:server:thing.controller:** missing `res` param for handleError added ([eb7d50c](https://github.com/DaftMonk/generator-angular-fullstack/commit/eb7d50c))
+* **app:styles:** use correct path for font awesome and glyphicons ([1917ba3](https://github.com/DaftMonk/generator-angular-fullstack/commit/1917ba3))
+* **dependencies:** include certain dependencies only when answering yes to their respective prompts ([040c57d](https://github.com/DaftMonk/generator-angular-fullstack/commit/040c57d))
+* **server:**
+ * fix seeding of db in test mode causing tests to randomly fail ([05f7f43](https://github.com/DaftMonk/generator-angular-fullstack/commit/05f7f43)), closes [#352](https://github.com/DaftMonk/generator-angular-fullstack/issues/352)
+ * make user tests run more consistently ([addb506](https://github.com/DaftMonk/generator-angular-fullstack/commit/addb506)), closes [#346](https://github.com/DaftMonk/generator-angular-fullstack/issues/346)
-
-### v2.0.4 (2014-07-08)
+### Features
+* **app:** added oath buttons to signup page ([a408f58](https://github.com/DaftMonk/generator-angular-fullstack/commit/a408f58))
+* **gen:**
+ * Generate CSS from Stylus ([1b90c44](https://github.com/DaftMonk/generator-angular-fullstack/commit/1b90c44))
+ * Generate CSS from Stylus ([9d87a2c](https://github.com/DaftMonk/generator-angular-fullstack/commit/9d87a2c))
+* **oauth:** remove code according to user prompts ([316bd9d](https://github.com/DaftMonk/generator-angular-fullstack/commit/316bd9d))
-#### Bug Fixes
-* **app:** fix dependency injection minsafe problem in auth service coffeescript. ([03742a80](http://github.com/DaftMonk/generator-angular-fullstack/commit/03742a8000f19efdf14791ff1aae52a90e86c149))
-* **gen:** heroku and openshift generators requiring .yo-rc file to work ([88ebfc8c](http://github.com/DaftMonk/generator-angular-fullstack/commit/88ebfc8c835ac6ec04b6d42fcf9357cfb0bcc47d))
-
-### v2.0.3 (2014-07-04)
+
+## [2.0.4](https://github.com/DaftMonk/generator-angular-fullstack/compare/v2.0.3...v2.0.4) (2014-07-09)
-#### Bug Fixes
+### Bug Fixes
-* **server:** only enable sessions if twitter oauth was selected ([bcd00dc0](http://github.com/DaftMonk/generator-angular-fullstack/commit/bcd00dc02d270486adafe6dbf973a4ec25499a5e))
+* **app:** fix dependency injection minsafe problem in auth service ([03742a8](https://github.com/DaftMonk/generator-angular-fullstack/commit/03742a8))
+* **gen:** heroku and openshift generators requiring .yo-rc file to work ([88ebfc8](https://github.com/DaftMonk/generator-angular-fullstack/commit/88ebfc8)), closes [#318](https://github.com/DaftMonk/generator-angular-fullstack/issues/318)
-
-### v2.0.2 (2014-07-02)
-#### Bug Fixes
-* **gen:endpoint**
- * fix endpoint spec not properly adjusting to users route url
- * fix some valid route urls causing failing tests
+
+## [2.0.3](https://github.com/DaftMonk/generator-angular-fullstack/compare/v2.0.2...v2.0.3) (2014-07-04)
+
+
+### Bug Fixes
+
+* **server:** only enable sessions if twitter oauth was selected ([bcd00dc](https://github.com/DaftMonk/generator-angular-fullstack/commit/bcd00dc))
+
+### Features
+
+* **gen:** make bootstrap and bootstrap ui optional ([f50d094](https://github.com/DaftMonk/generator-angular-fullstack/commit/f50d094))
+
+
+
+
+## [2.0.2](https://github.com/DaftMonk/generator-angular-fullstack/compare/v2.0.1...v2.0.2) (2014-07-03)
+
+
+### Bug Fixes
+
+* **gen:endpoint:**
+ * fix endpoint spec not adjusting from route url ([163cacf](https://github.com/DaftMonk/generator-angular-fullstack/commit/163cacf)), closes [#298](https://github.com/DaftMonk/generator-angular-fullstack/issues/298)
+ * fix some urls failing for api creation ([3fe80bd](https://github.com/DaftMonk/generator-angular-fullstack/commit/3fe80bd))
+
+
+
+
+## [2.0.1](https://github.com/DaftMonk/generator-angular-fullstack/compare/v2.0.0...v2.0.1) (2014-07-02)
+
+
+### Bug Fixes
+
+* **server:** local env not being copied ([f65b393](https://github.com/DaftMonk/generator-angular-fullstack/commit/f65b393))
+
+
## v2.0.0 (2014-07-02)
From 07a158e3368a608f134bd98a8351d1b9deb2c15f Mon Sep 17 00:00:00 2001
From: kingcody
Date: Thu, 10 Sep 2015 08:46:46 -0400
Subject: [PATCH 0040/1129] docs(gen): update generated endpoint files
[ci skip]
---
readme.md | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/readme.md b/readme.md
index f4ccb9ba7..0e997b633 100644
--- a/readme.md
+++ b/readme.md
@@ -139,9 +139,11 @@ yo angular-fullstack:endpoint message
Produces:
server/api/message/index.js
- server/api/message/message.spec.js
+ server/api/message/index.spec.js
server/api/message/message.controller.js
+ server/api/message/message.integration.js
server/api/message/message.model.js (optional)
+ server/api/message/message.events.js (optional)
server/api/message/message.socket.js (optional)
### Route
From 90f4b05521f4e91ea98bba5750c482c5adeca654 Mon Sep 17 00:00:00 2001
From: Andrew Koroluk
Date: Thu, 10 Sep 2015 13:27:09 -0400
Subject: [PATCH 0041/1129] feat(gen): remove CoffeeScript
---
app/generator.js | 6 +-
app/templates/.buildignore | 1 -
app/templates/Gruntfile.js | 34 +---
app/templates/_package.json | 4 +-
.../app/account(auth)/account(coffee).coffee | 59 -------
.../login/login.controller(coffee).coffee | 20 ---
.../settings.controller(coffee).coffee | 17 --
.../signup/signup.controller(coffee).coffee | 33 ----
.../app/admin(auth)/admin(coffee).coffee | 15 --
.../admin.controller(coffee).coffee | 10 --
app/templates/client/app/app(coffee).coffee | 42 -----
.../client/app/main/main(coffee).coffee | 15 --
.../app/main/main.controller(coffee).coffee | 22 ---
.../main/main.controller.spec(coffee).coffee | 32 ----
.../auth(auth)/auth.service(coffee).coffee | 150 ------------------
.../auth(auth)/user.service(coffee).coffee | 17 --
.../footer/footer.directive(coffee).coffee | 8 -
.../modal.service(coffee).coffee | 71 ---------
.../mongoose-error.directive(coffee).coffee | 12 --
.../navbar/navbar.controller(coffee).coffee | 15 --
.../navbar/navbar.directive(coffee).coffee | 7 -
.../oauth-buttons.controller(coffee).coffee | 7 -
...uth-buttons.controller.spec(coffee).coffee | 20 ---
.../oauth-buttons.directive(coffee).coffee | 9 --
...auth-buttons.directive.spec(coffee).coffee | 51 ------
.../socket.mock(coffee).coffee | 15 --
.../socket.service(coffee).coffee | 67 --------
.../ui-router.mock(coffee).coffee | 26 ---
app/templates/karma.conf.js | 6 +-
app/templates/server/config/seed(models).js | 4 +-
readme.md | 3 +-
test/fixtures/.yo-rc.json | 2 +-
test/test-file-creation.js | 10 +-
33 files changed, 16 insertions(+), 794 deletions(-)
delete mode 100644 app/templates/client/app/account(auth)/account(coffee).coffee
delete mode 100644 app/templates/client/app/account(auth)/login/login.controller(coffee).coffee
delete mode 100644 app/templates/client/app/account(auth)/settings/settings.controller(coffee).coffee
delete mode 100644 app/templates/client/app/account(auth)/signup/signup.controller(coffee).coffee
delete mode 100644 app/templates/client/app/admin(auth)/admin(coffee).coffee
delete mode 100644 app/templates/client/app/admin(auth)/admin.controller(coffee).coffee
delete mode 100644 app/templates/client/app/app(coffee).coffee
delete mode 100644 app/templates/client/app/main/main(coffee).coffee
delete mode 100644 app/templates/client/app/main/main.controller(coffee).coffee
delete mode 100644 app/templates/client/app/main/main.controller.spec(coffee).coffee
delete mode 100644 app/templates/client/components/auth(auth)/auth.service(coffee).coffee
delete mode 100644 app/templates/client/components/auth(auth)/user.service(coffee).coffee
delete mode 100644 app/templates/client/components/footer/footer.directive(coffee).coffee
delete mode 100644 app/templates/client/components/modal(uibootstrap)/modal.service(coffee).coffee
delete mode 100644 app/templates/client/components/mongoose-error(auth)/mongoose-error.directive(coffee).coffee
delete mode 100644 app/templates/client/components/navbar/navbar.controller(coffee).coffee
delete mode 100644 app/templates/client/components/navbar/navbar.directive(coffee).coffee
delete mode 100644 app/templates/client/components/oauth-buttons(oauth)/oauth-buttons.controller(coffee).coffee
delete mode 100644 app/templates/client/components/oauth-buttons(oauth)/oauth-buttons.controller.spec(coffee).coffee
delete mode 100644 app/templates/client/components/oauth-buttons(oauth)/oauth-buttons.directive(coffee).coffee
delete mode 100644 app/templates/client/components/oauth-buttons(oauth)/oauth-buttons.directive.spec(coffee).coffee
delete mode 100644 app/templates/client/components/socket(socketio)/socket.mock(coffee).coffee
delete mode 100644 app/templates/client/components/socket(socketio)/socket.service(coffee).coffee
delete mode 100644 app/templates/client/components/ui-router(uirouter)/ui-router.mock(coffee).coffee
diff --git a/app/generator.js b/app/generator.js
index 915d5d380..a7d323b91 100644
--- a/app/generator.js
+++ b/app/generator.js
@@ -86,12 +86,11 @@ export default class Generator extends Base {
type: 'list',
name: 'script',
message: 'What would you like to write scripts with?',
- choices: [ 'JavaScript', 'JavaScript + Babel', 'CoffeeScript'],
+ choices: [ 'JavaScript', 'JavaScript + Babel'],
filter: function( val ) {
return {
'JavaScript': 'js',
- 'JavaScript + Babel': 'babel',
- 'CoffeeScript': 'coffee'
+ 'JavaScript + Babel': 'babel'
}[val];
}
}, {
@@ -340,7 +339,6 @@ export default class Generator extends Base {
if(this.filters.ngroute) filters.push('ngroute');
if(this.filters.uirouter) filters.push('uirouter');
if(this.filters.babel) extensions.push('babel');
- if(this.filters.coffee) extensions.push('coffee');
if(this.filters.js) extensions.push('js');
if(this.filters.html) extensions.push('html');
if(this.filters.jade) extensions.push('jade');
diff --git a/app/templates/.buildignore b/app/templates/.buildignore
index 3ae6d06a2..e69de29bb 100644
--- a/app/templates/.buildignore
+++ b/app/templates/.buildignore
@@ -1 +0,0 @@
-*.coffee
diff --git a/app/templates/Gruntfile.js b/app/templates/Gruntfile.js
index e480ee3ea..1168d75b0 100644
--- a/app/templates/Gruntfile.js
+++ b/app/templates/Gruntfile.js
@@ -106,14 +106,6 @@ module.exports = function (grunt) {
jade: {
files: ['<%%= yeoman.client %>/{app,components}/**/*.jade'],
tasks: ['jade']
- },<% } if (filters.coffee) { %>
- coffee: {
- files: ['<%%= yeoman.client %>/{app,components}/**/!(*.spec).{coffee,litcoffee,coffee.md}'],
- tasks: ['newer:coffee', 'injector:scripts']
- },
- coffeeTest: {
- files: ['<%%= yeoman.client %>/{app,components}/**/*.spec.{coffee,litcoffee,coffee.md}'],
- tasks: ['karma']
},<% } %>
gruntfile: {
files: ['Gruntfile.js']
@@ -431,16 +423,14 @@ module.exports = function (grunt) {
// Run some tasks in parallel to speed up the build process
concurrent: {
- server: [<% if(filters.coffee) { %>
- 'coffee',<% } if(filters.babel) { %>
+ server: [<% if(filters.babel) { %>
'newer:babel:client',<% } if(filters.jade) { %>
'jade',<% } if(filters.stylus) { %>
'stylus',<% } if(filters.sass) { %>
'sass',<% } if(filters.less) { %>
'less',<% } %>
],
- test: [<% if(filters.coffee) { %>
- 'coffee',<% } if(filters.babel) { %>
+ test: [<% if(filters.babel) { %>
'newer:babel:client',<% } if(filters.jade) { %>
'jade',<% } if(filters.stylus) { %>
'stylus',<% } if(filters.sass) { %>
@@ -456,8 +446,7 @@ module.exports = function (grunt) {
logConcurrentOutput: true
}
},
- dist: [<% if(filters.coffee) { %>
- 'coffee',<% } if(filters.babel) { %>
+ dist: [<% if(filters.babel) { %>
'newer:babel:client',<% } if(filters.jade) { %>
'jade',<% } if(filters.stylus) { %>
'stylus',<% } if(filters.sass) { %>
@@ -565,23 +554,6 @@ module.exports = function (grunt) {
ext: '.html'
}]
}
- },<% } if (filters.coffee) { %>
-
- // Compiles CoffeeScript to JavaScript
- coffee: {
- options: {
- sourceMap: true,
- sourceRoot: ''
- },
- server: {
- files: [{
- expand: true,
- cwd: 'client',
- src: ['{app,components}/**/!(*.spec).coffee'],
- dest: '.tmp',
- ext: '.js'
- }]
- }
},<% } %>
// Compiles ES6 to JavaScript using Babel
diff --git a/app/templates/_package.json b/app/templates/_package.json
index 8017603f3..a53bc8991 100644
--- a/app/templates/_package.json
+++ b/app/templates/_package.json
@@ -48,8 +48,7 @@
"grunt-contrib-imagemin": "^0.9.4",
"grunt-contrib-jshint": "~0.11.2",
"grunt-contrib-uglify": "^0.9.1",
- "grunt-contrib-watch": "~0.6.1",<% if (filters.coffee) { %>
- "grunt-contrib-coffee": "^0.13.0",<% } %><% if (filters.jade) { %>
+ "grunt-contrib-watch": "~0.6.1",<% if (filters.jade) { %>
"grunt-contrib-jade": "^0.15.0",<% } %><% if (filters.less) { %>
"grunt-contrib-less": "^1.0.0",<% } %><% if(filters.babel) { %>
"karma-babel-preprocessor": "^5.2.1",
@@ -99,7 +98,6 @@
"karma-chrome-launcher": "~0.2.0",
"requirejs": "~2.1.11",
"karma-requirejs": "~0.2.2",
- "karma-coffee-preprocessor": "~0.3.0",
"karma-jade-preprocessor": "0.0.11",
"karma-phantomjs-launcher": "~0.2.0",
"karma": "~0.13.3",
diff --git a/app/templates/client/app/account(auth)/account(coffee).coffee b/app/templates/client/app/account(auth)/account(coffee).coffee
deleted file mode 100644
index c794d7f04..000000000
--- a/app/templates/client/app/account(auth)/account(coffee).coffee
+++ /dev/null
@@ -1,59 +0,0 @@
-'use strict'
-
-angular.module '<%= scriptAppName %>'
-<% if (filters.ngroute) { %>.config ($routeProvider) ->
- $routeProvider
- .when '/login',
- templateUrl: 'app/account/login/login.html'
- controller: 'LoginCtrl'
-
- .when '/logout',
- name: 'logout'
- referrer: '/'
- controller: ($location, $route, Auth) ->
- referrer = $route.current.params.referrer or $route.current.referrer or "/"
- Auth.logout()
- $location.path referrer
-
- .when '/signup',
- templateUrl: 'app/account/signup/signup.html'
- controller: 'SignupCtrl'
-
- .when '/settings',
- templateUrl: 'app/account/settings/settings.html'
- controller: 'SettingsCtrl'
- authenticate: true
-
-.run ($rootScope) ->
- $rootScope.$on '$routeChangeStart', (event, next, current) ->
- next.referrer = current.originalPath if next.name is "logout" and current and current.originalPath and not current.authenticate
-<% } %><% if (filters.uirouter) { %>.config ($stateProvider) ->
- $stateProvider
- .state 'login',
- url: '/login'
- templateUrl: 'app/account/login/login.html'
- controller: 'LoginCtrl'
-
- .state 'logout',
- url: '/logout?referrer'
- referrer: 'main'
- controller: ($state, Auth) ->
- referrer = $state.params.referrer or $state.current.referrer or "main"
- Auth.logout()
- $state.go referrer
-
- .state 'signup',
- url: '/signup'
- templateUrl: 'app/account/signup/signup.html'
- controller: 'SignupCtrl'
-
- .state 'settings',
- url: '/settings'
- templateUrl: 'app/account/settings/settings.html'
- controller: 'SettingsCtrl'
- authenticate: true
-
-.run ($rootScope) ->
- $rootScope.$on '$stateChangeStart', (event, next, nextParams, current) ->
- next.referrer = current.name if next.name is "logout" and current and current.name and not current.authenticate
-<% } %>
diff --git a/app/templates/client/app/account(auth)/login/login.controller(coffee).coffee b/app/templates/client/app/account(auth)/login/login.controller(coffee).coffee
deleted file mode 100644
index 2ba501a42..000000000
--- a/app/templates/client/app/account(auth)/login/login.controller(coffee).coffee
+++ /dev/null
@@ -1,20 +0,0 @@
-'use strict'
-
-angular.module '<%= scriptAppName %>'
-.controller 'LoginCtrl', ($scope, Auth<% if (filters.ngroute) { %>, $location<% } %><% if (filters.uirouter) { %>, $state<% } %>) ->
- $scope.user = {}
- $scope.errors = {}
- $scope.login = (form) ->
- $scope.submitted = true
-
- if form.$valid
- # Logged in, redirect to home
- Auth.login
- email: $scope.user.email
- password: $scope.user.password
-
- .then ->
- <% if (filters.ngroute) { %>$location.path '/'<% } %><% if (filters.uirouter) { %>$state.go 'main'<% } %>
-
- .catch (err) ->
- $scope.errors.other = err.message
diff --git a/app/templates/client/app/account(auth)/settings/settings.controller(coffee).coffee b/app/templates/client/app/account(auth)/settings/settings.controller(coffee).coffee
deleted file mode 100644
index e058f167e..000000000
--- a/app/templates/client/app/account(auth)/settings/settings.controller(coffee).coffee
+++ /dev/null
@@ -1,17 +0,0 @@
-'use strict'
-
-angular.module '<%= scriptAppName %>'
-.controller 'SettingsCtrl', ($scope, User, Auth) ->
- $scope.errors = {}
- $scope.changePassword = (form) ->
- $scope.submitted = true
-
- if form.$valid
- Auth.changePassword $scope.user.oldPassword, $scope.user.newPassword
- .then ->
- $scope.message = 'Password successfully changed.'
-
- .catch ->
- form.password.$setValidity 'mongoose', false
- $scope.errors.other = 'Incorrect password'
- $scope.message = ''
diff --git a/app/templates/client/app/account(auth)/signup/signup.controller(coffee).coffee b/app/templates/client/app/account(auth)/signup/signup.controller(coffee).coffee
deleted file mode 100644
index 68952a74d..000000000
--- a/app/templates/client/app/account(auth)/signup/signup.controller(coffee).coffee
+++ /dev/null
@@ -1,33 +0,0 @@
-'use strict'
-
-angular.module '<%= scriptAppName %>'
-.controller 'SignupCtrl', ($scope, Auth<% if (filters.ngroute) { %>, $location<% } %><% if (filters.uirouter) { %>, $state<% } %>) ->
- $scope.user = {}
- $scope.errors = {}
- $scope.register = (form) ->
- $scope.submitted = true
-
- if form.$valid
- # Account created, redirect to home
- Auth.createUser
- name: $scope.user.name
- email: $scope.user.email
- password: $scope.user.password
-
- .then ->
- <% if (filters.ngroute) { %>$location.path '/'<% } %><% if (filters.uirouter) { %>$state.go 'main'<% } %>
-
- .catch (err) ->
- err = err.data
- $scope.errors = {}
-<% if (filters.mongooseModels) { %>
- # Update validity of form fields that match the mongoose errors
- angular.forEach err.errors, (error, field) ->
- form[field].$setValidity 'mongoose', false
- $scope.errors[field] = error.message<% }
- if (filters.sequelizeModels) { %>
- # Update validity of form fields that match the sequelize errors
- if err.name
- angular.forEach err.fields, (field) ->
- form[field].$setValidity 'mongoose', false
- $scope.errors[field] = err.message<% } %>
diff --git a/app/templates/client/app/admin(auth)/admin(coffee).coffee b/app/templates/client/app/admin(auth)/admin(coffee).coffee
deleted file mode 100644
index 99b49177f..000000000
--- a/app/templates/client/app/admin(auth)/admin(coffee).coffee
+++ /dev/null
@@ -1,15 +0,0 @@
-'use strict'
-
-angular.module '<%= scriptAppName %>'
-<% if (filters.ngroute) { %>.config ($routeProvider) ->
- $routeProvider
- .when '/admin',
- templateUrl: 'app/admin/admin.html'
- controller: 'AdminCtrl'
-<% } %><% if (filters.uirouter) { %>.config ($stateProvider) ->
- $stateProvider
- .state 'admin',
- url: '/admin'
- templateUrl: 'app/admin/admin.html'
- controller: 'AdminCtrl'
-<% } %>
diff --git a/app/templates/client/app/admin(auth)/admin.controller(coffee).coffee b/app/templates/client/app/admin(auth)/admin.controller(coffee).coffee
deleted file mode 100644
index 04af43178..000000000
--- a/app/templates/client/app/admin(auth)/admin.controller(coffee).coffee
+++ /dev/null
@@ -1,10 +0,0 @@
-'use strict'
-
-angular.module '<%= scriptAppName %>'
-.controller 'AdminCtrl', ($scope, $http, Auth, User) ->
-
- $scope.users = User.query()
-
- $scope.delete = (user) ->
- User.remove id: user._id
- $scope.users.splice @$index, 1
diff --git a/app/templates/client/app/app(coffee).coffee b/app/templates/client/app/app(coffee).coffee
deleted file mode 100644
index 6458ca920..000000000
--- a/app/templates/client/app/app(coffee).coffee
+++ /dev/null
@@ -1,42 +0,0 @@
-'use strict'
-
-angular.module '<%= scriptAppName %>', [<%- angularModules %>]
-<% if (filters.ngroute) { %>.config ($routeProvider, $locationProvider<% if (filters.auth) { %>, $httpProvider<% } %>) ->
- $routeProvider
- .otherwise
- redirectTo: '/'
-
- $locationProvider.html5Mode true<% if (filters.auth) { %>
- $httpProvider.interceptors.push 'authInterceptor'<% } %>
-<% } %><% if (filters.uirouter) { %>.config ($stateProvider, $urlRouterProvider, $locationProvider<% if (filters.auth) { %>, $httpProvider<% } %>) ->
- $urlRouterProvider
- .otherwise '/'
-
- $locationProvider.html5Mode true<% if (filters.auth) { %>
- $httpProvider.interceptors.push 'authInterceptor'<% } %>
-<% } %><% if (filters.auth) { %>
-.factory 'authInterceptor', ($rootScope, $q, $cookies<% if (filters.ngroute) { %>, $location<% } if (filters.uirouter) { %>, $injector<% } %>) ->
- <% if (filters.uirouter) { %>state = null
- <% } %># Add authorization token to headers
- request: (config) ->
- config.headers = config.headers or {}
- config.headers.Authorization = 'Bearer ' + $cookies.get 'token' if $cookies.get 'token'
- config
-
- # Intercept 401s and redirect you to login
- responseError: (response) ->
- if response.status is 401
- <% if (filters.ngroute) { %>$location.path '/login'<% } if (filters.uirouter) { %>(state || state = $injector.get '$state').go 'login'<% } %>
- # remove any stale tokens
- $cookies.remove 'token'
-
- $q.reject response
-
-.run ($rootScope<% if (filters.ngroute) { %>, $location<% } %><% if (filters.uirouter) { %>, $state<% } %>, Auth) ->
- # Redirect to login if route requires auth and the user is not logged in
- $rootScope.$on <% if (filters.ngroute) { %>'$routeChangeStart'<% } %><% if (filters.uirouter) { %>'$stateChangeStart'<% } %>, (event, next) ->
- if next.authenticate
- Auth.isLoggedIn (loggedIn) ->
- if !loggedIn
- event.preventDefault()
- <% if (filters.ngroute) { %>$location.path '/login'<% } %><% if (filters.uirouter) { %>$state.go 'login'<% }} %>
diff --git a/app/templates/client/app/main/main(coffee).coffee b/app/templates/client/app/main/main(coffee).coffee
deleted file mode 100644
index 04cd367bb..000000000
--- a/app/templates/client/app/main/main(coffee).coffee
+++ /dev/null
@@ -1,15 +0,0 @@
-'use strict'
-
-angular.module '<%= scriptAppName %>'
-<% if (filters.ngroute) { %>.config ($routeProvider) ->
- $routeProvider
- .when '/',
- templateUrl: 'app/main/main.html'
- controller: 'MainCtrl'
-<% } %><% if (filters.uirouter) { %>.config ($stateProvider) ->
- $stateProvider
- .state 'main',
- url: '/'
- templateUrl: 'app/main/main.html'
- controller: 'MainCtrl'
-<% } %>
diff --git a/app/templates/client/app/main/main.controller(coffee).coffee b/app/templates/client/app/main/main.controller(coffee).coffee
deleted file mode 100644
index fdd03c644..000000000
--- a/app/templates/client/app/main/main.controller(coffee).coffee
+++ /dev/null
@@ -1,22 +0,0 @@
-'use strict'
-
-angular.module '<%= scriptAppName %>'
-.controller 'MainCtrl', ($scope, $http<% if (filters.socketio) { %>, socket<% } %>) ->
- $scope.awesomeThings = []
-
- $http.get('/api/things').then (response) ->
- $scope.awesomeThings = response.data
- <% if (filters.socketio) { %>socket.syncUpdates 'thing', $scope.awesomeThings<% } %>
-<% if (filters.models) { %>
- $scope.addThing = ->
- return if $scope.newThing is ''
- $http.post '/api/things',
- name: $scope.newThing
-
- $scope.newThing = ''
-
- $scope.deleteThing = (thing) ->
- $http.delete '/api/things/' + thing._id<% } %><% if (filters.socketio) { %>
-
- $scope.$on '$destroy', ->
- socket.unsyncUpdates 'thing'<% } %>
diff --git a/app/templates/client/app/main/main.controller.spec(coffee).coffee b/app/templates/client/app/main/main.controller.spec(coffee).coffee
deleted file mode 100644
index 0284253d7..000000000
--- a/app/templates/client/app/main/main.controller.spec(coffee).coffee
+++ /dev/null
@@ -1,32 +0,0 @@
-'use strict'
-
-describe 'Controller: MainCtrl', ->
-
- # load the controller's module
- beforeEach module '<%= scriptAppName %>' <% if (filters.uirouter) {%>
- beforeEach module 'stateMock' <% } %><% if (filters.socketio) {%>
- beforeEach module 'socketMock' <% } %>
-
- MainCtrl = undefined
- scope = undefined<% if (filters.uirouter) {%>
- state = undefined<% } %>
- $httpBackend = undefined
-
- # Initialize the controller and a mock scope
- beforeEach inject (_$httpBackend_, $controller, $rootScope<% if (filters.uirouter) {%>, $state<% } %>) ->
- $httpBackend = _$httpBackend_
- $httpBackend.expectGET('/api/things').respond [
- 'HTML5 Boilerplate'
- 'AngularJS'
- 'Karma'
- 'Express'
- ]
- scope = $rootScope.$new()<% if (filters.uirouter) {%>
- state = $state<% } %>
- MainCtrl = $controller 'MainCtrl',
- $scope: scope
-
- it 'should attach a list of things to the scope', ->
- $httpBackend.flush()<% if (filters.jasmine) { %>
- expect(scope.awesomeThings.length).toBe 4 <% } if (filters.mocha) { %>
- <%= expect() %>scope.awesomeThings.length<%= to() %>.equal 4<% } %>
diff --git a/app/templates/client/components/auth(auth)/auth.service(coffee).coffee b/app/templates/client/components/auth(auth)/auth.service(coffee).coffee
deleted file mode 100644
index 2892d04ed..000000000
--- a/app/templates/client/components/auth(auth)/auth.service(coffee).coffee
+++ /dev/null
@@ -1,150 +0,0 @@
-'use strict'
-
-angular.module '<%= scriptAppName %>'
-.factory 'Auth', ($http, User, $cookies, $q) ->
- currentUser = if $cookies.get 'token' then User.get() else {}
-
- ###
- Authenticate user and save token
-
- @param {Object} user - login info
- @param {Function} callback - optional, function(error, user)
- @return {Promise}
- ###
- login: (user, callback) ->
- $http.post '/auth/local',
- email: user.email
- password: user.password
-
- .then (res) ->
- $cookies.put 'token', res.data.token
- currentUser = User.get()
- currentUser.$promise
-
- .then (user) ->
- callback? null, user
- user
-
- .catch (err) =>
- @logout()
- callback? err.data
- $q.reject err.data
-
-
- ###
- Delete access token and user info
- ###
- logout: ->
- $cookies.remove 'token'
- currentUser = {}
- return
-
-
- ###
- Create a new user
-
- @param {Object} user - user info
- @param {Function} callback - optional, function(error, user)
- @return {Promise}
- ###
- createUser: (user, callback) ->
- User.save user,
- (data) ->
- $cookies.put 'token', data.token
- currentUser = User.get()
- callback? null, user
-
- , (err) =>
- @logout()
- callback? err
-
- .$promise
-
-
- ###
- Change password
-
- @param {String} oldPassword
- @param {String} newPassword
- @param {Function} callback - optional, function(error, user)
- @return {Promise}
- ###
- changePassword: (oldPassword, newPassword, callback) ->
- User.changePassword
- id: currentUser._id
- ,
- oldPassword: oldPassword
- newPassword: newPassword
-
- , () ->
- callback? null
-
- , (err) ->
- callback? err
-
- .$promise
-
-
- ###
- Gets all available info on a user
- (synchronous|asynchronous)
-
- @param {Function|*} callback - optional, funciton(user)
- @return {Object|Promise}
- ###
- getCurrentUser: (callback) ->
- return currentUser if arguments.length is 0
-
- value = if (currentUser.hasOwnProperty("$promise")) then currentUser.$promise else currentUser
- $q.when value
-
- .then (user) ->
- callback? user
- user
-
- , ->
- callback? {}
- {}
-
-
- ###
- Check if a user is logged in
- (synchronous|asynchronous)
-
- @param {Function|*} callback - optional, function(is)
- @return {Bool|Promise}
- ###
- isLoggedIn: (callback) ->
- return currentUser.hasOwnProperty("role") if arguments.length is 0
-
- @getCurrentUser null
-
- .then (user) ->
- is_ = user.hasOwnProperty("role")
- callback? is_
- is_
-
-
- ###
- Check if a user is an admin
- (synchronous|asynchronous)
-
- @param {Function|*} callback - optional, function(is)
- @return {Bool|Promise}
- ###
- isAdmin: (callback) ->
- return currentUser.role is "admin" if arguments.length is 0
-
- @getCurrentUser null
-
- .then (user) ->
- is_ = user.role is "admin"
- callback? is_
- is_
-
-
- ###
- Get auth token
- ###
- getToken: ->
- $cookies.get 'token'
diff --git a/app/templates/client/components/auth(auth)/user.service(coffee).coffee b/app/templates/client/components/auth(auth)/user.service(coffee).coffee
deleted file mode 100644
index e0dc2e839..000000000
--- a/app/templates/client/components/auth(auth)/user.service(coffee).coffee
+++ /dev/null
@@ -1,17 +0,0 @@
-'use strict'
-
-angular.module '<%= scriptAppName %>'
-.factory 'User', ($resource) ->
- $resource '/api/users/:id/:controller',
- id: '@_id'
- ,
- changePassword:
- method: 'PUT'
- params:
- controller: 'password'
-
- get:
- method: 'GET'
- params:
- id: 'me'
-
diff --git a/app/templates/client/components/footer/footer.directive(coffee).coffee b/app/templates/client/components/footer/footer.directive(coffee).coffee
deleted file mode 100644
index 467006759..000000000
--- a/app/templates/client/components/footer/footer.directive(coffee).coffee
+++ /dev/null
@@ -1,8 +0,0 @@
-'use strict'
-
-angular.module '<%= scriptAppName %>'
-.directive 'footer', ->
- templateUrl: 'components/footer/footer.html'
- restrict: 'E',
- link: (scope, element) ->
- element.addClass('footer')
diff --git a/app/templates/client/components/modal(uibootstrap)/modal.service(coffee).coffee b/app/templates/client/components/modal(uibootstrap)/modal.service(coffee).coffee
deleted file mode 100644
index eae01f69f..000000000
--- a/app/templates/client/components/modal(uibootstrap)/modal.service(coffee).coffee
+++ /dev/null
@@ -1,71 +0,0 @@
-'use strict'
-
-angular.module '<%= scriptAppName %>'
-.factory 'Modal', ($rootScope, $modal) ->
-
- ###
- Opens a modal
- @param {Object} scope - an object to be merged with modal's scope
- @param {String} modalClass - (optional) class(es) to be applied to the modal
- @return {Object} - the instance $modal.open() returns
- ###
- openModal = (scope, modalClass) ->
- modalScope = $rootScope.$new()
- scope = scope or {}
- modalClass = modalClass or 'modal-default'
- angular.extend modalScope, scope
- $modal.open
- templateUrl: 'components/modal/modal.html'
- windowClass: modalClass
- scope: modalScope
-
-
- # Public API here
-
- # Confirmation modals
- confirm:
-
- ###
- Create a function to open a delete confirmation modal (ex. ng-click='myModalFn(name, arg1, arg2...)')
- @param {Function} del - callback, ran when delete is confirmed
- @return {Function} - the function to open the modal (ex. myModalFn)
- ###
- delete: (del) ->
- del = del or angular.noop
-
- ###
- Open a delete confirmation modal
- @param {String} name - name or info to show on modal
- @param {All} - any additional args are passed staight to del callback
- ###
- ->
- args = Array::slice.call arguments
- name = args.shift()
- deleteModal = undefined
- deleteModal = openModal(
- modal:
- dismissable: true
- title: 'Confirm Delete'
- html: 'Are you sure you want to delete ' + name + ' ?
'
- buttons: [
- {
- classes: 'btn-danger'
- text: 'Delete'
- click: (e) ->
- deleteModal.close e
- return
- }
- {
- classes: 'btn-default'
- text: 'Cancel'
- click: (e) ->
- deleteModal.dismiss e
- return
- }
- ]
- , 'modal-danger')
- deleteModal.result.then (event) ->
- del.apply event, args
- return
-
- return
diff --git a/app/templates/client/components/mongoose-error(auth)/mongoose-error.directive(coffee).coffee b/app/templates/client/components/mongoose-error(auth)/mongoose-error.directive(coffee).coffee
deleted file mode 100644
index cf0e1ccf0..000000000
--- a/app/templates/client/components/mongoose-error(auth)/mongoose-error.directive(coffee).coffee
+++ /dev/null
@@ -1,12 +0,0 @@
-'use strict'
-
-###
-Removes server error when user updates input
-###
-angular.module '<%= scriptAppName %>'
-.directive 'mongooseError', ->
- restrict: 'A'
- require: 'ngModel'
- link: (scope, element, attrs, ngModel) ->
- element.on 'keydown', ->
- ngModel.$setValidity 'mongoose', true
diff --git a/app/templates/client/components/navbar/navbar.controller(coffee).coffee b/app/templates/client/components/navbar/navbar.controller(coffee).coffee
deleted file mode 100644
index 98eaf2213..000000000
--- a/app/templates/client/components/navbar/navbar.controller(coffee).coffee
+++ /dev/null
@@ -1,15 +0,0 @@
-'use strict'
-
-angular.module '<%= scriptAppName %>'
-.controller 'NavbarCtrl', ($scope<% if(!filters.uirouter) { %>, $location<% } %><% if (filters.auth) {%>, Auth<% } %>) ->
- $scope.menu = [
- title: 'Home'
- <% if (filters.uirouter) { %>state: 'main'<% } else { %>link: '/'<% } %>
- ]
- $scope.isCollapsed = true<% if (filters.auth) {%>
- $scope.isLoggedIn = Auth.isLoggedIn
- $scope.isAdmin = Auth.isAdmin
- $scope.getCurrentUser = Auth.getCurrentUser<% } %><% if(!filters.uirouter) { %>
-
- $scope.isActive = (route) ->
- route is $location.path()<% } %>
diff --git a/app/templates/client/components/navbar/navbar.directive(coffee).coffee b/app/templates/client/components/navbar/navbar.directive(coffee).coffee
deleted file mode 100644
index bea476822..000000000
--- a/app/templates/client/components/navbar/navbar.directive(coffee).coffee
+++ /dev/null
@@ -1,7 +0,0 @@
-'use strict'
-
-angular.module '<%= scriptAppName %>'
-.directive 'navbar', ->
- templateUrl: 'components/navbar/navbar.html'
- restrict: 'E'
- controller: 'NavbarCtrl'
diff --git a/app/templates/client/components/oauth-buttons(oauth)/oauth-buttons.controller(coffee).coffee b/app/templates/client/components/oauth-buttons(oauth)/oauth-buttons.controller(coffee).coffee
deleted file mode 100644
index 4dca2832f..000000000
--- a/app/templates/client/components/oauth-buttons(oauth)/oauth-buttons.controller(coffee).coffee
+++ /dev/null
@@ -1,7 +0,0 @@
-'use strict'
-
-angular.module('<%= scriptAppName %>')
-.controller 'OauthButtonsCtrl', ($window) ->
- @loginOauth = (provider) ->
- $window.location.href = '/auth/' + provider
- return;
diff --git a/app/templates/client/components/oauth-buttons(oauth)/oauth-buttons.controller.spec(coffee).coffee b/app/templates/client/components/oauth-buttons(oauth)/oauth-buttons.controller.spec(coffee).coffee
deleted file mode 100644
index 59b4dd9e4..000000000
--- a/app/templates/client/components/oauth-buttons(oauth)/oauth-buttons.controller.spec(coffee).coffee
+++ /dev/null
@@ -1,20 +0,0 @@
-'use strict'
-
-describe 'Controller: OauthButtonsCtrl', ->
- # load the controller's module
- beforeEach module('<%= scriptAppName %>')
-
- OauthButtonsCtrl = null
- $window = null
-
- # Initialize the controller and a mock $window
- beforeEach inject ($controller) ->
- $window = location: {}
- OauthButtonsCtrl = $controller 'OauthButtonsCtrl', $window: $window
- return
-
- it 'should attach loginOauth', -><% if (filters.jasmine) { %>
- expect(OauthButtonsCtrl.loginOauth).toEqual jasmine.any Function<% } if (filters.mocha) { %>
- <%= expect() %>OauthButtonsCtrl.loginOauth<%= to() %>.be.a 'function' <% } %>
- return
- return
diff --git a/app/templates/client/components/oauth-buttons(oauth)/oauth-buttons.directive(coffee).coffee b/app/templates/client/components/oauth-buttons(oauth)/oauth-buttons.directive(coffee).coffee
deleted file mode 100644
index f009e5b1d..000000000
--- a/app/templates/client/components/oauth-buttons(oauth)/oauth-buttons.directive(coffee).coffee
+++ /dev/null
@@ -1,9 +0,0 @@
-'use strict'
-
-angular.module('<%= scriptAppName %>')
-.directive 'oauthButtons', ->
- templateUrl: 'components/oauth-buttons/oauth-buttons.html'
- restrict: 'EA'
- controller: 'OauthButtonsCtrl'
- controllerAs: 'OauthButtons'
- scope: classes: '@'
diff --git a/app/templates/client/components/oauth-buttons(oauth)/oauth-buttons.directive.spec(coffee).coffee b/app/templates/client/components/oauth-buttons(oauth)/oauth-buttons.directive.spec(coffee).coffee
deleted file mode 100644
index 903d05476..000000000
--- a/app/templates/client/components/oauth-buttons(oauth)/oauth-buttons.directive.spec(coffee).coffee
+++ /dev/null
@@ -1,51 +0,0 @@
-'use strict'
-
-describe 'Directive: oauthButtons', ->
- # load the directive's module and view
- beforeEach module('<%= scriptAppName %>')
- beforeEach module('components/oauth-buttons/oauth-buttons.html')
-
- element = null
- parentScope = null
- elementScope = null
-
- compileDirective = (template) ->
- inject ($compile) ->
- element = angular.element template
- element = $compile(element) parentScope
- parentScope.$digest()
- elementScope = element.isolateScope()
-
- beforeEach inject ($rootScope) ->
- parentScope = $rootScope.$new()
-
- it 'should contain anchor buttons', ->
- compileDirective ''<% if (filters.jasmine) { %>
- expect(element.find('a.btn<% if (filters.bootstrap) { %>.btn-social<% } %>').length).toBeGreaterThan 0<% } if (filters.mocha) { %>
- <%= expect() %>element.find('a.btn<% if (filters.bootstrap) { %>.btn-social<% } %>').length<%= to() %>.be.at.least 1<% } %>
- return
-
- it 'should evaluate and bind the classes attribute to scope.classes', ->
- parentScope.scopedClass = 'scopedClass1'
- compileDirective ''<% if (filters.jasmine) { %>
- expect(elementScope.classes).toEqual 'testClass1 scopedClass1'<% } if (filters.mocha) { %>
- <%= expect() %>elementScope.classes<%= to() %>.equal 'testClass1 scopedClass1'<% } %>
- return
-
- it 'should bind scope.classes to class names on the anchor buttons', ->
- compileDirective ''
-
- # Add classes
- elementScope.classes = 'testClass1 testClass2'
- elementScope.$digest()<% if (filters.jasmine) { %>
- expect(element.find('a.btn<% if (filters.bootstrap) { %>.btn-social<% } %>.testClass1.testClass2').length).toBeGreaterThan 0<% } if (filters.mocha) { %>
- <%= expect() %>element.find('a.btn<% if (filters.bootstrap) { %>.btn-social<% } %>.testClass1.testClass2').length<%= to() %>.be.at.least 1<% } %>
-
- # Remove classes
- elementScope.classes = ''
- elementScope.$digest()<% if (filters.jasmine) { %>
- expect(element.find('a.btn<% if (filters.bootstrap) { %>.btn-social<% } %>.testClass1.testClass2').length).toEqual 0<% } if (filters.mocha) { %>
- <%= expect() %>element.find('a.btn<% if (filters.bootstrap) { %>.btn-social<% } %>.testClass1.testClass2').length<%= to() %>.equal 0<% } %>
-
- return
- return
diff --git a/app/templates/client/components/socket(socketio)/socket.mock(coffee).coffee b/app/templates/client/components/socket(socketio)/socket.mock(coffee).coffee
deleted file mode 100644
index 6f565bbc2..000000000
--- a/app/templates/client/components/socket(socketio)/socket.mock(coffee).coffee
+++ /dev/null
@@ -1,15 +0,0 @@
-'use strict'
-
-angular.module 'socketMock', []
-.factory 'socket', ->
- socket:
- connect: ->
-
- on: ->
-
- emit: ->
-
- receive: ->
-
- syncUpdates: ->
- unsyncUpdates: ->
diff --git a/app/templates/client/components/socket(socketio)/socket.service(coffee).coffee b/app/templates/client/components/socket(socketio)/socket.service(coffee).coffee
deleted file mode 100644
index 3fef1c00e..000000000
--- a/app/templates/client/components/socket(socketio)/socket.service(coffee).coffee
+++ /dev/null
@@ -1,67 +0,0 @@
-# global io
-
-'use strict'
-
-angular.module '<%= scriptAppName %>'
-.factory 'socket', (socketFactory) ->
-
- # socket.io now auto-configures its connection when we omit a connection url
- ioSocket = io '',
- # Send auth token on connection, you will need to DI the Auth service above
- # 'query': 'token=' + Auth.getToken()
- path: '/socket.io-client'
-
- socket = socketFactory ioSocket: ioSocket
-
- socket: socket
-
- ###
- Register listeners to sync an array with updates on a model
-
- Takes the array we want to sync, the model name that socket updates are sent from,
- and an optional callback function after new items are updated.
-
- @param {String} modelName
- @param {Array} array
- @param {Function} callback
- ###
- syncUpdates: (modelName, array, callback) ->
-
- ###
- Syncs item creation/updates on 'model:save'
- ###
- socket.on modelName + ':save', (item) ->
- oldItem = _.find array,
- _id: item._id
-
- index = array.indexOf oldItem
- event = 'created'
-
- # replace oldItem if it exists
- # otherwise just add item to the collection
- if oldItem
- array.splice index, 1, item
- event = 'updated'
- else
- array.push item
-
- callback? event, item, array
-
- ###
- Syncs removed items on 'model:remove'
- ###
- socket.on modelName + ':remove', (item) ->
- event = 'deleted'
- _.remove array,
- _id: item._id
-
- callback? event, item, array
-
- ###
- Removes listeners for a models updates on the socket
-
- @param modelName
- ###
- unsyncUpdates: (modelName) ->
- socket.removeAllListeners modelName + ':save'
- socket.removeAllListeners modelName + ':remove'
diff --git a/app/templates/client/components/ui-router(uirouter)/ui-router.mock(coffee).coffee b/app/templates/client/components/ui-router(uirouter)/ui-router.mock(coffee).coffee
deleted file mode 100644
index ff3937c35..000000000
--- a/app/templates/client/components/ui-router(uirouter)/ui-router.mock(coffee).coffee
+++ /dev/null
@@ -1,26 +0,0 @@
-'use strict'
-
-angular.module 'stateMock', []
-angular.module('stateMock').service '$state', ($q) ->
- @expectedTransitions = []
-
- @transitionTo = (stateName) ->
- if @expectedTransitions.length > 0
- expectedState = @expectedTransitions.shift()
- throw Error('Expected transition to state: ' + expectedState + ' but transitioned to ' + stateName) if expectedState isnt stateName
- else
- throw Error('No more transitions were expected! Tried to transition to ' + stateName)
- console.log 'Mock transition to: ' + stateName
- deferred = $q.defer()
- promise = deferred.promise
- deferred.resolve()
- promise
-
- @go = @transitionTo
-
- @expectTransitionTo = (stateName) ->
- @expectedTransitions.push stateName
-
- @ensureAllTransitionsHappened = ->
- throw Error('Not all transitions happened!') if @expectedTransitions.length > 0
- @
diff --git a/app/templates/karma.conf.js b/app/templates/karma.conf.js
index 9b46a3a22..61aa87b74 100644
--- a/app/templates/karma.conf.js
+++ b/app/templates/karma.conf.js
@@ -22,11 +22,8 @@ module.exports = function(config) {
// endbower<% if (filters.socketio) { %>
'node_modules/socket.io-client/socket.io.js',<% } %>
'client/app/app.js',
- 'client/app/app.coffee',
'client/app/**/*.js',
- 'client/app/**/*.coffee',
'client/components/**/*.js',
- 'client/components/**/*.coffee',
'client/app/**/*.jade',
'client/components/**/*.jade',
'client/app/**/*.html',
@@ -36,8 +33,7 @@ module.exports = function(config) {
preprocessors: {
'**/*.jade': 'ng-jade2js',
'**/*.html': 'html2js',<% if(filters.babel) { %>
- 'client/{app,components}/**/*.js': 'babel',<% } %>
- '**/*.coffee': 'coffee',
+ 'client/{app,components}/**/*.js': 'babel'<% } %>
},
ngHtml2JsPreprocessor: {
diff --git a/app/templates/server/config/seed(models).js b/app/templates/server/config/seed(models).js
index a0e5edb76..81f3c6b5c 100644
--- a/app/templates/server/config/seed(models).js
+++ b/app/templates/server/config/seed(models).js
@@ -19,9 +19,9 @@ var User = sqldb.User;<% } %><% } %>
<% if (filters.mongooseModels) { %>Thing.create({<% }
if (filters.sequelizeModels) { %>Thing.bulkCreate([{<% } %>
name: 'Development Tools',
- info: 'Integration with popular tools such as Bower, Grunt, Karma, ' +
+ info: 'Integration with popular tools such as Bower, Grunt, Babel, Karma, ' +
'Mocha, JSHint, Node Inspector, Livereload, Protractor, Jade, ' +
- 'Stylus, Sass, CoffeeScript, and Less.'
+ 'Stylus, Sass, and Less.'
}, {
name: 'Server and Client integration',
info: 'Built with a powerful and fun stack: MongoDB, Express, ' +
diff --git a/readme.md b/readme.md
index f4ccb9ba7..d00f531cd 100644
--- a/readme.md
+++ b/readme.md
@@ -43,7 +43,7 @@ Run `grunt` for building, `grunt serve` for preview, and `grunt serve:dist` for
**Client**
-* Scripts: `JavaScript`, `CoffeeScript`, `Babel`
+* Scripts: `JavaScript`, `Babel`
* Markup: `HTML`, `Jade`
* Stylesheets: `CSS`, `Stylus`, `Sass`, `Less`,
* Angular Routers: `ngRoute`, `ui-router`
@@ -64,7 +64,6 @@ A grunt task looks for new files in your `client/app` and `client/components` fo
* `stylus` files into `client/app.styl`
* `css` files into `client/index.html`
* `js` files into `client/index.html`
-* `coffeescript` temp `js` files into `client/index.html`
* `babel` temp `js` files into `client/index.html`
## Generators
diff --git a/test/fixtures/.yo-rc.json b/test/fixtures/.yo-rc.json
index 01d568984..716e42b6c 100644
--- a/test/fixtures/.yo-rc.json
+++ b/test/fixtures/.yo-rc.json
@@ -13,7 +13,7 @@
"registerModelsFile": "server/sqldb/index.js",
"modelsNeedle": "// Insert models below",
"filters": {
- "coffee": true,
+ "babel": true,
"html": true,
"less": true,
"uirouter": true,
diff --git a/test/test-file-creation.js b/test/test-file-creation.js
index cca66a78f..bfcfebe5a 100644
--- a/test/test-file-creation.js
+++ b/test/test-file-creation.js
@@ -136,8 +136,7 @@ describe('angular-fullstack generator', function () {
html: 'html'
},
script: {
- js: 'js',
- coffee: 'coffee'
+ js: 'js'
}
},
files = [];
@@ -475,7 +474,6 @@ describe('angular-fullstack generator', function () {
gen.run(function () {
assert.file([
'client/app/main/main.less',
- 'client/app/main/main.coffee',
'server/auth/google/passport.js'
]);
done();
@@ -508,7 +506,8 @@ describe('angular-fullstack generator', function () {
describe('with other preprocessors and oauth', function() {
var testOptions = {
- script: 'coffee',
+ script: 'js',
+ babel: true,
markup: 'jade',
stylesheet: 'less',
router: 'uirouter',
@@ -652,7 +651,8 @@ describe('angular-fullstack generator', function () {
describe('with other preprocessors and no server options', function() {
var testOptions = {
- script: 'coffee',
+ script: 'js',
+ babel: true,
markup: 'jade',
stylesheet: 'stylus',
router: 'ngroute',
From 4cee3186fb3d3b536b3932757f6cc0e17e3d3acf Mon Sep 17 00:00:00 2001
From: Andrew Koroluk
Date: Thu, 10 Sep 2015 21:30:52 -0400
Subject: [PATCH 0042/1129] feat(gen): add note about being prerelease version
---
app/generator.js | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/app/generator.js b/app/generator.js
index 915d5d380..548240e0b 100644
--- a/app/generator.js
+++ b/app/generator.js
@@ -37,6 +37,12 @@ export default class Generator extends Base {
},
info: function () {
+ this.log(chalk.red(`
+################################################################
+# NOTE: You are using a pre-release version of
+# generator-angular-fullstack. For a more stable version, run
+# \`npm install -g generator-angular-fullstack@^2.0.0\`
+################################################################`));
this.log(this.yoWelcome);
this.log('Out of the box I create an AngularJS app with an Express server.\n');
},
From f56ab60c03434c52bd8f1ed5d82c4e89fd310d6a Mon Sep 17 00:00:00 2001
From: Andrew Koroluk
Date: Thu, 10 Sep 2015 21:17:16 -0400
Subject: [PATCH 0043/1129] feat(gen): Show gen version in console & add to
.yo-rc.json
---
app/generator.js | 2 ++
1 file changed, 2 insertions(+)
diff --git a/app/generator.js b/app/generator.js
index 548240e0b..a68fa0b35 100644
--- a/app/generator.js
+++ b/app/generator.js
@@ -30,6 +30,7 @@ export default class Generator extends Base {
return {
init: function () {
+ this.config.set('generatorVersion', this.rootGeneratorVersion());
this.filters = {};
// init shared generator properies and methods
@@ -43,6 +44,7 @@ export default class Generator extends Base {
# generator-angular-fullstack. For a more stable version, run
# \`npm install -g generator-angular-fullstack@^2.0.0\`
################################################################`));
+ this.log('You\'re using the Angular Full-Stack Generator, version ' + this.rootGeneratorVersion());
this.log(this.yoWelcome);
this.log('Out of the box I create an AngularJS app with an Express server.\n');
},
From 7a2c01eb7c26cdc69a0c76a05e58e6bfb2ab8b4b Mon Sep 17 00:00:00 2001
From: kingcody
Date: Fri, 11 Sep 2015 00:29:26 -0400
Subject: [PATCH 0044/1129] fix(gen): require `q` and `grunt` in gruntUtils
---
Gruntfile.js | 8 ++--
task-utils/grunt.js | 112 +++++++++++++++++++++++---------------------
2 files changed, 62 insertions(+), 58 deletions(-)
diff --git a/Gruntfile.js b/Gruntfile.js
index e776b3c48..64e407a11 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -4,14 +4,14 @@ var shell = require('shelljs');
var child_process = require('child_process');
var Q = require('q');
var helpers = require('yeoman-generator').test;
-var gruntUtils = require('./task-utils/grunt');
var fs = require('fs');
var path = require('path');
-var gitCmd = gruntUtils.gitCmd;
-var gitCmdAsync = gruntUtils.gitCmdAsync;
-
module.exports = function (grunt) {
+ var gruntUtils = require('./task-utils/grunt')(grunt);
+ var gitCmd = gruntUtils.gitCmd;
+ var gitCmdAsync = gruntUtils.gitCmdAsync;
+
// Load grunt tasks automatically, when needed
require('jit-grunt')(grunt, {
buildcontrol: 'grunt-build-control'
diff --git a/task-utils/grunt.js b/task-utils/grunt.js
index 70a598b8b..973a01073 100644
--- a/task-utils/grunt.js
+++ b/task-utils/grunt.js
@@ -2,72 +2,76 @@
var path = require('path');
var fs = require('fs');
+var Q = require('q');
-exports = module.exports = {
- gitCmd: function gitCmd(args, opts, done) {
- grunt.util.spawn({
- cmd: process.platform === 'win32' ? 'git.cmd' : 'git',
- args: args,
- opts: opts || {}
- }, done);
- },
+exports = module.exports = function(grunt) {
+ var self;
+ return self = {
+ gitCmd: function(args, opts, done) {
+ grunt.util.spawn({
+ cmd: process.platform === 'win32' ? 'git.cmd' : 'git',
+ args: args,
+ opts: opts || {}
+ }, done);
+ },
- gitCmdAsync: function gitCmdAsync(args, opts) {
- return function() {
- var deferred = Q.defer();
- gitCmd(args, opts, function(err) {
- if (err) { return deferred.reject(err); }
- deferred.resolve();
- });
- return deferred.promise;
- };
- },
+ gitCmdAsync: function(args, opts) {
+ return function() {
+ var deferred = Q.defer();
+ self.gitCmd(args, opts, function(err) {
+ if (err) { return deferred.reject(err); }
+ deferred.resolve();
+ });
+ return deferred.promise;
+ };
+ },
- conventionalChangelog: {
- finalizeContext: function(context, writerOpts, commits, keyCommit) {
- var gitSemverTags = context.gitSemverTags;
- var commitGroups = context.commitGroups;
+ conventionalChangelog: {
+ finalizeContext: function(context, writerOpts, commits, keyCommit) {
+ var gitSemverTags = context.gitSemverTags;
+ var commitGroups = context.commitGroups;
- if ((!context.currentTag || !context.previousTag) && keyCommit) {
- var match = /tag:\s*(.+?)[,\)]/gi.exec(keyCommit.gitTags);
- var currentTag = context.currentTag = context.currentTag || match ? match[1] : null;
- var index = gitSemverTags.indexOf(currentTag);
- var previousTag = context.previousTag = gitSemverTags[index + 1];
+ if ((!context.currentTag || !context.previousTag) && keyCommit) {
+ var match = /tag:\s*(.+?)[,\)]/gi.exec(keyCommit.gitTags);
+ var currentTag = context.currentTag = context.currentTag || match ? match[1] : null;
+ var index = gitSemverTags.indexOf(currentTag);
+ var previousTag = context.previousTag = gitSemverTags[index + 1];
- if (!previousTag) {
- if (options.append) {
- context.previousTag = context.previousTag || commits[0] ? commits[0].hash : null;
- } else {
- context.previousTag = context.previousTag || commits[commits.length - 1] ? commits[commits.length - 1].hash : null;
+ if (!previousTag) {
+ if (options.append) {
+ context.previousTag = context.previousTag || commits[0] ? commits[0].hash : null;
+ } else {
+ context.previousTag = context.previousTag || commits[commits.length - 1] ? commits[commits.length - 1].hash : null;
+ }
}
+ } else {
+ context.previousTag = context.previousTag || gitSemverTags[0];
+ context.currentTag = context.currentTag || 'v' + context.version;
}
- } else {
- context.previousTag = context.previousTag || gitSemverTags[0];
- context.currentTag = context.currentTag || 'v' + context.version;
- }
- if (typeof context.linkCompare !== 'boolean' && context.previousTag && context.currentTag) {
- context.linkCompare = true;
- }
+ if (typeof context.linkCompare !== 'boolean' && context.previousTag && context.currentTag) {
+ context.linkCompare = true;
+ }
- if (Array.isArray(commitGroups)) {
- for (var i = 0, commitGroupsLength = commitGroups.length; i < commitGroupsLength; i++) {
- var commits = commitGroups[i].commits;
- if (Array.isArray(commits)) {
- for (var n = 1, commitsLength = commits.length; n < commitsLength; n++) {
- var commit = commits[n], prevCommit = commits[n - 1];
- if (commit.scope && commit.scope === prevCommit.scope) {
- commit.subScope = true;
- if (prevCommit.scope && !prevCommit.subScope) {
- prevCommit.leadScope = true;
+ if (Array.isArray(commitGroups)) {
+ for (var i = 0, commitGroupsLength = commitGroups.length; i < commitGroupsLength; i++) {
+ var commits = commitGroups[i].commits;
+ if (Array.isArray(commits)) {
+ for (var n = 1, commitsLength = commits.length; n < commitsLength; n++) {
+ var commit = commits[n], prevCommit = commits[n - 1];
+ if (commit.scope && commit.scope === prevCommit.scope) {
+ commit.subScope = true;
+ if (prevCommit.scope && !prevCommit.subScope) {
+ prevCommit.leadScope = true;
+ }
}
}
}
}
}
- }
- return context;
- },
- commitPartial: fs.readFileSync(path.resolve(__dirname, 'changelog-templates', 'commit.hbs')).toString()
- }
+ return context;
+ },
+ commitPartial: fs.readFileSync(path.resolve(__dirname, 'changelog-templates', 'commit.hbs')).toString()
+ }
+ };
};
From a958f90ca4243109e13f1ee5cccbb646cf33d961 Mon Sep 17 00:00:00 2001
From: Andrew Koroluk
Date: Fri, 11 Sep 2015 16:55:26 -0400
Subject: [PATCH 0045/1129] fix(npm): always include grunt-babel
Closes #1282
---
app/templates/_package.json | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/templates/_package.json b/app/templates/_package.json
index 8017603f3..212759cf1 100644
--- a/app/templates/_package.json
+++ b/app/templates/_package.json
@@ -52,8 +52,8 @@
"grunt-contrib-coffee": "^0.13.0",<% } %><% if (filters.jade) { %>
"grunt-contrib-jade": "^0.15.0",<% } %><% if (filters.less) { %>
"grunt-contrib-less": "^1.0.0",<% } %><% if(filters.babel) { %>
- "karma-babel-preprocessor": "^5.2.1",
- "grunt-babel": "~5.0.0",<% } %>
+ "karma-babel-preprocessor": "^5.2.1",<% } %>
+ "grunt-babel": "~5.0.0",
"grunt-google-cdn": "~0.4.0",
"grunt-jscs": "^2.0.0",
"grunt-newer": "^1.1.1",
From 7d7daee655d3ebb76a0f6b9f1e25d0af687688d9 Mon Sep 17 00:00:00 2001
From: Andrew Koroluk
Date: Wed, 2 Sep 2015 19:48:11 -0400
Subject: [PATCH 0046/1129] refactor(client:main): use controller as, named
function, new name
controller as main, MainCtrl -> MainController
---
app/templates/client/app/main/main(html).html | 8 ++--
app/templates/client/app/main/main(jade).jade | 8 ++--
app/templates/client/app/main/main(js).js | 6 ++-
.../client/app/main/main.controller(js).js | 48 +++++++++++--------
.../app/main/main.controller.spec(js).js | 14 +++---
5 files changed, 46 insertions(+), 38 deletions(-)
diff --git a/app/templates/client/app/main/main(html).html b/app/templates/client/app/main/main(html).html
index 0d745d9a8..4f85aa54e 100644
--- a/app/templates/client/app/main/main(html).html
+++ b/app/templates/client/app/main/main(html).html
@@ -12,8 +12,8 @@ 'Allo, 'Allo!
<% if (filters.socketio) { %>
@@ -21,9 +21,9 @@
<% } %>
diff --git a/app/templates/client/app/main/main(jade).jade b/app/templates/client/app/main/main(jade).jade
index 3277e7b05..54d1d7e9c 100644
--- a/app/templates/client/app/main/main(jade).jade
+++ b/app/templates/client/app/main/main(jade).jade
@@ -10,17 +10,17 @@ header#banner.hero-unit
.row
.col-lg-12
h1.page-header Features:
- ul.nav.nav-tabs.nav-stacked.col-md-4.col-lg-4.col-sm-6(ng-repeat='thing in awesomeThings')
+ ul.nav.nav-tabs.nav-stacked.col-md-4.col-lg-4.col-sm-6(ng-repeat='thing in main.awesomeThings')
li
a(href='#', tooltip='{{thing.info}}')
| {{thing.name}}<% if (filters.socketio) { %>
- button.close(type='button', ng-click='deleteThing(thing)') ×<% } %><% if (filters.socketio) { %>
+ button.close(type='button', ng-click='main.deleteThing(thing)') ×<% } %><% if (filters.socketio) { %>
form.thing-form
label Syncs in realtime across clients
p.input-group
- input.form-control(type='text', placeholder='Add a new thing here.', ng-model='newThing')
+ input.form-control(type='text', placeholder='Add a new thing here.', ng-model='main.newThing')
span.input-group-btn
- button.btn.btn-primary(type='submit', ng-click='addThing()') Add New<% } %>
+ button.btn.btn-primary(type='submit', ng-click='main.addThing()') Add New<% } %>
footer
diff --git a/app/templates/client/app/main/main(js).js b/app/templates/client/app/main/main(js).js
index 165181ffe..a22d74e4e 100644
--- a/app/templates/client/app/main/main(js).js
+++ b/app/templates/client/app/main/main(js).js
@@ -5,13 +5,15 @@ angular.module('<%= scriptAppName %>')
$routeProvider
.when('/', {
templateUrl: 'app/main/main.html',
- controller: 'MainCtrl'
+ controller: 'MainController',
+ conterollerAs: 'main'
});
});<% } %><% if (filters.uirouter) { %>.config(function($stateProvider) {
$stateProvider
.state('main', {
url: '/',
templateUrl: 'app/main/main.html',
- controller: 'MainCtrl'
+ controller: 'MainController',
+ conterollerAs: 'main'
});
});<% } %>
diff --git a/app/templates/client/app/main/main.controller(js).js b/app/templates/client/app/main/main.controller(js).js
index 91ba5d131..35fd95951 100644
--- a/app/templates/client/app/main/main.controller(js).js
+++ b/app/templates/client/app/main/main.controller(js).js
@@ -1,27 +1,33 @@
'use strict';
+(function() {
-angular.module('<%= scriptAppName %>')
- .controller('MainCtrl', function($scope, $http<% if (filters.socketio) { %>, socket<% } %>) {
- $scope.awesomeThings = [];
+function MainController($scope, $http<% if (filters.socketio) { %>, socket<% } %>) {
+ var self = this;
+ this.awesomeThings = [];
- $http.get('/api/things').then(function(response) {
- $scope.awesomeThings = response.data;<% if (filters.socketio) { %>
- socket.syncUpdates('thing', $scope.awesomeThings);<% } %>
- });
+ $http.get('/api/things').then(function(response) {
+ self.awesomeThings = response.data;<% if (filters.socketio) { %>
+ socket.syncUpdates('thing', self.awesomeThings);<% } %>
+ });
<% if (filters.models) { %>
- $scope.addThing = function() {
- if ($scope.newThing === '') {
- return;
- }
- $http.post('/api/things', { name: $scope.newThing });
- $scope.newThing = '';
- };
+ this.addThing = function() {
+ if (self.newThing === '') {
+ return;
+ }
+ $http.post('/api/things', { name: self.newThing });
+ self.newThing = '';
+ };
- $scope.deleteThing = function(thing) {
- $http.delete('/api/things/' + thing._id);
- };<% } %><% if (filters.socketio) { %>
+ this.deleteThing = function(thing) {
+ $http.delete('/api/things/' + thing._id);
+ };<% } %><% if (filters.socketio) { %>
- $scope.$on('$destroy', function() {
- socket.unsyncUpdates('thing');
- });<% } %>
- });
+ $scope.$on('$destroy', function() {
+ socket.unsyncUpdates('thing');
+ });<% } %>
+}
+
+angular.module('<%= scriptAppName %>')
+ .controller('MainController', MainController);
+
+})();
diff --git a/app/templates/client/app/main/main.controller.spec(js).js b/app/templates/client/app/main/main.controller.spec(js).js
index b8a652a79..42b1ea135 100644
--- a/app/templates/client/app/main/main.controller.spec(js).js
+++ b/app/templates/client/app/main/main.controller.spec(js).js
@@ -1,14 +1,14 @@
'use strict';
-describe('Controller: MainCtrl', function() {
+describe('Controller: MainController', function() {
// load the controller's module
beforeEach(module('<%= scriptAppName %>'));<% if (filters.uirouter) {%>
beforeEach(module('stateMock'));<% } %><% if (filters.socketio) {%>
beforeEach(module('socketMock'));<% } %>
- var MainCtrl;
- var scope;<% if (filters.uirouter) {%>
+ var scope;
+ var MainController;<% if (filters.uirouter) {%>
var state;<% } %>
var $httpBackend;
@@ -20,14 +20,14 @@ describe('Controller: MainCtrl', function() {
scope = $rootScope.$new();<% if (filters.uirouter) {%>
state = $state;<% } %>
- MainCtrl = $controller('MainCtrl', {
+ MainController = $controller('MainController', {
$scope: scope
});
}));
- it('should attach a list of things to the scope', function() {
+ it('should attach a list of things to the controller', function() {
$httpBackend.flush();<% if (filters.jasmine) { %>
- expect(scope.awesomeThings.length).toBe(4);<% } if (filters.mocha) { %>
- <%= expect() %>scope.awesomeThings.length<%= to() %>.equal(4);<% } %>
+ expect(MainController.awesomeThings.length).toBe(4);<% } if (filters.mocha) { %>
+ <%= expect() %>MainController.awesomeThings.length<%= to() %>.equal(4);<% } %>
});
});
From 87774071f6bc148d75d3d8289a5face81bc0bda2 Mon Sep 17 00:00:00 2001
From: kingcody
Date: Sat, 12 Sep 2015 17:22:31 -0400
Subject: [PATCH 0047/1129] fix(app): correct `controllerAs` property
---
app/templates/client/app/main/main(js).js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/templates/client/app/main/main(js).js b/app/templates/client/app/main/main(js).js
index a22d74e4e..43206bce4 100644
--- a/app/templates/client/app/main/main(js).js
+++ b/app/templates/client/app/main/main(js).js
@@ -6,7 +6,7 @@ angular.module('<%= scriptAppName %>')
.when('/', {
templateUrl: 'app/main/main.html',
controller: 'MainController',
- conterollerAs: 'main'
+ controllerAs: 'main'
});
});<% } %><% if (filters.uirouter) { %>.config(function($stateProvider) {
$stateProvider
@@ -14,6 +14,6 @@ angular.module('<%= scriptAppName %>')
url: '/',
templateUrl: 'app/main/main.html',
controller: 'MainController',
- conterollerAs: 'main'
+ controllerAs: 'main'
});
});<% } %>
From 68e5be20154793a64d30446bd2ff768950a0fa04 Mon Sep 17 00:00:00 2001
From: Andrew Koroluk
Date: Sun, 13 Sep 2015 01:56:33 -0400
Subject: [PATCH 0048/1129] docs(gen:README): fix paths for css in injection
section
Closes #645
---
readme.md | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/readme.md b/readme.md
index e0e31f120..b63bc9562 100644
--- a/readme.md
+++ b/readme.md
@@ -59,9 +59,9 @@ Run `grunt` for building, `grunt serve` for preview, and `grunt serve:dist` for
A grunt task looks for new files in your `client/app` and `client/components` folder and automatically injects them in the appropriate places based on an injection block.
-* `less` files into `client/app.less`
-* `scss` files into `client/app.scss`
-* `stylus` files into `client/app.styl`
+* `less` files into `client/app/app.less`
+* `scss` files into `client/app/app.scss`
+* `stylus` files into `client/app/app.styl`
* `css` files into `client/index.html`
* `js` files into `client/index.html`
* `babel` temp `js` files into `client/index.html`
From 23379553e114e446f6146db8e480461a178cfbfc Mon Sep 17 00:00:00 2001
From: Andrew Koroluk
Date: Sun, 13 Sep 2015 16:53:01 -0400
Subject: [PATCH 0049/1129] fix(oauth-buttons): fix template name
Fixes #1286
---
.../{oath-buttons(html).html => oauth-buttons(html).html} | 0
1 file changed, 0 insertions(+), 0 deletions(-)
rename app/templates/client/components/oauth-buttons(oauth)/{oath-buttons(html).html => oauth-buttons(html).html} (100%)
diff --git a/app/templates/client/components/oauth-buttons(oauth)/oath-buttons(html).html b/app/templates/client/components/oauth-buttons(oauth)/oauth-buttons(html).html
similarity index 100%
rename from app/templates/client/components/oauth-buttons(oauth)/oath-buttons(html).html
rename to app/templates/client/components/oauth-buttons(oauth)/oauth-buttons(html).html
From 33eea65bdfd816942c93bc9853de765221514483 Mon Sep 17 00:00:00 2001
From: Andrew Koroluk
Date: Sun, 13 Sep 2015 18:39:55 -0400
Subject: [PATCH 0050/1129] 3.0.0-rc8
---
package.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/package.json b/package.json
index 7a6abd472..caad04a6b 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "generator-angular-fullstack",
- "version": "3.0.0-rc7-patch.0",
+ "version": "3.0.0-rc8",
"description": "Yeoman generator for creating MEAN stack applications, using MongoDB, Express, AngularJS, and Node",
"keywords": [
"yeoman-generator",
From 3d67df25a9b39c98c52604f33c3c3153b8245ea5 Mon Sep 17 00:00:00 2001
From: Andrew Koroluk
Date: Sun, 13 Sep 2015 20:57:14 -0400
Subject: [PATCH 0051/1129] chore(npm): update sqlite3 to ~3.1.0
---
app/templates/_package.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/templates/_package.json b/app/templates/_package.json
index 01f57c1bd..771c37c95 100644
--- a/app/templates/_package.json
+++ b/app/templates/_package.json
@@ -21,7 +21,7 @@
"bluebird": "^2.9.34",
"connect-mongo": "^0.8.1",<% } %><% if (filters.sequelize) { %>
"sequelize": "^3.5.1",
- "sqlite3": "~3.0.2",
+ "sqlite3": "~3.1.0",
"express-sequelize-session": "0.4.0",<% } %><% if (filters.auth) { %>
"jsonwebtoken": "^5.0.0",
"express-jwt": "^3.0.0",
From 0870e01bc7c2577a953ebca5c15d221a233a922d Mon Sep 17 00:00:00 2001
From: Andrew Koroluk
Date: Sun, 13 Sep 2015 21:11:39 -0400
Subject: [PATCH 0052/1129] docs(README): add note about `grunt serve:debug`
---
readme.md | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/readme.md b/readme.md
index b63bc9562..aab821a0f 100644
--- a/readme.md
+++ b/readme.md
@@ -390,6 +390,10 @@ The coverage taget has 3 available options:
* *when no option is given `test:coverage` runs all options in the above order*
+**Debugging**
+
+Use `grunt serve:debug` for a more debugging-friendly environment.
+
## Environment Variables
Keeping your app secrets and other sensitive information in source control isn't a good idea. To have grunt launch your app with specific environment variables, add them to the git ignored environment config file: `server/config/local.env.js`.
From 7b940dab5ddb5cf73ce3ed231e0867b57c947b0c Mon Sep 17 00:00:00 2001
From: kingcody
Date: Sun, 13 Sep 2015 23:50:49 -0400
Subject: [PATCH 0053/1129] chore(app:grunt): improve grunt config template
usage
---
app/templates/Gruntfile.js | 47 +++++++++++++++++++++-----------------
1 file changed, 26 insertions(+), 21 deletions(-)
diff --git a/app/templates/Gruntfile.js b/app/templates/Gruntfile.js
index 1168d75b0..e98e6006a 100644
--- a/app/templates/Gruntfile.js
+++ b/app/templates/Gruntfile.js
@@ -265,9 +265,9 @@ module.exports = function (grunt) {
filerev: {
dist: {
src: [
- '<%%= yeoman.dist %>/client/!(bower_components){,*/}*.{js,css}',
- '<%%= yeoman.dist %>/client/assets/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}',
- '<%%= yeoman.dist %>/client/assets/fonts/*'
+ '<%%= yeoman.dist %>/<%%= yeoman.client %>/!(bower_components){,*/}*.{js,css}',
+ '<%%= yeoman.dist %>/<%%= yeoman.client %>/assets/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}',
+ '<%%= yeoman.dist %>/<%%= yeoman.client %>/assets/fonts/*'
]
}
},
@@ -278,19 +278,19 @@ module.exports = function (grunt) {
useminPrepare: {
html: ['<%%= yeoman.client %>/index.html'],
options: {
- dest: '<%%= yeoman.dist %>/client'
+ dest: '<%%= yeoman.dist %>/<%%= yeoman.client %>'
}
},
// Performs rewrites based on rev and the useminPrepare configuration
usemin: {
- html: ['<%%= yeoman.dist %>/client/{,!(bower_components)/**/}*.html'],
- css: ['<%%= yeoman.dist %>/client/!(bower_components){,*/}*.css'],
- js: ['<%%= yeoman.dist %>/client/!(bower_components){,*/}*.js'],
+ html: ['<%%= yeoman.dist %>/<%%= yeoman.client %>/{,!(bower_components)/**/}*.html'],
+ css: ['<%%= yeoman.dist %>/<%%= yeoman.client %>/!(bower_components){,*/}*.css'],
+ js: ['<%%= yeoman.dist %>/<%%= yeoman.client %>/!(bower_components){,*/}*.js'],
options: {
assetsDirs: [
- '<%%= yeoman.dist %>/client',
- '<%%= yeoman.dist %>/client/assets/images'
+ '<%%= yeoman.dist %>/<%%= yeoman.client %>',
+ '<%%= yeoman.dist %>/<%%= yeoman.client %>/assets/images'
],
// This is so we update image references in our ng-templates
patterns: {
@@ -308,7 +308,7 @@ module.exports = function (grunt) {
expand: true,
cwd: '<%%= yeoman.client %>/assets/images',
src: '{,*/}*.{png,jpg,jpeg,gif,svg}',
- dest: '<%%= yeoman.dist %>/client/assets/images'
+ dest: '<%%= yeoman.dist %>/<%%= yeoman.client %>/assets/images'
}]
}
},
@@ -357,7 +357,7 @@ module.exports = function (grunt) {
// Replace Google CDN references
cdnify: {
dist: {
- html: ['<%%= yeoman.dist %>/client/*.html']
+ html: ['<%%= yeoman.dist %>/<%%= yeoman.client %>/*.html']
}
},
@@ -368,7 +368,7 @@ module.exports = function (grunt) {
expand: true,
dot: true,
cwd: '<%%= yeoman.client %>',
- dest: '<%%= yeoman.dist %>/client',
+ dest: '<%%= yeoman.dist %>/<%%= yeoman.client %>',
src: [
'*.{ico,png,txt}',
'.htaccess',
@@ -380,7 +380,7 @@ module.exports = function (grunt) {
}, {
expand: true,
cwd: '.tmp/images',
- dest: '<%%= yeoman.dist %>/client/assets/images',
+ dest: '<%%= yeoman.dist %>/<%%= yeoman.client %>/assets/images',
src: ['generated/*']
}, {
expand: true,
@@ -623,7 +623,8 @@ module.exports = function (grunt) {
scripts: {
options: {
transform: function(filePath) {
- filePath = filePath.replace('/client/', '');
+ var yoClient = grunt.config.get('yeoman.client');
+ filePath = filePath.replace('/' + yoClient + '/', '');
filePath = filePath.replace('/.tmp/', '');
return '';
},
@@ -645,8 +646,9 @@ module.exports = function (grunt) {
stylus: {
options: {
transform: function(filePath) {
- filePath = filePath.replace('/client/app/', '');
- filePath = filePath.replace('/client/components/', '../components/');
+ var yoClient = grunt.config.get('yeoman.client');
+ filePath = filePath.replace('/' + yoClient + '/app/', '');
+ filePath = filePath.replace('/' + yoClient + '/components/', '../components/');
return '@import \'' + filePath + '\';';
},
starttag: '// injector',
@@ -664,8 +666,9 @@ module.exports = function (grunt) {
sass: {
options: {
transform: function(filePath) {
- filePath = filePath.replace('/client/app/', '');
- filePath = filePath.replace('/client/components/', '../components/');
+ var yoClient = grunt.config.get('yeoman.client');
+ filePath = filePath.replace('/' + yoClient + '/app/', '');
+ filePath = filePath.replace('/' + yoClient + '/components/', '../components/');
return '@import \'' + filePath + '\';';
},
starttag: '// injector',
@@ -683,8 +686,9 @@ module.exports = function (grunt) {
less: {
options: {
transform: function(filePath) {
- filePath = filePath.replace('/client/app/', '');
- filePath = filePath.replace('/client/components/', '../components/');
+ var yoClient = grunt.config.get('yeoman.client');
+ filePath = filePath.replace('/' + yoClient + '/app/', '');
+ filePath = filePath.replace('/' + yoClient + '/components/', '../components/');
return '@import \'' + filePath + '\';';
},
starttag: '// injector',
@@ -702,7 +706,8 @@ module.exports = function (grunt) {
css: {
options: {
transform: function(filePath) {
- filePath = filePath.replace('/client/', '');
+ var yoClient = grunt.config.get('yeoman.client');
+ filePath = filePath.replace('/' + yoClient + '/', '');
filePath = filePath.replace('/.tmp/', '');
return '';
},
From 109e45d68ccb0131d2fc5e7d2a88689914c134c5 Mon Sep 17 00:00:00 2001
From: kingcody
Date: Mon, 14 Sep 2015 00:49:14 -0400
Subject: [PATCH 0054/1129] feat(app): dynamically generate angular constant
`appConfig`
---
app/generator.js | 1 +
app/templates/Gruntfile.js | 64 ++++++++++++-------
app/templates/_package.json | 1 +
.../server/config/environment/index.js | 4 +-
.../server/config/environment/shared.js | 6 ++
test/test-file-creation.js | 1 +
6 files changed, 52 insertions(+), 25 deletions(-)
create mode 100644 app/templates/server/config/environment/shared.js
diff --git a/app/generator.js b/app/generator.js
index e0465a299..907df7234 100644
--- a/app/generator.js
+++ b/app/generator.js
@@ -371,6 +371,7 @@ export default class Generator extends Base {
ngModules: function() {
var angModules = [
+ `'${this.scriptAppName}.constants'`,
"'ngCookies'",
"'ngResource'",
"'ngSanitize'"
diff --git a/app/templates/Gruntfile.js b/app/templates/Gruntfile.js
index e98e6006a..1a8bd012f 100644
--- a/app/templates/Gruntfile.js
+++ b/app/templates/Gruntfile.js
@@ -17,7 +17,8 @@ module.exports = function (grunt) {
cdnify: 'grunt-google-cdn',
protractor: 'grunt-protractor-runner',
buildcontrol: 'grunt-build-control',
- istanbul_check_coverage: 'grunt-mocha-istanbul'
+ istanbul_check_coverage: 'grunt-mocha-istanbul',
+ ngconstant: 'grunt-ng-constant'
});
// Time how long tasks take. Can help when optimizing build times
@@ -60,6 +61,10 @@ module.exports = function (grunt) {
files: ['<%%= yeoman.client %>/{app,components}/**/!(*.spec|*.mock).js'],
tasks: ['newer:babel:client']
},<% } %>
+ ngconstant: {
+ files: ['<%%= yeoman.server %>/config/environment/shared.js'],
+ tasks: ['ngconstant']
+ },
injectJS: {
files: [
'<%%= yeoman.client %>/{app,components}/**/!(*.spec|*.mock).js',
@@ -241,7 +246,7 @@ module.exports = function (grunt) {
// Automatically inject Bower components into the app and karma.conf.js
wiredep: {
options: {
- exclude: [ <% if(filters.uibootstrap) { %>
+ exclude: [<% if(filters.uibootstrap) { %>
/bootstrap.js/,<% } %>
'/json3/',
'/es5-shim/'<% if(!filters.css) { %>,
@@ -326,6 +331,25 @@ module.exports = function (grunt) {
}
},
+ // Dynamically generate angular constant `appConfig` from
+ // `server/config/environment/shared.js`
+ ngconstant: {
+ options: {
+ name: '<%= scriptAppName %>.constants',
+ dest: '<%%= yeoman.client %>/app/app.constant.js',
+ deps: [],
+ wrap: true,
+ configPath: '<%%= yeoman.server %>/config/environment/shared'
+ },
+ app: {
+ constants: function() {
+ return {
+ appConfig: require('./' + grunt.config.get('ngconstant.options.configPath'))
+ };
+ }
+ }
+ },
+
// Package all the html partials into a single javascript payload
ngtemplates: {
options: {
@@ -423,6 +447,12 @@ module.exports = function (grunt) {
// Run some tasks in parallel to speed up the build process
concurrent: {
+ pre: [<% if (filters.stylus) { %>
+ 'injector:stylus',<% } if (filters.less) { %>
+ 'injector:less',<% } if (filters.sass) { %>
+ 'injector:sass',<% } %>
+ 'ngconstant'
+ ],
server: [<% if(filters.babel) { %>
'newer:babel:client',<% } if(filters.jade) { %>
'jade',<% } if(filters.stylus) { %>
@@ -747,10 +777,8 @@ module.exports = function (grunt) {
if (target === 'debug') {
return grunt.task.run([
'clean:server',
- 'env:all',<% if (filters.stylus) { %>
- 'injector:stylus',<% } if (filters.less) { %>
- 'injector:less',<% } if (filters.sass) { %>
- 'injector:sass',<% } %>
+ 'env:all',
+ 'concurrent:pre',
'concurrent:server',
'injector',
'wiredep:client',
@@ -761,10 +789,8 @@ module.exports = function (grunt) {
grunt.task.run([
'clean:server',
- 'env:all',<% if (filters.stylus) { %>
- 'injector:stylus',<% } if (filters.less) { %>
- 'injector:less',<% } if (filters.sass) { %>
- 'injector:sass',<% } %>
+ 'env:all',
+ 'concurrent:pre',
'concurrent:server',
'injector',
'wiredep:client',
@@ -794,10 +820,8 @@ module.exports = function (grunt) {
else if (target === 'client') {
return grunt.task.run([
'clean:server',
- 'env:all',<% if (filters.stylus) { %>
- 'injector:stylus',<% } if (filters.less) { %>
- 'injector:less',<% } if (filters.sass) { %>
- 'injector:sass',<% } %>
+ 'env:all',
+ 'concurrent:pre',
'concurrent:test',
'injector',
'postcss',
@@ -822,10 +846,8 @@ module.exports = function (grunt) {
return grunt.task.run([
'clean:server',
'env:all',
- 'env:test',<% if (filters.stylus) { %>
- 'injector:stylus',<% } if (filters.less) { %>
- 'injector:less',<% } if (filters.sass) { %>
- 'injector:sass',<% } %>
+ 'env:test',
+ 'concurrent:pre',
'concurrent:test',
'injector',
'wiredep:client',
@@ -878,10 +900,8 @@ module.exports = function (grunt) {
});
grunt.registerTask('build', [
- 'clean:dist',<% if (filters.stylus) { %>
- 'injector:stylus',<% } if (filters.less) { %>
- 'injector:less',<% } if (filters.sass) { %>
- 'injector:sass',<% } %>
+ 'clean:dist',
+ 'concurrent:pre',
'concurrent:dist',
'injector',
'wiredep:client',
diff --git a/app/templates/_package.json b/app/templates/_package.json
index 771c37c95..4d4b52a15 100644
--- a/app/templates/_package.json
+++ b/app/templates/_package.json
@@ -57,6 +57,7 @@
"grunt-jscs": "^2.0.0",
"grunt-newer": "^1.1.1",
"grunt-ng-annotate": "^1.0.1",
+ "grunt-ng-constant": "^1.1.0",
"grunt-filerev": "^2.3.1",
"grunt-usemin": "^3.0.0",
"grunt-env": "~0.4.1",
diff --git a/app/templates/server/config/environment/index.js b/app/templates/server/config/environment/index.js
index 98c892d32..c6115a06d 100644
--- a/app/templates/server/config/environment/index.js
+++ b/app/templates/server/config/environment/index.js
@@ -32,9 +32,6 @@ var all = {
session: '<%= lodash.slugify(lodash.humanize(appname)) + '-secret' %>'
},
- // List of user roles
- userRoles: ['guest', 'user', 'admin'],
-
// MongoDB connection options
mongo: {
options: {
@@ -67,4 +64,5 @@ var all = {
// ==============================================
module.exports = _.merge(
all,
+ require('./shared'),
require('./' + process.env.NODE_ENV + '.js') || {});
diff --git a/app/templates/server/config/environment/shared.js b/app/templates/server/config/environment/shared.js
new file mode 100644
index 000000000..64a5eab99
--- /dev/null
+++ b/app/templates/server/config/environment/shared.js
@@ -0,0 +1,6 @@
+'use strict';
+
+exports = module.exports = {
+ // List of user roles
+ userRoles: ['guest', 'user', 'admin']
+};
diff --git a/test/test-file-creation.js b/test/test-file-creation.js
index bfcfebe5a..dda6bfbd1 100644
--- a/test/test-file-creation.js
+++ b/test/test-file-creation.js
@@ -199,6 +199,7 @@ describe('angular-fullstack generator', function () {
'server/config/environment/development.js',
'server/config/environment/production.js',
'server/config/environment/test.js',
+ 'server/config/environment/shared.js',
'server/views/404.' + markup,
'e2e/main/main.po.js',
'e2e/main/main.spec.js',
From 6147e764613e5744084bd2282287452e2ba9d231 Mon Sep 17 00:00:00 2001
From: kingcody
Date: Mon, 14 Sep 2015 03:49:01 -0400
Subject: [PATCH 0055/1129] refactor(client:auth): use named function, create
Auth reference
---
.../client/app/main/main.controller(js).js | 57 ++++++++++---------
.../components/auth(auth)/auth.service(js).js | 28 +++++----
2 files changed, 47 insertions(+), 38 deletions(-)
diff --git a/app/templates/client/app/main/main.controller(js).js b/app/templates/client/app/main/main.controller(js).js
index 35fd95951..bfbed15ec 100644
--- a/app/templates/client/app/main/main.controller(js).js
+++ b/app/templates/client/app/main/main.controller(js).js
@@ -1,33 +1,34 @@
'use strict';
+
(function() {
-function MainController($scope, $http<% if (filters.socketio) { %>, socket<% } %>) {
- var self = this;
- this.awesomeThings = [];
-
- $http.get('/api/things').then(function(response) {
- self.awesomeThings = response.data;<% if (filters.socketio) { %>
- socket.syncUpdates('thing', self.awesomeThings);<% } %>
- });
-<% if (filters.models) { %>
- this.addThing = function() {
- if (self.newThing === '') {
- return;
- }
- $http.post('/api/things', { name: self.newThing });
- self.newThing = '';
- };
-
- this.deleteThing = function(thing) {
- $http.delete('/api/things/' + thing._id);
- };<% } %><% if (filters.socketio) { %>
-
- $scope.$on('$destroy', function() {
- socket.unsyncUpdates('thing');
- });<% } %>
-}
-
-angular.module('<%= scriptAppName %>')
- .controller('MainController', MainController);
+ function MainController($scope, $http<% if (filters.socketio) { %>, socket<% } %>) {
+ var self = this;
+ this.awesomeThings = [];
+
+ $http.get('/api/things').then(function(response) {
+ self.awesomeThings = response.data;<% if (filters.socketio) { %>
+ socket.syncUpdates('thing', self.awesomeThings);<% } %>
+ });<% if (filters.models) { %>
+
+ this.addThing = function() {
+ if (self.newThing === '') {
+ return;
+ }
+ $http.post('/api/things', { name: self.newThing });
+ self.newThing = '';
+ };
+
+ this.deleteThing = function(thing) {
+ $http.delete('/api/things/' + thing._id);
+ };<% } if (filters.socketio) { %>
+
+ $scope.$on('$destroy', function() {
+ socket.unsyncUpdates('thing');
+ });<% } %>
+ }
+
+ angular.module('<%= scriptAppName %>')
+ .controller('MainController', MainController);
})();
diff --git a/app/templates/client/components/auth(auth)/auth.service(js).js b/app/templates/client/components/auth(auth)/auth.service(js).js
index 2a1fcb480..eb687a564 100644
--- a/app/templates/client/components/auth(auth)/auth.service(js).js
+++ b/app/templates/client/components/auth(auth)/auth.service(js).js
@@ -1,7 +1,8 @@
'use strict';
-angular.module('<%= scriptAppName %>')
- .factory('Auth', function Auth($http, User, $cookies, $q) {
+(function() {
+
+ function AuthService($http, User, $cookies, $q) {
/**
* Return a callback or noop function
*
@@ -18,7 +19,7 @@ angular.module('<%= scriptAppName %>')
currentUser = User.get();
}
- return {
+ var Auth = {
/**
* Authenticate user and save token
@@ -42,10 +43,10 @@ angular.module('<%= scriptAppName %>')
return user;
})
.catch(function(err) {
- this.logout();
+ Auth.logout();
safeCb(callback)(err.data);
return $q.reject(err.data);
- }.bind(this));
+ });
},
/**
@@ -71,9 +72,9 @@ angular.module('<%= scriptAppName %>')
return safeCb(callback)(null, user);
},
function(err) {
- this.logout();
+ Auth.logout();
return safeCb(callback)(err);
- }.bind(this)).$promise;
+ }).$promise;
},
/**
@@ -130,7 +131,7 @@ angular.module('<%= scriptAppName %>')
return currentUser.hasOwnProperty('role');
}
- return this.getCurrentUser(null)
+ return Auth.getCurrentUser(null)
.then(function(user) {
var is = user.hasOwnProperty('role');
safeCb(callback)(is);
@@ -150,7 +151,7 @@ angular.module('<%= scriptAppName %>')
return currentUser.role === 'admin';
}
- return this.getCurrentUser(null)
+ return Auth.getCurrentUser(null)
.then(function(user) {
var is = user.role === 'admin';
safeCb(callback)(is);
@@ -167,4 +168,11 @@ angular.module('<%= scriptAppName %>')
return $cookies.get('token');
}
};
- });
+
+ return Auth;
+ }
+
+ angular.module('<%= scriptAppName %>')
+ .factory('Auth', AuthService);
+
+})();
From 9133296a3f5d04aa5c8a7f5b8f69a587c30ff589 Mon Sep 17 00:00:00 2001
From: kingcody
Date: Mon, 14 Sep 2015 06:46:10 -0400
Subject: [PATCH 0056/1129] feat(injector): inject module definitions first
---
app/templates/Gruntfile.js | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/app/templates/Gruntfile.js b/app/templates/Gruntfile.js
index 1a8bd012f..cc3d414e0 100644
--- a/app/templates/Gruntfile.js
+++ b/app/templates/Gruntfile.js
@@ -658,6 +658,13 @@ module.exports = function (grunt) {
filePath = filePath.replace('/.tmp/', '');
return '';
},
+ sort: function(a, b) {
+ var module = /\.module\.js$/;
+ var aMod = module.test(a);
+ var bMod = module.test(b);
+ // inject *.module.js first
+ return (aMod === bMod) ? 0 : (aMod ? -1 : 1);
+ },
starttag: '',
endtag: ''
},
From d3d0f569d912f14e7d5b33269fdaca13472132df Mon Sep 17 00:00:00 2001
From: kingcody
Date: Mon, 14 Sep 2015 06:54:58 -0400
Subject: [PATCH 0057/1129] feat(client:auth): implement auth components as a
seperate module
---
app/generator.js | 5 ++++-
.../client/components/auth(auth)/auth.module(js).js | 5 +++++
.../client/components/auth(auth)/auth.service(js).js | 2 +-
.../client/components/auth(auth)/user.service(js).js | 2 +-
test/test-file-creation.js | 1 +
5 files changed, 12 insertions(+), 3 deletions(-)
create mode 100644 app/templates/client/components/auth(auth)/auth.module(js).js
diff --git a/app/generator.js b/app/generator.js
index 907df7234..00fad1ad5 100644
--- a/app/generator.js
+++ b/app/generator.js
@@ -380,7 +380,10 @@ export default class Generator extends Base {
if(this.filters.socketio) angModules.push("'btford.socket-io'");
if(this.filters.uirouter) angModules.push("'ui.router'");
if(this.filters.uibootstrap) angModules.push("'ui.bootstrap'");
- if(this.filters.auth) angModules.push("'validation.match'");
+ if(this.filters.auth) {
+ angModules.unshift(`'${this.scriptAppName}.auth'`);
+ angModules.push("'validation.match'");
+ }
this.angularModules = '\n ' + angModules.join(',\n ') +'\n';
}
diff --git a/app/templates/client/components/auth(auth)/auth.module(js).js b/app/templates/client/components/auth(auth)/auth.module(js).js
new file mode 100644
index 000000000..26a4bff0e
--- /dev/null
+++ b/app/templates/client/components/auth(auth)/auth.module(js).js
@@ -0,0 +1,5 @@
+'use strict';
+
+angular.module('<%= scriptAppName %>.auth', [
+ 'ngCookies'
+]);
diff --git a/app/templates/client/components/auth(auth)/auth.service(js).js b/app/templates/client/components/auth(auth)/auth.service(js).js
index eb687a564..6477075ff 100644
--- a/app/templates/client/components/auth(auth)/auth.service(js).js
+++ b/app/templates/client/components/auth(auth)/auth.service(js).js
@@ -172,7 +172,7 @@
return Auth;
}
- angular.module('<%= scriptAppName %>')
+ angular.module('<%= scriptAppName %>.auth')
.factory('Auth', AuthService);
})();
diff --git a/app/templates/client/components/auth(auth)/user.service(js).js b/app/templates/client/components/auth(auth)/user.service(js).js
index aad887945..c0bf13513 100644
--- a/app/templates/client/components/auth(auth)/user.service(js).js
+++ b/app/templates/client/components/auth(auth)/user.service(js).js
@@ -1,6 +1,6 @@
'use strict';
-angular.module('<%= scriptAppName %>')
+angular.module('<%= scriptAppName %>.auth')
.factory('User', function ($resource) {
return $resource('/api/users/:id/:controller', {
id: '@_id'
diff --git a/test/test-file-creation.js b/test/test-file-creation.js
index dda6bfbd1..f89dd0b9f 100644
--- a/test/test-file-creation.js
+++ b/test/test-file-creation.js
@@ -267,6 +267,7 @@ describe('angular-fullstack generator', function () {
'client/app/admin/admin.' + stylesheet,
'client/app/admin/admin.' + script,
'client/app/admin/admin.controller.' + script,
+ 'client/components/auth/auth.module.' + script,
'client/components/auth/auth.service.' + script,
'client/components/auth/user.service.' + script,
'client/components/mongoose-error/mongoose-error.directive.' + script,
From f350412cf66daf23a610d32dcafcf30545b7b168 Mon Sep 17 00:00:00 2001
From: kingcody
Date: Mon, 14 Sep 2015 07:27:20 -0400
Subject: [PATCH 0058/1129] refactor(client:auth): move authInterceptor to auth
module
---
app/templates/client/app/app(js).js | 42 +++----------------
.../components/auth(auth)/auth.module(js).js | 9 +++-
.../auth(auth)/interceptor.service(js).js | 35 ++++++++++++++++
test/test-file-creation.js | 1 +
4 files changed, 48 insertions(+), 39 deletions(-)
create mode 100644 app/templates/client/components/auth(auth)/interceptor.service(js).js
diff --git a/app/templates/client/app/app(js).js b/app/templates/client/app/app(js).js
index 0c8ec39e8..d10f0808f 100644
--- a/app/templates/client/app/app(js).js
+++ b/app/templates/client/app/app(js).js
@@ -1,48 +1,16 @@
'use strict';
angular.module('<%= scriptAppName %>', [<%- angularModules %>])
- <% if (filters.ngroute) { %>.config(function($routeProvider, $locationProvider<% if (filters.auth) { %>, $httpProvider<% } %>) {
+ .config(function(<% if (filters.ngroute) { %>$routeProvider<% } if (filters.uirouter) { %>$urlRouterProvider<% } %>, $locationProvider) {<% if (filters.ngroute) { %>
$routeProvider
.otherwise({
redirectTo: '/'
- });
-
- $locationProvider.html5Mode(true);<% if (filters.auth) { %>
- $httpProvider.interceptors.push('authInterceptor');<% } %>
- })<% } if (filters.uirouter) { %>.config(function($stateProvider, $urlRouterProvider, $locationProvider<% if (filters.auth) { %>, $httpProvider<% } %>) {
+ });<% } if (filters.uirouter) { %>
$urlRouterProvider
- .otherwise('/');
-
- $locationProvider.html5Mode(true);<% if (filters.auth) { %>
- $httpProvider.interceptors.push('authInterceptor');<% } %>
- })<% } if (filters.auth) { %>
+ .otherwise('/');<% } %>
- .factory('authInterceptor', function($rootScope, $q, $cookies<% if (filters.ngroute) { %>, $location<% } if (filters.uirouter) { %>, $injector<% } %>) {
- <% if (filters.uirouter) { %>var state;
- <% } %>return {
- // Add authorization token to headers
- request: function(config) {
- config.headers = config.headers || {};
- if ($cookies.get('token')) {
- config.headers.Authorization = 'Bearer ' + $cookies.get('token');
- }
- return config;
- },
-
- // Intercept 401s and redirect you to login
- responseError: function(response) {
- if (response.status === 401) {
- <% if (filters.ngroute) { %>$location.path('/login');<% } if (filters.uirouter) { %>(state || (state = $injector.get('$state'))).go('login');<% } %>
- // remove any stale tokens
- $cookies.remove('token');
- return $q.reject(response);
- }
- else {
- return $q.reject(response);
- }
- }
- };
- })
+ $locationProvider.html5Mode(true);
+ })<% if (filters.auth) { %>
.run(function($rootScope<% if (filters.ngroute) { %>, $location<% } if (filters.uirouter) { %>, $state<% } %>, Auth) {
// Redirect to login if route requires auth and the user is not logged in
diff --git a/app/templates/client/components/auth(auth)/auth.module(js).js b/app/templates/client/components/auth(auth)/auth.module(js).js
index 26a4bff0e..dcb4ff7f3 100644
--- a/app/templates/client/components/auth(auth)/auth.module(js).js
+++ b/app/templates/client/components/auth(auth)/auth.module(js).js
@@ -1,5 +1,10 @@
'use strict';
angular.module('<%= scriptAppName %>.auth', [
- 'ngCookies'
-]);
+ 'ngCookies'<% if (filters.ngroute) { %>,
+ 'ngRoute'<% } if (filters.uirouter) { %>,
+ 'ui.router'<% } %>
+])
+ .config(function($httpProvider) {
+ $httpProvider.interceptors.push('authInterceptor');
+ });
diff --git a/app/templates/client/components/auth(auth)/interceptor.service(js).js b/app/templates/client/components/auth(auth)/interceptor.service(js).js
new file mode 100644
index 000000000..8843527b9
--- /dev/null
+++ b/app/templates/client/components/auth(auth)/interceptor.service(js).js
@@ -0,0 +1,35 @@
+'use strict';
+
+(function() {
+
+ function authInterceptor($rootScope, $q, $cookies<% if (filters.ngroute) { %>, $location<% } if (filters.uirouter) { %>, $injector<% } %>) {
+ <% if (filters.uirouter) { %>var state;
+ <% } %>return {
+ // Add authorization token to headers
+ request: function(config) {
+ config.headers = config.headers || {};
+ if ($cookies.get('token')) {
+ config.headers.Authorization = 'Bearer ' + $cookies.get('token');
+ }
+ return config;
+ },
+
+ // Intercept 401s and redirect you to login
+ responseError: function(response) {
+ if (response.status === 401) {
+ <% if (filters.ngroute) { %>$location.path('/login');<% } if (filters.uirouter) { %>(state || (state = $injector.get('$state'))).go('login');<% } %>
+ // remove any stale tokens
+ $cookies.remove('token');
+ return $q.reject(response);
+ }
+ else {
+ return $q.reject(response);
+ }
+ }
+ };
+ }
+
+ angular.module('<%= scriptAppName %>.auth')
+ .factory('authInterceptor', authInterceptor);
+
+})();
diff --git a/test/test-file-creation.js b/test/test-file-creation.js
index f89dd0b9f..26d47f8b2 100644
--- a/test/test-file-creation.js
+++ b/test/test-file-creation.js
@@ -269,6 +269,7 @@ describe('angular-fullstack generator', function () {
'client/app/admin/admin.controller.' + script,
'client/components/auth/auth.module.' + script,
'client/components/auth/auth.service.' + script,
+ 'client/components/auth/interceptor.service.' + script,
'client/components/auth/user.service.' + script,
'client/components/mongoose-error/mongoose-error.directive.' + script,
'server/api/user/index.js',
From 533f20e663592b3f4b8911eb914c82ab7c8d5d54 Mon Sep 17 00:00:00 2001
From: kingcody
Date: Mon, 14 Sep 2015 22:49:14 -0400
Subject: [PATCH 0059/1129] feat(client:auth): implement `Auth.hasRole`
---
.../components/auth(auth)/auth.module(js).js | 1 +
.../components/auth(auth)/auth.service(js).js | 42 ++++++++++++++-----
2 files changed, 32 insertions(+), 11 deletions(-)
diff --git a/app/templates/client/components/auth(auth)/auth.module(js).js b/app/templates/client/components/auth(auth)/auth.module(js).js
index dcb4ff7f3..3e096aeb3 100644
--- a/app/templates/client/components/auth(auth)/auth.module(js).js
+++ b/app/templates/client/components/auth(auth)/auth.module(js).js
@@ -1,6 +1,7 @@
'use strict';
angular.module('<%= scriptAppName %>.auth', [
+ '<%= scriptAppName %>.constants',
'ngCookies'<% if (filters.ngroute) { %>,
'ngRoute'<% } if (filters.uirouter) { %>,
'ui.router'<% } %>
diff --git a/app/templates/client/components/auth(auth)/auth.service(js).js b/app/templates/client/components/auth(auth)/auth.service(js).js
index 6477075ff..0b771500a 100644
--- a/app/templates/client/components/auth(auth)/auth.service(js).js
+++ b/app/templates/client/components/auth(auth)/auth.service(js).js
@@ -2,7 +2,7 @@
(function() {
- function AuthService($http, User, $cookies, $q) {
+ function AuthService($http, $cookies, $q, appConfig, User) {
/**
* Return a callback or noop function
*
@@ -13,7 +13,8 @@
return (angular.isFunction(cb)) ? cb : angular.noop;
},
- currentUser = {};
+ currentUser = {},
+ userRoles = appConfig.userRoles || [];
if ($cookies.get('token')) {
currentUser = User.get();
@@ -108,7 +109,8 @@
return currentUser;
}
- var value = (currentUser.hasOwnProperty('$promise')) ? currentUser.$promise : currentUser;
+ var value = (currentUser.hasOwnProperty('$promise')) ?
+ currentUser.$promise : currentUser;
return $q.when(value)
.then(function(user) {
safeCb(callback)(user);
@@ -140,25 +142,43 @@
},
/**
- * Check if a user is an admin
+ * Check if a user has a specified role or higher
* (synchronous|asynchronous)
*
- * @param {Function|*} callback - optional, function(is)
+ * @param {String} role - the role to check against
+ * @param {Function|*} callback - optional, function(has)
* @return {Bool|Promise}
*/
- isAdmin: function(callback) {
- if (arguments.length === 0) {
- return currentUser.role === 'admin';
+ hasRole: function(role, callback) {
+ var hasRole = function(r, h) {
+ return userRoles.indexOf(r) >= userRoles.indexOf(h);
+ };
+
+ if (arguments.length < 2) {
+ return hasRole(currentUser.role, role);
}
return Auth.getCurrentUser(null)
.then(function(user) {
- var is = user.role === 'admin';
- safeCb(callback)(is);
- return is;
+ var has = (user.hasOwnProperty('role')) ?
+ hasRole(user.role, role) : false;
+ safeCb(callback)(has);
+ return has;
});
},
+ /**
+ * Check if a user is an admin
+ * (synchronous|asynchronous)
+ *
+ * @param {Function|*} callback - optional, function(is)
+ * @return {Bool|Promise}
+ */
+ isAdmin: function() {
+ return Auth.hasRole
+ .apply(Auth, [].concat.apply(['admin'], arguments));
+ },
+
/**
* Get auth token
*
From f222cfb7c3cca098cf40e3cc7f64655858ca1799 Mon Sep 17 00:00:00 2001
From: kingcody
Date: Tue, 15 Sep 2015 00:14:05 -0400
Subject: [PATCH 0060/1129] feat(client:auth): implement router auth via
router.decorator
Changes:
* move remaining auth code from app.js to auth module
* the router param `authenticate` now accepts a string as a role requirement
* admin route now uses role based auth
---
.../client/app/admin(auth)/admin(js).js | 6 ++-
app/templates/client/app/app(js).js | 16 +-------
.../auth(auth)/router.decorator(js).js | 41 +++++++++++++++++++
test/test-file-creation.js | 1 +
4 files changed, 47 insertions(+), 17 deletions(-)
create mode 100644 app/templates/client/components/auth(auth)/router.decorator(js).js
diff --git a/app/templates/client/app/admin(auth)/admin(js).js b/app/templates/client/app/admin(auth)/admin(js).js
index f37ba9fcc..510363868 100644
--- a/app/templates/client/app/admin(auth)/admin(js).js
+++ b/app/templates/client/app/admin(auth)/admin(js).js
@@ -5,13 +5,15 @@ angular.module('<%= scriptAppName %>')
$routeProvider
.when('/admin', {
templateUrl: 'app/admin/admin.html',
- controller: 'AdminCtrl'
+ controller: 'AdminCtrl',
+ authenticate: 'admin'
});
});<% } %><% if (filters.uirouter) { %>.config(function($stateProvider) {
$stateProvider
.state('admin', {
url: '/admin',
templateUrl: 'app/admin/admin.html',
- controller: 'AdminCtrl'
+ controller: 'AdminCtrl',
+ authenticate: 'admin'
});
});<% } %>
diff --git a/app/templates/client/app/app(js).js b/app/templates/client/app/app(js).js
index d10f0808f..a9d9f2b09 100644
--- a/app/templates/client/app/app(js).js
+++ b/app/templates/client/app/app(js).js
@@ -10,18 +10,4 @@ angular.module('<%= scriptAppName %>', [<%- angularModules %>])
.otherwise('/');<% } %>
$locationProvider.html5Mode(true);
- })<% if (filters.auth) { %>
-
- .run(function($rootScope<% if (filters.ngroute) { %>, $location<% } if (filters.uirouter) { %>, $state<% } %>, Auth) {
- // Redirect to login if route requires auth and the user is not logged in
- $rootScope.$on(<% if (filters.ngroute) { %>'$routeChangeStart'<% } %><% if (filters.uirouter) { %>'$stateChangeStart'<% } %>, function(event, next) {
- if (next.authenticate) {
- Auth.isLoggedIn(function(loggedIn) {
- if (!loggedIn) {
- event.preventDefault();
- <% if (filters.ngroute) { %>$location.path('/login');<% } if (filters.uirouter) { %>$state.go('login');<% } %>
- }
- });
- }
- });
- })<% } %>;
+ });
diff --git a/app/templates/client/components/auth(auth)/router.decorator(js).js b/app/templates/client/components/auth(auth)/router.decorator(js).js
new file mode 100644
index 000000000..edd71d95e
--- /dev/null
+++ b/app/templates/client/components/auth(auth)/router.decorator(js).js
@@ -0,0 +1,41 @@
+'use strict';
+
+(function() {
+
+ function routerDecorator(<%= filters.uirouter ? '$stateProvider' : '$provide' %>) {
+ var authDecorator = function(<%= filters.uirouter ? 'state' : 'route' %>) {
+ var auth = <%= filters.uirouter ? 'state' : 'route' %>.authenticate;
+ if (auth) {
+ <%= filters.uirouter ? 'state' : 'route' %>.resolve = <%= filters.uirouter ? 'state' : 'route' %>.resolve || {};
+ <%= filters.uirouter ? 'state' : 'route' %>.resolve.user = function(<%= filters.uirouter ? '$state' : '$location' %>, $q, Auth) {
+ return Auth.getCurrentUser(true)
+ .then(function(user) {
+ if ((typeof auth !== 'string' && user._id) ||
+ (typeof auth === 'string' && Auth.hasRole(auth))) {
+ return user;
+ }<% if (filters.ngroute) { %>
+ $location.path((user._id) ? '/' : '/login');<% } if (filters.uirouter) { %>
+ $state.go((user._id) ? 'main' : 'login');<% } %>
+ return $q.reject('not authorized');
+ });
+ };
+ }
+ };<% if (filters.ngroute) { %>
+
+ $provide.decorator('$route', function($delegate) {
+ for (var r in $delegate.routes) {
+ authDecorator($delegate.routes[r]);
+ }
+ return $delegate;
+ });<% } if (filters.uirouter) { %>
+
+ $stateProvider.decorator('authenticate', function(state) {
+ authDecorator(state);
+ return state.authenticate;
+ });<% } %>
+ }
+
+ angular.module('<%= scriptAppName %>.auth')
+ .config(routerDecorator);
+
+})();
diff --git a/test/test-file-creation.js b/test/test-file-creation.js
index 26d47f8b2..ae1dc0297 100644
--- a/test/test-file-creation.js
+++ b/test/test-file-creation.js
@@ -270,6 +270,7 @@ describe('angular-fullstack generator', function () {
'client/components/auth/auth.module.' + script,
'client/components/auth/auth.service.' + script,
'client/components/auth/interceptor.service.' + script,
+ 'client/components/auth/router.decorator.' + script,
'client/components/auth/user.service.' + script,
'client/components/mongoose-error/mongoose-error.directive.' + script,
'server/api/user/index.js',
From cf38d627130f9bc9942767a099222476397d42c8 Mon Sep 17 00:00:00 2001
From: kingcody
Date: Tue, 15 Sep 2015 00:20:44 -0400
Subject: [PATCH 0061/1129] refactor(client:auth): use named function for user
resource
---
.../client/components/auth(auth)/user.service(js).js | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/app/templates/client/components/auth(auth)/user.service(js).js b/app/templates/client/components/auth(auth)/user.service(js).js
index c0bf13513..965f84566 100644
--- a/app/templates/client/components/auth(auth)/user.service(js).js
+++ b/app/templates/client/components/auth(auth)/user.service(js).js
@@ -1,7 +1,8 @@
'use strict';
-angular.module('<%= scriptAppName %>.auth')
- .factory('User', function ($resource) {
+(function() {
+
+ function UserResource($resource) {
return $resource('/api/users/:id/:controller', {
id: '@_id'
},
@@ -19,4 +20,9 @@ angular.module('<%= scriptAppName %>.auth')
}
}
});
- });
+ }
+
+ angular.module('<%= scriptAppName %>.auth')
+ .factory('User', UserResource);
+
+})();
From dafd65aee6fd919181da7fc629b9840a83c74cda Mon Sep 17 00:00:00 2001
From: kingcody
Date: Tue, 15 Sep 2015 01:32:01 -0400
Subject: [PATCH 0062/1129] fix(client:auth): exclued user fetching for logout
route
---
.../client/components/auth(auth)/auth.service(js).js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/templates/client/components/auth(auth)/auth.service(js).js b/app/templates/client/components/auth(auth)/auth.service(js).js
index 0b771500a..0310e1198 100644
--- a/app/templates/client/components/auth(auth)/auth.service(js).js
+++ b/app/templates/client/components/auth(auth)/auth.service(js).js
@@ -2,7 +2,7 @@
(function() {
- function AuthService($http, $cookies, $q, appConfig, User) {
+ function AuthService($location, $http, $cookies, $q, appConfig, User) {
/**
* Return a callback or noop function
*
@@ -16,7 +16,7 @@
currentUser = {},
userRoles = appConfig.userRoles || [];
- if ($cookies.get('token')) {
+ if ($cookies.get('token') && $location.path() !== '/logout') {
currentUser = User.get();
}
From 650a5295c44dcf0935872f599b302700a88f7dc6 Mon Sep 17 00:00:00 2001
From: kingcody
Date: Tue, 15 Sep 2015 19:50:10 -0400
Subject: [PATCH 0063/1129] style(app): flatten IIFEs
---
.../client/app/main/main.controller(js).js | 56 +--
.../components/auth(auth)/auth.service(js).js | 358 +++++++++---------
.../auth(auth)/interceptor.service(js).js | 52 +--
.../auth(auth)/router.decorator(js).js | 64 ++--
.../components/auth(auth)/user.service(js).js | 38 +-
5 files changed, 284 insertions(+), 284 deletions(-)
diff --git a/app/templates/client/app/main/main.controller(js).js b/app/templates/client/app/main/main.controller(js).js
index bfbed15ec..db9bbd5c3 100644
--- a/app/templates/client/app/main/main.controller(js).js
+++ b/app/templates/client/app/main/main.controller(js).js
@@ -2,33 +2,33 @@
(function() {
- function MainController($scope, $http<% if (filters.socketio) { %>, socket<% } %>) {
- var self = this;
- this.awesomeThings = [];
-
- $http.get('/api/things').then(function(response) {
- self.awesomeThings = response.data;<% if (filters.socketio) { %>
- socket.syncUpdates('thing', self.awesomeThings);<% } %>
- });<% if (filters.models) { %>
-
- this.addThing = function() {
- if (self.newThing === '') {
- return;
- }
- $http.post('/api/things', { name: self.newThing });
- self.newThing = '';
- };
-
- this.deleteThing = function(thing) {
- $http.delete('/api/things/' + thing._id);
- };<% } if (filters.socketio) { %>
-
- $scope.$on('$destroy', function() {
- socket.unsyncUpdates('thing');
- });<% } %>
- }
-
- angular.module('<%= scriptAppName %>')
- .controller('MainController', MainController);
+function MainController($scope, $http<% if (filters.socketio) { %>, socket<% } %>) {
+ var self = this;
+ this.awesomeThings = [];
+
+ $http.get('/api/things').then(function(response) {
+ self.awesomeThings = response.data;<% if (filters.socketio) { %>
+ socket.syncUpdates('thing', self.awesomeThings);<% } %>
+ });<% if (filters.models) { %>
+
+ this.addThing = function() {
+ if (self.newThing === '') {
+ return;
+ }
+ $http.post('/api/things', { name: self.newThing });
+ self.newThing = '';
+ };
+
+ this.deleteThing = function(thing) {
+ $http.delete('/api/things/' + thing._id);
+ };<% } if (filters.socketio) { %>
+
+ $scope.$on('$destroy', function() {
+ socket.unsyncUpdates('thing');
+ });<% } %>
+}
+
+angular.module('<%= scriptAppName %>')
+ .controller('MainController', MainController);
})();
diff --git a/app/templates/client/components/auth(auth)/auth.service(js).js b/app/templates/client/components/auth(auth)/auth.service(js).js
index 0310e1198..49bdb2a9e 100644
--- a/app/templates/client/components/auth(auth)/auth.service(js).js
+++ b/app/templates/client/components/auth(auth)/auth.service(js).js
@@ -2,197 +2,197 @@
(function() {
- function AuthService($location, $http, $cookies, $q, appConfig, User) {
+function AuthService($location, $http, $cookies, $q, appConfig, User) {
+ /**
+ * Return a callback or noop function
+ *
+ * @param {Function|*} cb - a 'potential' function
+ * @return {Function}
+ */
+ var safeCb = function(cb) {
+ return (angular.isFunction(cb)) ? cb : angular.noop;
+ },
+
+ currentUser = {},
+ userRoles = appConfig.userRoles || [];
+
+ if ($cookies.get('token') && $location.path() !== '/logout') {
+ currentUser = User.get();
+ }
+
+ var Auth = {
+
/**
- * Return a callback or noop function
+ * Authenticate user and save token
*
- * @param {Function|*} cb - a 'potential' function
- * @return {Function}
+ * @param {Object} user - login info
+ * @param {Function} callback - optional, function(error, user)
+ * @return {Promise}
*/
- var safeCb = function(cb) {
- return (angular.isFunction(cb)) ? cb : angular.noop;
+ login: function(user, callback) {
+ return $http.post('/auth/local', {
+ email: user.email,
+ password: user.password
+ })
+ .then(function(res) {
+ $cookies.put('token', res.data.token);
+ currentUser = User.get();
+ return currentUser.$promise;
+ })
+ .then(function(user) {
+ safeCb(callback)(null, user);
+ return user;
+ })
+ .catch(function(err) {
+ Auth.logout();
+ safeCb(callback)(err.data);
+ return $q.reject(err.data);
+ });
},
- currentUser = {},
- userRoles = appConfig.userRoles || [];
-
- if ($cookies.get('token') && $location.path() !== '/logout') {
- currentUser = User.get();
- }
+ /**
+ * Delete access token and user info
+ */
+ logout: function() {
+ $cookies.remove('token');
+ currentUser = {};
+ },
- var Auth = {
-
- /**
- * Authenticate user and save token
- *
- * @param {Object} user - login info
- * @param {Function} callback - optional, function(error, user)
- * @return {Promise}
- */
- login: function(user, callback) {
- return $http.post('/auth/local', {
- email: user.email,
- password: user.password
- })
- .then(function(res) {
- $cookies.put('token', res.data.token);
+ /**
+ * Create a new user
+ *
+ * @param {Object} user - user info
+ * @param {Function} callback - optional, function(error, user)
+ * @return {Promise}
+ */
+ createUser: function(user, callback) {
+ return User.save(user,
+ function(data) {
+ $cookies.put('token', data.token);
currentUser = User.get();
- return currentUser.$promise;
- })
- .then(function(user) {
- safeCb(callback)(null, user);
- return user;
- })
- .catch(function(err) {
+ return safeCb(callback)(null, user);
+ },
+ function(err) {
Auth.logout();
- safeCb(callback)(err.data);
- return $q.reject(err.data);
- });
- },
-
- /**
- * Delete access token and user info
- */
- logout: function() {
- $cookies.remove('token');
- currentUser = {};
- },
-
- /**
- * Create a new user
- *
- * @param {Object} user - user info
- * @param {Function} callback - optional, function(error, user)
- * @return {Promise}
- */
- createUser: function(user, callback) {
- return User.save(user,
- function(data) {
- $cookies.put('token', data.token);
- currentUser = User.get();
- return safeCb(callback)(null, user);
- },
- function(err) {
- Auth.logout();
- return safeCb(callback)(err);
- }).$promise;
- },
-
- /**
- * Change password
- *
- * @param {String} oldPassword
- * @param {String} newPassword
- * @param {Function} callback - optional, function(error, user)
- * @return {Promise}
- */
- changePassword: function(oldPassword, newPassword, callback) {
- return User.changePassword({ id: currentUser._id }, {
- oldPassword: oldPassword,
- newPassword: newPassword
- }, function() {
- return safeCb(callback)(null);
- }, function(err) {
return safeCb(callback)(err);
}).$promise;
- },
-
- /**
- * Gets all available info on a user
- * (synchronous|asynchronous)
- *
- * @param {Function|*} callback - optional, funciton(user)
- * @return {Object|Promise}
- */
- getCurrentUser: function(callback) {
- if (arguments.length === 0) {
- return currentUser;
- }
-
- var value = (currentUser.hasOwnProperty('$promise')) ?
- currentUser.$promise : currentUser;
- return $q.when(value)
- .then(function(user) {
- safeCb(callback)(user);
- return user;
- }, function() {
- safeCb(callback)({});
- return {};
- });
- },
-
- /**
- * Check if a user is logged in
- * (synchronous|asynchronous)
- *
- * @param {Function|*} callback - optional, function(is)
- * @return {Bool|Promise}
- */
- isLoggedIn: function(callback) {
- if (arguments.length === 0) {
- return currentUser.hasOwnProperty('role');
- }
-
- return Auth.getCurrentUser(null)
- .then(function(user) {
- var is = user.hasOwnProperty('role');
- safeCb(callback)(is);
- return is;
- });
- },
-
- /**
- * Check if a user has a specified role or higher
- * (synchronous|asynchronous)
- *
- * @param {String} role - the role to check against
- * @param {Function|*} callback - optional, function(has)
- * @return {Bool|Promise}
- */
- hasRole: function(role, callback) {
- var hasRole = function(r, h) {
- return userRoles.indexOf(r) >= userRoles.indexOf(h);
- };
-
- if (arguments.length < 2) {
- return hasRole(currentUser.role, role);
- }
-
- return Auth.getCurrentUser(null)
- .then(function(user) {
- var has = (user.hasOwnProperty('role')) ?
- hasRole(user.role, role) : false;
- safeCb(callback)(has);
- return has;
- });
- },
-
- /**
- * Check if a user is an admin
- * (synchronous|asynchronous)
- *
- * @param {Function|*} callback - optional, function(is)
- * @return {Bool|Promise}
- */
- isAdmin: function() {
- return Auth.hasRole
- .apply(Auth, [].concat.apply(['admin'], arguments));
- },
-
- /**
- * Get auth token
- *
- * @return {String} - a token string used for authenticating
- */
- getToken: function() {
- return $cookies.get('token');
+ },
+
+ /**
+ * Change password
+ *
+ * @param {String} oldPassword
+ * @param {String} newPassword
+ * @param {Function} callback - optional, function(error, user)
+ * @return {Promise}
+ */
+ changePassword: function(oldPassword, newPassword, callback) {
+ return User.changePassword({ id: currentUser._id }, {
+ oldPassword: oldPassword,
+ newPassword: newPassword
+ }, function() {
+ return safeCb(callback)(null);
+ }, function(err) {
+ return safeCb(callback)(err);
+ }).$promise;
+ },
+
+ /**
+ * Gets all available info on a user
+ * (synchronous|asynchronous)
+ *
+ * @param {Function|*} callback - optional, funciton(user)
+ * @return {Object|Promise}
+ */
+ getCurrentUser: function(callback) {
+ if (arguments.length === 0) {
+ return currentUser;
}
- };
- return Auth;
- }
+ var value = (currentUser.hasOwnProperty('$promise')) ?
+ currentUser.$promise : currentUser;
+ return $q.when(value)
+ .then(function(user) {
+ safeCb(callback)(user);
+ return user;
+ }, function() {
+ safeCb(callback)({});
+ return {};
+ });
+ },
+
+ /**
+ * Check if a user is logged in
+ * (synchronous|asynchronous)
+ *
+ * @param {Function|*} callback - optional, function(is)
+ * @return {Bool|Promise}
+ */
+ isLoggedIn: function(callback) {
+ if (arguments.length === 0) {
+ return currentUser.hasOwnProperty('role');
+ }
+
+ return Auth.getCurrentUser(null)
+ .then(function(user) {
+ var is = user.hasOwnProperty('role');
+ safeCb(callback)(is);
+ return is;
+ });
+ },
+
+ /**
+ * Check if a user has a specified role or higher
+ * (synchronous|asynchronous)
+ *
+ * @param {String} role - the role to check against
+ * @param {Function|*} callback - optional, function(has)
+ * @return {Bool|Promise}
+ */
+ hasRole: function(role, callback) {
+ var hasRole = function(r, h) {
+ return userRoles.indexOf(r) >= userRoles.indexOf(h);
+ };
+
+ if (arguments.length < 2) {
+ return hasRole(currentUser.role, role);
+ }
+
+ return Auth.getCurrentUser(null)
+ .then(function(user) {
+ var has = (user.hasOwnProperty('role')) ?
+ hasRole(user.role, role) : false;
+ safeCb(callback)(has);
+ return has;
+ });
+ },
+
+ /**
+ * Check if a user is an admin
+ * (synchronous|asynchronous)
+ *
+ * @param {Function|*} callback - optional, function(is)
+ * @return {Bool|Promise}
+ */
+ isAdmin: function() {
+ return Auth.hasRole
+ .apply(Auth, [].concat.apply(['admin'], arguments));
+ },
+
+ /**
+ * Get auth token
+ *
+ * @return {String} - a token string used for authenticating
+ */
+ getToken: function() {
+ return $cookies.get('token');
+ }
+ };
+
+ return Auth;
+}
- angular.module('<%= scriptAppName %>.auth')
- .factory('Auth', AuthService);
+angular.module('<%= scriptAppName %>.auth')
+ .factory('Auth', AuthService);
})();
diff --git a/app/templates/client/components/auth(auth)/interceptor.service(js).js b/app/templates/client/components/auth(auth)/interceptor.service(js).js
index 8843527b9..67c0526a3 100644
--- a/app/templates/client/components/auth(auth)/interceptor.service(js).js
+++ b/app/templates/client/components/auth(auth)/interceptor.service(js).js
@@ -2,34 +2,34 @@
(function() {
- function authInterceptor($rootScope, $q, $cookies<% if (filters.ngroute) { %>, $location<% } if (filters.uirouter) { %>, $injector<% } %>) {
- <% if (filters.uirouter) { %>var state;
- <% } %>return {
- // Add authorization token to headers
- request: function(config) {
- config.headers = config.headers || {};
- if ($cookies.get('token')) {
- config.headers.Authorization = 'Bearer ' + $cookies.get('token');
- }
- return config;
- },
+function authInterceptor($rootScope, $q, $cookies<% if (filters.ngroute) { %>, $location<% } if (filters.uirouter) { %>, $injector<% } %>) {
+ <% if (filters.uirouter) { %>var state;
+ <% } %>return {
+ // Add authorization token to headers
+ request: function(config) {
+ config.headers = config.headers || {};
+ if ($cookies.get('token')) {
+ config.headers.Authorization = 'Bearer ' + $cookies.get('token');
+ }
+ return config;
+ },
- // Intercept 401s and redirect you to login
- responseError: function(response) {
- if (response.status === 401) {
- <% if (filters.ngroute) { %>$location.path('/login');<% } if (filters.uirouter) { %>(state || (state = $injector.get('$state'))).go('login');<% } %>
- // remove any stale tokens
- $cookies.remove('token');
- return $q.reject(response);
- }
- else {
- return $q.reject(response);
- }
+ // Intercept 401s and redirect you to login
+ responseError: function(response) {
+ if (response.status === 401) {
+ <% if (filters.ngroute) { %>$location.path('/login');<% } if (filters.uirouter) { %>(state || (state = $injector.get('$state'))).go('login');<% } %>
+ // remove any stale tokens
+ $cookies.remove('token');
+ return $q.reject(response);
+ }
+ else {
+ return $q.reject(response);
}
- };
- }
+ }
+ };
+}
- angular.module('<%= scriptAppName %>.auth')
- .factory('authInterceptor', authInterceptor);
+angular.module('<%= scriptAppName %>.auth')
+ .factory('authInterceptor', authInterceptor);
})();
diff --git a/app/templates/client/components/auth(auth)/router.decorator(js).js b/app/templates/client/components/auth(auth)/router.decorator(js).js
index edd71d95e..4e48f401a 100644
--- a/app/templates/client/components/auth(auth)/router.decorator(js).js
+++ b/app/templates/client/components/auth(auth)/router.decorator(js).js
@@ -2,40 +2,40 @@
(function() {
- function routerDecorator(<%= filters.uirouter ? '$stateProvider' : '$provide' %>) {
- var authDecorator = function(<%= filters.uirouter ? 'state' : 'route' %>) {
- var auth = <%= filters.uirouter ? 'state' : 'route' %>.authenticate;
- if (auth) {
- <%= filters.uirouter ? 'state' : 'route' %>.resolve = <%= filters.uirouter ? 'state' : 'route' %>.resolve || {};
- <%= filters.uirouter ? 'state' : 'route' %>.resolve.user = function(<%= filters.uirouter ? '$state' : '$location' %>, $q, Auth) {
- return Auth.getCurrentUser(true)
- .then(function(user) {
- if ((typeof auth !== 'string' && user._id) ||
- (typeof auth === 'string' && Auth.hasRole(auth))) {
- return user;
- }<% if (filters.ngroute) { %>
- $location.path((user._id) ? '/' : '/login');<% } if (filters.uirouter) { %>
- $state.go((user._id) ? 'main' : 'login');<% } %>
- return $q.reject('not authorized');
- });
- };
- }
- };<% if (filters.ngroute) { %>
+function routerDecorator(<%= filters.uirouter ? '$stateProvider' : '$provide' %>) {
+ var authDecorator = function(<%= filters.uirouter ? 'state' : 'route' %>) {
+ var auth = <%= filters.uirouter ? 'state' : 'route' %>.authenticate;
+ if (auth) {
+ <%= filters.uirouter ? 'state' : 'route' %>.resolve = <%= filters.uirouter ? 'state' : 'route' %>.resolve || {};
+ <%= filters.uirouter ? 'state' : 'route' %>.resolve.user = function(<%= filters.uirouter ? '$state' : '$location' %>, $q, Auth) {
+ return Auth.getCurrentUser(true)
+ .then(function(user) {
+ if ((typeof auth !== 'string' && user._id) ||
+ (typeof auth === 'string' && Auth.hasRole(auth))) {
+ return user;
+ }<% if (filters.ngroute) { %>
+ $location.path((user._id) ? '/' : '/login');<% } if (filters.uirouter) { %>
+ $state.go((user._id) ? 'main' : 'login');<% } %>
+ return $q.reject('not authorized');
+ });
+ };
+ }
+ };<% if (filters.ngroute) { %>
- $provide.decorator('$route', function($delegate) {
- for (var r in $delegate.routes) {
- authDecorator($delegate.routes[r]);
- }
- return $delegate;
- });<% } if (filters.uirouter) { %>
+ $provide.decorator('$route', function($delegate) {
+ for (var r in $delegate.routes) {
+ authDecorator($delegate.routes[r]);
+ }
+ return $delegate;
+ });<% } if (filters.uirouter) { %>
- $stateProvider.decorator('authenticate', function(state) {
- authDecorator(state);
- return state.authenticate;
- });<% } %>
- }
+ $stateProvider.decorator('authenticate', function(state) {
+ authDecorator(state);
+ return state.authenticate;
+ });<% } %>
+}
- angular.module('<%= scriptAppName %>.auth')
- .config(routerDecorator);
+angular.module('<%= scriptAppName %>.auth')
+ .config(routerDecorator);
})();
diff --git a/app/templates/client/components/auth(auth)/user.service(js).js b/app/templates/client/components/auth(auth)/user.service(js).js
index 965f84566..f347c72a9 100644
--- a/app/templates/client/components/auth(auth)/user.service(js).js
+++ b/app/templates/client/components/auth(auth)/user.service(js).js
@@ -2,27 +2,27 @@
(function() {
- function UserResource($resource) {
- return $resource('/api/users/:id/:controller', {
- id: '@_id'
+function UserResource($resource) {
+ return $resource('/api/users/:id/:controller', {
+ id: '@_id'
+ },
+ {
+ changePassword: {
+ method: 'PUT',
+ params: {
+ controller:'password'
+ }
},
- {
- changePassword: {
- method: 'PUT',
- params: {
- controller:'password'
- }
- },
- get: {
- method: 'GET',
- params: {
- id:'me'
- }
+ get: {
+ method: 'GET',
+ params: {
+ id:'me'
}
- });
- }
+ }
+ });
+}
- angular.module('<%= scriptAppName %>.auth')
- .factory('User', UserResource);
+angular.module('<%= scriptAppName %>.auth')
+ .factory('User', UserResource);
})();
From a9ab1fa0d60a6ac4cd05787af3d448b2a8942e41 Mon Sep 17 00:00:00 2001
From: kingcody
Date: Tue, 15 Sep 2015 22:45:10 -0400
Subject: [PATCH 0064/1129] chore(dependencies): update grunt-contrib-cssmin to
`^0.14.0`
---
app/templates/_package.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/templates/_package.json b/app/templates/_package.json
index 4d4b52a15..6eba3d7f3 100644
--- a/app/templates/_package.json
+++ b/app/templates/_package.json
@@ -44,7 +44,7 @@
"grunt-contrib-clean": "^0.6.0",
"grunt-contrib-concat": "^0.5.1",
"grunt-contrib-copy": "^0.8.0",
- "grunt-contrib-cssmin": "^0.13.0",
+ "grunt-contrib-cssmin": "^0.14.0",
"grunt-contrib-imagemin": "^0.9.4",
"grunt-contrib-jshint": "~0.11.2",
"grunt-contrib-uglify": "^0.9.1",
From 2fab1f549806f950da53a756a9d179e181677a0f Mon Sep 17 00:00:00 2001
From: kingcody
Date: Wed, 16 Sep 2015 00:51:16 -0400
Subject: [PATCH 0065/1129] refactor(client:auth) simplify
`authInterceptor.responseError`
---
.../client/components/auth(auth)/interceptor.service(js).js | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/app/templates/client/components/auth(auth)/interceptor.service(js).js b/app/templates/client/components/auth(auth)/interceptor.service(js).js
index 67c0526a3..4191d1dde 100644
--- a/app/templates/client/components/auth(auth)/interceptor.service(js).js
+++ b/app/templates/client/components/auth(auth)/interceptor.service(js).js
@@ -20,11 +20,8 @@ function authInterceptor($rootScope, $q, $cookies<% if (filters.ngroute) { %>, $
<% if (filters.ngroute) { %>$location.path('/login');<% } if (filters.uirouter) { %>(state || (state = $injector.get('$state'))).go('login');<% } %>
// remove any stale tokens
$cookies.remove('token');
- return $q.reject(response);
- }
- else {
- return $q.reject(response);
}
+ return $q.reject(response);
}
};
}
From 3c29832f515179a5f4fb54f9ed73ebc07dd34945 Mon Sep 17 00:00:00 2001
From: kingcody
Date: Wed, 16 Sep 2015 03:29:48 -0400
Subject: [PATCH 0066/1129] feat(app): implement util module for thin, reusable
functions
---
.../components/auth(auth)/auth.module(js).js | 1 +
.../components/auth(auth)/auth.service(js).js | 17 ++---
.../client/components/util/util.module.js | 3 +
.../client/components/util/util.service.js | 62 +++++++++++++++++++
test/test-file-creation.js | 2 +
5 files changed, 72 insertions(+), 13 deletions(-)
create mode 100644 app/templates/client/components/util/util.module.js
create mode 100644 app/templates/client/components/util/util.service.js
diff --git a/app/templates/client/components/auth(auth)/auth.module(js).js b/app/templates/client/components/auth(auth)/auth.module(js).js
index 3e096aeb3..60ce6e321 100644
--- a/app/templates/client/components/auth(auth)/auth.module(js).js
+++ b/app/templates/client/components/auth(auth)/auth.module(js).js
@@ -2,6 +2,7 @@
angular.module('<%= scriptAppName %>.auth', [
'<%= scriptAppName %>.constants',
+ '<%= scriptAppName %>.util',
'ngCookies'<% if (filters.ngroute) { %>,
'ngRoute'<% } if (filters.uirouter) { %>,
'ui.router'<% } %>
diff --git a/app/templates/client/components/auth(auth)/auth.service(js).js b/app/templates/client/components/auth(auth)/auth.service(js).js
index 49bdb2a9e..e8c7c16b1 100644
--- a/app/templates/client/components/auth(auth)/auth.service(js).js
+++ b/app/templates/client/components/auth(auth)/auth.service(js).js
@@ -2,19 +2,10 @@
(function() {
-function AuthService($location, $http, $cookies, $q, appConfig, User) {
- /**
- * Return a callback or noop function
- *
- * @param {Function|*} cb - a 'potential' function
- * @return {Function}
- */
- var safeCb = function(cb) {
- return (angular.isFunction(cb)) ? cb : angular.noop;
- },
-
- currentUser = {},
- userRoles = appConfig.userRoles || [];
+function AuthService($location, $http, $cookies, $q, appConfig, Util, User) {
+ var safeCb = Util.safeCb;
+ var currentUser = {};
+ var userRoles = appConfig.userRoles || [];
if ($cookies.get('token') && $location.path() !== '/logout') {
currentUser = User.get();
diff --git a/app/templates/client/components/util/util.module.js b/app/templates/client/components/util/util.module.js
new file mode 100644
index 000000000..690b12456
--- /dev/null
+++ b/app/templates/client/components/util/util.module.js
@@ -0,0 +1,3 @@
+'use strict';
+
+angular.module('<%= scriptAppName %>.util', []);
diff --git a/app/templates/client/components/util/util.service.js b/app/templates/client/components/util/util.service.js
new file mode 100644
index 000000000..71f0c25e5
--- /dev/null
+++ b/app/templates/client/components/util/util.service.js
@@ -0,0 +1,62 @@
+'use strict';
+
+(function() {
+
+/**
+ * The Util service is for thin, globally reusable, utility functions
+ */
+function UtilService($window) {
+
+ var Util = {
+
+ /**
+ * Return a callback or noop function
+ *
+ * @param {Function|*} cb - a 'potential' function
+ * @return {Function}
+ */
+ safeCb: function(cb) {
+ return (angular.isFunction(cb)) ? cb : angular.noop;
+ },
+
+ /**
+ * Parse a given url with the use of an anchor element
+ *
+ * @param {String} url - the url to parse
+ * @return {Object} - the parsed url, anchor element
+ */
+ urlParse: function(url) {
+ var a = document.createElement('a');
+ a.href = url;
+ return a;
+ },
+
+ /**
+ * Test whether or not a given url is same origin
+ *
+ * @param {String} url - url to test
+ * @param {String|String[]} [origins] - additional origins to test against
+ * @return {Boolean} - true if url is same origin
+ */
+ isSameOrigin: function(url, origins) {
+ url = Util.urlParse(url);
+ origins = (origins && [].concat(origins)) || [];
+ origins = origins.map(Util.urlParse);
+ origins.push($window.location);
+ origins = origins.filter(function(o) {
+ return url.hostname === o.hostname &&
+ url.port === o.port &&
+ url.protocol === o.protocol;
+ });
+ return (origins.length >= 1);
+ }
+
+ };
+
+ return Util;
+}
+
+angular.module('<%= scriptAppName %>.util')
+ .factory('Util', UtilService);
+
+})();
diff --git a/test/test-file-creation.js b/test/test-file-creation.js
index ae1dc0297..5edd9ec84 100644
--- a/test/test-file-creation.js
+++ b/test/test-file-creation.js
@@ -182,6 +182,8 @@ describe('angular-fullstack generator', function () {
'client/components/navbar/navbar.' + markup,
'client/components/navbar/navbar.controller.' + script,
'client/components/navbar/navbar.directive.' + script,
+ 'client/components/util/util.module.' + script,
+ 'client/components/util/util.service.' + script,
'server/.jshintrc',
'server/.jshintrc-spec',
'server/app.js',
From abcb51a7686bb138ef9d005a596e2de43b790766 Mon Sep 17 00:00:00 2001
From: kingcody
Date: Wed, 16 Sep 2015 03:46:36 -0400
Subject: [PATCH 0067/1129] fix(client:auth): restrict `Authorization` header
to same origin
---
.../client/components/auth(auth)/interceptor.service(js).js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/templates/client/components/auth(auth)/interceptor.service(js).js b/app/templates/client/components/auth(auth)/interceptor.service(js).js
index 4191d1dde..5bfb4b174 100644
--- a/app/templates/client/components/auth(auth)/interceptor.service(js).js
+++ b/app/templates/client/components/auth(auth)/interceptor.service(js).js
@@ -2,13 +2,13 @@
(function() {
-function authInterceptor($rootScope, $q, $cookies<% if (filters.ngroute) { %>, $location<% } if (filters.uirouter) { %>, $injector<% } %>) {
+function authInterceptor($rootScope, $q, $cookies<% if (filters.ngroute) { %>, $location<% } if (filters.uirouter) { %>, $injector<% } %>, Util) {
<% if (filters.uirouter) { %>var state;
<% } %>return {
// Add authorization token to headers
request: function(config) {
config.headers = config.headers || {};
- if ($cookies.get('token')) {
+ if ($cookies.get('token') && Util.isSameOrigin(config.url)) {
config.headers.Authorization = 'Bearer ' + $cookies.get('token');
}
return config;
From 64d0e4342b6cbcebf3f60e27afe0d7165f646821 Mon Sep 17 00:00:00 2001
From: Andrew Koroluk
Date: Wed, 9 Sep 2015 08:45:21 -0400
Subject: [PATCH 0068/1129] chore(travis): add node 4.0.0 to travis targets
allow failures on node 4.0.0 for now
---
.travis.yml | 5 +++++
app/templates/.travis.yml | 5 +++++
2 files changed, 10 insertions(+)
diff --git a/.travis.yml b/.travis.yml
index 82f95fde5..1ce49d7dc 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -2,10 +2,15 @@ sudo: false
language: node_js
node_js:
- '0.12'
+ - '4.0.0'
env:
global:
- SAUCE_USERNAME=fullstack_ci
- SAUCE_ACCESS_KEY=1a527ca6-4aa5-4618-86ce-0278bf158cbf
+matrix:
+ fast_finish: true
+ allow_failures:
+ - node_js: 4.0.0
before_install:
- ./scripts/sauce_connect_setup.sh
- gem update --system
diff --git a/app/templates/.travis.yml b/app/templates/.travis.yml
index c12f57edb..95545e08d 100644
--- a/app/templates/.travis.yml
+++ b/app/templates/.travis.yml
@@ -1,6 +1,11 @@
language: node_js
node_js:
- '0.12'
+ - '4.0.0'
+matrix:
+ fast_finish: true
+ allow_failures:
+ - node_js: 4.0.0
before_script:
- npm install -g bower grunt-cli<% if (filters.sass) { %>
- gem install sass<% } %>
From cdfc423c9f079eacff8592d7c100609f3e85171a Mon Sep 17 00:00:00 2001
From: Andrew Koroluk
Date: Tue, 15 Sep 2015 15:33:08 -0400
Subject: [PATCH 0069/1129] feat(gen): always use Babel
leave in supporting code for use with eventually supporting typescript
---
app/generator.js | 18 ++----
.../{account(js).js => account.js} | 0
....controller(js).js => login.controller.js} | 0
...ntroller(js).js => settings.controller.js} | 0
...controller(js).js => signup.controller.js} | 0
....controller(js).js => admin.controller.js} | 0
.../admin(auth)/{admin(js).js => admin.js} | 0
.../client/app/{app(js).js => app.js} | 0
...n.controller(js).js => main.controller.js} | 0
...er.spec(js).js => main.controller.spec.js} | 0
.../client/app/main/{main(js).js => main.js} | 0
.../{auth.module(js).js => auth.module.js} | 0
.../{auth.service(js).js => auth.service.js} | 0
....service(js).js => interceptor.service.js} | 0
...r.decorator(js).js => router.decorator.js} | 0
.../{user.service(js).js => user.service.js} | 0
...r.directive(js).js => footer.directive.js} | 0
...{modal.service(js).js => modal.service.js} | 0
...ive(js).js => mongoose-error.directive.js} | 0
...controller(js).js => navbar.controller.js} | 0
...r.directive(js).js => navbar.directive.js} | 0
...ler(js).js => oauth-buttons.controller.js} | 0
...s).js => oauth-buttons.controller.spec.js} | 0
...tive(js).js => oauth-buttons.directive.js} | 0
...js).js => oauth-buttons.directive.spec.js} | 0
.../{socket.mock(js).js => socket.mock.js} | 0
...ocket.service(js).js => socket.service.js} | 0
...i-router.mock(js).js => ui-router.mock.js} | 0
test/test-file-creation.js | 61 -------------------
29 files changed, 6 insertions(+), 73 deletions(-)
rename app/templates/client/app/account(auth)/{account(js).js => account.js} (100%)
rename app/templates/client/app/account(auth)/login/{login.controller(js).js => login.controller.js} (100%)
rename app/templates/client/app/account(auth)/settings/{settings.controller(js).js => settings.controller.js} (100%)
rename app/templates/client/app/account(auth)/signup/{signup.controller(js).js => signup.controller.js} (100%)
rename app/templates/client/app/admin(auth)/{admin.controller(js).js => admin.controller.js} (100%)
rename app/templates/client/app/admin(auth)/{admin(js).js => admin.js} (100%)
rename app/templates/client/app/{app(js).js => app.js} (100%)
rename app/templates/client/app/main/{main.controller(js).js => main.controller.js} (100%)
rename app/templates/client/app/main/{main.controller.spec(js).js => main.controller.spec.js} (100%)
rename app/templates/client/app/main/{main(js).js => main.js} (100%)
rename app/templates/client/components/auth(auth)/{auth.module(js).js => auth.module.js} (100%)
rename app/templates/client/components/auth(auth)/{auth.service(js).js => auth.service.js} (100%)
rename app/templates/client/components/auth(auth)/{interceptor.service(js).js => interceptor.service.js} (100%)
rename app/templates/client/components/auth(auth)/{router.decorator(js).js => router.decorator.js} (100%)
rename app/templates/client/components/auth(auth)/{user.service(js).js => user.service.js} (100%)
rename app/templates/client/components/footer/{footer.directive(js).js => footer.directive.js} (100%)
rename app/templates/client/components/modal(uibootstrap)/{modal.service(js).js => modal.service.js} (100%)
rename app/templates/client/components/mongoose-error(auth)/{mongoose-error.directive(js).js => mongoose-error.directive.js} (100%)
rename app/templates/client/components/navbar/{navbar.controller(js).js => navbar.controller.js} (100%)
rename app/templates/client/components/navbar/{navbar.directive(js).js => navbar.directive.js} (100%)
rename app/templates/client/components/oauth-buttons(oauth)/{oauth-buttons.controller(js).js => oauth-buttons.controller.js} (100%)
rename app/templates/client/components/oauth-buttons(oauth)/{oauth-buttons.controller.spec(js).js => oauth-buttons.controller.spec.js} (100%)
rename app/templates/client/components/oauth-buttons(oauth)/{oauth-buttons.directive(js).js => oauth-buttons.directive.js} (100%)
rename app/templates/client/components/oauth-buttons(oauth)/{oauth-buttons.directive.spec(js).js => oauth-buttons.directive.spec.js} (100%)
rename app/templates/client/components/socket(socketio)/{socket.mock(js).js => socket.mock.js} (100%)
rename app/templates/client/components/socket(socketio)/{socket.service(js).js => socket.service.js} (100%)
rename app/templates/client/components/ui-router(uirouter)/{ui-router.mock(js).js => ui-router.mock.js} (100%)
diff --git a/app/generator.js b/app/generator.js
index 00fad1ad5..5478748f0 100644
--- a/app/generator.js
+++ b/app/generator.js
@@ -90,18 +90,13 @@ export default class Generator extends Base {
this.log('# Client\n');
- this.prompt([{
+ this.prompt([/*{
type: 'list',
name: 'script',
message: 'What would you like to write scripts with?',
- choices: [ 'JavaScript', 'JavaScript + Babel'],
- filter: function( val ) {
- return {
- 'JavaScript': 'js',
- 'JavaScript + Babel': 'babel'
- }[val];
- }
- }, {
+ choices: ['Babel', 'TypeScript'],
+ filter: function(val) { return val.toLowerCase(); }
+ }, */{
type: 'list',
name: 'markup',
message: 'What would you like to write markup with?',
@@ -134,9 +129,8 @@ export default class Generator extends Base {
}
}], function (answers) {
- // also set 'js' to true if using babel
- if(answers.script === 'babel') { this.filters.js = true; }
- this.filters[answers.script] = true;
+ this.filters.js = true;
+ this.filters.babel = true;
this.filters[answers.markup] = true;
this.filters[answers.stylesheet] = true;
this.filters[answers.router] = true;
diff --git a/app/templates/client/app/account(auth)/account(js).js b/app/templates/client/app/account(auth)/account.js
similarity index 100%
rename from app/templates/client/app/account(auth)/account(js).js
rename to app/templates/client/app/account(auth)/account.js
diff --git a/app/templates/client/app/account(auth)/login/login.controller(js).js b/app/templates/client/app/account(auth)/login/login.controller.js
similarity index 100%
rename from app/templates/client/app/account(auth)/login/login.controller(js).js
rename to app/templates/client/app/account(auth)/login/login.controller.js
diff --git a/app/templates/client/app/account(auth)/settings/settings.controller(js).js b/app/templates/client/app/account(auth)/settings/settings.controller.js
similarity index 100%
rename from app/templates/client/app/account(auth)/settings/settings.controller(js).js
rename to app/templates/client/app/account(auth)/settings/settings.controller.js
diff --git a/app/templates/client/app/account(auth)/signup/signup.controller(js).js b/app/templates/client/app/account(auth)/signup/signup.controller.js
similarity index 100%
rename from app/templates/client/app/account(auth)/signup/signup.controller(js).js
rename to app/templates/client/app/account(auth)/signup/signup.controller.js
diff --git a/app/templates/client/app/admin(auth)/admin.controller(js).js b/app/templates/client/app/admin(auth)/admin.controller.js
similarity index 100%
rename from app/templates/client/app/admin(auth)/admin.controller(js).js
rename to app/templates/client/app/admin(auth)/admin.controller.js
diff --git a/app/templates/client/app/admin(auth)/admin(js).js b/app/templates/client/app/admin(auth)/admin.js
similarity index 100%
rename from app/templates/client/app/admin(auth)/admin(js).js
rename to app/templates/client/app/admin(auth)/admin.js
diff --git a/app/templates/client/app/app(js).js b/app/templates/client/app/app.js
similarity index 100%
rename from app/templates/client/app/app(js).js
rename to app/templates/client/app/app.js
diff --git a/app/templates/client/app/main/main.controller(js).js b/app/templates/client/app/main/main.controller.js
similarity index 100%
rename from app/templates/client/app/main/main.controller(js).js
rename to app/templates/client/app/main/main.controller.js
diff --git a/app/templates/client/app/main/main.controller.spec(js).js b/app/templates/client/app/main/main.controller.spec.js
similarity index 100%
rename from app/templates/client/app/main/main.controller.spec(js).js
rename to app/templates/client/app/main/main.controller.spec.js
diff --git a/app/templates/client/app/main/main(js).js b/app/templates/client/app/main/main.js
similarity index 100%
rename from app/templates/client/app/main/main(js).js
rename to app/templates/client/app/main/main.js
diff --git a/app/templates/client/components/auth(auth)/auth.module(js).js b/app/templates/client/components/auth(auth)/auth.module.js
similarity index 100%
rename from app/templates/client/components/auth(auth)/auth.module(js).js
rename to app/templates/client/components/auth(auth)/auth.module.js
diff --git a/app/templates/client/components/auth(auth)/auth.service(js).js b/app/templates/client/components/auth(auth)/auth.service.js
similarity index 100%
rename from app/templates/client/components/auth(auth)/auth.service(js).js
rename to app/templates/client/components/auth(auth)/auth.service.js
diff --git a/app/templates/client/components/auth(auth)/interceptor.service(js).js b/app/templates/client/components/auth(auth)/interceptor.service.js
similarity index 100%
rename from app/templates/client/components/auth(auth)/interceptor.service(js).js
rename to app/templates/client/components/auth(auth)/interceptor.service.js
diff --git a/app/templates/client/components/auth(auth)/router.decorator(js).js b/app/templates/client/components/auth(auth)/router.decorator.js
similarity index 100%
rename from app/templates/client/components/auth(auth)/router.decorator(js).js
rename to app/templates/client/components/auth(auth)/router.decorator.js
diff --git a/app/templates/client/components/auth(auth)/user.service(js).js b/app/templates/client/components/auth(auth)/user.service.js
similarity index 100%
rename from app/templates/client/components/auth(auth)/user.service(js).js
rename to app/templates/client/components/auth(auth)/user.service.js
diff --git a/app/templates/client/components/footer/footer.directive(js).js b/app/templates/client/components/footer/footer.directive.js
similarity index 100%
rename from app/templates/client/components/footer/footer.directive(js).js
rename to app/templates/client/components/footer/footer.directive.js
diff --git a/app/templates/client/components/modal(uibootstrap)/modal.service(js).js b/app/templates/client/components/modal(uibootstrap)/modal.service.js
similarity index 100%
rename from app/templates/client/components/modal(uibootstrap)/modal.service(js).js
rename to app/templates/client/components/modal(uibootstrap)/modal.service.js
diff --git a/app/templates/client/components/mongoose-error(auth)/mongoose-error.directive(js).js b/app/templates/client/components/mongoose-error(auth)/mongoose-error.directive.js
similarity index 100%
rename from app/templates/client/components/mongoose-error(auth)/mongoose-error.directive(js).js
rename to app/templates/client/components/mongoose-error(auth)/mongoose-error.directive.js
diff --git a/app/templates/client/components/navbar/navbar.controller(js).js b/app/templates/client/components/navbar/navbar.controller.js
similarity index 100%
rename from app/templates/client/components/navbar/navbar.controller(js).js
rename to app/templates/client/components/navbar/navbar.controller.js
diff --git a/app/templates/client/components/navbar/navbar.directive(js).js b/app/templates/client/components/navbar/navbar.directive.js
similarity index 100%
rename from app/templates/client/components/navbar/navbar.directive(js).js
rename to app/templates/client/components/navbar/navbar.directive.js
diff --git a/app/templates/client/components/oauth-buttons(oauth)/oauth-buttons.controller(js).js b/app/templates/client/components/oauth-buttons(oauth)/oauth-buttons.controller.js
similarity index 100%
rename from app/templates/client/components/oauth-buttons(oauth)/oauth-buttons.controller(js).js
rename to app/templates/client/components/oauth-buttons(oauth)/oauth-buttons.controller.js
diff --git a/app/templates/client/components/oauth-buttons(oauth)/oauth-buttons.controller.spec(js).js b/app/templates/client/components/oauth-buttons(oauth)/oauth-buttons.controller.spec.js
similarity index 100%
rename from app/templates/client/components/oauth-buttons(oauth)/oauth-buttons.controller.spec(js).js
rename to app/templates/client/components/oauth-buttons(oauth)/oauth-buttons.controller.spec.js
diff --git a/app/templates/client/components/oauth-buttons(oauth)/oauth-buttons.directive(js).js b/app/templates/client/components/oauth-buttons(oauth)/oauth-buttons.directive.js
similarity index 100%
rename from app/templates/client/components/oauth-buttons(oauth)/oauth-buttons.directive(js).js
rename to app/templates/client/components/oauth-buttons(oauth)/oauth-buttons.directive.js
diff --git a/app/templates/client/components/oauth-buttons(oauth)/oauth-buttons.directive.spec(js).js b/app/templates/client/components/oauth-buttons(oauth)/oauth-buttons.directive.spec.js
similarity index 100%
rename from app/templates/client/components/oauth-buttons(oauth)/oauth-buttons.directive.spec(js).js
rename to app/templates/client/components/oauth-buttons(oauth)/oauth-buttons.directive.spec.js
diff --git a/app/templates/client/components/socket(socketio)/socket.mock(js).js b/app/templates/client/components/socket(socketio)/socket.mock.js
similarity index 100%
rename from app/templates/client/components/socket(socketio)/socket.mock(js).js
rename to app/templates/client/components/socket(socketio)/socket.mock.js
diff --git a/app/templates/client/components/socket(socketio)/socket.service(js).js b/app/templates/client/components/socket(socketio)/socket.service.js
similarity index 100%
rename from app/templates/client/components/socket(socketio)/socket.service(js).js
rename to app/templates/client/components/socket(socketio)/socket.service.js
diff --git a/app/templates/client/components/ui-router(uirouter)/ui-router.mock(js).js b/app/templates/client/components/ui-router(uirouter)/ui-router.mock.js
similarity index 100%
rename from app/templates/client/components/ui-router(uirouter)/ui-router.mock(js).js
rename to app/templates/client/components/ui-router(uirouter)/ui-router.mock.js
diff --git a/test/test-file-creation.js b/test/test-file-creation.js
index 5edd9ec84..26f326dc7 100644
--- a/test/test-file-creation.js
+++ b/test/test-file-creation.js
@@ -729,66 +729,5 @@ describe('angular-fullstack generator', function () {
}
});
-
- describe('with no preprocessors and no server options', function() {
- var testOptions = {
- script: 'js',
- markup: 'html',
- stylesheet: 'css',
- router: 'ngroute',
- testing: 'jasmine',
- odms: [],
- auth: false,
- oauth: [],
- socketio: false,
- bootstrap: true,
- uibootstrap: true
- };
-
- beforeEach(function(done) {
- helpers.mockPrompt(gen, testOptions);
- done();
- });
-
- it('should run client tests successfully', function(done) {
- runTest('grunt test:client', this, done);
- });
-
- it('should pass jscs', function(done) {
- runTest('grunt jscs', this, done);
- });
-
- it('should pass lint', function(done) {
- runTest('grunt jshint', this, done);
- });
-
- it('should run server tests successfully', function(done) {
- runTest('grunt test:server', this, done);
- });
-
- it('should generate expected files', function (done) {
- gen.run(function () {
- assert.file(genFiles(testOptions));
- done();
- });
- });
-
- it('should not generate unexpected files', function (done) {
- gen.run(function () {
- assertOnlyFiles(genFiles(testOptions), done);
- });
- });
-
- if(!process.env.SKIP_E2E) {
- it('should run e2e tests successfully', function (done) {
- runTest('grunt test:e2e', this, done, 240000);
- });
-
- //it('should run e2e tests successfully for production app', function (done) {
- // runTest('grunt test:e2e:prod', this, done, 240000);
- //});
- }
-
- });
});
});
From 1a783ba4f8653b3fa2b90b7432ad58053c52f29f Mon Sep 17 00:00:00 2001
From: Andrew Koroluk
Date: Tue, 15 Sep 2015 16:11:10 -0400
Subject: [PATCH 0070/1129] feat(client:main): use a class for the main
controller
---
.../client/app/main/main.controller.js | 46 ++++++++++---------
1 file changed, 24 insertions(+), 22 deletions(-)
diff --git a/app/templates/client/app/main/main.controller.js b/app/templates/client/app/main/main.controller.js
index db9bbd5c3..f69ad1e8b 100644
--- a/app/templates/client/app/main/main.controller.js
+++ b/app/templates/client/app/main/main.controller.js
@@ -2,30 +2,32 @@
(function() {
-function MainController($scope, $http<% if (filters.socketio) { %>, socket<% } %>) {
- var self = this;
- this.awesomeThings = [];
-
- $http.get('/api/things').then(function(response) {
- self.awesomeThings = response.data;<% if (filters.socketio) { %>
- socket.syncUpdates('thing', self.awesomeThings);<% } %>
- });<% if (filters.models) { %>
-
- this.addThing = function() {
- if (self.newThing === '') {
- return;
+class MainController {
+
+ constructor($http<% if (filters.socketio) { %>, $scope, socket<% } %>) {
+ this.$http = $http;
+ this.awesomeThings = [];
+
+ $http.get('/api/things').then(response => {
+ this.awesomeThings = response.data;<% if (filters.socketio) { %>
+ socket.syncUpdates('thing', this.awesomeThings);<% } %>
+ });<% if (filters.socketio) { %>
+
+ $scope.$on('$destroy', function() {
+ socket.unsyncUpdates('thing');
+ });<% } %>
+ }<% if (filters.models) { %>
+
+ addThing() {
+ if (this.newThing) {
+ this.$http.post('/api/things', { name: this.newThing });
+ this.newThing = '';
}
- $http.post('/api/things', { name: self.newThing });
- self.newThing = '';
- };
+ }
- this.deleteThing = function(thing) {
- $http.delete('/api/things/' + thing._id);
- };<% } if (filters.socketio) { %>
-
- $scope.$on('$destroy', function() {
- socket.unsyncUpdates('thing');
- });<% } %>
+ deleteThing(thing) {
+ this.$http.delete('/api/things/' + thing._id);
+ }<% } %>
}
angular.module('<%= scriptAppName %>')
From 5babe1ce7ff269885fffdf5c5a407d763a0d40d9 Mon Sep 17 00:00:00 2001
From: kingcody
Date: Wed, 16 Sep 2015 17:18:25 -0400
Subject: [PATCH 0071/1129] feat(client:admin): implement admin components as a
seperate module
---
app/generator.js | 1 +
app/templates/client/app/admin(auth)/admin.controller.js | 2 +-
app/templates/client/app/admin(auth)/admin.module.js | 7 +++++++
.../client/app/admin(auth)/{admin.js => admin.router.js} | 4 ++--
test/test-file-creation.js | 3 ++-
5 files changed, 13 insertions(+), 4 deletions(-)
create mode 100644 app/templates/client/app/admin(auth)/admin.module.js
rename app/templates/client/app/admin(auth)/{admin.js => admin.router.js} (79%)
diff --git a/app/generator.js b/app/generator.js
index 5478748f0..67a00bfe5 100644
--- a/app/generator.js
+++ b/app/generator.js
@@ -375,6 +375,7 @@ export default class Generator extends Base {
if(this.filters.uirouter) angModules.push("'ui.router'");
if(this.filters.uibootstrap) angModules.push("'ui.bootstrap'");
if(this.filters.auth) {
+ angModules.unshift(`'${this.scriptAppName}.admin'`);
angModules.unshift(`'${this.scriptAppName}.auth'`);
angModules.push("'validation.match'");
}
diff --git a/app/templates/client/app/admin(auth)/admin.controller.js b/app/templates/client/app/admin(auth)/admin.controller.js
index 3cbfd4b7f..bcc8f0a6a 100644
--- a/app/templates/client/app/admin(auth)/admin.controller.js
+++ b/app/templates/client/app/admin(auth)/admin.controller.js
@@ -1,6 +1,6 @@
'use strict';
-angular.module('<%= scriptAppName %>')
+angular.module('<%= scriptAppName %>.admin')
.controller('AdminCtrl', function($scope, $http, Auth, User) {
// Use the User $resource to fetch all users
diff --git a/app/templates/client/app/admin(auth)/admin.module.js b/app/templates/client/app/admin(auth)/admin.module.js
new file mode 100644
index 000000000..da769ae91
--- /dev/null
+++ b/app/templates/client/app/admin(auth)/admin.module.js
@@ -0,0 +1,7 @@
+'use strict';
+
+angular.module('<%= scriptAppName %>.admin', [
+ '<%= scriptAppName %>.auth'<% if (filters.ngroute) { %>,
+ 'ngRoute'<% } if (filters.uirouter) { %>,
+ 'ui.router'<% } %>
+]);
diff --git a/app/templates/client/app/admin(auth)/admin.js b/app/templates/client/app/admin(auth)/admin.router.js
similarity index 79%
rename from app/templates/client/app/admin(auth)/admin.js
rename to app/templates/client/app/admin(auth)/admin.router.js
index 510363868..fd0366df0 100644
--- a/app/templates/client/app/admin(auth)/admin.js
+++ b/app/templates/client/app/admin(auth)/admin.router.js
@@ -1,6 +1,6 @@
'use strict';
-angular.module('<%= scriptAppName %>')
+angular.module('<%= scriptAppName %>.admin')
<% if (filters.ngroute) { %>.config(function($routeProvider) {
$routeProvider
.when('/admin', {
@@ -8,7 +8,7 @@ angular.module('<%= scriptAppName %>')
controller: 'AdminCtrl',
authenticate: 'admin'
});
- });<% } %><% if (filters.uirouter) { %>.config(function($stateProvider) {
+ });<% } if (filters.uirouter) { %>.config(function($stateProvider) {
$stateProvider
.state('admin', {
url: '/admin',
diff --git a/test/test-file-creation.js b/test/test-file-creation.js
index 26f326dc7..ef4a3e8e4 100644
--- a/test/test-file-creation.js
+++ b/test/test-file-creation.js
@@ -267,7 +267,8 @@ describe('angular-fullstack generator', function () {
'client/app/account/signup/signup.controller.' + script,
'client/app/admin/admin.' + markup,
'client/app/admin/admin.' + stylesheet,
- 'client/app/admin/admin.' + script,
+ 'client/app/admin/admin.module.' + script,
+ 'client/app/admin/admin.router.' + script,
'client/app/admin/admin.controller.' + script,
'client/components/auth/auth.module.' + script,
'client/components/auth/auth.service.' + script,
From 8a76da29efd6a35819df1e24f153f2358b685f3d Mon Sep 17 00:00:00 2001
From: kingcody
Date: Wed, 16 Sep 2015 17:32:19 -0400
Subject: [PATCH 0072/1129] feat(client:admin): use controllerAs syntax for
`AdminController`
---
.../client/app/admin(auth)/admin(html).html | 4 ++--
.../client/app/admin(auth)/admin(jade).jade | 4 ++--
.../app/admin(auth)/admin.controller.js | 23 +++++++++++--------
.../client/app/admin(auth)/admin.router.js | 6 +++--
4 files changed, 22 insertions(+), 15 deletions(-)
diff --git a/app/templates/client/app/admin(auth)/admin(html).html b/app/templates/client/app/admin(auth)/admin(html).html
index 7688c9b47..fca41494e 100644
--- a/app/templates/client/app/admin(auth)/admin(html).html
+++ b/app/templates/client/app/admin(auth)/admin(html).html
@@ -3,10 +3,10 @@
The delete user and user index api routes are restricted to users with the 'admin' role.
- -
+
-
{{user.name}}
{{user.email}}
-
+
diff --git a/app/templates/client/app/admin(auth)/admin(jade).jade b/app/templates/client/app/admin(auth)/admin(jade).jade
index bcef64773..822e747d8 100644
--- a/app/templates/client/app/admin(auth)/admin(jade).jade
+++ b/app/templates/client/app/admin(auth)/admin(jade).jade
@@ -3,9 +3,9 @@ navbar
p
| The delete user and user index api routes are restricted to users with the 'admin' role.
ul.list-group
- li.list-group-item(ng-repeat='user in users')
+ li.list-group-item(ng-repeat='user in admin.users')
strong {{user.name}}
br
span.text-muted {{user.email}}
- a.trash(ng-click='delete(user)')
+ a.trash(ng-click='admin.delete(user)')
span.glyphicon.glyphicon-trash.pull-right
diff --git a/app/templates/client/app/admin(auth)/admin.controller.js b/app/templates/client/app/admin(auth)/admin.controller.js
index bcc8f0a6a..c28d2adf3 100644
--- a/app/templates/client/app/admin(auth)/admin.controller.js
+++ b/app/templates/client/app/admin(auth)/admin.controller.js
@@ -1,13 +1,18 @@
'use strict';
-angular.module('<%= scriptAppName %>.admin')
- .controller('AdminCtrl', function($scope, $http, Auth, User) {
+(function() {
+
+function AdminController(User) {
+ // Use the User $resource to fetch all users
+ var users = this.users = User.query();
- // Use the User $resource to fetch all users
- $scope.users = User.query();
+ this.delete = function(user) {
+ user.$remove();
+ users.splice(users.indexOf(user), 1);
+ };
+}
+
+angular.module('<%= scriptAppName %>.admin')
+ .controller('AdminController', AdminController);
- $scope.delete = function(user) {
- User.remove({ id: user._id });
- $scope.users.splice(this.$index, 1);
- };
- });
+})();
diff --git a/app/templates/client/app/admin(auth)/admin.router.js b/app/templates/client/app/admin(auth)/admin.router.js
index fd0366df0..cc3d9e9f9 100644
--- a/app/templates/client/app/admin(auth)/admin.router.js
+++ b/app/templates/client/app/admin(auth)/admin.router.js
@@ -5,7 +5,8 @@ angular.module('<%= scriptAppName %>.admin')
$routeProvider
.when('/admin', {
templateUrl: 'app/admin/admin.html',
- controller: 'AdminCtrl',
+ controller: 'AdminController',
+ controllerAs: 'admin',
authenticate: 'admin'
});
});<% } if (filters.uirouter) { %>.config(function($stateProvider) {
@@ -13,7 +14,8 @@ angular.module('<%= scriptAppName %>.admin')
.state('admin', {
url: '/admin',
templateUrl: 'app/admin/admin.html',
- controller: 'AdminCtrl',
+ controller: 'AdminController',
+ controllerAs: 'admin',
authenticate: 'admin'
});
});<% } %>
From d93c7d5e56a3a7885c53ddfdfed70c2a04fee31c Mon Sep 17 00:00:00 2001
From: kingcody
Date: Wed, 16 Sep 2015 20:18:14 -0400
Subject: [PATCH 0073/1129] refactor(karma): update file globs, jade
preprocessor only when `filters.jade`
---
app/templates/_package.json | 4 ++--
app/templates/karma.conf.js | 23 ++++++++---------------
2 files changed, 10 insertions(+), 17 deletions(-)
diff --git a/app/templates/_package.json b/app/templates/_package.json
index 6eba3d7f3..336292463 100644
--- a/app/templates/_package.json
+++ b/app/templates/_package.json
@@ -49,7 +49,8 @@
"grunt-contrib-jshint": "~0.11.2",
"grunt-contrib-uglify": "^0.9.1",
"grunt-contrib-watch": "~0.6.1",<% if (filters.jade) { %>
- "grunt-contrib-jade": "^0.15.0",<% } %><% if (filters.less) { %>
+ "grunt-contrib-jade": "^0.15.0",
+ "karma-ng-jade2js-preprocessor": "^0.2.0",<% } %><% if (filters.less) { %>
"grunt-contrib-less": "^1.0.0",<% } %><% if(filters.babel) { %>
"karma-babel-preprocessor": "^5.2.1",<% } %>
"grunt-babel": "~5.0.0",
@@ -95,7 +96,6 @@
"karma-firefox-launcher": "~0.1.6",
"karma-script-launcher": "~0.1.0",
"karma-html2js-preprocessor": "~0.1.0",
- "karma-ng-jade2js-preprocessor": "^0.2.0",
"karma-chrome-launcher": "~0.2.0",
"requirejs": "~2.1.11",
"karma-requirejs": "~0.2.2",
diff --git a/app/templates/karma.conf.js b/app/templates/karma.conf.js
index 61aa87b74..f85a28f71 100644
--- a/app/templates/karma.conf.js
+++ b/app/templates/karma.conf.js
@@ -22,29 +22,25 @@ module.exports = function(config) {
// endbower<% if (filters.socketio) { %>
'node_modules/socket.io-client/socket.io.js',<% } %>
'client/app/app.js',
- 'client/app/**/*.js',
- 'client/components/**/*.js',
- 'client/app/**/*.jade',
- 'client/components/**/*.jade',
- 'client/app/**/*.html',
- 'client/components/**/*.html'
+ 'client/{app,components}/**/*.module.js',
+ 'client/{app,components}/**/*.js',
+ 'client/{app,components}/**/*.<%= filters.jade ? '{jade,html}' : 'html' %>'
],
preprocessors: {
- '**/*.jade': 'ng-jade2js',
- '**/*.html': 'html2js',<% if(filters.babel) { %>
+ '**/*.html': 'html2js'<% if (filters.jade) { %>,
+ '**/*.jade': 'ng-jade2js'<% } if (filters.babel) { %>,
'client/{app,components}/**/*.js': 'babel'<% } %>
},
ngHtml2JsPreprocessor: {
stripPrefix: 'client/'
- },
+ },<% if (filters.jade) { %>
ngJade2JsPreprocessor: {
stripPrefix: 'client/'
- },
+ },<% } if (filters.babel) { %>
- <% if(filters.babel) { %>
babelPreprocessor: {
options: {
sourceMap: 'inline'
@@ -55,8 +51,7 @@ module.exports = function(config) {
sourceFileName: function (file) {
return file.originalPath;
}
- },
- <% } %>
+ },<% } %>
// list of files / patterns to exclude
exclude: [],
@@ -80,7 +75,6 @@ module.exports = function(config) {
// enable / disable watching file and executing tests whenever any file changes
autoWatch: false,
-
// Start these browsers, currently available:
// - Chrome
// - ChromeCanary
@@ -91,7 +85,6 @@ module.exports = function(config) {
// - IE (only Windows)
browsers: ['PhantomJS'],
-
// Continuous Integration mode
// if true, it capture browsers, run tests and exit
singleRun: false
From 618461ff5da5f27f36d4477d9ac7a44e6b26c516 Mon Sep 17 00:00:00 2001
From: kingcody
Date: Thu, 17 Sep 2015 01:18:56 -0400
Subject: [PATCH 0074/1129] feat(client:admin): use class for AdminController
---
.../client/app/admin(auth)/admin.controller.js | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/app/templates/client/app/admin(auth)/admin.controller.js b/app/templates/client/app/admin(auth)/admin.controller.js
index c28d2adf3..698120b61 100644
--- a/app/templates/client/app/admin(auth)/admin.controller.js
+++ b/app/templates/client/app/admin(auth)/admin.controller.js
@@ -2,14 +2,17 @@
(function() {
-function AdminController(User) {
- // Use the User $resource to fetch all users
- var users = this.users = User.query();
+class AdminController {
- this.delete = function(user) {
+ constructor(User) {
+ // Use the User $resource to fetch all users
+ this.users = User.query();
+ }
+
+ delete(user) {
user.$remove();
- users.splice(users.indexOf(user), 1);
- };
+ this.users.splice(this.users.indexOf(user), 1);
+ }
}
angular.module('<%= scriptAppName %>.admin')
From 4228330ba99bdcb5914a380d4dd26397a9b61679 Mon Sep 17 00:00:00 2001
From: kingcody
Date: Sat, 19 Sep 2015 01:50:18 -0400
Subject: [PATCH 0075/1129] chore(dependencies): require peer-dependant modules
directly, per npm 3+
Changes:
* require `chai`, `sinon`, and `phantomjs` directly
---
app/templates/_package.json | 3 +++
1 file changed, 3 insertions(+)
diff --git a/app/templates/_package.json b/app/templates/_package.json
index 6eba3d7f3..682fa04d8 100644
--- a/app/templates/_package.json
+++ b/app/templates/_package.json
@@ -83,6 +83,8 @@
"grunt-mocha-test": "~0.12.7",
"grunt-mocha-istanbul": "^3.0.1",
"istanbul": "^0.3.17",
+ "chai": "^3.2.0",
+ "sinon": "^1.16.1",
"chai-as-promised": "^5.1.0",
"chai-things": "^0.2.0",
"sinon-chai": "^2.8.0",<% if (filters.mocha) { %>
@@ -100,6 +102,7 @@
"requirejs": "~2.1.11",
"karma-requirejs": "~0.2.2",
"karma-jade-preprocessor": "0.0.11",
+ "phantomjs": "^1.9.18",
"karma-phantomjs-launcher": "~0.2.0",
"karma": "~0.13.3",
"karma-ng-html2js-preprocessor": "~0.1.2",
From a8bd8a678d370035277309551e11e0870fa49b1e Mon Sep 17 00:00:00 2001
From: kingcody
Date: Sun, 20 Sep 2015 21:30:39 -0400
Subject: [PATCH 0076/1129] fix(server:config): template db configs and add
sequelize prod conf
---
.../server/config/environment/development.js | 11 ++++--
.../server/config/environment/production.js | 36 ++++++++++++-------
2 files changed, 32 insertions(+), 15 deletions(-)
diff --git a/app/templates/server/config/environment/development.js b/app/templates/server/config/environment/development.js
index d79b250b3..b97297e36 100644
--- a/app/templates/server/config/environment/development.js
+++ b/app/templates/server/config/environment/development.js
@@ -2,11 +2,14 @@
// Development specific configuration
// ==================================
-module.exports = {
+module.exports = {<% if (filters.mongoose) { %>
+
// MongoDB connection options
mongo: {
uri: 'mongodb://localhost/<%= lodash.slugify(appname) %>-dev'
- },
+ },<% } if (filters.sequelize) { %>
+
+ // Sequelize connecton opions
sequelize: {
uri: 'sqlite://',
options: {
@@ -16,7 +19,9 @@ module.exports = {
timestamps: false
}
}
- },
+ },<% } %>
+ // Seed database on startup
seedDB: true
+
};
diff --git a/app/templates/server/config/environment/production.js b/app/templates/server/config/environment/production.js
index abdda30a3..bb2a0375c 100644
--- a/app/templates/server/config/environment/production.js
+++ b/app/templates/server/config/environment/production.js
@@ -4,21 +4,33 @@
// =================================
module.exports = {
// Server IP
- ip: process.env.OPENSHIFT_NODEJS_IP ||
- process.env.IP ||
- undefined,
+ ip: process.env.OPENSHIFT_NODEJS_IP ||
+ process.env.IP ||
+ undefined,
// Server port
- port: process.env.OPENSHIFT_NODEJS_PORT ||
- process.env.PORT ||
- 8080,
+ port: process.env.OPENSHIFT_NODEJS_PORT ||
+ process.env.PORT ||
+ 8080<% if (filters.mongoose) { %>,
// MongoDB connection options
mongo: {
- uri: process.env.MONGOLAB_URI ||
- process.env.MONGOHQ_URL ||
- process.env.OPENSHIFT_MONGODB_DB_URL +
- process.env.OPENSHIFT_APP_NAME ||
- 'mongodb://localhost/<%= lodash.slugify(appname) %>'
- }
+ uri: process.env.MONGOLAB_URI ||
+ process.env.MONGOHQ_URL ||
+ process.env.OPENSHIFT_MONGODB_DB_URL +
+ process.env.OPENSHIFT_APP_NAME ||
+ 'mongodb://localhost/<%= lodash.slugify(appname) %>'
+ }<% } if (filters.sequelize) { %>,
+
+ sequelize: {
+ uri: process.env.SEQUELIZE_URI ||
+ 'sqlite://',
+ options: {
+ logging: false,
+ storage: 'dist.sqlite',
+ define: {
+ timestamps: false
+ }
+ }
+ }<% } %>
};
From 2266709c789766253fb7167d3f5c6d41a6f79122 Mon Sep 17 00:00:00 2001
From: devon townsend
Date: Wed, 23 Sep 2015 13:46:59 -0700
Subject: [PATCH 0077/1129] Fix typo in readme.md
---
readme.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/readme.md b/readme.md
index b63bc9562..6a5c91068 100644
--- a/readme.md
+++ b/readme.md
@@ -438,7 +438,7 @@ See the [contributing docs](https://github.com/DaftMonk/generator-angular-fullst
This project has 2 main branches: `master` and `canary`. The `master` branch is where the current stable code lives and should be used for production setups. The `canary` branch is the main development branch, this is where PRs should be submitted to (backport fixes may be applied to `master`).
-By seperating the current stable code from the cutting-edge development we hope to provide a stable and efficient workflow for users and developers alike.
+By separating the current stable code from the cutting-edge development we hope to provide a stable and efficient workflow for users and developers alike.
When submitting an issue, please follow the [guidelines](https://github.com/yeoman/yeoman/blob/master/contributing.md#issue-submission). Especially important is to make sure Yeoman is up-to-date, and providing the command or commands that cause the issue.
From 0138cdaffe82c97ee521540d9d6df33a485171e4 Mon Sep 17 00:00:00 2001
From: Andrew Koroluk
Date: Tue, 6 Oct 2015 12:48:11 -0400
Subject: [PATCH 0078/1129] chore(npm): grunt-node-inspector ^0.2.0 -> ^0.4.1
---
app/templates/_package.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/templates/_package.json b/app/templates/_package.json
index 682fa04d8..1aa01b38f 100644
--- a/app/templates/_package.json
+++ b/app/templates/_package.json
@@ -61,7 +61,7 @@
"grunt-filerev": "^2.3.1",
"grunt-usemin": "^3.0.0",
"grunt-env": "~0.4.1",
- "grunt-node-inspector": "^0.2.0",
+ "grunt-node-inspector": "^0.4.1",
"grunt-nodemon": "^0.4.0",
"grunt-angular-templates": "^0.5.4",
"grunt-dom-munger": "^3.4.0",
From 605d3151d0c05c9afa568dbbe20317b121734521 Mon Sep 17 00:00:00 2001
From: Andrew Koroluk
Date: Wed, 14 Oct 2015 12:14:01 -0400
Subject: [PATCH 0079/1129] docs(gen:readme): remove demo
---
readme.md | 2 --
1 file changed, 2 deletions(-)
diff --git a/readme.md b/readme.md
index b63bc9562..f9b1b8b4f 100644
--- a/readme.md
+++ b/readme.md
@@ -12,8 +12,6 @@
## Example project
-Generated with defaults: http://fullstack-demo.herokuapp.com/.
-
Source code: https://github.com/DaftMonk/fullstack-demo
## Usage
From 42a4b8f80518d42abf97c67d2a62406e07cceedb Mon Sep 17 00:00:00 2001
From: Andrew Koroluk
Date: Wed, 14 Oct 2015 15:23:24 -0400
Subject: [PATCH 0080/1129] feat(jscs): update to ^2.1.0, rename config file to
.jscsrc, use esnext option
---
app/templates/{.jscs.json => .jscsrc} | 1 +
app/templates/Gruntfile.js | 2 +-
app/templates/_package.json | 2 +-
test/test-file-creation.js | 2 +-
4 files changed, 4 insertions(+), 3 deletions(-)
rename app/templates/{.jscs.json => .jscsrc} (98%)
diff --git a/app/templates/.jscs.json b/app/templates/.jscsrc
similarity index 98%
rename from app/templates/.jscs.json
rename to app/templates/.jscsrc
index 99393d5f6..76b4a9aaa 100644
--- a/app/templates/.jscs.json
+++ b/app/templates/.jscsrc
@@ -1,4 +1,5 @@
{
+ "esnext": true,
"maximumLineLength": {
"value": 100,
"allowComments": true,
diff --git a/app/templates/Gruntfile.js b/app/templates/Gruntfile.js
index cc3d414e0..1c3ad2bfc 100644
--- a/app/templates/Gruntfile.js
+++ b/app/templates/Gruntfile.js
@@ -165,7 +165,7 @@ module.exports = function (grunt) {
jscs: {
options: {
- config: ".jscs.json"
+ config: ".jscsrc"
},
main: {
files: {
diff --git a/app/templates/_package.json b/app/templates/_package.json
index 4e4490510..217df92ab 100644
--- a/app/templates/_package.json
+++ b/app/templates/_package.json
@@ -55,7 +55,7 @@
"karma-babel-preprocessor": "^5.2.1",<% } %>
"grunt-babel": "~5.0.0",
"grunt-google-cdn": "~0.4.0",
- "grunt-jscs": "^2.0.0",
+ "grunt-jscs": "^2.1.0",
"grunt-newer": "^1.1.1",
"grunt-ng-annotate": "^1.0.1",
"grunt-ng-constant": "^1.1.0",
diff --git a/test/test-file-creation.js b/test/test-file-creation.js
index ef4a3e8e4..555036c94 100644
--- a/test/test-file-creation.js
+++ b/test/test-file-creation.js
@@ -212,7 +212,7 @@ describe('angular-fullstack generator', function () {
'.gitattributes',
'.gitignore',
'.travis.yml',
- '.jscs.json',
+ '.jscsrc',
'.yo-rc.json',
'Gruntfile.js',
'package.json',
From 8069d3b304d360dff2a28eb5badb0b343dfab357 Mon Sep 17 00:00:00 2001
From: Andrew Koroluk
Date: Fri, 30 Oct 2015 14:34:02 -0400
Subject: [PATCH 0081/1129] docs(gen:readme): modify supported configurations
section
reformat supported configurations section, add more info
closes #1397
---
readme.md | 27 +++++++++++++++++++++------
1 file changed, 21 insertions(+), 6 deletions(-)
diff --git a/readme.md b/readme.md
index f9b1b8b4f..1ea32f406 100644
--- a/readme.md
+++ b/readme.md
@@ -39,19 +39,34 @@ Run `grunt` for building, `grunt serve` for preview, and `grunt serve:dist` for
## Supported Configurations
+**General**
+
+* Build Systems: `Grunt`, `Gulp` (Coming Soon)
+* Testing:
+ * `Jasmine`
+ * `Mocha + Chai + Sinon`
+ * Chai assertions:
+ * `Expect`
+ * `Should`
+
**Client**
-* Scripts: `JavaScript`, `Babel`
+* Scripts: `Babel`, `TypeScript` (Coming Soon)
* Markup: `HTML`, `Jade`
-* Stylesheets: `CSS`, `Stylus`, `Sass`, `Less`,
+* Stylesheets: `CSS`, `Stylus`, `Sass`, `Less`
* Angular Routers: `ngRoute`, `ui-router`
+* CSS Frameworks: `Bootstrap`
+ * Option to include `UI Bootstrap`
**Server**
-* Database: `None`, `MongoDB`
-* Authentication boilerplate: `Yes`, `No`
-* oAuth integrations: `Facebook` `Twitter` `Google`
-* Socket.io integration: `Yes`, `No`
+* Scripts: `Babel`
+* Database:
+ * `None`,
+ * `MongoDB`, `SQL`
+ * Authentication boilerplate: `Yes`, `No`
+ * oAuth integrations: `Facebook` `Twitter` `Google`
+ * Socket.io integration: `Yes`, `No`
## Injection
From f4f8db4b4ab01f5ca1e4f076f863fb0fbb07c728 Mon Sep 17 00:00:00 2001
From: Andrew Koroluk
Date: Thu, 19 Nov 2015 15:18:48 -0500
Subject: [PATCH 0082/1129] fix(npm): use latest version numbers instead of
"latest"
closes #1440
---
app/templates/_package.json | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/app/templates/_package.json b/app/templates/_package.json
index 217df92ab..9304ef869 100644
--- a/app/templates/_package.json
+++ b/app/templates/_package.json
@@ -27,9 +27,9 @@
"express-jwt": "^3.0.0",
"passport": "~0.3.0",
"passport-local": "^1.0.0",<% } %><% if (filters.facebookAuth) { %>
- "passport-facebook": "latest",<% } %><% if (filters.twitterAuth) { %>
- "passport-twitter": "latest",<% } %><% if (filters.googleAuth) { %>
- "passport-google-oauth": "latest",<% } %><% if (filters.socketio) { %>
+ "passport-facebook": "^2.0.0",<% } %><% if (filters.twitterAuth) { %>
+ "passport-twitter": "^1.0.3",<% } %><% if (filters.googleAuth) { %>
+ "passport-google-oauth": "~0.2.0",<% } %><% if (filters.socketio) { %>
"socket.io": "^1.3.5",
"socket.io-client": "^1.3.5",
"socketio-jwt": "^4.2.0",<% } %>
@@ -71,7 +71,7 @@
"grunt-karma": "~0.12.0",
"grunt-build-control": "^0.6.0",<% if(filters.sass) { %>
"grunt-contrib-sass": "^0.9.0",<% } %><% if(filters.stylus) { %>
- "grunt-contrib-stylus": "latest",<% } %>
+ "grunt-contrib-stylus": "~0.22.0",<% } %>
"jit-grunt": "^0.9.1",
"time-grunt": "^1.2.1",
"grunt-express-server": "^0.5.1",
From 08831de1022aecbe07c24082fa51a19f49aae226 Mon Sep 17 00:00:00 2001
From: Andrew Koroluk
Date: Sat, 31 Oct 2015 13:56:02 -0400
Subject: [PATCH 0083/1129] feat(): update package.json node & npm. switch
travis.yml to test 4.2.2, allow failures on 5.0.0
---
.travis.yml | 5 ++---
app/templates/.travis.yml | 5 ++---
app/templates/_package.json | 3 ++-
package.json | 4 ++--
4 files changed, 8 insertions(+), 9 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index 1ce49d7dc..87857d767 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,8 +1,7 @@
sudo: false
language: node_js
node_js:
- - '0.12'
- - '4.0.0'
+ - 4.2.2
env:
global:
- SAUCE_USERNAME=fullstack_ci
@@ -10,7 +9,7 @@ env:
matrix:
fast_finish: true
allow_failures:
- - node_js: 4.0.0
+ - node_js: 5.0.0
before_install:
- ./scripts/sauce_connect_setup.sh
- gem update --system
diff --git a/app/templates/.travis.yml b/app/templates/.travis.yml
index 95545e08d..c4451b445 100644
--- a/app/templates/.travis.yml
+++ b/app/templates/.travis.yml
@@ -1,11 +1,10 @@
language: node_js
node_js:
- - '0.12'
- - '4.0.0'
+ - 4.2.2
matrix:
fast_finish: true
allow_failures:
- - node_js: 4.0.0
+ - node_js: 5.0.0
before_script:
- npm install -g bower grunt-cli<% if (filters.sass) { %>
- gem install sass<% } %>
diff --git a/app/templates/_package.json b/app/templates/_package.json
index 9304ef869..9db220316 100644
--- a/app/templates/_package.json
+++ b/app/templates/_package.json
@@ -111,7 +111,8 @@
"supertest": "^1.1.0"
},
"engines": {
- "node": ">=0.12.0"
+ "node": "^4.2.2",
+ "npm": "^2.14.7"
},
"scripts": {
"start": "node server",
diff --git a/package.json b/package.json
index caad04a6b..9bb8767ca 100644
--- a/package.json
+++ b/package.json
@@ -62,8 +62,8 @@
"yeoman-assert": "^2.0.0"
},
"engines": {
- "node": ">=0.12.0",
- "npm": ">=1.2.10"
+ "node": "^4.2.2",
+ "npm": "^2.14.7"
},
"license": "BSD-2-Clause"
}
From eaed80fc358ea23ad1159d924f10806abccfa14d Mon Sep 17 00:00:00 2001
From: Andrew Koroluk
Date: Tue, 3 Nov 2015 15:43:34 -0500
Subject: [PATCH 0084/1129] fix(tests): use `npm run-script update-webdriver`
instead of `npm run update-webdriver`
---
Gruntfile.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Gruntfile.js b/Gruntfile.js
index 64e407a11..3b9964182 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -292,8 +292,8 @@ module.exports = function (grunt) {
child_process.exec('bower install', {cwd: '../fixtures'}, function (error, stdout, stderr) {
if(!process.env.SAUCE_USERNAME) {
- grunt.log.ok('running npm run update-webdriver');
- child_process.exec('npm run update-webdriver', function() {
+ grunt.log.ok('running npm run-script update-webdriver');
+ child_process.exec('npm run-script update-webdriver', function() {
shell.cd('../../');
done();
});
From 3c1bff7daad39a0e204d8626df81149553db6d09 Mon Sep 17 00:00:00 2001
From: Andrew Koroluk
Date: Thu, 19 Nov 2015 21:09:53 -0500
Subject: [PATCH 0085/1129] chore(npm): use protractor 3.0.0
use *my* version of grunt-protractor-runner
---
app/templates/_package.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/templates/_package.json b/app/templates/_package.json
index 9db220316..6193ef373 100644
--- a/app/templates/_package.json
+++ b/app/templates/_package.json
@@ -66,7 +66,7 @@
"grunt-nodemon": "^0.4.0",
"grunt-angular-templates": "^0.5.4",
"grunt-dom-munger": "^3.4.0",
- "grunt-protractor-runner": "^2.0.0",
+ "grunt-protractor-runner": "https://github.com/StoutLLC/grunt-protractor-runner",
"grunt-injector": "^0.6.0",
"grunt-karma": "~0.12.0",
"grunt-build-control": "^0.6.0",<% if(filters.sass) { %>
From a0920af0c087b97842e919d3b0a4b67e205223c0 Mon Sep 17 00:00:00 2001
From: Andrew Koroluk
Date: Thu, 19 Nov 2015 21:10:10 -0500
Subject: [PATCH 0086/1129] fix(e2e): properly use some promises in e2e tests
---
app/templates/e2e/account(auth)/login/login.po.js | 2 +-
app/templates/e2e/account(auth)/login/login.spec(mocha).js | 3 ++-
app/templates/e2e/account(auth)/logout/logout.spec(mocha).js | 3 ++-
app/templates/e2e/account(auth)/signup/signup.po.js | 2 +-
app/templates/e2e/account(auth)/signup/signup.spec(mocha).js | 3 ++-
app/templates/e2e/main/main.spec(mocha).js | 3 ++-
6 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/app/templates/e2e/account(auth)/login/login.po.js b/app/templates/e2e/account(auth)/login/login.po.js
index 045204754..67005af2d 100644
--- a/app/templates/e2e/account(auth)/login/login.po.js
+++ b/app/templates/e2e/account(auth)/login/login.po.js
@@ -20,7 +20,7 @@ var LoginPage = function() {
}
}
- form.submit.click();
+ return form.submit.click();
};
};
diff --git a/app/templates/e2e/account(auth)/login/login.spec(mocha).js b/app/templates/e2e/account(auth)/login/login.spec(mocha).js
index 1fefea5d0..7316f6314 100644
--- a/app/templates/e2e/account(auth)/login/login.spec(mocha).js
+++ b/app/templates/e2e/account(auth)/login/login.spec(mocha).js
@@ -8,8 +8,9 @@ describe('Login View', function() {
var page;
var loadPage = function() {
- browser.get(config.baseUrl + '/login');
+ let promise = browser.get(config.baseUrl + '/login');
page = require('./login.po');
+ return promise;
};
var testUser = {
diff --git a/app/templates/e2e/account(auth)/logout/logout.spec(mocha).js b/app/templates/e2e/account(auth)/logout/logout.spec(mocha).js
index 0006306e0..7138149ac 100644
--- a/app/templates/e2e/account(auth)/logout/logout.spec(mocha).js
+++ b/app/templates/e2e/account(auth)/logout/logout.spec(mocha).js
@@ -6,8 +6,9 @@ var UserModel = require(config.serverConfig.root + '/server/sqldb').User;<% } %>
describe('Logout View', function() {
var login = function(user) {
- browser.get(config.baseUrl + '/login');
+ let promise = browser.get(config.baseUrl + '/login');
require('../login/login.po').login(user);
+ return promise;
};
var testUser = {
diff --git a/app/templates/e2e/account(auth)/signup/signup.po.js b/app/templates/e2e/account(auth)/signup/signup.po.js
index 3a812266c..39108177c 100644
--- a/app/templates/e2e/account(auth)/signup/signup.po.js
+++ b/app/templates/e2e/account(auth)/signup/signup.po.js
@@ -22,7 +22,7 @@ var SignupPage = function() {
}
}
- form.submit.click();
+ return form.submit.click();
};
};
diff --git a/app/templates/e2e/account(auth)/signup/signup.spec(mocha).js b/app/templates/e2e/account(auth)/signup/signup.spec(mocha).js
index 7578d2796..a45fdb3c3 100644
--- a/app/templates/e2e/account(auth)/signup/signup.spec(mocha).js
+++ b/app/templates/e2e/account(auth)/signup/signup.spec(mocha).js
@@ -9,8 +9,9 @@ describe('Signup View', function() {
var loadPage = function() {
browser.manage().deleteAllCookies()
- browser.get(config.baseUrl + '/signup');
+ let promise = browser.get(config.baseUrl + '/signup');
page = require('./signup.po');
+ return promise;
};
var testUser = {
diff --git a/app/templates/e2e/main/main.spec(mocha).js b/app/templates/e2e/main/main.spec(mocha).js
index d497443cd..798b58c41 100644
--- a/app/templates/e2e/main/main.spec(mocha).js
+++ b/app/templates/e2e/main/main.spec(mocha).js
@@ -6,8 +6,9 @@ describe('Main View', function() {
var page;
beforeEach(function() {
- browser.get(config.baseUrl + '/');
+ let promise = browser.get(config.baseUrl + '/');
page = require('./main.po');
+ return promise;
});
it('should include jumbotron with correct data', function() {
From 3ae64d7f1fbeb0db4ba140e567c6670db80a57fe Mon Sep 17 00:00:00 2001
From: Andrew Koroluk
Date: Thu, 19 Nov 2015 21:32:16 -0500
Subject: [PATCH 0087/1129] fix(jscs): exclude generated 'app.constant.js'
---
app/templates/.jscsrc | 3 +++
1 file changed, 3 insertions(+)
diff --git a/app/templates/.jscsrc b/app/templates/.jscsrc
index 76b4a9aaa..8923ad53e 100644
--- a/app/templates/.jscsrc
+++ b/app/templates/.jscsrc
@@ -1,4 +1,7 @@
{
+ "excludeFiles": [
+ "client/app/app.constant.js"
+ ],
"esnext": true,
"maximumLineLength": {
"value": 100,
From 898f9213744b3bd6904e3c87aa6d61ba8b7ae3a5 Mon Sep 17 00:00:00 2001
From: Varayut Lerdkanlayanawat
Date: Sat, 28 Nov 2015 23:15:41 +0700
Subject: [PATCH 0088/1129] chore(npm): grunt-contrib-imagemin ^0.9.4 -> 1.0.0
update grunt-contrib-imagemin version to fix the error when using npm
install with Node v4.2.2
Closes #1412
---
app/templates/_package.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/templates/_package.json b/app/templates/_package.json
index 217df92ab..a68e1fd6b 100644
--- a/app/templates/_package.json
+++ b/app/templates/_package.json
@@ -45,7 +45,7 @@
"grunt-contrib-concat": "^0.5.1",
"grunt-contrib-copy": "^0.8.0",
"grunt-contrib-cssmin": "^0.14.0",
- "grunt-contrib-imagemin": "^0.9.4",
+ "grunt-contrib-imagemin": "~1.0.0",
"grunt-contrib-jshint": "~0.11.2",
"grunt-contrib-uglify": "^0.9.1",
"grunt-contrib-watch": "~0.6.1",<% if (filters.jade) { %>
From 586f3ee6e84cb4d737e26e42cf89be85ee04cd42 Mon Sep 17 00:00:00 2001
From: Andrew Koroluk
Date: Thu, 10 Sep 2015 21:40:03 -0400
Subject: [PATCH 0089/1129] chore(gen): remove prerelease note
---
app/generator.js | 7 -------
1 file changed, 7 deletions(-)
diff --git a/app/generator.js b/app/generator.js
index 67a00bfe5..64db0c1a5 100644
--- a/app/generator.js
+++ b/app/generator.js
@@ -38,13 +38,6 @@ export default class Generator extends Base {
},
info: function () {
- this.log(chalk.red(`
-################################################################
-# NOTE: You are using a pre-release version of
-# generator-angular-fullstack. For a more stable version, run
-# \`npm install -g generator-angular-fullstack@^2.0.0\`
-################################################################`));
- this.log('You\'re using the Angular Full-Stack Generator, version ' + this.rootGeneratorVersion());
this.log(this.yoWelcome);
this.log('Out of the box I create an AngularJS app with an Express server.\n');
},
From 426810707772525d4056a4990cbac19f50c7b3e3 Mon Sep 17 00:00:00 2001
From: kingcody
Date: Tue, 8 Sep 2015 21:47:57 -0400
Subject: [PATCH 0090/1129] chore(gen): remove pre-`3.0.0` release code and
docs
[ci skip]
---
Gruntfile.js | 1 -
contributing.md | 10 ++--------
2 files changed, 2 insertions(+), 9 deletions(-)
diff --git a/Gruntfile.js b/Gruntfile.js
index 64e407a11..675c166bb 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -40,7 +40,6 @@ module.exports = function (grunt) {
},
release: {
options: {
- bump: false, // remove after 3.0.0 release
commitMessage: '<%= version %>',
tagName: '<%= version %>',
file: 'package.json',
diff --git a/contributing.md b/contributing.md
index 037a6b78f..bfcd7bb98 100644
--- a/contributing.md
+++ b/contributing.md
@@ -74,15 +74,9 @@ A detailed explanation can be found in this [document][commit-message-format].
# Releasing
*(for contributors with push access)*
-The `grunt release` task will do most of the work for you, see [`grunt-release`](https://github.com/geddski/grunt-release) for semver usage.
+The `grunt release` task will do most of the work for you, see [`grunt-release`](https://github.com/geddski/grunt-release#using-grunt-release) for valid release targets.
-* Manually bump `package.json` version.
-
-*note: this step will be removed once `3.0.0` is released*
-
-* Run the release task `grunt release`.
-
-*note: once `3.0.0` is released you will need to use a valid `grunt-release` target, see [here](https://github.com/geddski/grunt-release#using-grunt-release)*
+* Run the release task `grunt release:RELEASE_TARGET`.
* Push and publish the `angular-fullstack-deps` submodule.
```bash
From 33cb0496d952b5cdcb8f7059644633e8dc6d999c Mon Sep 17 00:00:00 2001
From: Andrew Koroluk
Date: Wed, 2 Dec 2015 10:45:20 -0500
Subject: [PATCH 0091/1129] docs(changelog): 3.0.0
---
CHANGELOG.md | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0b47eb6f1..20e4aed18 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,25 @@
+
+# [3.0.0](https://github.com/DaftMonk/generator-angular-fullstack/compare/2.1.1...3.0.0) (2015-12-06)
+
+# 3.0.0
+
+### New Features
+
+ * **Sequelize** - You can now choose between MongoDB + Mongoose or SQLite3 + Sequelize
+ * **Babel** - We now include Babel transpiler support, with plans to add TypeScript in the future
+ * **Lusca** - Lusca Security Middleware is included by default
+ * **Angular Modules** - A few components of the front-end have been broken out into their own Angular modules, such as `auth`, `admin`, and a new `util` module
+ * **Modern Angular Best-Practices** - We have moved a lot of the code to take advantage of the `controllerAs` syntax, as well as ES6/ES7 Classes
+ * Mongoose Bluebird Promises
+
+### Breaking Changes
+
+ * **Node >= 4.2.2** - We now support versions of Node 4.2.2 and up. Since this is a generator for scaffolding out a new project, it makes sense to move support to the 4.2.2 Long Term Support (LTS) version of Node, since it is the most supported release by Node. It is likely that the generator will work with earlier versions of Node, but it is not recommended.
+ * **~~CoffeeScript~~, ~~Vanilla JS~~** - Removed CoffeeScript and vanilla JS support. CoffeeScript has served its purpose and been replaced by much better transpilers. Vanilla JS doesn't provide a lot of the features that enable good, modern code. We now only support Babel 5.8.x, and plan to add TypeScript support in the future.
+ * Removed some backwards-compatibility support code
+
+To see the full list of changes, click the '3.0.0' title to view the GitHub compare between 3.0.0 and 2.1.1
+
## [2.1.1](https://github.com/DaftMonk/generator-angular-fullstack/compare/2.1.0...2.1.1) (2015-07-29)
From 40d1d55a895773664e60b63b97deee794015f560 Mon Sep 17 00:00:00 2001
From: Andrew Koroluk
Date: Tue, 1 Dec 2015 12:10:45 -0500
Subject: [PATCH 0092/1129] chore(npm): bump some out-of-date gen and template
dependencies
---
app/templates/_package.json | 16 ++++++++--------
package.json | 6 +++---
2 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/app/templates/_package.json b/app/templates/_package.json
index 8c3af0cd8..335ad9df4 100644
--- a/app/templates/_package.json
+++ b/app/templates/_package.json
@@ -21,7 +21,7 @@
"bluebird": "^2.9.34",
"connect-mongo": "^0.8.1",<% } %><% if (filters.sequelize) { %>
"sequelize": "^3.5.1",
- "sqlite3": "~3.1.0",
+ "sqlite3": "~3.1.1",
"express-sequelize-session": "0.4.0",<% } %><% if (filters.auth) { %>
"jsonwebtoken": "^5.0.0",
"express-jwt": "^3.0.0",
@@ -41,13 +41,13 @@
"grunt": "~0.4.5",
"grunt-wiredep": "^2.0.0",
"grunt-concurrent": "^2.0.1",
- "grunt-contrib-clean": "^0.6.0",
+ "grunt-contrib-clean": "~0.7.0",
"grunt-contrib-concat": "^0.5.1",
"grunt-contrib-copy": "^0.8.0",
- "grunt-contrib-cssmin": "^0.14.0",
+ "grunt-contrib-cssmin": "~0.14.0",
"grunt-contrib-imagemin": "~1.0.0",
"grunt-contrib-jshint": "~0.11.2",
- "grunt-contrib-uglify": "^0.9.1",
+ "grunt-contrib-uglify": "~0.11.0",
"grunt-contrib-watch": "~0.6.1",<% if (filters.jade) { %>
"grunt-contrib-jade": "^0.15.0",
"karma-ng-jade2js-preprocessor": "^0.2.0",<% } %><% if (filters.less) { %>
@@ -75,15 +75,15 @@
"jit-grunt": "^0.9.1",
"time-grunt": "^1.2.1",
"grunt-express-server": "^0.5.1",
- "grunt-postcss": "^0.6.0",
+ "grunt-postcss": "~0.7.1",
"grunt-open": "~0.2.3",
"open": "~0.0.4",
- "jshint-stylish": "~2.0.1",
+ "jshint-stylish": "~2.1.0",
"connect-livereload": "^0.5.3",
"mocha": "^2.2.5",
"grunt-mocha-test": "~0.12.7",
"grunt-mocha-istanbul": "^3.0.1",
- "istanbul": "^0.3.17",
+ "istanbul": "~0.4.1",
"chai": "^3.2.0",
"sinon": "^1.16.1",
"chai-as-promised": "^5.1.0",
@@ -105,7 +105,7 @@
"phantomjs": "^1.9.18",
"karma-phantomjs-launcher": "~0.2.0",
"karma": "~0.13.3",
- "karma-ng-html2js-preprocessor": "~0.1.2",
+ "karma-ng-html2js-preprocessor": "~0.2.0",
"karma-spec-reporter": "~0.0.20",
"proxyquire": "^1.0.1",
"supertest": "^1.1.0"
diff --git a/package.json b/package.json
index caad04a6b..3453adaad 100644
--- a/package.json
+++ b/package.json
@@ -37,7 +37,7 @@
"babel-core": "^5.8.23",
"chalk": "^1.1.0",
"generator-ng-component": "~0.1.1",
- "glob": "^5.0.14",
+ "glob": "^6.0.1",
"lodash": "^3.10.1",
"underscore.string": "^3.1.1",
"yeoman-generator": "~0.20.3",
@@ -47,10 +47,10 @@
"chai": "^3.2.0",
"grunt": "~0.4.1",
"grunt-build-control": "^0.6.0",
- "grunt-contrib-clean": "^0.6.0",
+ "grunt-contrib-clean": "^0.7.0",
"grunt-contrib-jshint": "^0.11.2",
"grunt-conventional-changelog": "^4.1.0",
- "grunt-david": "~0.5.0",
+ "grunt-david": "~0.7.0",
"grunt-env": "^0.4.1",
"grunt-mocha-test": "^0.12.7",
"grunt-release": "^0.13.0",
From 519fd36309cd5bfcd831d14e7af9da0149fab903 Mon Sep 17 00:00:00 2001
From: Andrew Koroluk
Date: Wed, 14 Oct 2015 14:49:23 -0400
Subject: [PATCH 0093/1129] feat(): add optional es7.classProperties
transformer to Babel
---
app/templates/Gruntfile.js | 5 ++++-
app/templates/karma.conf.js | 5 ++++-
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/app/templates/Gruntfile.js b/app/templates/Gruntfile.js
index 1c3ad2bfc..aa62e5c13 100644
--- a/app/templates/Gruntfile.js
+++ b/app/templates/Gruntfile.js
@@ -589,7 +589,10 @@ module.exports = function (grunt) {
// Compiles ES6 to JavaScript using Babel
babel: {
options: {
- sourceMap: true
+ sourceMap: true,
+ optional: [
+ 'es7.classProperties'
+ ]
},<% if(filters.babel) { %>
client: {
files: [{
diff --git a/app/templates/karma.conf.js b/app/templates/karma.conf.js
index f85a28f71..771749d4b 100644
--- a/app/templates/karma.conf.js
+++ b/app/templates/karma.conf.js
@@ -43,7 +43,10 @@ module.exports = function(config) {
babelPreprocessor: {
options: {
- sourceMap: 'inline'
+ sourceMap: 'inline',
+ optional: [
+ 'es7.classProperties'
+ ]
},
filename: function (file) {
return file.originalPath.replace(/\.js$/, '.es5.js');
From 326c69b57c665b0e0e1e6cfe28d59a1eb6de1df6 Mon Sep 17 00:00:00 2001
From: Andrew Koroluk
Date: Wed, 14 Oct 2015 18:13:20 -0400
Subject: [PATCH 0094/1129] refactor(client:account): use controller as and
classes
---
.../client/app/account(auth)/account.js | 18 +++--
.../app/account(auth)/login/login(html).html | 12 +--
.../app/account(auth)/login/login(jade).jade | 10 +--
.../account(auth)/login/login.controller.js | 50 +++++++-----
.../settings/settings(html).html | 18 ++---
.../settings/settings(jade).jade | 18 ++---
.../settings/settings.controller.js | 44 ++++++-----
.../account(auth)/signup/signup(html).html | 42 +++++-----
.../account(auth)/signup/signup(jade).jade | 43 +++++-----
.../account(auth)/signup/signup.controller.js | 78 ++++++++++---------
.../e2e/account(auth)/login/login.po.js | 4 +-
.../e2e/account(auth)/signup/signup.po.js | 8 +-
12 files changed, 188 insertions(+), 157 deletions(-)
diff --git a/app/templates/client/app/account(auth)/account.js b/app/templates/client/app/account(auth)/account.js
index d60fd72fe..4266116fa 100644
--- a/app/templates/client/app/account(auth)/account.js
+++ b/app/templates/client/app/account(auth)/account.js
@@ -5,7 +5,8 @@ angular.module('<%= scriptAppName %>')
$routeProvider
.when('/login', {
templateUrl: 'app/account/login/login.html',
- controller: 'LoginCtrl'
+ controller: 'LoginController',
+ controllerAs: 'vm'
})
.when('/logout', {
name: 'logout',
@@ -21,11 +22,13 @@ angular.module('<%= scriptAppName %>')
})
.when('/signup', {
templateUrl: 'app/account/signup/signup.html',
- controller: 'SignupCtrl'
+ controller: 'SignupController',
+ controllerAs: 'vm'
})
.when('/settings', {
templateUrl: 'app/account/settings/settings.html',
- controller: 'SettingsCtrl',
+ controller: 'SettingsController',
+ controllerAs: 'vm',
authenticate: true
});
})
@@ -40,7 +43,8 @@ angular.module('<%= scriptAppName %>')
.state('login', {
url: '/login',
templateUrl: 'app/account/login/login.html',
- controller: 'LoginCtrl'
+ controller: 'LoginController',
+ controllerAs: 'vm'
})
.state('logout', {
url: '/logout?referrer',
@@ -57,12 +61,14 @@ angular.module('<%= scriptAppName %>')
.state('signup', {
url: '/signup',
templateUrl: 'app/account/signup/signup.html',
- controller: 'SignupCtrl'
+ controller: 'SignupController',
+ controllerAs: 'vm'
})
.state('settings', {
url: '/settings',
templateUrl: 'app/account/settings/settings.html',
- controller: 'SettingsCtrl',
+ controller: 'SettingsController',
+ controllerAs: 'vm',
authenticate: true
});
})
diff --git a/app/templates/client/app/account(auth)/login/login(html).html b/app/templates/client/app/account(auth)/login/login(html).html
index ab1346ba6..a01d29342 100644
--- a/app/templates/client/app/account(auth)/login/login(html).html
+++ b/app/templates/client/app/account(auth)/login/login(html).html
@@ -8,29 +8,29 @@ Login
Admin account is admin@example.com / admin