From 474a3a16d32c33344efcdde147899c6e17cd15f8 Mon Sep 17 00:00:00 2001 From: David Rodriguez Date: Fri, 25 Mar 2016 13:05:10 -0400 Subject: [PATCH 001/885] fix(user): fix email and password validation If no email and password were passed to the authentication endpoints, the authentication would still succeed even though there was no email and password. This fixes that to make sure that we account for blank and null email and passwords. Also it makes sure that email and password are not required when using other oauth providers. --- app/templates/gulpfile.babel(gulp).js | 4 +- .../user(auth)/user.model(mongooseModels).js | 34 ++++- .../user.model.spec(mongooseModels).js | 135 ++++++++++++++++-- 3 files changed, 151 insertions(+), 22 deletions(-) diff --git a/app/templates/gulpfile.babel(gulp).js b/app/templates/gulpfile.babel(gulp).js index 4edb6adbd..8b5001ac9 100644 --- a/app/templates/gulpfile.babel(gulp).js +++ b/app/templates/gulpfile.babel(gulp).js @@ -486,7 +486,7 @@ gulp.task('wiredep:client', () => { /bootstrap\.css/<% if(filters.sass) { %>, /bootstrap-sass-official/<% } if(filters.oauth) { %>, /bootstrap-social\.css/<% }}} %> - ] + ], ignorePath: clientPath })) .pipe(gulp.dest(`${clientPath}/`)); @@ -503,7 +503,7 @@ gulp.task('wiredep:test', () => { /bootstrap\.css/<% if(filters.sass) { %>, /bootstrap-sass-official/<% } if(filters.oauth) { %>, /bootstrap-social\.css/<% }}} %> - ] + ], devDependencies: true })) .pipe(gulp.dest('./')); 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 04683efb2..d11f5d4d1 100644 --- a/app/templates/server/api/user(auth)/user.model(mongooseModels).js +++ b/app/templates/server/api/user(auth)/user.model(mongooseModels).js @@ -11,13 +11,29 @@ var UserSchema = new Schema({ name: String, email: { type: String, - lowercase: true + lowercase: true, + required: <% if(filters.oauth) { %>function() { + if (authTypes.indexOf(this.provider) === -1) { + return true; + } else { + return false; + } + }<% } else { %>true<% } %> }, role: { type: String, default: 'user' }, - password: String, + password: { + type: String, + required: <% if(filters.oauth) { %>function() { + if (authTypes.indexOf(this.provider) === -1) { + return true; + } else { + return false; + } + }<% } else { %>true<% } %> + }, provider: String, salt: String<% if (filters.oauth) { %>,<% if (filters.facebookAuth) { %> facebook: {},<% } %><% if (filters.twitterAuth) { %> @@ -108,8 +124,12 @@ UserSchema return next(); } - if (!validatePresenceOf(this.password)<% if (filters.oauth) { %> && authTypes.indexOf(this.provider) === -1<% } %>) { - return next(new Error('Invalid password')); + if (!validatePresenceOf(this.password)) { + <% if (filters.oauth) { %>if (authTypes.indexOf(this.provider) === -1) { + <% } %>return next(new Error('Invalid password'));<% if (filters.oauth) { %> + } else { + return next(); + }<% } %> } // Make salt with a callback @@ -203,7 +223,11 @@ UserSchema.methods = { */ encryptPassword(password, callback) { if (!password || !this.salt) { - return null; + if (!callback) { + return null; + } else { + return callback('Missing password or salt'); + } } var defaultIterations = 10000; 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 f67b01520..b8528cb48 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 @@ -41,32 +41,137 @@ describe('User Model', function() { }); describe('#email', function() { - it('should fail when saving without an email', function() { + it('should fail when saving with a blank email', function() { user.email = ''; return <%= expect() %>user.save()<%= to() %>.be.rejected; }); + + it('should fail when saving without an email', function() { + user.email = null; + return <%= expect() %>user.save()<%= to() %>.be.rejected; + });<% if (filters.oauth && filters.googleAuth) { %> + + context('given user provider is google', function() { + beforeEach(function() { + user.provider = 'google'; + }); + + it('should succeed when saving without an email', function() { + user.email = null; + return <%= expect() %>user.save()<%= to() %>.be.fulfilled; + }); + });<% } %><% if (filters.oauth && filters.facebookAuth) { %> + + context('given user provider is facebook', function() { + beforeEach(function() { + user.provider = 'facebook'; + }); + + it('should succeed when saving without an email', function() { + user.email = null; + return <%= expect() %>user.save()<%= to() %>.be.fulfilled; + }); + });<% } %><% if (filters.oauth && filters.twitterAuth) { %> + + context('given user provider is twitter', function() { + beforeEach(function() { + user.provider = 'twitter'; + }); + + it('should succeed when saving without an email', function() { + user.email = null; + return <%= expect() %>user.save()<%= to() %>.be.fulfilled; + }); + });<% } %><% if (filters.oauth) { %> + + context('given user provider is github', function() { + beforeEach(function() { + user.provider = 'github'; + }); + + it('should succeed when saving without an email', function() { + user.email = null; + return <%= expect() %>user.save()<%= to() %>.be.fulfilled; + }); + });<% } %> }); describe('#password', function() { - beforeEach(function() { - return user.save(); + it('should fail when saving with a blank password', function() { + user.password = ''; + return <%= expect() %>user.save()<%= to() %>.be.rejected; }); - it('should authenticate user if valid', function() { - <%= expect() %>user.authenticate('password')<%= to() %>.be.true; + it('should fail when saving without a password', function() { + user.password = null; + return <%= expect() %>user.save()<%= to() %>.be.rejected; }); - it('should not authenticate user if invalid', function() { - <%= expect() %>user.authenticate('blah')<%= to() %>.not.be.true; - }); + context('given the user has been previously saved', function() { + beforeEach(function() { + return user.save(); + }); - it('should remain the same hash unless the password is updated', function() { - user.name = 'Test User'; - return <%= expect() %>user.save() - .then(function(u) { - return u.authenticate('password'); - })<%= to() %>.eventually.be.true; - }); + it('should authenticate user if valid', function() { + <%= expect() %>user.authenticate('password')<%= to() %>.be.true; + }); + + it('should not authenticate user if invalid', function() { + <%= expect() %>user.authenticate('blah')<%= to() %>.not.be.true; + }); + + it('should remain the same hash unless the password is updated', function() { + user.name = 'Test User'; + return <%= expect() %>user.save() + .then(function(u) { + return u.authenticate('password'); + })<%= to() %>.eventually.be.true; + }); + });<% if (filters.oauth && filters.googleAuth) { %> + + context('given user provider is google', function() { + beforeEach(function() { + user.provider = 'google'; + }); + + it('should succeed when saving without a password', function() { + user.password = null; + return <%= expect() %>user.save()<%= to() %>.be.fulfilled; + }); + });<% } %><% if (filters.oauth && filters.facebookAuth) { %> + + context('given user provider is facebook', function() { + beforeEach(function() { + user.provider = 'facebook'; + }); + + it('should succeed when saving without a password', function() { + user.password = null; + return <%= expect() %>user.save()<%= to() %>.be.fulfilled; + }); + });<% } %><% if (filters.oauth && filters.twitterAuth) { %> + + context('given user provider is twitter', function() { + beforeEach(function() { + user.provider = 'twitter'; + }); + + it('should succeed when saving without a password', function() { + user.password = null; + return <%= expect() %>user.save()<%= to() %>.be.fulfilled; + }); + });<% } %><% if (filters.oauth) { %> + + context('given user provider is github', function() { + beforeEach(function() { + user.provider = 'github'; + }); + + it('should succeed when saving without a password', function() { + user.password = null; + return <%= expect() %>user.save()<%= to() %>.be.fulfilled; + }); + });<% } %> }); }); From d9982d45b25a004cd101907a16149b17907d1f43 Mon Sep 17 00:00:00 2001 From: David Rodriguez Date: Fri, 25 Mar 2016 14:00:05 -0400 Subject: [PATCH 002/885] test(user): check for undefined email and password --- .../user(auth)/user.model.spec(mongooseModels).js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) 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 b8528cb48..2e9f24eed 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 @@ -46,9 +46,14 @@ describe('User Model', function() { return <%= expect() %>user.save()<%= to() %>.be.rejected; }); - it('should fail when saving without an email', function() { + it('should fail when saving with a null email', function() { user.email = null; return <%= expect() %>user.save()<%= to() %>.be.rejected; + }); + + it('should fail when saving without an email', function() { + user.email = undefined; + return <%= expect() %>user.save()<%= to() %>.be.rejected; });<% if (filters.oauth && filters.googleAuth) { %> context('given user provider is google', function() { @@ -102,11 +107,16 @@ describe('User Model', function() { return <%= expect() %>user.save()<%= to() %>.be.rejected; }); - it('should fail when saving without a password', function() { + it('should fail when saving with a null password', function() { user.password = null; return <%= expect() %>user.save()<%= to() %>.be.rejected; }); + it('should fail when saving without a password', function() { + user.password = undefined; + return <%= expect() %>user.save()<%= to() %>.be.rejected; + }); + context('given the user has been previously saved', function() { beforeEach(function() { return user.save(); From 571666037a6fae4226ef83f16ad5e78bd2d67f93 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Mon, 28 Mar 2016 16:41:14 -0400 Subject: [PATCH 003/885] fix(server:user:spec): replace `context` with `describe` Jasmine doesn't have `context()` --- .../user.model.spec(mongooseModels).js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) 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 2e9f24eed..5fe8de3c5 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 @@ -56,7 +56,7 @@ describe('User Model', function() { return <%= expect() %>user.save()<%= to() %>.be.rejected; });<% if (filters.oauth && filters.googleAuth) { %> - context('given user provider is google', function() { + describe('given user provider is google', function() { beforeEach(function() { user.provider = 'google'; }); @@ -67,7 +67,7 @@ describe('User Model', function() { }); });<% } %><% if (filters.oauth && filters.facebookAuth) { %> - context('given user provider is facebook', function() { + describe('given user provider is facebook', function() { beforeEach(function() { user.provider = 'facebook'; }); @@ -78,7 +78,7 @@ describe('User Model', function() { }); });<% } %><% if (filters.oauth && filters.twitterAuth) { %> - context('given user provider is twitter', function() { + describe('given user provider is twitter', function() { beforeEach(function() { user.provider = 'twitter'; }); @@ -89,7 +89,7 @@ describe('User Model', function() { }); });<% } %><% if (filters.oauth) { %> - context('given user provider is github', function() { + describe('given user provider is github', function() { beforeEach(function() { user.provider = 'github'; }); @@ -117,7 +117,7 @@ describe('User Model', function() { return <%= expect() %>user.save()<%= to() %>.be.rejected; }); - context('given the user has been previously saved', function() { + describe('given the user has been previously saved', function() { beforeEach(function() { return user.save(); }); @@ -139,7 +139,7 @@ describe('User Model', function() { }); });<% if (filters.oauth && filters.googleAuth) { %> - context('given user provider is google', function() { + describe('given user provider is google', function() { beforeEach(function() { user.provider = 'google'; }); @@ -150,7 +150,7 @@ describe('User Model', function() { }); });<% } %><% if (filters.oauth && filters.facebookAuth) { %> - context('given user provider is facebook', function() { + describe('given user provider is facebook', function() { beforeEach(function() { user.provider = 'facebook'; }); @@ -161,7 +161,7 @@ describe('User Model', function() { }); });<% } %><% if (filters.oauth && filters.twitterAuth) { %> - context('given user provider is twitter', function() { + describe('given user provider is twitter', function() { beforeEach(function() { user.provider = 'twitter'; }); @@ -172,7 +172,7 @@ describe('User Model', function() { }); });<% } %><% if (filters.oauth) { %> - context('given user provider is github', function() { + describe('given user provider is github', function() { beforeEach(function() { user.provider = 'github'; }); From f62032c38a32d52763e0d7304aeb4c2bc0ef12ca Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Sun, 17 Apr 2016 17:39:28 -0400 Subject: [PATCH 004/885] docs(contributing): add bullet about easy label --- contributing.md | 1 + 1 file changed, 1 insertion(+) diff --git a/contributing.md b/contributing.md index bfcd7bb98..f81e01a39 100644 --- a/contributing.md +++ b/contributing.md @@ -9,6 +9,7 @@ Additionally for this generator: * When submitting a PR, make sure that the commit messages match the [AngularJS conventions][commit-message-format] (see below). * When submitting a bugfix, write a test that exposes the bug and fails before applying your fix. Submit the test alongside the fix. * When submitting a new feature, add tests that cover the feature. +* Open Issues marked with the [EASY](https://github.com/angular-fullstack/generator-angular-fullstack/issues?q=is%3Aopen+is%3Aissue+label%3AEasy) label are believed to be easy changes, and would be good Issues to tackle for new contributors. To run the generator: 1. Clone it and `cd` to its root From 8af09b705c1455d6e5819bfb07c7444a7bf541fc Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Sun, 17 Apr 2016 17:40:04 -0400 Subject: [PATCH 005/885] docs(contributing): fix NPM -> npm --- contributing.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contributing.md b/contributing.md index f81e01a39..221b0380e 100644 --- a/contributing.md +++ b/contributing.md @@ -14,8 +14,8 @@ Additionally for this generator: To run the generator: 1. Clone it and `cd` to its root 2. `npm install` -3. `npm link` (tells NPM to look to your own version) -4. `yo angular-fullstack` as normal. It should run from your cloned version rather than the one downloaded from NPM. +3. `npm link` (tells npm to look to your own version) +4. `yo angular-fullstack` as normal. It should run from your cloned version rather than the one downloaded from npm. ## Git Commit Guidelines From f6eb26da714e0b90106a3bf0bba97e022b5d69db Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Sun, 17 Apr 2016 19:07:53 -0400 Subject: [PATCH 006/885] feat(gulp): add serve:debug, add gulp-node-inspector --- app/templates/_package.json | 1 + app/templates/gulpfile.babel(gulp).js | 29 ++++++++++++++++++++++++--- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/app/templates/_package.json b/app/templates/_package.json index f86162e15..8c8e20138 100644 --- a/app/templates/_package.json +++ b/app/templates/_package.json @@ -68,6 +68,7 @@ "gulp-mocha": "^2.1.3", "gulp-ng-annotate": "^2.0.0", "gulp-ng-constant": "^1.1.0", + "gulp-node-inspector": "^0.1.0", "gulp-plumber": "^1.0.1", "gulp-protractor": "^2.1.0", "gulp-rename": "^1.2.2", diff --git a/app/templates/gulpfile.babel(gulp).js b/app/templates/gulpfile.babel(gulp).js index 8b5001ac9..daa462d11 100644 --- a/app/templates/gulpfile.babel(gulp).js +++ b/app/templates/gulpfile.babel(gulp).js @@ -375,6 +375,13 @@ gulp.task('start:client', cb => { }); }); +gulp.task('start:server', () => { + process.env.NODE_ENV = process.env.NODE_ENV || 'development'; + config = require(`./${serverPath}/config/environment`); + nodemon(`-w ${serverPath} ${serverPath}`) + .on('log', onServerLog); +}); + gulp.task('start:server:prod', () => { process.env.NODE_ENV = process.env.NODE_ENV || 'production'; config = require(`./${paths.dist}/${serverPath}/config/environment`); @@ -382,10 +389,15 @@ gulp.task('start:server:prod', () => { .on('log', onServerLog); }); -gulp.task('start:server', () => { +gulp.task('start:inspector', () => { + gulp.src([]) + .pipe(plugins.nodeInspector()); +}); + +gulp.task('start:server:debug', () => { process.env.NODE_ENV = process.env.NODE_ENV || 'development'; - config = require(`./${serverPath}/config/environment`); - nodemon(`-w ${serverPath} ${serverPath}`) + config = require(`./${serverPath}/config/environment`); + nodemon(`-w ${serverPath} --debug-brk ${serverPath}`) .on('log', onServerLog); }); @@ -443,6 +455,17 @@ gulp.task('serve:dist', cb => { cb); }); +gulp.task('serve:debug', cb => { + runSequence(['clean:tmp', 'constant'<% if(filters.ts) { %>, 'tsd'<% } %>], + ['lint:scripts', 'inject'<% if(filters.jade) { %>, 'jade'<% } %>], + ['wiredep:client'], + ['transpile:client', 'styles'], + 'start:inspector', + ['start:server:debug', 'start:client'], + 'watch', + cb); +}); + gulp.task('test', cb => { return runSequence('test:server', 'test:client', cb); }); From f339eff02d989adc8d93246dc8c27bdcb6b9e81c Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Sun, 17 Apr 2016 19:09:39 -0400 Subject: [PATCH 007/885] chore(grunt): bump Grunt to ^1.0.1 closes #1775 --- 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 f86162e15..189ace1b1 100644 --- a/app/templates/_package.json +++ b/app/templates/_package.json @@ -94,7 +94,7 @@ "run-sequence": "^1.1.0", "lazypipe": "^0.2.4", "wiredep": "^2.2.2",<% } /*end gulp*/ if(filters.grunt) { %> - "grunt": "~0.4.5", + "grunt": "^1.0.1", "grunt-wiredep": "^2.0.0", "grunt-concurrent": "^2.0.1", "grunt-contrib-clean": "^1.0.0", From c6a396b5c7221bfe89e56d29d707b50bfb10a047 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Sun, 17 Apr 2016 21:10:55 -0400 Subject: [PATCH 008/885] fix(livereload): ignore api routes and specific non-html files closes #1636, #1764 --- app/templates/server/config/express.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/templates/server/config/express.js b/app/templates/server/config/express.js index 009400b5e..eeca74e6e 100644 --- a/app/templates/server/config/express.js +++ b/app/templates/server/config/express.js @@ -80,7 +80,13 @@ export default function(app) { } if ('development' === env) { - app.use(require('connect-livereload')()); + app.use(require('connect-livereload')({ + ignore: [ + /^\/api\/(.*)/, + /\.js(\?.*)?$/, /\.css(\?.*)?$/, /\.svg(\?.*)?$/, /\.ico(\?.*)?$/, /\.woff(\?.*)?$/, + /\.png(\?.*)?$/, /\.jpg(\?.*)?$/, /\.jpeg(\?.*)?$/, /\.gif(\?.*)?$/, /\.pdf(\?.*)?$/ + ] + })); } if ('development' === env || 'test' === env) { From 27531fbec24f0fe5e9c1486b00314972247c5530 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Mon, 18 Apr 2016 10:19:55 -0400 Subject: [PATCH 009/885] fix(gulp:serve): add `env:all` closes #1779 --- app/templates/gulpfile.babel(gulp).js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/templates/gulpfile.babel(gulp).js b/app/templates/gulpfile.babel(gulp).js index 8b5001ac9..3b4a154d6 100644 --- a/app/templates/gulpfile.babel(gulp).js +++ b/app/templates/gulpfile.babel(gulp).js @@ -425,7 +425,7 @@ gulp.task('watch', () => { }); gulp.task('serve', cb => { - runSequence(['clean:tmp', 'constant'<% if(filters.ts) { %>, 'tsd'<% } %>], + runSequence(['clean:tmp', 'constant', 'env:all',<% if(filters.ts) { %>, 'tsd'<% } %>], ['lint:scripts', 'inject'<% if(filters.jade) { %>, 'jade'<% } %>], ['wiredep:client'], ['transpile:client', 'styles'], From d9e67ffb76a2faa42e267394e75043481b9955e6 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Mon, 18 Apr 2016 12:33:35 -0400 Subject: [PATCH 010/885] chore(mongo): connect-mongo -> ^1.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 189ace1b1..5c4b1f049 100644 --- a/app/templates/_package.json +++ b/app/templates/_package.json @@ -20,7 +20,7 @@ "ejs": "^2.3.3",<% } %><% if (filters.mongoose) { %> "mongoose": "^4.1.2", "bluebird": "^3.3.3", - "connect-mongo": "^0.8.1",<% } %><% if (filters.sequelize) { %> + "connect-mongo": "^1.1.0",<% } %><% if (filters.sequelize) { %> "sequelize": "^3.5.1", "sqlite3": "~3.1.1", "express-sequelize-session": "0.4.0",<% } %><% if (filters.auth) { %> From 4577c9ac25f075181a5a28d7acc3b044ce357289 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Tue, 19 Apr 2016 00:54:51 -0400 Subject: [PATCH 011/885] chore(gen:grunt): bump grunt -> ^1.0.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index eb23f59dd..93b83bd10 100644 --- a/package.json +++ b/package.json @@ -49,7 +49,7 @@ }, "devDependencies": { "chai": "^3.2.0", - "grunt": "~0.4.1", + "grunt": "^1.0.1", "grunt-build-control": "^0.6.0", "grunt-contrib-clean": "^1.0.0", "grunt-contrib-jshint": "^1.0.0", From fc62f7e7ca397134e0a0da8c955fd3e45076953e Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Tue, 19 Apr 2016 02:13:25 -0400 Subject: [PATCH 012/885] chore(gen): bump node -> 5.10.1, npm -> 3.8.3 --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 93b83bd10..e812a5087 100644 --- a/package.json +++ b/package.json @@ -67,8 +67,8 @@ "yeoman-test": "^1.1.0" }, "engines": { - "node": "^4.4.0", - "npm": "^2.14.20" + "node": "^5.10.1", + "npm": "^3.8.3" }, "license": "BSD-2-Clause" } From 00a0cf3a3d75cf6e181e895bb2062a7748ac2617 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Tue, 19 Apr 2016 01:23:17 -0400 Subject: [PATCH 013/885] chore(gen): bump recursive-readdir -> ^2.0.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e812a5087..d426adbdd 100644 --- a/package.json +++ b/package.json @@ -61,7 +61,7 @@ "jit-grunt": "~0.10.0", "mocha": "^2.2.5", "q": "^1.0.1", - "recursive-readdir": "^1.2.0", + "recursive-readdir": "^2.0.0", "shelljs": "^0.6.0", "yeoman-assert": "^2.0.0", "yeoman-test": "^1.1.0" From d64cafe162eac426c3f36bafc5848aa2413db513 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Tue, 19 Apr 2016 01:28:20 -0400 Subject: [PATCH 014/885] chore(grunt): grunt-contrib-watch -> ^1.0.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 1b3bfc560..6a68736f1 100644 --- a/app/templates/_package.json +++ b/app/templates/_package.json @@ -105,7 +105,7 @@ "grunt-contrib-imagemin": "^1.0.0", "grunt-contrib-jshint": "^1.0.0", "grunt-contrib-uglify": "^1.0.0", - "grunt-contrib-watch": "~0.6.1",<% if (filters.jade) { %> + "grunt-contrib-watch": "^1.0.0",<% if (filters.jade) { %> "grunt-contrib-jade": "^1.0.0",<% } %><% if (filters.less) { %> "grunt-contrib-less": "^1.2.0",<% } %> "grunt-babel": "~6.0.0",<% if(filters.ts) { %> From ad11e70c0a3d4de638f566ea9734af64691a89f7 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Tue, 19 Apr 2016 00:53:05 -0400 Subject: [PATCH 015/885] chore(grunt): bump grunt-build-control -> 0.7.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 1b3bfc560..5fbb2f065 100644 --- a/app/templates/_package.json +++ b/app/templates/_package.json @@ -127,7 +127,7 @@ "grunt-protractor-runner": "^2.0.0", "grunt-injector": "^0.6.0", "grunt-karma": "~0.12.0", - "grunt-build-control": "^0.6.0",<% if(filters.sass) { %> + "grunt-build-control": "^0.7.0",<% if(filters.sass) { %> "grunt-contrib-sass": "^1.0.0",<% } %><% if(filters.stylus) { %> "grunt-contrib-stylus": "^1.2.0",<% } %> "jit-grunt": "~0.10.0", diff --git a/package.json b/package.json index e812a5087..f4eb0eade 100644 --- a/package.json +++ b/package.json @@ -50,7 +50,7 @@ "devDependencies": { "chai": "^3.2.0", "grunt": "^1.0.1", - "grunt-build-control": "^0.6.0", + "grunt-build-control": "^0.7.0", "grunt-contrib-clean": "^1.0.0", "grunt-contrib-jshint": "^1.0.0", "grunt-conventional-changelog": "^6.1.0", From 99fc9e9004397a1f1fdc5b3b876f0e44222f05a6 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Tue, 19 Apr 2016 20:18:22 -0400 Subject: [PATCH 016/885] chore(gen): bump insight -> ~0.8.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 6967cbb8a..647a5a2a3 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,7 @@ "chalk": "^1.1.0", "generator-ng-component": "~0.2.1", "glob": "^7.0.3", - "insight": "~0.7.0", + "insight": "~0.8.1", "lodash": "^4.6.1", "underscore.string": "^3.1.1", "yeoman-generator": "^0.22.5", From e9f2199b41452099f6882ce3759589e25c97ed2c Mon Sep 17 00:00:00 2001 From: Jasper Yap Date: Tue, 19 Apr 2016 17:51:49 +0800 Subject: [PATCH 017/885] refactor(gen:directive): don't use deprecated generators.Base --- directive/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/directive/index.js b/directive/index.js index 257a4b19a..5ac3c7c0e 100644 --- a/directive/index.js +++ b/directive/index.js @@ -1,7 +1,7 @@ 'use strict'; var yeoman = require('yeoman-generator'); -var Generator = yeoman.generators.Base.extend({ +var Generator = yeoman.Base.extend({ compose: function() { this.composeWith('ng-component:directive', {arguments: this.arguments}, { local: require.resolve('generator-ng-component/directive') }); } From c7dbb3b8e2406055348336df71b7fefd51f25876 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Tue, 19 Apr 2016 20:52:09 -0400 Subject: [PATCH 018/885] refactor(gen:controller): remove deprecated `generators.Base` --- controller/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/controller/index.js b/controller/index.js index 6d8897d61..0c9a53d87 100644 --- a/controller/index.js +++ b/controller/index.js @@ -1,7 +1,7 @@ 'use strict'; var yeoman = require('yeoman-generator'); -var Generator = yeoman.generators.Base.extend({ +var Generator = yeoman.Base.extend({ compose: function() { this.composeWith('ng-component:controller', {arguments: this.arguments}, { local: require.resolve('generator-ng-component/controller') }); } From 876ff56e44b7a2a78db340962ab9a92e36f121bd Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Tue, 19 Apr 2016 20:52:22 -0400 Subject: [PATCH 019/885] refactor(gen:decorator): remove deprecated `generators.Base` --- decorator/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/decorator/index.js b/decorator/index.js index ae8193eb7..578427ae2 100644 --- a/decorator/index.js +++ b/decorator/index.js @@ -1,7 +1,7 @@ 'use strict'; var yeoman = require('yeoman-generator'); -var Generator = yeoman.generators.Base.extend({ +var Generator = yeoman.Base.extend({ compose: function() { this.composeWith('ng-component:decorator', {arguments: this.arguments}, { local: require.resolve('generator-ng-component/decorator') }); } From cca1127e844fe4657689f9d160758b5fa112aec8 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Tue, 19 Apr 2016 20:53:03 -0400 Subject: [PATCH 020/885] refactor(gen:filter): remove deprecated `generators.Base` --- filter/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/filter/index.js b/filter/index.js index d1119b27d..badbe02a1 100644 --- a/filter/index.js +++ b/filter/index.js @@ -1,7 +1,7 @@ 'use strict'; var yeoman = require('yeoman-generator'); -var Generator = yeoman.generators.Base.extend({ +var Generator = yeoman.Base.extend({ compose: function() { this.composeWith('ng-component:filter', {arguments: this.arguments}, { local: require.resolve('generator-ng-component/filter') }); } From 72070db9628ed4521ffc94da7449aad12166e216 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Tue, 19 Apr 2016 20:53:12 -0400 Subject: [PATCH 021/885] refactor(gen:heroku): remove deprecated `generators.Base` --- heroku/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/heroku/index.js b/heroku/index.js index dd3670473..3ba8bbed8 100644 --- a/heroku/index.js +++ b/heroku/index.js @@ -7,7 +7,7 @@ var path = require('path'); var s = require('underscore.string'); var Generator = module.exports = function Generator() { - yeoman.generators.Base.apply(this, arguments); + yeoman.Base.apply(this, arguments); this.sourceRoot(path.join(__dirname, './templates')); try { @@ -19,7 +19,7 @@ var Generator = module.exports = function Generator() { this.filters = this.config.get('filters') || {}; }; -util.inherits(Generator, yeoman.generators.NamedBase); +util.inherits(Generator, yeoman.NamedBase); Generator.prototype.askForName = function askForName() { var done = this.async(); From de389bafa4ab9ffe53b880c036e3f6246e88f1ec Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Tue, 19 Apr 2016 20:53:22 -0400 Subject: [PATCH 022/885] refactor(gen:openshift): remove deprecated `generators.Base` --- openshift/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openshift/index.js b/openshift/index.js index c0f8f171f..98617d868 100644 --- a/openshift/index.js +++ b/openshift/index.js @@ -9,7 +9,7 @@ var exec = childProcess.exec; var spawn = childProcess.spawn; var Generator = module.exports = function Generator() { - yeoman.generators.Base.apply(this, arguments); + yeoman.Base.apply(this, arguments); this.sourceRoot(path.join(__dirname, './templates')); try { @@ -21,7 +21,7 @@ var Generator = module.exports = function Generator() { this.filters = this.config.get('filters') || {}; }; -util.inherits(Generator, yeoman.generators.NamedBase); +util.inherits(Generator, yeoman.NamedBase); Generator.prototype.askForName = function askForName() { var done = this.async(); From 68eb30b0c010ccf415da7e1efc4fd154ddf49739 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Tue, 19 Apr 2016 20:53:28 -0400 Subject: [PATCH 023/885] refactor(gen:provider): remove deprecated `generators.Base` --- provider/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/provider/index.js b/provider/index.js index 5e3ac882e..8e0213799 100644 --- a/provider/index.js +++ b/provider/index.js @@ -1,7 +1,7 @@ 'use strict'; var yeoman = require('yeoman-generator'); -var Generator = yeoman.generators.Base.extend({ +var Generator = yeoman.Base.extend({ compose: function() { this.composeWith('ng-component:provider', {arguments: this.arguments}, { local: require.resolve('generator-ng-component/provider') }); } From 03b533ba36856efe2eaa108bba696811eb1027b3 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Tue, 19 Apr 2016 20:53:36 -0400 Subject: [PATCH 024/885] refactor(gen:route): remove deprecated `generators.Base` --- route/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/route/index.js b/route/index.js index cc8569854..9f6f1f12d 100644 --- a/route/index.js +++ b/route/index.js @@ -1,7 +1,7 @@ 'use strict'; var yeoman = require('yeoman-generator'); -var Generator = yeoman.generators.Base.extend({ +var Generator = yeoman.Base.extend({ compose: function() { this.composeWith('ng-component:route', {arguments: this.arguments}, { local: require.resolve('generator-ng-component/route') }); } From 1782dc0b609b0da948fd416bc8b8393e67cadbac Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Tue, 19 Apr 2016 20:53:44 -0400 Subject: [PATCH 025/885] refactor(gen:service): remove deprecated `generators.Base` --- service/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/service/index.js b/service/index.js index 9aa5f48b0..7ef1e214a 100644 --- a/service/index.js +++ b/service/index.js @@ -1,7 +1,7 @@ 'use strict'; var yeoman = require('yeoman-generator'); -var Generator = yeoman.generators.Base.extend({ +var Generator = yeoman.Base.extend({ compose: function() { this.composeWith('ng-component:service', {arguments: this.arguments}, { local: require.resolve('generator-ng-component/service') }); } From 954baa49d22ad6d764fbf959078c0a8178ae4ff0 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Tue, 19 Apr 2016 21:18:12 -0400 Subject: [PATCH 026/885] fix(gen:heroku): allow for grunt or gulp --- heroku/index.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/heroku/index.js b/heroku/index.js index dd3670473..45676112e 100644 --- a/heroku/index.js +++ b/heroku/index.js @@ -112,12 +112,13 @@ Generator.prototype.copyProcfile = function copyProcfile() { }); }; -Generator.prototype.gruntBuild = function gruntBuild() { +Generator.prototype.build = function build() { if(this.abort) return; var done = this.async(); + var buildCommand = this.filters.grunt ? 'grunt build' : 'gulp build'; this.log(chalk.bold('\nBuilding dist folder, please wait...')); - var child = exec('grunt build', function (err, stdout) { + var child = exec(buildCommand, function (err, stdout) { done(); }.bind(this)); child.stdout.on('data', function(data) { @@ -187,8 +188,12 @@ Generator.prototype.gitForcePush = function gitForcePush() { this.log(chalk.green('\nYou may need to address the issues mentioned above and restart the server for the app to work correctly.')); } - this.log(chalk.yellow('After app modification run\n\t' + chalk.bold('grunt build') + - '\nThen deploy with\n\t' + chalk.bold('grunt buildcontrol:heroku'))); + this.log(chalk.yellow( + 'After app modification run\n\t' + + chalk.bold(this.filters.grunt ? 'grunt build' : 'gulp build') + + '\nThen deploy with\n\t' + + chalk.bold(this.filters.grunt ? 'grunt buildcontrol:heroku' : 'gulp buildcontrol:heroku') + )); } done(); }.bind(this)); From 2f1a229c527c3052de3eea12e9faa58edd258d53 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Tue, 19 Apr 2016 21:18:21 -0400 Subject: [PATCH 027/885] fix(gen:openshift): allow for grunt or gulp --- openshift/index.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/openshift/index.js b/openshift/index.js index c0f8f171f..e1be427fd 100644 --- a/openshift/index.js +++ b/openshift/index.js @@ -193,12 +193,13 @@ Generator.prototype.enableOpenShiftHotDeploy = function enableOpenshiftHotDeploy }); }; -Generator.prototype.gruntBuild = function gruntBuild() { +Generator.prototype.build = function build() { if(this.abort || !this.openshift_remote_exists ) return; var done = this.async(); + var buildCommand = this.filters.grunt ? 'grunt build' : 'gulp build'; this.log(chalk.bold('\nBuilding dist folder, please wait...')); - var child = exec('grunt build', function (err, stdout) { + var child = exec(buildCommand, function (err, stdout) { if (err) { this.log.error(err); } @@ -294,7 +295,12 @@ Generator.prototype.restartApp = function restartApp() { this.log(chalk.green('\nYou may need to address the issues mentioned above and restart the server for the app to work correctly \n\t' + 'rhc app-restart -a ' + this.deployedName)); } - this.log(chalk.yellow('After app modification run\n\t' + chalk.bold('grunt build') + - '\nThen deploy with\n\t' + chalk.bold('grunt buildcontrol:openshift'))); + + this.log(chalk.yellow( + 'After app modification run\n\t' + + chalk.bold(this.filters.grunt ? 'grunt build' : 'gulp build') + + '\nThen deploy with\n\t' + + chalk.bold(this.filters.grunt ? 'grunt buildcontrol:openshift' : 'gulp buildcontrol:openshift') + )); }.bind(this)); }; From 3221678eb9f9d1599afdf62f5ba60a37f95cc0e3 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Tue, 19 Apr 2016 21:42:48 -0400 Subject: [PATCH 028/885] feat(gulp): port `grunt buildcontrol` tasks over to gulp --- app/templates/_package.json | 2 ++ app/templates/gulpfile.babel(gulp).js | 46 +++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) diff --git a/app/templates/_package.json b/app/templates/_package.json index 8447904a9..6981cba23 100644 --- a/app/templates/_package.json +++ b/app/templates/_package.json @@ -89,6 +89,8 @@ "gulp-scss-lint": "^0.3.9",<% } if(filters.less) { %> "gulp-less": "^3.0.3", "gulp-recess": "^1.1.2",<% } %> + "grunt": "^1.0.1", + "grunt-build-control": "^0.7.0", "isparta": "^4.0.0", "utile": "~0.3.0", "nodemon": "^1.3.7", diff --git a/app/templates/gulpfile.babel(gulp).js b/app/templates/gulpfile.babel(gulp).js index c75c1f0d3..3cb4b2573 100644 --- a/app/templates/gulpfile.babel(gulp).js +++ b/app/templates/gulpfile.babel(gulp).js @@ -4,6 +4,7 @@ import _ from 'lodash'; import del from 'del'; import gulp from 'gulp'; +import grunt from 'grunt'; import path from 'path'; import gulpLoadPlugins from 'gulp-load-plugins'; import http from 'http'; @@ -713,3 +714,48 @@ gulp.task('test:e2e', ['env:all', 'env:test', 'start:server', 'webdriver_update' process.exit(); }); }); + +/******************** + * Grunt ported tasks + ********************/ + +grunt.initConfig({ + buildcontrol: { + options: { + dir: paths.dist, + commit: true, + push: true, + connectCommits: false, + message: 'Built %sourceName% from commit %sourceCommit% on branch %sourceBranch%' + }, + heroku: { + options: { + remote: 'heroku', + branch: 'master' + } + }, + openshift: { + options: { + remote: 'openshift', + branch: 'master' + } + } + } +}); + +grunt.loadNpmTasks('grunt-build-control'); + +gulp.task('buildcontrol:heroku', function(done) { + grunt.tasks( + ['buildcontrol:heroku'], //you can add more grunt tasks in this array + {gruntfile: false}, //don't look for a Gruntfile - there is none. :-) + function() {done();} + ); +}); +gulp.task('buildcontrol:openshift', function(done) { + grunt.tasks( + ['buildcontrol:openshift'], //you can add more grunt tasks in this array + {gruntfile: false}, //don't look for a Gruntfile - there is none. :-) + function() {done();} + ); +}); From 2719f24c2f4579fa7cd80ee73184b30ee076b55a Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Wed, 20 Apr 2016 00:30:37 -0400 Subject: [PATCH 029/885] chore(gulp): bump various deps --- app/templates/_package.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/templates/_package.json b/app/templates/_package.json index 8447904a9..55b4df20b 100644 --- a/app/templates/_package.json +++ b/app/templates/_package.json @@ -47,9 +47,9 @@ "gulp": "^3.9.1", "gulp-add-src": "^0.2.0", "gulp-angular-templatecache": "^1.7.0", - "gulp-autoprefixer": "3.0.0", + "gulp-autoprefixer": "^3.1.0", "gulp-babel": "^6.1.2",<% if(filters.ts) { %> - "gulp-typescript": "~2.12.1", + "gulp-typescript": "~2.13.0", "gulp-tsd": "~0.1.0", "gulp-tslint": "^4.3.0",<% } %> "gulp-cache": "^0.4.2", @@ -57,7 +57,7 @@ "gulp-env": "^0.4.0", "gulp-filter": "^4.0.0", "gulp-imagemin": "^2.2.1", - "gulp-inject": "^3.0.0", + "gulp-inject": "^4.0.0", "gulp-istanbul": "~0.10.3", "gulp-istanbul-enforcer": "^1.0.3", "gulp-jscs": "^3.0.2", @@ -72,7 +72,7 @@ "gulp-plumber": "^1.0.1", "gulp-protractor": "^2.1.0", "gulp-rename": "^1.2.2", - "gulp-rev": "^5.0.0", + "gulp-rev": "^7.0.0", "gulp-rev-replace": "^0.4.2", "gulp-sort": "^2.0.0", "gulp-sourcemaps": "^1.5.2", @@ -85,7 +85,7 @@ "gulp-stylus": "^2.0.4", "gulp-stylint": "^3.0.0", "nib": "^1.1.0",<% } if(filters.sass) { %> - "gulp-sass": "^2.0.1", + "gulp-sass": "^2.2.0", "gulp-scss-lint": "^0.3.9",<% } if(filters.less) { %> "gulp-less": "^3.0.3", "gulp-recess": "^1.1.2",<% } %> From f6e45cd62d60aeebc14fe18eb346ee245c8211ec Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Wed, 20 Apr 2016 00:31:06 -0400 Subject: [PATCH 030/885] chore(grunt): bump a couple deps --- 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 55b4df20b..bfe8c1ca3 100644 --- a/app/templates/_package.json +++ b/app/templates/_package.json @@ -111,7 +111,7 @@ "grunt-babel": "~6.0.0",<% if(filters.ts) { %> "grunt-ts": "^5.3.2", "grunt-tsd": "~0.1.0", - "grunt-tslint": "~3.0.1",<% } %> + "grunt-tslint": "~3.1.0",<% } %> "grunt-google-cdn": "~0.4.0", "grunt-jscs": "^2.1.0", "grunt-newer": "^1.1.1", @@ -136,7 +136,7 @@ "grunt-open": "~0.2.3", "time-grunt": "^1.2.1", "grunt-mocha-test": "~0.12.7", - "grunt-mocha-istanbul": "^3.0.1",<% } /*end grunt*/ %> + "grunt-mocha-istanbul": "^4.0.2",<% } /*end grunt*/ %> "open": "~0.0.4", "jshint-stylish": "~2.1.0", "connect-livereload": "^0.5.3", From eb5e5b64ca538248fc70cc946adaab8023237c49 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Wed, 20 Apr 2016 00:55:26 -0400 Subject: [PATCH 031/885] chore(karma): bump karma-script-launcher --- 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 bfe8c1ca3..d98ed95a5 100644 --- a/app/templates/_package.json +++ b/app/templates/_package.json @@ -148,7 +148,7 @@ "karma": "~0.13.3", "karma-ng-scenario": "~0.1.0", "karma-firefox-launcher": "~0.1.6", - "karma-script-launcher": "~0.1.0", + "karma-script-launcher": "~0.2.0", "karma-chrome-launcher": "~0.2.0", "karma-requirejs": "~0.2.2", "karma-jade-preprocessor": "0.0.11", From 5a9985fdac67428585c545015f2ded4649b208a2 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Wed, 20 Apr 2016 00:56:00 -0400 Subject: [PATCH 032/885] chore(requirejs): 2.2.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 d98ed95a5..0e0917233 100644 --- a/app/templates/_package.json +++ b/app/templates/_package.json @@ -164,7 +164,7 @@ "karma-jasmine": "~0.3.0", "jasmine-spec-reporter": "^2.4.0",<% } if(filters.babel) { %> "karma-babel-preprocessor": "^6.0.1",<% } %> - "requirejs": "~2.1.11", + "requirejs": "~2.2.0", "phantomjs-prebuilt": "^2.1.4", "proxyquire": "^1.0.1", "supertest": "^1.1.0"<% if(filters.ts) { %>, From 5bc1d79957f39d576c066d365f7c6beed448b2e0 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Wed, 20 Apr 2016 01:33:18 -0400 Subject: [PATCH 033/885] chore(gulp): bump lazypipe --- 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 0e0917233..5764fd924 100644 --- a/app/templates/_package.json +++ b/app/templates/_package.json @@ -93,7 +93,7 @@ "utile": "~0.3.0", "nodemon": "^1.3.7", "run-sequence": "^1.1.0", - "lazypipe": "^0.2.4", + "lazypipe": "^1.0.1", "wiredep": "^2.2.2",<% } /*end gulp*/ if(filters.grunt) { %> "grunt": "^1.0.1", "grunt-wiredep": "^2.0.0", From 3e4077671cef320b87f14ef4793a77e2f3236452 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Wed, 20 Apr 2016 13:28:07 -0400 Subject: [PATCH 034/885] fix(ts): exclude ui-router.mock.ts from tsconfig.client.test.json if using ngroute --- app/templates/tsconfig.client.test(ts).json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/templates/tsconfig.client.test(ts).json b/app/templates/tsconfig.client.test(ts).json index 9ec77ddb5..8263986dd 100644 --- a/app/templates/tsconfig.client.test(ts).json +++ b/app/templates/tsconfig.client.test(ts).json @@ -13,7 +13,8 @@ "client/components/oauth-buttons/oauth-buttons.controller.spec.ts", "client/components/oauth-buttons/oauth-buttons.directive.spec.ts", "client/components/socket/socket.mock.ts", - "client/components/ui-router/ui-router.mock.ts", + <%_ if(filters.uirouter) { _%> + "client/components/ui-router/ui-router.mock.ts",<% } %> "client/test_typings/angular-protractor/angular-protractor.d.ts", "client/test_typings/selenium-webdriver/selenium-webdriver.d.ts",<% if(filters.mocha) { %> "client/test_typings/mocha/mocha.d.ts", From 775fb2261c562e356e3823d9a3f11cd2b66804ef Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Wed, 20 Apr 2016 14:39:22 -0400 Subject: [PATCH 035/885] chore(karma): remove old karma-ng-scenario --- app/templates/_package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/app/templates/_package.json b/app/templates/_package.json index 604f74aae..a95357f68 100644 --- a/app/templates/_package.json +++ b/app/templates/_package.json @@ -148,7 +148,6 @@ "chai-as-promised": "^5.1.0", "chai-things": "^0.2.0", "karma": "~0.13.3", - "karma-ng-scenario": "~0.1.0", "karma-firefox-launcher": "~0.1.6", "karma-script-launcher": "~0.2.0", "karma-chrome-launcher": "~0.2.0", From d9d9f6213018cb5675d3d5b8096a7d22ee02e755 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Wed, 20 Apr 2016 17:23:09 -0400 Subject: [PATCH 036/885] fix(gulp:serve): remove extra comma --- app/templates/gulpfile.babel(gulp).js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/templates/gulpfile.babel(gulp).js b/app/templates/gulpfile.babel(gulp).js index 3cb4b2573..a28d4d0b6 100644 --- a/app/templates/gulpfile.babel(gulp).js +++ b/app/templates/gulpfile.babel(gulp).js @@ -438,7 +438,7 @@ gulp.task('watch', () => { }); gulp.task('serve', cb => { - runSequence(['clean:tmp', 'constant', 'env:all',<% if(filters.ts) { %>, 'tsd'<% } %>], + runSequence(['clean:tmp', 'constant', 'env:all'<% if(filters.ts) { %>, 'tsd'<% } %>], ['lint:scripts', 'inject'<% if(filters.jade) { %>, 'jade'<% } %>], ['wiredep:client'], ['transpile:client', 'styles'], From 41396942c12a709ebc1d911d7f9af092e02fac42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carl=20F=C3=BCrstenberg?= Date: Thu, 21 Apr 2016 17:04:47 +0200 Subject: [PATCH 037/885] fix(gulp): build images before rev-replace When running `gulp build` the rev manifest will be remade, but the task "build:client" which uses this file doesn't depend on "build:images" which populates this file. The result is that when running `build`, rev-replace will be unable to replace images as it doesn't wait for images to be filled in. Solution is to simply have "build:client" depend upon "build:images" --- app/templates/gulpfile.babel(gulp).js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/templates/gulpfile.babel(gulp).js b/app/templates/gulpfile.babel(gulp).js index c75c1f0d3..085b6734f 100644 --- a/app/templates/gulpfile.babel(gulp).js +++ b/app/templates/gulpfile.babel(gulp).js @@ -561,7 +561,7 @@ gulp.task('build', cb => { gulp.task('clean:dist', () => del([`${paths.dist}/!(.git*|.openshift|Procfile)**`], {dot: true})); -gulp.task('build:client', ['transpile:client', 'styles', 'html', 'constant'], () => { +gulp.task('build:client', ['transpile:client', 'styles', 'html', 'constant', 'build:images'], () => { var manifest = gulp.src(`${paths.dist}/${clientPath}/assets/rev-manifest.json`); var appFilter = plugins.filter('**/app.js', {restore: true}); From 978f6ba7cf6e7c6d065d12a1480f7e6101e2d872 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Thu, 21 Apr 2016 12:30:42 -0400 Subject: [PATCH 038/885] fix(gulp:jshint): include jshint alongside gulp-jshint it's a peerDependency of gulp-jshint, so npm 3 won't install it for us --- app/templates/_package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/app/templates/_package.json b/app/templates/_package.json index a95357f68..fe1bf7d5c 100644 --- a/app/templates/_package.json +++ b/app/templates/_package.json @@ -62,6 +62,7 @@ "gulp-istanbul-enforcer": "^1.0.3", "gulp-jscs": "^3.0.2", "gulp-jshint": "^2.0.0", + "jshint": "2.9.2", "gulp-livereload": "^3.8.0", "gulp-load-plugins": "^1.0.0-rc.1", "gulp-minify-css": "^1.1.6", From 023b261d00df45b367fd56c2bfebd86b2f417a7b Mon Sep 17 00:00:00 2001 From: adam Date: Thu, 21 Apr 2016 17:42:35 +0200 Subject: [PATCH 039/885] fix(ts): fix typo of gulp's typescript test configuration file Fix a bug in gulp + typescript builds causing the test files to not be found by karma. Relates to issue #1748 --- app/templates/gulpfile.babel(gulp).js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/templates/gulpfile.babel(gulp).js b/app/templates/gulpfile.babel(gulp).js index a28d4d0b6..ad8259cf7 100644 --- a/app/templates/gulpfile.babel(gulp).js +++ b/app/templates/gulpfile.babel(gulp).js @@ -315,7 +315,7 @@ gulp.task('transpile:client', ['constant', 'copy:constant'], () => { }); gulp.task('transpile:client:test', ['tsd:test'], () => { - let tsTestProject = plugins.typescript.createProject('./tsconfig.client.json'); + let tsTestProject = plugins.typescript.createProject('./tsconfig.client.test.json'); return tsTestProject.src() .pipe(plugins.sourcemaps.init()) .pipe(plugins.typescript(tsTestProject)).js From 6e48189530dc6405d43d9c2929fa89fc5bb0b205 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Thu, 21 Apr 2016 15:52:53 -0400 Subject: [PATCH 040/885] chore(gulp): gulp-minify-css -> gulp-clean-css --- 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 fe1bf7d5c..c158e50b4 100644 --- a/app/templates/_package.json +++ b/app/templates/_package.json @@ -65,7 +65,7 @@ "jshint": "2.9.2", "gulp-livereload": "^3.8.0", "gulp-load-plugins": "^1.0.0-rc.1", - "gulp-minify-css": "^1.1.6", + "gulp-clean-css": "^2.0.6", "gulp-mocha": "^2.1.3", "gulp-ng-annotate": "^2.0.0", "gulp-ng-constant": "^1.1.0", From dc72c33a56bf9a308e21cd788cd0b16b13db3fde Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Thu, 21 Apr 2016 15:53:21 -0400 Subject: [PATCH 041/885] fix(gulp:styles): fix styles task for plain CSS closes #1747 --- app/templates/gulpfile.babel(gulp).js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/templates/gulpfile.babel(gulp).js b/app/templates/gulpfile.babel(gulp).js index ad8259cf7..caf4d1a0c 100644 --- a/app/templates/gulpfile.babel(gulp).js +++ b/app/templates/gulpfile.babel(gulp).js @@ -136,6 +136,8 @@ let styles = lazypipe() })<% } if(filters.sass) { %> .pipe(plugins.sass)<% } if(filters.less) { %> .pipe(plugins.less)<% } %> + <%_ if(filters.css) { _%> + .pipe(plugins.cleanCss, {processImportFrom: ['!fonts.googleapis.com']})<% } %> .pipe(plugins.autoprefixer, {browsers: ['last 1 version']}) .pipe(plugins.sourcemaps.write, '.');<% if(filters.babel) { %> @@ -295,7 +297,10 @@ gulp.task('tsd:test', cb => { });<% } %> gulp.task('styles', () => { + <%_ if(!filters.css) { _%> return gulp.src(paths.client.mainStyle) + <%_ } else { _%> + return gulp.src(paths.client.styles)<% } %> .pipe(styles()) .pipe(gulp.dest('.tmp/app')); });<% if(filters.ts) { %> @@ -581,8 +586,7 @@ gulp.task('build:client', ['transpile:client', 'styles', 'html', 'constant'], () .pipe(plugins.uglify()) .pipe(jsFilter.restore) .pipe(cssFilter) - .pipe(plugins.minifyCss({ - cache: true, + .pipe(plugins.cleanCss({ processImportFrom: ['!fonts.googleapis.com'] })) .pipe(cssFilter.restore) From 6de62726846b310832704b0e01d297697da3a9c5 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Thu, 21 Apr 2016 17:01:45 -0400 Subject: [PATCH 042/885] fix(gulp:inject:css): remove leading `/` --- app/templates/gulpfile.babel(gulp).js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/templates/gulpfile.babel(gulp).js b/app/templates/gulpfile.babel(gulp).js index caf4d1a0c..9bbfb9c10 100644 --- a/app/templates/gulpfile.babel(gulp).js +++ b/app/templates/gulpfile.babel(gulp).js @@ -249,7 +249,7 @@ gulp.task('inject:tsconfig', () => { gulp.task('inject:css', () => { return gulp.src(paths.client.mainView) .pipe(plugins.inject( - gulp.src(`/${clientPath}/{app,components}/**/*.css`, {read: false}) + gulp.src(`${clientPath}/{app,components}/**/*.css`, {read: false}) .pipe(plugins.sort()), { starttag: '', From 09b4f012f9b0e1821b3f4d5bd519434fd5e131ed Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Thu, 21 Apr 2016 18:49:10 -0400 Subject: [PATCH 043/885] fix(gulp:inject): prevent `'inject:css'` from showing up twice --- app/templates/gulpfile.babel(gulp).js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/templates/gulpfile.babel(gulp).js b/app/templates/gulpfile.babel(gulp).js index 9bbfb9c10..7593aae2a 100644 --- a/app/templates/gulpfile.babel(gulp).js +++ b/app/templates/gulpfile.babel(gulp).js @@ -211,7 +211,7 @@ gulp.task('env:prod', () => { ********************/ gulp.task('inject', cb => { - runSequence(['inject:js', 'inject:css', 'inject:<%= styleExt %>'<% if(filters.ts) { %>, 'inject:tsconfig'<% } %>], cb); + runSequence(['inject:js', 'inject:css'<% if(!filters.css) { %>, 'inject:<%= styleExt %>'<% } %><% if(filters.ts) { %>, 'inject:tsconfig'<% } %>], cb); }); gulp.task('inject:js', () => { From a5e31cfc7fe0faa64699259db07032a7b572b112 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Thu, 21 Apr 2016 18:49:54 -0400 Subject: [PATCH 044/885] fix(gulp:copy:constant): fix output dir fixes #1748 --- app/templates/gulpfile.babel(gulp).js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/templates/gulpfile.babel(gulp).js b/app/templates/gulpfile.babel(gulp).js index 7593aae2a..c18730615 100644 --- a/app/templates/gulpfile.babel(gulp).js +++ b/app/templates/gulpfile.babel(gulp).js @@ -307,7 +307,7 @@ gulp.task('styles', () => { gulp.task('copy:constant', () => { return gulp.src(`${clientPath}/app/app.constant.js`, { dot: true }) - .pipe(gulp.dest('.tmp')); + .pipe(gulp.dest('.tmp/app')); }) gulp.task('transpile:client', ['constant', 'copy:constant'], () => { From 86c7510d89d427838f285dc46f9fcc3e7a865738 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Thu, 21 Apr 2016 19:01:03 -0400 Subject: [PATCH 045/885] fix(gulp:test:client): move around some `'tsd'` tasks --- app/templates/gulpfile.babel(gulp).js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/templates/gulpfile.babel(gulp).js b/app/templates/gulpfile.babel(gulp).js index c18730615..6aecc5b2a 100644 --- a/app/templates/gulpfile.babel(gulp).js +++ b/app/templates/gulpfile.babel(gulp).js @@ -310,7 +310,7 @@ gulp.task('copy:constant', () => { .pipe(gulp.dest('.tmp/app')); }) -gulp.task('transpile:client', ['constant', 'copy:constant'], () => { +gulp.task('transpile:client', ['tsd', 'constant', 'copy:constant'], () => { let tsProject = plugins.typescript.createProject('./tsconfig.client.json'); return tsProject.src() .pipe(plugins.sourcemaps.init()) @@ -496,7 +496,7 @@ gulp.task('mocha:integration', () => { .pipe(mocha()); }); -gulp.task('test:client', ['wiredep:test', 'constant'<% if(filters.ts) { %>, 'tsd:test', 'transpile:client', 'transpile:client:test'<% } %>], (done) => { +gulp.task('test:client', ['wiredep:test', 'constant'<% if(filters.ts) { %>, 'transpile:client', 'transpile:client:test'<% } %>], (done) => { new KarmaServer({ configFile: `${__dirname}/${paths.karma}`, singleRun: true From 502276348cf53bbfbf08d501161f45b337abab1a Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Thu, 21 Apr 2016 19:16:01 -0400 Subject: [PATCH 046/885] 3.6.0 --- CHANGELOG.md | 35 +++++++++++++++++++++++++++++++++++ angular-fullstack-deps | 2 +- package.json | 2 +- 3 files changed, 37 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 065f2f68a..4d50d7ab9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,38 @@ + +# [3.6.0](https://github.com/angular-fullstack/generator-angular-fullstack/compare/3.5.0...v3.6.0) (2016-04-21) + + +### Bug Fixes + +* **gen:heroku:** allow for grunt or gulp ([954baa4](https://github.com/angular-fullstack/generator-angular-fullstack/commit/954baa4)) +* **gen:openshift:** allow for grunt or gulp ([2f1a229](https://github.com/angular-fullstack/generator-angular-fullstack/commit/2f1a229)) +* **gulp:** build images before rev-replace ([4139694](https://github.com/angular-fullstack/generator-angular-fullstack/commit/4139694)) +* **gulp:copy:constant:** fix output dir ([a5e31cf](https://github.com/angular-fullstack/generator-angular-fullstack/commit/a5e31cf)), closes [#1748](https://github.com/angular-fullstack/generator-angular-fullstack/issues/1748) +* **gulp:inject:** prevent `'inject:css'` from showing up twice ([09b4f01](https://github.com/angular-fullstack/generator-angular-fullstack/commit/09b4f01)) +* **gulp:inject:css:** remove leading `/` ([6de6272](https://github.com/angular-fullstack/generator-angular-fullstack/commit/6de6272)) +* **gulp:jshint:** include jshint alongside gulp-jshint ([978f6ba](https://github.com/angular-fullstack/generator-angular-fullstack/commit/978f6ba)) +* **gulp:serve:** + * add `env:all` ([27531fb](https://github.com/angular-fullstack/generator-angular-fullstack/commit/27531fb)), closes [#1779](https://github.com/angular-fullstack/generator-angular-fullstack/issues/1779) + * remove extra comma ([d9d9f62](https://github.com/angular-fullstack/generator-angular-fullstack/commit/d9d9f62)) +* **gulp:styles:** fix styles task for plain CSS ([dc72c33](https://github.com/angular-fullstack/generator-angular-fullstack/commit/dc72c33)), closes [#1747](https://github.com/angular-fullstack/generator-angular-fullstack/issues/1747) +* **gulp:test:client:** move around some `'tsd'` tasks ([86c7510](https://github.com/angular-fullstack/generator-angular-fullstack/commit/86c7510)) +* **gulp:wiredep:** copy `exclude` array code from Grunt ([2997e34](https://github.com/angular-fullstack/generator-angular-fullstack/commit/2997e34)), closes [#1739](https://github.com/angular-fullstack/generator-angular-fullstack/issues/1739) +* **livereload:** ignore api routes and specific non-html files ([c6a396b](https://github.com/angular-fullstack/generator-angular-fullstack/commit/c6a396b)), closes [#1636](https://github.com/angular-fullstack/generator-angular-fullstack/issues/1636) [#1764](https://github.com/angular-fullstack/generator-angular-fullstack/issues/1764) +* **server:user:spec:** replace `context` with `describe` ([5716660](https://github.com/angular-fullstack/generator-angular-fullstack/commit/5716660)) +* **ts:** + * exclude ui-router.mock.ts from tsconfig.client.test.json if using ngroute ([3e40776](https://github.com/angular-fullstack/generator-angular-fullstack/commit/3e40776)) + * fix typo of gulp's typescript test configuration file ([023b261](https://github.com/angular-fullstack/generator-angular-fullstack/commit/023b261)) +* **user:** fix email and password validation ([474a3a1](https://github.com/angular-fullstack/generator-angular-fullstack/commit/474a3a1)) + +### Features + +* **GitHub:** add issue and PR templates ([79b1db7](https://github.com/angular-fullstack/generator-angular-fullstack/commit/79b1db7)) +* **gulp:** + * add serve:debug, add gulp-node-inspector ([f6eb26d](https://github.com/angular-fullstack/generator-angular-fullstack/commit/f6eb26d)) + * port `grunt buildcontrol` tasks over to gulp ([3221678](https://github.com/angular-fullstack/generator-angular-fullstack/commit/3221678)) + + + ## [3.5.0](https://github.com/angular-fullstack/generator-angular-fullstack/compare/3.4.2...v3.5.0) (2016-03-20) diff --git a/angular-fullstack-deps b/angular-fullstack-deps index 030eb1f86..dab23e800 160000 --- a/angular-fullstack-deps +++ b/angular-fullstack-deps @@ -1 +1 @@ -Subproject commit 030eb1f864101f121015147c1f1ba7ec86ebaf11 +Subproject commit dab23e80014ffd270044ccc9343a882f2b53194c diff --git a/package.json b/package.json index 647a5a2a3..693a406f4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "generator-angular-fullstack", - "version": "3.5.0", + "version": "3.6.0", "description": "Yeoman generator for creating MEAN stack applications, using MongoDB, Express, AngularJS, and Node", "keywords": [ "yeoman-generator", From 466a9564ef3bdedaabcb44c40126ac6579f47f89 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Thu, 21 Apr 2016 20:17:22 -0400 Subject: [PATCH 047/885] chore(package): grunt-protractor-runner -> ^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 c158e50b4..c22436685 100644 --- a/app/templates/_package.json +++ b/app/templates/_package.json @@ -127,7 +127,7 @@ "grunt-nodemon": "^0.4.0", "grunt-angular-templates": "^1.0.3", "grunt-dom-munger": "^3.4.0", - "grunt-protractor-runner": "^2.0.0", + "grunt-protractor-runner": "^3.1.0", "grunt-injector": "^0.6.0", "grunt-karma": "~0.12.0", "grunt-build-control": "^0.7.0",<% if(filters.sass) { %> From 1cc91a34047319e48d8ae17b6a4806ce08b910bf Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Sat, 23 Apr 2016 12:47:21 -0400 Subject: [PATCH 048/885] fix(package): revert to Grunt 0.4.5 if user chooses Grunt fixes #1815 --- 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 c158e50b4..436262402 100644 --- a/app/templates/_package.json +++ b/app/templates/_package.json @@ -98,7 +98,7 @@ "run-sequence": "^1.1.0", "lazypipe": "^1.0.1", "wiredep": "^2.2.2",<% } /*end gulp*/ if(filters.grunt) { %> - "grunt": "^1.0.1", + "grunt": "^0.4.5", "grunt-wiredep": "^2.0.0", "grunt-concurrent": "^2.0.1", "grunt-contrib-clean": "^1.0.0", From c836fc407e22d097fffc05fdf47f46aaf8bf2f80 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Sat, 23 Apr 2016 13:19:51 -0400 Subject: [PATCH 049/885] 3.6.1 --- CHANGELOG.md | 10 ++++++++++ angular-fullstack-deps | 2 +- package.json | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4d50d7ab9..63a8ed7ab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,13 @@ + +# [3.6.1](https://github.com/angular-fullstack/generator-angular-fullstack/compare/3.6.0...v3.6.1) (2016-04-23) + + +### Bug Fixes + +* **package:** revert to Grunt 0.4.5 if user chooses Grunt ([1cc91a3](https://github.com/angular-fullstack/generator-angular-fullstack/commit/1cc91a3)), closes [#1815](https://github.com/angular-fullstack/generator-angular-fullstack/issues/1815) + + + # [3.6.0](https://github.com/angular-fullstack/generator-angular-fullstack/compare/3.5.0...v3.6.0) (2016-04-21) diff --git a/angular-fullstack-deps b/angular-fullstack-deps index dab23e800..efd5dd3fb 160000 --- a/angular-fullstack-deps +++ b/angular-fullstack-deps @@ -1 +1 @@ -Subproject commit dab23e80014ffd270044ccc9343a882f2b53194c +Subproject commit efd5dd3fb81daafcea3a1da6df1fde64c7d8084c diff --git a/package.json b/package.json index 693a406f4..d901622f5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "generator-angular-fullstack", - "version": "3.6.0", + "version": "3.6.1", "description": "Yeoman generator for creating MEAN stack applications, using MongoDB, Express, AngularJS, and Node", "keywords": [ "yeoman-generator", From 1d4ce11089816527841736a7e8d65514c850ad21 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Sat, 23 Apr 2016 16:04:53 -0400 Subject: [PATCH 050/885] feat(gen:app): run all client files through Babel & JS Beautifier --- app/generator.js | 70 ++++++++++++++++++++++++++++++++++++++++++++++++ package.json | 6 +++++ 2 files changed, 76 insertions(+) diff --git a/app/generator.js b/app/generator.js index c74d42b2f..838469608 100644 --- a/app/generator.js +++ b/app/generator.js @@ -7,6 +7,9 @@ import {Base} from 'yeoman-generator'; import {genBase} from '../generator-base'; import insight from '../insight-init'; import {exec} from 'child_process'; +import babelStream from 'gulp-babel'; +import beaufityStream from 'gulp-beautify'; +import filter from 'gulp-filter'; export default class Generator extends Base { constructor(...args) { @@ -119,6 +122,12 @@ export default class Generator extends Base { }[val]; } }, { + // TODO: enable once Babel setup supports Flow + // type: 'confirm', + // name: 'flow', + // message: 'Would you like to use Flow types with Babel?', + // when: answers => answers.transpiler === 'babel' + // }, { type: 'list', name: 'markup', message: 'What would you like to write markup with?', @@ -152,6 +161,9 @@ export default class Generator extends Base { this.filters[answers.transpiler] = true; insight.track('transpiler', answers.transpiler); + this.filters.flow = !!answers.flow; + insight.track('flow', !!answers.flow); + this.filters[answers.markup] = true; insight.track('markup', answers.markup); @@ -425,6 +437,64 @@ export default class Generator extends Base { get writing() { return { generateProject: function() { + /** + * var tap = require('gulp-tap'); + this.registerTransformStream([ + extensionFilter, + tap(function(file, t) { + var contents = file.contents.toString(); + contents = beautify_js(contents, config); + file.contents = new Buffer(contents); + }), + //prettifyJs(config), + extensionFilter.restore + ]); + */ + + let babelPlugins = [ + 'babel-plugin-syntax-flow', + 'babel-plugin-syntax-class-properties' + ]; + + // TODO: enable once Babel setup supports Flow + // if(this.filters.babel && !this.filters.flow) { + babelPlugins.push('babel-plugin-transform-flow-strip-types'); + // } + + const jsFilter = filter(['client/**/*.js'], {restore: true}); + this.registerTransformStream([ + jsFilter, + babelStream({ + plugins: babelPlugins.map(require.resolve), + /* Babel get's confused about these if you're using an `npm link`ed + generator-angular-fullstack, thus the `require.resolve` */ + // retainLines: true, + babelrc: false // don't grab the generator's `.babelrc` + }), + beaufityStream({ + "indent_size": 2, + "indent_char": " ", + "indent_level": 0, + "indent_with_tabs": false, + "preserve_newlines": true, + "max_preserve_newlines": 10, + "jslint_happy": false, + "space_after_anon_function": false, + "brace_style": "collapse", + "keep_array_indentation": false, + "keep_function_indentation": false, + "space_before_conditional": true, + "break_chained_methods": true, + "eval_code": false, + "unescape_strings": false, + "wrap_line_length": 100, + "wrap_attributes": "auto", + "wrap_attributes_indent_size": 4, + "end_with_newline": true + }), + jsFilter.restore + ]); + let self = this; this.sourceRoot(path.join(__dirname, './templates')); this.processDirectory('.', '.', function(dest) { diff --git a/package.json b/package.json index 693a406f4..e575595c9 100644 --- a/package.json +++ b/package.json @@ -35,12 +35,18 @@ }, "dependencies": { "babel-core": "^6.7.0", + "babel-plugin-syntax-class-properties": "^6.5.0", + "babel-plugin-syntax-flow": "^6.5.0", "babel-plugin-transform-class-properties": "^6.6.0", + "babel-plugin-transform-flow-strip-types": "^6.7.0", "babel-preset-es2015": "^6.6.0", "babel-register": "^6.6.5", "chalk": "^1.1.0", "generator-ng-component": "~0.2.1", "glob": "^7.0.3", + "gulp-babel": "^6.1.2", + "gulp-beautify": "^2.0.0", + "gulp-filter": "^4.0.0", "insight": "~0.8.1", "lodash": "^4.6.1", "underscore.string": "^3.1.1", From 9d4bcbd30091f635bfea160d60a9cd73afa1fba9 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Sat, 23 Apr 2016 16:05:30 -0400 Subject: [PATCH 051/885] refactor(gen): move `.ts` transform to `util.js` --- app/generator.js | 8 +------- util.js | 10 ++++------ 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/app/generator.js b/app/generator.js index 838469608..ad6904f78 100644 --- a/app/generator.js +++ b/app/generator.js @@ -497,13 +497,7 @@ export default class Generator extends Base { let self = this; this.sourceRoot(path.join(__dirname, './templates')); - this.processDirectory('.', '.', function(dest) { - if(self.filters.ts && dest.indexOf('client') > -1 && dest.indexOf('.json') === -1) { - dest = dest.replace('.js', '.ts'); - } - - return dest; - }); + this.processDirectory('.', '.'); }, generateEndpoint: function() { var models; diff --git a/util.js b/util.js index 6b8c65e73..4ed6205c2 100644 --- a/util.js +++ b/util.js @@ -105,14 +105,10 @@ function templateIsUsable(self, filteredFile) { return true; } -function defaultIteratee(dest) { - return dest; -} - /** * */ -export function processDirectory(source, destination, iteratee = defaultIteratee) { +export function processDirectory(source, destination) { var self = this; var root = path.isAbsolute(source) ? source : path.join(self.sourceRoot(), source); var files = expandFiles('**', { dot: true, cwd: root }); @@ -132,7 +128,9 @@ export function processDirectory(source, destination, iteratee = defaultIteratee src = path.join(root, f); dest = path.join(destination, name); - dest = iteratee(dest); + if(self.filters.ts && dest.indexOf('client') > -1 && dest.indexOf('.json') === -1) { + dest = dest.replace('.js', '.ts'); + } if(path.basename(dest).indexOf('_') === 0) { stripped = path.basename(dest).replace(/^_/, ''); From 7ed25853b4a9ad4977cf4c9884bc2e29228f45a7 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Sat, 23 Apr 2016 16:06:18 -0400 Subject: [PATCH 052/885] feat(client:auth): add first type definition (`callback: Function`) --- app/templates/client/components/auth(auth)/auth.service.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/templates/client/components/auth(auth)/auth.service.js b/app/templates/client/components/auth(auth)/auth.service.js index dbb13603a..3a75c5a9a 100644 --- a/app/templates/client/components/auth(auth)/auth.service.js +++ b/app/templates/client/components/auth(auth)/auth.service.js @@ -20,7 +20,7 @@ function AuthService($location, $http, $cookies, $q, appConfig, Util, User) { * @param {Function} callback - optional, function(error, user) * @return {Promise} */ - login({email, password}, callback) { + login({email, password}, callback: Function) { return $http.post('/auth/local', { email: email, password: password From b5475e4b10430557f4f8d030c05b78caccec67d1 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Sat, 23 Apr 2016 19:39:59 -0400 Subject: [PATCH 053/885] chore(grunt): use grunt-sass instead of grunt-contrib-sass closes #1673 --- 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 c158e50b4..b851e3914 100644 --- a/app/templates/_package.json +++ b/app/templates/_package.json @@ -131,7 +131,7 @@ "grunt-injector": "^0.6.0", "grunt-karma": "~0.12.0", "grunt-build-control": "^0.7.0",<% if(filters.sass) { %> - "grunt-contrib-sass": "^1.0.0",<% } %><% if(filters.stylus) { %> + "grunt-sass": "^1.1.0",<% } %><% if(filters.stylus) { %> "grunt-contrib-stylus": "^1.2.0",<% } %> "jit-grunt": "~0.10.0", "grunt-express-server": "^0.5.1", From 17052a5c678ecfce96bb1c6bafe38a2e1da3673b Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Sat, 23 Apr 2016 18:38:32 -0400 Subject: [PATCH 054/885] refactor(gen): set up whole generator to not need babel-register at runtime move all subgenerators to `src/`, all templates to `templates/`; use Gulp to build project; dist code is sent to `generators` --- .gitignore | 3 +- .npmignore | 4 ++ app/index.js | 9 ----- endpoint/index.js | 9 ----- gulpfile.babel.js | 35 ++++++++++++++++++ package.json | 9 +++-- {app => src/app}/USAGE | 0 app/generator.js => src/app/index.js | 6 ++- {controller => src/controller}/index.js | 0 {decorator => src/decorator}/index.js | 0 {directive => src/directive}/index.js | 0 .../generator.js => src/endpoint/index.js | 6 ++- {factory => src/factory}/index.js | 0 {filter => src/filter}/index.js | 0 generator-base.js => src/generator-base.js | 0 {heroku => src/heroku}/USAGE | 0 {heroku => src/heroku}/index.js | 0 {heroku => src/heroku}/templates/Procfile | 0 insight-init.js => src/insight-init.js | 2 +- {openshift => src/openshift}/USAGE | 0 {openshift => src/openshift}/index.js | 0 .../openshift}/templates/hot_deploy | 0 {provider => src/provider}/index.js | 0 {route => src/route}/index.js | 0 {service => src/service}/index.js | 0 util.js => src/util.js | 0 {app/templates => templates/app}/.bowerrc | 0 {app/templates => templates/app}/.buildignore | 0 .../templates => templates/app}/.editorconfig | 0 .../app}/.gitattributes | 0 {app/templates => templates/app}/.jscsrc | 0 {app/templates => templates/app}/.travis.yml | 0 .../app}/Gruntfile(grunt).js | 0 {app/templates => templates/app}/README.md | 0 {app/templates => templates/app}/_.babelrc | 0 {app/templates => templates/app}/_.gitignore | 0 {app/templates => templates/app}/_bower.json | 0 .../templates => templates/app}/_package.json | 0 .../app}/client/.htaccess | 0 .../app}/client/.jshintrc(babel) | 0 .../app}/client/app/account(auth)/account.js | 0 .../app/account(auth)/login/login(html).html | 0 .../app/account(auth)/login/login(jade).jade | 0 .../account(auth)/login/login.controller.js | 0 .../settings/settings(html).html | 0 .../settings/settings(jade).jade | 0 .../settings/settings.controller.js | 0 .../account(auth)/signup/signup(html).html | 0 .../account(auth)/signup/signup(jade).jade | 0 .../account(auth)/signup/signup.controller.js | 0 .../client/app/admin(auth)/admin(css).css | 0 .../client/app/admin(auth)/admin(html).html | 0 .../client/app/admin(auth)/admin(jade).jade | 0 .../client/app/admin(auth)/admin(less).less | 0 .../client/app/admin(auth)/admin(sass).scss | 0 .../client/app/admin(auth)/admin(stylus).styl | 0 .../app/admin(auth)/admin.controller.js | 0 .../client/app/admin(auth)/admin.module.js | 0 .../client/app/admin(auth)/admin.router.js | 0 .../app}/client/app/app(css).css | 0 .../app}/client/app/app(less).less | 0 .../app}/client/app/app(sass).scss | 0 .../app}/client/app/app(stylus).styl | 0 .../app}/client/app/app.js | 0 .../app}/client/app/main/main(css).css | 0 .../app}/client/app/main/main(html).html | 0 .../app}/client/app/main/main(jade).jade | 0 .../app}/client/app/main/main(less).less | 0 .../app}/client/app/main/main(sass).scss | 0 .../app}/client/app/main/main(stylus).styl | 0 .../app}/client/app/main/main.controller.js | 0 .../client/app/main/main.controller.spec.js | 0 .../app}/client/app/main/main.js | 0 .../app}/client/assets/images/!yeoman.png | Bin .../components/auth(auth)/auth.module.js | 0 .../components/auth(auth)/auth.service.js | 0 .../auth(auth)/interceptor.service.js | 0 .../components/auth(auth)/router.decorator.js | 0 .../components/auth(auth)/user.service.js | 0 .../client/components/footer/footer(css).css | 0 .../components/footer/footer(html).html | 0 .../components/footer/footer(jade).jade | 0 .../components/footer/footer(less).less | 0 .../components/footer/footer(sass).scss | 0 .../components/footer/footer(stylus).styl | 0 .../components/footer/footer.directive.js | 0 .../modal(uibootstrap)/modal(css).css | 0 .../modal(uibootstrap)/modal(html).html | 0 .../modal(uibootstrap)/modal(jade).jade | 0 .../modal(uibootstrap)/modal(less).less | 0 .../modal(uibootstrap)/modal(sass).scss | 0 .../modal(uibootstrap)/modal(stylus).styl | 0 .../modal(uibootstrap)/modal.service.js | 0 .../mongoose-error.directive.js | 0 .../components/navbar/navbar(html).html | 0 .../components/navbar/navbar(jade).jade | 0 .../components/navbar/navbar.controller.js | 0 .../components/navbar/navbar.directive.js | 0 .../oauth-buttons(css).css | 0 .../oauth-buttons(html).html | 0 .../oauth-buttons(jade).jade | 0 .../oauth-buttons(less).less | 0 .../oauth-buttons(sass).scss | 0 .../oauth-buttons(stylus).styl | 0 .../oauth-buttons.controller.js | 0 .../oauth-buttons.controller.spec.js | 0 .../oauth-buttons.directive.js | 0 .../oauth-buttons.directive.spec.js | 0 .../socket(socketio)/socket.mock.js | 0 .../socket(socketio)/socket.service.js | 0 .../ui-router(uirouter)/ui-router.mock.js | 0 .../client/components/util/util.module.js | 0 .../client/components/util/util.service.js | 0 .../app}/client/favicon.ico | Bin .../app}/client/index.html | 0 .../app}/client/robots.txt | 0 .../app}/client/tslint.json(ts) | 0 .../app}/e2e/account(auth)/login/login.po.js | 0 .../login/login.spec(jasmine).js | 0 .../account(auth)/login/login.spec(mocha).js | 0 .../logout/logout.spec(jasmine).js | 0 .../logout/logout.spec(mocha).js | 0 .../e2e/account(auth)/signup/signup.po.js | 0 .../signup/signup.spec(jasmine).js | 0 .../signup/signup.spec(mocha).js | 0 .../app}/e2e/components/navbar/navbar.po.js | 0 .../oauth-buttons(oauth)/oauth-buttons.po.js | 0 .../app}/e2e/main/main.po.js | 0 .../app}/e2e/main/main.spec(jasmine).js | 0 .../app}/e2e/main/main.spec(mocha).js | 0 .../app}/gulpfile.babel(gulp).js | 0 .../templates => templates/app}/karma.conf.js | 0 .../templates => templates/app}/mocha.conf.js | 0 .../app}/mocha.global(gulp).js | 0 .../app}/protractor.conf.js | 0 .../app}/server/.jshintrc | 0 .../app}/server/.jshintrc-spec | 0 .../app}/server/api/user(auth)/index.js | 0 .../app}/server/api/user(auth)/index.spec.js | 0 .../server/api/user(auth)/user.controller.js | 0 .../app}/server/api/user(auth)/user.events.js | 0 .../server/api/user(auth)/user.integration.js | 0 .../user(auth)/user.model(mongooseModels).js | 0 .../user(auth)/user.model(sequelizeModels).js | 0 .../user.model.spec(mongooseModels).js | 0 .../user.model.spec(sequelizeModels).js | 0 .../templates => templates/app}/server/app.js | 0 .../app}/server/auth(auth)/auth.service.js | 0 .../facebook(facebookAuth)/index.js | 0 .../facebook(facebookAuth)/passport.js | 0 .../auth(auth)/google(googleAuth)/index.js | 0 .../auth(auth)/google(googleAuth)/passport.js | 0 .../app}/server/auth(auth)/index.js | 0 .../app}/server/auth(auth)/local/index.js | 0 .../app}/server/auth(auth)/local/passport.js | 0 .../auth(auth)/twitter(twitterAuth)/index.js | 0 .../twitter(twitterAuth)/passport.js | 0 .../app}/server/components/errors/index.js | 0 .../app}/server/config/_local.env.js | 0 .../app}/server/config/_local.env.sample.js | 0 .../server/config/environment/development.js | 0 .../app}/server/config/environment/index.js | 0 .../server/config/environment/production.js | 0 .../app}/server/config/environment/shared.js | 0 .../app}/server/config/environment/test.js | 0 .../app}/server/config/express.js | 0 .../app}/server/config/seed(models).js | 0 .../app}/server/config/socketio(socketio).js | 0 .../app}/server/index.js | 0 .../app}/server/routes.js | 0 .../app}/server/sqldb(sequelize)/index.js | 0 .../app}/server/views/404(html).html | 0 .../app}/server/views/404(jade).jade | 0 .../app}/tsconfig.client(ts).json | 0 .../app}/tsconfig.client.test(ts).json | 0 {app/templates => templates/app}/tsd(ts).json | 0 .../app}/tsd_test(ts).json | 0 .../endpoint}/basename.controller.js | 0 .../endpoint}/basename.events(models).js | 0 .../endpoint}/basename.integration.js | 0 .../basename.model(mongooseModels).js | 0 .../basename.model(sequelizeModels).js | 0 .../endpoint}/basename.socket(socketio).js | 0 .../templates => templates/endpoint}/index.js | 0 .../endpoint}/index.spec.js | 0 185 files changed, 55 insertions(+), 28 deletions(-) delete mode 100644 app/index.js delete mode 100644 endpoint/index.js create mode 100644 gulpfile.babel.js rename {app => src/app}/USAGE (100%) rename app/generator.js => src/app/index.js (99%) rename {controller => src/controller}/index.js (100%) rename {decorator => src/decorator}/index.js (100%) rename {directive => src/directive}/index.js (100%) rename endpoint/generator.js => src/endpoint/index.js (96%) rename {factory => src/factory}/index.js (100%) rename {filter => src/filter}/index.js (100%) rename generator-base.js => src/generator-base.js (100%) rename {heroku => src/heroku}/USAGE (100%) rename {heroku => src/heroku}/index.js (100%) rename {heroku => src/heroku}/templates/Procfile (100%) rename insight-init.js => src/insight-init.js (92%) rename {openshift => src/openshift}/USAGE (100%) rename {openshift => src/openshift}/index.js (100%) rename {openshift => src/openshift}/templates/hot_deploy (100%) rename {provider => src/provider}/index.js (100%) rename {route => src/route}/index.js (100%) rename {service => src/service}/index.js (100%) rename util.js => src/util.js (100%) rename {app/templates => templates/app}/.bowerrc (100%) rename {app/templates => templates/app}/.buildignore (100%) rename {app/templates => templates/app}/.editorconfig (100%) rename {app/templates => templates/app}/.gitattributes (100%) rename {app/templates => templates/app}/.jscsrc (100%) rename {app/templates => templates/app}/.travis.yml (100%) rename {app/templates => templates/app}/Gruntfile(grunt).js (100%) rename {app/templates => templates/app}/README.md (100%) rename {app/templates => templates/app}/_.babelrc (100%) rename {app/templates => templates/app}/_.gitignore (100%) rename {app/templates => templates/app}/_bower.json (100%) rename {app/templates => templates/app}/_package.json (100%) rename {app/templates => templates/app}/client/.htaccess (100%) rename {app/templates => templates/app}/client/.jshintrc(babel) (100%) rename {app/templates => templates/app}/client/app/account(auth)/account.js (100%) rename {app/templates => templates/app}/client/app/account(auth)/login/login(html).html (100%) rename {app/templates => templates/app}/client/app/account(auth)/login/login(jade).jade (100%) rename {app/templates => templates/app}/client/app/account(auth)/login/login.controller.js (100%) rename {app/templates => templates/app}/client/app/account(auth)/settings/settings(html).html (100%) rename {app/templates => templates/app}/client/app/account(auth)/settings/settings(jade).jade (100%) rename {app/templates => templates/app}/client/app/account(auth)/settings/settings.controller.js (100%) rename {app/templates => templates/app}/client/app/account(auth)/signup/signup(html).html (100%) rename {app/templates => templates/app}/client/app/account(auth)/signup/signup(jade).jade (100%) rename {app/templates => templates/app}/client/app/account(auth)/signup/signup.controller.js (100%) rename {app/templates => templates/app}/client/app/admin(auth)/admin(css).css (100%) rename {app/templates => templates/app}/client/app/admin(auth)/admin(html).html (100%) rename {app/templates => templates/app}/client/app/admin(auth)/admin(jade).jade (100%) rename {app/templates => templates/app}/client/app/admin(auth)/admin(less).less (100%) rename {app/templates => templates/app}/client/app/admin(auth)/admin(sass).scss (100%) rename {app/templates => templates/app}/client/app/admin(auth)/admin(stylus).styl (100%) rename {app/templates => templates/app}/client/app/admin(auth)/admin.controller.js (100%) rename {app/templates => templates/app}/client/app/admin(auth)/admin.module.js (100%) rename {app/templates => templates/app}/client/app/admin(auth)/admin.router.js (100%) rename {app/templates => templates/app}/client/app/app(css).css (100%) rename {app/templates => templates/app}/client/app/app(less).less (100%) rename {app/templates => templates/app}/client/app/app(sass).scss (100%) rename {app/templates => templates/app}/client/app/app(stylus).styl (100%) rename {app/templates => templates/app}/client/app/app.js (100%) rename {app/templates => templates/app}/client/app/main/main(css).css (100%) rename {app/templates => templates/app}/client/app/main/main(html).html (100%) rename {app/templates => templates/app}/client/app/main/main(jade).jade (100%) rename {app/templates => templates/app}/client/app/main/main(less).less (100%) rename {app/templates => templates/app}/client/app/main/main(sass).scss (100%) rename {app/templates => templates/app}/client/app/main/main(stylus).styl (100%) rename {app/templates => templates/app}/client/app/main/main.controller.js (100%) rename {app/templates => templates/app}/client/app/main/main.controller.spec.js (100%) rename {app/templates => templates/app}/client/app/main/main.js (100%) rename {app/templates => templates/app}/client/assets/images/!yeoman.png (100%) rename {app/templates => templates/app}/client/components/auth(auth)/auth.module.js (100%) rename {app/templates => templates/app}/client/components/auth(auth)/auth.service.js (100%) rename {app/templates => templates/app}/client/components/auth(auth)/interceptor.service.js (100%) rename {app/templates => templates/app}/client/components/auth(auth)/router.decorator.js (100%) rename {app/templates => templates/app}/client/components/auth(auth)/user.service.js (100%) rename {app/templates => templates/app}/client/components/footer/footer(css).css (100%) rename {app/templates => templates/app}/client/components/footer/footer(html).html (100%) rename {app/templates => templates/app}/client/components/footer/footer(jade).jade (100%) rename {app/templates => templates/app}/client/components/footer/footer(less).less (100%) rename {app/templates => templates/app}/client/components/footer/footer(sass).scss (100%) rename {app/templates => templates/app}/client/components/footer/footer(stylus).styl (100%) rename {app/templates => templates/app}/client/components/footer/footer.directive.js (100%) rename {app/templates => templates/app}/client/components/modal(uibootstrap)/modal(css).css (100%) rename {app/templates => templates/app}/client/components/modal(uibootstrap)/modal(html).html (100%) rename {app/templates => templates/app}/client/components/modal(uibootstrap)/modal(jade).jade (100%) rename {app/templates => templates/app}/client/components/modal(uibootstrap)/modal(less).less (100%) rename {app/templates => templates/app}/client/components/modal(uibootstrap)/modal(sass).scss (100%) rename {app/templates => templates/app}/client/components/modal(uibootstrap)/modal(stylus).styl (100%) rename {app/templates => templates/app}/client/components/modal(uibootstrap)/modal.service.js (100%) rename {app/templates => templates/app}/client/components/mongoose-error(auth)/mongoose-error.directive.js (100%) rename {app/templates => templates/app}/client/components/navbar/navbar(html).html (100%) rename {app/templates => templates/app}/client/components/navbar/navbar(jade).jade (100%) rename {app/templates => templates/app}/client/components/navbar/navbar.controller.js (100%) rename {app/templates => templates/app}/client/components/navbar/navbar.directive.js (100%) rename {app/templates => templates/app}/client/components/oauth-buttons(oauth)/oauth-buttons(css).css (100%) rename {app/templates => templates/app}/client/components/oauth-buttons(oauth)/oauth-buttons(html).html (100%) rename {app/templates => templates/app}/client/components/oauth-buttons(oauth)/oauth-buttons(jade).jade (100%) rename {app/templates => templates/app}/client/components/oauth-buttons(oauth)/oauth-buttons(less).less (100%) rename {app/templates => templates/app}/client/components/oauth-buttons(oauth)/oauth-buttons(sass).scss (100%) rename {app/templates => templates/app}/client/components/oauth-buttons(oauth)/oauth-buttons(stylus).styl (100%) rename {app/templates => templates/app}/client/components/oauth-buttons(oauth)/oauth-buttons.controller.js (100%) rename {app/templates => templates/app}/client/components/oauth-buttons(oauth)/oauth-buttons.controller.spec.js (100%) rename {app/templates => templates/app}/client/components/oauth-buttons(oauth)/oauth-buttons.directive.js (100%) rename {app/templates => templates/app}/client/components/oauth-buttons(oauth)/oauth-buttons.directive.spec.js (100%) rename {app/templates => templates/app}/client/components/socket(socketio)/socket.mock.js (100%) rename {app/templates => templates/app}/client/components/socket(socketio)/socket.service.js (100%) rename {app/templates => templates/app}/client/components/ui-router(uirouter)/ui-router.mock.js (100%) rename {app/templates => templates/app}/client/components/util/util.module.js (100%) rename {app/templates => templates/app}/client/components/util/util.service.js (100%) rename {app/templates => templates/app}/client/favicon.ico (100%) rename {app/templates => templates/app}/client/index.html (100%) rename {app/templates => templates/app}/client/robots.txt (100%) rename {app/templates => templates/app}/client/tslint.json(ts) (100%) rename {app/templates => templates/app}/e2e/account(auth)/login/login.po.js (100%) rename {app/templates => templates/app}/e2e/account(auth)/login/login.spec(jasmine).js (100%) rename {app/templates => templates/app}/e2e/account(auth)/login/login.spec(mocha).js (100%) rename {app/templates => templates/app}/e2e/account(auth)/logout/logout.spec(jasmine).js (100%) rename {app/templates => templates/app}/e2e/account(auth)/logout/logout.spec(mocha).js (100%) rename {app/templates => templates/app}/e2e/account(auth)/signup/signup.po.js (100%) rename {app/templates => templates/app}/e2e/account(auth)/signup/signup.spec(jasmine).js (100%) rename {app/templates => templates/app}/e2e/account(auth)/signup/signup.spec(mocha).js (100%) rename {app/templates => templates/app}/e2e/components/navbar/navbar.po.js (100%) rename {app/templates => templates/app}/e2e/components/oauth-buttons(oauth)/oauth-buttons.po.js (100%) rename {app/templates => templates/app}/e2e/main/main.po.js (100%) rename {app/templates => templates/app}/e2e/main/main.spec(jasmine).js (100%) rename {app/templates => templates/app}/e2e/main/main.spec(mocha).js (100%) rename {app/templates => templates/app}/gulpfile.babel(gulp).js (100%) rename {app/templates => templates/app}/karma.conf.js (100%) rename {app/templates => templates/app}/mocha.conf.js (100%) rename {app/templates => templates/app}/mocha.global(gulp).js (100%) rename {app/templates => templates/app}/protractor.conf.js (100%) rename {app/templates => templates/app}/server/.jshintrc (100%) rename {app/templates => templates/app}/server/.jshintrc-spec (100%) rename {app/templates => templates/app}/server/api/user(auth)/index.js (100%) rename {app/templates => templates/app}/server/api/user(auth)/index.spec.js (100%) rename {app/templates => templates/app}/server/api/user(auth)/user.controller.js (100%) rename {app/templates => templates/app}/server/api/user(auth)/user.events.js (100%) rename {app/templates => templates/app}/server/api/user(auth)/user.integration.js (100%) rename {app/templates => templates/app}/server/api/user(auth)/user.model(mongooseModels).js (100%) rename {app/templates => templates/app}/server/api/user(auth)/user.model(sequelizeModels).js (100%) rename {app/templates => templates/app}/server/api/user(auth)/user.model.spec(mongooseModels).js (100%) rename {app/templates => templates/app}/server/api/user(auth)/user.model.spec(sequelizeModels).js (100%) rename {app/templates => templates/app}/server/app.js (100%) rename {app/templates => templates/app}/server/auth(auth)/auth.service.js (100%) rename {app/templates => templates/app}/server/auth(auth)/facebook(facebookAuth)/index.js (100%) rename {app/templates => templates/app}/server/auth(auth)/facebook(facebookAuth)/passport.js (100%) rename {app/templates => templates/app}/server/auth(auth)/google(googleAuth)/index.js (100%) rename {app/templates => templates/app}/server/auth(auth)/google(googleAuth)/passport.js (100%) rename {app/templates => templates/app}/server/auth(auth)/index.js (100%) rename {app/templates => templates/app}/server/auth(auth)/local/index.js (100%) rename {app/templates => templates/app}/server/auth(auth)/local/passport.js (100%) rename {app/templates => templates/app}/server/auth(auth)/twitter(twitterAuth)/index.js (100%) rename {app/templates => templates/app}/server/auth(auth)/twitter(twitterAuth)/passport.js (100%) rename {app/templates => templates/app}/server/components/errors/index.js (100%) rename {app/templates => templates/app}/server/config/_local.env.js (100%) rename {app/templates => templates/app}/server/config/_local.env.sample.js (100%) rename {app/templates => templates/app}/server/config/environment/development.js (100%) rename {app/templates => templates/app}/server/config/environment/index.js (100%) rename {app/templates => templates/app}/server/config/environment/production.js (100%) rename {app/templates => templates/app}/server/config/environment/shared.js (100%) rename {app/templates => templates/app}/server/config/environment/test.js (100%) rename {app/templates => templates/app}/server/config/express.js (100%) rename {app/templates => templates/app}/server/config/seed(models).js (100%) rename {app/templates => templates/app}/server/config/socketio(socketio).js (100%) rename {app/templates => templates/app}/server/index.js (100%) rename {app/templates => templates/app}/server/routes.js (100%) rename {app/templates => templates/app}/server/sqldb(sequelize)/index.js (100%) rename {app/templates => templates/app}/server/views/404(html).html (100%) rename {app/templates => templates/app}/server/views/404(jade).jade (100%) rename {app/templates => templates/app}/tsconfig.client(ts).json (100%) rename {app/templates => templates/app}/tsconfig.client.test(ts).json (100%) rename {app/templates => templates/app}/tsd(ts).json (100%) rename {app/templates => templates/app}/tsd_test(ts).json (100%) rename {endpoint/templates => templates/endpoint}/basename.controller.js (100%) rename {endpoint/templates => templates/endpoint}/basename.events(models).js (100%) rename {endpoint/templates => templates/endpoint}/basename.integration.js (100%) rename {endpoint/templates => templates/endpoint}/basename.model(mongooseModels).js (100%) rename {endpoint/templates => templates/endpoint}/basename.model(sequelizeModels).js (100%) rename {endpoint/templates => templates/endpoint}/basename.socket(socketio).js (100%) rename {endpoint/templates => templates/endpoint}/index.js (100%) rename {endpoint/templates => templates/endpoint}/index.spec.js (100%) diff --git a/.gitignore b/.gitignore index 78a6835b7..f9b1763a8 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,5 @@ demo .DS_Store release.txt test/fixtures/bower.json -test/fixtures/package.json \ No newline at end of file +test/fixtures/package.json +generators \ No newline at end of file diff --git a/.npmignore b/.npmignore index c823223d9..58e92379e 100644 --- a/.npmignore +++ b/.npmignore @@ -1,3 +1,7 @@ angular-fullstack-deps test .idea +src +scripts +ISSUE_TEMPLATE.md +PULL_REQUEST_TEMPLATE.md diff --git a/app/index.js b/app/index.js deleted file mode 100644 index e4df68f08..000000000 --- a/app/index.js +++ /dev/null @@ -1,9 +0,0 @@ -'use strict'; - -// Register the Babel require hook -require('babel-register')({ - only: /generator-angular-fullstack\/(?!node_modules)/ -}); - -// Export the generator -module.exports = require('./generator').default; diff --git a/endpoint/index.js b/endpoint/index.js deleted file mode 100644 index e4df68f08..000000000 --- a/endpoint/index.js +++ /dev/null @@ -1,9 +0,0 @@ -'use strict'; - -// Register the Babel require hook -require('babel-register')({ - only: /generator-angular-fullstack\/(?!node_modules)/ -}); - -// Export the generator -module.exports = require('./generator').default; diff --git a/gulpfile.babel.js b/gulpfile.babel.js new file mode 100644 index 000000000..a8c2ecfe1 --- /dev/null +++ b/gulpfile.babel.js @@ -0,0 +1,35 @@ +'use strict'; +// import _ from 'lodash'; +// import fs from 'fs'; +import gulp from 'gulp'; +import babel from 'gulp-babel'; +import del from 'del'; +import runSequence from 'run-sequence'; + +gulp.task('clean', () => { + return del(['generators/**/*']); +}); + +gulp.task('babel', () => { + return gulp.src(['src/**/*.js']) + .pipe(babel()) + .pipe(gulp.dest('generators')); +}); + +gulp.task('watch', () => { + return gulp.watch('src/**/*.js', ['babel']); +}); + +gulp.task('copy', () => { + return gulp.src(['src/**/*', '!src/**/*.js']) + .pipe(gulp.dest('generators')); +}); + +gulp.task('build', cb => { + return runSequence( + 'clean', + 'babel', + 'copy', + cb + ); +}); diff --git a/package.json b/package.json index e575595c9..0db5e59e0 100644 --- a/package.json +++ b/package.json @@ -34,13 +34,9 @@ "test": "grunt test" }, "dependencies": { - "babel-core": "^6.7.0", "babel-plugin-syntax-class-properties": "^6.5.0", "babel-plugin-syntax-flow": "^6.5.0", - "babel-plugin-transform-class-properties": "^6.6.0", "babel-plugin-transform-flow-strip-types": "^6.7.0", - "babel-preset-es2015": "^6.6.0", - "babel-register": "^6.6.5", "chalk": "^1.1.0", "generator-ng-component": "~0.2.1", "glob": "^7.0.3", @@ -55,6 +51,10 @@ }, "devDependencies": { "chai": "^3.2.0", + "babel-register": "^6.6.5", + "babel-preset-es2015": "^6.6.0", + "babel-plugin-transform-class-properties": "^6.6.0", + "del": "^2.2.0", "grunt": "^1.0.1", "grunt-build-control": "^0.7.0", "grunt-contrib-clean": "^1.0.0", @@ -68,6 +68,7 @@ "mocha": "^2.2.5", "q": "^1.0.1", "recursive-readdir": "^2.0.0", + "run-sequence": "^1.1.5", "shelljs": "^0.6.0", "yeoman-assert": "^2.0.0", "yeoman-test": "^1.1.0" diff --git a/app/USAGE b/src/app/USAGE similarity index 100% rename from app/USAGE rename to src/app/USAGE diff --git a/app/generator.js b/src/app/index.js similarity index 99% rename from app/generator.js rename to src/app/index.js index ad6904f78..1bfaa9e16 100644 --- a/app/generator.js +++ b/src/app/index.js @@ -11,7 +11,7 @@ import babelStream from 'gulp-babel'; import beaufityStream from 'gulp-beautify'; import filter from 'gulp-filter'; -export default class Generator extends Base { +export class Generator extends Base { constructor(...args) { super(...args); @@ -496,7 +496,7 @@ export default class Generator extends Base { ]); let self = this; - this.sourceRoot(path.join(__dirname, './templates')); + this.sourceRoot(path.join(__dirname, '../../templates/app')); this.processDirectory('.', '.'); }, generateEndpoint: function() { @@ -531,3 +531,5 @@ export default class Generator extends Base { return {}; } } + +module.exports = Generator; diff --git a/controller/index.js b/src/controller/index.js similarity index 100% rename from controller/index.js rename to src/controller/index.js diff --git a/decorator/index.js b/src/decorator/index.js similarity index 100% rename from decorator/index.js rename to src/decorator/index.js diff --git a/directive/index.js b/src/directive/index.js similarity index 100% rename from directive/index.js rename to src/directive/index.js diff --git a/endpoint/generator.js b/src/endpoint/index.js similarity index 96% rename from endpoint/generator.js rename to src/endpoint/index.js index a7c968093..9ea93f7e8 100644 --- a/endpoint/generator.js +++ b/src/endpoint/index.js @@ -4,7 +4,7 @@ import path from 'path'; import {NamedBase} from 'yeoman-generator'; import {genNamedBase} from '../generator-base'; -export default class Generator extends NamedBase { +export class Generator extends NamedBase { constructor(...args) { super(...args); @@ -99,7 +99,7 @@ export default class Generator extends NamedBase { } writing() { - this.sourceRoot(path.join(__dirname, './templates')); + this.sourceRoot(path.join(__dirname, '../../templates/endpoint')); this.processDirectory('.', this.routeDest); } @@ -145,3 +145,5 @@ export default class Generator extends NamedBase { } } } + +module.exports = Generator; diff --git a/factory/index.js b/src/factory/index.js similarity index 100% rename from factory/index.js rename to src/factory/index.js diff --git a/filter/index.js b/src/filter/index.js similarity index 100% rename from filter/index.js rename to src/filter/index.js diff --git a/generator-base.js b/src/generator-base.js similarity index 100% rename from generator-base.js rename to src/generator-base.js diff --git a/heroku/USAGE b/src/heroku/USAGE similarity index 100% rename from heroku/USAGE rename to src/heroku/USAGE diff --git a/heroku/index.js b/src/heroku/index.js similarity index 100% rename from heroku/index.js rename to src/heroku/index.js diff --git a/heroku/templates/Procfile b/src/heroku/templates/Procfile similarity index 100% rename from heroku/templates/Procfile rename to src/heroku/templates/Procfile diff --git a/insight-init.js b/src/insight-init.js similarity index 92% rename from insight-init.js rename to src/insight-init.js index b9fede03b..66984352d 100644 --- a/insight-init.js +++ b/src/insight-init.js @@ -1,6 +1,6 @@ 'use strict'; var Insight = require('insight'); -var pkg = require('./package.json'); +var pkg = require('../package.json'); var insight = new Insight({ // Google Analytics tracking code diff --git a/openshift/USAGE b/src/openshift/USAGE similarity index 100% rename from openshift/USAGE rename to src/openshift/USAGE diff --git a/openshift/index.js b/src/openshift/index.js similarity index 100% rename from openshift/index.js rename to src/openshift/index.js diff --git a/openshift/templates/hot_deploy b/src/openshift/templates/hot_deploy similarity index 100% rename from openshift/templates/hot_deploy rename to src/openshift/templates/hot_deploy diff --git a/provider/index.js b/src/provider/index.js similarity index 100% rename from provider/index.js rename to src/provider/index.js diff --git a/route/index.js b/src/route/index.js similarity index 100% rename from route/index.js rename to src/route/index.js diff --git a/service/index.js b/src/service/index.js similarity index 100% rename from service/index.js rename to src/service/index.js diff --git a/util.js b/src/util.js similarity index 100% rename from util.js rename to src/util.js diff --git a/app/templates/.bowerrc b/templates/app/.bowerrc similarity index 100% rename from app/templates/.bowerrc rename to templates/app/.bowerrc diff --git a/app/templates/.buildignore b/templates/app/.buildignore similarity index 100% rename from app/templates/.buildignore rename to templates/app/.buildignore diff --git a/app/templates/.editorconfig b/templates/app/.editorconfig similarity index 100% rename from app/templates/.editorconfig rename to templates/app/.editorconfig diff --git a/app/templates/.gitattributes b/templates/app/.gitattributes similarity index 100% rename from app/templates/.gitattributes rename to templates/app/.gitattributes diff --git a/app/templates/.jscsrc b/templates/app/.jscsrc similarity index 100% rename from app/templates/.jscsrc rename to templates/app/.jscsrc diff --git a/app/templates/.travis.yml b/templates/app/.travis.yml similarity index 100% rename from app/templates/.travis.yml rename to templates/app/.travis.yml diff --git a/app/templates/Gruntfile(grunt).js b/templates/app/Gruntfile(grunt).js similarity index 100% rename from app/templates/Gruntfile(grunt).js rename to templates/app/Gruntfile(grunt).js diff --git a/app/templates/README.md b/templates/app/README.md similarity index 100% rename from app/templates/README.md rename to templates/app/README.md diff --git a/app/templates/_.babelrc b/templates/app/_.babelrc similarity index 100% rename from app/templates/_.babelrc rename to templates/app/_.babelrc diff --git a/app/templates/_.gitignore b/templates/app/_.gitignore similarity index 100% rename from app/templates/_.gitignore rename to templates/app/_.gitignore diff --git a/app/templates/_bower.json b/templates/app/_bower.json similarity index 100% rename from app/templates/_bower.json rename to templates/app/_bower.json diff --git a/app/templates/_package.json b/templates/app/_package.json similarity index 100% rename from app/templates/_package.json rename to templates/app/_package.json diff --git a/app/templates/client/.htaccess b/templates/app/client/.htaccess similarity index 100% rename from app/templates/client/.htaccess rename to templates/app/client/.htaccess diff --git a/app/templates/client/.jshintrc(babel) b/templates/app/client/.jshintrc(babel) similarity index 100% rename from app/templates/client/.jshintrc(babel) rename to templates/app/client/.jshintrc(babel) diff --git a/app/templates/client/app/account(auth)/account.js b/templates/app/client/app/account(auth)/account.js similarity index 100% rename from app/templates/client/app/account(auth)/account.js rename to templates/app/client/app/account(auth)/account.js diff --git a/app/templates/client/app/account(auth)/login/login(html).html b/templates/app/client/app/account(auth)/login/login(html).html similarity index 100% rename from app/templates/client/app/account(auth)/login/login(html).html rename to templates/app/client/app/account(auth)/login/login(html).html diff --git a/app/templates/client/app/account(auth)/login/login(jade).jade b/templates/app/client/app/account(auth)/login/login(jade).jade similarity index 100% rename from app/templates/client/app/account(auth)/login/login(jade).jade rename to templates/app/client/app/account(auth)/login/login(jade).jade diff --git a/app/templates/client/app/account(auth)/login/login.controller.js b/templates/app/client/app/account(auth)/login/login.controller.js similarity index 100% rename from app/templates/client/app/account(auth)/login/login.controller.js rename to templates/app/client/app/account(auth)/login/login.controller.js diff --git a/app/templates/client/app/account(auth)/settings/settings(html).html b/templates/app/client/app/account(auth)/settings/settings(html).html similarity index 100% rename from app/templates/client/app/account(auth)/settings/settings(html).html rename to templates/app/client/app/account(auth)/settings/settings(html).html diff --git a/app/templates/client/app/account(auth)/settings/settings(jade).jade b/templates/app/client/app/account(auth)/settings/settings(jade).jade similarity index 100% rename from app/templates/client/app/account(auth)/settings/settings(jade).jade rename to templates/app/client/app/account(auth)/settings/settings(jade).jade diff --git a/app/templates/client/app/account(auth)/settings/settings.controller.js b/templates/app/client/app/account(auth)/settings/settings.controller.js similarity index 100% rename from app/templates/client/app/account(auth)/settings/settings.controller.js rename to templates/app/client/app/account(auth)/settings/settings.controller.js diff --git a/app/templates/client/app/account(auth)/signup/signup(html).html b/templates/app/client/app/account(auth)/signup/signup(html).html similarity index 100% rename from app/templates/client/app/account(auth)/signup/signup(html).html rename to templates/app/client/app/account(auth)/signup/signup(html).html diff --git a/app/templates/client/app/account(auth)/signup/signup(jade).jade b/templates/app/client/app/account(auth)/signup/signup(jade).jade similarity index 100% rename from app/templates/client/app/account(auth)/signup/signup(jade).jade rename to templates/app/client/app/account(auth)/signup/signup(jade).jade diff --git a/app/templates/client/app/account(auth)/signup/signup.controller.js b/templates/app/client/app/account(auth)/signup/signup.controller.js similarity index 100% rename from app/templates/client/app/account(auth)/signup/signup.controller.js rename to templates/app/client/app/account(auth)/signup/signup.controller.js diff --git a/app/templates/client/app/admin(auth)/admin(css).css b/templates/app/client/app/admin(auth)/admin(css).css similarity index 100% rename from app/templates/client/app/admin(auth)/admin(css).css rename to templates/app/client/app/admin(auth)/admin(css).css diff --git a/app/templates/client/app/admin(auth)/admin(html).html b/templates/app/client/app/admin(auth)/admin(html).html similarity index 100% rename from app/templates/client/app/admin(auth)/admin(html).html rename to templates/app/client/app/admin(auth)/admin(html).html diff --git a/app/templates/client/app/admin(auth)/admin(jade).jade b/templates/app/client/app/admin(auth)/admin(jade).jade similarity index 100% rename from app/templates/client/app/admin(auth)/admin(jade).jade rename to templates/app/client/app/admin(auth)/admin(jade).jade diff --git a/app/templates/client/app/admin(auth)/admin(less).less b/templates/app/client/app/admin(auth)/admin(less).less similarity index 100% rename from app/templates/client/app/admin(auth)/admin(less).less rename to templates/app/client/app/admin(auth)/admin(less).less diff --git a/app/templates/client/app/admin(auth)/admin(sass).scss b/templates/app/client/app/admin(auth)/admin(sass).scss similarity index 100% rename from app/templates/client/app/admin(auth)/admin(sass).scss rename to templates/app/client/app/admin(auth)/admin(sass).scss diff --git a/app/templates/client/app/admin(auth)/admin(stylus).styl b/templates/app/client/app/admin(auth)/admin(stylus).styl similarity index 100% rename from app/templates/client/app/admin(auth)/admin(stylus).styl rename to templates/app/client/app/admin(auth)/admin(stylus).styl diff --git a/app/templates/client/app/admin(auth)/admin.controller.js b/templates/app/client/app/admin(auth)/admin.controller.js similarity index 100% rename from app/templates/client/app/admin(auth)/admin.controller.js rename to templates/app/client/app/admin(auth)/admin.controller.js diff --git a/app/templates/client/app/admin(auth)/admin.module.js b/templates/app/client/app/admin(auth)/admin.module.js similarity index 100% rename from app/templates/client/app/admin(auth)/admin.module.js rename to templates/app/client/app/admin(auth)/admin.module.js diff --git a/app/templates/client/app/admin(auth)/admin.router.js b/templates/app/client/app/admin(auth)/admin.router.js similarity index 100% rename from app/templates/client/app/admin(auth)/admin.router.js rename to templates/app/client/app/admin(auth)/admin.router.js diff --git a/app/templates/client/app/app(css).css b/templates/app/client/app/app(css).css similarity index 100% rename from app/templates/client/app/app(css).css rename to templates/app/client/app/app(css).css diff --git a/app/templates/client/app/app(less).less b/templates/app/client/app/app(less).less similarity index 100% rename from app/templates/client/app/app(less).less rename to templates/app/client/app/app(less).less diff --git a/app/templates/client/app/app(sass).scss b/templates/app/client/app/app(sass).scss similarity index 100% rename from app/templates/client/app/app(sass).scss rename to templates/app/client/app/app(sass).scss diff --git a/app/templates/client/app/app(stylus).styl b/templates/app/client/app/app(stylus).styl similarity index 100% rename from app/templates/client/app/app(stylus).styl rename to templates/app/client/app/app(stylus).styl diff --git a/app/templates/client/app/app.js b/templates/app/client/app/app.js similarity index 100% rename from app/templates/client/app/app.js rename to templates/app/client/app/app.js diff --git a/app/templates/client/app/main/main(css).css b/templates/app/client/app/main/main(css).css similarity index 100% rename from app/templates/client/app/main/main(css).css rename to templates/app/client/app/main/main(css).css diff --git a/app/templates/client/app/main/main(html).html b/templates/app/client/app/main/main(html).html similarity index 100% rename from app/templates/client/app/main/main(html).html rename to templates/app/client/app/main/main(html).html diff --git a/app/templates/client/app/main/main(jade).jade b/templates/app/client/app/main/main(jade).jade similarity index 100% rename from app/templates/client/app/main/main(jade).jade rename to templates/app/client/app/main/main(jade).jade diff --git a/app/templates/client/app/main/main(less).less b/templates/app/client/app/main/main(less).less similarity index 100% rename from app/templates/client/app/main/main(less).less rename to templates/app/client/app/main/main(less).less diff --git a/app/templates/client/app/main/main(sass).scss b/templates/app/client/app/main/main(sass).scss similarity index 100% rename from app/templates/client/app/main/main(sass).scss rename to templates/app/client/app/main/main(sass).scss diff --git a/app/templates/client/app/main/main(stylus).styl b/templates/app/client/app/main/main(stylus).styl similarity index 100% rename from app/templates/client/app/main/main(stylus).styl rename to templates/app/client/app/main/main(stylus).styl diff --git a/app/templates/client/app/main/main.controller.js b/templates/app/client/app/main/main.controller.js similarity index 100% rename from app/templates/client/app/main/main.controller.js rename to templates/app/client/app/main/main.controller.js diff --git a/app/templates/client/app/main/main.controller.spec.js b/templates/app/client/app/main/main.controller.spec.js similarity index 100% rename from app/templates/client/app/main/main.controller.spec.js rename to templates/app/client/app/main/main.controller.spec.js diff --git a/app/templates/client/app/main/main.js b/templates/app/client/app/main/main.js similarity index 100% rename from app/templates/client/app/main/main.js rename to templates/app/client/app/main/main.js diff --git a/app/templates/client/assets/images/!yeoman.png b/templates/app/client/assets/images/!yeoman.png similarity index 100% rename from app/templates/client/assets/images/!yeoman.png rename to templates/app/client/assets/images/!yeoman.png diff --git a/app/templates/client/components/auth(auth)/auth.module.js b/templates/app/client/components/auth(auth)/auth.module.js similarity index 100% rename from app/templates/client/components/auth(auth)/auth.module.js rename to templates/app/client/components/auth(auth)/auth.module.js diff --git a/app/templates/client/components/auth(auth)/auth.service.js b/templates/app/client/components/auth(auth)/auth.service.js similarity index 100% rename from app/templates/client/components/auth(auth)/auth.service.js rename to templates/app/client/components/auth(auth)/auth.service.js diff --git a/app/templates/client/components/auth(auth)/interceptor.service.js b/templates/app/client/components/auth(auth)/interceptor.service.js similarity index 100% rename from app/templates/client/components/auth(auth)/interceptor.service.js rename to templates/app/client/components/auth(auth)/interceptor.service.js diff --git a/app/templates/client/components/auth(auth)/router.decorator.js b/templates/app/client/components/auth(auth)/router.decorator.js similarity index 100% rename from app/templates/client/components/auth(auth)/router.decorator.js rename to templates/app/client/components/auth(auth)/router.decorator.js diff --git a/app/templates/client/components/auth(auth)/user.service.js b/templates/app/client/components/auth(auth)/user.service.js similarity index 100% rename from app/templates/client/components/auth(auth)/user.service.js rename to templates/app/client/components/auth(auth)/user.service.js diff --git a/app/templates/client/components/footer/footer(css).css b/templates/app/client/components/footer/footer(css).css similarity index 100% rename from app/templates/client/components/footer/footer(css).css rename to templates/app/client/components/footer/footer(css).css diff --git a/app/templates/client/components/footer/footer(html).html b/templates/app/client/components/footer/footer(html).html similarity index 100% rename from app/templates/client/components/footer/footer(html).html rename to templates/app/client/components/footer/footer(html).html diff --git a/app/templates/client/components/footer/footer(jade).jade b/templates/app/client/components/footer/footer(jade).jade similarity index 100% rename from app/templates/client/components/footer/footer(jade).jade rename to templates/app/client/components/footer/footer(jade).jade diff --git a/app/templates/client/components/footer/footer(less).less b/templates/app/client/components/footer/footer(less).less similarity index 100% rename from app/templates/client/components/footer/footer(less).less rename to templates/app/client/components/footer/footer(less).less diff --git a/app/templates/client/components/footer/footer(sass).scss b/templates/app/client/components/footer/footer(sass).scss similarity index 100% rename from app/templates/client/components/footer/footer(sass).scss rename to templates/app/client/components/footer/footer(sass).scss diff --git a/app/templates/client/components/footer/footer(stylus).styl b/templates/app/client/components/footer/footer(stylus).styl similarity index 100% rename from app/templates/client/components/footer/footer(stylus).styl rename to templates/app/client/components/footer/footer(stylus).styl diff --git a/app/templates/client/components/footer/footer.directive.js b/templates/app/client/components/footer/footer.directive.js similarity index 100% rename from app/templates/client/components/footer/footer.directive.js rename to templates/app/client/components/footer/footer.directive.js diff --git a/app/templates/client/components/modal(uibootstrap)/modal(css).css b/templates/app/client/components/modal(uibootstrap)/modal(css).css similarity index 100% rename from app/templates/client/components/modal(uibootstrap)/modal(css).css rename to templates/app/client/components/modal(uibootstrap)/modal(css).css diff --git a/app/templates/client/components/modal(uibootstrap)/modal(html).html b/templates/app/client/components/modal(uibootstrap)/modal(html).html similarity index 100% rename from app/templates/client/components/modal(uibootstrap)/modal(html).html rename to templates/app/client/components/modal(uibootstrap)/modal(html).html diff --git a/app/templates/client/components/modal(uibootstrap)/modal(jade).jade b/templates/app/client/components/modal(uibootstrap)/modal(jade).jade similarity index 100% rename from app/templates/client/components/modal(uibootstrap)/modal(jade).jade rename to templates/app/client/components/modal(uibootstrap)/modal(jade).jade diff --git a/app/templates/client/components/modal(uibootstrap)/modal(less).less b/templates/app/client/components/modal(uibootstrap)/modal(less).less similarity index 100% rename from app/templates/client/components/modal(uibootstrap)/modal(less).less rename to templates/app/client/components/modal(uibootstrap)/modal(less).less diff --git a/app/templates/client/components/modal(uibootstrap)/modal(sass).scss b/templates/app/client/components/modal(uibootstrap)/modal(sass).scss similarity index 100% rename from app/templates/client/components/modal(uibootstrap)/modal(sass).scss rename to templates/app/client/components/modal(uibootstrap)/modal(sass).scss diff --git a/app/templates/client/components/modal(uibootstrap)/modal(stylus).styl b/templates/app/client/components/modal(uibootstrap)/modal(stylus).styl similarity index 100% rename from app/templates/client/components/modal(uibootstrap)/modal(stylus).styl rename to templates/app/client/components/modal(uibootstrap)/modal(stylus).styl diff --git a/app/templates/client/components/modal(uibootstrap)/modal.service.js b/templates/app/client/components/modal(uibootstrap)/modal.service.js similarity index 100% rename from app/templates/client/components/modal(uibootstrap)/modal.service.js rename to templates/app/client/components/modal(uibootstrap)/modal.service.js diff --git a/app/templates/client/components/mongoose-error(auth)/mongoose-error.directive.js b/templates/app/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 rename to templates/app/client/components/mongoose-error(auth)/mongoose-error.directive.js diff --git a/app/templates/client/components/navbar/navbar(html).html b/templates/app/client/components/navbar/navbar(html).html similarity index 100% rename from app/templates/client/components/navbar/navbar(html).html rename to templates/app/client/components/navbar/navbar(html).html diff --git a/app/templates/client/components/navbar/navbar(jade).jade b/templates/app/client/components/navbar/navbar(jade).jade similarity index 100% rename from app/templates/client/components/navbar/navbar(jade).jade rename to templates/app/client/components/navbar/navbar(jade).jade diff --git a/app/templates/client/components/navbar/navbar.controller.js b/templates/app/client/components/navbar/navbar.controller.js similarity index 100% rename from app/templates/client/components/navbar/navbar.controller.js rename to templates/app/client/components/navbar/navbar.controller.js diff --git a/app/templates/client/components/navbar/navbar.directive.js b/templates/app/client/components/navbar/navbar.directive.js similarity index 100% rename from app/templates/client/components/navbar/navbar.directive.js rename to templates/app/client/components/navbar/navbar.directive.js diff --git a/app/templates/client/components/oauth-buttons(oauth)/oauth-buttons(css).css b/templates/app/client/components/oauth-buttons(oauth)/oauth-buttons(css).css similarity index 100% rename from app/templates/client/components/oauth-buttons(oauth)/oauth-buttons(css).css rename to templates/app/client/components/oauth-buttons(oauth)/oauth-buttons(css).css diff --git a/app/templates/client/components/oauth-buttons(oauth)/oauth-buttons(html).html b/templates/app/client/components/oauth-buttons(oauth)/oauth-buttons(html).html similarity index 100% rename from app/templates/client/components/oauth-buttons(oauth)/oauth-buttons(html).html rename to templates/app/client/components/oauth-buttons(oauth)/oauth-buttons(html).html diff --git a/app/templates/client/components/oauth-buttons(oauth)/oauth-buttons(jade).jade b/templates/app/client/components/oauth-buttons(oauth)/oauth-buttons(jade).jade similarity index 100% rename from app/templates/client/components/oauth-buttons(oauth)/oauth-buttons(jade).jade rename to templates/app/client/components/oauth-buttons(oauth)/oauth-buttons(jade).jade diff --git a/app/templates/client/components/oauth-buttons(oauth)/oauth-buttons(less).less b/templates/app/client/components/oauth-buttons(oauth)/oauth-buttons(less).less similarity index 100% rename from app/templates/client/components/oauth-buttons(oauth)/oauth-buttons(less).less rename to templates/app/client/components/oauth-buttons(oauth)/oauth-buttons(less).less diff --git a/app/templates/client/components/oauth-buttons(oauth)/oauth-buttons(sass).scss b/templates/app/client/components/oauth-buttons(oauth)/oauth-buttons(sass).scss similarity index 100% rename from app/templates/client/components/oauth-buttons(oauth)/oauth-buttons(sass).scss rename to templates/app/client/components/oauth-buttons(oauth)/oauth-buttons(sass).scss diff --git a/app/templates/client/components/oauth-buttons(oauth)/oauth-buttons(stylus).styl b/templates/app/client/components/oauth-buttons(oauth)/oauth-buttons(stylus).styl similarity index 100% rename from app/templates/client/components/oauth-buttons(oauth)/oauth-buttons(stylus).styl rename to templates/app/client/components/oauth-buttons(oauth)/oauth-buttons(stylus).styl diff --git a/app/templates/client/components/oauth-buttons(oauth)/oauth-buttons.controller.js b/templates/app/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 rename to templates/app/client/components/oauth-buttons(oauth)/oauth-buttons.controller.js diff --git a/app/templates/client/components/oauth-buttons(oauth)/oauth-buttons.controller.spec.js b/templates/app/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 rename to templates/app/client/components/oauth-buttons(oauth)/oauth-buttons.controller.spec.js diff --git a/app/templates/client/components/oauth-buttons(oauth)/oauth-buttons.directive.js b/templates/app/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 rename to templates/app/client/components/oauth-buttons(oauth)/oauth-buttons.directive.js diff --git a/app/templates/client/components/oauth-buttons(oauth)/oauth-buttons.directive.spec.js b/templates/app/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 rename to templates/app/client/components/oauth-buttons(oauth)/oauth-buttons.directive.spec.js diff --git a/app/templates/client/components/socket(socketio)/socket.mock.js b/templates/app/client/components/socket(socketio)/socket.mock.js similarity index 100% rename from app/templates/client/components/socket(socketio)/socket.mock.js rename to templates/app/client/components/socket(socketio)/socket.mock.js diff --git a/app/templates/client/components/socket(socketio)/socket.service.js b/templates/app/client/components/socket(socketio)/socket.service.js similarity index 100% rename from app/templates/client/components/socket(socketio)/socket.service.js rename to templates/app/client/components/socket(socketio)/socket.service.js diff --git a/app/templates/client/components/ui-router(uirouter)/ui-router.mock.js b/templates/app/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 rename to templates/app/client/components/ui-router(uirouter)/ui-router.mock.js diff --git a/app/templates/client/components/util/util.module.js b/templates/app/client/components/util/util.module.js similarity index 100% rename from app/templates/client/components/util/util.module.js rename to templates/app/client/components/util/util.module.js diff --git a/app/templates/client/components/util/util.service.js b/templates/app/client/components/util/util.service.js similarity index 100% rename from app/templates/client/components/util/util.service.js rename to templates/app/client/components/util/util.service.js diff --git a/app/templates/client/favicon.ico b/templates/app/client/favicon.ico similarity index 100% rename from app/templates/client/favicon.ico rename to templates/app/client/favicon.ico diff --git a/app/templates/client/index.html b/templates/app/client/index.html similarity index 100% rename from app/templates/client/index.html rename to templates/app/client/index.html diff --git a/app/templates/client/robots.txt b/templates/app/client/robots.txt similarity index 100% rename from app/templates/client/robots.txt rename to templates/app/client/robots.txt diff --git a/app/templates/client/tslint.json(ts) b/templates/app/client/tslint.json(ts) similarity index 100% rename from app/templates/client/tslint.json(ts) rename to templates/app/client/tslint.json(ts) diff --git a/app/templates/e2e/account(auth)/login/login.po.js b/templates/app/e2e/account(auth)/login/login.po.js similarity index 100% rename from app/templates/e2e/account(auth)/login/login.po.js rename to templates/app/e2e/account(auth)/login/login.po.js diff --git a/app/templates/e2e/account(auth)/login/login.spec(jasmine).js b/templates/app/e2e/account(auth)/login/login.spec(jasmine).js similarity index 100% rename from app/templates/e2e/account(auth)/login/login.spec(jasmine).js rename to templates/app/e2e/account(auth)/login/login.spec(jasmine).js diff --git a/app/templates/e2e/account(auth)/login/login.spec(mocha).js b/templates/app/e2e/account(auth)/login/login.spec(mocha).js similarity index 100% rename from app/templates/e2e/account(auth)/login/login.spec(mocha).js rename to templates/app/e2e/account(auth)/login/login.spec(mocha).js diff --git a/app/templates/e2e/account(auth)/logout/logout.spec(jasmine).js b/templates/app/e2e/account(auth)/logout/logout.spec(jasmine).js similarity index 100% rename from app/templates/e2e/account(auth)/logout/logout.spec(jasmine).js rename to templates/app/e2e/account(auth)/logout/logout.spec(jasmine).js diff --git a/app/templates/e2e/account(auth)/logout/logout.spec(mocha).js b/templates/app/e2e/account(auth)/logout/logout.spec(mocha).js similarity index 100% rename from app/templates/e2e/account(auth)/logout/logout.spec(mocha).js rename to templates/app/e2e/account(auth)/logout/logout.spec(mocha).js diff --git a/app/templates/e2e/account(auth)/signup/signup.po.js b/templates/app/e2e/account(auth)/signup/signup.po.js similarity index 100% rename from app/templates/e2e/account(auth)/signup/signup.po.js rename to templates/app/e2e/account(auth)/signup/signup.po.js diff --git a/app/templates/e2e/account(auth)/signup/signup.spec(jasmine).js b/templates/app/e2e/account(auth)/signup/signup.spec(jasmine).js similarity index 100% rename from app/templates/e2e/account(auth)/signup/signup.spec(jasmine).js rename to templates/app/e2e/account(auth)/signup/signup.spec(jasmine).js diff --git a/app/templates/e2e/account(auth)/signup/signup.spec(mocha).js b/templates/app/e2e/account(auth)/signup/signup.spec(mocha).js similarity index 100% rename from app/templates/e2e/account(auth)/signup/signup.spec(mocha).js rename to templates/app/e2e/account(auth)/signup/signup.spec(mocha).js diff --git a/app/templates/e2e/components/navbar/navbar.po.js b/templates/app/e2e/components/navbar/navbar.po.js similarity index 100% rename from app/templates/e2e/components/navbar/navbar.po.js rename to templates/app/e2e/components/navbar/navbar.po.js diff --git a/app/templates/e2e/components/oauth-buttons(oauth)/oauth-buttons.po.js b/templates/app/e2e/components/oauth-buttons(oauth)/oauth-buttons.po.js similarity index 100% rename from app/templates/e2e/components/oauth-buttons(oauth)/oauth-buttons.po.js rename to templates/app/e2e/components/oauth-buttons(oauth)/oauth-buttons.po.js diff --git a/app/templates/e2e/main/main.po.js b/templates/app/e2e/main/main.po.js similarity index 100% rename from app/templates/e2e/main/main.po.js rename to templates/app/e2e/main/main.po.js diff --git a/app/templates/e2e/main/main.spec(jasmine).js b/templates/app/e2e/main/main.spec(jasmine).js similarity index 100% rename from app/templates/e2e/main/main.spec(jasmine).js rename to templates/app/e2e/main/main.spec(jasmine).js diff --git a/app/templates/e2e/main/main.spec(mocha).js b/templates/app/e2e/main/main.spec(mocha).js similarity index 100% rename from app/templates/e2e/main/main.spec(mocha).js rename to templates/app/e2e/main/main.spec(mocha).js diff --git a/app/templates/gulpfile.babel(gulp).js b/templates/app/gulpfile.babel(gulp).js similarity index 100% rename from app/templates/gulpfile.babel(gulp).js rename to templates/app/gulpfile.babel(gulp).js diff --git a/app/templates/karma.conf.js b/templates/app/karma.conf.js similarity index 100% rename from app/templates/karma.conf.js rename to templates/app/karma.conf.js diff --git a/app/templates/mocha.conf.js b/templates/app/mocha.conf.js similarity index 100% rename from app/templates/mocha.conf.js rename to templates/app/mocha.conf.js diff --git a/app/templates/mocha.global(gulp).js b/templates/app/mocha.global(gulp).js similarity index 100% rename from app/templates/mocha.global(gulp).js rename to templates/app/mocha.global(gulp).js diff --git a/app/templates/protractor.conf.js b/templates/app/protractor.conf.js similarity index 100% rename from app/templates/protractor.conf.js rename to templates/app/protractor.conf.js diff --git a/app/templates/server/.jshintrc b/templates/app/server/.jshintrc similarity index 100% rename from app/templates/server/.jshintrc rename to templates/app/server/.jshintrc diff --git a/app/templates/server/.jshintrc-spec b/templates/app/server/.jshintrc-spec similarity index 100% rename from app/templates/server/.jshintrc-spec rename to templates/app/server/.jshintrc-spec diff --git a/app/templates/server/api/user(auth)/index.js b/templates/app/server/api/user(auth)/index.js similarity index 100% rename from app/templates/server/api/user(auth)/index.js rename to templates/app/server/api/user(auth)/index.js diff --git a/app/templates/server/api/user(auth)/index.spec.js b/templates/app/server/api/user(auth)/index.spec.js similarity index 100% rename from app/templates/server/api/user(auth)/index.spec.js rename to templates/app/server/api/user(auth)/index.spec.js diff --git a/app/templates/server/api/user(auth)/user.controller.js b/templates/app/server/api/user(auth)/user.controller.js similarity index 100% rename from app/templates/server/api/user(auth)/user.controller.js rename to templates/app/server/api/user(auth)/user.controller.js diff --git a/app/templates/server/api/user(auth)/user.events.js b/templates/app/server/api/user(auth)/user.events.js similarity index 100% rename from app/templates/server/api/user(auth)/user.events.js rename to templates/app/server/api/user(auth)/user.events.js diff --git a/app/templates/server/api/user(auth)/user.integration.js b/templates/app/server/api/user(auth)/user.integration.js similarity index 100% rename from app/templates/server/api/user(auth)/user.integration.js rename to templates/app/server/api/user(auth)/user.integration.js diff --git a/app/templates/server/api/user(auth)/user.model(mongooseModels).js b/templates/app/server/api/user(auth)/user.model(mongooseModels).js similarity index 100% rename from app/templates/server/api/user(auth)/user.model(mongooseModels).js rename to templates/app/server/api/user(auth)/user.model(mongooseModels).js diff --git a/app/templates/server/api/user(auth)/user.model(sequelizeModels).js b/templates/app/server/api/user(auth)/user.model(sequelizeModels).js similarity index 100% rename from app/templates/server/api/user(auth)/user.model(sequelizeModels).js rename to templates/app/server/api/user(auth)/user.model(sequelizeModels).js diff --git a/app/templates/server/api/user(auth)/user.model.spec(mongooseModels).js b/templates/app/server/api/user(auth)/user.model.spec(mongooseModels).js similarity index 100% rename from app/templates/server/api/user(auth)/user.model.spec(mongooseModels).js rename to templates/app/server/api/user(auth)/user.model.spec(mongooseModels).js diff --git a/app/templates/server/api/user(auth)/user.model.spec(sequelizeModels).js b/templates/app/server/api/user(auth)/user.model.spec(sequelizeModels).js similarity index 100% rename from app/templates/server/api/user(auth)/user.model.spec(sequelizeModels).js rename to templates/app/server/api/user(auth)/user.model.spec(sequelizeModels).js diff --git a/app/templates/server/app.js b/templates/app/server/app.js similarity index 100% rename from app/templates/server/app.js rename to templates/app/server/app.js diff --git a/app/templates/server/auth(auth)/auth.service.js b/templates/app/server/auth(auth)/auth.service.js similarity index 100% rename from app/templates/server/auth(auth)/auth.service.js rename to templates/app/server/auth(auth)/auth.service.js diff --git a/app/templates/server/auth(auth)/facebook(facebookAuth)/index.js b/templates/app/server/auth(auth)/facebook(facebookAuth)/index.js similarity index 100% rename from app/templates/server/auth(auth)/facebook(facebookAuth)/index.js rename to templates/app/server/auth(auth)/facebook(facebookAuth)/index.js diff --git a/app/templates/server/auth(auth)/facebook(facebookAuth)/passport.js b/templates/app/server/auth(auth)/facebook(facebookAuth)/passport.js similarity index 100% rename from app/templates/server/auth(auth)/facebook(facebookAuth)/passport.js rename to templates/app/server/auth(auth)/facebook(facebookAuth)/passport.js diff --git a/app/templates/server/auth(auth)/google(googleAuth)/index.js b/templates/app/server/auth(auth)/google(googleAuth)/index.js similarity index 100% rename from app/templates/server/auth(auth)/google(googleAuth)/index.js rename to templates/app/server/auth(auth)/google(googleAuth)/index.js diff --git a/app/templates/server/auth(auth)/google(googleAuth)/passport.js b/templates/app/server/auth(auth)/google(googleAuth)/passport.js similarity index 100% rename from app/templates/server/auth(auth)/google(googleAuth)/passport.js rename to templates/app/server/auth(auth)/google(googleAuth)/passport.js diff --git a/app/templates/server/auth(auth)/index.js b/templates/app/server/auth(auth)/index.js similarity index 100% rename from app/templates/server/auth(auth)/index.js rename to templates/app/server/auth(auth)/index.js diff --git a/app/templates/server/auth(auth)/local/index.js b/templates/app/server/auth(auth)/local/index.js similarity index 100% rename from app/templates/server/auth(auth)/local/index.js rename to templates/app/server/auth(auth)/local/index.js diff --git a/app/templates/server/auth(auth)/local/passport.js b/templates/app/server/auth(auth)/local/passport.js similarity index 100% rename from app/templates/server/auth(auth)/local/passport.js rename to templates/app/server/auth(auth)/local/passport.js diff --git a/app/templates/server/auth(auth)/twitter(twitterAuth)/index.js b/templates/app/server/auth(auth)/twitter(twitterAuth)/index.js similarity index 100% rename from app/templates/server/auth(auth)/twitter(twitterAuth)/index.js rename to templates/app/server/auth(auth)/twitter(twitterAuth)/index.js diff --git a/app/templates/server/auth(auth)/twitter(twitterAuth)/passport.js b/templates/app/server/auth(auth)/twitter(twitterAuth)/passport.js similarity index 100% rename from app/templates/server/auth(auth)/twitter(twitterAuth)/passport.js rename to templates/app/server/auth(auth)/twitter(twitterAuth)/passport.js diff --git a/app/templates/server/components/errors/index.js b/templates/app/server/components/errors/index.js similarity index 100% rename from app/templates/server/components/errors/index.js rename to templates/app/server/components/errors/index.js diff --git a/app/templates/server/config/_local.env.js b/templates/app/server/config/_local.env.js similarity index 100% rename from app/templates/server/config/_local.env.js rename to templates/app/server/config/_local.env.js diff --git a/app/templates/server/config/_local.env.sample.js b/templates/app/server/config/_local.env.sample.js similarity index 100% rename from app/templates/server/config/_local.env.sample.js rename to templates/app/server/config/_local.env.sample.js diff --git a/app/templates/server/config/environment/development.js b/templates/app/server/config/environment/development.js similarity index 100% rename from app/templates/server/config/environment/development.js rename to templates/app/server/config/environment/development.js diff --git a/app/templates/server/config/environment/index.js b/templates/app/server/config/environment/index.js similarity index 100% rename from app/templates/server/config/environment/index.js rename to templates/app/server/config/environment/index.js diff --git a/app/templates/server/config/environment/production.js b/templates/app/server/config/environment/production.js similarity index 100% rename from app/templates/server/config/environment/production.js rename to templates/app/server/config/environment/production.js diff --git a/app/templates/server/config/environment/shared.js b/templates/app/server/config/environment/shared.js similarity index 100% rename from app/templates/server/config/environment/shared.js rename to templates/app/server/config/environment/shared.js diff --git a/app/templates/server/config/environment/test.js b/templates/app/server/config/environment/test.js similarity index 100% rename from app/templates/server/config/environment/test.js rename to templates/app/server/config/environment/test.js diff --git a/app/templates/server/config/express.js b/templates/app/server/config/express.js similarity index 100% rename from app/templates/server/config/express.js rename to templates/app/server/config/express.js diff --git a/app/templates/server/config/seed(models).js b/templates/app/server/config/seed(models).js similarity index 100% rename from app/templates/server/config/seed(models).js rename to templates/app/server/config/seed(models).js diff --git a/app/templates/server/config/socketio(socketio).js b/templates/app/server/config/socketio(socketio).js similarity index 100% rename from app/templates/server/config/socketio(socketio).js rename to templates/app/server/config/socketio(socketio).js diff --git a/app/templates/server/index.js b/templates/app/server/index.js similarity index 100% rename from app/templates/server/index.js rename to templates/app/server/index.js diff --git a/app/templates/server/routes.js b/templates/app/server/routes.js similarity index 100% rename from app/templates/server/routes.js rename to templates/app/server/routes.js diff --git a/app/templates/server/sqldb(sequelize)/index.js b/templates/app/server/sqldb(sequelize)/index.js similarity index 100% rename from app/templates/server/sqldb(sequelize)/index.js rename to templates/app/server/sqldb(sequelize)/index.js diff --git a/app/templates/server/views/404(html).html b/templates/app/server/views/404(html).html similarity index 100% rename from app/templates/server/views/404(html).html rename to templates/app/server/views/404(html).html diff --git a/app/templates/server/views/404(jade).jade b/templates/app/server/views/404(jade).jade similarity index 100% rename from app/templates/server/views/404(jade).jade rename to templates/app/server/views/404(jade).jade diff --git a/app/templates/tsconfig.client(ts).json b/templates/app/tsconfig.client(ts).json similarity index 100% rename from app/templates/tsconfig.client(ts).json rename to templates/app/tsconfig.client(ts).json diff --git a/app/templates/tsconfig.client.test(ts).json b/templates/app/tsconfig.client.test(ts).json similarity index 100% rename from app/templates/tsconfig.client.test(ts).json rename to templates/app/tsconfig.client.test(ts).json diff --git a/app/templates/tsd(ts).json b/templates/app/tsd(ts).json similarity index 100% rename from app/templates/tsd(ts).json rename to templates/app/tsd(ts).json diff --git a/app/templates/tsd_test(ts).json b/templates/app/tsd_test(ts).json similarity index 100% rename from app/templates/tsd_test(ts).json rename to templates/app/tsd_test(ts).json diff --git a/endpoint/templates/basename.controller.js b/templates/endpoint/basename.controller.js similarity index 100% rename from endpoint/templates/basename.controller.js rename to templates/endpoint/basename.controller.js diff --git a/endpoint/templates/basename.events(models).js b/templates/endpoint/basename.events(models).js similarity index 100% rename from endpoint/templates/basename.events(models).js rename to templates/endpoint/basename.events(models).js diff --git a/endpoint/templates/basename.integration.js b/templates/endpoint/basename.integration.js similarity index 100% rename from endpoint/templates/basename.integration.js rename to templates/endpoint/basename.integration.js diff --git a/endpoint/templates/basename.model(mongooseModels).js b/templates/endpoint/basename.model(mongooseModels).js similarity index 100% rename from endpoint/templates/basename.model(mongooseModels).js rename to templates/endpoint/basename.model(mongooseModels).js diff --git a/endpoint/templates/basename.model(sequelizeModels).js b/templates/endpoint/basename.model(sequelizeModels).js similarity index 100% rename from endpoint/templates/basename.model(sequelizeModels).js rename to templates/endpoint/basename.model(sequelizeModels).js diff --git a/endpoint/templates/basename.socket(socketio).js b/templates/endpoint/basename.socket(socketio).js similarity index 100% rename from endpoint/templates/basename.socket(socketio).js rename to templates/endpoint/basename.socket(socketio).js diff --git a/endpoint/templates/index.js b/templates/endpoint/index.js similarity index 100% rename from endpoint/templates/index.js rename to templates/endpoint/index.js diff --git a/endpoint/templates/index.spec.js b/templates/endpoint/index.spec.js similarity index 100% rename from endpoint/templates/index.spec.js rename to templates/endpoint/index.spec.js From 104efc635b15e76bba5a48dfadfeb6e4f4fd91fb Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Sat, 23 Apr 2016 19:26:34 -0400 Subject: [PATCH 055/885] fix(gen:grunt): update paths --- Gruntfile.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index ca5178fc7..37efd2c0d 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -87,7 +87,7 @@ module.exports = function (grunt) { curly: false, node: true }, - all: ['Gruntfile.js', '*/index.js'] + all: ['Gruntfile.js', 'src/**/*.js'] }, env: { fast: { @@ -276,8 +276,8 @@ module.exports = function (grunt) { 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'); + processJson('templates/app/_package.json', dest + 'package.json'); + processJson('templates/app/_bower.json', dest + 'bower.json'); }); grunt.registerTask('installFixtures', 'install package and bower fixtures', function() { From d970e5cc91c2fdf2dd2d30935cf9825026ae1e07 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Sat, 23 Apr 2016 19:27:19 -0400 Subject: [PATCH 056/885] refactor(gen:endpoint): remove deprecated NamedBase --- src/endpoint/index.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/endpoint/index.js b/src/endpoint/index.js index 9ea93f7e8..675e61c07 100644 --- a/src/endpoint/index.js +++ b/src/endpoint/index.js @@ -1,14 +1,16 @@ 'use strict'; import path from 'path'; -import {NamedBase} from 'yeoman-generator'; +import {Base} from 'yeoman-generator'; import {genNamedBase} from '../generator-base'; -export class Generator extends NamedBase { +export class Generator extends Base { constructor(...args) { super(...args); + this.argument('name', { type: String, required: true }); + this.option('route', { desc: 'URL for the endpoint', type: String From 73238813a3a01f4d88345454c2d59804d02d1390 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Sat, 23 Apr 2016 19:27:38 -0400 Subject: [PATCH 057/885] fix(test): update paths --- test/test-file-creation.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/test-file-creation.js b/test/test-file-creation.js index 80ae2538c..a61a2ad87 100644 --- a/test/test-file-creation.js +++ b/test/test-file-creation.js @@ -351,8 +351,8 @@ describe('angular-fullstack generator', function () { beforeEach(function (done) { this.timeout(10000); var deps = [ - '../../app', - '../../endpoint', + '../../generators/app', + '../../generators/endpoint', [ helpers.createDummyGenerator(), 'ng-component:app' From 97d7fcc3c2ccf6529fc367287a38335d3720cb15 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Sat, 23 Apr 2016 19:38:32 -0400 Subject: [PATCH 058/885] chore(npm): add a few more files to `.npmignore` [skip ci] --- .npmignore | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.npmignore b/.npmignore index 58e92379e..29dc7d501 100644 --- a/.npmignore +++ b/.npmignore @@ -5,3 +5,7 @@ src scripts ISSUE_TEMPLATE.md PULL_REQUEST_TEMPLATE.md +.travis.yml +gulpfile.babel.js +Gruntfile.js +.jshintrc From 61f70f626ccebd308c28dd7c4dad8ef29fec63fa Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Sat, 23 Apr 2016 19:44:38 -0400 Subject: [PATCH 059/885] fix(test): add `gulp build` to npm `test` script (I know, gulp thing, then grunt thing, get over it) --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 0db5e59e0..5483708c7 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "url": "git://github.com/angular-fullstack/generator-angular-fullstack.git" }, "scripts": { - "test": "grunt test" + "test": "gulp build && grunt test" }, "dependencies": { "babel-plugin-syntax-class-properties": "^6.5.0", From c857b2742f9251afe715908a28502b845b7b8e23 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Sat, 23 Apr 2016 19:56:36 -0400 Subject: [PATCH 060/885] fix(package): include gulp devDependency --- package.json | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 5483708c7..6af1f196d 100644 --- a/package.json +++ b/package.json @@ -50,10 +50,10 @@ "yeoman-welcome": "^1.0.1" }, "devDependencies": { - "chai": "^3.2.0", - "babel-register": "^6.6.5", - "babel-preset-es2015": "^6.6.0", "babel-plugin-transform-class-properties": "^6.6.0", + "babel-preset-es2015": "^6.6.0", + "babel-register": "^6.6.5", + "chai": "^3.2.0", "del": "^2.2.0", "grunt": "^1.0.1", "grunt-build-control": "^0.7.0", @@ -64,6 +64,7 @@ "grunt-env": "^0.4.1", "grunt-mocha-test": "^0.12.7", "grunt-release": "^0.13.0", + "gulp": "^3.9.1", "jit-grunt": "~0.10.0", "mocha": "^2.2.5", "q": "^1.0.1", From 07b6f8bc79443fc84dcc55389924a4f61614543d Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Sat, 23 Apr 2016 20:36:49 -0400 Subject: [PATCH 061/885] fix(test): fix some more paths --- test/test-file-creation.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/test-file-creation.js b/test/test-file-creation.js index a61a2ad87..b2e4c59d8 100644 --- a/test/test-file-creation.js +++ b/test/test-file-creation.js @@ -484,8 +484,8 @@ describe('angular-fullstack generator', function () { this.timeout(60000); copySync(__dirname + '/fixtures/.yo-rc.json', __dirname + '/temp/.yo-rc.json'); var gen = helpers.createGenerator('angular-fullstack:app', [ - '../../app', - '../../endpoint', + '../../generators/app', + '../../generators/endpoint', [ helpers.createDummyGenerator(), 'ng-component:app' From c5a1b41820ac269a1fac160d8a8817f9a0445d36 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Sat, 23 Apr 2016 21:16:40 -0400 Subject: [PATCH 062/885] fix(test): fix another path! fml! I'm dying inside --- test/test-file-creation.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test-file-creation.js b/test/test-file-creation.js index b2e4c59d8..5c4c29e5d 100644 --- a/test/test-file-creation.js +++ b/test/test-file-creation.js @@ -32,7 +32,7 @@ describe('angular-fullstack generator', function () { function generatorTest(generatorType, name, mockPrompt, callback) { gen.run(function () { var afGenerator; - var deps = [path.join('../..', generatorType)]; + var deps = [path.join('../../generators', generatorType)]; afGenerator = helpers.createGenerator('angular-fullstack:' + generatorType, deps, [name], { skipInstall: true }); From 11f5719efecadceaaa05b0e172dbb325c9b0ff72 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Sat, 23 Apr 2016 22:06:46 -0400 Subject: [PATCH 063/885] refactor(gen:gulp): don't use babel --- gulpfile.babel.js => gulpfile.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) rename gulpfile.babel.js => gulpfile.js (75%) diff --git a/gulpfile.babel.js b/gulpfile.js similarity index 75% rename from gulpfile.babel.js rename to gulpfile.js index a8c2ecfe1..6636000b2 100644 --- a/gulpfile.babel.js +++ b/gulpfile.js @@ -1,10 +1,8 @@ 'use strict'; -// import _ from 'lodash'; -// import fs from 'fs'; -import gulp from 'gulp'; -import babel from 'gulp-babel'; -import del from 'del'; -import runSequence from 'run-sequence'; +var gulp = require('gulp'); +var babel = require('gulp-babel'); +var del = require('del'); +var runSequence = require('run-sequence'); gulp.task('clean', () => { return del(['generators/**/*']); From 94d69dae395911fd1a0a6442257a89182081306f Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Sat, 23 Apr 2016 22:39:32 -0400 Subject: [PATCH 064/885] feat(gen:gulp): port updateFixtures to Gulp (hot damn is it faster :fire:) [skip ci] --- gulpfile.js | 47 +++++++++++++++++++++++++++++++++++++++++++++++ package.json | 1 + 2 files changed, 48 insertions(+) diff --git a/gulpfile.js b/gulpfile.js index 6636000b2..f98f08d45 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -1,4 +1,7 @@ 'use strict'; +var fs = require('fs'); +var path = require('path'); +var Promise = require('bluebird'); var gulp = require('gulp'); var babel = require('gulp-babel'); var del = require('del'); @@ -31,3 +34,47 @@ gulp.task('build', cb => { cb ); }); + +var processJson = function(src, dest, opt) { + return new Promise((resolve, reject) => { + // read file, strip all ejs conditionals, and parse as json + fs.readFile(path.resolve(src), 'utf8', (err, data) => { + if(err) return reject(err); + + var json = JSON.parse(data.replace(/<%(.*)%>/g, '')); + + // set properties + json.name = opt.appName; + json.version = opt.genVer; + json.private = opt.private; + + // stringify json and write it to the destination + fs.writeFile(path.resolve(dest), JSON.stringify(json, null, 2), err => { + if(err) reject(err); + else resolve(); + }); + }); + }); +}; + +function updateFixtures(target) { + const deps = target === 'deps'; + const genVer = require('./package.json').version; + const dest = __dirname + (deps ? '/angular-fullstack-deps/' : '/test/fixtures/'); + const appName = deps ? 'angular-fullstack-deps' : 'tempApp'; + + return Promise.all([ + processJson('templates/app/_package.json', dest + 'package.json', {appName, genVer, private: !!deps}), + processJson('templates/app/_bower.json', dest + 'bower.json', {appName, genVer, private: !!deps}) + ]); +} + +gulp.task('updateFixtures', cb => { + return runSequence(['updateFixtures:test', 'updateFixtures:deps'], cb); +}); +gulp.task('updateFixtures:test', () => { + return updateFixtures('test'); +}); +gulp.task('updateFixtures:deps', () => { + return updateFixtures('deps'); +}); diff --git a/package.json b/package.json index 6af1f196d..7f10960f0 100644 --- a/package.json +++ b/package.json @@ -53,6 +53,7 @@ "babel-plugin-transform-class-properties": "^6.6.0", "babel-preset-es2015": "^6.6.0", "babel-register": "^6.6.5", + "bluebird": "^3.3.5", "chai": "^3.2.0", "del": "^2.2.0", "grunt": "^1.0.1", From a2cecab2c70a02e7b918e7520ce58725185aadd7 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Sat, 23 Apr 2016 22:41:11 -0400 Subject: [PATCH 065/885] fix(gen:gulp:updateFixtures): fix saving as private/public [skip ci] --- gulpfile.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index f98f08d45..ba2b2dab7 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -64,8 +64,8 @@ function updateFixtures(target) { const appName = deps ? 'angular-fullstack-deps' : 'tempApp'; return Promise.all([ - processJson('templates/app/_package.json', dest + 'package.json', {appName, genVer, private: !!deps}), - processJson('templates/app/_bower.json', dest + 'bower.json', {appName, genVer, private: !!deps}) + processJson('templates/app/_package.json', dest + 'package.json', {appName, genVer, private: !deps}), + processJson('templates/app/_bower.json', dest + 'bower.json', {appName, genVer, private: !deps}) ]); } From db3d9e783f317cd5cde1426e1c2283acc7521c6c Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Sat, 23 Apr 2016 22:46:36 -0400 Subject: [PATCH 066/885] feat(gen:gulp:updateFixtures): stop deleting the deps description! [skip ci] --- gulpfile.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gulpfile.js b/gulpfile.js index ba2b2dab7..7aeb1de2c 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -45,6 +45,9 @@ var processJson = function(src, dest, opt) { // set properties json.name = opt.appName; + json.description = opt.private + ? null + : 'The purpose of this repository is to track all the possible dependencies of an application created by generator-angular-fullstack.'; json.version = opt.genVer; json.private = opt.private; From 04b42d4421b732bec8fc90f547ed1895dd06370a Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Sat, 23 Apr 2016 22:57:47 -0400 Subject: [PATCH 067/885] 3.7.0-beta.1 --- angular-fullstack-deps | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/angular-fullstack-deps b/angular-fullstack-deps index efd5dd3fb..7bfa34baa 160000 --- a/angular-fullstack-deps +++ b/angular-fullstack-deps @@ -1 +1 @@ -Subproject commit efd5dd3fb81daafcea3a1da6df1fde64c7d8084c +Subproject commit 7bfa34baa078ab2ee9d7be5850c568b968566fd0 diff --git a/package.json b/package.json index 1a68c954c..766158e47 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "generator-angular-fullstack", - "version": "3.6.1", + "version": "3.7.0-beta.1", "description": "Yeoman generator for creating MEAN stack applications, using MongoDB, Express, AngularJS, and Node", "keywords": [ "yeoman-generator", From bdf1e4a803f824d6ff05919115556964152ab00d Mon Sep 17 00:00:00 2001 From: David Rodriguez Date: Thu, 24 Mar 2016 21:18:04 -0400 Subject: [PATCH 068/885] fix(package): always make html2js a dependency When you generate with the Jade option, the Karma.conf file still keeps the config for ng-html2js for any html files that may be present. This fix makes it so we always add the ng-html2js dependency to package.json to fix that. Closes #1722 --- 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 87ec90858..3f51be985 100644 --- a/app/templates/_package.json +++ b/app/templates/_package.json @@ -155,8 +155,8 @@ "karma-requirejs": "~0.2.2", "karma-jade-preprocessor": "0.0.11", "karma-phantomjs-launcher": "~1.0.0",<% if (filters.jade) { %> - "karma-ng-jade2js-preprocessor": "^0.2.0",<% } else { %> - "karma-ng-html2js-preprocessor": "~0.2.0",<% } %> + "karma-ng-jade2js-preprocessor": "^0.2.0",<% } %> + "karma-ng-html2js-preprocessor": "~0.2.0", "karma-spec-reporter": "~0.0.20", "sinon-chai": "^2.8.0", "mocha": "^2.2.5",<% if (filters.mocha) { %> From eafc4e07fe9b412f35243f98857e59d754a307f2 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Mon, 25 Apr 2016 11:16:36 -0400 Subject: [PATCH 069/885] fix(client): remove no-empty from tslint.json --- app/templates/client/tslint.json(ts) | 1 - 1 file changed, 1 deletion(-) diff --git a/app/templates/client/tslint.json(ts) b/app/templates/client/tslint.json(ts) index 8870b5fe1..6809bfe0c 100644 --- a/app/templates/client/tslint.json(ts) +++ b/app/templates/client/tslint.json(ts) @@ -21,7 +21,6 @@ "no-debugger": true, "no-duplicate-key": true, "no-duplicate-variable": true, - "no-empty": true, "no-eval": true, "no-inferrable-types": true, "no-shadowed-variable": true, From 621acecb0f25ff5531c4e66d931877e2ff738c1f Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Mon, 25 Apr 2016 11:27:25 -0400 Subject: [PATCH 070/885] chore(package): add prepublish (gulp build) --- package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 766158e47..7cc2759bf 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,8 @@ "url": "git://github.com/angular-fullstack/generator-angular-fullstack.git" }, "scripts": { - "test": "gulp build && grunt test" + "test": "gulp build && grunt test", + "prepublish": "gulp build" }, "dependencies": { "babel-plugin-syntax-class-properties": "^6.5.0", From c0c9256bd11137ca31bdccfc11530ab6ee5d9406 Mon Sep 17 00:00:00 2001 From: greenkeeperio-bot Date: Mon, 25 Apr 2016 17:43:26 -0400 Subject: [PATCH 071/885] chore(package): update shelljs to version 0.7.0 https://greenkeeper.io/ --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d901622f5..9ce89d117 100644 --- a/package.json +++ b/package.json @@ -62,7 +62,7 @@ "mocha": "^2.2.5", "q": "^1.0.1", "recursive-readdir": "^2.0.0", - "shelljs": "^0.6.0", + "shelljs": "^0.7.0", "yeoman-assert": "^2.0.0", "yeoman-test": "^1.1.0" }, From f07b4510b533704689549238762d093cfc969f33 Mon Sep 17 00:00:00 2001 From: Koslun Date: Tue, 26 Apr 2016 16:23:37 +0200 Subject: [PATCH 072/885] fix(gulp): fix racing condition for copy:constant Set task constant as dependency to copy:constant and remove constant as dependency to transpile:client. As it then becomes redundant. Closes #1830 --- app/templates/gulpfile.babel(gulp).js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/templates/gulpfile.babel(gulp).js b/app/templates/gulpfile.babel(gulp).js index 4dd1b13e3..17b27b895 100644 --- a/app/templates/gulpfile.babel(gulp).js +++ b/app/templates/gulpfile.babel(gulp).js @@ -305,12 +305,12 @@ gulp.task('styles', () => { .pipe(gulp.dest('.tmp/app')); });<% if(filters.ts) { %> -gulp.task('copy:constant', () => { +gulp.task('copy:constant', ['constant'], () => { return gulp.src(`${clientPath}/app/app.constant.js`, { dot: true }) .pipe(gulp.dest('.tmp/app')); }) -gulp.task('transpile:client', ['tsd', 'constant', 'copy:constant'], () => { +gulp.task('transpile:client', ['tsd', 'copy:constant'], () => { let tsProject = plugins.typescript.createProject('./tsconfig.client.json'); return tsProject.src() .pipe(plugins.sourcemaps.init()) From 17cb4e44cc682a7e0e83a00e12418bf09eaf2fe2 Mon Sep 17 00:00:00 2001 From: Koslun Date: Thu, 28 Apr 2016 18:10:38 +0200 Subject: [PATCH 073/885] feat(gulp:ts): inject client .ts test files automatically into config file. Refactor .ts injection of client .ts files into ts config file into function. Use new function to also inject client .ts test files given glob and config file. Closes #1828 --- app/templates/gulpfile.babel(gulp).js | 30 ++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/app/templates/gulpfile.babel(gulp).js b/app/templates/gulpfile.babel(gulp).js index 17b27b895..e69e20533 100644 --- a/app/templates/gulpfile.babel(gulp).js +++ b/app/templates/gulpfile.babel(gulp).js @@ -227,15 +227,11 @@ gulp.task('inject:js', () => { .pipe(gulp.dest(clientPath)); });<% if(filters.ts) { %> -gulp.task('inject:tsconfig', () => { - let src = gulp.src([ - `${clientPath}/**/!(*.spec|*.mock).ts`, - `!${clientPath}/bower_components/**/*`, - `${clientPath}/typings/**/*.d.ts` - ], {read: false}) +function injectTsConfig(filesGlob, tsconfigPath){ + let src = gulp.src(filesGlob, {read: false}) .pipe(plugins.sort()); - return gulp.src('./tsconfig.client.json') + return gulp.src(tsconfigPath) .pipe(plugins.inject(src, { starttag: '"files": [', endtag: ']', @@ -244,6 +240,26 @@ gulp.task('inject:tsconfig', () => { } })) .pipe(gulp.dest('./')); +} + +gulp.task('inject:tsconfig', () => { + return injectTsConfig([ + `${clientPath}/**/!(*.spec|*.mock).ts`, + `!${clientPath}/bower_components/**/*`, + `${clientPath}/typings/**/*.d.ts`, + `!${clientPath}/test_typings/**/*.d.ts` + ], + './tsconfig.client.json'); +}); + +gulp.task('inject:tsconfigTest', () => { + return injectTsConfig([ + `${clientPath}/**/+(*.spec|*.mock).ts`, + `!${clientPath}/bower_components/**/*`, + `!${clientPath}/typings/**/*.d.ts`, + `${clientPath}/test_typings/**/*.d.ts` + ], + './tsconfig.client.test.json'); });<% } %> gulp.task('inject:css', () => { From ecea98978028fac42f459802555d242121406be7 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Sat, 30 Apr 2016 14:52:16 -0400 Subject: [PATCH 074/885] docs(github): add `tests pass` task to PR template --- PULL_REQUEST_TEMPLATE.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/PULL_REQUEST_TEMPLATE.md b/PULL_REQUEST_TEMPLATE.md index 519809893..c6b7b868e 100644 --- a/PULL_REQUEST_TEMPLATE.md +++ b/PULL_REQUEST_TEMPLATE.md @@ -1,2 +1,3 @@ - [ ] I have read the [Contributing Documents](https://github.com/DaftMonk/generator-angular-fullstack/blob/master/contributing.md) -- [ ] My commit(s) follow the [AngularJS commit message guidelines](https://docs.google.com/document/d/1QrDFcIiPjSLDn3EL15IJygNPiHORgU1_OOAqWjiDU5Y/) \ No newline at end of file +- [ ] My commit(s) follow the [AngularJS commit message guidelines](https://docs.google.com/document/d/1QrDFcIiPjSLDn3EL15IJygNPiHORgU1_OOAqWjiDU5Y/) +- [ ] The generator's tests pass (`generator-angular-fullstack$ npm test`) From e09fb76c3380c36e8378880703e9e5b95659ed6b Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Sun, 24 Apr 2016 00:02:15 -0400 Subject: [PATCH 075/885] feat(gen): also build test dir (just like generators dir) --- .gitignore | 8 ++--- gulpfile.js | 16 +++++++-- package.json | 1 + src/{ => generators}/app/USAGE | 0 src/{ => generators}/app/index.js | 0 src/{ => generators}/controller/index.js | 0 src/{ => generators}/decorator/index.js | 0 src/{ => generators}/directive/index.js | 0 src/{ => generators}/endpoint/index.js | 0 src/{ => generators}/factory/index.js | 0 src/{ => generators}/filter/index.js | 0 src/{ => generators}/generator-base.js | 0 src/{ => generators}/heroku/USAGE | 0 src/{ => generators}/heroku/index.js | 0 .../heroku/templates/Procfile | 0 src/{ => generators}/insight-init.js | 0 src/{ => generators}/openshift/USAGE | 0 src/{ => generators}/openshift/index.js | 0 .../openshift/templates/hot_deploy | 0 src/{ => generators}/provider/index.js | 0 src/{ => generators}/route/index.js | 0 src/{ => generators}/service/index.js | 0 src/{ => generators}/util.js | 0 src/test/fixtures/.bowerrc | 3 ++ src/test/fixtures/.yo-rc.json | 36 +++++++++++++++++++ {test => src/test}/test-file-creation.js | 0 26 files changed, 57 insertions(+), 7 deletions(-) rename src/{ => generators}/app/USAGE (100%) rename src/{ => generators}/app/index.js (100%) rename src/{ => generators}/controller/index.js (100%) rename src/{ => generators}/decorator/index.js (100%) rename src/{ => generators}/directive/index.js (100%) rename src/{ => generators}/endpoint/index.js (100%) rename src/{ => generators}/factory/index.js (100%) rename src/{ => generators}/filter/index.js (100%) rename src/{ => generators}/generator-base.js (100%) rename src/{ => generators}/heroku/USAGE (100%) rename src/{ => generators}/heroku/index.js (100%) rename src/{ => generators}/heroku/templates/Procfile (100%) rename src/{ => generators}/insight-init.js (100%) rename src/{ => generators}/openshift/USAGE (100%) rename src/{ => generators}/openshift/index.js (100%) rename src/{ => generators}/openshift/templates/hot_deploy (100%) rename src/{ => generators}/provider/index.js (100%) rename src/{ => generators}/route/index.js (100%) rename src/{ => generators}/service/index.js (100%) rename src/{ => generators}/util.js (100%) create mode 100644 src/test/fixtures/.bowerrc create mode 100644 src/test/fixtures/.yo-rc.json rename {test => src/test}/test-file-creation.js (100%) diff --git a/.gitignore b/.gitignore index f9b1763a8..230257f1f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,10 +1,8 @@ node_modules bower_components -test/temp +/generators/* +/test/* demo .idea .DS_Store -release.txt -test/fixtures/bower.json -test/fixtures/package.json -generators \ No newline at end of file +release.txt \ No newline at end of file diff --git a/gulpfile.js b/gulpfile.js index 7aeb1de2c..2fa763455 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -6,15 +6,22 @@ var gulp = require('gulp'); var babel = require('gulp-babel'); var del = require('del'); var runSequence = require('run-sequence'); +var merge = require('merge-stream'); gulp.task('clean', () => { return del(['generators/**/*']); }); gulp.task('babel', () => { - return gulp.src(['src/**/*.js']) + let generators = gulp.src(['src/generators/**/*.js']) .pipe(babel()) .pipe(gulp.dest('generators')); + + let test = gulp.src(['src/test/**/*.js']) + .pipe(babel()) + .pipe(gulp.dest('test')); + + return merge(generators); }); gulp.task('watch', () => { @@ -22,8 +29,13 @@ gulp.task('watch', () => { }); gulp.task('copy', () => { - return gulp.src(['src/**/*', '!src/**/*.js']) + let nonJsGen = gulp.src(['src/generators/**/*', '!src/generators/**/*.js'], {dot: true}) .pipe(gulp.dest('generators')); + + let nonJsTest = gulp.src(['src/test/**/*', '!src/test/**/*.js'], {dot: true}) + .pipe(gulp.dest('test')); + + return merge(nonJsGen, nonJsTest); }); gulp.task('build', cb => { diff --git a/package.json b/package.json index 7cc2759bf..a6f769767 100644 --- a/package.json +++ b/package.json @@ -68,6 +68,7 @@ "grunt-release": "^0.13.0", "gulp": "^3.9.1", "jit-grunt": "~0.10.0", + "merge-stream": "^1.0.0", "mocha": "^2.2.5", "q": "^1.0.1", "recursive-readdir": "^2.0.0", diff --git a/src/app/USAGE b/src/generators/app/USAGE similarity index 100% rename from src/app/USAGE rename to src/generators/app/USAGE diff --git a/src/app/index.js b/src/generators/app/index.js similarity index 100% rename from src/app/index.js rename to src/generators/app/index.js diff --git a/src/controller/index.js b/src/generators/controller/index.js similarity index 100% rename from src/controller/index.js rename to src/generators/controller/index.js diff --git a/src/decorator/index.js b/src/generators/decorator/index.js similarity index 100% rename from src/decorator/index.js rename to src/generators/decorator/index.js diff --git a/src/directive/index.js b/src/generators/directive/index.js similarity index 100% rename from src/directive/index.js rename to src/generators/directive/index.js diff --git a/src/endpoint/index.js b/src/generators/endpoint/index.js similarity index 100% rename from src/endpoint/index.js rename to src/generators/endpoint/index.js diff --git a/src/factory/index.js b/src/generators/factory/index.js similarity index 100% rename from src/factory/index.js rename to src/generators/factory/index.js diff --git a/src/filter/index.js b/src/generators/filter/index.js similarity index 100% rename from src/filter/index.js rename to src/generators/filter/index.js diff --git a/src/generator-base.js b/src/generators/generator-base.js similarity index 100% rename from src/generator-base.js rename to src/generators/generator-base.js diff --git a/src/heroku/USAGE b/src/generators/heroku/USAGE similarity index 100% rename from src/heroku/USAGE rename to src/generators/heroku/USAGE diff --git a/src/heroku/index.js b/src/generators/heroku/index.js similarity index 100% rename from src/heroku/index.js rename to src/generators/heroku/index.js diff --git a/src/heroku/templates/Procfile b/src/generators/heroku/templates/Procfile similarity index 100% rename from src/heroku/templates/Procfile rename to src/generators/heroku/templates/Procfile diff --git a/src/insight-init.js b/src/generators/insight-init.js similarity index 100% rename from src/insight-init.js rename to src/generators/insight-init.js diff --git a/src/openshift/USAGE b/src/generators/openshift/USAGE similarity index 100% rename from src/openshift/USAGE rename to src/generators/openshift/USAGE diff --git a/src/openshift/index.js b/src/generators/openshift/index.js similarity index 100% rename from src/openshift/index.js rename to src/generators/openshift/index.js diff --git a/src/openshift/templates/hot_deploy b/src/generators/openshift/templates/hot_deploy similarity index 100% rename from src/openshift/templates/hot_deploy rename to src/generators/openshift/templates/hot_deploy diff --git a/src/provider/index.js b/src/generators/provider/index.js similarity index 100% rename from src/provider/index.js rename to src/generators/provider/index.js diff --git a/src/route/index.js b/src/generators/route/index.js similarity index 100% rename from src/route/index.js rename to src/generators/route/index.js diff --git a/src/service/index.js b/src/generators/service/index.js similarity index 100% rename from src/service/index.js rename to src/generators/service/index.js diff --git a/src/util.js b/src/generators/util.js similarity index 100% rename from src/util.js rename to src/generators/util.js diff --git a/src/test/fixtures/.bowerrc b/src/test/fixtures/.bowerrc new file mode 100644 index 000000000..69fad3580 --- /dev/null +++ b/src/test/fixtures/.bowerrc @@ -0,0 +1,3 @@ +{ + "directory": "bower_components" +} diff --git a/src/test/fixtures/.yo-rc.json b/src/test/fixtures/.yo-rc.json new file mode 100644 index 000000000..716e42b6c --- /dev/null +++ b/src/test/fixtures/.yo-rc.json @@ -0,0 +1,36 @@ +{ + "generator-angular-fullstack": { + "endpointDirectory": "server/api/", + "insertRoutes": true, + "registerRoutesFile": "server/routes.js", + "routesNeedle": "// Insert routes below", + "routesBase": "/api/", + "pluralizeRoutes": true, + "insertSockets": true, + "registerSocketsFile": "server/config/socketio.js", + "socketsNeedle": "// Insert sockets below", + "insertModels": true, + "registerModelsFile": "server/sqldb/index.js", + "modelsNeedle": "// Insert models below", + "filters": { + "babel": true, + "html": true, + "less": true, + "uirouter": true, + "bootstrap": false, + "uibootstrap": false, + "socketio": true, + "auth": true, + "models": true, + "mongooseModels": true, + "mongoose": true, + "oauth": true, + "googleAuth": true, + "grunt": true, + "mocha": true, + "jasmine": false, + "should": true, + "expect": false + } + } +} diff --git a/test/test-file-creation.js b/src/test/test-file-creation.js similarity index 100% rename from test/test-file-creation.js rename to src/test/test-file-creation.js From f852113cb88f959412d60e4a437d5647c1baa669 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Sun, 24 Apr 2016 01:20:09 -0400 Subject: [PATCH 076/885] fix(gen:gulp:watch): use plumber when watching --- gulpfile.js | 7 +++++++ package.json | 2 ++ 2 files changed, 9 insertions(+) diff --git a/gulpfile.js b/gulpfile.js index 2fa763455..e10855420 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -4,6 +4,8 @@ var path = require('path'); var Promise = require('bluebird'); var gulp = require('gulp'); var babel = require('gulp-babel'); +var plumber = require('gulp-plumber'); +var gulpIf = require('gulp-if'); var del = require('del'); var runSequence = require('run-sequence'); var merge = require('merge-stream'); @@ -12,12 +14,16 @@ gulp.task('clean', () => { return del(['generators/**/*']); }); +var watching = false; + gulp.task('babel', () => { let generators = gulp.src(['src/generators/**/*.js']) + .pipe(gulpIf(watching, plumber())) .pipe(babel()) .pipe(gulp.dest('generators')); let test = gulp.src(['src/test/**/*.js']) + .pipe(gulpIf(watching, plumber())) .pipe(babel()) .pipe(gulp.dest('test')); @@ -25,6 +31,7 @@ gulp.task('babel', () => { }); gulp.task('watch', () => { + watching = true; return gulp.watch('src/**/*.js', ['babel']); }); diff --git a/package.json b/package.json index a6f769767..c35fe4c42 100644 --- a/package.json +++ b/package.json @@ -67,6 +67,8 @@ "grunt-mocha-test": "^0.12.7", "grunt-release": "^0.13.0", "gulp": "^3.9.1", + "gulp-if": "^2.0.0", + "gulp-plumber": "^1.1.0", "jit-grunt": "~0.10.0", "merge-stream": "^1.0.0", "mocha": "^2.2.5", From 6398160cfcdb16b62af8c17782656833ac96b5b5 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Sun, 24 Apr 2016 01:22:59 -0400 Subject: [PATCH 077/885] refactor(gen:test): promisify `fs`, use the promises --- src/test/test-file-creation.js | 70 ++++++++++++++++++++-------------- 1 file changed, 42 insertions(+), 28 deletions(-) diff --git a/src/test/test-file-creation.js b/src/test/test-file-creation.js index 5c4c29e5d..4d0d97882 100644 --- a/src/test/test-file-creation.js +++ b/src/test/test-file-creation.js @@ -1,7 +1,9 @@ /*global describe, beforeEach, it */ 'use strict'; var path = require('path'); +var Promise = require('bluebird'); var fs = require('fs'); +Promise.promisifyAll(fs); var exec = require('child_process').exec; var helpers = require('yeoman-test'); var assert = require('yeoman-assert'); @@ -9,8 +11,18 @@ var chai = require('chai'); var expect = chai.expect; var recursiveReadDir = require('recursive-readdir'); +/**************** + * FileSystem Utils + ****************/ + +function copyAsync(src, dest) { + return fs.readFileAsync(src) + .then(data => fs.writeFileAsync(data, dest)); +} + describe('angular-fullstack generator', function () { - var gen, defaultOptions = { + var gen; + var defaultOptions = { buildtool: 'grunt', script: 'js', transpiler: 'babel', @@ -21,13 +33,12 @@ describe('angular-fullstack generator', function () { chai: 'expect', bootstrap: true, uibootstrap: true, - odms: [ 'mongoose' ], + odms: ['mongoose'], auth: true, oauth: [], socketio: true - }, dependenciesInstalled = false; - - function copySync(s, d) { fs.writeFileSync(d, fs.readFileSync(s)); } + }; + var dependenciesInstalled = false; function generatorTest(generatorType, name, mockPrompt, callback) { gen.run(function () { @@ -411,9 +422,11 @@ describe('angular-fullstack generator', function () { beforeEach(function() { this.timeout(20000); - fs.mkdirSync(__dirname + '/temp/client'); - fs.symlinkSync(__dirname + '/fixtures/node_modules', __dirname + '/temp/node_modules'); - fs.symlinkSync(__dirname +'/fixtures/bower_components', __dirname +'/temp/client/bower_components'); + return Promise.all([ + fs.mkdirAsync(__dirname + '/temp/client'), + fs.symlinkAsync(__dirname + '/fixtures/node_modules', __dirname + '/temp/node_modules'), + fs.symlinkAsync(__dirname +'/fixtures/bower_components', __dirname +'/temp/client/bower_components') + ]); }); describe('with default options', function() { @@ -482,26 +495,27 @@ describe('angular-fullstack generator', function () { it('should use existing config if available', function(done) { this.timeout(60000); - copySync(__dirname + '/fixtures/.yo-rc.json', __dirname + '/temp/.yo-rc.json'); - var gen = helpers.createGenerator('angular-fullstack:app', [ - '../../generators/app', - '../../generators/endpoint', - [ - helpers.createDummyGenerator(), - 'ng-component:app' - ] - ], [], { - skipInstall: true - }); - helpers.mockPrompt(gen, { - skipConfig: true - }); - gen.run(function () { - assert.file([ - 'client/app/main/main.less', - 'server/auth/google/passport.js' - ]); - done(); + return copyAsync(__dirname + '/fixtures/.yo-rc.json', __dirname + '/temp/.yo-rc.json').then(() => { + var gen = helpers.createGenerator('angular-fullstack:app', [ + '../../generators/app', + '../../generators/endpoint', + [ + helpers.createDummyGenerator(), + 'ng-component:app' + ] + ], [], { + skipInstall: true + }); + helpers.mockPrompt(gen, { + skipConfig: true + }); + gen.run(function () { + assert.file([ + 'client/app/main/main.less', + 'server/auth/google/passport.js' + ]); + done(); + }); }); }); From 8f5c120fd9e4ca182fbff8e9d2c7df76ff262fa0 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Sun, 24 Apr 2016 01:38:03 -0400 Subject: [PATCH 078/885] fix(gen:test): fix copyAsync --- src/test/test-file-creation.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/test-file-creation.js b/src/test/test-file-creation.js index 4d0d97882..200e49852 100644 --- a/src/test/test-file-creation.js +++ b/src/test/test-file-creation.js @@ -17,7 +17,7 @@ var recursiveReadDir = require('recursive-readdir'); function copyAsync(src, dest) { return fs.readFileAsync(src) - .then(data => fs.writeFileAsync(data, dest)); + .then(data => fs.writeFileAsync(dest, data)); } describe('angular-fullstack generator', function () { From 27806c564e3fd64859e5bb779b45f8f1cd9191e8 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Sun, 24 Apr 2016 04:28:17 -0400 Subject: [PATCH 079/885] refactor(gen:gulp): use lazypipe --- gulpfile.js | 15 +++++++++------ package.json | 1 + 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index e10855420..f6d5e244a 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -7,24 +7,27 @@ var babel = require('gulp-babel'); var plumber = require('gulp-plumber'); var gulpIf = require('gulp-if'); var del = require('del'); +var lazypipe = require('lazypipe'); var runSequence = require('run-sequence'); var merge = require('merge-stream'); +var watching = false; + +const transpile = lazypipe() + .pipe(() => gulpIf(watching, plumber())) + .pipe(babel); + gulp.task('clean', () => { return del(['generators/**/*']); }); -var watching = false; - gulp.task('babel', () => { let generators = gulp.src(['src/generators/**/*.js']) - .pipe(gulpIf(watching, plumber())) - .pipe(babel()) + .pipe(transpile()) .pipe(gulp.dest('generators')); let test = gulp.src(['src/test/**/*.js']) - .pipe(gulpIf(watching, plumber())) - .pipe(babel()) + .pipe(transpile()) .pipe(gulp.dest('test')); return merge(generators); diff --git a/package.json b/package.json index c35fe4c42..28d95ad7d 100644 --- a/package.json +++ b/package.json @@ -70,6 +70,7 @@ "gulp-if": "^2.0.0", "gulp-plumber": "^1.1.0", "jit-grunt": "~0.10.0", + "lazypipe": "^1.0.1", "merge-stream": "^1.0.0", "mocha": "^2.2.5", "q": "^1.0.1", From 3748953ba08d2821a16df522b01ed4d6ff15b8bf Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Sun, 24 Apr 2016 04:28:54 -0400 Subject: [PATCH 080/885] fix(gen:gulp:babel): return the two merged streams --- gulpfile.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gulpfile.js b/gulpfile.js index f6d5e244a..a625a1f0a 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -30,7 +30,7 @@ gulp.task('babel', () => { .pipe(transpile()) .pipe(gulp.dest('test')); - return merge(generators); + return merge(generators, test); }); gulp.task('watch', () => { From ead201a24b993e8e017a9d4988c1c6705fdc41de Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Sun, 24 Apr 2016 04:29:20 -0400 Subject: [PATCH 081/885] feat(gen:gulp): add mocha --- gulpfile.js | 15 +++++++++++++++ package.json | 2 ++ 2 files changed, 17 insertions(+) diff --git a/gulpfile.js b/gulpfile.js index a625a1f0a..257025cf3 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -4,6 +4,7 @@ var path = require('path'); var Promise = require('bluebird'); var gulp = require('gulp'); var babel = require('gulp-babel'); +var gulpMocha = require('gulp-mocha'); var plumber = require('gulp-plumber'); var gulpIf = require('gulp-if'); var del = require('del'); @@ -13,6 +14,15 @@ var merge = require('merge-stream'); var watching = false; +const mocha = lazypipe() + .pipe(gulpMocha, { + reporter: 'spec', + timeout: 120000, + globals: { + should: require('should') + } + }); + const transpile = lazypipe() .pipe(() => gulpIf(watching, plumber())) .pipe(babel); @@ -103,3 +113,8 @@ gulp.task('updateFixtures:test', () => { gulp.task('updateFixtures:deps', () => { return updateFixtures('deps'); }); + +gulp.task('test', () => { + return gulp.src('test/*.test.js') + .pipe(mocha()) +}); diff --git a/package.json b/package.json index 28d95ad7d..f961d8549 100644 --- a/package.json +++ b/package.json @@ -68,6 +68,7 @@ "grunt-release": "^0.13.0", "gulp": "^3.9.1", "gulp-if": "^2.0.0", + "gulp-mocha": "^2.2.0", "gulp-plumber": "^1.1.0", "jit-grunt": "~0.10.0", "lazypipe": "^1.0.1", @@ -77,6 +78,7 @@ "recursive-readdir": "^2.0.0", "run-sequence": "^1.1.5", "shelljs": "^0.6.0", + "should": "^8.3.1", "yeoman-assert": "^2.0.0", "yeoman-test": "^1.1.0" }, From 316e93f2897216b8fbc50fd3b920292087b1601c Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Mon, 25 Apr 2016 11:25:57 -0400 Subject: [PATCH 082/885] feat(gen:tests): step 1 of new test structure --- src/test/get-expected-files.js | 237 ++++++++++++++++++ src/test/main.test.js | 96 +++++++ ...test-file-creation.js => main.test.off.js} | 37 ++- 3 files changed, 348 insertions(+), 22 deletions(-) create mode 100644 src/test/get-expected-files.js create mode 100644 src/test/main.test.js rename src/test/{test-file-creation.js => main.test.off.js} (96%) diff --git a/src/test/get-expected-files.js b/src/test/get-expected-files.js new file mode 100644 index 000000000..6a435b3dd --- /dev/null +++ b/src/test/get-expected-files.js @@ -0,0 +1,237 @@ +/** + * Generate an array of files to expect from a set of options + * + * @param {Object} options - generator options + * @return {Array} - array of files + * + */ +export function app(options) { + var mapping = { + stylesheet: { + sass: 'scss', + stylus: 'styl', + less: 'less', + css: 'css' + }, + markup: { + jade: 'jade', + html: 'html' + }, + script: { + js: 'js', + ts: 'ts' + } + }, + files = []; + + /** + * Generate an array of OAuth files based on type + * + * @param {String} type - type of oauth + * @return {Array} - array of files + * + */ + var oauthFiles = function(type) { + return [ + 'server/auth/' + type + '/index.js', + 'server/auth/' + type + '/passport.js', + ]; + }; + + + var script = mapping.script[options.transpiler === 'ts' ? 'ts' : 'js'], + markup = mapping.markup[options.markup], + stylesheet = mapping.stylesheet[options.stylesheet], + models = options.models ? options.models : options.odms[0]; + + /* Core Files */ + files = files.concat([ + 'client/.htaccess', + 'client/favicon.ico', + 'client/robots.txt', + 'client/index.html', + 'client/app/app.' + script, + 'client/app/app.' + stylesheet, + 'client/app/main/main.' + script, + 'client/app/main/main.' + markup, + 'client/app/main/main.' + stylesheet, + 'client/app/main/main.controller.' + script, + 'client/app/main/main.controller.spec.' + script, + 'client/assets/images/yeoman.png', + 'client/components/footer/footer.' + stylesheet, + 'client/components/footer/footer.' + markup, + 'client/components/footer/footer.directive.' + script, + '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', + 'server/index.js', + 'server/routes.js', + 'server/api/thing/index.js', + 'server/api/thing/index.spec.js', + 'server/api/thing/thing.controller.js', + 'server/api/thing/thing.integration.js', + 'server/components/errors/index.js', + 'server/config/local.env.js', + 'server/config/local.env.sample.js', + 'server/config/express.js', + 'server/config/environment/index.js', + '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', + 'e2e/components/navbar/navbar.po.js', + '.babelrc', + '.bowerrc', + '.buildignore', + '.editorconfig', + '.gitattributes', + '.gitignore', + '.travis.yml', + '.jscsrc', + '.yo-rc.json', + 'Gruntfile.js', + 'package.json', + 'bower.json', + 'karma.conf.js', + 'mocha.conf.js', + 'protractor.conf.js', + 'README.md' + ]); + + /* TypeScript */ + if (options.transpiler === 'ts') { + files = files.concat([ + 'tsconfig.client.test.json', + 'tsconfig.client.json', + 'tsd.json', + 'tsd_test.json', + 'client/tslint.json' + ]); + } else { + files = files.concat([ + 'client/.jshintrc' + ]); + } + + /* Ui-Router */ + if (options.router === 'uirouter') { + files = files.concat([ + 'client/components/ui-router/ui-router.mock.' + script + ]); + } + + /* Ui-Bootstrap */ + if (options.uibootstrap) { + files = files.concat([ + 'client/components/modal/modal.' + markup, + 'client/components/modal/modal.' + stylesheet, + 'client/components/modal/modal.service.' + script + ]); + } + + /* Models - Mongoose or Sequelize */ + if (models) { + files = files.concat([ + 'server/api/thing/thing.model.js', + 'server/api/thing/thing.events.js', + 'server/config/seed.js' + ]); + } + + /* Sequelize */ + if (options.odms.indexOf('sequelize') !== -1) { + files = files.concat([ + 'server/sqldb/index.js' + ]); + } + + /* Authentication */ + if (options.auth) { + files = files.concat([ + 'client/app/account/account.' + script, + 'client/app/account/login/login.' + markup, + 'client/app/account/login/login.controller.' + script, + 'client/app/account/settings/settings.' + markup, + 'client/app/account/settings/settings.controller.' + script, + 'client/app/account/signup/signup.' + markup, + 'client/app/account/signup/signup.controller.' + script, + 'client/app/admin/admin.' + markup, + 'client/app/admin/admin.' + stylesheet, + '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, + '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', + 'server/api/user/index.spec.js', + 'server/api/user/user.controller.js', + 'server/api/user/user.integration.js', + 'server/api/user/user.model.js', + 'server/api/user/user.model.spec.js', + 'server/api/user/user.events.js', + 'server/auth/index.js', + 'server/auth/auth.service.js', + 'server/auth/local/index.js', + 'server/auth/local/passport.js', + 'e2e/account/login/login.po.js', + 'e2e/account/login/login.spec.js', + 'e2e/account/logout/logout.spec.js', + 'e2e/account/signup/signup.po.js', + 'e2e/account/signup/signup.spec.js' + ]); + } + + if (options.oauth && options.oauth.length) { + /* OAuth (see oauthFiles function above) */ + options.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 */ + if (options.socketio) { + files = files.concat([ + 'client/components/socket/socket.service.' + script, + 'client/components/socket/socket.mock.' + script, + 'server/api/thing/thing.socket.js', + 'server/config/socketio.js' + ]); + } + + return files; +} + +export function endpoint(name, options) { + return [ + `server/api/${name}/index.js`, + `server/api/${name}/index.spec.js`, + `server/api/${name}/bar.controller.js`, + `server/api/${name}/bar.events.js`, + `server/api/${name}/bar.integration.js`, + `server/api/${name}/bar.model.js`, + `server/api/${name}/bar.socket.js` + ]; +} diff --git a/src/test/main.test.js b/src/test/main.test.js new file mode 100644 index 000000000..deed2c25b --- /dev/null +++ b/src/test/main.test.js @@ -0,0 +1,96 @@ +'use strict'; +import path from 'path'; +import fs from 'fs'; +import Promise from 'bluebird'; +Promise.promisifyAll(fs); +import {exec} from 'child_process'; +import helpers from 'yeoman-test'; +import assert from 'yeoman-assert'; +import * as getExpectedFiles from './get-expected-files'; + +const defaultOptions = { + buildtool: 'grunt', + script: 'js', + transpiler: 'babel', + markup: 'html', + stylesheet: 'sass', + router: 'uirouter', + testing: 'mocha', + chai: 'expect', + bootstrap: true, + uibootstrap: true, + odms: ['mongoose'], + auth: true, + oauth: [], + socketio: true +}; +// var DEBUG = true; +var DEBUG = false; + +function runCmd(cmd, done) { + exec(cmd, {}, function(err, stdout, stderr) { + if(err) { + console.error(stdout); + throw new Error(`Error running command: ${cmd}`); + done(err); + } else { + if(DEBUG) console.log(stdout); + done(); + } + }); +} + +describe('angular-fullstack:app', function() { + beforeEach(function() { + this.gen = helpers + .run(require.resolve('../generators/app')) + .inTmpDir(function(dir) { + var done = this.async(); + if(DEBUG) console.log(`TEMP DIR: ${dir}`); + + return Promise.all([ + fs.mkdirAsync(dir + '/client').then(() => { + return fs.symlinkAsync(__dirname + '/fixtures/bower_components', dir + '/client/bower_components'); + }), + fs.symlinkAsync(__dirname + '/fixtures/node_modules', dir + '/node_modules') + ]).then(done); + }) + .withGenerators([ + require.resolve('../generators/endpoint'), + // [helpers.createDummyGenerator(), 'ng-component:app'] + ]) + .withOptions({ + skipInstall: true, + force: true + }) + // .withArguments(['upperCaseBug']) + .withPrompts(defaultOptions); + }); + + describe('default settings', function() { + beforeEach(function(done) { + this.gen.on('end', done); + }); + + it('generates the proper files', function(done) { + assert.file(getExpectedFiles.app(defaultOptions)); + done(); + }); + + it('passes JSCS', function(done) { + runCmd('grunt jscs', done); + }); + + it('passes JSHint', function(done) { + runCmd('grunt jshint', done); + }); + + it('passes client tests', function(done) { + runCmd('grunt test:client', done); + }); + + it('passes client tests', function(done) { + runCmd('grunt test:server', done); + }); + }); +}); \ No newline at end of file diff --git a/src/test/test-file-creation.js b/src/test/main.test.off.js similarity index 96% rename from src/test/test-file-creation.js rename to src/test/main.test.off.js index 200e49852..6f706cc70 100644 --- a/src/test/test-file-creation.js +++ b/src/test/main.test.off.js @@ -64,12 +64,13 @@ describe('angular-fullstack generator', function () { * @param {Array} skip - array of paths to skip/ignore (optional) * */ - function assertOnlyFiles(expectedFiles, done, topLevelPath, skip) { - topLevelPath = topLevelPath || './'; - skip = skip || ['node_modules', 'client/bower_components']; - + function assertOnlyFiles( + expectedFiles, + done, + topLevelPath='./', + skip=['node_modules', 'client/bower_components']) { recursiveReadDir(topLevelPath, skip, function(err, actualFiles) { - if (err) { return done(err); } + if (err) return done(err); var files = actualFiles.concat(); expectedFiles.forEach(function(file, i) { @@ -101,9 +102,9 @@ describe('angular-fullstack generator', function () { * */ function runTest(cmd, self, cb) { - var args = Array.prototype.slice.call(arguments), - endpoint = (args[3] && typeof args[3] === 'string') ? args.splice(3, 1)[0] : null, - timeout = (args[3] && typeof args[3] === 'number') ? args.splice(3, 1)[0] : null; + var args = Array.prototype.slice.call(arguments); + var endpoint = (args[3] && typeof args[3] === 'string') ? args.splice(3, 1)[0] : null; + var timeout = (args[3] && typeof args[3] === 'number') ? args.splice(3, 1)[0] : null; self.timeout(timeout || 60000); @@ -370,31 +371,24 @@ describe('angular-fullstack generator', function () { ] ]; - helpers.testDirectory(path.join(__dirname, 'temp'), function (err) { - if (err) { - return done(err); - } + helpers.testDirectory(path.join(__dirname, 'temp'), err => { + if(err) return done(err); gen = helpers.createGenerator('angular-fullstack:app', deps, [], { skipInstall: true }); gen.conflicter.force = true; done(); - }.bind(this)); + }); }); describe('making sure test fixtures are present', function() { - it('should have package.json in fixtures', function() { - assert.file([ - path.join(__dirname, 'fixtures', 'package.json') - ]); + assert.file([path.join(__dirname, 'fixtures', 'package.json')]); }); it('should have bower.json in fixtures', function() { - assert.file([ - path.join(__dirname, 'fixtures', 'bower.json') - ]); + assert.file([path.join(__dirname, 'fixtures', 'bower.json')]); }); it('should have all npm packages in fixtures/node_modules', function() { @@ -419,7 +413,6 @@ describe('angular-fullstack generator', function () { }); describe('running app', function() { - beforeEach(function() { this.timeout(20000); return Promise.all([ @@ -438,7 +431,7 @@ describe('angular-fullstack generator', function () { runTest('grunt test:client', this, done); }); - it('should pass jscs', function(done) { + it.only('should pass jscs', function(done) { runTest('grunt jscs', this, done); }); From 7c8795371cfa2a7c6afdf5f7f1bc93d393972feb Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Mon, 25 Apr 2016 13:00:25 -0400 Subject: [PATCH 083/885] chore(package): update test command to use `gulp test` instead of grunt --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f961d8549..1827ba07e 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "url": "git://github.com/angular-fullstack/generator-angular-fullstack.git" }, "scripts": { - "test": "gulp build && grunt test", + "test": "gulp build && gulp test", "prepublish": "gulp build" }, "dependencies": { From 04a787884ad05d0cc1facf662725bcdbdd294e8b Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Mon, 25 Apr 2016 13:51:57 -0400 Subject: [PATCH 084/885] feat(gen:gulp): add installFixtures task --- gulpfile.js | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/gulpfile.js b/gulpfile.js index 257025cf3..e4529953e 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -11,6 +11,10 @@ var del = require('del'); var lazypipe = require('lazypipe'); var runSequence = require('run-sequence'); var merge = require('merge-stream'); +const exec = require('child_process').exec; +const _ = require('lodash'); +const gutil = require('gulp-util'); +const shell = require('shelljs'); var watching = false; @@ -114,6 +118,47 @@ gulp.task('updateFixtures:deps', () => { return updateFixtures('deps'); }); +function execAsync(cmd, opt) { + return new Promise((resolve, reject) => { + exec(cmd, opt, (err, stdout, stderr) => { + if(err) { + console.log(`stderr: ${stderr}`); + return reject(err); + } + + return resolve(stdout); + }) + }); +} + +gulp.task('installFixtures', function() { + gutil.log('installing npm & bower dependencies for generated app'); + let progress = setInterval(() => { + process.stdout.write('.'); + }, 1 * 1000); + shell.cd('test/fixtures'); + + return Promise.all([ + execAsync('npm install --quiet', {cwd: '../fixtures'}), + execAsync('bower install', {cwd: '../fixtures'}) + ]).then(() => { + process.stdout.write('\n'); + if(!process.env.SAUCE_USERNAME) { + gutil.log('running npm run-script update-webdriver'); + return execAsync('npm run-script update-webdriver').then(() => { + clearInterval(progress); + process.stdout.write('\n'); + shell.cd('../../'); + }); + } else { + clearInterval(progress); + process.stdout.write('\n'); + shell.cd('../../'); + return Promise.resolve(); + } + }); +}); + gulp.task('test', () => { return gulp.src('test/*.test.js') .pipe(mocha()) From 62577eafb4c4f8c5c8e45e464aa89db1f6f126ce Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Mon, 25 Apr 2016 13:52:51 -0400 Subject: [PATCH 085/885] style(gen:gulp): use const for imports, add semicolon --- gulpfile.js | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index e4529953e..8310337f7 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -1,19 +1,19 @@ 'use strict'; -var fs = require('fs'); -var path = require('path'); -var Promise = require('bluebird'); -var gulp = require('gulp'); -var babel = require('gulp-babel'); -var gulpMocha = require('gulp-mocha'); -var plumber = require('gulp-plumber'); -var gulpIf = require('gulp-if'); -var del = require('del'); -var lazypipe = require('lazypipe'); -var runSequence = require('run-sequence'); -var merge = require('merge-stream'); +const fs = require('fs'); +const path = require('path'); const exec = require('child_process').exec; const _ = require('lodash'); +const Promise = require('bluebird'); +const gulp = require('gulp'); const gutil = require('gulp-util'); +const babel = require('gulp-babel'); +const gulpMocha = require('gulp-mocha'); +const plumber = require('gulp-plumber'); +const gulpIf = require('gulp-if'); +const del = require('del'); +const lazypipe = require('lazypipe'); +const runSequence = require('run-sequence'); +const merge = require('merge-stream'); const shell = require('shelljs'); var watching = false; @@ -161,5 +161,5 @@ gulp.task('installFixtures', function() { gulp.task('test', () => { return gulp.src('test/*.test.js') - .pipe(mocha()) + .pipe(mocha()); }); From 9b9c781fbd97048eb42b31b2e8e852cc2f8b74a2 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Mon, 25 Apr 2016 13:53:16 -0400 Subject: [PATCH 086/885] chore(package): add gulp-util --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index 1827ba07e..f373d4df7 100644 --- a/package.json +++ b/package.json @@ -70,6 +70,7 @@ "gulp-if": "^2.0.0", "gulp-mocha": "^2.2.0", "gulp-plumber": "^1.1.0", + "gulp-util": "^3.0.7", "jit-grunt": "~0.10.0", "lazypipe": "^1.0.1", "merge-stream": "^1.0.0", From 5a21831029bf107665b8111239dc755f72e2a5a8 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Mon, 25 Apr 2016 13:53:43 -0400 Subject: [PATCH 087/885] chore(package): add updateFixtures:deps & installFixtures to `test` script --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f373d4df7..524ab175b 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "url": "git://github.com/angular-fullstack/generator-angular-fullstack.git" }, "scripts": { - "test": "gulp build && gulp test", + "test": "gulp updateFixtures:test && gulp installFixtures && gulp build && gulp test", "prepublish": "gulp build" }, "dependencies": { From 57477392d315faa8b9db1e2915c206f3c3e97e50 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Mon, 25 Apr 2016 16:40:09 -0400 Subject: [PATCH 088/885] fix(gen:gulp:watch): for some reason gulp-if isn't working inside lazypipe --- gulpfile.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gulpfile.js b/gulpfile.js index 8310337f7..3b47197d6 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -28,7 +28,6 @@ const mocha = lazypipe() }); const transpile = lazypipe() - .pipe(() => gulpIf(watching, plumber())) .pipe(babel); gulp.task('clean', () => { @@ -37,10 +36,12 @@ gulp.task('clean', () => { gulp.task('babel', () => { let generators = gulp.src(['src/generators/**/*.js']) + .pipe(gulpIf(watching, plumber())) .pipe(transpile()) .pipe(gulp.dest('generators')); let test = gulp.src(['src/test/**/*.js']) + .pipe(gulpIf(watching, plumber())) .pipe(transpile()) .pipe(gulp.dest('test')); From 0787039881bec29280b9fafeadbf8fe14fb95058 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Mon, 25 Apr 2016 16:41:16 -0400 Subject: [PATCH 089/885] fix(gen:endpoint): typo --- src/generators/endpoint/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/generators/endpoint/index.js b/src/generators/endpoint/index.js index 675e61c07..4c05c8e97 100644 --- a/src/generators/endpoint/index.js +++ b/src/generators/endpoint/index.js @@ -22,7 +22,7 @@ export class Generator extends Base { }); this.option('endpointDirectory', { - desc: 'Parent directory for enpoints', + desc: 'Parent directory for endpoints', type: String }); } From d51295a84b0149496d904a775954f65ec1a6945f Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Mon, 25 Apr 2016 16:42:10 -0400 Subject: [PATCH 090/885] docs(gen:tests): add some JSDoc to `runCmd` --- src/test/main.test.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/test/main.test.js b/src/test/main.test.js index deed2c25b..802d2c6b1 100644 --- a/src/test/main.test.js +++ b/src/test/main.test.js @@ -27,6 +27,16 @@ const defaultOptions = { // var DEBUG = true; var DEBUG = false; +/** + * @callback doneCallback + * @param {null|Error} err + */ + +/** + * Run the given command in a child process + * @param {string} cmd - command to run + * @param {doneCallback} done + */ function runCmd(cmd, done) { exec(cmd, {}, function(err, stdout, stderr) { if(err) { From 36d79c2f98bfddce0f3f85077e6a9fc39491614b Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Mon, 25 Apr 2016 16:43:47 -0400 Subject: [PATCH 091/885] feat(gen:tests): a bunch of test progress --- src/test/main.test.js | 177 ++++++++++++++++++++++++++++++++++++++---- 1 file changed, 163 insertions(+), 14 deletions(-) diff --git a/src/test/main.test.js b/src/test/main.test.js index 802d2c6b1..64f80e796 100644 --- a/src/test/main.test.js +++ b/src/test/main.test.js @@ -1,12 +1,14 @@ 'use strict'; import path from 'path'; import fs from 'fs'; +import _ from 'lodash'; import Promise from 'bluebird'; Promise.promisifyAll(fs); import {exec} from 'child_process'; import helpers from 'yeoman-test'; import assert from 'yeoman-assert'; import * as getExpectedFiles from './get-expected-files'; +import recursiveReadDir from 'recursive-readdir'; const defaultOptions = { buildtool: 'grunt', @@ -26,6 +28,12 @@ const defaultOptions = { }; // var DEBUG = true; var DEBUG = false; +const TEST_DIR = __dirname; + +function copyAsync(src, dest) { + return fs.readFileAsync(src) + .then(data => fs.writeFileAsync(dest, data)); +} /** * @callback doneCallback @@ -50,14 +58,36 @@ function runCmd(cmd, done) { }); } -describe('angular-fullstack:app', function() { - beforeEach(function() { - this.gen = helpers +function assertOnlyFiles(expectedFiles, topLevelPath='./', skip=['node_modules', 'bower_components']) { + return new Promise((resolve, reject) => { + recursiveReadDir(topLevelPath, skip, function(err, actualFiles) { + if(err) return reject(err); + + actualFiles = _.map(actualFiles.concat(), file => path.normalize(file.replace(path.normalize(`${topLevelPath}/`), ''))); + expectedFiles = _.map(expectedFiles, file => path.normalize(file)); + + let extras = _.pullAll(actualFiles, expectedFiles); + + if(extras.length !== 0) { + return reject(extras); + } + resolve(); + }); + }); +} + +function runGen(prompts) { + return new Promise((resolve, reject) => { + let dir; + helpers .run(require.resolve('../generators/app')) - .inTmpDir(function(dir) { + .inTmpDir(function(_dir) { + // this will create a new temporary directory for each new generator run var done = this.async(); - if(DEBUG) console.log(`TEMP DIR: ${dir}`); + if(DEBUG) console.log(`TEMP DIR: ${_dir}`); + dir = _dir; + // symlink our dependency directories return Promise.all([ fs.mkdirAsync(dir + '/client').then(() => { return fs.symlinkAsync(__dirname + '/fixtures/bower_components', dir + '/client/bower_components'); @@ -70,21 +100,62 @@ describe('angular-fullstack:app', function() { // [helpers.createDummyGenerator(), 'ng-component:app'] ]) .withOptions({ - skipInstall: true, - force: true + skipInstall: true }) // .withArguments(['upperCaseBug']) - .withPrompts(defaultOptions); + .withPrompts(prompts) + .on('error', reject) + .on('end', () => resolve(dir)); + }); +} + +function runEndpointGen(name, opt={}) { + let prompts = opt.prompts || {}; + let options = opt.options || {}; + let config = opt.config; + + return new Promise((resolve, reject) => { + let gen = helpers + .run(require.resolve('../generators/endpoint'), {tmpdir: false}) + .withOptions(options) + .withArguments([name]) + .withPrompts(prompts); + + if(config) { + gen + .withLocalConfig(config); + } + + gen + .on('error', reject) + .on('end', () => resolve()) + }); +} + +function getConfig(dir) { + return fs.readFileAsync(path.join(dir, '.yo-rc.json'), 'utf8').then(data => { + return JSON.parse(data); + }); +} + +describe('angular-fullstack:app', function() { + beforeEach(function() { + this.gen = runGen(defaultOptions); }); describe('default settings', function() { - beforeEach(function(done) { - this.gen.on('end', done); + var dir; + + beforeEach(function() { + return this.gen.then(_dir => { + dir = _dir; + }); }); - it('generates the proper files', function(done) { - assert.file(getExpectedFiles.app(defaultOptions)); - done(); + it('generates the proper files', function() { + const expectedFiles = getExpectedFiles.app(defaultOptions); + assert.file(expectedFiles); + return assertOnlyFiles(expectedFiles, path.normalize(dir)).should.eventually.be.fulfilled; }); it('passes JSCS', function(done) { @@ -99,8 +170,86 @@ describe('angular-fullstack:app', function() { runCmd('grunt test:client', done); }); - it('passes client tests', function(done) { + it('passes server tests', function(done) { runCmd('grunt test:server', done); }); + + describe('with a generated endpont', function() { + beforeEach(function() { + getConfig(dir).then(config => { + return runEndpointGen('foo', {config: config['generator-angular-fullstack']}); + }); + }); + + it('should pass jscs'); //'foo' + + it('should pass lint'); + + it('should run server tests successfully', function(done) { + runCmd('grunt test:server', done); + }); + }); + + describe.only('with a generated capitalized endpont', function() { + beforeEach(function() { + getConfig(dir).then(config => { + return runEndpointGen('Foo', {config: config['generator-angular-fullstack']}); + }); + }); + + it('should pass jscs'); + + it('should pass lint'); + + it('should run server tests successfully', function(done) { + runCmd('grunt test:server', done); + }); + }); + + it('should pass lint with generated path name endpoint'); //'foo/bar' + + it('should run server tests successfully with generated path name endpoint'); + + it('should generate expected files with path name endpoint'); + // [ + // 'server/api/foo/bar/index.js', + // 'server/api/foo/bar/index.spec.js', + // 'server/api/foo/bar/bar.controller.js', + // 'server/api/foo/bar/bar.events.js', + // 'server/api/foo/bar/bar.integration.js', + // 'server/api/foo/bar/bar.model.js', + // 'server/api/foo/bar/bar.socket.js' + // ] + + it('should use existing config if available'); + // this.timeout(60000); + // return copyAsync(__dirname + '/fixtures/.yo-rc.json', __dirname + '/temp/.yo-rc.json').then(() => { + // var gen = helpers.createGenerator('angular-fullstack:app', [ + // '../../generators/app', + // '../../generators/endpoint', + // [ + // helpers.createDummyGenerator(), + // 'ng-component:app' + // ] + // ], [], { + // skipInstall: true + // }); + // helpers.mockPrompt(gen, { + // skipConfig: true + // }); + // gen.run(function () { + // assert.file([ + // 'client/app/main/main.less', + // 'server/auth/google/passport.js' + // ]); + // done(); + // }); + // }); + + if(!process.env.SKIP_E2E) { + it('should run e2e tests successfully'); //'grunt test:e2e' + + it('should run e2e tests successfully for production app'); //'grunt test:e2e:prod' + } }); }); \ No newline at end of file From 3310a1cebf417394b6b702ac87be04b374e73631 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Mon, 25 Apr 2016 16:50:00 -0400 Subject: [PATCH 092/885] fix(gen:test): remove my `.only` --- src/test/main.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/main.test.js b/src/test/main.test.js index 64f80e796..62eeed2b0 100644 --- a/src/test/main.test.js +++ b/src/test/main.test.js @@ -190,7 +190,7 @@ describe('angular-fullstack:app', function() { }); }); - describe.only('with a generated capitalized endpont', function() { + describe('with a generated capitalized endpont', function() { beforeEach(function() { getConfig(dir).then(config => { return runEndpointGen('Foo', {config: config['generator-angular-fullstack']}); From 1c91686baa0c24eade8fb8b34361417c7ff2c94e Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Wed, 27 Apr 2016 01:51:01 -0400 Subject: [PATCH 093/885] refactor(gen:test): move DEBUG var to mocha.conf.js --- gulpfile.js | 5 ++++- mocha.conf.js | 3 +++ src/test/main.test.js | 2 -- 3 files changed, 7 insertions(+), 3 deletions(-) create mode 100644 mocha.conf.js diff --git a/gulpfile.js b/gulpfile.js index 3b47197d6..6ffef6e65 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -24,7 +24,10 @@ const mocha = lazypipe() timeout: 120000, globals: { should: require('should') - } + }, + require: [ + './mocha.conf' + ] }); const transpile = lazypipe() diff --git a/mocha.conf.js b/mocha.conf.js new file mode 100644 index 000000000..8fbbb39e6 --- /dev/null +++ b/mocha.conf.js @@ -0,0 +1,3 @@ +'use strict'; + +global.DEBUG = !!process.env.DEBUG; diff --git a/src/test/main.test.js b/src/test/main.test.js index 62eeed2b0..1f5f8a70e 100644 --- a/src/test/main.test.js +++ b/src/test/main.test.js @@ -26,8 +26,6 @@ const defaultOptions = { oauth: [], socketio: true }; -// var DEBUG = true; -var DEBUG = false; const TEST_DIR = __dirname; function copyAsync(src, dest) { From fdd5b68899f22057829066363c2c047333875f58 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Wed, 27 Apr 2016 02:04:55 -0400 Subject: [PATCH 094/885] refactor(gen:test): pull 4 helper functions out into a separate module --- src/test/main.test.js | 60 ++++---------------------------------- src/test/test-helpers.js | 63 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+), 54 deletions(-) create mode 100644 src/test/test-helpers.js diff --git a/src/test/main.test.js b/src/test/main.test.js index 1f5f8a70e..8f7a0836f 100644 --- a/src/test/main.test.js +++ b/src/test/main.test.js @@ -4,11 +4,15 @@ import fs from 'fs'; import _ from 'lodash'; import Promise from 'bluebird'; Promise.promisifyAll(fs); -import {exec} from 'child_process'; import helpers from 'yeoman-test'; import assert from 'yeoman-assert'; import * as getExpectedFiles from './get-expected-files'; -import recursiveReadDir from 'recursive-readdir'; +import { + copyAsync, + runCmd, + assertOnlyFiles, + getConfig +} from './test-helpers'; const defaultOptions = { buildtool: 'grunt', @@ -28,52 +32,6 @@ const defaultOptions = { }; const TEST_DIR = __dirname; -function copyAsync(src, dest) { - return fs.readFileAsync(src) - .then(data => fs.writeFileAsync(dest, data)); -} - -/** - * @callback doneCallback - * @param {null|Error} err - */ - -/** - * Run the given command in a child process - * @param {string} cmd - command to run - * @param {doneCallback} done - */ -function runCmd(cmd, done) { - exec(cmd, {}, function(err, stdout, stderr) { - if(err) { - console.error(stdout); - throw new Error(`Error running command: ${cmd}`); - done(err); - } else { - if(DEBUG) console.log(stdout); - done(); - } - }); -} - -function assertOnlyFiles(expectedFiles, topLevelPath='./', skip=['node_modules', 'bower_components']) { - return new Promise((resolve, reject) => { - recursiveReadDir(topLevelPath, skip, function(err, actualFiles) { - if(err) return reject(err); - - actualFiles = _.map(actualFiles.concat(), file => path.normalize(file.replace(path.normalize(`${topLevelPath}/`), ''))); - expectedFiles = _.map(expectedFiles, file => path.normalize(file)); - - let extras = _.pullAll(actualFiles, expectedFiles); - - if(extras.length !== 0) { - return reject(extras); - } - resolve(); - }); - }); -} - function runGen(prompts) { return new Promise((resolve, reject) => { let dir; @@ -130,12 +88,6 @@ function runEndpointGen(name, opt={}) { }); } -function getConfig(dir) { - return fs.readFileAsync(path.join(dir, '.yo-rc.json'), 'utf8').then(data => { - return JSON.parse(data); - }); -} - describe('angular-fullstack:app', function() { beforeEach(function() { this.gen = runGen(defaultOptions); diff --git a/src/test/test-helpers.js b/src/test/test-helpers.js new file mode 100644 index 000000000..7ddf890cb --- /dev/null +++ b/src/test/test-helpers.js @@ -0,0 +1,63 @@ +'use strict'; +import path from 'path'; +import fs from 'fs'; +import _ from 'lodash'; +import Promise from 'bluebird'; +Promise.promisifyAll(fs); +import {exec} from 'child_process'; +import helpers from 'yeoman-test'; +import assert from 'yeoman-assert'; +import * as getExpectedFiles from './get-expected-files'; +import recursiveReadDir from 'recursive-readdir'; + +export function copyAsync(src, dest) { + return fs.readFileAsync(src) + .then(data => fs.writeFileAsync(dest, data)); +} + +/** + * @callback doneCallback + * @param {null|Error} err + */ + +/** + * Run the given command in a child process + * @param {string} cmd - command to run + * @param {doneCallback} done + */ +export function runCmd(cmd, done) { + exec(cmd, {}, function(err, stdout, stderr) { + if(err) { + console.error(stdout); + throw new Error(`Error running command: ${cmd}`); + done(err); + } else { + if(DEBUG) console.log(stdout); + done(); + } + }); +} + +export function assertOnlyFiles(expectedFiles, topLevelPath='./', skip=['node_modules', 'bower_components']) { + return new Promise((resolve, reject) => { + recursiveReadDir(topLevelPath, skip, function(err, actualFiles) { + if(err) return reject(err); + + actualFiles = _.map(actualFiles.concat(), file => path.normalize(file.replace(path.normalize(`${topLevelPath}/`), ''))); + expectedFiles = _.map(expectedFiles, file => path.normalize(file)); + + let extras = _.pullAll(actualFiles, expectedFiles); + + if(extras.length !== 0) { + return reject(extras); + } + resolve(); + }); + }); +} + +export function getConfig(dir) { + return fs.readFileAsync(path.join(dir, '.yo-rc.json'), 'utf8').then(data => { + return JSON.parse(data); + }); +} From 0b363756b62263396c45165741ef1ef88b0d5bba Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Wed, 27 Apr 2016 02:20:15 -0400 Subject: [PATCH 095/885] feat(gen:test): add endpoint path name test --- src/test/main.test.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/test/main.test.js b/src/test/main.test.js index 8f7a0836f..84756b05c 100644 --- a/src/test/main.test.js +++ b/src/test/main.test.js @@ -156,9 +156,21 @@ describe('angular-fullstack:app', function() { }); }); - it('should pass lint with generated path name endpoint'); //'foo/bar' + describe('with a generated path name endpont', function() { + beforeEach(function() { + getConfig(dir).then(config => { + return runEndpointGen('foo/bar', {config: config['generator-angular-fullstack']}); + }); + }); + + it('should pass jscs'); - it('should run server tests successfully with generated path name endpoint'); + it('should pass lint'); + + it('should run server tests successfully', function(done) { + runCmd('grunt test:server', done); + }); + }); it('should generate expected files with path name endpoint'); // [ From babb03fa5b38dd345ae58bc330aee5842d784c2a Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Wed, 27 Apr 2016 02:25:41 -0400 Subject: [PATCH 096/885] fix(gen:test): fix `getConfig` path --- src/test/main.test.js | 6 +++--- src/test/test-helpers.js | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/test/main.test.js b/src/test/main.test.js index 84756b05c..49823798c 100644 --- a/src/test/main.test.js +++ b/src/test/main.test.js @@ -126,7 +126,7 @@ describe('angular-fullstack:app', function() { describe('with a generated endpont', function() { beforeEach(function() { - getConfig(dir).then(config => { + getConfig(path.join(dir, '.yo-rc.json')).then(config => { return runEndpointGen('foo', {config: config['generator-angular-fullstack']}); }); }); @@ -142,7 +142,7 @@ describe('angular-fullstack:app', function() { describe('with a generated capitalized endpont', function() { beforeEach(function() { - getConfig(dir).then(config => { + getConfig(path.join(dir, '.yo-rc.json')).then(config => { return runEndpointGen('Foo', {config: config['generator-angular-fullstack']}); }); }); @@ -158,7 +158,7 @@ describe('angular-fullstack:app', function() { describe('with a generated path name endpont', function() { beforeEach(function() { - getConfig(dir).then(config => { + getConfig(path.join(dir, '.yo-rc.json')).then(config => { return runEndpointGen('foo/bar', {config: config['generator-angular-fullstack']}); }); }); diff --git a/src/test/test-helpers.js b/src/test/test-helpers.js index 7ddf890cb..7a45e4b25 100644 --- a/src/test/test-helpers.js +++ b/src/test/test-helpers.js @@ -56,8 +56,8 @@ export function assertOnlyFiles(expectedFiles, topLevelPath='./', skip=['node_mo }); } -export function getConfig(dir) { - return fs.readFileAsync(path.join(dir, '.yo-rc.json'), 'utf8').then(data => { +export function getConfig(path) { + return fs.readFileAsync(path, 'utf8').then(data => { return JSON.parse(data); }); } From 2a1d702860dda8540c043ee90271eebb68c1ed79 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Thu, 28 Apr 2016 02:56:19 -0400 Subject: [PATCH 097/885] refactor(gen:test): runCmd returns a Promise instead of taking a callback --- src/test/main.test.js | 28 ++++++++++++++-------------- src/test/test-helpers.js | 23 ++++++++++++----------- 2 files changed, 26 insertions(+), 25 deletions(-) diff --git a/src/test/main.test.js b/src/test/main.test.js index 49823798c..d6bc3eac6 100644 --- a/src/test/main.test.js +++ b/src/test/main.test.js @@ -108,20 +108,20 @@ describe('angular-fullstack:app', function() { return assertOnlyFiles(expectedFiles, path.normalize(dir)).should.eventually.be.fulfilled; }); - it('passes JSCS', function(done) { - runCmd('grunt jscs', done); + it('passes JSCS', function() { + return runCmd('grunt jscs').should.be.fulfilled(); }); - it('passes JSHint', function(done) { - runCmd('grunt jshint', done); + it('passes JSHint', function() { + return runCmd('grunt jshint').should.be.fulfilled(); }); - it('passes client tests', function(done) { - runCmd('grunt test:client', done); + it('passes client tests', function() { + return runCmd('grunt test:client').should.be.fulfilled(); }); - it('passes server tests', function(done) { - runCmd('grunt test:server', done); + it('passes server tests', function() { + return runCmd('grunt test:server').should.be.fulfilled(); }); describe('with a generated endpont', function() { @@ -135,8 +135,8 @@ describe('angular-fullstack:app', function() { it('should pass lint'); - it('should run server tests successfully', function(done) { - runCmd('grunt test:server', done); + it('should run server tests successfully', function() { + return runCmd('grunt test:server').should.be.fulfilled(); }); }); @@ -151,8 +151,8 @@ describe('angular-fullstack:app', function() { it('should pass lint'); - it('should run server tests successfully', function(done) { - runCmd('grunt test:server', done); + it('should run server tests successfully', function() { + return runCmd('grunt test:server').should.be.fulfilled(); }); }); @@ -167,8 +167,8 @@ describe('angular-fullstack:app', function() { it('should pass lint'); - it('should run server tests successfully', function(done) { - runCmd('grunt test:server', done); + it('should run server tests successfully', function() { + return runCmd('grunt test:server').should.be.fulfilled(); }); }); diff --git a/src/test/test-helpers.js b/src/test/test-helpers.js index 7a45e4b25..9745c2cfe 100644 --- a/src/test/test-helpers.js +++ b/src/test/test-helpers.js @@ -23,18 +23,19 @@ export function copyAsync(src, dest) { /** * Run the given command in a child process * @param {string} cmd - command to run - * @param {doneCallback} done + * @returns {Promise} */ -export function runCmd(cmd, done) { - exec(cmd, {}, function(err, stdout, stderr) { - if(err) { - console.error(stdout); - throw new Error(`Error running command: ${cmd}`); - done(err); - } else { - if(DEBUG) console.log(stdout); - done(); - } +export function runCmd(cmd) { + return new Promise((resolve, reject) => { + exec(cmd, {}, function(err, stdout, stderr) { + if(err) { + console.error(stdout); + return reject(err); + } else { + if(DEBUG) console.log(`${cmd} stdout: ${stdout}`); + return resolve(); + } + }); }); } From 887476fc5988c4781730c5f9a69a9c0fad17e752 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Thu, 28 Apr 2016 02:58:09 -0400 Subject: [PATCH 098/885] feat(gen:test): add endpoint-specific tests --- package.json | 1 + src/test/endpoint.test.js | 192 +++++++++++++++++++++++++++++++++ src/test/get-expected-files.js | 17 +-- 3 files changed, 202 insertions(+), 8 deletions(-) create mode 100644 src/test/endpoint.test.js diff --git a/package.json b/package.json index 524ab175b..0e6ebf82e 100644 --- a/package.json +++ b/package.json @@ -74,6 +74,7 @@ "jit-grunt": "~0.10.0", "lazypipe": "^1.0.1", "merge-stream": "^1.0.0", + "minimatch": "^3.0.0", "mocha": "^2.2.5", "q": "^1.0.1", "recursive-readdir": "^2.0.0", diff --git a/src/test/endpoint.test.js b/src/test/endpoint.test.js new file mode 100644 index 000000000..7c925c93e --- /dev/null +++ b/src/test/endpoint.test.js @@ -0,0 +1,192 @@ +'use strict'; +import path from 'path'; +import fs from 'fs'; +import _ from 'lodash'; +import Promise from 'bluebird'; +Promise.promisifyAll(fs); +import helpers from 'yeoman-test'; +import assert from 'yeoman-assert'; +import minimatch from 'minimatch'; +import * as getExpectedFiles from './get-expected-files'; +import { + copyAsync, + runCmd, + assertOnlyFiles, + getConfig +} from './test-helpers'; + +const TEST_DIR = __dirname; + +const defaultOptions = { + buildtool: 'grunt', + script: 'js', + transpiler: 'babel', + markup: 'html', + stylesheet: 'sass', + router: 'uirouter', + testing: 'mocha', + chai: 'expect', + bootstrap: true, + uibootstrap: true, + odms: ['mongoose'], + auth: true, + oauth: [], + socketio: true +}; +function runGen(prompts) { + return new Promise((resolve, reject) => { + let dir; + helpers + .run(require.resolve('../generators/app')) + .inTmpDir(function(_dir) { + // this will create a new temporary directory for each new generator run + var done = this.async(); + if(DEBUG) console.log(`TEMP DIR: ${_dir}`); + dir = _dir; + + // symlink our dependency directories + return Promise.all([ + fs.mkdirAsync(dir + '/client').then(() => { + return fs.symlinkAsync(__dirname + '/fixtures/bower_components', dir + '/client/bower_components'); + }), + fs.symlinkAsync(__dirname + '/fixtures/node_modules', dir + '/node_modules') + ]).then(done); + }) + .withGenerators([ + require.resolve('../generators/endpoint'), + // [helpers.createDummyGenerator(), 'ng-component:app'] + ]) + .withOptions({ + skipInstall: true + }) + .withPrompts(prompts) + .on('error', reject) + .on('end', () => resolve(dir)); + }); +} + +function runEndpointGen(name, opt={}) { + let prompts = opt.prompts || {}; + let options = opt.options || {}; + let config = opt.config; + + return new Promise((resolve, reject) => { + let dir; + let gen = helpers + .run(require.resolve('../generators/endpoint')) + .inTmpDir(function(_dir) { + // this will create a new temporary directory for each new generator run + var done = this.async(); + if(DEBUG) console.log(`TEMP DIR: ${_dir}`); + dir = _dir; + + // symlink our dependency directories + return Promise.all([ + fs.mkdirAsync(dir + '/client').then(() => { + return fs.symlinkAsync(__dirname + '/fixtures/bower_components', dir + '/client/bower_components'); + }), + fs.symlinkAsync(__dirname + '/fixtures/node_modules', dir + '/node_modules') + ]).then(done); + }) + .withOptions(options) + .withArguments([name]) + .withPrompts(prompts); + + if(config) { + gen + .withLocalConfig(config); + } + + gen + .on('error', reject) + .on('end', () => resolve(dir)) + }); +} + +let jshintCmd = path.join(TEST_DIR, '/fixtures/node_modules/.bin/jshint'); +function jshint(_path, opt={}) { + let {exclude, config} = opt; + let cmd = `${jshintCmd} ${path.normalize(_path)}`; + if(exclude) cmd += ` --exclude ${exclude}`; + if(config) cmd += ` --config ${config}`; + return runCmd(cmd); +} + +var config; +var genDir; + +before(function() { + return Promise.all([ + runGen(defaultOptions).then(_dir => { + genDir = _dir; + }), + getConfig(path.join(TEST_DIR, 'fixtures/.yo-rc.json')).then(_config => { + _config['generator-angular-fullstack'].insertRoutes = false; + _config['generator-angular-fullstack'].pluralizeRoutes = false; + _config['generator-angular-fullstack'].insertSockets = false; + _config['generator-angular-fullstack'].insertModels = false; + config = _config; + }) + ]); +}); + +describe('angular-fullstack:endpoint', function() { + describe(`with a generated endpont 'foo'`, function() { + var dir; + beforeEach(function() { + return runEndpointGen('foo', {config: config['generator-angular-fullstack']}).then(_dir => { + dir = _dir; + + return Promise.all([ + copyAsync(path.join(genDir, '/server/.jshintrc'), './server/.jshintrc'), + copyAsync(path.join(genDir, '/server/.jshintrc-spec'), './server/.jshintrc-spec') + ]); + }); + }); + + it('should generate the expected files', function() { + assert.file(getExpectedFiles.endpoint('foo')); + }); + + it('should pass jscs'); + + it('should pass lint', function() { + let endpointDir = path.join(dir, 'server/api/foo/'); + let regFiles = fs.readdirAsync(endpointDir) + .then(files => files.filter(file => minimatch(file, '**/!(*.spec|*.mock|*.integration).js', {dot: true}))) + .map(file => jshint(`./server/api/foo/${file}`)); + + let specFiles = fs.readdirAsync(endpointDir) + .then(files => files.filter(file => minimatch(file, '**/+(*.spec|*.mock|*.integration).js', {dot: true}))) + .map(file => jshint(`./server/api/food/${file}`, {config: 'server/.jshintrc-spec'})); + + return Promise.all([regFiles, specFiles]).should.be.fulfilled(); + }); + }); + + describe('with a generated capitalized endpont', function() { + var dir; + beforeEach(function() { + return runEndpointGen('foo', {config: config['generator-angular-fullstack']}).then(_dir => { + dir = _dir; + }); + }); + + it('should pass jscs'); + + it('should pass lint'); + }); + + describe('with a generated path name endpont', function() { + var dir; + beforeEach(function() { + return runEndpointGen('foo', {config: config['generator-angular-fullstack']}).then(_dir => { + dir = _dir; + }); + }); + + it('should pass jscs'); + + it('should pass lint'); + }); +}); \ No newline at end of file diff --git a/src/test/get-expected-files.js b/src/test/get-expected-files.js index 6a435b3dd..c3ac9a338 100644 --- a/src/test/get-expected-files.js +++ b/src/test/get-expected-files.js @@ -224,14 +224,15 @@ export function app(options) { return files; } -export function endpoint(name, options) { +export function endpoint(name, path) { + if(!path) path = name; return [ - `server/api/${name}/index.js`, - `server/api/${name}/index.spec.js`, - `server/api/${name}/bar.controller.js`, - `server/api/${name}/bar.events.js`, - `server/api/${name}/bar.integration.js`, - `server/api/${name}/bar.model.js`, - `server/api/${name}/bar.socket.js` + `server/api/${path}/index.js`, + `server/api/${path}/index.spec.js`, + `server/api/${path}/${name}.controller.js`, + `server/api/${path}/${name}.events.js`, + `server/api/${path}/${name}.integration.js`, + `server/api/${path}/${name}.model.js`, + `server/api/${path}/${name}.socket.js` ]; } From cfa3152319a19355bff10fd1f59cf32bee7835d4 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Thu, 28 Apr 2016 13:36:24 -0400 Subject: [PATCH 099/885] test(gen:main): remove pending endpoint lint tasks --- src/test/main.test.js | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/src/test/main.test.js b/src/test/main.test.js index d6bc3eac6..c334174ce 100644 --- a/src/test/main.test.js +++ b/src/test/main.test.js @@ -131,10 +131,6 @@ describe('angular-fullstack:app', function() { }); }); - it('should pass jscs'); //'foo' - - it('should pass lint'); - it('should run server tests successfully', function() { return runCmd('grunt test:server').should.be.fulfilled(); }); @@ -147,10 +143,6 @@ describe('angular-fullstack:app', function() { }); }); - it('should pass jscs'); - - it('should pass lint'); - it('should run server tests successfully', function() { return runCmd('grunt test:server').should.be.fulfilled(); }); @@ -163,10 +155,6 @@ describe('angular-fullstack:app', function() { }); }); - it('should pass jscs'); - - it('should pass lint'); - it('should run server tests successfully', function() { return runCmd('grunt test:server').should.be.fulfilled(); }); From 17d9985d6afef905aa2edccc2c69923d70d778bd Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Thu, 28 Apr 2016 13:53:10 -0400 Subject: [PATCH 100/885] fix(gen:test:endpoint): `jshint` function also checks that the file exists --- src/test/endpoint.test.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/test/endpoint.test.js b/src/test/endpoint.test.js index 7c925c93e..2950448ab 100644 --- a/src/test/endpoint.test.js +++ b/src/test/endpoint.test.js @@ -105,11 +105,14 @@ function runEndpointGen(name, opt={}) { let jshintCmd = path.join(TEST_DIR, '/fixtures/node_modules/.bin/jshint'); function jshint(_path, opt={}) { - let {exclude, config} = opt; - let cmd = `${jshintCmd} ${path.normalize(_path)}`; - if(exclude) cmd += ` --exclude ${exclude}`; - if(config) cmd += ` --config ${config}`; - return runCmd(cmd); + _path = path.normalize(_path); + return fs.accessAsync(_path, fs.R_OK).then(err => { + let {config} = opt; + let cmd = `${jshintCmd} ${path.normalize(_path)}`; + if(config) cmd += ` --config ${config}`; + return runCmd(cmd); + }); +} } var config; From 61eb160ffe7ac2d8c2877dfc52511b8619d975c7 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Thu, 28 Apr 2016 13:54:16 -0400 Subject: [PATCH 101/885] refactor(test:endpoint): break out jshint suite into helper function --- src/test/endpoint.test.js | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/src/test/endpoint.test.js b/src/test/endpoint.test.js index 2950448ab..8bb10bb30 100644 --- a/src/test/endpoint.test.js +++ b/src/test/endpoint.test.js @@ -113,6 +113,20 @@ function jshint(_path, opt={}) { return runCmd(cmd); }); } + +function jshintDir(dir, name, folder) { + if(!folder) folder = name; + let endpointDir = path.join(dir, 'server/api', folder); + + let regFiles = fs.readdirAsync(endpointDir) + .then(files => files.filter(file => minimatch(file, '**/!(*.spec|*.mock|*.integration).js', {dot: true}))) + .map(file => jshint(path.join('./server/api/', folder, file))); + + let specFiles = fs.readdirAsync(endpointDir) + .then(files => files.filter(file => minimatch(file, '**/+(*.spec|*.mock|*.integration).js', {dot: true}))) + .map(file => jshint(path.join('./server/api/', folder, file), {config: 'server/.jshintrc-spec'})); + + return Promise.all([regFiles, specFiles]); } var config; @@ -154,16 +168,7 @@ describe('angular-fullstack:endpoint', function() { it('should pass jscs'); it('should pass lint', function() { - let endpointDir = path.join(dir, 'server/api/foo/'); - let regFiles = fs.readdirAsync(endpointDir) - .then(files => files.filter(file => minimatch(file, '**/!(*.spec|*.mock|*.integration).js', {dot: true}))) - .map(file => jshint(`./server/api/foo/${file}`)); - - let specFiles = fs.readdirAsync(endpointDir) - .then(files => files.filter(file => minimatch(file, '**/+(*.spec|*.mock|*.integration).js', {dot: true}))) - .map(file => jshint(`./server/api/food/${file}`, {config: 'server/.jshintrc-spec'})); - - return Promise.all([regFiles, specFiles]).should.be.fulfilled(); + return jshintDir(dir, 'foo').should.be.fulfilled(); }); }); From 20cfbe62bebabcbcdee00b2917a8d8e71651b15a Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Thu, 28 Apr 2016 18:52:23 -0400 Subject: [PATCH 102/885] test(gen:endpoint): add other 2 lint tests, file assert stubs --- src/test/endpoint.test.js | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/src/test/endpoint.test.js b/src/test/endpoint.test.js index 8bb10bb30..ed06d1575 100644 --- a/src/test/endpoint.test.js +++ b/src/test/endpoint.test.js @@ -175,26 +175,44 @@ describe('angular-fullstack:endpoint', function() { describe('with a generated capitalized endpont', function() { var dir; beforeEach(function() { - return runEndpointGen('foo', {config: config['generator-angular-fullstack']}).then(_dir => { + return runEndpointGen('Foo', {config: config['generator-angular-fullstack']}).then(_dir => { dir = _dir; + + return Promise.all([ + copyAsync(path.join(genDir, '/server/.jshintrc'), './server/.jshintrc'), + copyAsync(path.join(genDir, '/server/.jshintrc-spec'), './server/.jshintrc-spec') + ]); }); }); + it('should generate the expected files'); + it('should pass jscs'); - it('should pass lint'); + it('should pass lint', function() { + return jshintDir(dir, 'Foo').should.be.fulfilled(); + }); }); describe('with a generated path name endpont', function() { var dir; beforeEach(function() { - return runEndpointGen('foo', {config: config['generator-angular-fullstack']}).then(_dir => { + return runEndpointGen('foo/bar', {config: config['generator-angular-fullstack']}).then(_dir => { dir = _dir; + + return Promise.all([ + copyAsync(path.join(genDir, '/server/.jshintrc'), './server/.jshintrc'), + copyAsync(path.join(genDir, '/server/.jshintrc-spec'), './server/.jshintrc-spec') + ]); }); }); + it('should generate the expected files'); + it('should pass jscs'); - it('should pass lint'); + it('should pass lint', function() { + return jshintDir(dir, 'foo', 'foo/bar').should.be.fulfilled(); + }); }); }); \ No newline at end of file From 07d78eb971b8271d75c393b1437630dbc775d5da Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Fri, 29 Apr 2016 19:32:13 -0400 Subject: [PATCH 103/885] refactor(gen:test:endpoint): refactor `jshint` into more generic `testFile`, add jscsCmd --- src/test/endpoint.test.js | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/test/endpoint.test.js b/src/test/endpoint.test.js index ed06d1575..f57589f26 100644 --- a/src/test/endpoint.test.js +++ b/src/test/endpoint.test.js @@ -99,18 +99,16 @@ function runEndpointGen(name, opt={}) { gen .on('error', reject) - .on('end', () => resolve(dir)) + .on('end', () => resolve(dir)); }); } let jshintCmd = path.join(TEST_DIR, '/fixtures/node_modules/.bin/jshint'); -function jshint(_path, opt={}) { +let jscsCmd = path.join(TEST_DIR, '/fixtures/node_modules/gulp-jscs/node_modules/.bin/jscs'); +function testFile(command, _path) { _path = path.normalize(_path); - return fs.accessAsync(_path, fs.R_OK).then(err => { - let {config} = opt; - let cmd = `${jshintCmd} ${path.normalize(_path)}`; - if(config) cmd += ` --config ${config}`; - return runCmd(cmd); + return fs.accessAsync(_path, fs.R_OK).then(() => { + return runCmd(`${command} ${_path}`); }); } @@ -120,11 +118,11 @@ function jshintDir(dir, name, folder) { let regFiles = fs.readdirAsync(endpointDir) .then(files => files.filter(file => minimatch(file, '**/!(*.spec|*.mock|*.integration).js', {dot: true}))) - .map(file => jshint(path.join('./server/api/', folder, file))); + .map(file => testFile(jshintCmd, path.join('./server/api/', folder, file))); let specFiles = fs.readdirAsync(endpointDir) .then(files => files.filter(file => minimatch(file, '**/+(*.spec|*.mock|*.integration).js', {dot: true}))) - .map(file => jshint(path.join('./server/api/', folder, file), {config: 'server/.jshintrc-spec'})); + .map(file => testFile(`${jshintCmd} --config server/.jshintrc-spec`, path.join('./server/api/', folder, file))); return Promise.all([regFiles, specFiles]); } From f145af27d306a6db3962df6dcd59b2ed7fc656b6 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Fri, 29 Apr 2016 19:33:38 -0400 Subject: [PATCH 104/885] test(gen:endpoint): jshint other 2 endpoints --- src/test/endpoint.test.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/test/endpoint.test.js b/src/test/endpoint.test.js index f57589f26..31078f1dc 100644 --- a/src/test/endpoint.test.js +++ b/src/test/endpoint.test.js @@ -183,7 +183,9 @@ describe('angular-fullstack:endpoint', function() { }); }); - it('should generate the expected files'); + it('should generate the expected files', function() { + assert.file(getExpectedFiles.endpoint('Foo')); + }); it('should pass jscs'); @@ -205,7 +207,9 @@ describe('angular-fullstack:endpoint', function() { }); }); - it('should generate the expected files'); + it('should generate the expected files', function() { + assert.file(getExpectedFiles.endpoint('bar', 'foo/bar')); + }); it('should pass jscs'); From 5389c143c634627206043c6512e1ec6437f4df7f Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Fri, 29 Apr 2016 19:50:16 -0400 Subject: [PATCH 105/885] test(gen:endpoint): add jscs endpoint tests --- src/test/endpoint.test.js | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/src/test/endpoint.test.js b/src/test/endpoint.test.js index 31078f1dc..e0d074a98 100644 --- a/src/test/endpoint.test.js +++ b/src/test/endpoint.test.js @@ -126,6 +126,13 @@ function jshintDir(dir, name, folder) { return Promise.all([regFiles, specFiles]); } +function jscsDir(dir, name, folder) { + if(!folder) folder = name; + let endpointDir = path.join(dir, 'server/api', folder); + + return fs.readdirAsync(endpointDir) + .map(file => testFile(jscsCmd, path.join('./server/api/', folder, file)));; +} var config; var genDir; @@ -154,7 +161,8 @@ describe('angular-fullstack:endpoint', function() { return Promise.all([ copyAsync(path.join(genDir, '/server/.jshintrc'), './server/.jshintrc'), - copyAsync(path.join(genDir, '/server/.jshintrc-spec'), './server/.jshintrc-spec') + copyAsync(path.join(genDir, '/server/.jshintrc-spec'), './server/.jshintrc-spec'), + copyAsync(path.join(genDir, '/.jscsrc'), './.jscsrc') ]); }); }); @@ -163,7 +171,9 @@ describe('angular-fullstack:endpoint', function() { assert.file(getExpectedFiles.endpoint('foo')); }); - it('should pass jscs'); + it('should pass jscs', function() { + return jscsDir(dir, 'foo').should.be.fulfilled(); + }); it('should pass lint', function() { return jshintDir(dir, 'foo').should.be.fulfilled(); @@ -178,7 +188,8 @@ describe('angular-fullstack:endpoint', function() { return Promise.all([ copyAsync(path.join(genDir, '/server/.jshintrc'), './server/.jshintrc'), - copyAsync(path.join(genDir, '/server/.jshintrc-spec'), './server/.jshintrc-spec') + copyAsync(path.join(genDir, '/server/.jshintrc-spec'), './server/.jshintrc-spec'), + copyAsync(path.join(genDir, '/.jscsrc'), './.jscsrc') ]); }); }); @@ -187,7 +198,9 @@ describe('angular-fullstack:endpoint', function() { assert.file(getExpectedFiles.endpoint('Foo')); }); - it('should pass jscs'); + it('should pass jscs', function() { + return jscsDir(dir, 'Foo').should.be.fulfilled(); + }); it('should pass lint', function() { return jshintDir(dir, 'Foo').should.be.fulfilled(); @@ -202,7 +215,8 @@ describe('angular-fullstack:endpoint', function() { return Promise.all([ copyAsync(path.join(genDir, '/server/.jshintrc'), './server/.jshintrc'), - copyAsync(path.join(genDir, '/server/.jshintrc-spec'), './server/.jshintrc-spec') + copyAsync(path.join(genDir, '/server/.jshintrc-spec'), './server/.jshintrc-spec'), + copyAsync(path.join(genDir, '/.jscsrc'), './.jscsrc') ]); }); }); @@ -211,7 +225,9 @@ describe('angular-fullstack:endpoint', function() { assert.file(getExpectedFiles.endpoint('bar', 'foo/bar')); }); - it('should pass jscs'); + it('should pass jscs', function() { + return jscsDir(dir, 'foo', 'foo/bar').should.be.fulfilled(); + }); it('should pass lint', function() { return jshintDir(dir, 'foo', 'foo/bar').should.be.fulfilled(); From 93d7cb6e2c0fbb495d5309fc30b51d102917e533 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Sat, 30 Apr 2016 03:37:16 -0400 Subject: [PATCH 106/885] test(gen:endpont): use jscs programmatically --- package.json | 1 + src/test/endpoint.test.js | 27 ++++++++++++++++++++++++--- templates/app/.jscsrc | 1 - 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 0e6ebf82e..168f15fed 100644 --- a/package.json +++ b/package.json @@ -72,6 +72,7 @@ "gulp-plumber": "^1.1.0", "gulp-util": "^3.0.7", "jit-grunt": "~0.10.0", + "jscs": "^3.0.3", "lazypipe": "^1.0.1", "merge-stream": "^1.0.0", "minimatch": "^3.0.0", diff --git a/src/test/endpoint.test.js b/src/test/endpoint.test.js index e0d074a98..e52ae077f 100644 --- a/src/test/endpoint.test.js +++ b/src/test/endpoint.test.js @@ -7,6 +7,9 @@ Promise.promisifyAll(fs); import helpers from 'yeoman-test'; import assert from 'yeoman-assert'; import minimatch from 'minimatch'; +import Checker from 'jscs'; +const jscs = new Checker(); +jscs.registerDefaultRules(); import * as getExpectedFiles from './get-expected-files'; import { copyAsync, @@ -104,7 +107,6 @@ function runEndpointGen(name, opt={}) { } let jshintCmd = path.join(TEST_DIR, '/fixtures/node_modules/.bin/jshint'); -let jscsCmd = path.join(TEST_DIR, '/fixtures/node_modules/gulp-jscs/node_modules/.bin/jscs'); function testFile(command, _path) { _path = path.normalize(_path); return fs.accessAsync(_path, fs.R_OK).then(() => { @@ -130,8 +132,23 @@ function jscsDir(dir, name, folder) { if(!folder) folder = name; let endpointDir = path.join(dir, 'server/api', folder); - return fs.readdirAsync(endpointDir) - .map(file => testFile(jscsCmd, path.join('./server/api/', folder, file)));; + return fs.readdirAsync(endpointDir).then(files => { + return Promise.map(files, file => { + return fs.readFileAsync(path.join('server/api', folder, file), 'utf8').then(data => { + let results = jscs.checkString(data) + let errors = results.getErrorList(); + if(errors.length === 0) { + return Promise.resolve(); + } else { + errors.forEach(error => { + var colorizeOutput = true; + console.log(results.explainError(error, colorizeOutput) + '\n'); + }); + return Promise.reject(); + } + }); + }); + }); } var config; @@ -141,6 +158,10 @@ before(function() { return Promise.all([ runGen(defaultOptions).then(_dir => { genDir = _dir; + + return fs.readFileAsync(path.join(genDir, '.jscsrc'), 'utf8').then(data => { + jscs.configure(JSON.parse(data)); + }); }), getConfig(path.join(TEST_DIR, 'fixtures/.yo-rc.json')).then(_config => { _config['generator-angular-fullstack'].insertRoutes = false; diff --git a/templates/app/.jscsrc b/templates/app/.jscsrc index 8923ad53e..e05f83c6c 100644 --- a/templates/app/.jscsrc +++ b/templates/app/.jscsrc @@ -2,7 +2,6 @@ "excludeFiles": [ "client/app/app.constant.js" ], - "esnext": true, "maximumLineLength": { "value": 100, "allowComments": true, From c70d35a79ddfb3d0a022c4df337f60fc448a138d Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Sat, 30 Apr 2016 04:06:12 -0400 Subject: [PATCH 107/885] test(gen): add pre-test (check fixtures) --- gulpfile.js | 2 +- src/test/pre.test.js | 46 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 src/test/pre.test.js diff --git a/gulpfile.js b/gulpfile.js index 6ffef6e65..b08c3968e 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -164,6 +164,6 @@ gulp.task('installFixtures', function() { }); gulp.task('test', () => { - return gulp.src('test/*.test.js') + return gulp.src(['test/pre.test.js', 'test/*.test.js']) .pipe(mocha()); }); diff --git a/src/test/pre.test.js b/src/test/pre.test.js new file mode 100644 index 000000000..d877cfb95 --- /dev/null +++ b/src/test/pre.test.js @@ -0,0 +1,46 @@ +'use strict'; +import path from 'path'; +import fs from 'fs'; +import _ from 'lodash'; +import Promise from 'bluebird'; +Promise.promisifyAll(fs); +import helpers from 'yeoman-test'; +import assert from 'yeoman-assert'; +import minimatch from 'minimatch'; +import * as getExpectedFiles from './get-expected-files'; +import { + copyAsync, + runCmd, + assertOnlyFiles, + getConfig +} from './test-helpers'; + +describe('test fixtures', function() { + it('should have package.json in fixtures', function() { + assert.file([path.join(__dirname, 'fixtures', 'package.json')]); + }); + + it('should have bower.json in fixtures', function() { + assert.file([path.join(__dirname, 'fixtures', 'bower.json')]); + }); + + it('should have all npm packages in fixtures/node_modules', function() { + var packageJson = require('./fixtures/package.json'); + var deps = Object.keys(packageJson.dependencies); + deps = deps.concat(Object.keys(packageJson.devDependencies)); + deps = deps.map(function(dep) { + return path.join(__dirname, 'fixtures', 'node_modules', dep); + }); + assert.file(deps); + }); + + it('should have all bower packages in fixtures/bower_components', function() { + var bowerJson = require('./fixtures/bower.json'); + var deps = Object.keys(bowerJson.dependencies); + deps = deps.concat(Object.keys(bowerJson.devDependencies)); + deps = deps.map(function(dep) { + return path.join(__dirname, 'fixtures', 'bower_components', dep); + }); + assert.file(deps); + }); +}); \ No newline at end of file From 0445fcc5a0a50f7e0048d2ad7c993cafb84db1b9 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Sat, 30 Apr 2016 17:12:23 -0400 Subject: [PATCH 108/885] test(gen:main): test using existing config --- src/test/fixtures/.yo-rc.json | 47 +++++++++++++++++++---- src/test/main.test.js | 72 +++++++++++++++++++++++++++-------- test/fixtures/.yo-rc.json | 47 +++++++++++++++++++---- 3 files changed, 137 insertions(+), 29 deletions(-) diff --git a/src/test/fixtures/.yo-rc.json b/src/test/fixtures/.yo-rc.json index 716e42b6c..3f652f692 100644 --- a/src/test/fixtures/.yo-rc.json +++ b/src/test/fixtures/.yo-rc.json @@ -13,24 +13,57 @@ "registerModelsFile": "server/sqldb/index.js", "modelsNeedle": "// Insert models below", "filters": { + "js": true, "babel": true, + "flow": false, "html": true, - "less": true, + "sass": true, "uirouter": true, - "bootstrap": false, - "uibootstrap": false, + "bootstrap": true, + "uibootstrap": true, "socketio": true, "auth": true, "models": true, "mongooseModels": true, "mongoose": true, - "oauth": true, - "googleAuth": true, "grunt": true, "mocha": true, "jasmine": false, - "should": true, - "expect": false + "expect": true } + }, + "generator-ng-component": { + "routeDirectory": "client/app/", + "directiveDirectory": "client/app/", + "componentDirectory": "app/components/", + "filterDirectory": "client/app/", + "serviceDirectory": "client/app/", + "basePath": "client", + "moduleName": "", + "modulePrompt": true, + "filters": [ + "uirouter", + "mocha", + "expect", + "should", + "uirouter", + "es6" + ], + "extensions": [ + "babel", + "js", + "html", + "scss" + ], + "directiveSimpleTemplates": "", + "directiveComplexTemplates": "", + "filterTemplates": "", + "serviceTemplates": "", + "factoryTemplates": "", + "controllerTemplates": "", + "componentTemplates": "", + "decoratorTemplates": "", + "providerTemplates": "", + "routeTemplates": "" } } diff --git a/src/test/main.test.js b/src/test/main.test.js index c334174ce..8459e6fab 100644 --- a/src/test/main.test.js +++ b/src/test/main.test.js @@ -16,7 +16,6 @@ import { const defaultOptions = { buildtool: 'grunt', - script: 'js', transpiler: 'babel', markup: 'html', stylesheet: 'sass', @@ -32,10 +31,12 @@ const defaultOptions = { }; const TEST_DIR = __dirname; -function runGen(prompts) { +function runGen(prompts, opts={}) { + let options = opts.options || {skipInstall: true}; + return new Promise((resolve, reject) => { let dir; - helpers + let gen = helpers .run(require.resolve('../generators/app')) .inTmpDir(function(_dir) { // this will create a new temporary directory for each new generator run @@ -43,23 +44,30 @@ function runGen(prompts) { if(DEBUG) console.log(`TEMP DIR: ${_dir}`); dir = _dir; - // symlink our dependency directories - return Promise.all([ + let promises = [ fs.mkdirAsync(dir + '/client').then(() => { return fs.symlinkAsync(__dirname + '/fixtures/bower_components', dir + '/client/bower_components'); }), fs.symlinkAsync(__dirname + '/fixtures/node_modules', dir + '/node_modules') - ]).then(done); + ]; + + if(opts.copyConfigFile) { + promises.push(copyAsync(path.join(TEST_DIR, 'fixtures/.yo-rc.json'), path.join(dir, '.yo-rc.json'))); + } + + // symlink our dependency directories + return Promise.all(promises).then(done); }) .withGenerators([ require.resolve('../generators/endpoint'), // [helpers.createDummyGenerator(), 'ng-component:app'] ]) - .withOptions({ - skipInstall: true - }) // .withArguments(['upperCaseBug']) - .withPrompts(prompts) + .withOptions(options); + + if(prompts) gen.withPrompts(prompts); + + gen .on('error', reject) .on('end', () => resolve(dir)); }); @@ -89,15 +97,11 @@ function runEndpointGen(name, opt={}) { } describe('angular-fullstack:app', function() { - beforeEach(function() { - this.gen = runGen(defaultOptions); - }); - describe('default settings', function() { var dir; beforeEach(function() { - return this.gen.then(_dir => { + return runGen(defaultOptions).then(_dir => { dir = _dir; }); }); @@ -202,4 +206,42 @@ describe('angular-fullstack:app', function() { it('should run e2e tests successfully for production app'); //'grunt test:e2e:prod' } }); + + describe('default settings using existing `.yo-rc.json`', function() { + var dir; + + beforeEach(function() { + return runGen(null, { + copyConfigFile: true, + options: { + skipInstall: true, + skipConfig: true + } + }).then(_dir => { + dir = _dir; + }); + }); + + it('generates the proper files', function() { + const expectedFiles = getExpectedFiles.app(defaultOptions); + assert.file(expectedFiles); + return assertOnlyFiles(expectedFiles, path.normalize(dir)).should.be.fulfilled(); + }); + + it('passes JSCS', function() { + return runCmd('grunt jscs').should.be.fulfilled(); + }); + + it('passes JSHint', function() { + return runCmd('grunt jshint').should.be.fulfilled(); + }); + + it('passes client tests', function() { + return runCmd('grunt test:client').should.be.fulfilled(); + }); + + it('passes server tests', function() { + return runCmd('grunt test:server').should.be.fulfilled(); + }); + }); }); \ No newline at end of file diff --git a/test/fixtures/.yo-rc.json b/test/fixtures/.yo-rc.json index 716e42b6c..3f652f692 100644 --- a/test/fixtures/.yo-rc.json +++ b/test/fixtures/.yo-rc.json @@ -13,24 +13,57 @@ "registerModelsFile": "server/sqldb/index.js", "modelsNeedle": "// Insert models below", "filters": { + "js": true, "babel": true, + "flow": false, "html": true, - "less": true, + "sass": true, "uirouter": true, - "bootstrap": false, - "uibootstrap": false, + "bootstrap": true, + "uibootstrap": true, "socketio": true, "auth": true, "models": true, "mongooseModels": true, "mongoose": true, - "oauth": true, - "googleAuth": true, "grunt": true, "mocha": true, "jasmine": false, - "should": true, - "expect": false + "expect": true } + }, + "generator-ng-component": { + "routeDirectory": "client/app/", + "directiveDirectory": "client/app/", + "componentDirectory": "app/components/", + "filterDirectory": "client/app/", + "serviceDirectory": "client/app/", + "basePath": "client", + "moduleName": "", + "modulePrompt": true, + "filters": [ + "uirouter", + "mocha", + "expect", + "should", + "uirouter", + "es6" + ], + "extensions": [ + "babel", + "js", + "html", + "scss" + ], + "directiveSimpleTemplates": "", + "directiveComplexTemplates": "", + "filterTemplates": "", + "serviceTemplates": "", + "factoryTemplates": "", + "controllerTemplates": "", + "componentTemplates": "", + "decoratorTemplates": "", + "providerTemplates": "", + "routeTemplates": "" } } From a1f2c6df0dc6dd30634ecff07979b4ef66235fbb Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Sat, 30 Apr 2016 18:31:13 -0400 Subject: [PATCH 109/885] test(gen:pre): add .bowerrc & .yo-rc.json checks --- src/test/pre.test.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/test/pre.test.js b/src/test/pre.test.js index d877cfb95..d08a90e59 100644 --- a/src/test/pre.test.js +++ b/src/test/pre.test.js @@ -17,11 +17,15 @@ import { describe('test fixtures', function() { it('should have package.json in fixtures', function() { - assert.file([path.join(__dirname, 'fixtures', 'package.json')]); + assert.file([path.join(__dirname, 'fixtures/package.json')]); }); - it('should have bower.json in fixtures', function() { - assert.file([path.join(__dirname, 'fixtures', 'bower.json')]); + it('should have .bowerrc & bower.json in fixtures', function() { + assert.file([path.join(__dirname, 'fixtures/bower.json'), path.join(__dirname, 'fixtures/.bowerrc')]); + }); + + it('should have .yo-rc.json in fixtures', function() { + assert.file([path.join(__dirname, 'fixtures/.yo-rc.json')]); }); it('should have all npm packages in fixtures/node_modules', function() { From df20c8ec95fc54524b15c268d059da5630766524 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Sat, 30 Apr 2016 18:32:03 -0400 Subject: [PATCH 110/885] test(gen:main): various fixes/etc --- src/test/main.test.js | 44 +++++-------------------------------------- 1 file changed, 5 insertions(+), 39 deletions(-) diff --git a/src/test/main.test.js b/src/test/main.test.js index 8459e6fab..794f6e085 100644 --- a/src/test/main.test.js +++ b/src/test/main.test.js @@ -109,7 +109,7 @@ describe('angular-fullstack:app', function() { it('generates the proper files', function() { const expectedFiles = getExpectedFiles.app(defaultOptions); assert.file(expectedFiles); - return assertOnlyFiles(expectedFiles, path.normalize(dir)).should.eventually.be.fulfilled; + return assertOnlyFiles(expectedFiles, path.normalize(dir)).should.be.fulfilled(); }); it('passes JSCS', function() { @@ -128,7 +128,7 @@ describe('angular-fullstack:app', function() { return runCmd('grunt test:server').should.be.fulfilled(); }); - describe('with a generated endpont', function() { + describe('with a generated endpoint', function() { beforeEach(function() { getConfig(path.join(dir, '.yo-rc.json')).then(config => { return runEndpointGen('foo', {config: config['generator-angular-fullstack']}); @@ -140,7 +140,7 @@ describe('angular-fullstack:app', function() { }); }); - describe('with a generated capitalized endpont', function() { + describe('with a generated capitalized endpoint', function() { beforeEach(function() { getConfig(path.join(dir, '.yo-rc.json')).then(config => { return runEndpointGen('Foo', {config: config['generator-angular-fullstack']}); @@ -152,7 +152,7 @@ describe('angular-fullstack:app', function() { }); }); - describe('with a generated path name endpont', function() { + describe('with a generated path name endpoint', function() { beforeEach(function() { getConfig(path.join(dir, '.yo-rc.json')).then(config => { return runEndpointGen('foo/bar', {config: config['generator-angular-fullstack']}); @@ -164,41 +164,7 @@ describe('angular-fullstack:app', function() { }); }); - it('should generate expected files with path name endpoint'); - // [ - // 'server/api/foo/bar/index.js', - // 'server/api/foo/bar/index.spec.js', - // 'server/api/foo/bar/bar.controller.js', - // 'server/api/foo/bar/bar.events.js', - // 'server/api/foo/bar/bar.integration.js', - // 'server/api/foo/bar/bar.model.js', - // 'server/api/foo/bar/bar.socket.js' - // ] - - it('should use existing config if available'); - // this.timeout(60000); - // return copyAsync(__dirname + '/fixtures/.yo-rc.json', __dirname + '/temp/.yo-rc.json').then(() => { - // var gen = helpers.createGenerator('angular-fullstack:app', [ - // '../../generators/app', - // '../../generators/endpoint', - // [ - // helpers.createDummyGenerator(), - // 'ng-component:app' - // ] - // ], [], { - // skipInstall: true - // }); - // helpers.mockPrompt(gen, { - // skipConfig: true - // }); - // gen.run(function () { - // assert.file([ - // 'client/app/main/main.less', - // 'server/auth/google/passport.js' - // ]); - // done(); - // }); - // }); + it('should run server tests successfully with generated snake-case endpoint'); //'foo-bar' if(!process.env.SKIP_E2E) { it('should run e2e tests successfully'); //'grunt test:e2e' From a24643a446e29eb30bdedc415281cbdf95982b49 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Sat, 30 Apr 2016 18:32:43 -0400 Subject: [PATCH 111/885] test(gen:main): add 'with TypeScript, Jade, Jasmine, LESS, & OAuth' suite --- src/test/main.test.js | 66 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/src/test/main.test.js b/src/test/main.test.js index 794f6e085..3efac0104 100644 --- a/src/test/main.test.js +++ b/src/test/main.test.js @@ -210,4 +210,70 @@ describe('angular-fullstack:app', function() { return runCmd('grunt test:server').should.be.fulfilled(); }); }); + + describe('with TypeScript, Jade, Jasmine, LESS, & OAuth', function() { + var dir; + var testOptions = { + buildtool: 'grunt', + transpiler: 'ts', + markup: 'jade', + stylesheet: 'less', + router: 'uirouter', + testing: 'jasmine', + odms: ['mongoose'], + auth: true, + oauth: ['twitterAuth', 'facebookAuth', 'googleAuth'], + socketio: true, + bootstrap: true, + uibootstrap: true + }; + + beforeEach(function() { + return runGen(testOptions).then(_dir => { + dir = _dir; + }); + }); + + it('should generate the proper files', function() { + const expectedFiles = getExpectedFiles.app(testOptions); + assert.file(expectedFiles); + return assertOnlyFiles(expectedFiles, path.normalize(dir)).should.be.fulfilled(); + }); + + it('passes JSCS', function() { + return runCmd('grunt jscs').should.be.fulfilled(); + }); + + it('passes lint', function() { + return runCmd('grunt tslint').should.be.fulfilled(); + }); + + it('should run client tests successfully', function() { + return runCmd('grunt test:client').should.be.fulfilled(); + }); + + it('should run server tests successfully', function() { + return runCmd('grunt test:server').should.be.fulfilled(); + }); + + describe('with a generated endpoint', function() { + beforeEach(function() { + getConfig(path.join(dir, '.yo-rc.json')).then(config => { + return runEndpointGen('foo', {config: config['generator-angular-fullstack']}); + }); + }); + + it('should run server tests successfully', function() { + return runCmd('grunt test:server').should.be.fulfilled(); + }); + }); + + if(!process.env.SKIP_E2E) { + it('should run e2e tests successfully'); + + //it('should run e2e tests successfully for production app', function (done) { + // runTest('grunt test:e2e:prod', this, done, 240000); + //}); + } + }); }); \ No newline at end of file From a75b1d4881b21d132b965f972d917f8816a9a5aa Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Sat, 30 Apr 2016 22:30:53 -0400 Subject: [PATCH 112/885] fix(client:navbar.controller): refactor EJS, exclude constructor if empty --- .../client/components/navbar/navbar.controller.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/templates/app/client/components/navbar/navbar.controller.js b/templates/app/client/components/navbar/navbar.controller.js index 958355f9f..12ae0b351 100644 --- a/templates/app/client/components/navbar/navbar.controller.js +++ b/templates/app/client/components/navbar/navbar.controller.js @@ -9,13 +9,19 @@ class NavbarController { isCollapsed = true; //end-non-standard + <%_ if(filters.ngroute || filters.auth) { _%> - constructor(<% if(!filters.uirouter) { %>$location<% } if(!filters.uirouter && filters.auth) { %>, <% } if (filters.auth) { %>Auth<% } %>) {<% if(!filters.uirouter) { %> - this.$location = $location;<% } %> - <% if (filters.auth) { %>this.isLoggedIn = Auth.isLoggedIn; + constructor(<% if(!filters.uirouter) { %>$location<% } if(!filters.uirouter && filters.auth) { %>, <% } if (filters.auth) { %>Auth<% } %>) { + <%_ if(!filters.uirouter) { _%> + this.$location = $location; + <%_ } _%> + <%_ if (filters.auth) { _%> + this.isLoggedIn = Auth.isLoggedIn; this.isAdmin = Auth.isAdmin; this.getCurrentUser = Auth.getCurrentUser; - <% } %>}<% if(!filters.uirouter) { %> + <%_ } _%> + }<% } %> + <%_ if(!filters.uirouter) { _%> isActive(route) { return route === this.$location.path(); From 4b4db99d73985bba4db20e7664b12fafe09ccaf1 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Sun, 1 May 2016 03:35:31 -0400 Subject: [PATCH 113/885] fix(e2e:main): fix yeoman.png regex allow for revved image name, fixes e2e tests on a prod environment --- templates/app/e2e/main/main.spec(jasmine).js | 2 +- templates/app/e2e/main/main.spec(mocha).js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/app/e2e/main/main.spec(jasmine).js b/templates/app/e2e/main/main.spec(jasmine).js index 57284495a..3d56cb5d3 100644 --- a/templates/app/e2e/main/main.spec(jasmine).js +++ b/templates/app/e2e/main/main.spec(jasmine).js @@ -12,7 +12,7 @@ describe('Main View', function() { it('should include jumbotron with correct data', function() { expect(page.h1El.getText()).toBe('\'Allo, \'Allo!'); - expect(page.imgEl.getAttribute('src')).toMatch(/yeoman.png$/); + expect(page.imgEl.getAttribute('src')).toMatch(/yeoman(\.[a-zA-Z0-9]*)?\.png$/); expect(page.imgEl.getAttribute('alt')).toBe('I\'m Yeoman'); }); }); diff --git a/templates/app/e2e/main/main.spec(mocha).js b/templates/app/e2e/main/main.spec(mocha).js index 798b58c41..12b0781db 100644 --- a/templates/app/e2e/main/main.spec(mocha).js +++ b/templates/app/e2e/main/main.spec(mocha).js @@ -13,7 +13,7 @@ describe('Main View', function() { it('should include jumbotron with correct data', function() { <%= expect() %>page.h1El.getText()<%= to() %>.eventually.equal('\'Allo, \'Allo!'); - <%= expect() %>page.imgEl.getAttribute('src')<%= to() %>.eventually.match(/yeoman.png$/); + <%= expect() %>page.imgEl.getAttribute('src')<%= to() %>.eventually.match(/yeoman(\.[a-zA-Z0-9]*)?\.png$/); <%= expect() %>page.imgEl.getAttribute('alt')<%= to() %>.eventually.equal('I\'m Yeoman'); }); }); From d21082d9b25c801cb68aad8de9722539e7fae8b0 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Sun, 1 May 2016 04:25:33 -0400 Subject: [PATCH 114/885] style(grunt): less whitespace please --- templates/app/Gruntfile(grunt).js | 96 +++++++++++++------------------ 1 file changed, 39 insertions(+), 57 deletions(-) diff --git a/templates/app/Gruntfile(grunt).js b/templates/app/Gruntfile(grunt).js index a39fd5d18..0d137d551 100644 --- a/templates/app/Gruntfile(grunt).js +++ b/templates/app/Gruntfile(grunt).js @@ -1,7 +1,7 @@ // Generated on <%= (new Date).toISOString().split('T')[0] %> using <%= rootGeneratorName() %> <%= rootGeneratorVersion() %> 'use strict'; -module.exports = function (grunt) { +module.exports = function(grunt) { var localConfig; try { localConfig = require('./server/config/local.env'); @@ -26,7 +26,6 @@ module.exports = function (grunt) { // Define the configuration for all the tasks grunt.initConfig({ - // Project settings pkg: grunt.file.readJSON('package.json'), yeoman: { @@ -87,7 +86,7 @@ module.exports = function (grunt) { jsTest: { files: ['<%%= yeoman.client %>/{app,components}/**/*.{spec,mock}.<%= scriptExt %>'], tasks: [<% if(filters.babel) { %>'newer:jshint:all'<% } if(filters.ts) { %>'newer:tslint:all', 'newer:ts:client_test',<% } %>, 'wiredep:test', 'karma'] - },<% if (filters.stylus) { %> + },<% if(filters.stylus) { %> injectStylus: { files: ['<%%= yeoman.client %>/{app,components}/**/*.styl'], tasks: ['injector:stylus'] @@ -95,7 +94,7 @@ module.exports = function (grunt) { stylus: { files: ['<%%= yeoman.client %>/{app,components}/**/*.styl'], tasks: ['stylus', 'postcss'] - },<% } if (filters.sass) { %> + },<% } if(filters.sass) { %> injectSass: { files: ['<%%= yeoman.client %>/{app,components}/**/*.{scss,sass}'], tasks: ['injector:sass'] @@ -103,7 +102,7 @@ module.exports = function (grunt) { sass: { files: ['<%%= yeoman.client %>/{app,components}/**/*.{scss,sass}'], tasks: ['sass', 'postcss'] - },<% } if (filters.less) { %> + },<% } if(filters.less) { %> injectLess: { files: ['<%%= yeoman.client %>/{app,components}/**/*.less'], tasks: ['injector:less'] @@ -111,7 +110,7 @@ module.exports = function (grunt) { less: { files: ['<%%= yeoman.client %>/{app,components}/**/*.less'], tasks: ['less', 'postcss'] - },<% } if (filters.jade) { %> + },<% } if(filters.jade) { %> jade: { files: ['<%%= yeoman.client %>/{app,components}/**/*.jade'], tasks: ['jade'] @@ -240,14 +239,14 @@ module.exports = function (grunt) { env: { PORT: process.env.PORT || 9000 }, - callback: function (nodemon) { - nodemon.on('log', function (event) { + callback: function(nodemon) { + nodemon.on('log', function(event) { console.log(event.colour); }); // opens browser on initial server start - nodemon.on('config:update', function () { - setTimeout(function () { + nodemon.on('config:update', function() { + setTimeout(function() { require('open')('http://localhost:8080/debug?port=5858'); }, 500); }); @@ -469,9 +468,9 @@ 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) { %> + pre: [<% if(filters.stylus) { %> + 'injector:stylus',<% } if(filters.less) { %> + 'injector:less',<% } if(filters.sass) { %> 'injector:sass',<% } %> 'ngconstant'<% if(filters.ts) { %>, 'copy:constant'<% } %> @@ -596,7 +595,7 @@ module.exports = function (grunt) { NODE_ENV: 'production' }, all: localConfig - },<% if (filters.jade) { %> + },<% if(filters.jade) { %> // Compiles Jade to html jade: { @@ -688,7 +687,7 @@ module.exports = function (grunt) { '.tmp/app/app.css' : '<%%= yeoman.client %>/app/app.styl' } } - },<% } if (filters.sass) { %> + },<% } if(filters.sass) { %> // Compiles Sass to CSS sass: { @@ -700,7 +699,7 @@ module.exports = function (grunt) { '.tmp/app/app.css' : '<%%= yeoman.client %>/app/app.scss' } } - },<% } if (filters.less) { %> + },<% } if(filters.less) { %> // Compiles Less to CSS less: { @@ -742,7 +741,7 @@ module.exports = function (grunt) { ] ] } - },<% if (filters.stylus) { %> + },<% if(filters.stylus) { %> // Inject component styl into app.styl stylus: { @@ -762,7 +761,7 @@ module.exports = function (grunt) { '!<%%= yeoman.client %>/app/app.styl' ] } - },<% } if (filters.sass) { %> + },<% } if(filters.sass) { %> // Inject component scss into app.scss sass: { @@ -782,7 +781,7 @@ module.exports = function (grunt) { '!<%%= yeoman.client %>/app/app.{scss,sass}' ] } - },<% } if (filters.less) { %> + },<% } if(filters.less) { %> // Inject component less into app.less less: { @@ -826,12 +825,12 @@ module.exports = function (grunt) { }); // Used for delaying livereload until after server has restarted - grunt.registerTask('wait', function () { + grunt.registerTask('wait', function() { grunt.log.ok('Waiting for server reload...'); var done = this.async(); - setTimeout(function () { + setTimeout(function() { grunt.log.writeln('Done waiting!'); done(); }, 1500); @@ -841,12 +840,12 @@ module.exports = function (grunt) { this.async(); }); - grunt.registerTask('serve', function (target) { - if (target === 'dist') { + grunt.registerTask('serve', function(target) { + if(target === 'dist') { return grunt.task.run(['build', 'env:all', 'env:prod', 'express:prod', 'wait', 'open', 'express-keepalive']); } - if (target === 'debug') { + if(target === 'debug') { return grunt.task.run([ 'clean:server', 'env:all', @@ -876,22 +875,20 @@ module.exports = function (grunt) { ]); }); - grunt.registerTask('server', function () { + grunt.registerTask('server', function() { grunt.log.warn('The `server` task has been deprecated. Use `grunt serve` to start a server.'); grunt.task.run(['serve']); }); grunt.registerTask('test', function(target, option) { - if (target === 'server') { + if(target === 'server') { return grunt.task.run([ 'env:all', 'env:test', 'mochaTest:unit', 'mochaTest:integration' ]); - } - - else if (target === 'client') { + } else if(target === 'client') { return grunt.task.run([ 'clean:server', 'env:all', @@ -905,11 +902,8 @@ module.exports = function (grunt) { 'wiredep:test', 'karma' ]); - } - - else if (target === 'e2e') { - - if (option === 'prod') { + } else if(target === 'e2e') { + if(option === 'prod') { return grunt.task.run([ 'build', 'env:all', @@ -917,9 +911,7 @@ module.exports = function (grunt) { 'express:prod', 'protractor' ]); - } - - else { + } else { return grunt.task.run([ 'clean:server', 'env:all', @@ -937,33 +929,24 @@ module.exports = function (grunt) { 'protractor' ]); } - } - - else if (target === 'coverage') { - - if (option === 'unit') { + } else if(target === 'coverage') { + if(option === 'unit') { return grunt.task.run([ 'env:all', 'env:test', 'mocha_istanbul:unit' ]); - } - - else if (option === 'integration') { + } else if(option === 'integration') { return grunt.task.run([ 'env:all', 'env:test', 'mocha_istanbul:integration' ]); - } - - else if (option === 'check') { + } else if(option === 'check') { return grunt.task.run([ 'istanbul_check_coverage' ]); - } - - else { + } else { return grunt.task.run([ 'env:all', 'env:test', @@ -971,13 +954,12 @@ module.exports = function (grunt) { 'istanbul_check_coverage' ]); } - + } else { + grunt.task.run([ + 'test:server', + 'test:client' + ]); } - - else grunt.task.run([ - 'test:server', - 'test:client' - ]); }); grunt.registerTask('build', [ From 9d5e9451183914220aa9a77d17358acd0c8932b1 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Sun, 1 May 2016 04:31:06 -0400 Subject: [PATCH 115/885] test(gen:main): add snake-case endpoint test --- src/test/main.test.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/test/main.test.js b/src/test/main.test.js index 3efac0104..96b00036f 100644 --- a/src/test/main.test.js +++ b/src/test/main.test.js @@ -164,7 +164,17 @@ describe('angular-fullstack:app', function() { }); }); - it('should run server tests successfully with generated snake-case endpoint'); //'foo-bar' + describe('with a generated snake-case endpoint', function() { + beforeEach(function() { + getConfig(path.join(dir, '.yo-rc.json')).then(config => { + return runEndpointGen('foo-bar', {config: config['generator-angular-fullstack']}); + }); + }); + + it('should run server tests successfully', function() { + return runCmd('grunt test:server').should.be.fulfilled(); + }); + }); if(!process.env.SKIP_E2E) { it('should run e2e tests successfully'); //'grunt test:e2e' From 43ce8eef1f470943ea6362df7184bad88b1fd5b5 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Sun, 1 May 2016 04:31:57 -0400 Subject: [PATCH 116/885] test(gen:main): add e2e tests --- src/test/main.test.js | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/test/main.test.js b/src/test/main.test.js index 96b00036f..e83a98aa8 100644 --- a/src/test/main.test.js +++ b/src/test/main.test.js @@ -177,9 +177,13 @@ describe('angular-fullstack:app', function() { }); if(!process.env.SKIP_E2E) { - it('should run e2e tests successfully'); //'grunt test:e2e' + it('should run e2e tests successfully', function() { + return runCmd('grunt test:e2e').should.be.fulfilled(); + }); - it('should run e2e tests successfully for production app'); //'grunt test:e2e:prod' + it('should run e2e tests successfully for production app', function() { + return runCmd('grunt test:e2e:prod').should.be.fulfilled(); + }); } }); @@ -279,7 +283,15 @@ describe('angular-fullstack:app', function() { }); if(!process.env.SKIP_E2E) { - it('should run e2e tests successfully'); + it('should run e2e tests successfully', function() { + return runCmd('grunt test:e2e:prod').should.be.fulfilled(); + }); + + it('should run e2e tests successfully for production app', function() { + return runCmd('grunt test:e2e:prod').should.be.fulfilled(); + }); + } + }); //it('should run e2e tests successfully for production app', function (done) { // runTest('grunt test:e2e:prod', this, done, 240000); From 8827e939f472be719d1c286ec933ea88867f81e6 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Sun, 1 May 2016 04:33:02 -0400 Subject: [PATCH 117/885] test(gen:main): add the 2 other test suites (sql, no server) --- src/test/main.test.js | 137 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 134 insertions(+), 3 deletions(-) diff --git a/src/test/main.test.js b/src/test/main.test.js index e83a98aa8..b6cdea51c 100644 --- a/src/test/main.test.js +++ b/src/test/main.test.js @@ -293,9 +293,140 @@ describe('angular-fullstack:app', function() { } }); - //it('should run e2e tests successfully for production app', function (done) { - // runTest('grunt test:e2e:prod', this, done, 240000); - //}); + describe('with sequelize models, auth', function() { + var dir; + var testOptions = { + buildtool: 'grunt', + transpiler: 'babel', + markup: 'jade', + stylesheet: 'css', + router: 'uirouter', + testing: 'jasmine', + odms: ['sequelize'], + auth: true, + oauth: ['twitterAuth', 'facebookAuth', 'googleAuth'], + socketio: true, + bootstrap: true, + uibootstrap: true + }; + + beforeEach(function() { + return runGen(testOptions).then(_dir => { + dir = _dir; + }); + }); + + it('should generate the proper files', function() { + const expectedFiles = getExpectedFiles.app(testOptions); + assert.file(expectedFiles); + return assertOnlyFiles(expectedFiles, path.normalize(dir)).should.be.fulfilled(); + }); + + it('passes JSCS', function() { + return runCmd('grunt jscs').should.be.fulfilled(); + }); + + it('passes lint', function() { + return runCmd('grunt jshint').should.be.fulfilled(); + }); + + it('should run client tests successfully', function() { + return runCmd('grunt test:client').should.be.fulfilled(); + }); + + it('should run server tests successfully', function() { + return runCmd('grunt test:server').should.be.fulfilled(); + }); + + describe('with a generated endpoint', function() { + beforeEach(function() { + getConfig(path.join(dir, '.yo-rc.json')).then(config => { + return runEndpointGen('foo', {config: config['generator-angular-fullstack']}); + }); + }); + + it('should run server tests successfully', function() { + return runCmd('grunt test:server').should.be.fulfilled(); + }); + }); + + if(!process.env.SKIP_E2E) { + it('should run e2e tests successfully', function() { + return runCmd('grunt test:e2e:prod').should.be.fulfilled(); + }); + + it('should run e2e tests successfully for production app', function() { + return runCmd('grunt test:e2e:prod').should.be.fulfilled(); + }); + } + }); + + describe('with TypeScript, Mocha + Chai (should) and no server options', function() { + var dir; + var testOptions = { + buildtool: 'grunt', + transpiler: 'ts', + markup: 'jade', + stylesheet: 'stylus', + router: 'uirouter', + testing: 'mocha', + chai: 'should', + odms: [], + auth: false, + oauth: [], + socketio: false, + bootstrap: false, + uibootstrap: false + }; + + beforeEach(function() { + return runGen(testOptions).then(_dir => { + dir = _dir; + }); + }); + + it('should generate the proper files', function() { + const expectedFiles = getExpectedFiles.app(testOptions); + assert.file(expectedFiles); + return assertOnlyFiles(expectedFiles, path.normalize(dir)).should.be.fulfilled(); + }); + + it('passes JSCS', function() { + return runCmd('grunt jscs').should.be.fulfilled(); + }); + + it('passes lint', function() { + return runCmd('grunt tslint').should.be.fulfilled(); + }); + + it('should run client tests successfully', function() { + return runCmd('grunt test:client').should.be.fulfilled(); + }); + + it('should run server tests successfully', function() { + return runCmd('grunt test:server').should.be.fulfilled(); + }); + + describe('with a generated endpoint', function() { + beforeEach(function() { + getConfig(path.join(dir, '.yo-rc.json')).then(config => { + return runEndpointGen('foo', {config: config['generator-angular-fullstack']}); + }); + }); + + it('should run server tests successfully', function() { + return runCmd('grunt test:server').should.be.fulfilled(); + }); + }); + + if(!process.env.SKIP_E2E) { + it('should run e2e tests successfully', function() { + return runCmd('grunt test:e2e:prod').should.be.fulfilled(); + }); + + it('should run e2e tests successfully for production app', function() { + return runCmd('grunt test:e2e:prod').should.be.fulfilled(); + }); } }); }); \ No newline at end of file From 5aca55f08af7ddec213f6202939bb8d445c27ecf Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Sun, 1 May 2016 16:36:35 -0400 Subject: [PATCH 118/885] fix(e2e:prod): turn off lusca if using saucelabs --- templates/app/server/config/express.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/app/server/config/express.js b/templates/app/server/config/express.js index eeca74e6e..84f82043b 100644 --- a/templates/app/server/config/express.js +++ b/templates/app/server/config/express.js @@ -56,7 +56,7 @@ export default function(app) { * Lusca - express server security * https://github.com/krakenjs/lusca */ - if ('test' !== env) { + if (env !== 'test' && !process.env.SAUCE_USERNAME) { app.use(lusca({ csrf: { angular: true From 53a24a32242fdb155e85485db61cbde03ab59438 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Sun, 1 May 2016 17:48:30 -0400 Subject: [PATCH 119/885] test(gen:main): fix reg e2e tests running prod tests instead --- src/test/main.test.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/test/main.test.js b/src/test/main.test.js index b6cdea51c..69a3b0509 100644 --- a/src/test/main.test.js +++ b/src/test/main.test.js @@ -284,7 +284,7 @@ describe('angular-fullstack:app', function() { if(!process.env.SKIP_E2E) { it('should run e2e tests successfully', function() { - return runCmd('grunt test:e2e:prod').should.be.fulfilled(); + return runCmd('grunt test:e2e').should.be.fulfilled(); }); it('should run e2e tests successfully for production app', function() { @@ -352,7 +352,7 @@ describe('angular-fullstack:app', function() { if(!process.env.SKIP_E2E) { it('should run e2e tests successfully', function() { - return runCmd('grunt test:e2e:prod').should.be.fulfilled(); + return runCmd('grunt test').should.be.fulfilled(); }); it('should run e2e tests successfully for production app', function() { @@ -421,7 +421,7 @@ describe('angular-fullstack:app', function() { if(!process.env.SKIP_E2E) { it('should run e2e tests successfully', function() { - return runCmd('grunt test:e2e:prod').should.be.fulfilled(); + return runCmd('grunt test:e2e').should.be.fulfilled(); }); it('should run e2e tests successfully for production app', function() { From b41d4a6936da0ec9938c4bccce93202280713bc2 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Sun, 1 May 2016 19:10:46 -0400 Subject: [PATCH 120/885] test(gen:endpoint): add snake-case tests --- src/test/endpoint.test.js | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/test/endpoint.test.js b/src/test/endpoint.test.js index e52ae077f..aa53858d1 100644 --- a/src/test/endpoint.test.js +++ b/src/test/endpoint.test.js @@ -254,4 +254,31 @@ describe('angular-fullstack:endpoint', function() { return jshintDir(dir, 'foo', 'foo/bar').should.be.fulfilled(); }); }); + + describe('with a generated snake-case endpoint', function() { + var dir; + beforeEach(function() { + return runEndpointGen('foo-bar', {config: config['generator-angular-fullstack']}).then(_dir => { + dir = _dir; + + return Promise.all([ + copyAsync(path.join(genDir, '/server/.jshintrc'), './server/.jshintrc'), + copyAsync(path.join(genDir, '/server/.jshintrc-spec'), './server/.jshintrc-spec'), + copyAsync(path.join(genDir, '/.jscsrc'), './.jscsrc') + ]); + }); + }); + + it('should generate the expected files', function() { + assert.file(getExpectedFiles.endpoint('foo-bar')); + }); + + it('should pass jscs', function() { + return jscsDir(dir, 'foo-bar').should.be.fulfilled(); + }); + + it('should pass lint', function() { + return jshintDir(dir, 'foo-bar').should.be.fulfilled(); + }); + }); }); \ No newline at end of file From 54d4ebd370beb2a22e00af0b41a351b0c4fcc3b0 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Sun, 1 May 2016 19:11:10 -0400 Subject: [PATCH 121/885] fix(grunt): exclude jshint config if using TypeScript --- templates/app/Gruntfile(grunt).js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/templates/app/Gruntfile(grunt).js b/templates/app/Gruntfile(grunt).js index 0d137d551..7f5d4e83f 100644 --- a/templates/app/Gruntfile(grunt).js +++ b/templates/app/Gruntfile(grunt).js @@ -141,6 +141,7 @@ module.exports = function(grunt) { tasks: ['wiredep'] }, }, + <%_ if(!filters.ts) { _%> // Make sure code styles are up to par and there are no obvious mistakes jshint: { @@ -164,7 +165,8 @@ module.exports = function(grunt) { test: { src: ['<%%= yeoman.client %>/{app,components}/**/*.{spec,mock}.js'] } - },<% if(filters.ts) { %> + },<% } %> + <%_ if(filters.ts) { _%> tslint: { options: { From daf0540793dbea9457769146adaa19f378fa2156 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Sun, 1 May 2016 19:47:58 -0400 Subject: [PATCH 122/885] perf(gen:test:main): lets get some concurrency/re-use going --- src/test/main.test.js | 82 ++++++++++++++++++++++++++++++------------- 1 file changed, 57 insertions(+), 25 deletions(-) diff --git a/src/test/main.test.js b/src/test/main.test.js index 69a3b0509..1d73022aa 100644 --- a/src/test/main.test.js +++ b/src/test/main.test.js @@ -130,7 +130,7 @@ describe('angular-fullstack:app', function() { describe('with a generated endpoint', function() { beforeEach(function() { - getConfig(path.join(dir, '.yo-rc.json')).then(config => { + return getConfig(path.join(dir, '.yo-rc.json')).then(config => { return runEndpointGen('foo', {config: config['generator-angular-fullstack']}); }); }); @@ -142,7 +142,7 @@ describe('angular-fullstack:app', function() { describe('with a generated capitalized endpoint', function() { beforeEach(function() { - getConfig(path.join(dir, '.yo-rc.json')).then(config => { + return getConfig(path.join(dir, '.yo-rc.json')).then(config => { return runEndpointGen('Foo', {config: config['generator-angular-fullstack']}); }); }); @@ -154,7 +154,7 @@ describe('angular-fullstack:app', function() { describe('with a generated path name endpoint', function() { beforeEach(function() { - getConfig(path.join(dir, '.yo-rc.json')).then(config => { + return getConfig(path.join(dir, '.yo-rc.json')).then(config => { return runEndpointGen('foo/bar', {config: config['generator-angular-fullstack']}); }); }); @@ -166,7 +166,7 @@ describe('angular-fullstack:app', function() { describe('with a generated snake-case endpoint', function() { beforeEach(function() { - getConfig(path.join(dir, '.yo-rc.json')).then(config => { + return getConfig(path.join(dir, '.yo-rc.json')).then(config => { return runEndpointGen('foo-bar', {config: config['generator-angular-fullstack']}); }); }); @@ -189,8 +189,12 @@ describe('angular-fullstack:app', function() { describe('default settings using existing `.yo-rc.json`', function() { var dir; + var jscsResult; + var lintResult; + var clientTestResult; + var serverTestResult; - beforeEach(function() { + before(function() { return runGen(null, { copyConfigFile: true, options: { @@ -199,6 +203,10 @@ describe('angular-fullstack:app', function() { } }).then(_dir => { dir = _dir; + jscsResult = runCmd('grunt jscs'); + lintResult = runCmd('grunt jshint'); + clientTestResult = runCmd('grunt test:client'); + serverTestResult = runCmd('grunt test:server'); }); }); @@ -209,24 +217,28 @@ describe('angular-fullstack:app', function() { }); it('passes JSCS', function() { - return runCmd('grunt jscs').should.be.fulfilled(); + return jscsResult.should.be.fulfilled(); }); it('passes JSHint', function() { - return runCmd('grunt jshint').should.be.fulfilled(); + return lintResult.should.be.fulfilled(); }); it('passes client tests', function() { - return runCmd('grunt test:client').should.be.fulfilled(); + return clientTestResult.should.be.fulfilled(); }); it('passes server tests', function() { - return runCmd('grunt test:server').should.be.fulfilled(); + return serverTestResult.should.be.fulfilled(); }); }); describe('with TypeScript, Jade, Jasmine, LESS, & OAuth', function() { var dir; + var jscsResult; + var lintResult; + var clientTestResult; + var serverTestResult; var testOptions = { buildtool: 'grunt', transpiler: 'ts', @@ -242,9 +254,13 @@ describe('angular-fullstack:app', function() { uibootstrap: true }; - beforeEach(function() { + before(function() { return runGen(testOptions).then(_dir => { dir = _dir; + jscsResult = runCmd('grunt jscs'); + lintResult = runCmd('grunt tslint'); + clientTestResult = runCmd('grunt test:client'); + serverTestResult = runCmd('grunt test:server'); }); }); @@ -255,24 +271,24 @@ describe('angular-fullstack:app', function() { }); it('passes JSCS', function() { - return runCmd('grunt jscs').should.be.fulfilled(); + return jscsResult.should.be.fulfilled(); }); it('passes lint', function() { - return runCmd('grunt tslint').should.be.fulfilled(); + return lintResult.should.be.fulfilled(); }); it('should run client tests successfully', function() { - return runCmd('grunt test:client').should.be.fulfilled(); + return clientTestResult.should.be.fulfilled(); }); it('should run server tests successfully', function() { - return runCmd('grunt test:server').should.be.fulfilled(); + return serverTestResult.should.be.fulfilled(); }); describe('with a generated endpoint', function() { beforeEach(function() { - getConfig(path.join(dir, '.yo-rc.json')).then(config => { + return getConfig(path.join(dir, '.yo-rc.json')).then(config => { return runEndpointGen('foo', {config: config['generator-angular-fullstack']}); }); }); @@ -295,6 +311,10 @@ describe('angular-fullstack:app', function() { describe('with sequelize models, auth', function() { var dir; + var jscsResult; + var lintResult; + var clientTestResult; + var serverTestResult; var testOptions = { buildtool: 'grunt', transpiler: 'babel', @@ -313,6 +333,10 @@ describe('angular-fullstack:app', function() { beforeEach(function() { return runGen(testOptions).then(_dir => { dir = _dir; + jscsResult = runCmd('grunt jscs'); + lintResult = runCmd('grunt jshint'); + clientTestResult = runCmd('grunt test:client'); + serverTestResult = runCmd('grunt test:server'); }); }); @@ -323,24 +347,24 @@ describe('angular-fullstack:app', function() { }); it('passes JSCS', function() { - return runCmd('grunt jscs').should.be.fulfilled(); + return jscsResult.should.be.fulfilled(); }); it('passes lint', function() { - return runCmd('grunt jshint').should.be.fulfilled(); + return lintResult.should.be.fulfilled(); }); it('should run client tests successfully', function() { - return runCmd('grunt test:client').should.be.fulfilled(); + return clientTestResult.should.be.fulfilled(); }); it('should run server tests successfully', function() { - return runCmd('grunt test:server').should.be.fulfilled(); + return serverTestResult.should.be.fulfilled(); }); describe('with a generated endpoint', function() { beforeEach(function() { - getConfig(path.join(dir, '.yo-rc.json')).then(config => { + return getConfig(path.join(dir, '.yo-rc.json')).then(config => { return runEndpointGen('foo', {config: config['generator-angular-fullstack']}); }); }); @@ -363,6 +387,10 @@ describe('angular-fullstack:app', function() { describe('with TypeScript, Mocha + Chai (should) and no server options', function() { var dir; + var jscsResult; + var lintResult; + var clientTestResult; + var serverTestResult; var testOptions = { buildtool: 'grunt', transpiler: 'ts', @@ -382,6 +410,10 @@ describe('angular-fullstack:app', function() { beforeEach(function() { return runGen(testOptions).then(_dir => { dir = _dir; + jscsResult = runCmd('grunt jscs'); + lintResult = runCmd('grunt tslint'); + clientTestResult = runCmd('grunt test:client'); + serverTestResult = runCmd('grunt test:server'); }); }); @@ -392,24 +424,24 @@ describe('angular-fullstack:app', function() { }); it('passes JSCS', function() { - return runCmd('grunt jscs').should.be.fulfilled(); + return jscsResult.should.be.fulfilled(); }); it('passes lint', function() { - return runCmd('grunt tslint').should.be.fulfilled(); + return lintResult.should.be.fulfilled(); }); it('should run client tests successfully', function() { - return runCmd('grunt test:client').should.be.fulfilled(); + return clientTestResult.should.be.fulfilled(); }); it('should run server tests successfully', function() { - return runCmd('grunt test:server').should.be.fulfilled(); + return serverTestResult.should.be.fulfilled(); }); describe('with a generated endpoint', function() { beforeEach(function() { - getConfig(path.join(dir, '.yo-rc.json')).then(config => { + return getConfig(path.join(dir, '.yo-rc.json')).then(config => { return runEndpointGen('foo', {config: config['generator-angular-fullstack']}); }); }); From d64029febdde1ab2ea60ee052815a50525f35af8 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Sun, 1 May 2016 20:48:27 -0400 Subject: [PATCH 123/885] refactor(gen:test): rm dead code, promisify fs in mocha.conf, del old test file --- mocha.conf.js | 4 + src/test/endpoint.test.js | 1 - src/test/main.test.js | 1 - src/test/main.test.off.js | 765 -------------------------------------- src/test/pre.test.js | 13 - src/test/test-helpers.js | 2 - 6 files changed, 4 insertions(+), 782 deletions(-) delete mode 100644 src/test/main.test.off.js diff --git a/mocha.conf.js b/mocha.conf.js index 8fbbb39e6..4a47ecbec 100644 --- a/mocha.conf.js +++ b/mocha.conf.js @@ -1,3 +1,7 @@ 'use strict'; global.DEBUG = !!process.env.DEBUG; + +var fs = require('fs'); +var Promise = require('bluebird'); +Promise.promisifyAll(fs); diff --git a/src/test/endpoint.test.js b/src/test/endpoint.test.js index aa53858d1..d35523c65 100644 --- a/src/test/endpoint.test.js +++ b/src/test/endpoint.test.js @@ -3,7 +3,6 @@ import path from 'path'; import fs from 'fs'; import _ from 'lodash'; import Promise from 'bluebird'; -Promise.promisifyAll(fs); import helpers from 'yeoman-test'; import assert from 'yeoman-assert'; import minimatch from 'minimatch'; diff --git a/src/test/main.test.js b/src/test/main.test.js index 1d73022aa..38add4ef9 100644 --- a/src/test/main.test.js +++ b/src/test/main.test.js @@ -3,7 +3,6 @@ import path from 'path'; import fs from 'fs'; import _ from 'lodash'; import Promise from 'bluebird'; -Promise.promisifyAll(fs); import helpers from 'yeoman-test'; import assert from 'yeoman-assert'; import * as getExpectedFiles from './get-expected-files'; diff --git a/src/test/main.test.off.js b/src/test/main.test.off.js deleted file mode 100644 index 6f706cc70..000000000 --- a/src/test/main.test.off.js +++ /dev/null @@ -1,765 +0,0 @@ -/*global describe, beforeEach, it */ -'use strict'; -var path = require('path'); -var Promise = require('bluebird'); -var fs = require('fs'); -Promise.promisifyAll(fs); -var exec = require('child_process').exec; -var helpers = require('yeoman-test'); -var assert = require('yeoman-assert'); -var chai = require('chai'); -var expect = chai.expect; -var recursiveReadDir = require('recursive-readdir'); - -/**************** - * FileSystem Utils - ****************/ - -function copyAsync(src, dest) { - return fs.readFileAsync(src) - .then(data => fs.writeFileAsync(dest, data)); -} - -describe('angular-fullstack generator', function () { - var gen; - var defaultOptions = { - buildtool: 'grunt', - script: 'js', - transpiler: 'babel', - markup: 'html', - stylesheet: 'sass', - router: 'uirouter', - testing: 'mocha', - chai: 'expect', - bootstrap: true, - uibootstrap: true, - odms: ['mongoose'], - auth: true, - oauth: [], - socketio: true - }; - var dependenciesInstalled = false; - - function generatorTest(generatorType, name, mockPrompt, callback) { - gen.run(function () { - var afGenerator; - var deps = [path.join('../../generators', generatorType)]; - afGenerator = helpers.createGenerator('angular-fullstack:' + generatorType, deps, [name], { - skipInstall: true - }); - - helpers.mockPrompt(afGenerator, mockPrompt); - afGenerator.run(function () { - callback(); - }); - }); - } - - /** - * Assert that only an array of files exist at a given path - * - * @param {Array} expectedFiles - array of files - * @param {Function} done - callback(error{Error}) - * @param {String} topLevelPath - top level path to assert files at (optional) - * @param {Array} skip - array of paths to skip/ignore (optional) - * - */ - function assertOnlyFiles( - expectedFiles, - done, - topLevelPath='./', - skip=['node_modules', 'client/bower_components']) { - recursiveReadDir(topLevelPath, skip, function(err, actualFiles) { - if (err) return done(err); - var files = actualFiles.concat(); - - expectedFiles.forEach(function(file, i) { - var index = files.indexOf(path.normalize(file)); - if (index >= 0) { - files.splice(index, 1); - } - }); - - if (files.length !== 0) { - err = new Error('unexpected files found'); - err.expected = expectedFiles.join('\n'); - err.actual = files.join('\n'); - return done(err); - } - - done(); - }); - } - - /** - * Exec a command and run test assertion(s) based on command type - * - * @param {String} cmd - the command to exec - * @param {Object} self - context of the test - * @param {Function} cb - callback() - * @param {String} endpoint - endpoint to generate before exec (optional) - * @param {Number} timeout - timeout for the exec and test (optional) - * - */ - function runTest(cmd, self, cb) { - var args = Array.prototype.slice.call(arguments); - var endpoint = (args[3] && typeof args[3] === 'string') ? args.splice(3, 1)[0] : null; - var timeout = (args[3] && typeof args[3] === 'number') ? args.splice(3, 1)[0] : null; - - self.timeout(timeout || 60000); - - var execFn = function() { - var cmdCode; - var cp = exec(cmd, function(error, stdout, stderr) { - if(cmdCode !== 0) { - console.error(stdout); - throw new Error('Error running command: ' + cmd); - } - cb(); - }); - cp.on('exit', function (code) { - cmdCode = code; - }); - }; - - if (endpoint) { - generatorTest('endpoint', endpoint, {}, execFn); - } else { - gen.run(execFn); - } - } - - /** - * Generate an array of files to expect from a set of options - * - * @param {Object} ops - generator options - * @return {Array} - array of files - * - */ - function genFiles(ops) { - var mapping = { - stylesheet: { - sass: 'scss', - stylus: 'styl', - less: 'less', - css: 'css' - }, - markup: { - jade: 'jade', - html: 'html' - }, - script: { - js: 'js', - ts: 'ts' - } - }, - files = []; - - /** - * Generate an array of OAuth files based on type - * - * @param {String} type - type of oauth - * @return {Array} - array of files - * - */ - var oauthFiles = function(type) { - return [ - 'server/auth/' + type + '/index.js', - 'server/auth/' + type + '/passport.js', - ]; - }; - - - var script = mapping.script[ops.transpiler === 'ts' ? 'ts' : 'js'], - markup = mapping.markup[ops.markup], - stylesheet = mapping.stylesheet[ops.stylesheet], - models = ops.models ? ops.models : ops.odms[0]; - - /* Core Files */ - files = files.concat([ - 'client/.htaccess', - 'client/favicon.ico', - 'client/robots.txt', - 'client/index.html', - 'client/app/app.' + script, - 'client/app/app.' + stylesheet, - 'client/app/main/main.' + script, - 'client/app/main/main.' + markup, - 'client/app/main/main.' + stylesheet, - 'client/app/main/main.controller.' + script, - 'client/app/main/main.controller.spec.' + script, - 'client/assets/images/yeoman.png', - 'client/components/footer/footer.' + stylesheet, - 'client/components/footer/footer.' + markup, - 'client/components/footer/footer.directive.' + script, - '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', - 'server/index.js', - 'server/routes.js', - 'server/api/thing/index.js', - 'server/api/thing/index.spec.js', - 'server/api/thing/thing.controller.js', - 'server/api/thing/thing.integration.js', - 'server/components/errors/index.js', - 'server/config/local.env.js', - 'server/config/local.env.sample.js', - 'server/config/express.js', - 'server/config/environment/index.js', - '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', - 'e2e/components/navbar/navbar.po.js', - '.babelrc', - '.bowerrc', - '.buildignore', - '.editorconfig', - '.gitattributes', - '.gitignore', - '.travis.yml', - '.jscsrc', - '.yo-rc.json', - 'Gruntfile.js', - 'package.json', - 'bower.json', - 'karma.conf.js', - 'mocha.conf.js', - 'protractor.conf.js', - 'README.md' - ]); - - /* TypeScript */ - if (ops.transpiler === 'ts') { - files = files.concat([ - 'tsconfig.client.test.json', - 'tsconfig.client.json', - 'tsd.json', - 'tsd_test.json', - 'client/tslint.json' - ]); - } else { - files = files.concat([ - 'client/.jshintrc' - ]); - } - - /* Ui-Router */ - if (ops.router === 'uirouter') { - files = files.concat([ - 'client/components/ui-router/ui-router.mock.' + script - ]); - } - - /* Ui-Bootstrap */ - if (ops.uibootstrap) { - files = files.concat([ - 'client/components/modal/modal.' + markup, - 'client/components/modal/modal.' + stylesheet, - 'client/components/modal/modal.service.' + script - ]); - } - - /* Models - Mongoose or Sequelize */ - if (models) { - files = files.concat([ - 'server/api/thing/thing.model.js', - 'server/api/thing/thing.events.js', - 'server/config/seed.js' - ]); - } - - /* Sequelize */ - if (ops.odms.indexOf('sequelize') !== -1) { - files = files.concat([ - 'server/sqldb/index.js' - ]); - } - - /* Authentication */ - if (ops.auth) { - files = files.concat([ - 'client/app/account/account.' + script, - 'client/app/account/login/login.' + markup, - 'client/app/account/login/login.controller.' + script, - 'client/app/account/settings/settings.' + markup, - 'client/app/account/settings/settings.controller.' + script, - 'client/app/account/signup/signup.' + markup, - 'client/app/account/signup/signup.controller.' + script, - 'client/app/admin/admin.' + markup, - 'client/app/admin/admin.' + stylesheet, - '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, - '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', - 'server/api/user/index.spec.js', - 'server/api/user/user.controller.js', - 'server/api/user/user.integration.js', - 'server/api/user/user.model.js', - 'server/api/user/user.model.spec.js', - 'server/api/user/user.events.js', - 'server/auth/index.js', - 'server/auth/auth.service.js', - 'server/auth/local/index.js', - 'server/auth/local/passport.js', - 'e2e/account/login/login.po.js', - 'e2e/account/login/login.spec.js', - 'e2e/account/logout/logout.spec.js', - 'e2e/account/signup/signup.po.js', - 'e2e/account/signup/signup.spec.js' - ]); - } - - 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 */ - if (ops.socketio) { - files = files.concat([ - 'client/components/socket/socket.service.' + script, - 'client/components/socket/socket.mock.' + script, - 'server/api/thing/thing.socket.js', - 'server/config/socketio.js' - ]); - } - - return files; - } - - - /** - * Generator tests - */ - - beforeEach(function (done) { - this.timeout(10000); - var deps = [ - '../../generators/app', - '../../generators/endpoint', - [ - helpers.createDummyGenerator(), - 'ng-component:app' - ] - ]; - - helpers.testDirectory(path.join(__dirname, 'temp'), err => { - if(err) return done(err); - - gen = helpers.createGenerator('angular-fullstack:app', deps, [], { - skipInstall: true - }); - gen.conflicter.force = true; - done(); - }); - }); - - describe('making sure test fixtures are present', function() { - it('should have package.json in fixtures', function() { - assert.file([path.join(__dirname, 'fixtures', 'package.json')]); - }); - - it('should have bower.json in fixtures', function() { - assert.file([path.join(__dirname, 'fixtures', 'bower.json')]); - }); - - it('should have all npm packages in fixtures/node_modules', function() { - var packageJson = require('./fixtures/package.json'); - var deps = Object.keys(packageJson.dependencies); - deps = deps.concat(Object.keys(packageJson.devDependencies)); - deps = deps.map(function(dep) { - return path.join(__dirname, 'fixtures', 'node_modules', dep); - }); - assert.file(deps); - }); - - it('should have all bower packages in fixtures/bower_components', function() { - var bowerJson = require('./fixtures/bower.json'); - var deps = Object.keys(bowerJson.dependencies); - deps = deps.concat(Object.keys(bowerJson.devDependencies)); - deps = deps.map(function(dep) { - return path.join(__dirname, 'fixtures', 'bower_components', dep); - }); - assert.file(deps); - }); - }); - - describe('running app', function() { - beforeEach(function() { - this.timeout(20000); - return Promise.all([ - fs.mkdirAsync(__dirname + '/temp/client'), - fs.symlinkAsync(__dirname + '/fixtures/node_modules', __dirname + '/temp/node_modules'), - fs.symlinkAsync(__dirname +'/fixtures/bower_components', __dirname +'/temp/client/bower_components') - ]); - }); - - describe('with default options', function() { - beforeEach(function() { - helpers.mockPrompt(gen, defaultOptions); - }); - - it('should run client tests successfully', function(done) { - runTest('grunt test:client', this, done); - }); - - it.only('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 pass jscs with generated endpoint', function(done) { - runTest('grunt jscs', this, done, 'foo'); - }); - - it('should pass lint with generated endpoint', function(done) { - runTest('grunt jshint', this, done, 'foo'); - }); - - it('should run server tests successfully with generated endpoint', function(done) { - runTest('grunt test:server', this, done, 'foo'); - }); - - it('should pass lint with generated capitalized endpoint', function(done) { - runTest('grunt jshint', this, done, 'Foo'); - }); - - it('should run server tests successfully with generated capitalized endpoint', function(done) { - runTest('grunt test:server', this, done, 'Foo'); - }); - - it('should pass lint with generated path name endpoint', function(done) { - runTest('grunt jshint', this, done, 'foo/bar'); - }); - - it('should run server tests successfully with generated path name endpoint', function(done) { - runTest('grunt test:server', this, done, 'foo/bar'); - }); - - it('should generate expected files with path name endpoint', function(done) { - runTest('(exit 0)', this, function() { - assert.file([ - 'server/api/foo/bar/index.js', - 'server/api/foo/bar/index.spec.js', - 'server/api/foo/bar/bar.controller.js', - 'server/api/foo/bar/bar.events.js', - 'server/api/foo/bar/bar.integration.js', - 'server/api/foo/bar/bar.model.js', - 'server/api/foo/bar/bar.socket.js' - ]); - done(); - }, 'foo/bar'); - }); - - it('should use existing config if available', function(done) { - this.timeout(60000); - return copyAsync(__dirname + '/fixtures/.yo-rc.json', __dirname + '/temp/.yo-rc.json').then(() => { - var gen = helpers.createGenerator('angular-fullstack:app', [ - '../../generators/app', - '../../generators/endpoint', - [ - helpers.createDummyGenerator(), - 'ng-component:app' - ] - ], [], { - skipInstall: true - }); - helpers.mockPrompt(gen, { - skipConfig: true - }); - gen.run(function () { - assert.file([ - 'client/app/main/main.less', - 'server/auth/google/passport.js' - ]); - done(); - }); - }); - }); - - it('should generate expected files', function (done) { - gen.run(function () { - assert.file(genFiles(defaultOptions)); - done(); - }); - }); - - it('should not generate unexpected files', function (done) { - gen.run(function () { - assertOnlyFiles(genFiles(defaultOptions), 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); - //}); - } - }); - - describe('with other preprocessors and oauth', function() { - var testOptions = { - buildtool: 'grunt', - script: 'js', - transpiler: 'ts', - markup: 'jade', - stylesheet: 'less', - router: 'uirouter', - testing: 'jasmine', - odms: [ 'mongoose' ], - auth: true, - oauth: ['twitterAuth', 'facebookAuth', 'googleAuth'], - socketio: true, - bootstrap: true, - uibootstrap: true - }; - - beforeEach(function() { - helpers.mockPrompt(gen, testOptions); - }); - - 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 tslint', this, done); - }); - - it('should run server tests successfully', function(done) { - runTest('grunt test:server', this, done); - }); - - it('should pass jscs with generated endpoint', function(done) { - runTest('grunt jscs', this, done, 'foo'); - }); - - // TODO: generator-ng-component needs TS support - // it('should pass lint with generated snake-case endpoint', function(done) { - // runTest('grunt jshint', this, done, 'foo-bar'); - // }); - - it('should run server tests successfully with generated snake-case endpoint', function(done) { - runTest('grunt test:server', this, done, 'foo-bar'); - }); - - 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); - //}); - } - - }); - - describe('with sequelize models, auth', function() { - var testOptions = { - buildtool: 'grunt', - script: 'js', - transpiler: 'babel', - markup: 'jade', - stylesheet: 'stylus', - router: 'uirouter', - testing: 'jasmine', - odms: [ 'sequelize' ], - auth: true, - oauth: ['twitterAuth', 'facebookAuth', 'googleAuth'], - socketio: true, - bootstrap: true, - uibootstrap: true - }; - - beforeEach(function() { - helpers.mockPrompt(gen, testOptions); - }); - - 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 pass jscs with generated endpoint', function(done) { - runTest('grunt jscs', this, done, 'foo'); - }); - - it('should pass lint with generated snake-case endpoint', function(done) { - runTest('grunt jshint', this, done, 'foo-bar'); - }); - - it('should run server tests successfully with generated snake-case endpoint', function(done) { - runTest('grunt test:server', this, done, 'foo-bar'); - }); - - 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); - //}); - } - - }); - - describe('with other preprocessors and no server options', function() { - var testOptions = { - buildtool: 'grunt', - script: 'js', - transpiler: 'ts', - markup: 'jade', - stylesheet: 'stylus', - router: 'ngroute', - testing: 'mocha', - chai: 'should', - odms: [], - auth: false, - oauth: [], - socketio: false, - bootstrap: false, - uibootstrap: false - }; - - 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 tslint', this, done); - }); - - it('should run server tests successfully', function(done) { - runTest('grunt test:server', this, done); - }); - - it('should pass jscs with generated endpoint', function(done) { - runTest('grunt jscs', this, done, 'foo'); - }); - - // TODO: generator-ng-component needs TS support - // it('should pass lint with generated endpoint', function(done) { - // runTest('grunt jshint', this, done, 'foo'); - // }); - - it('should run server tests successfully with generated endpoint', function(done) { - runTest('grunt test:server', this, done, 'foo'); - }); - - 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); - //}); - } - - }); - }); -}); diff --git a/src/test/pre.test.js b/src/test/pre.test.js index d08a90e59..61c88de27 100644 --- a/src/test/pre.test.js +++ b/src/test/pre.test.js @@ -1,19 +1,6 @@ 'use strict'; import path from 'path'; -import fs from 'fs'; -import _ from 'lodash'; -import Promise from 'bluebird'; -Promise.promisifyAll(fs); -import helpers from 'yeoman-test'; import assert from 'yeoman-assert'; -import minimatch from 'minimatch'; -import * as getExpectedFiles from './get-expected-files'; -import { - copyAsync, - runCmd, - assertOnlyFiles, - getConfig -} from './test-helpers'; describe('test fixtures', function() { it('should have package.json in fixtures', function() { diff --git a/src/test/test-helpers.js b/src/test/test-helpers.js index 9745c2cfe..4a3149eff 100644 --- a/src/test/test-helpers.js +++ b/src/test/test-helpers.js @@ -3,11 +3,9 @@ import path from 'path'; import fs from 'fs'; import _ from 'lodash'; import Promise from 'bluebird'; -Promise.promisifyAll(fs); import {exec} from 'child_process'; import helpers from 'yeoman-test'; import assert from 'yeoman-assert'; -import * as getExpectedFiles from './get-expected-files'; import recursiveReadDir from 'recursive-readdir'; export function copyAsync(src, dest) { From 3febf4c722bcdc7f771768a8d7b9f411438641c4 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Sun, 1 May 2016 20:50:15 -0400 Subject: [PATCH 124/885] refactor(gen:test): move runGen to test-helpers, rename getConfig to readJSON --- src/test/endpoint.test.js | 36 ++------------------ src/test/main.test.js | 59 +++++--------------------------- src/test/test-helpers.js | 71 ++++++++++++++++++++++++++++++++++++++- 3 files changed, 82 insertions(+), 84 deletions(-) diff --git a/src/test/endpoint.test.js b/src/test/endpoint.test.js index d35523c65..16cb76c38 100644 --- a/src/test/endpoint.test.js +++ b/src/test/endpoint.test.js @@ -14,7 +14,8 @@ import { copyAsync, runCmd, assertOnlyFiles, - getConfig + readJSON, + runGen } from './test-helpers'; const TEST_DIR = __dirname; @@ -35,37 +36,6 @@ const defaultOptions = { oauth: [], socketio: true }; -function runGen(prompts) { - return new Promise((resolve, reject) => { - let dir; - helpers - .run(require.resolve('../generators/app')) - .inTmpDir(function(_dir) { - // this will create a new temporary directory for each new generator run - var done = this.async(); - if(DEBUG) console.log(`TEMP DIR: ${_dir}`); - dir = _dir; - - // symlink our dependency directories - return Promise.all([ - fs.mkdirAsync(dir + '/client').then(() => { - return fs.symlinkAsync(__dirname + '/fixtures/bower_components', dir + '/client/bower_components'); - }), - fs.symlinkAsync(__dirname + '/fixtures/node_modules', dir + '/node_modules') - ]).then(done); - }) - .withGenerators([ - require.resolve('../generators/endpoint'), - // [helpers.createDummyGenerator(), 'ng-component:app'] - ]) - .withOptions({ - skipInstall: true - }) - .withPrompts(prompts) - .on('error', reject) - .on('end', () => resolve(dir)); - }); -} function runEndpointGen(name, opt={}) { let prompts = opt.prompts || {}; @@ -162,7 +132,7 @@ before(function() { jscs.configure(JSON.parse(data)); }); }), - getConfig(path.join(TEST_DIR, 'fixtures/.yo-rc.json')).then(_config => { + readJSON(path.join(TEST_DIR, 'fixtures/.yo-rc.json')).then(_config => { _config['generator-angular-fullstack'].insertRoutes = false; _config['generator-angular-fullstack'].pluralizeRoutes = false; _config['generator-angular-fullstack'].insertSockets = false; diff --git a/src/test/main.test.js b/src/test/main.test.js index 38add4ef9..cfe269f2a 100644 --- a/src/test/main.test.js +++ b/src/test/main.test.js @@ -10,7 +10,8 @@ import { copyAsync, runCmd, assertOnlyFiles, - getConfig + readJSON, + runGen } from './test-helpers'; const defaultOptions = { @@ -30,48 +31,6 @@ const defaultOptions = { }; const TEST_DIR = __dirname; -function runGen(prompts, opts={}) { - let options = opts.options || {skipInstall: true}; - - return new Promise((resolve, reject) => { - let dir; - let gen = helpers - .run(require.resolve('../generators/app')) - .inTmpDir(function(_dir) { - // this will create a new temporary directory for each new generator run - var done = this.async(); - if(DEBUG) console.log(`TEMP DIR: ${_dir}`); - dir = _dir; - - let promises = [ - fs.mkdirAsync(dir + '/client').then(() => { - return fs.symlinkAsync(__dirname + '/fixtures/bower_components', dir + '/client/bower_components'); - }), - fs.symlinkAsync(__dirname + '/fixtures/node_modules', dir + '/node_modules') - ]; - - if(opts.copyConfigFile) { - promises.push(copyAsync(path.join(TEST_DIR, 'fixtures/.yo-rc.json'), path.join(dir, '.yo-rc.json'))); - } - - // symlink our dependency directories - return Promise.all(promises).then(done); - }) - .withGenerators([ - require.resolve('../generators/endpoint'), - // [helpers.createDummyGenerator(), 'ng-component:app'] - ]) - // .withArguments(['upperCaseBug']) - .withOptions(options); - - if(prompts) gen.withPrompts(prompts); - - gen - .on('error', reject) - .on('end', () => resolve(dir)); - }); -} - function runEndpointGen(name, opt={}) { let prompts = opt.prompts || {}; let options = opt.options || {}; @@ -129,7 +88,7 @@ describe('angular-fullstack:app', function() { describe('with a generated endpoint', function() { beforeEach(function() { - return getConfig(path.join(dir, '.yo-rc.json')).then(config => { + return readJSON(path.join(dir, '.yo-rc.json')).then(config => { return runEndpointGen('foo', {config: config['generator-angular-fullstack']}); }); }); @@ -141,7 +100,7 @@ describe('angular-fullstack:app', function() { describe('with a generated capitalized endpoint', function() { beforeEach(function() { - return getConfig(path.join(dir, '.yo-rc.json')).then(config => { + return readJSON(path.join(dir, '.yo-rc.json')).then(config => { return runEndpointGen('Foo', {config: config['generator-angular-fullstack']}); }); }); @@ -153,7 +112,7 @@ describe('angular-fullstack:app', function() { describe('with a generated path name endpoint', function() { beforeEach(function() { - return getConfig(path.join(dir, '.yo-rc.json')).then(config => { + return readJSON(path.join(dir, '.yo-rc.json')).then(config => { return runEndpointGen('foo/bar', {config: config['generator-angular-fullstack']}); }); }); @@ -165,7 +124,7 @@ describe('angular-fullstack:app', function() { describe('with a generated snake-case endpoint', function() { beforeEach(function() { - return getConfig(path.join(dir, '.yo-rc.json')).then(config => { + return readJSON(path.join(dir, '.yo-rc.json')).then(config => { return runEndpointGen('foo-bar', {config: config['generator-angular-fullstack']}); }); }); @@ -287,7 +246,7 @@ describe('angular-fullstack:app', function() { describe('with a generated endpoint', function() { beforeEach(function() { - return getConfig(path.join(dir, '.yo-rc.json')).then(config => { + return readJSON(path.join(dir, '.yo-rc.json')).then(config => { return runEndpointGen('foo', {config: config['generator-angular-fullstack']}); }); }); @@ -363,7 +322,7 @@ describe('angular-fullstack:app', function() { describe('with a generated endpoint', function() { beforeEach(function() { - return getConfig(path.join(dir, '.yo-rc.json')).then(config => { + return readJSON(path.join(dir, '.yo-rc.json')).then(config => { return runEndpointGen('foo', {config: config['generator-angular-fullstack']}); }); }); @@ -440,7 +399,7 @@ describe('angular-fullstack:app', function() { describe('with a generated endpoint', function() { beforeEach(function() { - return getConfig(path.join(dir, '.yo-rc.json')).then(config => { + return readJSON(path.join(dir, '.yo-rc.json')).then(config => { return runEndpointGen('foo', {config: config['generator-angular-fullstack']}); }); }); diff --git a/src/test/test-helpers.js b/src/test/test-helpers.js index 4a3149eff..5a192e936 100644 --- a/src/test/test-helpers.js +++ b/src/test/test-helpers.js @@ -8,6 +8,14 @@ import helpers from 'yeoman-test'; import assert from 'yeoman-assert'; import recursiveReadDir from 'recursive-readdir'; +const TEST_DIR = __dirname; + +/** + * Copy file from src to dest + * @param {string} src + * @param {string} dest + * @returns {Promise} + */ export function copyAsync(src, dest) { return fs.readFileAsync(src) .then(data => fs.writeFileAsync(dest, data)); @@ -37,6 +45,13 @@ export function runCmd(cmd) { }); } +/** + * Assert that only the expected files are present + * @param {string[]} expectedFiles - array of expected files + * @param {string} [topLevelPath='./'] - root dir of expected files to recursively search + * @param {string[]} [skip=['node_modules','bower_components']] - files/folders recursiveReadDir should skip + * @returns {Promise} + */ export function assertOnlyFiles(expectedFiles, topLevelPath='./', skip=['node_modules', 'bower_components']) { return new Promise((resolve, reject) => { recursiveReadDir(topLevelPath, skip, function(err, actualFiles) { @@ -55,8 +70,62 @@ export function assertOnlyFiles(expectedFiles, topLevelPath='./', skip=['node_mo }); } -export function getConfig(path) { +/** + * Read JSON from a file + * @param {string} path + * @returns {Promise} - parsed JSON + */ +export function readJSON(path) { return fs.readFileAsync(path, 'utf8').then(data => { return JSON.parse(data); }); } + +/** + * Run angular-fullstack:app + * @param {object} [prompts] + * @param {object} [opts={}] + * @param {boolean} [opts.copyConfigFile] - copy default .yo-rc.json + * @returns {Promise} + */ +export function runGen(prompts, opts={}) { + let options = opts.options || {skipInstall: true}; + + return new Promise((resolve, reject) => { + let dir; + let gen = helpers + .run(require.resolve('../generators/app')) + .inTmpDir(function(_dir) { + // this will create a new temporary directory for each new generator run + var done = this.async(); + if(DEBUG) console.log(`TEMP DIR: ${_dir}`); + dir = _dir; + + let promises = [ + fs.mkdirAsync(dir + '/client').then(() => { + return fs.symlinkAsync(__dirname + '/fixtures/bower_components', dir + '/client/bower_components'); + }), + fs.symlinkAsync(__dirname + '/fixtures/node_modules', dir + '/node_modules') + ]; + + if(opts.copyConfigFile) { + promises.push(copyAsync(path.join(TEST_DIR, 'fixtures/.yo-rc.json'), path.join(dir, '.yo-rc.json'))); + } + + // symlink our dependency directories + return Promise.all(promises).then(done); + }) + .withGenerators([ + require.resolve('../generators/endpoint'), + // [helpers.createDummyGenerator(), 'ng-component:app'] + ]) + // .withArguments(['upperCaseBug']) + .withOptions(options); + + if(prompts) gen.withPrompts(prompts); + + gen + .on('error', reject) + .on('end', () => resolve(dir)); + }); +} \ No newline at end of file From 97ddb8bc95d60316ff70644c603a7c6830e7155c Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Sun, 1 May 2016 23:54:40 -0400 Subject: [PATCH 125/885] chore(package): bump yeoman-test to ^1.3.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 168f15fed..6d407e4c0 100644 --- a/package.json +++ b/package.json @@ -83,7 +83,7 @@ "shelljs": "^0.6.0", "should": "^8.3.1", "yeoman-assert": "^2.0.0", - "yeoman-test": "^1.1.0" + "yeoman-test": "^1.3.0" }, "engines": { "node": "^5.10.1", From ae514e117e079a85108b54812476479a3b85bafe Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Mon, 2 May 2016 15:20:26 -0400 Subject: [PATCH 126/885] test(gen): slow tests are 500ms and above [skip ci] --- gulpfile.js | 1 + 1 file changed, 1 insertion(+) diff --git a/gulpfile.js b/gulpfile.js index b08c3968e..0f6dcdf23 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -22,6 +22,7 @@ const mocha = lazypipe() .pipe(gulpMocha, { reporter: 'spec', timeout: 120000, + slow: 500, globals: { should: require('should') }, From 3b613e70e1f8973954689a4f6dab11fe66075b5e Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Mon, 2 May 2016 15:26:04 -0400 Subject: [PATCH 127/885] test(gen:main): retry e2e tests twice --- src/test/main.test.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/test/main.test.js b/src/test/main.test.js index cfe269f2a..849b221b5 100644 --- a/src/test/main.test.js +++ b/src/test/main.test.js @@ -136,10 +136,12 @@ describe('angular-fullstack:app', function() { if(!process.env.SKIP_E2E) { it('should run e2e tests successfully', function() { + this.retries(2); return runCmd('grunt test:e2e').should.be.fulfilled(); }); it('should run e2e tests successfully for production app', function() { + this.retries(2); return runCmd('grunt test:e2e:prod').should.be.fulfilled(); }); } @@ -258,10 +260,12 @@ describe('angular-fullstack:app', function() { if(!process.env.SKIP_E2E) { it('should run e2e tests successfully', function() { + this.retries(2); return runCmd('grunt test:e2e').should.be.fulfilled(); }); it('should run e2e tests successfully for production app', function() { + this.retries(2); return runCmd('grunt test:e2e:prod').should.be.fulfilled(); }); } @@ -334,10 +338,12 @@ describe('angular-fullstack:app', function() { if(!process.env.SKIP_E2E) { it('should run e2e tests successfully', function() { + this.retries(2); return runCmd('grunt test').should.be.fulfilled(); }); it('should run e2e tests successfully for production app', function() { + this.retries(2); return runCmd('grunt test:e2e:prod').should.be.fulfilled(); }); } @@ -411,10 +417,12 @@ describe('angular-fullstack:app', function() { if(!process.env.SKIP_E2E) { it('should run e2e tests successfully', function() { + this.retries(2); return runCmd('grunt test:e2e').should.be.fulfilled(); }); it('should run e2e tests successfully for production app', function() { + this.retries(2); return runCmd('grunt test:e2e:prod').should.be.fulfilled(); }); } From aedb37ecc8850dc40dbc74672f07fd2bd8a0504a Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Tue, 3 May 2016 13:28:00 -0600 Subject: [PATCH 128/885] fix(gen:gulp:clean): also clean test dir --- gulpfile.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gulpfile.js b/gulpfile.js index 0f6dcdf23..2a66b5681 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -35,7 +35,7 @@ const transpile = lazypipe() .pipe(babel); gulp.task('clean', () => { - return del(['generators/**/*']); + return del(['generators/**/*', './test/(**|!fixtures/node_modules|!fixtures/bower_components)/*']); }); gulp.task('babel', () => { From a644812aa7594ee77e7f6dd97369d3a6e41d73cf Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Tue, 3 May 2016 16:39:50 -0600 Subject: [PATCH 129/885] chore(gen): update yeoman-generator to 0.23.0 --- package.json | 2 +- src/generators/app/index.js | 30 ++++++++---------------------- src/generators/endpoint/index.js | 4 +--- 3 files changed, 10 insertions(+), 26 deletions(-) diff --git a/package.json b/package.json index 6d407e4c0..42dafd1c9 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,7 @@ "insight": "~0.8.1", "lodash": "^4.6.1", "underscore.string": "^3.1.1", - "yeoman-generator": "^0.22.5", + "yeoman-generator": "~0.23.0", "yeoman-welcome": "^1.0.1" }, "devDependencies": { diff --git a/src/generators/app/index.js b/src/generators/app/index.js index 1bfaa9e16..b2814b718 100644 --- a/src/generators/app/index.js +++ b/src/generators/app/index.js @@ -63,16 +63,15 @@ export class Generator extends Base { this.log('Out of the box I create an AngularJS app with an Express server.\n'); }, checkForConfig: function() { - var cb = this.async(); var existingFilters = this.config.get('filters'); if(existingFilters) { - this.prompt([{ + return this.prompt([{ type: 'confirm', name: 'skipConfig', message: 'Existing .yo-rc configuration found, would you like to use it?', default: true, - }], answers => { + }]).then(answers => { this.skipConfig = answers.skipConfig; if(this.skipConfig) { @@ -92,11 +91,7 @@ export class Generator extends Base { this.config.set('filters', this.filters); this.config.forceSave(); } - - cb(); }); - } else { - cb(); } } }; @@ -106,11 +101,10 @@ export class Generator extends Base { return { clientPrompts: function() { if(this.skipConfig) return; - var cb = this.async(); this.log('# Client\n'); - this.prompt([{ + return this.prompt([{ type: 'list', name: 'transpiler', message: 'What would you like to write scripts with?', @@ -156,7 +150,7 @@ export class Generator extends Base { name: 'uibootstrap', message: 'Would you like to include UI Bootstrap?', when: answers => answers.bootstrap - }], answers => { + }]).then(answers => { this.filters.js = true; this.filters[answers.transpiler] = true; insight.track('transpiler', answers.transpiler); @@ -184,18 +178,15 @@ export class Generator extends Base { var styleExt = {sass: 'scss', stylus: 'styl'}[answers.stylesheet]; this.styleExt = styleExt ? styleExt : answers.stylesheet; - - cb(); }); }, serverPrompts: function() { if(this.skipConfig) return; - var cb = this.async(); var self = this; this.log('\n# Server\n'); - this.prompt([{ + return this.prompt([{ type: 'checkbox', name: 'odms', message: 'What would you like to use for data modeling?', @@ -245,7 +236,7 @@ export class Generator extends Base { // to-do: should not be dependent on ODMs when: answers => answers.odms && answers.odms.length !== 0, default: true - }], answers => { + }]).then(answers => { if(answers.socketio) this.filters.socketio = true; insight.track('socketio', !!answers.socketio); @@ -284,18 +275,15 @@ export class Generator extends Base { insight.track('google-oauth', !!this.filters['googleAuth']); insight.track('facebook-oauth', !!this.filters['facebookAuth']); insight.track('twitter-oauth', !!this.filters['twitterAuth']); - - cb(); }); }, projectPrompts: function() { if(this.skipConfig) return; - var cb = this.async(); var self = this; this.log('\n# Project\n'); - this.prompt([{ + return this.prompt([{ type: 'list', name: 'buildtool', message: 'Would you like to use Gulp or Grunt?', @@ -320,7 +308,7 @@ export class Generator extends Base { choices: ['Expect', 'Should'], filter: val => val.toLowerCase(), when: answers => answers.testing === 'mocha' - }], answers => { + }]).then(answers => { this.filters[answers.buildtool] = true; insight.track('buildtool', answers.buildtool); @@ -338,8 +326,6 @@ export class Generator extends Base { this.filters.should = false; this.filters.expect = false; } - - cb(); }); } }; diff --git a/src/generators/endpoint/index.js b/src/generators/endpoint/index.js index 4c05c8e97..b48a8815f 100644 --- a/src/generators/endpoint/index.js +++ b/src/generators/endpoint/index.js @@ -33,7 +33,6 @@ export class Generator extends Base { } prompting() { - var done = this.async(); var promptCb = (props) => { if(props.route.charAt(0) !== '/') { props.route = '/' + props.route; @@ -50,7 +49,6 @@ export class Generator extends Base { this.filters[props.models] = true; this.filters[props.models + 'Models'] = true; } - done(); }; if (this.options.route) { @@ -92,7 +90,7 @@ export class Generator extends Base { when: () => this.filters.mongoose && this.filters.sequelize }]; - this.prompt(prompts, promptCb); + return this.prompt(prompts).then(promptCb); } configuring() { From 6666ddb56f6c93157728a3f9037da11d464f4655 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Tue, 3 May 2016 16:51:29 -0600 Subject: [PATCH 130/885] fix(gen:test): endpoint gen `before` should be inside the `describe` else it would run before every suite, not just that suite --- src/test/endpoint.test.js | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/src/test/endpoint.test.js b/src/test/endpoint.test.js index 16cb76c38..729535b9f 100644 --- a/src/test/endpoint.test.js +++ b/src/test/endpoint.test.js @@ -123,26 +123,26 @@ function jscsDir(dir, name, folder) { var config; var genDir; -before(function() { - return Promise.all([ - runGen(defaultOptions).then(_dir => { - genDir = _dir; - - return fs.readFileAsync(path.join(genDir, '.jscsrc'), 'utf8').then(data => { - jscs.configure(JSON.parse(data)); - }); - }), - readJSON(path.join(TEST_DIR, 'fixtures/.yo-rc.json')).then(_config => { - _config['generator-angular-fullstack'].insertRoutes = false; - _config['generator-angular-fullstack'].pluralizeRoutes = false; - _config['generator-angular-fullstack'].insertSockets = false; - _config['generator-angular-fullstack'].insertModels = false; - config = _config; - }) - ]); -}); - describe('angular-fullstack:endpoint', function() { + before(function() { + return Promise.all([ + runGen(defaultOptions).then(_dir => { + genDir = _dir; + + return fs.readFileAsync(path.join(genDir, '.jscsrc'), 'utf8').then(data => { + jscs.configure(JSON.parse(data)); + }); + }), + readJSON(path.join(TEST_DIR, 'fixtures/.yo-rc.json')).then(_config => { + _config['generator-angular-fullstack'].insertRoutes = false; + _config['generator-angular-fullstack'].pluralizeRoutes = false; + _config['generator-angular-fullstack'].insertSockets = false; + _config['generator-angular-fullstack'].insertModels = false; + config = _config; + }) + ]); + }); + describe(`with a generated endpont 'foo'`, function() { var dir; beforeEach(function() { From 4863f7c98c888fcf82addb998c6d2ddaf9c25d27 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Tue, 3 May 2016 17:58:43 -0600 Subject: [PATCH 131/885] chore(gen): update yeoman-test to 1.4.0, use `toPromise` --- package.json | 2 +- src/test/test-helpers.js | 69 +++++++++++++++++++--------------------- 2 files changed, 33 insertions(+), 38 deletions(-) diff --git a/package.json b/package.json index 42dafd1c9..d1f0792f0 100644 --- a/package.json +++ b/package.json @@ -83,7 +83,7 @@ "shelljs": "^0.6.0", "should": "^8.3.1", "yeoman-assert": "^2.0.0", - "yeoman-test": "^1.3.0" + "yeoman-test": "^1.4.0" }, "engines": { "node": "^5.10.1", diff --git a/src/test/test-helpers.js b/src/test/test-helpers.js index 5a192e936..f82ef4b8d 100644 --- a/src/test/test-helpers.js +++ b/src/test/test-helpers.js @@ -91,41 +91,36 @@ export function readJSON(path) { export function runGen(prompts, opts={}) { let options = opts.options || {skipInstall: true}; - return new Promise((resolve, reject) => { - let dir; - let gen = helpers - .run(require.resolve('../generators/app')) - .inTmpDir(function(_dir) { - // this will create a new temporary directory for each new generator run - var done = this.async(); - if(DEBUG) console.log(`TEMP DIR: ${_dir}`); - dir = _dir; - - let promises = [ - fs.mkdirAsync(dir + '/client').then(() => { - return fs.symlinkAsync(__dirname + '/fixtures/bower_components', dir + '/client/bower_components'); - }), - fs.symlinkAsync(__dirname + '/fixtures/node_modules', dir + '/node_modules') - ]; - - if(opts.copyConfigFile) { - promises.push(copyAsync(path.join(TEST_DIR, 'fixtures/.yo-rc.json'), path.join(dir, '.yo-rc.json'))); - } - - // symlink our dependency directories - return Promise.all(promises).then(done); - }) - .withGenerators([ - require.resolve('../generators/endpoint'), - // [helpers.createDummyGenerator(), 'ng-component:app'] - ]) - // .withArguments(['upperCaseBug']) - .withOptions(options); - - if(prompts) gen.withPrompts(prompts); - - gen - .on('error', reject) - .on('end', () => resolve(dir)); - }); + // let dir; + let gen = helpers + .run(require.resolve('../generators/app')) + .inTmpDir(function(dir) { + // this will create a new temporary directory for each new generator run + var done = this.async(); + if(DEBUG) console.log(`TEMP DIR: ${dir}`); + + let promises = [ + fs.mkdirAsync(dir + '/client').then(() => { + return fs.symlinkAsync(__dirname + '/fixtures/bower_components', dir + '/client/bower_components'); + }), + fs.symlinkAsync(__dirname + '/fixtures/node_modules', dir + '/node_modules') + ]; + + if(opts.copyConfigFile) { + promises.push(copyAsync(path.join(TEST_DIR, 'fixtures/.yo-rc.json'), path.join(dir, '.yo-rc.json'))); + } + + // symlink our dependency directories + return Promise.all(promises).then(done); + }) + .withGenerators([ + require.resolve('../generators/endpoint'), + // [helpers.createDummyGenerator(), 'ng-component:app'] + ]) + // .withArguments(['upperCaseBug']) + .withOptions(options); + + if(prompts) gen.withPrompts(prompts); + + return gen.toPromise(); } \ No newline at end of file From 5f8805d4f1fce32cf83184b44d0ce61fe692e48c Mon Sep 17 00:00:00 2001 From: thegitfather Date: Wed, 4 May 2016 13:41:47 +0200 Subject: [PATCH 132/885] fix(server:oauth): fix mongoose validation when re-login using twitter oauth Problem occurs after second login attempt using passport-twitter. Error message: "ValidationError: The specified email address is already in use." --- .../server/api/user(auth)/user.model(mongooseModels).js | 3 +++ 1 file changed, 3 insertions(+) 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 d11f5d4d1..60120b3b6 100644 --- a/app/templates/server/api/user(auth)/user.model(mongooseModels).js +++ b/app/templates/server/api/user(auth)/user.model(mongooseModels).js @@ -95,6 +95,9 @@ UserSchema .path('email') .validate(function(value, respond) { var self = this; + if (authTypes.indexOf(this.provider) !== -1) { + return respond(true); + } return this.constructor.findOne({ email: value }).exec() .then(function(user) { if (user) { From a9d238c9d136aa71dbf70df22c58f27bba90b570 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Wed, 4 May 2016 10:47:40 -0600 Subject: [PATCH 133/885] fix(gen:test:main): fix sql e2e --- src/test/main.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/main.test.js b/src/test/main.test.js index 849b221b5..d23add9cd 100644 --- a/src/test/main.test.js +++ b/src/test/main.test.js @@ -339,7 +339,7 @@ describe('angular-fullstack:app', function() { if(!process.env.SKIP_E2E) { it('should run e2e tests successfully', function() { this.retries(2); - return runCmd('grunt test').should.be.fulfilled(); + return runCmd('grunt test:e2e').should.be.fulfilled(); }); it('should run e2e tests successfully for production app', function() { From 5cbd6034739558f4a9bd7dc0083ea56558510681 Mon Sep 17 00:00:00 2001 From: thegitfather Date: Wed, 4 May 2016 13:41:47 +0200 Subject: [PATCH 134/885] fix(server:oauth): fix mongoose validation when re-login using twitter oauth Problem occurs after second login attempt using passport-twitter. Error message: "ValidationError: The specified email address is already in use." --- .../app/server/api/user(auth)/user.model(mongooseModels).js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/templates/app/server/api/user(auth)/user.model(mongooseModels).js b/templates/app/server/api/user(auth)/user.model(mongooseModels).js index d11f5d4d1..60120b3b6 100644 --- a/templates/app/server/api/user(auth)/user.model(mongooseModels).js +++ b/templates/app/server/api/user(auth)/user.model(mongooseModels).js @@ -95,6 +95,9 @@ UserSchema .path('email') .validate(function(value, respond) { var self = this; + if (authTypes.indexOf(this.provider) !== -1) { + return respond(true); + } return this.constructor.findOne({ email: value }).exec() .then(function(user) { if (user) { From 8cf7f9e0629c86596811886ca4bf0b6f68bce69f Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Wed, 4 May 2016 11:16:19 -0600 Subject: [PATCH 135/885] fix(server): fix oauth PR --- .../app/server/api/user(auth)/user.model(mongooseModels).js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/templates/app/server/api/user(auth)/user.model(mongooseModels).js b/templates/app/server/api/user(auth)/user.model(mongooseModels).js index 60120b3b6..5394bad3c 100644 --- a/templates/app/server/api/user(auth)/user.model(mongooseModels).js +++ b/templates/app/server/api/user(auth)/user.model(mongooseModels).js @@ -95,9 +95,10 @@ UserSchema .path('email') .validate(function(value, respond) { var self = this; + <%_ if(filters.oauth) { _%> if (authTypes.indexOf(this.provider) !== -1) { return respond(true); - } + }<% } %> return this.constructor.findOne({ email: value }).exec() .then(function(user) { if (user) { From b52a71be89d365cae45e9ed275613d722258eb0e Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Wed, 4 May 2016 14:13:19 -0600 Subject: [PATCH 136/885] chore(gen:package): update yeoman deps, generator-ng-component --- package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index d1f0792f0..50e500b75 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,7 @@ "babel-plugin-syntax-flow": "^6.5.0", "babel-plugin-transform-flow-strip-types": "^6.7.0", "chalk": "^1.1.0", - "generator-ng-component": "~0.2.1", + "generator-ng-component": "~0.3.0", "glob": "^7.0.3", "gulp-babel": "^6.1.2", "gulp-beautify": "^2.0.0", @@ -47,7 +47,7 @@ "insight": "~0.8.1", "lodash": "^4.6.1", "underscore.string": "^3.1.1", - "yeoman-generator": "~0.23.0", + "yeoman-generator": "~0.23.3", "yeoman-welcome": "^1.0.1" }, "devDependencies": { @@ -83,7 +83,7 @@ "shelljs": "^0.6.0", "should": "^8.3.1", "yeoman-assert": "^2.0.0", - "yeoman-test": "^1.4.0" + "yeoman-test": "~1.4.0" }, "engines": { "node": "^5.10.1", From 69933c6fb1208fb611cb7a6bb2c20f5d516aa46c Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Wed, 4 May 2016 14:31:25 -0600 Subject: [PATCH 137/885] test(gen:sequelize): retry all sequelize tests 3 times --- src/test/main.test.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/test/main.test.js b/src/test/main.test.js index d23add9cd..9e4e53fef 100644 --- a/src/test/main.test.js +++ b/src/test/main.test.js @@ -291,6 +291,7 @@ describe('angular-fullstack:app', function() { bootstrap: true, uibootstrap: true }; + this.retries(3); // Sequelize seems to be quite flaky beforeEach(function() { return runGen(testOptions).then(_dir => { From e2f6056fd82e869399a7770f98b897484e35bfc9 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Wed, 4 May 2016 17:40:51 -0600 Subject: [PATCH 138/885] 3.7.0-beta-2 [skip ci] --- angular-fullstack-deps | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/angular-fullstack-deps b/angular-fullstack-deps index 7bfa34baa..414ce8173 160000 --- a/angular-fullstack-deps +++ b/angular-fullstack-deps @@ -1 +1 @@ -Subproject commit 7bfa34baa078ab2ee9d7be5850c568b968566fd0 +Subproject commit 414ce81739c932aa4b9b9565c508956d207ade11 diff --git a/package.json b/package.json index e0a84bc24..ac9a68518 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "generator-angular-fullstack", - "version": "3.7.0-beta.1", + "version": "3.7.0-beta.2", "description": "Yeoman generator for creating MEAN stack applications, using MongoDB, Express, AngularJS, and Node", "keywords": [ "yeoman-generator", From 282e48a5117acfb047ccaf5f9903e4bc3734ea58 Mon Sep 17 00:00:00 2001 From: greenkeeperio-bot Date: Thu, 5 May 2016 11:26:45 -0600 Subject: [PATCH 139/885] chore(package): update gulp-if to version 2.0.1 https://greenkeeper.io/ --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ac9a68518..c5861fd12 100644 --- a/package.json +++ b/package.json @@ -67,7 +67,7 @@ "grunt-mocha-test": "^0.12.7", "grunt-release": "^0.13.0", "gulp": "^3.9.1", - "gulp-if": "^2.0.0", + "gulp-if": "^2.0.1", "gulp-mocha": "^2.2.0", "gulp-plumber": "^1.1.0", "gulp-util": "^3.0.7", From ae313df8ae0afd90eaabcb3035ac2eb999ef49c6 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Thu, 5 May 2016 23:22:53 -0600 Subject: [PATCH 140/885] fix(server): MONGOLAB_URI -> MONGODB_URI fixes #1838 [skip ci] --- templates/app/server/config/environment/production.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/app/server/config/environment/production.js b/templates/app/server/config/environment/production.js index bb2a0375c..791dfb4a1 100644 --- a/templates/app/server/config/environment/production.js +++ b/templates/app/server/config/environment/production.js @@ -15,7 +15,7 @@ module.exports = { // MongoDB connection options mongo: { - uri: process.env.MONGOLAB_URI || + uri: process.env.MONGODB_URI || process.env.MONGOHQ_URL || process.env.OPENSHIFT_MONGODB_DB_URL + process.env.OPENSHIFT_APP_NAME || From f3fd533c8db9fe440143bf57389ff041b2d1ba3f Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Thu, 5 May 2016 23:24:37 -0600 Subject: [PATCH 141/885] style(): [skip ci] --- src/test/main.test.js | 2 +- src/test/test-helpers.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test/main.test.js b/src/test/main.test.js index 9e4e53fef..5e701de0d 100644 --- a/src/test/main.test.js +++ b/src/test/main.test.js @@ -428,4 +428,4 @@ describe('angular-fullstack:app', function() { }); } }); -}); \ No newline at end of file +}); diff --git a/src/test/test-helpers.js b/src/test/test-helpers.js index f82ef4b8d..ffd69c0a8 100644 --- a/src/test/test-helpers.js +++ b/src/test/test-helpers.js @@ -123,4 +123,4 @@ export function runGen(prompts, opts={}) { if(prompts) gen.withPrompts(prompts); return gen.toPromise(); -} \ No newline at end of file +} From c56c3600c71f7a5f0fa45b43bf2937ce0564ce3e Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Thu, 5 May 2016 23:36:04 -0600 Subject: [PATCH 142/885] docs(readme): add note about updating node on openshift [skip ci] --- readme.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/readme.md b/readme.md index 3b3e7628b..6e5009001 100644 --- a/readme.md +++ b/readme.md @@ -271,6 +271,8 @@ Produces ###Openshift +> Note: Openshift uses a quite old version of Node by default. We strongly recommend updating your Node version. [Here's a helpful article](https://blog.openshift.com/any-version-of-nodejs-you-want-in-the-cloud-openshift-does-it-paas-style/). + Deploying to OpenShift can be done in just a few steps: yo angular-fullstack:openshift From bcf5fd48ea0f79cac4b1cb872f4de4bd1f56ee24 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Thu, 5 May 2016 23:36:31 -0600 Subject: [PATCH 143/885] docs(readme): remove example project --- readme.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/readme.md b/readme.md index 6e5009001..67cf1ca77 100644 --- a/readme.md +++ b/readme.md @@ -12,10 +12,6 @@ [![Dependency Status](https://img.shields.io/david/angular-fullstack/angular-fullstack-deps.svg)](https://david-dm.org/angular-fullstack/angular-fullstack-deps) [![Dev-Dependency Status](https://img.shields.io/david/dev/angular-fullstack/angular-fullstack-deps.svg)](https://david-dm.org/angular-fullstack/angular-fullstack-deps#info=devDependencies) -## Example project - -Source code: https://github.com/DaftMonk/fullstack-demo - ## Usage Install `yo`, `grunt-cli`/`gulp-cli`, `bower`, and `generator-angular-fullstack`: From c12f3ee714c9f8d5ef7d2979258654e9afd2c7ee Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Thu, 5 May 2016 23:50:22 -0600 Subject: [PATCH 144/885] chore(package): jsonwebtoken -> 6.2.0 --- templates/app/_package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/app/_package.json b/templates/app/_package.json index 7e4f6532c..a6807dd38 100644 --- a/templates/app/_package.json +++ b/templates/app/_package.json @@ -24,7 +24,7 @@ "sequelize": "^3.5.1", "sqlite3": "~3.1.1", "express-sequelize-session": "0.4.0",<% } %><% if (filters.auth) { %> - "jsonwebtoken": "^5.0.0", + "jsonwebtoken": "^6.2.0", "express-jwt": "^3.0.0", "passport": "~0.3.0", "passport-local": "^1.0.0",<% } %><% if (filters.facebookAuth) { %> From c181fc376fa154377b36409cd662119f35cc3f50 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Fri, 6 May 2016 00:00:41 -0600 Subject: [PATCH 145/885] chore(package): bump various deps --- templates/app/_package.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/templates/app/_package.json b/templates/app/_package.json index 7e4f6532c..0dfdf1dd8 100644 --- a/templates/app/_package.json +++ b/templates/app/_package.json @@ -51,7 +51,7 @@ "gulp-babel": "^6.1.2",<% if(filters.ts) { %> "gulp-typescript": "~2.13.0", "gulp-tsd": "~0.1.0", - "gulp-tslint": "^4.3.0",<% } %> + "gulp-tslint": "^5.0.0",<% } %> "gulp-cache": "^0.4.2", "gulp-concat": "^2.6.0", "gulp-env": "^0.4.0", @@ -128,8 +128,8 @@ "grunt-angular-templates": "^1.0.3", "grunt-dom-munger": "^3.4.0", "grunt-protractor-runner": "^3.1.0", - "grunt-injector": "^0.6.0", - "grunt-karma": "~0.12.0", + "grunt-injector": "^1.0.0", + "grunt-karma": "^1.0.0", "grunt-build-control": "^0.7.0",<% if(filters.sass) { %> "grunt-sass": "^1.1.0",<% } %><% if(filters.stylus) { %> "grunt-contrib-stylus": "^1.2.0",<% } %> @@ -141,7 +141,7 @@ "grunt-mocha-test": "~0.12.7", "grunt-mocha-istanbul": "^4.0.2",<% } /*end grunt*/ %> "open": "~0.0.4", - "jshint-stylish": "~2.1.0", + "jshint-stylish": "^2.2.0", "connect-livereload": "^0.5.3", "istanbul": "~0.4.1", "chai": "^3.2.0", From 3391299b29d5a4f6e111872013c3e3a27a693ba7 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Fri, 6 May 2016 10:50:00 -0600 Subject: [PATCH 146/885] fix(package): grunt-injector 1.0.0 is broken --- templates/app/_package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/app/_package.json b/templates/app/_package.json index 0dfdf1dd8..8bd07114a 100644 --- a/templates/app/_package.json +++ b/templates/app/_package.json @@ -128,7 +128,7 @@ "grunt-angular-templates": "^1.0.3", "grunt-dom-munger": "^3.4.0", "grunt-protractor-runner": "^3.1.0", - "grunt-injector": "^1.0.0", + "grunt-injector": "~0.6.0 ", "grunt-karma": "^1.0.0", "grunt-build-control": "^0.7.0",<% if(filters.sass) { %> "grunt-sass": "^1.1.0",<% } %><% if(filters.stylus) { %> From 2547a22028325bbb5a291e6736c22d0d24a92c3e Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Fri, 6 May 2016 10:53:43 -0600 Subject: [PATCH 147/885] chore(package): bump karma deps, remove requirejs --- templates/app/_package.json | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/templates/app/_package.json b/templates/app/_package.json index 8bd07114a..7ae00ac8e 100644 --- a/templates/app/_package.json +++ b/templates/app/_package.json @@ -149,24 +149,22 @@ "chai-as-promised": "^5.1.0", "chai-things": "^0.2.0", "karma": "~0.13.3", - "karma-firefox-launcher": "~0.1.6", - "karma-script-launcher": "~0.2.0", - "karma-chrome-launcher": "~0.2.0", - "karma-requirejs": "~0.2.2", + "karma-firefox-launcher": "^1.0.0", + "karma-script-launcher": "^1.0.0", + "karma-chrome-launcher": "^1.0.1", "karma-jade-preprocessor": "0.0.11", "karma-phantomjs-launcher": "~1.0.0",<% if (filters.jade) { %> "karma-ng-jade2js-preprocessor": "^0.2.0",<% } %> - "karma-ng-html2js-preprocessor": "~0.2.0", + "karma-ng-html2js-preprocessor": "^1.0.0", "karma-spec-reporter": "~0.0.20", "sinon-chai": "^2.8.0", "mocha": "^2.2.5",<% if (filters.mocha) { %> - "karma-mocha": "^0.2.0", + "karma-mocha": "^1.0.1", "karma-chai-plugins": "~0.7.0",<% } if (filters.jasmine) { %> "jasmine-core": "^2.3.4", - "karma-jasmine": "~0.3.0", + "karma-jasmine": "^1.0.2", "jasmine-spec-reporter": "^2.4.0",<% } if(filters.babel) { %> "karma-babel-preprocessor": "^6.0.1",<% } %> - "requirejs": "~2.2.0", "phantomjs-prebuilt": "^2.1.4", "proxyquire": "^1.0.1", "supertest": "^1.1.0"<% if(filters.ts) { %>, From ebf2990bb952fdded832992a3e4eddd147075ab5 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Fri, 6 May 2016 11:32:35 -0600 Subject: [PATCH 148/885] docs(readme): readme tweaks [skip ci] --- readme.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/readme.md b/readme.md index 67cf1ca77..3b579c62c 100644 --- a/readme.md +++ b/readme.md @@ -49,7 +49,7 @@ Run `grunt` for building, `grunt serve` for preview, and `grunt serve:dist` for **Client** -* Scripts: `Babel`, `TypeScript` +* Scripts: `JavaScript (Babel)`, `TypeScript` * Markup: `HTML`, `Jade` * Stylesheets: `CSS`, `Stylus`, `Sass`, `Less` * Angular Routers: `ngRoute`, `ui-router` @@ -58,7 +58,7 @@ Run `grunt` for building, `grunt serve` for preview, and `grunt serve:dist` for **Server** -* Scripts: `Babel` +* Scripts: `JavaScript (Babel)` * Database: * `None`, * `MongoDB`, `SQL` @@ -68,14 +68,15 @@ Run `grunt` for building, `grunt serve` for preview, and `grunt serve:dist` for ## Injection -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. +A grunt/gulp 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/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` +* `babel`/`typescript` temp `js` files into `client/index.html` +* `typescript types` into `tsconfig.client.json` & `tsconfig.client.test.json` ## Generators From 63fb77ff5b0e8c12982981536801c81cbb45e19f Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Fri, 6 May 2016 15:23:27 -0600 Subject: [PATCH 149/885] fix(express): import `connect-mongo/es5` if node < 4 closes #1844 --- package.json | 1 + src/generators/app/index.js | 26 ++++++++++++------------ src/generators/util.js | 28 ++++++++++++++++++++++++++ templates/app/server/config/express.js | 4 +++- 4 files changed, 45 insertions(+), 14 deletions(-) diff --git a/package.json b/package.json index c5861fd12..c1b983dfe 100644 --- a/package.json +++ b/package.json @@ -46,6 +46,7 @@ "gulp-filter": "^4.0.0", "insight": "~0.8.1", "lodash": "^4.6.1", + "semver": "^5.1.0", "underscore.string": "^3.1.1", "yeoman-generator": "~0.23.3", "yeoman-welcome": "^1.0.1" diff --git a/src/generators/app/index.js b/src/generators/app/index.js index b2814b718..de4647416 100644 --- a/src/generators/app/index.js +++ b/src/generators/app/index.js @@ -2,6 +2,7 @@ import fs from 'fs'; import path from 'path'; +import { runCmd } from '../util'; import chalk from 'chalk'; import {Base} from 'yeoman-generator'; import {genBase} from '../generator-base'; @@ -10,6 +11,7 @@ import {exec} from 'child_process'; import babelStream from 'gulp-babel'; import beaufityStream from 'gulp-beautify'; import filter from 'gulp-filter'; +import semver from 'semver'; export class Generator extends Base { constructor(...args) { @@ -33,32 +35,30 @@ export class Generator extends Base { get initializing() { return { init: function () { - var cb = this.async(); - this.config.set('generatorVersion', this.rootGeneratorVersion()); this.filters = {}; // init shared generator properies and methods genBase(this); + insight.track('generator', this.rootGeneratorVersion()); + this.nodeVersion = semver.clean(process.version); + this.semver = semver; + insight.track('node', this.nodeVersion); + insight.track('platform', process.platform); + if(process.env.CI) { insight.optOut = true; - return cb(); } else if(insight.optOut === undefined) { insight.askPermission(null, cb); - } else { - return cb(); } + + return runCmd('npm --version').then(stdout => { + this.npmVersion = stdout.toString().trim(); + return insight.track('npm', this.npmVersion); + }); }, info: function () { - insight.track('generator', this.rootGeneratorVersion()); - insight.track('node', process.version); - exec('npm --version', (err, stdin, stderr) => { - if(err || stderr.length > 0) return insight.track('npm', 'error'); - else return insight.track('npm', stdin.toString().trim()); - }); - insight.track('platform', process.platform); - this.log(this.yoWelcome); this.log('Out of the box I create an AngularJS app with an Express server.\n'); }, diff --git a/src/generators/util.js b/src/generators/util.js index 4ed6205c2..90a2db5a3 100644 --- a/src/generators/util.js +++ b/src/generators/util.js @@ -3,6 +3,34 @@ import path from 'path'; import fs from 'fs'; import glob from 'glob'; +import Promise from 'bluebird'; +import {exec} from 'child_process'; + +const DEBUG = !!process.env.DEBUG; + +/** + * @callback doneCallback + * @param {null|Error} err + */ + +/** + * Run the given command in a child process + * @param {string} cmd - command to run + * @returns {Promise} + */ +export function runCmd(cmd) { + return new Promise((resolve, reject) => { + exec(cmd, {}, function(err, stdout, stderr) { + if(err) { + console.error(stdout); + return reject(err); + } else { + if(DEBUG) console.log(`${cmd} stdout: ${stdout}`); + return resolve(stdout); + } + }); + }); +} function expandFiles(pattern, options) { options = options || {}; diff --git a/templates/app/server/config/express.js b/templates/app/server/config/express.js index 84f82043b..e2c0d2560 100644 --- a/templates/app/server/config/express.js +++ b/templates/app/server/config/express.js @@ -17,7 +17,9 @@ 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'; +<%_ if(semver.satisfies(nodeVersion, '>= 4')) { _%> +import connectMongo from 'connect-mongo';<% } else { _%> +import connectMongo from 'connect-mongo/es5';<% } %> import mongoose from 'mongoose'; var MongoStore = connectMongo(session);<% } else if(filters.sequelize) { %> import sqldb from '../sqldb'; From bf649ab82aa623e62bab62d860a01f994d6027f1 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Fri, 6 May 2016 15:53:54 -0600 Subject: [PATCH 150/885] feat(gen): add component generator closes #1711 --- src/generators/app/index.js | 1 + src/generators/component/index.js | 14 ++++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 src/generators/component/index.js diff --git a/src/generators/app/index.js b/src/generators/app/index.js index de4647416..0ab968d7d 100644 --- a/src/generators/app/index.js +++ b/src/generators/app/index.js @@ -387,6 +387,7 @@ export class Generator extends Base { 'directiveDirectory': appPath, 'filterDirectory': appPath, 'serviceDirectory': appPath, + 'componentDirectory': `${appPath}components/`, 'filters': filters, 'extensions': extensions, 'basePath': 'client', diff --git a/src/generators/component/index.js b/src/generators/component/index.js new file mode 100644 index 000000000..9d742dca4 --- /dev/null +++ b/src/generators/component/index.js @@ -0,0 +1,14 @@ +'use strict'; +import {Base} from 'yeoman-generator'; + +class Generator extends Base { + compose() { + this.composeWith('ng-component:component', { + arguments: this.arguments + }, { + local: require.resolve('generator-ng-component/component') + }); + } +} + +module.exports = Generator; From 58c9dbf51d6bb0db736a7aa0befd0a573b2f52f0 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Fri, 6 May 2016 16:15:32 -0600 Subject: [PATCH 151/885] chore(gen): make sure users are using yo >= 1.7.1 --- src/generators/app/index.js | 6 ++++-- src/generators/generator-base.js | 23 ++++++++++++++++------- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/src/generators/app/index.js b/src/generators/app/index.js index 0ab968d7d..34d1df167 100644 --- a/src/generators/app/index.js +++ b/src/generators/app/index.js @@ -39,7 +39,7 @@ export class Generator extends Base { this.filters = {}; // init shared generator properies and methods - genBase(this); + const genBasePromise = genBase(this); insight.track('generator', this.rootGeneratorVersion()); this.nodeVersion = semver.clean(process.version); @@ -53,10 +53,12 @@ export class Generator extends Base { insight.askPermission(null, cb); } - return runCmd('npm --version').then(stdout => { + const npmVersionPromise = runCmd('npm --version').then(stdout => { this.npmVersion = stdout.toString().trim(); return insight.track('npm', this.npmVersion); }); + + return Promise.all([genBasePromise, npmVersionPromise]); }, info: function () { this.log(this.yoWelcome); diff --git a/src/generators/generator-base.js b/src/generators/generator-base.js index 180411e0a..358254eba 100644 --- a/src/generators/generator-base.js +++ b/src/generators/generator-base.js @@ -4,6 +4,7 @@ import util from 'util'; import path from 'path'; import lodash from 'lodash'; import s from 'underscore.string'; +import semver from 'semver'; import yoWelcome from 'yeoman-welcome'; import * as genUtils from './util'; @@ -13,6 +14,12 @@ lodash.mixin(s.exports()); export function genBase(self) { self = self || this; + let yoCheckPromise = genUtils.runCmd('yo --version').then(stdout => { + if(!semver.satisfies(semver.clean(stdout), '>= 1.7.1')) { + throw new Error('ERROR: You need to update yo to at least 1.7.1 (npm i -g yo)'); + } + }); + self.lodash = lodash; self.yoWelcome = yoWelcome; @@ -46,19 +53,21 @@ export function genBase(self) { self.processDirectory = genUtils.processDirectory.bind(self); // rewrite a file in place self.rewriteFile = genUtils.rewriteFile; + + return yoCheckPromise; } export function genNamedBase(self) { self = self || this; // extend genBase - genBase(self); - - var name = self.name.replace(/\//g, '-'); + return genBase(self).then(() => { + var name = self.name.replace(/\//g, '-'); - self.cameledName = lodash.camelize(name); - self.classedName = lodash.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; + self.basename = path.basename(self.name); + self.dirname = (self.name.indexOf('/') >= 0) ? path.dirname(self.name) : self.name; + }); } From f8e1ead7e0faef3a65abb65a2c1fa59fd305ec7c Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Fri, 6 May 2016 16:36:49 -0600 Subject: [PATCH 152/885] fix(build): don't check yo version on CI --- src/generators/generator-base.js | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/generators/generator-base.js b/src/generators/generator-base.js index 358254eba..166411d41 100644 --- a/src/generators/generator-base.js +++ b/src/generators/generator-base.js @@ -14,11 +14,17 @@ lodash.mixin(s.exports()); export function genBase(self) { self = self || this; - let yoCheckPromise = genUtils.runCmd('yo --version').then(stdout => { - if(!semver.satisfies(semver.clean(stdout), '>= 1.7.1')) { - throw new Error('ERROR: You need to update yo to at least 1.7.1 (npm i -g yo)'); - } - }); + let yoCheckPromise; + if(!process.env.CI) { + yoCheckPromise = genUtils.runCmd('yo --version').then(stdout => { + if(!semver.satisfies(semver.clean(stdout), '>= 1.7.1')) { + throw new Error('ERROR: You need to update yo to at least 1.7.1 (npm i -g yo)'); + } + }); + } else { + // CI won't have yo installed + yoCheckPromise = Promise.resolve(); + } self.lodash = lodash; self.yoWelcome = yoWelcome; From 55c9a18ab234d033ccd8b70a15969bf0e29c8090 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Fri, 6 May 2016 21:34:25 -0600 Subject: [PATCH 153/885] feat(grunt:less): add sourcemap options (#1868) closes #1765 --- templates/app/Gruntfile(grunt).js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/templates/app/Gruntfile(grunt).js b/templates/app/Gruntfile(grunt).js index 7f5d4e83f..7b92bf2a9 100644 --- a/templates/app/Gruntfile(grunt).js +++ b/templates/app/Gruntfile(grunt).js @@ -705,6 +705,10 @@ module.exports = function(grunt) { // Compiles Less to CSS less: { + options: { + sourceMap: true, + sourceMapFileInline: true + }, server: { files: { '.tmp/app/app.css' : '<%%= yeoman.client %>/app/app.less' From c94f78f00eae92e8149ce9254b978f1982e0ed06 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Fri, 6 May 2016 20:53:08 -0600 Subject: [PATCH 154/885] chore(app): tsd -> typings (fix webdriver-update for diff npm versions) closes #1803 [2a46b5d] b --- templates/app/Gruntfile(grunt).js | 26 ++++---------- templates/app/_package.json | 18 ++++++---- templates/app/gulpfile.babel(gulp).js | 48 ++++++++++---------------- templates/app/tsconfig.client(ts).json | 11 +++--- templates/app/tsd(ts).json | 21 ----------- templates/app/tsd_test(ts).json | 33 ------------------ templates/app/typings.json | 20 +++++++++++ 7 files changed, 61 insertions(+), 116 deletions(-) delete mode 100644 templates/app/tsd(ts).json delete mode 100644 templates/app/tsd_test(ts).json create mode 100644 templates/app/typings.json diff --git a/templates/app/Gruntfile(grunt).js b/templates/app/Gruntfile(grunt).js index 7b92bf2a9..cf335b970 100644 --- a/templates/app/Gruntfile(grunt).js +++ b/templates/app/Gruntfile(grunt).js @@ -664,19 +664,8 @@ module.exports = function(grunt) { } }, - tsd: { - install: { - options: { - command: 'reinstall', - config: './tsd.json' - } - }, - install_test: { - options: { - command: 'reinstall', - config: './tsd_test.json' - } - } + typings: { + install: {} },<% } %><% if(filters.stylus) { %> // Compiles Stylus to CSS @@ -856,7 +845,7 @@ module.exports = function(grunt) { 'clean:server', 'env:all', 'concurrent:pre',<% if(filters.ts) { %> - 'tsd',<% } %> + 'typings',<% } %> 'concurrent:server', 'injector', 'wiredep:client', @@ -869,7 +858,7 @@ module.exports = function(grunt) { 'clean:server', 'env:all', 'concurrent:pre',<% if(filters.ts) { %> - 'tsd',<% } %> + 'typings',<% } %> 'concurrent:server', 'injector', 'wiredep:client', @@ -901,7 +890,7 @@ module.exports = function(grunt) { 'concurrent:pre',<% if(filters.ts) { %> 'ts:client', 'ts:client_test', - 'tsd',<% } %> + 'typings',<% } %> 'concurrent:test', 'injector', 'postcss', @@ -923,8 +912,7 @@ module.exports = function(grunt) { 'env:all', 'env:test', 'concurrent:pre',<% if(filters.ts) { %> - 'tsd:install', - 'tsd:install_test', + 'typings', 'ts:client', 'ts:client_test',<% } %> 'concurrent:test', @@ -971,7 +959,7 @@ module.exports = function(grunt) { grunt.registerTask('build', [ 'clean:dist', 'concurrent:pre',<% if(filters.ts) { %> - 'tsd',<% } %> + 'typings',<% } %> 'concurrent:dist', 'injector', 'wiredep:client', diff --git a/templates/app/_package.json b/templates/app/_package.json index 43d891ce0..ab6d09dde 100644 --- a/templates/app/_package.json +++ b/templates/app/_package.json @@ -50,7 +50,7 @@ "gulp-autoprefixer": "^3.1.0", "gulp-babel": "^6.1.2",<% if(filters.ts) { %> "gulp-typescript": "~2.13.0", - "gulp-tsd": "~0.1.0", + "gulp-typings": "^1.3.6", "gulp-tslint": "^5.0.0",<% } %> "gulp-cache": "^0.4.2", "gulp-concat": "^2.6.0", @@ -113,7 +113,7 @@ "grunt-contrib-less": "^1.2.0",<% } %> "grunt-babel": "~6.0.0",<% if(filters.ts) { %> "grunt-ts": "^5.3.2", - "grunt-tsd": "~0.1.0", + "grunt-typings": "~0.1.4", "grunt-tslint": "~3.1.0",<% } %> "grunt-google-cdn": "~0.4.0", "grunt-jscs": "^2.1.0", @@ -168,17 +168,23 @@ "phantomjs-prebuilt": "^2.1.4", "proxyquire": "^1.0.1", "supertest": "^1.1.0"<% if(filters.ts) { %>, - "tslint": "^3.5.0"<% } %> + "tslint": "^3.5.0", + "typings": "^0.8.1"<% } %> }, "engines": { "node": "^4.4.0", "npm": "^2.14.20" }, - "scripts": { - "start": "node server",<% if(filters.gulp) { %> + "scripts": {<% if(filters.gulp) { %> "test": "gulp test",<% } else { %> "test": "grunt test",<% } %> - "update-webdriver": "node node_modules/grunt-protractor-runner/node_modules/protractor/bin/webdriver-manager update" + <%_ if(filters.ts) { _%> + "postinstall": "./node_modules/.bin/typings install",<% } %> + <%_ if(semver.satisfies(npmVersion, '>= 3')) { _%> + "update-webdriver": "node node_modules/protractor/bin/webdriver-manager update", + <%_ } else { _%> + "update-webdriver": "node node_modules/grunt-protractor-runner/node_modules/protractor/bin/webdriver-manager update",<% } %> + "start": "node server" }, "private": true } diff --git a/templates/app/gulpfile.babel(gulp).js b/templates/app/gulpfile.babel(gulp).js index e69e20533..be37130d9 100644 --- a/templates/app/gulpfile.babel(gulp).js +++ b/templates/app/gulpfile.babel(gulp).js @@ -245,9 +245,8 @@ function injectTsConfig(filesGlob, tsconfigPath){ gulp.task('inject:tsconfig', () => { return injectTsConfig([ `${clientPath}/**/!(*.spec|*.mock).ts`, - `!${clientPath}/bower_components/**/*`, - `${clientPath}/typings/**/*.d.ts`, - `!${clientPath}/test_typings/**/*.d.ts` + `!${clientPath}/bower_components/**/*`, + `typings/main.d.ts` ], './tsconfig.client.json'); }); @@ -256,8 +255,7 @@ gulp.task('inject:tsconfigTest', () => { return injectTsConfig([ `${clientPath}/**/+(*.spec|*.mock).ts`, `!${clientPath}/bower_components/**/*`, - `!${clientPath}/typings/**/*.d.ts`, - `${clientPath}/test_typings/**/*.d.ts` + `typings/main.d.ts` ], './tsconfig.client.test.json'); });<% } %> @@ -298,25 +296,17 @@ gulp.task('inject:<%= styleExt %>', () => { });<% } %><% if(filters.ts) { %> // Install DefinitelyTyped TypeScript definition files -gulp.task('tsd', cb => { - plugins.tsd({ - command: 'reinstall', - config: './tsd.json' - }, cb); -}); - -gulp.task('tsd:test', cb => { - plugins.tsd({ - command: 'reinstall', - config: './tsd_test.json' - }, cb); +gulp.task('typings', () => { + return gulp.src("./typings.json") + .pipe(plugins.typings()); });<% } %> gulp.task('styles', () => { <%_ if(!filters.css) { _%> return gulp.src(paths.client.mainStyle) <%_ } else { _%> - return gulp.src(paths.client.styles)<% } %> + return gulp.src(paths.client.styles) + <%_ } _%> .pipe(styles()) .pipe(gulp.dest('.tmp/app')); });<% if(filters.ts) { %> @@ -326,20 +316,18 @@ gulp.task('copy:constant', ['constant'], () => { .pipe(gulp.dest('.tmp/app')); }) -gulp.task('transpile:client', ['tsd', 'copy:constant'], () => { - let tsProject = plugins.typescript.createProject('./tsconfig.client.json'); - return tsProject.src() +gulp.task('transpile:client', ['typings', 'copy:constant'], () => { + return gulp.src(['client/{app,components}/**/!(*.spec|*.mock).ts', 'typings/main.d.ts']) .pipe(plugins.sourcemaps.init()) - .pipe(plugins.typescript(tsProject)).js + .pipe(plugins.typescript()).js .pipe(plugins.sourcemaps.write('.')) .pipe(gulp.dest('.tmp')); }); -gulp.task('transpile:client:test', ['tsd:test'], () => { - let tsTestProject = plugins.typescript.createProject('./tsconfig.client.test.json'); - return tsTestProject.src() +gulp.task('transpile:client:test', ['typings'], () => { + return gulp.src(['client/{app,components}/**/+(*.spec|*.mock).ts', 'typings/main.d.ts']) .pipe(plugins.sourcemaps.init()) - .pipe(plugins.typescript(tsTestProject)).js + .pipe(plugins.typescript()).js .pipe(plugins.sourcemaps.write('.')) .pipe(gulp.dest('.tmp/test')); });<% } %><% if(filters.babel) { %> @@ -448,7 +436,7 @@ gulp.task('watch', () => { .pipe(gulp.dest('.tmp')) .pipe(plugins.livereload());<% } %><% if(filters.ts) { %> - gulp.watch(paths.client.scripts, ['inject:tsconfig', 'lint:scripts:client', 'transpile:client']);<% } %> + gulp.watch(paths.client.scripts, ['lint:scripts:client', 'transpile:client']);<% } %> plugins.watch(_.union(paths.server.scripts, testFiles)) .pipe(plugins.plumber()) @@ -459,7 +447,7 @@ gulp.task('watch', () => { }); gulp.task('serve', cb => { - runSequence(['clean:tmp', 'constant', 'env:all'<% if(filters.ts) { %>, 'tsd'<% } %>], + runSequence(['clean:tmp', 'constant', 'env:all'<% if(filters.ts) { %>, 'typings'<% } %>], ['lint:scripts', 'inject'<% if(filters.jade) { %>, 'jade'<% } %>], ['wiredep:client'], ['transpile:client', 'styles'], @@ -478,7 +466,7 @@ gulp.task('serve:dist', cb => { }); gulp.task('serve:debug', cb => { - runSequence(['clean:tmp', 'constant'<% if(filters.ts) { %>, 'tsd'<% } %>], + runSequence(['clean:tmp', 'constant'<% if(filters.ts) { %>, 'typings'<% } %>], ['lint:scripts', 'inject'<% if(filters.jade) { %>, 'jade'<% } %>], ['wiredep:client'], ['transpile:client', 'styles'], @@ -568,7 +556,7 @@ gulp.task('build', cb => { 'jade',<% } %> 'inject', 'wiredep:client',<% if(filters.ts) { %> - 'tsd',<% } %> + 'typings',<% } %> [ 'build:images', 'copy:extras', diff --git a/templates/app/tsconfig.client(ts).json b/templates/app/tsconfig.client(ts).json index edbfbd011..e84a3e2fe 100644 --- a/templates/app/tsconfig.client(ts).json +++ b/templates/app/tsconfig.client(ts).json @@ -2,11 +2,12 @@ "compilerOptions": { "sourceMap": true, "rootDir": "./client", - "outDir": ".tmp" + "outDir": ".tmp", + "target": "ES5" }, "filesGlob": [ "client/{app,components}/**/!(*.spec).ts", - "client/typings/**/*.d.ts" + "typings/main.d.ts" ], "files": [ "client/app/account/account.ts", @@ -36,10 +37,6 @@ "client/components/ui-router/ui-router.mock.ts", "client/components/util/util.module.ts", "client/components/util/util.service.ts", - "client/typings/angularjs/angular.d.ts", - "client/typings/jquery/jquery.d.ts", - "client/typings/lodash/lodash.d.ts", - "client/typings/socket.io-client/socket.io-client.d.ts", - "client/typings/tsd.d.ts" + "typings/main.d.ts" ] } diff --git a/templates/app/tsd(ts).json b/templates/app/tsd(ts).json deleted file mode 100644 index 9f475e502..000000000 --- a/templates/app/tsd(ts).json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "version": "v4", - "repo": "borisyankov/DefinitelyTyped", - "ref": "master", - "path": "client/typings", - "bundle": "client/typings/tsd.d.ts", - "installed": { - "angularjs/angular.d.ts": { - "commit": "40c60850ad6c8175a62d5ab48c4e016ea5b3dffe" - }, - "jquery/jquery.d.ts": { - "commit": "40c60850ad6c8175a62d5ab48c4e016ea5b3dffe" - }, - "lodash/lodash.d.ts": { - "commit": "40c60850ad6c8175a62d5ab48c4e016ea5b3dffe" - }, - "socket.io-client/socket.io-client.d.ts": { - "commit": "40c60850ad6c8175a62d5ab48c4e016ea5b3dffe" - } - } -} diff --git a/templates/app/tsd_test(ts).json b/templates/app/tsd_test(ts).json deleted file mode 100644 index 0a60c8103..000000000 --- a/templates/app/tsd_test(ts).json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "version": "v4", - "repo": "borisyankov/DefinitelyTyped", - "ref": "master", - "path": "client/test_typings", - "bundle": "client/test_typings/tsd.d.ts", - "installed": { - "angular-protractor/angular-protractor.d.ts": { - "commit": "40c60850ad6c8175a62d5ab48c4e016ea5b3dffe" - }, - "selenium-webdriver/selenium-webdriver.d.ts": { - "commit": "40c60850ad6c8175a62d5ab48c4e016ea5b3dffe" - },<% if(filters.mocha) { %> - "mocha/mocha.d.ts": { - "commit": "40c60850ad6c8175a62d5ab48c4e016ea5b3dffe" - }, - "chai/chai.d.ts": { - "commit": "40c60850ad6c8175a62d5ab48c4e016ea5b3dffe" - }, - "assertion-error/assertion-error.d.ts": { - "commit": "40c60850ad6c8175a62d5ab48c4e016ea5b3dffe" - }, - "sinon/sinon.d.ts": { - "commit": "40c60850ad6c8175a62d5ab48c4e016ea5b3dffe" - }, - "sinon-chai/sinon-chai.d.ts": { - "commit": "40c60850ad6c8175a62d5ab48c4e016ea5b3dffe" - }<% } %><% if(filters.jasmine) { %> - "jasmine/jasmine.d.ts": { - "commit": "40c60850ad6c8175a62d5ab48c4e016ea5b3dffe" - }<% } %> - } -} diff --git a/templates/app/typings.json b/templates/app/typings.json new file mode 100644 index 000000000..cfbd0f707 --- /dev/null +++ b/templates/app/typings.json @@ -0,0 +1,20 @@ +{ + "ambientDependencies": { + "angular": "registry:dt/angular#1.5.0+20160412133217", + "jquery": "github:DefinitelyTyped/DefinitelyTyped/jquery/jquery.d.ts#40c60850ad6c8175a62d5ab48c4e016ea5b3dffe", + "lodash": "github:DefinitelyTyped/DefinitelyTyped/lodash/lodash.d.ts#40c60850ad6c8175a62d5ab48c4e016ea5b3dffe", + "socket.io-client": "github:DefinitelyTyped/DefinitelyTyped/socket.io-client/socket.io-client.d.ts#40c60850ad6c8175a62d5ab48c4e016ea5b3dffe" + }, + "ambientDevDependencies": { + "angular-protractor": "github:DefinitelyTyped/DefinitelyTyped/angular-protractor/angular-protractor.d.ts#40c60850ad6c8175a62d5ab48c4e016ea5b3dffe", + "selenium-webdriver": "github:DefinitelyTyped/DefinitelyTyped/selenium-webdriver/selenium-webdriver.d.ts#40c60850ad6c8175a62d5ab48c4e016ea5b3dffe", + <%_ if(filters.mocha) { _%> + "mocha": "github:DefinitelyTyped/DefinitelyTyped/mocha/mocha.d.ts#40c60850ad6c8175a62d5ab48c4e016ea5b3dffe", + "chai": "github:DefinitelyTyped/DefinitelyTyped/chai/chai.d.ts#40c60850ad6c8175a62d5ab48c4e016ea5b3dffe", + "assertion-error": "github:DefinitelyTyped/DefinitelyTyped/assertion-error/assertion-error.d.ts#40c60850ad6c8175a62d5ab48c4e016ea5b3dffe", + "sinon": "github:DefinitelyTyped/DefinitelyTyped/sinon/sinon.d.ts#40c60850ad6c8175a62d5ab48c4e016ea5b3dffe", + "sinon-chai": "github:DefinitelyTyped/DefinitelyTyped/sinon-chai/sinon-chai.d.ts#40c60850ad6c8175a62d5ab48c4e016ea5b3dffe"<% } %> + <%_ if(filters.jasmine) { _%> + "jasmine": "github:DefinitelyTyped/DefinitelyTyped/jasmine/jasmine.d.ts#40c60850ad6c8175a62d5ab48c4e016ea5b3dffe"<% } %> + } +} From 6b30ef7bbdb3adc83adfc6dc4873a9bf90d4e177 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Fri, 6 May 2016 20:32:05 -0600 Subject: [PATCH 155/885] fix(gen:endpoint): return promise --- src/generators/endpoint/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/generators/endpoint/index.js b/src/generators/endpoint/index.js index b48a8815f..144325c2c 100644 --- a/src/generators/endpoint/index.js +++ b/src/generators/endpoint/index.js @@ -29,7 +29,7 @@ export class Generator extends Base { initializing() { // init shared generator properies and methods - genNamedBase(this); + return genNamedBase(this); } prompting() { From d23949d7c72bd9eabba801520211e376542572c8 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Fri, 6 May 2016 20:32:43 -0600 Subject: [PATCH 156/885] refactor(client): fix some type errors --- .../app/account(auth)/settings/settings.controller.js | 6 +++--- templates/app/client/app/admin(auth)/admin.controller.js | 4 ++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/templates/app/client/app/account(auth)/settings/settings.controller.js b/templates/app/client/app/account(auth)/settings/settings.controller.js index cbaed8885..58c89e0ff 100644 --- a/templates/app/client/app/account(auth)/settings/settings.controller.js +++ b/templates/app/client/app/account(auth)/settings/settings.controller.js @@ -1,10 +1,10 @@ 'use strict'; class SettingsController { - constructor(Auth) { - this.errors = {}; - this.submitted = false; + errors = {}; + submitted = false; + constructor(Auth) { this.Auth = Auth; } diff --git a/templates/app/client/app/admin(auth)/admin.controller.js b/templates/app/client/app/admin(auth)/admin.controller.js index 43964511a..b56309871 100644 --- a/templates/app/client/app/admin(auth)/admin.controller.js +++ b/templates/app/client/app/admin(auth)/admin.controller.js @@ -3,6 +3,10 @@ (function() { class AdminController { + <%_ if(filters.ts || filters.flow) { _%> + users: Object[]; + + <%_ } _%> constructor(User) { // Use the User $resource to fetch all users this.users = User.query(); From 19deba8e7961b8477041970013ee2b260f4ca95f Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Fri, 6 May 2016 21:01:42 -0600 Subject: [PATCH 157/885] fix(build): don't include postinstall on CI --- gulpfile.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 2a66b5681..c70cc8df0 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -84,6 +84,10 @@ var processJson = function(src, dest, opt) { var json = JSON.parse(data.replace(/<%(.*)%>/g, '')); + if(/package.json/g.test(src) && opt.test) { + delete json.scripts.postinstall; + } + // set properties json.name = opt.appName; json.description = opt.private @@ -103,13 +107,14 @@ var processJson = function(src, dest, opt) { function updateFixtures(target) { const deps = target === 'deps'; + const test = target === 'test'; const genVer = require('./package.json').version; const dest = __dirname + (deps ? '/angular-fullstack-deps/' : '/test/fixtures/'); const appName = deps ? 'angular-fullstack-deps' : 'tempApp'; return Promise.all([ - processJson('templates/app/_package.json', dest + 'package.json', {appName, genVer, private: !deps}), - processJson('templates/app/_bower.json', dest + 'bower.json', {appName, genVer, private: !deps}) + processJson('templates/app/_package.json', dest + 'package.json', {appName, genVer, private: !deps, test: test}), + processJson('templates/app/_bower.json', dest + 'bower.json', {appName, genVer, private: !deps, test: test}) ]); } From 3a970ea2f7643d10e7e48988294f4104089fad95 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Tue, 10 May 2016 18:16:25 -0400 Subject: [PATCH 158/885] test(gen): replace expected tsd files with expected typings file --- src/test/get-expected-files.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/test/get-expected-files.js b/src/test/get-expected-files.js index c3ac9a338..3543eda94 100644 --- a/src/test/get-expected-files.js +++ b/src/test/get-expected-files.js @@ -111,8 +111,7 @@ export function app(options) { files = files.concat([ 'tsconfig.client.test.json', 'tsconfig.client.json', - 'tsd.json', - 'tsd_test.json', + 'typings.json', 'client/tslint.json' ]); } else { From 6f82220fdc3046849a6980f347ad6308c43c59f3 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Tue, 10 May 2016 18:37:42 -0400 Subject: [PATCH 159/885] fix(gen:app): only include `typings.json` with TS --- templates/app/{typings.json => typings(ts).json} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename templates/app/{typings.json => typings(ts).json} (100%) diff --git a/templates/app/typings.json b/templates/app/typings(ts).json similarity index 100% rename from templates/app/typings.json rename to templates/app/typings(ts).json From 8d1471ab4a183112d9d710c8905be3253ea5cafa Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Tue, 10 May 2016 20:45:19 -0400 Subject: [PATCH 160/885] Ts improve (#1867) * fix(gen:endpoint): return promise * chore(app): tsd -> typings (fix webdriver-update for diff npm versions) closes #1803 [2a46b5d] b * refactor(client): fix some type errors * fix(build): don't include postinstall on CI * test(gen): replace expected tsd files with expected typings file * fix(gen:app): only include `typings.json` with TS --- gulpfile.js | 9 +++- src/generators/endpoint/index.js | 2 +- src/test/get-expected-files.js | 3 +- templates/app/Gruntfile(grunt).js | 26 +++------- templates/app/_package.json | 18 ++++--- .../settings/settings.controller.js | 6 +-- .../app/admin(auth)/admin.controller.js | 4 ++ templates/app/gulpfile.babel(gulp).js | 48 +++++++------------ templates/app/tsconfig.client(ts).json | 11 ++--- templates/app/tsd(ts).json | 21 -------- templates/app/tsd_test(ts).json | 33 ------------- templates/app/typings(ts).json | 20 ++++++++ 12 files changed, 77 insertions(+), 124 deletions(-) delete mode 100644 templates/app/tsd(ts).json delete mode 100644 templates/app/tsd_test(ts).json create mode 100644 templates/app/typings(ts).json diff --git a/gulpfile.js b/gulpfile.js index 2a66b5681..c70cc8df0 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -84,6 +84,10 @@ var processJson = function(src, dest, opt) { var json = JSON.parse(data.replace(/<%(.*)%>/g, '')); + if(/package.json/g.test(src) && opt.test) { + delete json.scripts.postinstall; + } + // set properties json.name = opt.appName; json.description = opt.private @@ -103,13 +107,14 @@ var processJson = function(src, dest, opt) { function updateFixtures(target) { const deps = target === 'deps'; + const test = target === 'test'; const genVer = require('./package.json').version; const dest = __dirname + (deps ? '/angular-fullstack-deps/' : '/test/fixtures/'); const appName = deps ? 'angular-fullstack-deps' : 'tempApp'; return Promise.all([ - processJson('templates/app/_package.json', dest + 'package.json', {appName, genVer, private: !deps}), - processJson('templates/app/_bower.json', dest + 'bower.json', {appName, genVer, private: !deps}) + processJson('templates/app/_package.json', dest + 'package.json', {appName, genVer, private: !deps, test: test}), + processJson('templates/app/_bower.json', dest + 'bower.json', {appName, genVer, private: !deps, test: test}) ]); } diff --git a/src/generators/endpoint/index.js b/src/generators/endpoint/index.js index b48a8815f..144325c2c 100644 --- a/src/generators/endpoint/index.js +++ b/src/generators/endpoint/index.js @@ -29,7 +29,7 @@ export class Generator extends Base { initializing() { // init shared generator properies and methods - genNamedBase(this); + return genNamedBase(this); } prompting() { diff --git a/src/test/get-expected-files.js b/src/test/get-expected-files.js index c3ac9a338..3543eda94 100644 --- a/src/test/get-expected-files.js +++ b/src/test/get-expected-files.js @@ -111,8 +111,7 @@ export function app(options) { files = files.concat([ 'tsconfig.client.test.json', 'tsconfig.client.json', - 'tsd.json', - 'tsd_test.json', + 'typings.json', 'client/tslint.json' ]); } else { diff --git a/templates/app/Gruntfile(grunt).js b/templates/app/Gruntfile(grunt).js index 7b92bf2a9..cf335b970 100644 --- a/templates/app/Gruntfile(grunt).js +++ b/templates/app/Gruntfile(grunt).js @@ -664,19 +664,8 @@ module.exports = function(grunt) { } }, - tsd: { - install: { - options: { - command: 'reinstall', - config: './tsd.json' - } - }, - install_test: { - options: { - command: 'reinstall', - config: './tsd_test.json' - } - } + typings: { + install: {} },<% } %><% if(filters.stylus) { %> // Compiles Stylus to CSS @@ -856,7 +845,7 @@ module.exports = function(grunt) { 'clean:server', 'env:all', 'concurrent:pre',<% if(filters.ts) { %> - 'tsd',<% } %> + 'typings',<% } %> 'concurrent:server', 'injector', 'wiredep:client', @@ -869,7 +858,7 @@ module.exports = function(grunt) { 'clean:server', 'env:all', 'concurrent:pre',<% if(filters.ts) { %> - 'tsd',<% } %> + 'typings',<% } %> 'concurrent:server', 'injector', 'wiredep:client', @@ -901,7 +890,7 @@ module.exports = function(grunt) { 'concurrent:pre',<% if(filters.ts) { %> 'ts:client', 'ts:client_test', - 'tsd',<% } %> + 'typings',<% } %> 'concurrent:test', 'injector', 'postcss', @@ -923,8 +912,7 @@ module.exports = function(grunt) { 'env:all', 'env:test', 'concurrent:pre',<% if(filters.ts) { %> - 'tsd:install', - 'tsd:install_test', + 'typings', 'ts:client', 'ts:client_test',<% } %> 'concurrent:test', @@ -971,7 +959,7 @@ module.exports = function(grunt) { grunt.registerTask('build', [ 'clean:dist', 'concurrent:pre',<% if(filters.ts) { %> - 'tsd',<% } %> + 'typings',<% } %> 'concurrent:dist', 'injector', 'wiredep:client', diff --git a/templates/app/_package.json b/templates/app/_package.json index 43d891ce0..ab6d09dde 100644 --- a/templates/app/_package.json +++ b/templates/app/_package.json @@ -50,7 +50,7 @@ "gulp-autoprefixer": "^3.1.0", "gulp-babel": "^6.1.2",<% if(filters.ts) { %> "gulp-typescript": "~2.13.0", - "gulp-tsd": "~0.1.0", + "gulp-typings": "^1.3.6", "gulp-tslint": "^5.0.0",<% } %> "gulp-cache": "^0.4.2", "gulp-concat": "^2.6.0", @@ -113,7 +113,7 @@ "grunt-contrib-less": "^1.2.0",<% } %> "grunt-babel": "~6.0.0",<% if(filters.ts) { %> "grunt-ts": "^5.3.2", - "grunt-tsd": "~0.1.0", + "grunt-typings": "~0.1.4", "grunt-tslint": "~3.1.0",<% } %> "grunt-google-cdn": "~0.4.0", "grunt-jscs": "^2.1.0", @@ -168,17 +168,23 @@ "phantomjs-prebuilt": "^2.1.4", "proxyquire": "^1.0.1", "supertest": "^1.1.0"<% if(filters.ts) { %>, - "tslint": "^3.5.0"<% } %> + "tslint": "^3.5.0", + "typings": "^0.8.1"<% } %> }, "engines": { "node": "^4.4.0", "npm": "^2.14.20" }, - "scripts": { - "start": "node server",<% if(filters.gulp) { %> + "scripts": {<% if(filters.gulp) { %> "test": "gulp test",<% } else { %> "test": "grunt test",<% } %> - "update-webdriver": "node node_modules/grunt-protractor-runner/node_modules/protractor/bin/webdriver-manager update" + <%_ if(filters.ts) { _%> + "postinstall": "./node_modules/.bin/typings install",<% } %> + <%_ if(semver.satisfies(npmVersion, '>= 3')) { _%> + "update-webdriver": "node node_modules/protractor/bin/webdriver-manager update", + <%_ } else { _%> + "update-webdriver": "node node_modules/grunt-protractor-runner/node_modules/protractor/bin/webdriver-manager update",<% } %> + "start": "node server" }, "private": true } diff --git a/templates/app/client/app/account(auth)/settings/settings.controller.js b/templates/app/client/app/account(auth)/settings/settings.controller.js index cbaed8885..58c89e0ff 100644 --- a/templates/app/client/app/account(auth)/settings/settings.controller.js +++ b/templates/app/client/app/account(auth)/settings/settings.controller.js @@ -1,10 +1,10 @@ 'use strict'; class SettingsController { - constructor(Auth) { - this.errors = {}; - this.submitted = false; + errors = {}; + submitted = false; + constructor(Auth) { this.Auth = Auth; } diff --git a/templates/app/client/app/admin(auth)/admin.controller.js b/templates/app/client/app/admin(auth)/admin.controller.js index 43964511a..b56309871 100644 --- a/templates/app/client/app/admin(auth)/admin.controller.js +++ b/templates/app/client/app/admin(auth)/admin.controller.js @@ -3,6 +3,10 @@ (function() { class AdminController { + <%_ if(filters.ts || filters.flow) { _%> + users: Object[]; + + <%_ } _%> constructor(User) { // Use the User $resource to fetch all users this.users = User.query(); diff --git a/templates/app/gulpfile.babel(gulp).js b/templates/app/gulpfile.babel(gulp).js index e69e20533..be37130d9 100644 --- a/templates/app/gulpfile.babel(gulp).js +++ b/templates/app/gulpfile.babel(gulp).js @@ -245,9 +245,8 @@ function injectTsConfig(filesGlob, tsconfigPath){ gulp.task('inject:tsconfig', () => { return injectTsConfig([ `${clientPath}/**/!(*.spec|*.mock).ts`, - `!${clientPath}/bower_components/**/*`, - `${clientPath}/typings/**/*.d.ts`, - `!${clientPath}/test_typings/**/*.d.ts` + `!${clientPath}/bower_components/**/*`, + `typings/main.d.ts` ], './tsconfig.client.json'); }); @@ -256,8 +255,7 @@ gulp.task('inject:tsconfigTest', () => { return injectTsConfig([ `${clientPath}/**/+(*.spec|*.mock).ts`, `!${clientPath}/bower_components/**/*`, - `!${clientPath}/typings/**/*.d.ts`, - `${clientPath}/test_typings/**/*.d.ts` + `typings/main.d.ts` ], './tsconfig.client.test.json'); });<% } %> @@ -298,25 +296,17 @@ gulp.task('inject:<%= styleExt %>', () => { });<% } %><% if(filters.ts) { %> // Install DefinitelyTyped TypeScript definition files -gulp.task('tsd', cb => { - plugins.tsd({ - command: 'reinstall', - config: './tsd.json' - }, cb); -}); - -gulp.task('tsd:test', cb => { - plugins.tsd({ - command: 'reinstall', - config: './tsd_test.json' - }, cb); +gulp.task('typings', () => { + return gulp.src("./typings.json") + .pipe(plugins.typings()); });<% } %> gulp.task('styles', () => { <%_ if(!filters.css) { _%> return gulp.src(paths.client.mainStyle) <%_ } else { _%> - return gulp.src(paths.client.styles)<% } %> + return gulp.src(paths.client.styles) + <%_ } _%> .pipe(styles()) .pipe(gulp.dest('.tmp/app')); });<% if(filters.ts) { %> @@ -326,20 +316,18 @@ gulp.task('copy:constant', ['constant'], () => { .pipe(gulp.dest('.tmp/app')); }) -gulp.task('transpile:client', ['tsd', 'copy:constant'], () => { - let tsProject = plugins.typescript.createProject('./tsconfig.client.json'); - return tsProject.src() +gulp.task('transpile:client', ['typings', 'copy:constant'], () => { + return gulp.src(['client/{app,components}/**/!(*.spec|*.mock).ts', 'typings/main.d.ts']) .pipe(plugins.sourcemaps.init()) - .pipe(plugins.typescript(tsProject)).js + .pipe(plugins.typescript()).js .pipe(plugins.sourcemaps.write('.')) .pipe(gulp.dest('.tmp')); }); -gulp.task('transpile:client:test', ['tsd:test'], () => { - let tsTestProject = plugins.typescript.createProject('./tsconfig.client.test.json'); - return tsTestProject.src() +gulp.task('transpile:client:test', ['typings'], () => { + return gulp.src(['client/{app,components}/**/+(*.spec|*.mock).ts', 'typings/main.d.ts']) .pipe(plugins.sourcemaps.init()) - .pipe(plugins.typescript(tsTestProject)).js + .pipe(plugins.typescript()).js .pipe(plugins.sourcemaps.write('.')) .pipe(gulp.dest('.tmp/test')); });<% } %><% if(filters.babel) { %> @@ -448,7 +436,7 @@ gulp.task('watch', () => { .pipe(gulp.dest('.tmp')) .pipe(plugins.livereload());<% } %><% if(filters.ts) { %> - gulp.watch(paths.client.scripts, ['inject:tsconfig', 'lint:scripts:client', 'transpile:client']);<% } %> + gulp.watch(paths.client.scripts, ['lint:scripts:client', 'transpile:client']);<% } %> plugins.watch(_.union(paths.server.scripts, testFiles)) .pipe(plugins.plumber()) @@ -459,7 +447,7 @@ gulp.task('watch', () => { }); gulp.task('serve', cb => { - runSequence(['clean:tmp', 'constant', 'env:all'<% if(filters.ts) { %>, 'tsd'<% } %>], + runSequence(['clean:tmp', 'constant', 'env:all'<% if(filters.ts) { %>, 'typings'<% } %>], ['lint:scripts', 'inject'<% if(filters.jade) { %>, 'jade'<% } %>], ['wiredep:client'], ['transpile:client', 'styles'], @@ -478,7 +466,7 @@ gulp.task('serve:dist', cb => { }); gulp.task('serve:debug', cb => { - runSequence(['clean:tmp', 'constant'<% if(filters.ts) { %>, 'tsd'<% } %>], + runSequence(['clean:tmp', 'constant'<% if(filters.ts) { %>, 'typings'<% } %>], ['lint:scripts', 'inject'<% if(filters.jade) { %>, 'jade'<% } %>], ['wiredep:client'], ['transpile:client', 'styles'], @@ -568,7 +556,7 @@ gulp.task('build', cb => { 'jade',<% } %> 'inject', 'wiredep:client',<% if(filters.ts) { %> - 'tsd',<% } %> + 'typings',<% } %> [ 'build:images', 'copy:extras', diff --git a/templates/app/tsconfig.client(ts).json b/templates/app/tsconfig.client(ts).json index edbfbd011..e84a3e2fe 100644 --- a/templates/app/tsconfig.client(ts).json +++ b/templates/app/tsconfig.client(ts).json @@ -2,11 +2,12 @@ "compilerOptions": { "sourceMap": true, "rootDir": "./client", - "outDir": ".tmp" + "outDir": ".tmp", + "target": "ES5" }, "filesGlob": [ "client/{app,components}/**/!(*.spec).ts", - "client/typings/**/*.d.ts" + "typings/main.d.ts" ], "files": [ "client/app/account/account.ts", @@ -36,10 +37,6 @@ "client/components/ui-router/ui-router.mock.ts", "client/components/util/util.module.ts", "client/components/util/util.service.ts", - "client/typings/angularjs/angular.d.ts", - "client/typings/jquery/jquery.d.ts", - "client/typings/lodash/lodash.d.ts", - "client/typings/socket.io-client/socket.io-client.d.ts", - "client/typings/tsd.d.ts" + "typings/main.d.ts" ] } diff --git a/templates/app/tsd(ts).json b/templates/app/tsd(ts).json deleted file mode 100644 index 9f475e502..000000000 --- a/templates/app/tsd(ts).json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "version": "v4", - "repo": "borisyankov/DefinitelyTyped", - "ref": "master", - "path": "client/typings", - "bundle": "client/typings/tsd.d.ts", - "installed": { - "angularjs/angular.d.ts": { - "commit": "40c60850ad6c8175a62d5ab48c4e016ea5b3dffe" - }, - "jquery/jquery.d.ts": { - "commit": "40c60850ad6c8175a62d5ab48c4e016ea5b3dffe" - }, - "lodash/lodash.d.ts": { - "commit": "40c60850ad6c8175a62d5ab48c4e016ea5b3dffe" - }, - "socket.io-client/socket.io-client.d.ts": { - "commit": "40c60850ad6c8175a62d5ab48c4e016ea5b3dffe" - } - } -} diff --git a/templates/app/tsd_test(ts).json b/templates/app/tsd_test(ts).json deleted file mode 100644 index 0a60c8103..000000000 --- a/templates/app/tsd_test(ts).json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "version": "v4", - "repo": "borisyankov/DefinitelyTyped", - "ref": "master", - "path": "client/test_typings", - "bundle": "client/test_typings/tsd.d.ts", - "installed": { - "angular-protractor/angular-protractor.d.ts": { - "commit": "40c60850ad6c8175a62d5ab48c4e016ea5b3dffe" - }, - "selenium-webdriver/selenium-webdriver.d.ts": { - "commit": "40c60850ad6c8175a62d5ab48c4e016ea5b3dffe" - },<% if(filters.mocha) { %> - "mocha/mocha.d.ts": { - "commit": "40c60850ad6c8175a62d5ab48c4e016ea5b3dffe" - }, - "chai/chai.d.ts": { - "commit": "40c60850ad6c8175a62d5ab48c4e016ea5b3dffe" - }, - "assertion-error/assertion-error.d.ts": { - "commit": "40c60850ad6c8175a62d5ab48c4e016ea5b3dffe" - }, - "sinon/sinon.d.ts": { - "commit": "40c60850ad6c8175a62d5ab48c4e016ea5b3dffe" - }, - "sinon-chai/sinon-chai.d.ts": { - "commit": "40c60850ad6c8175a62d5ab48c4e016ea5b3dffe" - }<% } %><% if(filters.jasmine) { %> - "jasmine/jasmine.d.ts": { - "commit": "40c60850ad6c8175a62d5ab48c4e016ea5b3dffe" - }<% } %> - } -} diff --git a/templates/app/typings(ts).json b/templates/app/typings(ts).json new file mode 100644 index 000000000..cfbd0f707 --- /dev/null +++ b/templates/app/typings(ts).json @@ -0,0 +1,20 @@ +{ + "ambientDependencies": { + "angular": "registry:dt/angular#1.5.0+20160412133217", + "jquery": "github:DefinitelyTyped/DefinitelyTyped/jquery/jquery.d.ts#40c60850ad6c8175a62d5ab48c4e016ea5b3dffe", + "lodash": "github:DefinitelyTyped/DefinitelyTyped/lodash/lodash.d.ts#40c60850ad6c8175a62d5ab48c4e016ea5b3dffe", + "socket.io-client": "github:DefinitelyTyped/DefinitelyTyped/socket.io-client/socket.io-client.d.ts#40c60850ad6c8175a62d5ab48c4e016ea5b3dffe" + }, + "ambientDevDependencies": { + "angular-protractor": "github:DefinitelyTyped/DefinitelyTyped/angular-protractor/angular-protractor.d.ts#40c60850ad6c8175a62d5ab48c4e016ea5b3dffe", + "selenium-webdriver": "github:DefinitelyTyped/DefinitelyTyped/selenium-webdriver/selenium-webdriver.d.ts#40c60850ad6c8175a62d5ab48c4e016ea5b3dffe", + <%_ if(filters.mocha) { _%> + "mocha": "github:DefinitelyTyped/DefinitelyTyped/mocha/mocha.d.ts#40c60850ad6c8175a62d5ab48c4e016ea5b3dffe", + "chai": "github:DefinitelyTyped/DefinitelyTyped/chai/chai.d.ts#40c60850ad6c8175a62d5ab48c4e016ea5b3dffe", + "assertion-error": "github:DefinitelyTyped/DefinitelyTyped/assertion-error/assertion-error.d.ts#40c60850ad6c8175a62d5ab48c4e016ea5b3dffe", + "sinon": "github:DefinitelyTyped/DefinitelyTyped/sinon/sinon.d.ts#40c60850ad6c8175a62d5ab48c4e016ea5b3dffe", + "sinon-chai": "github:DefinitelyTyped/DefinitelyTyped/sinon-chai/sinon-chai.d.ts#40c60850ad6c8175a62d5ab48c4e016ea5b3dffe"<% } %> + <%_ if(filters.jasmine) { _%> + "jasmine": "github:DefinitelyTyped/DefinitelyTyped/jasmine/jasmine.d.ts#40c60850ad6c8175a62d5ab48c4e016ea5b3dffe"<% } %> + } +} From 2cff111504565dc2504cff039fce9a3f09b7f825 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Wed, 11 May 2016 12:24:01 -0400 Subject: [PATCH 161/885] chore(github): add checkbox to issue template --- ISSUE_TEMPLATE.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ISSUE_TEMPLATE.md b/ISSUE_TEMPLATE.md index a024d2708..9ffab02d5 100644 --- a/ISSUE_TEMPLATE.md +++ b/ISSUE_TEMPLATE.md @@ -1,3 +1,5 @@ + - [ ] I understand that GitHub issues are not for tech support, but for questions specific to this generator, bug reports, and feature requests. + Item | Version ----- | ----- generator-angular-fullstack | x.x.x From 555fa49781c9f32bd2aee32f0692a05de33a3084 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Wed, 11 May 2016 12:34:49 -0400 Subject: [PATCH 162/885] docs(): init /docs/ [skip ci] --- docs/index.md | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 docs/index.md diff --git a/docs/index.md b/docs/index.md new file mode 100644 index 000000000..3a3218024 --- /dev/null +++ b/docs/index.md @@ -0,0 +1,2 @@ +# Documentation Home + From b98d9be5a89062f9df1303db71fbb20f24ee9ef7 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Wed, 11 May 2016 12:35:48 -0400 Subject: [PATCH 163/885] docs(contributing): specify yeoman contrib docs [skip ci] --- contributing.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contributing.md b/contributing.md index 221b0380e..55addd67b 100644 --- a/contributing.md +++ b/contributing.md @@ -1,6 +1,6 @@ # Contributing -See the [contributing docs](https://github.com/yeoman/yeoman/blob/master/contributing.md) +See the [Yeoman contributing docs](https://github.com/yeoman/yeoman/blob/master/contributing.md) Additionally for this generator: From ac4a990a14857c85fc016dc54f1ed81cb5badcf8 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Wed, 11 May 2016 12:46:14 -0400 Subject: [PATCH 164/885] docs(readme): add heroku gulp warning --- readme.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/readme.md b/readme.md index 3b579c62c..3b29328ef 100644 --- a/readme.md +++ b/readme.md @@ -335,6 +335,8 @@ Your app should now be live. To view it run `heroku open`. > heroku config:set DOMAIN= > +> WARNING: Deployment is untested with Gulp + To make your deployment process easier consider using [grunt-build-control](https://github.com/robwierzbowski/grunt-build-control). #### Pushing Updates From 14e9d5655a408ad724dc25c78c4a4f2746180899 Mon Sep 17 00:00:00 2001 From: gaboesquivel Date: Thu, 29 Jan 2015 16:25:49 -0600 Subject: [PATCH 165/885] docs(readme): add note on heroku mongohq replicaset connection error closes #806, [skip ci] --- readme.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/readme.md b/readme.md index 3b29328ef..8a8f9150f 100644 --- a/readme.md +++ b/readme.md @@ -318,6 +318,19 @@ If you're using mongoDB you will need to add a database to your app: heroku addons:create mongolab +Note: if you get an `Error: No valid replicaset instance servers found` you need to modify moongose connection options in config/environment/production.js as follows: +``` +options: { + db: { + safe: true, + replset: { socketOptions: { keepAlive: 1, connectTimeoutMS: 30000 } }, + server: { socketOptions: { keepAlive: 1, connectTimeoutMS: 30000 } } + } + } +``` +One of the odd things about the Node driver is that the default timeout for replica set connections is only 1 second, so make sure you're setting it to something more like 30s like in this example. + + Your app should now be live. To view it run `heroku open`. > From 86f2adec7bd7fc9e6c53c40e8eaa78ec3905c481 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Fri, 13 May 2016 13:27:26 -0400 Subject: [PATCH 166/885] docs(readme): update mongodb link [skip ci] --- readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.md b/readme.md index 8a8f9150f..1aaa84fc0 100644 --- a/readme.md +++ b/readme.md @@ -33,7 +33,7 @@ Run `grunt` for building, `grunt serve` for preview, and `grunt serve:dist` for ## Prerequisites -* MongoDB - Download and Install [MongoDB](http://www.mongodb.org/downloads) - If you plan on scaffolding your project with mongoose, you'll need mongoDB to be installed and have the `mongod` process running. +* MongoDB - Download and Install [MongoDB](https://www.mongodb.com/download-center#community) - If you plan on scaffolding your project with mongoose, you'll need mongoDB to be installed and have the `mongod` process running. ## Supported Configurations From e66d020c3f45d52f9cdec1e4b8df18d4abb5d239 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Fri, 13 May 2016 13:28:58 -0400 Subject: [PATCH 167/885] docs(readme): sean stack (tm) :wink: [skip ci] --- readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.md b/readme.md index 1aaa84fc0..cf47debcc 100644 --- a/readme.md +++ b/readme.md @@ -6,7 +6,7 @@ [![Gitter chat](https://img.shields.io/gitter/room/DaftMonk/generator-angular-fullstack.svg)](https://gitter.im/DaftMonk/generator-angular-fullstack) [![OpenCollective](https://opencollective.com/angular-fullstack/backers/badge.svg)](#backers) [![OpenCollective](https://opencollective.com/angular-fullstack/sponsors/badge.svg)](#sponsors) -> Yeoman generator for creating MEAN stack applications, using MongoDB, Express, AngularJS, and Node - lets you quickly set up a project following best practices. +> Yeoman generator for creating MEAN/SEAN stack applications, using MongoDB/SQL, Express, AngularJS, and Node - lets you quickly set up a project following best practices. #### Generated project: [![Dependency Status](https://img.shields.io/david/angular-fullstack/angular-fullstack-deps.svg)](https://david-dm.org/angular-fullstack/angular-fullstack-deps) From 4cc2da6da78f193309ec5dbde877e59f89922363 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Fri, 13 May 2016 13:59:26 -0400 Subject: [PATCH 168/885] feat(gen): default to gulp, mocha [skip ci] --- src/generators/app/index.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/generators/app/index.js b/src/generators/app/index.js index 34d1df167..a762512eb 100644 --- a/src/generators/app/index.js +++ b/src/generators/app/index.js @@ -290,13 +290,14 @@ export class Generator extends Base { name: 'buildtool', message: 'Would you like to use Gulp or Grunt?', choices: ['Grunt', 'Gulp'], - default: 0, + default: 1, filter: val => val.toLowerCase() }, { type: 'list', name: 'testing', message: 'What would you like to write tests with?', - choices: [ 'Jasmine', 'Mocha + Chai + Sinon'], + choices: ['Jasmine', 'Mocha + Chai + Sinon'], + default: 1, filter: function(val) { return { 'Jasmine': 'jasmine', From 8d5f493ba0dd1c631eca914da4ddd552672cd819 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Fri, 13 May 2016 14:01:29 -0400 Subject: [PATCH 169/885] docs(readme): remove travis note [skip ci] --- readme.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/readme.md b/readme.md index cf47debcc..f237fabee 100644 --- a/readme.md +++ b/readme.md @@ -482,8 +482,6 @@ When submitting a bugfix, try to write a test that exposes the bug and fails bef When submitting a new feature, add tests that cover the feature. -See the `travis.yml` for configuration required to run tests. - ## License [BSD license](http://opensource.org/licenses/bsd-license.php) From 20cc9d3be2aa8d0c59efc1dc36fb70f51b901ca9 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Fri, 13 May 2016 14:10:14 -0400 Subject: [PATCH 170/885] docs(generators:app): create app.md [skip ci] --- docs/generators/app.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 docs/generators/app.md diff --git a/docs/generators/app.md b/docs/generators/app.md new file mode 100644 index 000000000..95cb5cc4b --- /dev/null +++ b/docs/generators/app.md @@ -0,0 +1,17 @@ +### 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 +``` From a25ddadc1c82eeff143d3dcfe7ddaa9d1dca0350 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Fri, 13 May 2016 14:20:51 -0400 Subject: [PATCH 171/885] docs(generators:endpoint): create endpoint.md [skip ci] --- docs/generators/endpoint.md | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 docs/generators/endpoint.md diff --git a/docs/generators/endpoint.md b/docs/generators/endpoint.md new file mode 100644 index 000000000..2073d56e9 --- /dev/null +++ b/docs/generators/endpoint.md @@ -0,0 +1,34 @@ +### 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 Options: mongoose, sequelize + --endpointDirectory # Parent directory for enpoints + +Arguments: + name Type: String Required: true +``` + +Example: +```bash +yo angular-fullstack:endpoint message +[?] What will the url of your endpoint be? /api/messages +``` + +Produces: + + server/api/message/index.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) From 524544100de1249ec3f78774de7a78936c06ea0e Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Fri, 13 May 2016 14:20:54 -0400 Subject: [PATCH 172/885] docs(generators:route): create route.md [skip ci] --- docs/generators/route.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 docs/generators/route.md diff --git a/docs/generators/route.md b/docs/generators/route.md new file mode 100644 index 000000000..c77083209 --- /dev/null +++ b/docs/generators/route.md @@ -0,0 +1,18 @@ +### Route +Generates a new route. + +Example: +```bash +yo angular-fullstack:route myroute +[?] What module name would you like to use? myApp +[?] Where would you like to create this route? client/app/ +[?] What will the url of your route be? /myroute +``` + +Produces: + + client/app/myroute/myroute.js + client/app/myroute/myroute.controller.js + client/app/myroute/myroute.controller.spec.js + client/app/myroute/myroute.html + client/app/myroute/myroute.scss From c628bd10147730834a3818bd9ce535f04c3e1e8b Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Fri, 13 May 2016 14:21:49 -0400 Subject: [PATCH 173/885] docs(generators:controller): create controller.md [skip ci] --- docs/generators/controller.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 docs/generators/controller.md diff --git a/docs/generators/controller.md b/docs/generators/controller.md new file mode 100644 index 000000000..9056821ed --- /dev/null +++ b/docs/generators/controller.md @@ -0,0 +1,13 @@ +### Controller +Generates a controller. + +Example: +```bash +yo angular-fullstack:controller user +[?] Where would you like to create this controller? client/app/ +``` + +Produces: + + client/app/user/user.controller.js + client/app/user/user.controller.spec.js From 3dbd3d2ef7e5e8956ecce878910946be37c787b0 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Fri, 13 May 2016 14:22:23 -0400 Subject: [PATCH 174/885] docs(generators:directive): create directive.md [skip ci] --- docs/generators/directive.md | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 docs/generators/directive.md diff --git a/docs/generators/directive.md b/docs/generators/directive.md new file mode 100644 index 000000000..4961e44d1 --- /dev/null +++ b/docs/generators/directive.md @@ -0,0 +1,30 @@ +### Directive +Generates a directive. + +Example: +```bash +yo angular-fullstack:directive myDirective +[?] Where would you like to create this directive? client/app/ +[?] Does this directive need an external html file? Yes +``` + +Produces: + + client/app/myDirective/myDirective.directive.js + client/app/myDirective/myDirective.directive.spec.js + client/app/myDirective/myDirective.html + client/app/myDirective/myDirective.scss + +**Simple directive without an html file** + +Example: +```bash +yo angular-fullstack:directive simple +[?] Where would you like to create this directive? client/app/ +[?] Does this directive need an external html file? No +``` + +Produces: + + client/app/simple/simple.directive.js + client/app/simple/simple.directive.spec.js From da34dee2a48d83659d2b60c892dcb133ea144d3d Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Fri, 13 May 2016 14:23:01 -0400 Subject: [PATCH 175/885] docs(generators:filter): create filter.md [skip ci] --- docs/generators/filter.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 docs/generators/filter.md diff --git a/docs/generators/filter.md b/docs/generators/filter.md new file mode 100644 index 000000000..adc1d6202 --- /dev/null +++ b/docs/generators/filter.md @@ -0,0 +1,13 @@ +### Filter +Generates a filter. + +Example: +```bash +yo angular-fullstack:filter myFilter +[?] Where would you like to create this filter? client/app/ +``` + +Produces: + + client/app/myFilter/myFilter.filter.js + client/app/myFilter/myFilter.filter.spec.js From a4508b490f83ee3f0cde74f9f9dd07b9a7adc273 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Fri, 13 May 2016 14:23:38 -0400 Subject: [PATCH 176/885] docs(generators:service): create service.md [skip ci] --- docs/generators/service.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 docs/generators/service.md diff --git a/docs/generators/service.md b/docs/generators/service.md new file mode 100644 index 000000000..4bad4093c --- /dev/null +++ b/docs/generators/service.md @@ -0,0 +1,16 @@ +### Service +Generates an AngularJS service. + +Example: +```bash +yo angular-fullstack:service myService +[?] Where would you like to create this service? client/app/ +``` + +Produces: + + client/app/myService/myService.service.js + client/app/myService/myService.service.spec.js + + +You can also do `yo angular-fullstack:factory` and `yo angular-fullstack:provider` for other types of services. From 2fe295ef47c626d977e2bf846a1739ef1ff358ca Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Fri, 13 May 2016 14:24:17 -0400 Subject: [PATCH 177/885] docs(generators:decorator): create decorator.md [skip ci] --- docs/generators/decorator.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 docs/generators/decorator.md diff --git a/docs/generators/decorator.md b/docs/generators/decorator.md new file mode 100644 index 000000000..2f1b3dc03 --- /dev/null +++ b/docs/generators/decorator.md @@ -0,0 +1,12 @@ +### Decorator +Generates an AngularJS service decorator. + +Example: +```bash +yo angular-fullstack:decorator serviceName +[?] Where would you like to create this decorator? client/app/ +``` + +Produces + + client/app/serviceName/serviceName.decorator.js From 5f1bf139d76ca94b5b60d62e7457730cfe86ca3a Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Fri, 13 May 2016 14:24:51 -0400 Subject: [PATCH 178/885] docs(generators:openshift): create openshift.md [skip ci] --- docs/generators/openshift.md | 38 ++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 docs/generators/openshift.md diff --git a/docs/generators/openshift.md b/docs/generators/openshift.md new file mode 100644 index 000000000..0d2ed8970 --- /dev/null +++ b/docs/generators/openshift.md @@ -0,0 +1,38 @@ +###Openshift + +> Note: Openshift uses a quite old version of Node by default. We strongly recommend updating your Node version. [Here's a helpful article](https://blog.openshift.com/any-version-of-nodejs-you-want-in-the-cloud-openshift-does-it-paas-style/). + +Deploying to OpenShift can be done in just a few steps: + + yo angular-fullstack:openshift + +A live application URL will be available in the output. + +> **oAuth** +> +> If you're using any oAuth strategies, you must set environment variables for your selected oAuth. For example, if we're using Facebook oAuth we would do this : +> +> rhc set-env FACEBOOK_ID=id -a my-openshift-app +> rhc set-env FACEBOOK_SECRET=secret -a my-openshift-app +> +> You will also need to set `DOMAIN` environment variable: +> +> rhc set-env DOMAIN=.rhcloud.com +> +> # or (if you're using it): +> +> rhc set-env DOMAIN= +> +> After you've set the required environment variables, restart the server: +> +> rhc app-restart -a my-openshift-app + +To make your deployment process easier consider using [grunt-build-control](https://github.com/robwierzbowski/grunt-build-control). + +**Pushing Updates** + + grunt + +Commit and push the resulting build, located in your dist folder: + + grunt buildcontrol:openshift From 5d9b2ed00a6c7ada29cd9b0b6e91f294af3f78c7 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Fri, 13 May 2016 14:25:34 -0400 Subject: [PATCH 179/885] docs(generators:heroku): create heroku.md [skip ci] --- docs/generators/heroku.md | 54 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 docs/generators/heroku.md diff --git a/docs/generators/heroku.md b/docs/generators/heroku.md new file mode 100644 index 000000000..3d62c7c5d --- /dev/null +++ b/docs/generators/heroku.md @@ -0,0 +1,54 @@ +### Heroku + +Deploying to heroku only takes a few steps. + + yo angular-fullstack:heroku + +To work with your new heroku app using the command line, you will need to run any `heroku` commands from the `dist` folder. + + +If you're using mongoDB you will need to add a database to your app: + + heroku addons:create mongolab + +Note: if you get an `Error: No valid replicaset instance servers found` you need to modify moongose connection options in config/environment/production.js as follows: +``` +options: { + db: { + safe: true, + replset: { socketOptions: { keepAlive: 1, connectTimeoutMS: 30000 } }, + server: { socketOptions: { keepAlive: 1, connectTimeoutMS: 30000 } } + } + } +``` +One of the odd things about the Node driver is that the default timeout for replica set connections is only 1 second, so make sure you're setting it to something more like 30s like in this example. + + +Your app should now be live. To view it run `heroku open`. + +> +> If you're using any oAuth strategies, you must set environment variables for your selected oAuth. For example, if we're using **Facebook** oAuth we would do this : +> +> heroku config:set FACEBOOK_ID=id +> heroku config:set FACEBOOK_SECRET=secret +> +> You will also need to set `DOMAIN` environment variable: +> +> heroku config:set DOMAIN=.herokuapp.com +> +> # or (if you're using it): +> +> heroku config:set DOMAIN= +> + +> WARNING: Deployment is untested with Gulp + +To make your deployment process easier consider using [grunt-build-control](https://github.com/robwierzbowski/grunt-build-control). + +#### Pushing Updates + + grunt + +Commit and push the resulting build, located in your dist folder: + + grunt buildcontrol:heroku From 60b23bf77faf154ae334433bee76c89c873032d5 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Fri, 13 May 2016 14:37:24 -0400 Subject: [PATCH 180/885] docs(readme): move gen docs to docs folder remove subgenerator docs, change links to link to `/docs/generators/xxx.md` [skip ci] --- readme.md | 285 +++--------------------------------------------------- 1 file changed, 12 insertions(+), 273 deletions(-) diff --git a/readme.md b/readme.md index f237fabee..fc25315d3 100644 --- a/readme.md +++ b/readme.md @@ -83,282 +83,21 @@ A grunt/gulp task looks for new files in your `client/app` and `client/component Available generators: * App - - [angular-fullstack](#app) (aka [angular-fullstack:app](#app)) + - [angular-fullstack](/docs/generators/app.md) (aka [angular-fullstack:app](/docs/generators/app.md)) * Server Side - - [angular-fullstack:endpoint](#endpoint) + - [angular-fullstack:endpoint](/docs/generators/endpoint.md) * Client Side - - [angular-fullstack:route](#route) - - [angular-fullstack:controller](#controller) - - [angular-fullstack:filter](#filter) - - [angular-fullstack:directive](#directive) - - [angular-fullstack:service](#service) - - [angular-fullstack:provider](#service) - - [angular-fullstack:factory](#service) - - [angular-fullstack:decorator](#decorator) + - [angular-fullstack:route](/docs/generators/route.md) + - [angular-fullstack:controller](/docs/generators/controller.md) + - [angular-fullstack:filter](/docs/generators/filter.md) + - [angular-fullstack:directive](/docs/generators/directive.md) + - [angular-fullstack:service](/docs/generators/service.md) + - [angular-fullstack:provider](/docs/generators/service.md) + - [angular-fullstack:factory](/docs/generators/service.md) + - [angular-fullstack:decorator](/docs/generators/decorator.md) * Deployment - - [angular-fullstack:openshift](#openshift) - - [angular-fullstack:heroku](#heroku) - -### 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 -``` - -### 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 Options: mongoose, sequelize - --endpointDirectory # Parent directory for enpoints - -Arguments: - name Type: String Required: true -``` - -Example: -```bash -yo angular-fullstack:endpoint message -[?] What will the url of your endpoint be? /api/messages -``` - -Produces: - - server/api/message/index.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 -Generates a new route. - -Example: -```bash -yo angular-fullstack:route myroute -[?] What module name would you like to use? myApp -[?] Where would you like to create this route? client/app/ -[?] What will the url of your route be? /myroute -``` - -Produces: - - client/app/myroute/myroute.js - client/app/myroute/myroute.controller.js - client/app/myroute/myroute.controller.spec.js - client/app/myroute/myroute.html - client/app/myroute/myroute.scss - - -### Controller -Generates a controller. - -Example: -```bash -yo angular-fullstack:controller user -[?] Where would you like to create this controller? client/app/ -``` - -Produces: - - client/app/user/user.controller.js - client/app/user/user.controller.spec.js - -### Directive -Generates a directive. - -Example: -```bash -yo angular-fullstack:directive myDirective -[?] Where would you like to create this directive? client/app/ -[?] Does this directive need an external html file? Yes -``` - -Produces: - - client/app/myDirective/myDirective.directive.js - client/app/myDirective/myDirective.directive.spec.js - client/app/myDirective/myDirective.html - client/app/myDirective/myDirective.scss - -**Simple directive without an html file** - -Example: -```bash -yo angular-fullstack:directive simple -[?] Where would you like to create this directive? client/app/ -[?] Does this directive need an external html file? No -``` - -Produces: - - client/app/simple/simple.directive.js - client/app/simple/simple.directive.spec.js - -### Filter -Generates a filter. - -Example: -```bash -yo angular-fullstack:filter myFilter -[?] Where would you like to create this filter? client/app/ -``` - -Produces: - - client/app/myFilter/myFilter.filter.js - client/app/myFilter/myFilter.filter.spec.js - -### Service -Generates an AngularJS service. - -Example: -```bash -yo angular-fullstack:service myService -[?] Where would you like to create this service? client/app/ -``` - -Produces: - - client/app/myService/myService.service.js - client/app/myService/myService.service.spec.js - - -You can also do `yo angular-fullstack:factory` and `yo angular-fullstack:provider` for other types of services. - -### Decorator -Generates an AngularJS service decorator. - -Example: -```bash -yo angular-fullstack:decorator serviceName -[?] Where would you like to create this decorator? client/app/ -``` - -Produces - - client/app/serviceName/serviceName.decorator.js - -###Openshift - -> Note: Openshift uses a quite old version of Node by default. We strongly recommend updating your Node version. [Here's a helpful article](https://blog.openshift.com/any-version-of-nodejs-you-want-in-the-cloud-openshift-does-it-paas-style/). - -Deploying to OpenShift can be done in just a few steps: - - yo angular-fullstack:openshift - -A live application URL will be available in the output. - -> **oAuth** -> -> If you're using any oAuth strategies, you must set environment variables for your selected oAuth. For example, if we're using Facebook oAuth we would do this : -> -> rhc set-env FACEBOOK_ID=id -a my-openshift-app -> rhc set-env FACEBOOK_SECRET=secret -a my-openshift-app -> -> You will also need to set `DOMAIN` environment variable: -> -> rhc set-env DOMAIN=.rhcloud.com -> -> # or (if you're using it): -> -> rhc set-env DOMAIN= -> -> After you've set the required environment variables, restart the server: -> -> rhc app-restart -a my-openshift-app - -To make your deployment process easier consider using [grunt-build-control](https://github.com/robwierzbowski/grunt-build-control). - -**Pushing Updates** - - grunt - -Commit and push the resulting build, located in your dist folder: - - grunt buildcontrol:openshift - -### Heroku - -Deploying to heroku only takes a few steps. - - yo angular-fullstack:heroku - -To work with your new heroku app using the command line, you will need to run any `heroku` commands from the `dist` folder. - - -If you're using mongoDB you will need to add a database to your app: - - heroku addons:create mongolab - -Note: if you get an `Error: No valid replicaset instance servers found` you need to modify moongose connection options in config/environment/production.js as follows: -``` -options: { - db: { - safe: true, - replset: { socketOptions: { keepAlive: 1, connectTimeoutMS: 30000 } }, - server: { socketOptions: { keepAlive: 1, connectTimeoutMS: 30000 } } - } - } -``` -One of the odd things about the Node driver is that the default timeout for replica set connections is only 1 second, so make sure you're setting it to something more like 30s like in this example. - - -Your app should now be live. To view it run `heroku open`. - -> -> If you're using any oAuth strategies, you must set environment variables for your selected oAuth. For example, if we're using **Facebook** oAuth we would do this : -> -> heroku config:set FACEBOOK_ID=id -> heroku config:set FACEBOOK_SECRET=secret -> -> You will also need to set `DOMAIN` environment variable: -> -> heroku config:set DOMAIN=.herokuapp.com -> -> # or (if you're using it): -> -> heroku config:set DOMAIN= -> - -> WARNING: Deployment is untested with Gulp - -To make your deployment process easier consider using [grunt-build-control](https://github.com/robwierzbowski/grunt-build-control). - -#### Pushing Updates - - grunt - -Commit and push the resulting build, located in your dist folder: - - grunt buildcontrol:heroku + - [angular-fullstack:openshift](/docs/generators/openshift.md) + - [angular-fullstack:heroku](/docs/generators/heroku.md) ## Bower Components From ac0ae0dd18e8c57349116352ddea1b4e90bfc0cc Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Fri, 13 May 2016 14:45:12 -0400 Subject: [PATCH 181/885] docs(readme): update gulp stuff, options, move injecting section [skip ci] --- readme.md | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/readme.md b/readme.md index fc25315d3..35efd64db 100644 --- a/readme.md +++ b/readme.md @@ -29,7 +29,7 @@ Run `yo angular-fullstack`, optionally passing an app name: yo angular-fullstack [app-name] ``` -Run `grunt` for building, `grunt serve` for preview, and `grunt serve:dist` for a preview of the built app. +Run `grunt`/`gulp build` for building, `grunt serve`/`gulp serve` for development, and `grunt serve:dist`/`gulp serve:dist` for a preview of the built app. ## Prerequisites @@ -50,6 +50,7 @@ Run `grunt` for building, `grunt serve` for preview, and `grunt serve:dist` for **Client** * Scripts: `JavaScript (Babel)`, `TypeScript` +* Module Systems: `Bower`, `Webpack` (soon), `SystemJS + JSPM` (planned) * Markup: `HTML`, `Jade` * Stylesheets: `CSS`, `Stylus`, `Sass`, `Less` * Angular Routers: `ngRoute`, `ui-router` @@ -58,7 +59,7 @@ Run `grunt` for building, `grunt serve` for preview, and `grunt serve:dist` for **Server** -* Scripts: `JavaScript (Babel)` +* Scripts: `JavaScript (Babel)`, `TypeScript` (planned) * Database: * `None`, * `MongoDB`, `SQL` @@ -66,17 +67,6 @@ Run `grunt` for building, `grunt serve` for preview, and `grunt serve:dist` for * oAuth integrations: `Facebook` `Twitter` `Google` * Socket.io integration: `Yes`, `No` -## Injection - -A grunt/gulp 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/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`/`typescript` temp `js` files into `client/index.html` -* `typescript types` into `tsconfig.client.json` & `tsconfig.client.test.json` ## Generators @@ -125,6 +115,19 @@ These packages are installed optionally depending on your configuration: All of these can be updated with `bower update` as new versions are released. +## Injection + +A grunt/gulp 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/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`/`typescript` temp `js` files into `client/index.html` +* `typescript types` into `tsconfig.client.json` & `tsconfig.client.test.json` + + ## Configuration Yeoman generated projects can be further tweaked according to your needs by modifying project files appropriately. From 39356f55cced3edc927e841722deaea25924bf85 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Fri, 13 May 2016 14:47:17 -0400 Subject: [PATCH 182/885] docs(readme): add link to doc home [skip ci] --- readme.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/readme.md b/readme.md index 35efd64db..f5ab24dd9 100644 --- a/readme.md +++ b/readme.md @@ -90,6 +90,11 @@ Available generators: - [angular-fullstack:heroku](/docs/generators/heroku.md) +## Documentation + +Check out our [documentation home page](/docs/index.md). + + ## Bower Components The following packages are always installed by the [app](#app) generator: From 083eac9cee5478c0983cd50da7effe416ddb8cd0 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Fri, 13 May 2016 14:50:53 -0400 Subject: [PATCH 183/885] docs(readme): remove excess contributing doc [skip ci] --- readme.md | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/readme.md b/readme.md index f5ab24dd9..d4e65d019 100644 --- a/readme.md +++ b/readme.md @@ -217,17 +217,7 @@ An example server component in `server/api` See the [contributing docs](https://github.com/DaftMonk/generator-angular-fullstack/blob/master/contributing.md) -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 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. - -When submitting a PR, make sure that the commit messages match the [AngularJS conventions](https://docs.google.com/document/d/1QrDFcIiPjSLDn3EL15IJygNPiHORgU1_OOAqWjiDU5Y/). - -When submitting a bugfix, try to write a test that exposes the bug and fails before applying your fix. Submit the test alongside the fix. - -When submitting a new feature, add tests that cover the feature. +When submitting an issue, please follow the [Yeoman issue 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, as well as any stack traces. ## License From 522a6ce158bf9e7cea6d0d1a86f475126ec2ca6e Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Fri, 13 May 2016 14:51:13 -0400 Subject: [PATCH 184/885] docs(contributing): add back info from readme, modified [skip ci] --- contributing.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/contributing.md b/contributing.md index 55addd67b..36c7a6c7b 100644 --- a/contributing.md +++ b/contributing.md @@ -11,7 +11,18 @@ Additionally for this generator: * When submitting a new feature, add tests that cover the feature. * Open Issues marked with the [EASY](https://github.com/angular-fullstack/generator-angular-fullstack/issues?q=is%3Aopen+is%3Aissue+label%3AEasy) label are believed to be easy changes, and would be good Issues to tackle for new contributors. +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 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 a PR, make sure that the commit messages match the [AngularJS conventions](https://docs.google.com/document/d/1QrDFcIiPjSLDn3EL15IJygNPiHORgU1_OOAqWjiDU5Y/). + +When submitting a bugfix, try to write a test that exposes the bug and fails before applying your fix. Submit the test alongside the fix. + +When submitting a new feature, add tests that cover the feature. + To run the generator: + 1. Clone it and `cd` to its root 2. `npm install` 3. `npm link` (tells npm to look to your own version) From a8799c22701d6b97ecd30286c3ea2ea3a2131dd7 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Fri, 13 May 2016 14:54:15 -0400 Subject: [PATCH 185/885] docs(readme): update tagline, add es6 note [skip ci] --- readme.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/readme.md b/readme.md index d4e65d019..18536f486 100644 --- a/readme.md +++ b/readme.md @@ -6,7 +6,7 @@ [![Gitter chat](https://img.shields.io/gitter/room/DaftMonk/generator-angular-fullstack.svg)](https://gitter.im/DaftMonk/generator-angular-fullstack) [![OpenCollective](https://opencollective.com/angular-fullstack/backers/badge.svg)](#backers) [![OpenCollective](https://opencollective.com/angular-fullstack/sponsors/badge.svg)](#sponsors) -> Yeoman generator for creating MEAN/SEAN stack applications, using MongoDB/SQL, Express, AngularJS, and Node - lets you quickly set up a project following best practices. +> Yeoman generator for creating MEAN/SEAN stack applications, using ES6, MongoDB/SQL, Express, AngularJS, and Node - lets you quickly set up a project following best practices. #### Generated project: [![Dependency Status](https://img.shields.io/david/angular-fullstack/angular-fullstack-deps.svg)](https://david-dm.org/angular-fullstack/angular-fullstack-deps) @@ -34,6 +34,7 @@ Run `grunt`/`gulp build` for building, `grunt serve`/`gulp serve` for developmen ## Prerequisites * MongoDB - Download and Install [MongoDB](https://www.mongodb.com/download-center#community) - If you plan on scaffolding your project with mongoose, you'll need mongoDB to be installed and have the `mongod` process running. +* The project's JavaScript is written in ECMAScript 2015. If you're unfamiliar with the latest changes to the specification for JavaScript, check out http://es6-features.org/ ## Supported Configurations From 3115a30d21b5fe9496aadf2819162ab10f3ce7ca Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Fri, 13 May 2016 14:59:03 -0400 Subject: [PATCH 186/885] docs(readme): cut extra doc to go to doc home [skip ci] --- readme.md | 118 ------------------------------------------------------ 1 file changed, 118 deletions(-) diff --git a/readme.md b/readme.md index 18536f486..efa9c40a3 100644 --- a/readme.md +++ b/readme.md @@ -96,124 +96,6 @@ Available generators: Check out our [documentation home page](/docs/index.md). -## Bower Components - -The following packages are always installed by the [app](#app) generator: - -* angular -* angular-cookies -* angular-mocks -* angular-resource -* angular-sanitize -* es5-shim -* font-awesome -* json3 -* jquery -* lodash - -These packages are installed optionally depending on your configuration: - -* angular-route -* angular-ui-router -* angular-socket-io -* angular-bootstrap -* bootstrap - -All of these can be updated with `bower update` as new versions are released. - -## Injection - -A grunt/gulp 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/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`/`typescript` temp `js` files into `client/index.html` -* `typescript types` into `tsconfig.client.json` & `tsconfig.client.test.json` - - -## Configuration -Yeoman generated projects can be further tweaked according to your needs by modifying project files appropriately. - -A `.yo-rc` file is generated for helping you copy configuration across projects, and to allow you to keep track of your settings. You can change this as you see fit. - -## Testing - -Running `grunt test` will run the client and server unit tests with karma and mocha. - -Use `grunt test:server` to only run server tests. - -Use `grunt test:client` to only run client tests. - -**Protractor tests** - -To setup protractor e2e tests, you must first run - -`npm run update-webdriver` - -Use `grunt test:e2e` to have protractor go through tests located in the `e2e` folder. - -**Code Coverage** - -Use `grunt test:coverage` to run mocha-istanbul and generate code coverage reports. - -`coverage/server` will be populated with `e2e` and `unit` folders containing the `lcov` reports. - -The coverage taget has 3 available options: -- `test:coverage:unit` generate server unit test coverage -- `test:coverage:e2e` generate server e2e test coverage -- `test:coverage:check` combine the coverage reports and check against predefined thresholds - -* *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`. - -## Project Structure - -Overview - - ├── client - │   ├── app - All of our app specific components go in here - │   ├── assets - Custom assets: fonts, images, etc… - │   ├── components - Our reusable components, non-specific to to our app - │ - ├── e2e - Our protractor end to end tests - │ - └── server - ├── api - Our apps server api - ├── auth - For handling authentication with different auth strategies - ├── components - Our reusable or app-wide components - ├── config - Where we do the bulk of our apps configuration - │ └── local.env.js - Keep our environment variables out of source control - │   └── environment - Configuration specific to the node environment - └── views - Server rendered views - -An example client component in `client/app` - - main - ├── main.js - Routes - ├── main.controller.js - Controller for our main route - ├── main.controller.spec.js - Test - ├── main.html - View - └── main.less - Styles - -An example server component in `server/api` - - thing - ├── index.js - Routes - ├── thing.controller.js - Controller for our `thing` endpoint - ├── thing.model.js - Database model - ├── thing.socket.js - Register socket events - └── thing.spec.js - Test - ## Contribute See the [contributing docs](https://github.com/DaftMonk/generator-angular-fullstack/blob/master/contributing.md) From 7180789773600b2e56cd2994e837512ee62cea7f Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Fri, 13 May 2016 14:59:29 -0400 Subject: [PATCH 187/885] docs(index): add info from readme.md [skip ci] --- docs/index.md | 139 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 139 insertions(+) diff --git a/docs/index.md b/docs/index.md index 3a3218024..f46a131b7 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1,2 +1,141 @@ # Documentation Home +## Generators + +Available generators: + +* App + - [angular-fullstack](/docs/generators/app.md) (aka [angular-fullstack:app](/docs/generators/app.md)) +* Server Side + - [angular-fullstack:endpoint](/docs/generators/endpoint.md) +* Client Side + - [angular-fullstack:route](/docs/generators/route.md) + - [angular-fullstack:controller](/docs/generators/controller.md) + - [angular-fullstack:filter](/docs/generators/filter.md) + - [angular-fullstack:directive](/docs/generators/directive.md) + - [angular-fullstack:service](/docs/generators/service.md) + - [angular-fullstack:provider](/docs/generators/service.md) + - [angular-fullstack:factory](/docs/generators/service.md) + - [angular-fullstack:decorator](/docs/generators/decorator.md) +* Deployment + - [angular-fullstack:openshift](/docs/generators/openshift.md) + - [angular-fullstack:heroku](/docs/generators/heroku.md) + + +## Bower Components + +The following packages are always installed by the [app](#app) generator: + +* angular +* angular-cookies +* angular-mocks +* angular-resource +* angular-sanitize +* es5-shim +* font-awesome +* json3 +* jquery +* lodash + +These packages are installed optionally depending on your configuration: + +* angular-route +* angular-ui-router +* angular-socket-io +* angular-bootstrap +* bootstrap + +All of these can be updated with `bower update` as new versions are released. + +## Injection + +A grunt/gulp 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/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`/`typescript` temp `js` files into `client/index.html` +* `typescript types` into `tsconfig.client.json` & `tsconfig.client.test.json` + + +## Configuration +Yeoman generated projects can be further tweaked according to your needs by modifying project files appropriately. + +A `.yo-rc` file is generated for helping you copy configuration across projects, and to allow you to keep track of your settings. You can change this as you see fit. + +## Testing + +Running `grunt test` will run the client and server unit tests with karma and mocha. + +Use `grunt test:server` to only run server tests. + +Use `grunt test:client` to only run client tests. + +**Protractor tests** + +To setup protractor e2e tests, you must first run + +`npm run update-webdriver` + +Use `grunt test:e2e` to have protractor go through tests located in the `e2e` folder. + +**Code Coverage** + +Use `grunt test:coverage` to run mocha-istanbul and generate code coverage reports. + +`coverage/server` will be populated with `e2e` and `unit` folders containing the `lcov` reports. + +The coverage taget has 3 available options: +- `test:coverage:unit` generate server unit test coverage +- `test:coverage:e2e` generate server e2e test coverage +- `test:coverage:check` combine the coverage reports and check against predefined thresholds + +* *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`. + +## Project Structure + +Overview + + ├── client + │   ├── app - All of our app specific components go in here + │   ├── assets - Custom assets: fonts, images, etc… + │   ├── components - Our reusable components, non-specific to to our app + │ + ├── e2e - Our protractor end to end tests + │ + └── server + ├── api - Our apps server api + ├── auth - For handling authentication with different auth strategies + ├── components - Our reusable or app-wide components + ├── config - Where we do the bulk of our apps configuration + │ └── local.env.js - Keep our environment variables out of source control + │   └── environment - Configuration specific to the node environment + └── views - Server rendered views + +An example client component in `client/app` + + main + ├── main.js - Routes + ├── main.controller.js - Controller for our main route + ├── main.controller.spec.js - Test + ├── main.html - View + └── main.less - Styles + +An example server component in `server/api` + + thing + ├── index.js - Routes + ├── thing.controller.js - Controller for our `thing` endpoint + ├── thing.model.js - Database model + ├── thing.socket.js - Register socket events + └── thing.spec.js - Test From ef1aa5011eefc61f157828a259732eb4d0ef26e2 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Sat, 14 May 2016 19:18:08 -0400 Subject: [PATCH 188/885] ci(): add circle.yml [skip ci] --- circle.yml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 circle.yml diff --git a/circle.yml b/circle.yml new file mode 100644 index 000000000..4811cf4e9 --- /dev/null +++ b/circle.yml @@ -0,0 +1,26 @@ +## Customize the test machine +machine: + node: + version: 5.11.1 + +## Customize checkout +checkout: + post: + - git submodule sync + - git submodule update --init # use submodules + +## Customize dependencies +dependencies: + pre: + - sudo service mongodb stop && curl -L -O https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu1204-3.0.2.tgz && tar xvzf mongodb-linux-x86_64-ubuntu1204-3.0.2.tgz && sudo mv mongodb-linux-x86_64-ubuntu1204-3.0.2/bin/* /usr/bin/ && sudo service mongodb start + + # we automatically cache and restore many dependencies between + # builds. If you need to, you can add custom paths to cache: + cache_directories: + - "test/fixtures/node_modules" + +## Custom notifications +#notify: + #webhooks: + # A list of hashes representing hooks. Only the url field is supported. + #- url: https://someurl.com/hooks/circle From 9b5f954701fef0e43704984d17575ae484a6498d Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Sat, 14 May 2016 21:08:38 -0400 Subject: [PATCH 189/885] ci(circle): remove custom mongo --- circle.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/circle.yml b/circle.yml index 4811cf4e9..609b3cae4 100644 --- a/circle.yml +++ b/circle.yml @@ -11,9 +11,6 @@ checkout: ## Customize dependencies dependencies: - pre: - - sudo service mongodb stop && curl -L -O https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu1204-3.0.2.tgz && tar xvzf mongodb-linux-x86_64-ubuntu1204-3.0.2.tgz && sudo mv mongodb-linux-x86_64-ubuntu1204-3.0.2/bin/* /usr/bin/ && sudo service mongodb start - # we automatically cache and restore many dependencies between # builds. If you need to, you can add custom paths to cache: cache_directories: From cf515ad348add8b291b6e55583e293d6e43c5716 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Sat, 14 May 2016 21:14:52 -0400 Subject: [PATCH 190/885] ci(circle): add `npm install -g ...` [skip ci] --- circle.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/circle.yml b/circle.yml index 609b3cae4..07e880bc0 100644 --- a/circle.yml +++ b/circle.yml @@ -2,6 +2,8 @@ machine: node: version: 5.11.1 + pre: + - npm install -g gulp-cli grunt-cli bower ## Customize checkout checkout: From e1c41bea79d71a1a95cc4d5e4811bc520d1b7b25 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Sat, 14 May 2016 21:49:55 -0400 Subject: [PATCH 191/885] ci(circle): install globals w/ `post` [skip ci] --- circle.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/circle.yml b/circle.yml index 07e880bc0..025eca1c7 100644 --- a/circle.yml +++ b/circle.yml @@ -2,7 +2,7 @@ machine: node: version: 5.11.1 - pre: + post: - npm install -g gulp-cli grunt-cli bower ## Customize checkout From 9670f30379226a39e41c1dee4e62e35f6ea1b180 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Sat, 14 May 2016 22:07:06 -0400 Subject: [PATCH 192/885] fix(circle): fix update-webdriver for node 3+ [skip ci] --- gulpfile.js | 1 + 1 file changed, 1 insertion(+) diff --git a/gulpfile.js b/gulpfile.js index c70cc8df0..647f84404 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -86,6 +86,7 @@ var processJson = function(src, dest, opt) { if(/package.json/g.test(src) && opt.test) { delete json.scripts.postinstall; + json.scripts['update-webdriver'] = 'node node_modules/grunt-protractor-runner/node_modules/protractor/bin/webdriver-manager update || node node_modules/protractor/bin/webdriver-manager update'; } // set properties From d1ee16ba24066e79a6b323033cd6ceca774d2fa0 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Sun, 15 May 2016 00:49:16 -0400 Subject: [PATCH 193/885] 3.7.0 --- CHANGELOG.md | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++ package.json | 2 +- 2 files changed, 60 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 63a8ed7ab..e3c129294 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,62 @@ + +# [3.7.0](https://github.com/angular-fullstack/generator-angular-fullstack/compare/3.6.1...v3.7.0) (2016-05-15) + + +### Notable Changes +* The Angular component sub-generator from generator-ng-component was added +* The generator no longer uses the babel require hook at runtime +* The generator's template files are now passed through Babel at scaffold time. This allows for things like removing type annotations if the user so chooses. +* TypeScript uses typings instead of tsd + + +### Bug Fixes + +* **client:** remove no-empty from tslint.json ([eafc4e0](https://github.com/angular-fullstack/generator-angular-fullstack/commit/eafc4e0)) +* **client:navbar.controller:** refactor EJS, exclude constructor if empty ([a75b1d4](https://github.com/angular-fullstack/generator-angular-fullstack/commit/a75b1d4)) +* **e2e:main:** fix yeoman.png regex ([4b4db99](https://github.com/angular-fullstack/generator-angular-fullstack/commit/4b4db99)) +* **express:** import `connect-mongo/es5` if node < 4 ([63fb77f](https://github.com/angular-fullstack/generator-angular-fullstack/commit/63fb77f)), closes [#1844](https://github.com/angular-fullstack/generator-angular-fullstack/issues/1844) +* **gen:app:** only include `typings.json` with TS ([6f82220](https://github.com/angular-fullstack/generator-angular-fullstack/commit/6f82220)) +* **gen:endpoint:** + * return promise ([6b30ef7](https://github.com/angular-fullstack/generator-angular-fullstack/commit/6b30ef7)) + * typo ([0787039](https://github.com/angular-fullstack/generator-angular-fullstack/commit/0787039)) +* **gen:grunt:** update paths ([104efc6](https://github.com/angular-fullstack/generator-angular-fullstack/commit/104efc6)) +* **gen:gulp:babel:** return the two merged streams ([3748953](https://github.com/angular-fullstack/generator-angular-fullstack/commit/3748953)) +* **gen:gulp:clean:** also clean test dir ([aedb37e](https://github.com/angular-fullstack/generator-angular-fullstack/commit/aedb37e)) +* **gen:gulp:updateFixtures:** fix saving as private/public ([a2cecab](https://github.com/angular-fullstack/generator-angular-fullstack/commit/a2cecab)) +* **gen:test:endpoint:** `jshint` function also checks that the file exists ([17d9985](https://github.com/angular-fullstack/generator-angular-fullstack/commit/17d9985)) +* **gen:test:main:** fix sql e2e ([a9d238c](https://github.com/angular-fullstack/generator-angular-fullstack/commit/a9d238c)) +* **grunt:** exclude jshint config if using TypeScript ([54d4ebd](https://github.com/angular-fullstack/generator-angular-fullstack/commit/54d4ebd)) +* **gulp:** fix racing condition for copy:constant ([f07b451](https://github.com/angular-fullstack/generator-angular-fullstack/commit/f07b451)), closes [#1830](https://github.com/angular-fullstack/generator-angular-fullstack/issues/1830) +* **package:** + * always make html2js a dependency ([bdf1e4a](https://github.com/angular-fullstack/generator-angular-fullstack/commit/bdf1e4a)), closes [#1722](https://github.com/angular-fullstack/generator-angular-fullstack/issues/1722) + * grunt-injector 1.0.0 is broken ([3391299](https://github.com/angular-fullstack/generator-angular-fullstack/commit/3391299)) + * include gulp devDependency ([c857b27](https://github.com/angular-fullstack/generator-angular-fullstack/commit/c857b27)) +* **server:** + * MONGOLAB_URI -> MONGODB_URI ([ae313df](https://github.com/angular-fullstack/generator-angular-fullstack/commit/ae313df)), closes [#1838](https://github.com/angular-fullstack/generator-angular-fullstack/issues/1838) +* **server:oauth:** + * fix mongoose validation when re-login using twitter oauth ([5f8805d](https://github.com/angular-fullstack/generator-angular-fullstack/commit/5f8805d)) + + +### Features + +* **client:auth:** add first type definition (`callback: Function`) ([7ed2585](https://github.com/angular-fullstack/generator-angular-fullstack/commit/7ed2585)) +* **gen:** + * add component generator ([bf649ab](https://github.com/angular-fullstack/generator-angular-fullstack/commit/bf649ab)), closes [#1711](https://github.com/angular-fullstack/generator-angular-fullstack/issues/1711) + * also build test dir (just like generators dir) ([e09fb76](https://github.com/angular-fullstack/generator-angular-fullstack/commit/e09fb76)) + * default to gulp, mocha ([4cc2da6](https://github.com/angular-fullstack/generator-angular-fullstack/commit/4cc2da6)) +* **gen:app:** run all client files through Babel & JS Beautifier ([1d4ce11](https://github.com/angular-fullstack/generator-angular-fullstack/commit/1d4ce11)) +* **gen:gulp:** + * add installFixtures task ([04a7878](https://github.com/angular-fullstack/generator-angular-fullstack/commit/04a7878)) + * add mocha ([ead201a](https://github.com/angular-fullstack/generator-angular-fullstack/commit/ead201a)) + * port updateFixtures to Gulp (hot damn is it faster :fire:) ([94d69da](https://github.com/angular-fullstack/generator-angular-fullstack/commit/94d69da)) +* **gen:test:** + * add endpoint path name test ([0b36375](https://github.com/angular-fullstack/generator-angular-fullstack/commit/0b36375)) + * add endpoint-specific tests ([887476f](https://github.com/angular-fullstack/generator-angular-fullstack/commit/887476f)) +* **grunt:less:** add sourcemap options ([#1868](https://github.com/angular-fullstack/generator-angular-fullstack/issues/1868)) ([55c9a18](https://github.com/angular-fullstack/generator-angular-fullstack/commit/55c9a18)), closes [#1765](https://github.com/angular-fullstack/generator-angular-fullstack/issues/1765) +* **gulp:ts:** inject client .ts test files automatically into config file. ([17cb4e4](https://github.com/angular-fullstack/generator-angular-fullstack/commit/17cb4e4)), closes [#1828](https://github.com/angular-fullstack/generator-angular-fullstack/issues/1828) + + + # [3.6.1](https://github.com/angular-fullstack/generator-angular-fullstack/compare/3.6.0...v3.6.1) (2016-04-23) diff --git a/package.json b/package.json index c1b983dfe..13cf0e8d5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "generator-angular-fullstack", - "version": "3.7.0-beta.2", + "version": "3.7.0", "description": "Yeoman generator for creating MEAN stack applications, using MongoDB, Express, AngularJS, and Node", "keywords": [ "yeoman-generator", From f19976ae5098c7a0f2b82a04c2012f16e797adf2 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Sun, 15 May 2016 01:31:13 -0400 Subject: [PATCH 194/885] docs(readme): replace build badge [skip ci] --- readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.md b/readme.md index efa9c40a3..119310134 100644 --- a/readme.md +++ b/readme.md @@ -1,5 +1,5 @@ # AngularJS Full-Stack generator -![Build Status](https://img.shields.io/codeship/26128390-800a-0133-c5f7-6a23b0487a18/master.svg) +![Build Status](https://img.shields.io/circleci/project/angular-fullstack/generator-angular-fullstack.svg) [![npm version](https://img.shields.io/npm/v/generator-angular-fullstack.svg)](https://www.npmjs.com/package/generator-angular-fullstack) [![Dependency Status](https://img.shields.io/david/angular-fullstack/generator-angular-fullstack.svg)](https://david-dm.org/angular-fullstack/generator-angular-fullstack) [![Dev-Dependency Status](https://img.shields.io/david/dev/angular-fullstack/generator-angular-fullstack.svg)](https://david-dm.org/angular-fullstack/generator-angular-fullstack#info=devDependencies) From 060d49fc8e35e2bdb276d5ad84a0a0646fa06f63 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Sun, 15 May 2016 02:15:20 -0400 Subject: [PATCH 195/885] ci(circle): add gitter hook [skip ci] --- circle.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/circle.yml b/circle.yml index 025eca1c7..31795bcd5 100644 --- a/circle.yml +++ b/circle.yml @@ -20,6 +20,8 @@ dependencies: ## Custom notifications #notify: - #webhooks: - # A list of hashes representing hooks. Only the url field is supported. - #- url: https://someurl.com/hooks/circle +notify: + webhooks: + # A list of hook hashes, containing the url field + # gitter hook + - url: https://webhooks.gitter.im/e/ac3980c61cb722b9e789 From 7d87697ccda698611f87e633990c787d1a8d9477 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Sun, 15 May 2016 13:39:27 -0400 Subject: [PATCH 196/885] fix(gen): move bluebird to dependencies closes #1888 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 13cf0e8d5..6eb809625 100644 --- a/package.json +++ b/package.json @@ -38,6 +38,7 @@ "babel-plugin-syntax-class-properties": "^6.5.0", "babel-plugin-syntax-flow": "^6.5.0", "babel-plugin-transform-flow-strip-types": "^6.7.0", + "bluebird": "^3.3.5", "chalk": "^1.1.0", "generator-ng-component": "~0.3.0", "glob": "^7.0.3", @@ -55,7 +56,6 @@ "babel-plugin-transform-class-properties": "^6.6.0", "babel-preset-es2015": "^6.6.0", "babel-register": "^6.6.5", - "bluebird": "^3.3.5", "chai": "^3.2.0", "del": "^2.2.0", "grunt": "^1.0.1", From be5ace991f2b09db84e86469bde980c4637e3bfd Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Sun, 15 May 2016 13:41:28 -0400 Subject: [PATCH 197/885] 3.7.1 --- CHANGELOG.md | 10 ++++++++++ angular-fullstack-deps | 2 +- package.json | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e3c129294..8d7e81631 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,13 @@ + +## [3.7.1](https://github.com/angular-fullstack/generator-angular-fullstack/compare/3.7.0...v3.7.1) (2016-05-15) + + +### Bug Fixes + +* **gen:** move bluebird to dependencies ([7d87697](https://github.com/angular-fullstack/generator-angular-fullstack/commit/7d87697)), closes [#1888](https://github.com/angular-fullstack/generator-angular-fullstack/issues/1888) + + + # [3.7.0](https://github.com/angular-fullstack/generator-angular-fullstack/compare/3.6.1...v3.7.0) (2016-05-15) diff --git a/angular-fullstack-deps b/angular-fullstack-deps index 414ce8173..58b567446 160000 --- a/angular-fullstack-deps +++ b/angular-fullstack-deps @@ -1 +1 @@ -Subproject commit 414ce81739c932aa4b9b9565c508956d207ade11 +Subproject commit 58b567446c0700584b4dfb0f8334f41c5650952e diff --git a/package.json b/package.json index 6eb809625..aa238f8b0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "generator-angular-fullstack", - "version": "3.7.0", + "version": "3.7.1", "description": "Yeoman generator for creating MEAN stack applications, using MongoDB, Express, AngularJS, and Node", "keywords": [ "yeoman-generator", From f6f1fb61a3305cbdf878f4abf4afc29fe70c63ff Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Sun, 15 May 2016 16:39:21 -0400 Subject: [PATCH 198/885] fix(gen:app): fix insight askPermission fixes #1889 --- src/generators/app/index.js | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/generators/app/index.js b/src/generators/app/index.js index a762512eb..6d4dd5435 100644 --- a/src/generators/app/index.js +++ b/src/generators/app/index.js @@ -2,6 +2,7 @@ import fs from 'fs'; import path from 'path'; +import Promise from 'bluebird'; import { runCmd } from '../util'; import chalk from 'chalk'; import {Base} from 'yeoman-generator'; @@ -40,6 +41,18 @@ export class Generator extends Base { // init shared generator properies and methods const genBasePromise = genBase(this); + let promises = [genBasePromise]; + + if(process.env.CI) { + insight.optOut = true; + } else if(insight.optOut === undefined) { + promises.push(new Promise((resolve, reject) => { + insight.askPermission(null, (err, optIn) => { + if(err) return reject(err); + else return resolve(optIn); + }); + })); + } insight.track('generator', this.rootGeneratorVersion()); this.nodeVersion = semver.clean(process.version); @@ -47,18 +60,13 @@ export class Generator extends Base { insight.track('node', this.nodeVersion); insight.track('platform', process.platform); - if(process.env.CI) { - insight.optOut = true; - } else if(insight.optOut === undefined) { - insight.askPermission(null, cb); - } - const npmVersionPromise = runCmd('npm --version').then(stdout => { this.npmVersion = stdout.toString().trim(); return insight.track('npm', this.npmVersion); }); + promises.push(npmVersionPromise); - return Promise.all([genBasePromise, npmVersionPromise]); + return Promise.all(promises); }, info: function () { this.log(this.yoWelcome); From 62814798ad6c1c8434fc78b2b77c01b52342a72a Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Sun, 15 May 2016 16:41:51 -0400 Subject: [PATCH 199/885] 3.7.2 --- CHANGELOG.md | 10 ++++++++++ angular-fullstack-deps | 2 +- package.json | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8d7e81631..cc1169726 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,13 @@ + +## [3.7.2](https://github.com/angular-fullstack/generator-angular-fullstack/compare/3.7.1...v3.7.2) (2016-05-15) + + +### Bug Fixes + +* **gen:app:** fix insight askPermission ([f6f1fb6](https://github.com/angular-fullstack/generator-angular-fullstack/commit/f6f1fb6)), closes [#1889](https://github.com/angular-fullstack/generator-angular-fullstack/issues/1889) + + + ## [3.7.1](https://github.com/angular-fullstack/generator-angular-fullstack/compare/3.7.0...v3.7.1) (2016-05-15) diff --git a/angular-fullstack-deps b/angular-fullstack-deps index 58b567446..786e55ad5 160000 --- a/angular-fullstack-deps +++ b/angular-fullstack-deps @@ -1 +1 @@ -Subproject commit 58b567446c0700584b4dfb0f8334f41c5650952e +Subproject commit 786e55ad5feea7cb5472ea3bac4b3f082317403c diff --git a/package.json b/package.json index aa238f8b0..0249b7087 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "generator-angular-fullstack", - "version": "3.7.1", + "version": "3.7.2", "description": "Yeoman generator for creating MEAN stack applications, using MongoDB, Express, AngularJS, and Node", "keywords": [ "yeoman-generator", From eb95b337fbd9b7ca6c2c1e587c2fd70bd50efdc8 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Mon, 16 May 2016 10:13:00 -0400 Subject: [PATCH 200/885] docs(readme): circleci badge tracks master [skip ci] --- readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.md b/readme.md index 119310134..86e794d1e 100644 --- a/readme.md +++ b/readme.md @@ -1,5 +1,5 @@ # AngularJS Full-Stack generator -![Build Status](https://img.shields.io/circleci/project/angular-fullstack/generator-angular-fullstack.svg) +![Build Status](https://img.shields.io/circleci/project/angular-fullstack/generator-angular-fullstack/master.svg) [![npm version](https://img.shields.io/npm/v/generator-angular-fullstack.svg)](https://www.npmjs.com/package/generator-angular-fullstack) [![Dependency Status](https://img.shields.io/david/angular-fullstack/generator-angular-fullstack.svg)](https://david-dm.org/angular-fullstack/generator-angular-fullstack) [![Dev-Dependency Status](https://img.shields.io/david/dev/angular-fullstack/generator-angular-fullstack.svg)](https://david-dm.org/angular-fullstack/generator-angular-fullstack#info=devDependencies) From 004e1f50c65804266402fcd0803b3fe917ecbc21 Mon Sep 17 00:00:00 2001 From: Greenkeeper Date: Mon, 16 May 2016 22:26:31 +0200 Subject: [PATCH 201/885] chore(package): update run-sequence to version 1.2.0 (#1898) https://greenkeeper.io/ [skip ci] --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 0249b7087..7b7edac1b 100644 --- a/package.json +++ b/package.json @@ -80,7 +80,7 @@ "mocha": "^2.2.5", "q": "^1.0.1", "recursive-readdir": "^2.0.0", - "run-sequence": "^1.1.5", + "run-sequence": "^1.2.0", "shelljs": "^0.7.0", "should": "^8.3.1", "yeoman-assert": "^2.0.0", From 5bf800041fb1496b9f644227604e5624425786cd Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Mon, 16 May 2016 19:05:04 -0400 Subject: [PATCH 202/885] fix(npm): fix .npmignore excluding `templates/app/server/.jshintrc` fixes #1893 --- .npmignore | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/.npmignore b/.npmignore index 29dc7d501..e54390670 100644 --- a/.npmignore +++ b/.npmignore @@ -1,11 +1,11 @@ -angular-fullstack-deps -test -.idea -src -scripts -ISSUE_TEMPLATE.md -PULL_REQUEST_TEMPLATE.md -.travis.yml -gulpfile.babel.js -Gruntfile.js -.jshintrc +./angular-fullstack-deps +./test +./.idea +./src +./scripts +./ISSUE_TEMPLATE.md +./PULL_REQUEST_TEMPLATE.md +./.travis.yml +./gulpfile.babel.js +./Gruntfile.js +./.jshintrc \ No newline at end of file From 23efe9f41ca5a861eb21a665fdbff2fe04376c35 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Mon, 16 May 2016 21:36:41 -0400 Subject: [PATCH 203/885] 3.7.3 --- angular-fullstack-deps | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/angular-fullstack-deps b/angular-fullstack-deps index 786e55ad5..a21c6d720 160000 --- a/angular-fullstack-deps +++ b/angular-fullstack-deps @@ -1 +1 @@ -Subproject commit 786e55ad5feea7cb5472ea3bac4b3f082317403c +Subproject commit a21c6d720a6c7c08e550300503fdbd2f552efda9 diff --git a/package.json b/package.json index 7b7edac1b..eaa618b5f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "generator-angular-fullstack", - "version": "3.7.2", + "version": "3.7.3", "description": "Yeoman generator for creating MEAN stack applications, using MongoDB, Express, AngularJS, and Node", "keywords": [ "yeoman-generator", From 7cd8ba0ad284696a2c515077b2f84a979a0a5621 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Sat, 21 May 2016 09:55:31 -0400 Subject: [PATCH 204/885] chore(package): jwt 7 (#1912) --- templates/app/_package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/app/_package.json b/templates/app/_package.json index ab6d09dde..c80e0bf40 100644 --- a/templates/app/_package.json +++ b/templates/app/_package.json @@ -24,7 +24,7 @@ "sequelize": "^3.5.1", "sqlite3": "~3.1.1", "express-sequelize-session": "0.4.0",<% } %><% if (filters.auth) { %> - "jsonwebtoken": "^6.2.0", + "jsonwebtoken": "^7.0.0", "express-jwt": "^3.0.0", "passport": "~0.3.0", "passport-local": "^1.0.0",<% } %><% if (filters.facebookAuth) { %> From c68b4c5112f3cddf04b5f5d52258f0b54d50b88c Mon Sep 17 00:00:00 2001 From: Greenkeeper Date: Mon, 23 May 2016 16:37:07 +0200 Subject: [PATCH 205/885] =?UTF-8?q?mocha@2.5.0=20breaks=20build=20?= =?UTF-8?q?=F0=9F=9A=A8=20(#1917)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore(package): update mocha to version 2.5.0 https://greenkeeper.io/ * fix(package): bump mocha to 2.5.1 [skip ci] --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index eaa618b5f..20c099f85 100644 --- a/package.json +++ b/package.json @@ -77,7 +77,7 @@ "lazypipe": "^1.0.1", "merge-stream": "^1.0.0", "minimatch": "^3.0.0", - "mocha": "^2.2.5", + "mocha": "^2.5.1", "q": "^1.0.1", "recursive-readdir": "^2.0.0", "run-sequence": "^1.2.0", From 21fe615fcd55b831335302323bf3d9839e56a699 Mon Sep 17 00:00:00 2001 From: Greenkeeper Date: Mon, 23 May 2016 21:44:26 +0200 Subject: [PATCH 206/885] chore(package): update lodash to version 4.13.1 (#1921) https://greenkeeper.io/ [skip ci] --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 20c099f85..77c6b03a0 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,7 @@ "gulp-beautify": "^2.0.0", "gulp-filter": "^4.0.0", "insight": "~0.8.1", - "lodash": "^4.6.1", + "lodash": "^4.13.1", "semver": "^5.1.0", "underscore.string": "^3.1.1", "yeoman-generator": "~0.23.3", From 61b58b5ba4a9f168fd5eb55cc506714040fb2b21 Mon Sep 17 00:00:00 2001 From: Greenkeeper Date: Tue, 24 May 2016 04:13:37 +0200 Subject: [PATCH 207/885] chore(package): update run-sequence to version 1.2.1 (#1923) https://greenkeeper.io/ [skip ci] --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 77c6b03a0..f565cfd4d 100644 --- a/package.json +++ b/package.json @@ -80,7 +80,7 @@ "mocha": "^2.5.1", "q": "^1.0.1", "recursive-readdir": "^2.0.0", - "run-sequence": "^1.2.0", + "run-sequence": "^1.2.1", "shelljs": "^0.7.0", "should": "^8.3.1", "yeoman-assert": "^2.0.0", From a0b7b97776e580e27276a233b170c37d66714721 Mon Sep 17 00:00:00 2001 From: Greenkeeper Date: Tue, 24 May 2016 15:37:26 +0200 Subject: [PATCH 208/885] chore(package): update mocha to version 2.5.2 (#1926) https://greenkeeper.io/ [skip ci] --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f565cfd4d..fd245c384 100644 --- a/package.json +++ b/package.json @@ -77,7 +77,7 @@ "lazypipe": "^1.0.1", "merge-stream": "^1.0.0", "minimatch": "^3.0.0", - "mocha": "^2.5.1", + "mocha": "^2.5.2", "q": "^1.0.1", "recursive-readdir": "^2.0.0", "run-sequence": "^1.2.1", From 9da05c85084dd81958f2ede89dd7e06416b69d36 Mon Sep 17 00:00:00 2001 From: Matt Heise Date: Tue, 24 May 2016 10:27:27 -0500 Subject: [PATCH 209/885] (fix:express): reorder static middleware (#1925) Fixes an upstream issue in express-session or express-sequelize-session where static middleware requests: - Hit the session store, - Overwrite one another, and - Generate many new sessions. Fixes #1668. --- templates/app/server/config/express.js | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/templates/app/server/config/express.js b/templates/app/server/config/express.js index e2c0d2560..2e4b8b1cb 100644 --- a/templates/app/server/config/express.js +++ b/templates/app/server/config/express.js @@ -29,6 +29,18 @@ var Store = expressSequelizeSession(session.Store);<% } %> export default function(app) { var env = app.get('env'); + if (env === 'development' || env === 'test') { + app.use(express.static(path.join(config.root, '.tmp'))); + } + + if (env === 'production') { + app.use(favicon(path.join(config.root, 'client', 'favicon.ico'))); + } + + app.set('appPath', path.join(config.root, 'client')); + app.use(express.static(app.get('appPath'))); + app.use(morgan('dev')); + app.set('views', config.root + '/server/views');<% if (filters.html) { %> app.engine('html', require('ejs').renderFile); app.set('view engine', 'html');<% } %><% if (filters.jade) { %> @@ -73,14 +85,6 @@ export default function(app) { })); } - app.set('appPath', path.join(config.root, 'client')); - - if ('production' === env) { - app.use(favicon(path.join(config.root, 'client', 'favicon.ico'))); - app.use(express.static(app.get('appPath'))); - app.use(morgan('dev')); - } - if ('development' === env) { app.use(require('connect-livereload')({ ignore: [ @@ -92,9 +96,6 @@ export default function(app) { } if ('development' === env || 'test' === env) { - app.use(express.static(path.join(config.root, '.tmp'))); - app.use(express.static(app.get('appPath'))); - app.use(morgan('dev')); app.use(errorHandler()); // Error handler - has to be last } } From c5f2641afcd7a458a2f52adf7902eeb4746e75d7 Mon Sep 17 00:00:00 2001 From: Greenkeeper Date: Tue, 24 May 2016 19:29:27 +0200 Subject: [PATCH 210/885] chore(package): update babel-plugin-transform-class-properties to version 6.9.0 (#1903) https://greenkeeper.io/ [skip ci] --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index fd245c384..04bd53dd2 100644 --- a/package.json +++ b/package.json @@ -53,7 +53,7 @@ "yeoman-welcome": "^1.0.1" }, "devDependencies": { - "babel-plugin-transform-class-properties": "^6.6.0", + "babel-plugin-transform-class-properties": "^6.9.0", "babel-preset-es2015": "^6.6.0", "babel-register": "^6.6.5", "chai": "^3.2.0", From 414b80ab03c703d71f2b785d69e23eacb3d6b006 Mon Sep 17 00:00:00 2001 From: Erik Renberg Date: Mon, 16 May 2016 17:13:32 +0200 Subject: [PATCH 211/885] fix(ie): IE11 log in works for ports 80 and 443 Fixes logging in with IE11 when using well-known port numbers 80 and 443 where otherwise isSameOrigin() fails because of an IE bug. closes #1880, #1896 --- templates/app/client/components/util/util.service.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/templates/app/client/components/util/util.service.js b/templates/app/client/components/util/util.service.js index 49d487396..cbee2ec95 100644 --- a/templates/app/client/components/util/util.service.js +++ b/templates/app/client/components/util/util.service.js @@ -49,7 +49,10 @@ function UtilService($window) { origins.push($window.location); origins = origins.filter(function(o) { return url.hostname === o.hostname && - url.port === o.port && + // 2nd part of the special treatment for IE fix (see above): + // This part is when using well-known ports 80 or 443 with IE, when $window.location.port==='' instead of the real port number. Probably the same cause as this IE bug: + // https://connect.microsoft.com/IE/feedback/details/817343/ie11-scripting-value-of-htmlanchorelement-host-differs-between-script-created-link-and-link-from-document + (url.port === o.port || (o.port === '' && (url.port === '80' || url.port === '443'))) && url.protocol === o.protocol; }); return (origins.length >= 1); From 3113a3e03f2fd4476e0b2a98b6b2592abab6b3fe Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Tue, 24 May 2016 22:35:02 -0400 Subject: [PATCH 212/885] fix(build): fix up PR 1896 --- .../app/client/components/util/util.service.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/templates/app/client/components/util/util.service.js b/templates/app/client/components/util/util.service.js index cbee2ec95..4ce50a841 100644 --- a/templates/app/client/components/util/util.service.js +++ b/templates/app/client/components/util/util.service.js @@ -48,14 +48,16 @@ function UtilService($window) { origins = origins.map(Util.urlParse); origins.push($window.location); origins = origins.filter(function(o) { - return url.hostname === o.hostname && - // 2nd part of the special treatment for IE fix (see above): - // This part is when using well-known ports 80 or 443 with IE, when $window.location.port==='' instead of the real port number. Probably the same cause as this IE bug: - // https://connect.microsoft.com/IE/feedback/details/817343/ie11-scripting-value-of-htmlanchorelement-host-differs-between-script-created-link-and-link-from-document - (url.port === o.port || (o.port === '' && (url.port === '80' || url.port === '443'))) && - url.protocol === o.protocol; + let hostnameCheck = url.hostname === o.hostname; + let protocolCheck = url.protocol === o.protocol; + // 2nd part of the special treatment for IE fix (see above): + // This part is when using well-known ports 80 or 443 with IE, + // when $window.location.port==='' instead of the real port number. + // Probably the same cause as this IE bug: https://goo.gl/J9hRta + let portCheck = url.port === o.port || (o.port === '' && (url.port === '80' || url.port === '443')); + return hostnameCheck && protocolCheck && portCheck; }); - return (origins.length >= 1); + return origins.length >= 1; } }; From 027edc04a11978e51a58265971707f3245409f98 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Wed, 25 May 2016 19:34:56 -0400 Subject: [PATCH 213/885] 3.7.4 --- CHANGELOG.md | 11 +++++++++++ angular-fullstack-deps | 2 +- package.json | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cc1169726..233062a27 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,14 @@ + +## [3.7.4](https://github.com/angular-fullstack/generator-angular-fullstack/compare/3.7.3...v3.7.4) (2016-05-25) + + +### Bug Fixes + +* **build:** fix up PR 1896 ([3113a3e](https://github.com/angular-fullstack/generator-angular-fullstack/commit/3113a3e)) +* **ie:** IE11 log in works for ports 80 and 443 ([414b80a](https://github.com/angular-fullstack/generator-angular-fullstack/commit/414b80a)), closes [#1880](https://github.com/angular-fullstack/generator-angular-fullstack/issues/1880) [#1896](https://github.com/angular-fullstack/generator-angular-fullstack/issues/1896) + + + ## [3.7.2](https://github.com/angular-fullstack/generator-angular-fullstack/compare/3.7.1...v3.7.2) (2016-05-15) diff --git a/angular-fullstack-deps b/angular-fullstack-deps index a21c6d720..2e355b956 160000 --- a/angular-fullstack-deps +++ b/angular-fullstack-deps @@ -1 +1 @@ -Subproject commit a21c6d720a6c7c08e550300503fdbd2f552efda9 +Subproject commit 2e355b95678767107857e6625f056458c268ecc0 diff --git a/package.json b/package.json index 04bd53dd2..608d30bf6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "generator-angular-fullstack", - "version": "3.7.3", + "version": "3.7.4", "description": "Yeoman generator for creating MEAN stack applications, using MongoDB, Express, AngularJS, and Node", "keywords": [ "yeoman-generator", From 30bb316c70c2237231e2c2d3b7f84a90801244a1 Mon Sep 17 00:00:00 2001 From: Greenkeeper Date: Mon, 30 May 2016 19:33:22 +0200 Subject: [PATCH 214/885] chore(package): update should to version 9.0.0 (#1939) https://greenkeeper.io/ [skip ci] --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 608d30bf6..c26d5d249 100644 --- a/package.json +++ b/package.json @@ -82,7 +82,7 @@ "recursive-readdir": "^2.0.0", "run-sequence": "^1.2.1", "shelljs": "^0.7.0", - "should": "^8.3.1", + "should": "^9.0.0", "yeoman-assert": "^2.0.0", "yeoman-test": "~1.4.0" }, From 0286817a30aeaaeba99f5ef33d1f4d0ed78d2904 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guilherme=20Gon=C3=A7alves?= Date: Tue, 31 May 2016 22:06:43 -0300 Subject: [PATCH 215/885] fix(build): fix templateCache generation on gulpfile (#1936) (#1942) Change execution order for gulp tasks 'transpile:client' and 'html' to fix the templateCache generation. closes #1936 --- templates/app/gulpfile.babel(gulp).js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/templates/app/gulpfile.babel(gulp).js b/templates/app/gulpfile.babel(gulp).js index be37130d9..16582400f 100644 --- a/templates/app/gulpfile.babel(gulp).js +++ b/templates/app/gulpfile.babel(gulp).js @@ -557,13 +557,16 @@ gulp.task('build', cb => { 'inject', 'wiredep:client',<% if(filters.ts) { %> 'typings',<% } %> + [ + 'transpile:client', + 'transpile:server' + ], [ 'build:images', 'copy:extras', 'copy:fonts', 'copy:assets', 'copy:server', - 'transpile:server', 'build:client' ], cb); @@ -571,7 +574,7 @@ gulp.task('build', cb => { gulp.task('clean:dist', () => del([`${paths.dist}/!(.git*|.openshift|Procfile)**`], {dot: true})); -gulp.task('build:client', ['transpile:client', 'styles', 'html', 'constant', 'build:images'], () => { +gulp.task('build:client', ['styles', 'html', 'constant', 'build:images'], () => { var manifest = gulp.src(`${paths.dist}/${clientPath}/assets/rev-manifest.json`); var appFilter = plugins.filter('**/app.js', {restore: true}); From fa4a668d626f8bd341fd156c8ff41000e5fac193 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Wed, 1 Jun 2016 11:23:00 -0400 Subject: [PATCH 216/885] docs(generators:component): add component.md [skip ci] --- docs/generators/component.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 docs/generators/component.md diff --git a/docs/generators/component.md b/docs/generators/component.md new file mode 100644 index 000000000..5c26a45b3 --- /dev/null +++ b/docs/generators/component.md @@ -0,0 +1,13 @@ +### Component +Generates an Angular 1.5 component. + +Example: +```bash +yo angular-fullstack:component name +[?] Where would you like to create this component? client/app/ +``` + +Produces: + + client/app/name/name.component.js + client/app/name/name.component.spec.js From 83394ec7cabf987586148f84e5f100e90566a4f9 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Wed, 1 Jun 2016 11:23:53 -0400 Subject: [PATCH 217/885] docs(generators): add component link [skip ci] --- docs/index.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/index.md b/docs/index.md index f46a131b7..8e053b91f 100644 --- a/docs/index.md +++ b/docs/index.md @@ -10,6 +10,7 @@ Available generators: - [angular-fullstack:endpoint](/docs/generators/endpoint.md) * Client Side - [angular-fullstack:route](/docs/generators/route.md) + - [angular-fullstack:component](/docs/generators/component.md) - [angular-fullstack:controller](/docs/generators/controller.md) - [angular-fullstack:filter](/docs/generators/filter.md) - [angular-fullstack:directive](/docs/generators/directive.md) From 12546261534a560ea943e03de6c33c09527a2a83 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Wed, 1 Jun 2016 11:24:41 -0400 Subject: [PATCH 218/885] docs(readme): add component link [skip ci] --- readme.md | 1 + 1 file changed, 1 insertion(+) diff --git a/readme.md b/readme.md index 86e794d1e..a166442e5 100644 --- a/readme.md +++ b/readme.md @@ -79,6 +79,7 @@ Available generators: - [angular-fullstack:endpoint](/docs/generators/endpoint.md) * Client Side - [angular-fullstack:route](/docs/generators/route.md) + - [angular-fullstack:component](/docs/generators/component.md) - [angular-fullstack:controller](/docs/generators/controller.md) - [angular-fullstack:filter](/docs/generators/filter.md) - [angular-fullstack:directive](/docs/generators/directive.md) From 7ae3829d1b9859a2223955c6e273959d336eb768 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Wed, 1 Jun 2016 23:18:29 -0400 Subject: [PATCH 219/885] feat(genBase): show raw stdout for yo check (#1944) show raw stdout if yo >= 1.7.1 check fails --- src/generators/generator-base.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/generators/generator-base.js b/src/generators/generator-base.js index 166411d41..0d398a88b 100644 --- a/src/generators/generator-base.js +++ b/src/generators/generator-base.js @@ -18,7 +18,8 @@ export function genBase(self) { if(!process.env.CI) { yoCheckPromise = genUtils.runCmd('yo --version').then(stdout => { if(!semver.satisfies(semver.clean(stdout), '>= 1.7.1')) { - throw new Error('ERROR: You need to update yo to at least 1.7.1 (npm i -g yo)'); + throw new Error(`ERROR: You need to update yo to at least 1.7.1 (npm i -g yo) +'yo --version' output: ${stdout}`); } }); } else { From d6447d142bb9d3a9ba71e953cd556d2c38ed582b Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Wed, 1 Jun 2016 23:47:42 -0400 Subject: [PATCH 220/885] 3.7.5 --- CHANGELOG.md | 15 +++++++++++++++ angular-fullstack-deps | 2 +- package.json | 2 +- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 233062a27..c3ec1c599 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,18 @@ + +## [3.7.5](https://github.com/angular-fullstack/generator-angular-fullstack/compare/3.7.4...v3.7.5) (2016-06-02) + + +### Bug Fixes + +* **build:** fix templateCache generation on gulpfile ([#1936](https://github.com/angular-fullstack/generator-angular-fullstack/issues/1936)) ([#1942](https://github.com/angular-fullstack/generator-angular-fullstack/issues/1942)) ([0286817](https://github.com/angular-fullstack/generator-angular-fullstack/commit/0286817)), closes [#1936](https://github.com/angular-fullstack/generator-angular-fullstack/issues/1936) [#1942](https://github.com/angular-fullstack/generator-angular-fullstack/issues/1942) [#1936](https://github.com/angular-fullstack/generator-angular-fullstack/issues/1936) + + +### Features + +* **genBase:** show raw stdout for yo check ([#1944](https://github.com/angular-fullstack/generator-angular-fullstack/issues/1944)) ([7ae3829](https://github.com/angular-fullstack/generator-angular-fullstack/commit/7ae3829)) + + + ## [3.7.4](https://github.com/angular-fullstack/generator-angular-fullstack/compare/3.7.3...v3.7.4) (2016-05-25) diff --git a/angular-fullstack-deps b/angular-fullstack-deps index 2e355b956..eada40699 160000 --- a/angular-fullstack-deps +++ b/angular-fullstack-deps @@ -1 +1 @@ -Subproject commit 2e355b95678767107857e6625f056458c268ecc0 +Subproject commit eada40699249e9e82510b43685f8df5f4eb6cc31 diff --git a/package.json b/package.json index c26d5d249..671b33dc9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "generator-angular-fullstack", - "version": "3.7.4", + "version": "3.7.5", "description": "Yeoman generator for creating MEAN stack applications, using MongoDB, Express, AngularJS, and Node", "keywords": [ "yeoman-generator", From 6fd9f52b72ccd23814f8e7d78d6f968202af1768 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Mon, 6 Jun 2016 08:12:35 -0400 Subject: [PATCH 221/885] docs(readme): add note about webpack tag --- readme.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/readme.md b/readme.md index a166442e5..50502b88b 100644 --- a/readme.md +++ b/readme.md @@ -19,6 +19,8 @@ Install `yo`, `grunt-cli`/`gulp-cli`, `bower`, and `generator-angular-fullstack` npm install -g yo grunt-cli gulp-cli bower generator-angular-fullstack ``` +> To install the latest 4.0.0 Beta with Webpack support, use `generator-angular-fullstack@webpack` + Make a new directory, and `cd` into it: ``` mkdir my-new-project && cd $_ From f9e64e2d9427deeb48002e08c4f0487d050ee4e0 Mon Sep 17 00:00:00 2001 From: Andrew Koroluk Date: Sat, 7 May 2016 14:02:11 -0600 Subject: [PATCH 222/885] feat(gen:app): remove bower, initial webpack support --- gulpfile.js | 14 +- package.json | 3 +- src/generators/app/index.js | 42 +- templates/app/.bowerrc | 3 - templates/app/_bower.json | 25 -- templates/app/_package.json | 92 +++- .../{account.js => account.routes.js} | 81 ++-- .../app/client/app/account(auth)/index.js | 37 ++ .../client/app/account(auth)/login/index.js | 6 + .../account(auth)/login/login.controller.js | 6 +- .../app/account(auth)/settings/index.js | 6 + .../settings/settings.controller.js | 6 +- .../client/app/account(auth)/signup/index.js | 7 + .../account(auth)/signup/signup.controller.js | 6 +- .../app/admin(auth)/admin.controller.js | 10 +- .../client/app/admin(auth)/admin.module.js | 7 - .../client/app/admin(auth)/admin.router.js | 21 - .../client/app/admin(auth)/admin.routes.js | 25 ++ templates/app/client/app/admin(auth)/index.js | 12 + templates/app/client/app/app(sass).scss | 15 +- templates/app/client/app/app.config.js | 15 + templates/app/client/app/app.js | 86 +++- .../app/client/app/main/main.component.js | 52 +++ ...troller.spec.js => main.component.spec.js} | 14 +- .../app/client/app/main/main.controller.js | 42 -- templates/app/client/app/main/main.js | 15 - templates/app/client/app/main/main.routes.js | 19 + .../components/auth(auth)/auth.module.js | 36 +- .../components/auth(auth)/auth.service.js | 10 +- .../auth(auth)/interceptor.service.js | 20 +- .../components/auth(auth)/router.decorator.js | 65 +-- .../components/auth(auth)/user.service.js | 10 +- .../components/footer/footer.component.js | 10 + .../components/footer/footer.directive.js | 12 - .../modal(uibootstrap)/modal.service.js | 125 +++--- .../components/navbar/navbar(html).html | 20 +- .../components/navbar/navbar(jade).jade | 26 +- ...vbar.controller.js => navbar.component.js} | 13 +- .../components/navbar/navbar.directive.js | 9 - .../components/oauth-buttons(oauth)/index.js | 21 + .../oauth-buttons.controller.js | 8 - .../oauth-buttons.controller.spec.js | 20 +- .../oauth-buttons.directive.js | 14 - .../oauth-buttons.directive.spec.js | 19 +- .../socket(socketio)/socket.service.js | 12 +- .../app/client/components/util/util.module.js | 5 +- .../client/components/util/util.service.js | 10 +- templates/app/client/index.html | 49 +-- templates/app/client/polyfills.js | 30 ++ templates/app/gulpfile.babel(gulp).js | 408 +++++++----------- templates/app/karma.conf.js | 79 ++-- templates/app/server/config/express.js | 49 ++- templates/app/spec.js | 22 + templates/app/tsconfig.client(ts).json | 11 + templates/app/tsconfig.client.test(ts).json | 1 + templates/app/typings(ts).json | 5 +- templates/app/webpack.build.js | 8 + templates/app/webpack.dev.js | 8 + templates/app/webpack.make.js | 388 +++++++++++++++++ templates/app/webpack.test.js | 8 + 60 files changed, 1408 insertions(+), 790 deletions(-) delete mode 100644 templates/app/.bowerrc delete mode 100644 templates/app/_bower.json rename templates/app/client/app/account(auth)/{account.js => account.routes.js} (66%) create mode 100644 templates/app/client/app/account(auth)/index.js create mode 100644 templates/app/client/app/account(auth)/login/index.js create mode 100644 templates/app/client/app/account(auth)/settings/index.js create mode 100644 templates/app/client/app/account(auth)/signup/index.js delete mode 100644 templates/app/client/app/admin(auth)/admin.module.js delete mode 100644 templates/app/client/app/admin(auth)/admin.router.js create mode 100644 templates/app/client/app/admin(auth)/admin.routes.js create mode 100644 templates/app/client/app/admin(auth)/index.js create mode 100644 templates/app/client/app/app.config.js create mode 100644 templates/app/client/app/main/main.component.js rename templates/app/client/app/main/{main.controller.spec.js => main.component.spec.js} (75%) delete mode 100644 templates/app/client/app/main/main.controller.js delete mode 100644 templates/app/client/app/main/main.js create mode 100644 templates/app/client/app/main/main.routes.js create mode 100644 templates/app/client/components/footer/footer.component.js delete mode 100644 templates/app/client/components/footer/footer.directive.js rename templates/app/client/components/navbar/{navbar.controller.js => navbar.component.js} (77%) delete mode 100644 templates/app/client/components/navbar/navbar.directive.js create mode 100644 templates/app/client/components/oauth-buttons(oauth)/index.js delete mode 100644 templates/app/client/components/oauth-buttons(oauth)/oauth-buttons.controller.js delete mode 100644 templates/app/client/components/oauth-buttons(oauth)/oauth-buttons.directive.js create mode 100644 templates/app/client/polyfills.js create mode 100644 templates/app/spec.js create mode 100644 templates/app/webpack.build.js create mode 100644 templates/app/webpack.dev.js create mode 100644 templates/app/webpack.make.js create mode 100644 templates/app/webpack.test.js diff --git a/gulpfile.js b/gulpfile.js index 647f84404..c3adf0fda 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -35,7 +35,7 @@ const transpile = lazypipe() .pipe(babel); gulp.task('clean', () => { - return del(['generators/**/*', './test/(**|!fixtures/node_modules|!fixtures/bower_components)/*']); + return del(['generators/**/*', './test/(**|!fixtures/node_modules)/*']); }); gulp.task('babel', () => { @@ -113,10 +113,7 @@ function updateFixtures(target) { const dest = __dirname + (deps ? '/angular-fullstack-deps/' : '/test/fixtures/'); const appName = deps ? 'angular-fullstack-deps' : 'tempApp'; - return Promise.all([ - processJson('templates/app/_package.json', dest + 'package.json', {appName, genVer, private: !deps, test: test}), - processJson('templates/app/_bower.json', dest + 'bower.json', {appName, genVer, private: !deps, test: test}) - ]); + return processJson('templates/app/_package.json', dest + 'package.json', {appName, genVer, private: !deps, test: test}); } gulp.task('updateFixtures', cb => { @@ -143,16 +140,13 @@ function execAsync(cmd, opt) { } gulp.task('installFixtures', function() { - gutil.log('installing npm & bower dependencies for generated app'); + gutil.log('installing npm dependencies for generated app'); let progress = setInterval(() => { process.stdout.write('.'); }, 1 * 1000); shell.cd('test/fixtures'); - return Promise.all([ - execAsync('npm install --quiet', {cwd: '../fixtures'}), - execAsync('bower install', {cwd: '../fixtures'}) - ]).then(() => { + execAsync('npm install --quiet', {cwd: '../fixtures'}).then(() => { process.stdout.write('\n'); if(!process.env.SAUCE_USERNAME) { gutil.log('running npm run-script update-webdriver'); diff --git a/package.json b/package.json index 671b33dc9..0a4406273 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "generator-angular-fullstack", - "version": "3.7.5", + "version": "4.0.0-beta", "description": "Yeoman generator for creating MEAN stack applications, using MongoDB, Express, AngularJS, and Node", "keywords": [ "yeoman-generator", @@ -45,6 +45,7 @@ "gulp-babel": "^6.1.2", "gulp-beautify": "^2.0.0", "gulp-filter": "^4.0.0", + "gulp-tap": "^0.1.3", "insight": "~0.8.1", "lodash": "^4.13.1", "semver": "^5.1.0", diff --git a/src/generators/app/index.js b/src/generators/app/index.js index 6d4dd5435..85c703fc4 100644 --- a/src/generators/app/index.js +++ b/src/generators/app/index.js @@ -11,6 +11,7 @@ import insight from '../insight-init'; import {exec} from 'child_process'; import babelStream from 'gulp-babel'; import beaufityStream from 'gulp-beautify'; +import tap from 'gulp-tap'; import filter from 'gulp-filter'; import semver from 'semver'; @@ -18,6 +19,9 @@ export class Generator extends Base { constructor(...args) { super(...args); + this.env.alias('angular-fullstack', 'afs'); + this.env.alias('afs', 'angular-fullstack'); + this.argument('name', { type: String, required: false }); this.option('skip-install', { @@ -459,7 +463,7 @@ export class Generator extends Base { babelPlugins.push('babel-plugin-transform-flow-strip-types'); // } - const jsFilter = filter(['client/**/*.js'], {restore: true}); + let jsFilter = filter(['client/**/*.js'], {restore: true}); this.registerTransformStream([ jsFilter, babelStream({ @@ -493,6 +497,42 @@ export class Generator extends Base { jsFilter.restore ]); + /** + * TypeScript doesn't play nicely with things that don't have a default export + */ + if(this.filters.ts) { + const modulesToFix = [ + ['angular', 'angular'], + ['ngCookies', 'angular-cookies'], + ['ngResource', 'angular-resource'], + ['ngSanitize', 'angular-sanitize'], + ['uiRouter', 'angular-ui-router'], + ['uiBootstrap', 'angular-ui-bootstrap'], + ['ngMessages', 'angular-messages'], + ['io', 'socket.io-client'] + ]; + function replacer(contents) { + modulesToFix.forEach(([moduleName, importName]) => { + contents = contents.replace( + `import ${moduleName} from '${importName}'`, + `const ${moduleName} = require('${importName}')` + ); + }); + return contents; + } + + let tsFilter = filter(['client/**/*.ts'], {restore: true}); + this.registerTransformStream([ + tsFilter, + tap(function(file, t) { + var contents = file.contents.toString(); + contents = replacer(contents); + file.contents = new Buffer(contents); + }), + tsFilter.restore + ]); + } + let self = this; this.sourceRoot(path.join(__dirname, '../../templates/app')); this.processDirectory('.', '.'); diff --git a/templates/app/.bowerrc b/templates/app/.bowerrc deleted file mode 100644 index 666f34745..000000000 --- a/templates/app/.bowerrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "directory": "client/bower_components" -} diff --git a/templates/app/_bower.json b/templates/app/_bower.json deleted file mode 100644 index b2bcd90bd..000000000 --- a/templates/app/_bower.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "name": "<%= lodash.slugify(lodash.humanize(appname)) %>", - "version": "0.0.0", - "dependencies": { - "angular": "~1.5.0", - "json3": "~3.3.1", - "es5-shim": "~3.0.1",<% if(filters.bootstrap) { if (filters.sass) { %> - "bootstrap-sass-official": "~3.1.1",<% } %> - "bootstrap": "~3.1.1",<% if(filters.oauth) { %> - "bootstrap-social": "~4.9.1",<% }} %> - "angular-resource": "~1.5.0", - "angular-cookies": "~1.5.0", - "angular-sanitize": "~1.5.0",<% if (filters.ngroute) { %> - "angular-route": "~1.5.0",<% } if (filters.uibootstrap) { %> - "angular-bootstrap": "~1.1.2",<% } %> - "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"<% } if (filters.auth) { %>, - "angular-validation-match": "~1.5.2"<% } %> - }, - "devDependencies": { - "angular-mocks": "~1.5.0" - } -} diff --git a/templates/app/_package.json b/templates/app/_package.json index c80e0bf40..6ab28e943 100644 --- a/templates/app/_package.json +++ b/templates/app/_package.json @@ -3,6 +3,24 @@ "version": "0.0.0", "main": "server/app.js", "dependencies": { + <%_ /* CLIENT */ _%> + "angular": "~1.5.5",<% if(filters.bootstrap) { if(filters.sass) { %> + "bootstrap-sass": "~3.1.1",<% } %> + "bootstrap": "~3.1.1",<% if(filters.oauth) { %> + "bootstrap-social": "~4.9.1",<% }} %> + "angular-animate": "~1.5.5", + "angular-aria": "~1.5.5", + "angular-resource": "~1.5.5", + "angular-cookies": "~1.5.5", + "angular-sanitize": "~1.5.5",<% if(filters.ngroute) { %> + "angular-route": "~1.5.5",<% } if(filters.uibootstrap) { %> + "angular-ui-bootstrap": "~1.1.2",<% } %> + "font-awesome": ">=4.1.0",<% if(filters.socketio) { %> + "angular-socket-io": "~0.7.0",<% } if(filters.uirouter) { %> + "angular-ui-router": "~0.2.15",<% } if(filters.auth) { %> + "angular-validation-match": "~1.5.2",<% } %> + <%_ /* END CLIENT */ _%> + "core-js": "^2.2.1", "express": "^4.13.3", "morgan": "~1.7.0", "body-parser": "^1.13.3", @@ -15,28 +33,32 @@ "lodash": "^4.6.1", "lusca": "^1.3.0", "babel-runtime": "^6.6.1", - "babel-polyfill": "^6.7.2",<% if (filters.jade) { %> - "jade": "^1.11.0",<% } %><% if (filters.html) { %> - "ejs": "^2.3.3",<% } %><% if (filters.mongoose) { %> + "babel-polyfill": "^6.7.2",<% if(filters.jade) { %> + "jade": "^1.11.0",<% } %><% if(filters.html) { %> + "ejs": "^2.3.3",<% } %><% if(filters.mongoose) { %> "mongoose": "^4.1.2", "bluebird": "^3.3.3", - "connect-mongo": "^1.1.0",<% } %><% if (filters.sequelize) { %> + "connect-mongo": "^1.1.0",<% } %><% if(filters.sequelize) { %> "sequelize": "^3.5.1", "sqlite3": "~3.1.1", - "express-sequelize-session": "0.4.0",<% } %><% if (filters.auth) { %> + "express-sequelize-session": "0.4.0",<% } %><% if(filters.auth) { %> "jsonwebtoken": "^7.0.0", "express-jwt": "^3.0.0", "passport": "~0.3.0", - "passport-local": "^1.0.0",<% } %><% if (filters.facebookAuth) { %> - "passport-facebook": "^2.0.0",<% } %><% if (filters.twitterAuth) { %> - "passport-twitter": "^1.0.3",<% } %><% if (filters.googleAuth) { %> - "passport-google-oauth20": "^1.0.0",<% } %><% if (filters.socketio) { %> + "passport-local": "^1.0.0",<% } %><% if(filters.facebookAuth) { %> + "passport-facebook": "^2.0.0",<% } %><% if(filters.twitterAuth) { %> + "passport-twitter": "^1.0.3",<% } %><% if(filters.googleAuth) { %> + "passport-google-oauth20": "^1.0.0",<% } %><% if(filters.socketio) { %> "socket.io": "^1.3.5", "socket.io-client": "^1.3.5", "socketio-jwt": "^4.2.0",<% } %> - "serve-favicon": "^2.3.0" + "serve-favicon": "^2.3.0", + "sprint-js": "~0.1.0" }, "devDependencies": { + <%_ /* CLIENT */ _%> + "angular-mocks": "~1.5.5", + <%_ /* END CLIENT */ _%> "autoprefixer": "^6.0.0", "babel-core": "^6.6.5", "babel-register": "^6.6.5", @@ -51,7 +73,8 @@ "gulp-babel": "^6.1.2",<% if(filters.ts) { %> "gulp-typescript": "~2.13.0", "gulp-typings": "^1.3.6", - "gulp-tslint": "^5.0.0",<% } %> + "gulp-tslint": "^5.0.0", + "ts-helpers": "1.1.1",<% } %> "gulp-cache": "^0.4.2", "gulp-concat": "^2.6.0", "gulp-env": "^0.4.0", @@ -108,8 +131,8 @@ "grunt-contrib-imagemin": "^1.0.0", "grunt-contrib-jshint": "^1.0.0", "grunt-contrib-uglify": "^1.0.0", - "grunt-contrib-watch": "^1.0.0",<% if (filters.jade) { %> - "grunt-contrib-jade": "^1.0.0",<% } %><% if (filters.less) { %> + "grunt-contrib-watch": "^1.0.0",<% if(filters.jade) { %> + "grunt-contrib-jade": "^1.0.0",<% } %><% if(filters.less) { %> "grunt-contrib-less": "^1.2.0",<% } %> "grunt-babel": "~6.0.0",<% if(filters.ts) { %> "grunt-ts": "^5.3.2", @@ -140,6 +163,36 @@ "time-grunt": "^1.2.1", "grunt-mocha-test": "~0.12.7", "grunt-mocha-istanbul": "^4.0.2",<% } /*end grunt*/ %> + <%_ /* WEBPACK */ _%> + "webpack": "^1.12.14", + "webpack-dev-middleware": "^1.5.1", + "webpack-dev-server": "~1.14.0", + "webpack-stream": "^3.2.0", + "extract-text-webpack-plugin": "^1.0.1", + "html-webpack-plugin": "^2.16.0", + "awesome-typescript-loader": "0.17.0", + "ng-annotate-loader": "~0.1.0", + "babel-loader": "^6.2.4", + "css-loader": "^0.23.1", + "file-loader": "^0.8.4", + "imports-loader": "^0.6.5", + "isparta-instrumenter-loader": "^1.0.0", + "isparta-loader": "^2.0.0", + "istanbul-instrumenter-loader": "^0.2.0", + "null-loader": "^0.1.1", + "postcss-loader": "^0.9.1", + "raw-loader": "^0.5.1", + "style-loader": "^0.13.0", + <%_ if(filters.sass) { _%> + "sass-loader": "^3.1.1",<% } %> + <%_ if(filters.less) { _%> + "less-loader": "",<% } %> + <%_ if(filters.stylus) { _%> + "stylus-loader": "",<% } %> + "tiny-lr": "^0.2.1", + "karma-webpack": "^1.7.0", + <%_ /* END WEBPACK */ _%> + "through2": "^2.0.1", "open": "~0.0.4", "jshint-stylish": "^2.2.0", "connect-livereload": "^0.5.3", @@ -151,20 +204,17 @@ "karma": "~0.13.3", "karma-firefox-launcher": "^1.0.0", "karma-script-launcher": "^1.0.0", + "karma-coverage": "^0.5.3", "karma-chrome-launcher": "^1.0.1", - "karma-jade-preprocessor": "0.0.11", - "karma-phantomjs-launcher": "~1.0.0",<% if (filters.jade) { %> - "karma-ng-jade2js-preprocessor": "^0.2.0",<% } %> - "karma-ng-html2js-preprocessor": "^1.0.0", + "karma-phantomjs-launcher": "~1.0.0", "karma-spec-reporter": "~0.0.20", "sinon-chai": "^2.8.0", - "mocha": "^2.2.5",<% if (filters.mocha) { %> + "mocha": "^2.2.5",<% if(filters.mocha) { %> "karma-mocha": "^1.0.1", - "karma-chai-plugins": "~0.7.0",<% } if (filters.jasmine) { %> + "karma-chai-plugins": "~0.7.0",<% } if(filters.jasmine) { %> "jasmine-core": "^2.3.4", "karma-jasmine": "^1.0.2", - "jasmine-spec-reporter": "^2.4.0",<% } if(filters.babel) { %> - "karma-babel-preprocessor": "^6.0.1",<% } %> + "jasmine-spec-reporter": "^2.4.0",<% } %> "phantomjs-prebuilt": "^2.1.4", "proxyquire": "^1.0.1", "supertest": "^1.1.0"<% if(filters.ts) { %>, diff --git a/templates/app/client/app/account(auth)/account.js b/templates/app/client/app/account(auth)/account.routes.js similarity index 66% rename from templates/app/client/app/account(auth)/account.js rename to templates/app/client/app/account(auth)/account.routes.js index 4266116fa..67f69c1e3 100644 --- a/templates/app/client/app/account(auth)/account.js +++ b/templates/app/client/app/account(auth)/account.routes.js @@ -1,81 +1,72 @@ 'use strict'; -angular.module('<%= scriptAppName %>') - <% if (filters.ngroute) { %>.config(function($routeProvider) { - $routeProvider - .when('/login', { +<%_ if (filters.uirouter) { _%> +export default function routes($stateProvider) { + 'ngInject'; + $stateProvider + .state('login', { + url: '/login', templateUrl: 'app/account/login/login.html', controller: 'LoginController', controllerAs: 'vm' }) - .when('/logout', { - name: 'logout', - referrer: '/', + .state('logout', { + url: '/logout?referrer', + referrer: 'main', template: '', - controller: function($location, $route, Auth) { - var referrer = $route.current.params.referrer || - $route.current.referrer || - '/'; + controller: function($state, Auth) { + 'ngInject'; + var referrer = $state.params.referrer + || $state.current.referrer + || 'main'; Auth.logout(); - $location.path(referrer); + $state.go(referrer); } }) - .when('/signup', { + .state('signup', { + url: '/signup', templateUrl: 'app/account/signup/signup.html', controller: 'SignupController', controllerAs: 'vm' }) - .when('/settings', { + .state('settings', { + url: '/settings', templateUrl: 'app/account/settings/settings.html', controller: 'SettingsController', controllerAs: 'vm', authenticate: true }); - }) - .run(function($rootScope) { - $rootScope.$on('$routeChangeStart', function(event, next, current) { - if (next.name === 'logout' && current && current.originalPath && !current.authenticate) { - next.referrer = current.originalPath; - } - }); - });<% } %><% if (filters.uirouter) { %>.config(function($stateProvider) { - $stateProvider - .state('login', { - url: '/login', +}<% } %> +<%_ if (filters.ngroute) { _%> +export default function routes($stateProvider) { + 'ngInject'; + $routeProvider + .when('/login', { templateUrl: 'app/account/login/login.html', controller: 'LoginController', controllerAs: 'vm' }) - .state('logout', { - url: '/logout?referrer', - referrer: 'main', + .when('/logout', { + name: 'logout', + referrer: '/', template: '', - controller: function($state, Auth) { - var referrer = $state.params.referrer || - $state.current.referrer || - 'main'; + controller: function($location, $route, Auth) { + var referrer = $route.current.params.referrer || + $route.current.referrer || + '/'; Auth.logout(); - $state.go(referrer); + $location.path(referrer); } }) - .state('signup', { - url: '/signup', + .when('/signup', { templateUrl: 'app/account/signup/signup.html', controller: 'SignupController', controllerAs: 'vm' }) - .state('settings', { - url: '/settings', + .when('/settings', { templateUrl: 'app/account/settings/settings.html', controller: 'SettingsController', controllerAs: 'vm', authenticate: true }); - }) - .run(function($rootScope) { - $rootScope.$on('$stateChangeStart', function(event, next, nextParams, current) { - if (next.name === 'logout' && current && current.name && !current.authenticate) { - next.referrer = current.name; - } - }); - });<% } %> +}<% } %> diff --git a/templates/app/client/app/account(auth)/index.js b/templates/app/client/app/account(auth)/index.js new file mode 100644 index 000000000..2cdd86c1d --- /dev/null +++ b/templates/app/client/app/account(auth)/index.js @@ -0,0 +1,37 @@ +'use strict'; +import angular from 'angular'; +import uiRouter from 'angular-ui-router'; + +import routing from './account.routes'; +import login from './login'; +import settings from './settings'; +import signup from './signup'; +import oauthButtons from '../../components/oauth-buttons'; + +export default angular.module('<%= scriptAppName %>.account', [ + uiRouter, + login, + settings, + signup, + oauthButtons +]) + .config(routing) + <%_ if (filters.ngroute) { _%> + .run(function($rootScope) { + 'ngInject'; + $rootScope.$on('$routeChangeStart', function(event, next, current) { + if (next.name === 'logout' && current && current.originalPath && !current.authenticate) { + next.referrer = current.originalPath; + } + }); + })<% } %> + <%_ if (filters.uirouter) { _%> + .run(function($rootScope) { + 'ngInject'; + $rootScope.$on('$stateChangeStart', function(event, next, nextParams, current) { + if (next.name === 'logout' && current && current.name && !current.authenticate) { + next.referrer = current.name; + } + }); + })<% } %> + .name; diff --git a/templates/app/client/app/account(auth)/login/index.js b/templates/app/client/app/account(auth)/login/index.js new file mode 100644 index 000000000..187b43be5 --- /dev/null +++ b/templates/app/client/app/account(auth)/login/index.js @@ -0,0 +1,6 @@ +'use strict'; +import LoginController from './login.controller'; + +export default angular.module('<%= scriptAppName %>.login', []) + .controller('LoginController', LoginController) + .name; diff --git a/templates/app/client/app/account(auth)/login/login.controller.js b/templates/app/client/app/account(auth)/login/login.controller.js index d53fcbe20..1aa48e1e3 100644 --- a/templates/app/client/app/account(auth)/login/login.controller.js +++ b/templates/app/client/app/account(auth)/login/login.controller.js @@ -1,6 +1,7 @@ 'use strict'; -class LoginController { +export default class LoginController { + /*@ngInject*/ constructor(Auth<% if (filters.ngroute) { %>, $location<% } %><% if (filters.uirouter) { %>, $state<% } %>) { this.user = {}; this.errors = {}; @@ -29,6 +30,3 @@ class LoginController { } } } - -angular.module('<%= scriptAppName %>') - .controller('LoginController', LoginController); diff --git a/templates/app/client/app/account(auth)/settings/index.js b/templates/app/client/app/account(auth)/settings/index.js new file mode 100644 index 000000000..823caa530 --- /dev/null +++ b/templates/app/client/app/account(auth)/settings/index.js @@ -0,0 +1,6 @@ +'use strict'; +import SettingsController from './settings.controller'; + +export default angular.module('<%= scriptAppName %>.settings', []) + .controller('SettingsController', SettingsController) + .name; diff --git a/templates/app/client/app/account(auth)/settings/settings.controller.js b/templates/app/client/app/account(auth)/settings/settings.controller.js index 58c89e0ff..976bd5154 100644 --- a/templates/app/client/app/account(auth)/settings/settings.controller.js +++ b/templates/app/client/app/account(auth)/settings/settings.controller.js @@ -1,9 +1,10 @@ 'use strict'; -class SettingsController { +export default class SettingsController { errors = {}; submitted = false; + /*@ngInject*/ constructor(Auth) { this.Auth = Auth; } @@ -24,6 +25,3 @@ class SettingsController { } } } - -angular.module('<%= scriptAppName %>') - .controller('SettingsController', SettingsController); diff --git a/templates/app/client/app/account(auth)/signup/index.js b/templates/app/client/app/account(auth)/signup/index.js new file mode 100644 index 000000000..43b4842b7 --- /dev/null +++ b/templates/app/client/app/account(auth)/signup/index.js @@ -0,0 +1,7 @@ +'use strict'; + +import SignupController from './signup.controller'; + +export default angular.module('<%= scriptAppName %>.signup', []) + .controller('SignupController', SignupController) + .name; diff --git a/templates/app/client/app/account(auth)/signup/signup.controller.js b/templates/app/client/app/account(auth)/signup/signup.controller.js index a6f83fb58..6ae9064e4 100644 --- a/templates/app/client/app/account(auth)/signup/signup.controller.js +++ b/templates/app/client/app/account(auth)/signup/signup.controller.js @@ -1,12 +1,13 @@ 'use strict'; -class SignupController { +export default class SignupController { //start-non-standard user = {}; errors = {}; submitted = false; //end-non-standard + /*@ngInject*/ constructor(Auth<% if (filters.ngroute) { %>, $location<% } %><% if (filters.uirouter) { %>, $state<% } %>) { this.Auth = Auth;<% if (filters.ngroute) { %> this.$location = $location;<% } if (filters.uirouter) { %> @@ -47,6 +48,3 @@ if (filters.sequelizeModels) { %> } } } - -angular.module('<%= scriptAppName %>') - .controller('SignupController', SignupController); diff --git a/templates/app/client/app/admin(auth)/admin.controller.js b/templates/app/client/app/admin(auth)/admin.controller.js index b56309871..afb2e557b 100644 --- a/templates/app/client/app/admin(auth)/admin.controller.js +++ b/templates/app/client/app/admin(auth)/admin.controller.js @@ -1,12 +1,11 @@ 'use strict'; -(function() { - -class AdminController { +export default class AdminController { <%_ if(filters.ts || filters.flow) { _%> users: Object[]; <%_ } _%> + /*@ngInject*/ constructor(User) { // Use the User $resource to fetch all users this.users = User.query(); @@ -17,8 +16,3 @@ class AdminController { this.users.splice(this.users.indexOf(user), 1); } } - -angular.module('<%= scriptAppName %>.admin') - .controller('AdminController', AdminController); - -})(); diff --git a/templates/app/client/app/admin(auth)/admin.module.js b/templates/app/client/app/admin(auth)/admin.module.js deleted file mode 100644 index da769ae91..000000000 --- a/templates/app/client/app/admin(auth)/admin.module.js +++ /dev/null @@ -1,7 +0,0 @@ -'use strict'; - -angular.module('<%= scriptAppName %>.admin', [ - '<%= scriptAppName %>.auth'<% if (filters.ngroute) { %>, - 'ngRoute'<% } if (filters.uirouter) { %>, - 'ui.router'<% } %> -]); diff --git a/templates/app/client/app/admin(auth)/admin.router.js b/templates/app/client/app/admin(auth)/admin.router.js deleted file mode 100644 index cc3d9e9f9..000000000 --- a/templates/app/client/app/admin(auth)/admin.router.js +++ /dev/null @@ -1,21 +0,0 @@ -'use strict'; - -angular.module('<%= scriptAppName %>.admin') - <% if (filters.ngroute) { %>.config(function($routeProvider) { - $routeProvider - .when('/admin', { - templateUrl: 'app/admin/admin.html', - controller: 'AdminController', - controllerAs: 'admin', - authenticate: 'admin' - }); - });<% } if (filters.uirouter) { %>.config(function($stateProvider) { - $stateProvider - .state('admin', { - url: '/admin', - templateUrl: 'app/admin/admin.html', - controller: 'AdminController', - controllerAs: 'admin', - authenticate: 'admin' - }); - });<% } %> diff --git a/templates/app/client/app/admin(auth)/admin.routes.js b/templates/app/client/app/admin(auth)/admin.routes.js new file mode 100644 index 000000000..95d0e5476 --- /dev/null +++ b/templates/app/client/app/admin(auth)/admin.routes.js @@ -0,0 +1,25 @@ +'use strict'; + +<%_ if (filters.ngroute) { _%> +export default function routes($routeProvider) { + 'ngInject'; + $routeProvider + .when('/admin', { + templateUrl: 'app/admin/admin.html', + controller: 'AdminController', + controllerAs: 'admin', + authenticate: 'admin' + }); +};<% } %> +<%_ if (filters.uirouter) { _%> +export default function routes($stateProvider) { + 'ngInject'; + $stateProvider + .state('admin', { + url: '/admin', + templateUrl: 'app/admin/admin.html', + controller: 'AdminController', + controllerAs: 'admin', + authenticate: 'admin' + }); +};<% } %> diff --git a/templates/app/client/app/admin(auth)/index.js b/templates/app/client/app/admin(auth)/index.js new file mode 100644 index 000000000..d78165412 --- /dev/null +++ b/templates/app/client/app/admin(auth)/index.js @@ -0,0 +1,12 @@ +'use strict'; +import routes from './admin.routes'; +import AdminController from './admin.controller'; + +export default angular.module('<%= scriptAppName %>.admin', [ + '<%= scriptAppName %>.auth'<% if (filters.ngroute) { %>, + 'ngRoute'<% } if (filters.uirouter) { %>, + 'ui.router'<% } %> +]) + .config(routes) + .controller('AdminController', AdminController) + .name; diff --git a/templates/app/client/app/app(sass).scss b/templates/app/client/app/app(sass).scss index 0191121c1..3a8fc330e 100644 --- a/templates/app/client/app/app(sass).scss +++ b/templates/app/client/app/app(sass).scss @@ -1,8 +1,13 @@ -<% if (filters.bootstrap) { %>$icon-font-path: "../bower_components/bootstrap-sass-official/vendor/assets/fonts/bootstrap/"; -@import '../bower_components/bootstrap-sass-official/vendor/assets/stylesheets/bootstrap'; -<% if(filters.oauth) { %>@import '../bower_components/bootstrap-social/bootstrap-social.scss'; -<% }} %>$fa-font-path: "../bower_components/font-awesome/fonts"; -@import '../bower_components/font-awesome/scss/font-awesome'; +<%_ if (filters.bootstrap) { _%> +$icon-font-path: "/assets/fonts/bootstrap/"; +@import '../../node_modules/bootstrap-sass/vendor/assets/stylesheets/bootstrap'; +<%_ if(filters.oauth) { _%> +@import '../../node_modules/bootstrap-social/bootstrap-social.scss'; +<% }} _%> +$fa-font-path: "/assets/fonts/font-awesome/"; +@import '../../node_modules/font-awesome/scss/font-awesome'; + +// @import url(http://fonts.googleapis.com/css?family=Open+Sans:300,400,600,900|Roboto:300,500,700,900); /** * App-wide Styles diff --git a/templates/app/client/app/app.config.js b/templates/app/client/app/app.config.js new file mode 100644 index 000000000..3b3ea607b --- /dev/null +++ b/templates/app/client/app/app.config.js @@ -0,0 +1,15 @@ +'use strict'; + +export function routeConfig(<% if (filters.ngroute) { %>$routeProvider<% } if (filters.uirouter) { %>$urlRouterProvider<% } %>, $locationProvider) { + 'ngInject'; + <%_ if(filters.ngroute) { _%> + $routeProvider + .otherwise({ + redirectTo: '/' + });<% } %> + <%_ if(filters.uirouter) { _%> + $urlRouterProvider + .otherwise('/');<% } %> + + $locationProvider.html5Mode(true); +} diff --git a/templates/app/client/app/app.js b/templates/app/client/app/app.js index a9d9f2b09..484025cf5 100644 --- a/templates/app/client/app/app.js +++ b/templates/app/client/app/app.js @@ -1,13 +1,81 @@ 'use strict'; +import angular from 'angular'; +// import ngAnimate from 'angular-animate'; +import ngCookies from 'angular-cookies'; +import ngResource from 'angular-resource'; +import ngSanitize from 'angular-sanitize'; +<%_ if(filters.socketio) { _%> +import 'angular-socket-io';<% } %> +<%_ if(filters.ngroute) { _%> +import ngRoute from 'angular-route';<% } %> +<%_ if(filters.uirouter) { _%> +import uiRouter from 'angular-ui-router';<% } %> +<%_ if(filters.uibootstrap) { _%> +import uiBootstrap from 'angular-ui-bootstrap';<% } %> +// import ngMessages from 'angular-messages'; +<%_ if(filters.auth) { _%> +//import ngValidationMatch from 'angular-validation-match';<% } %> -angular.module('<%= scriptAppName %>', [<%- angularModules %>]) - .config(function(<% if (filters.ngroute) { %>$routeProvider<% } if (filters.uirouter) { %>$urlRouterProvider<% } %>, $locationProvider) {<% if (filters.ngroute) { %> - $routeProvider - .otherwise({ - redirectTo: '/' - });<% } if (filters.uirouter) { %> - $urlRouterProvider - .otherwise('/');<% } %> - $locationProvider.html5Mode(true); +import {routeConfig} from './app.config'; + +<%_ if(filters.auth) { _%> +import _Auth from '../components/auth/auth.module'; +import account from './account'; +import admin from './admin';<% } %> +import navbar from '../components/navbar/navbar.component'; +import footer from '../components/footer/footer.component'; +import main from './main/main.component'; +import './app.constant'; +import util from '../components/util/util.module'; +import socket from '../components/socket/socket.service'; + + +import './app.<%= styleExt %>'; + +angular.module('<%= scriptAppName %>', [ + // ngAnimate, + ngCookies, + ngResource, + ngSanitize, + <%_ if(filters.socketio) { %> + 'btford.socket-io',<% } %> + <%_ if(filters.ngroute) { %> + ngRoute,<% } _%> + <%_ if(filters.uirouter) { %> + uiRouter,<% } _%> + <%_ if(filters.uibootstrap) { %> + uiBootstrap,<% } %> + // ngMessages, + <%_ if(filters.auth) { %> + // ngValidationMatch, + _Auth, + account, + admin,<% } _%> + navbar, + footer, + main, + '<%= scriptAppName %>.constants', + socket, + util +]) + .config(routeConfig) + .run(function($rootScope, $location, Auth) { + 'ngInject'; + // Redirect to login if route requires auth and you're not logged in + $rootScope.$on('$stateChangeStart', function(event, next) { + Auth.isLoggedIn(function(loggedIn) { + if(next.authenticate && !loggedIn) { + $location.path('/login'); + } + }); + }); + }); + +angular + .element(document) + .ready(() => { + angular.bootstrap(document, ['<%= scriptAppName %>'], { + strictDi: true + }); }); diff --git a/templates/app/client/app/main/main.component.js b/templates/app/client/app/main/main.component.js new file mode 100644 index 000000000..cd1f932ba --- /dev/null +++ b/templates/app/client/app/main/main.component.js @@ -0,0 +1,52 @@ +import angular from 'angular'; +<%_ if(filters.ngroute) { _%> +import ngroute from 'angular-route';<% } _%> +<%_ if(filters.uirouter) { _%> +import uiRouter from 'angular-ui-router';<% } _%> + +import routing from './main.routes'; + +export class MainController { + /*@ngInject*/ + constructor($http<% if(filters.socketio) { %>, $scope, socket<% } %>) { + this.$http = $http;<% if (filters.socketio) { %> + this.socket = socket;<% } %> + this.awesomeThings = []; + <%_ if (filters.socketio) { _%> + + $scope.$on('$destroy', function() { + socket.unsyncUpdates('thing'); + });<% } %> + } + + $onInit() { + this.$http.get('/api/things').then(response => { + this.awesomeThings = response.data;<% if (filters.socketio) { %> + this.socket.syncUpdates('thing', this.awesomeThings);<% } %> + }); + }<% if (filters.models) { %> + + addThing() { + if (this.newThing) { + this.$http.post('/api/things', { name: this.newThing }); + this.newThing = ''; + } + } + + deleteThing(thing) { + this.$http.delete('/api/things/' + thing._id); + }<% } %> +} + +export default angular.module('<%= scriptAppName %>.main', [ + <%_ if(filters.ngroute) { _%> + ngroute<% } _%> + <%_ if(filters.uirouter) { _%> + uiRouter<% } _%> +]) + .config(routing) + .component('main', { + template: require('./main.<%= templateExt %>'), + controller: MainController + }) + .name; diff --git a/templates/app/client/app/main/main.controller.spec.js b/templates/app/client/app/main/main.component.spec.js similarity index 75% rename from templates/app/client/app/main/main.controller.spec.js rename to templates/app/client/app/main/main.component.spec.js index 67982faa0..ac10b1c54 100644 --- a/templates/app/client/app/main/main.controller.spec.js +++ b/templates/app/client/app/main/main.component.spec.js @@ -1,11 +1,15 @@ 'use strict'; -describe('Component: mainComponent', function() { +import main from './main.component'; +import {MainController} from './main.component'; - // load the controller's module - beforeEach(module('<%= scriptAppName %>'));<% if (filters.uirouter) {%> - beforeEach(module('stateMock'));<% } %><% if (filters.socketio) {%> - beforeEach(module('socketMock'));<% } %> +describe('Component: MainComponent', function() { + + beforeEach(angular.mock.module(main)); + <%_ if (filters.uirouter) { _%> + beforeEach(angular.mock.module('stateMock'));<% } _%> + <%_ if (filters.socketio) { _%> + beforeEach(angular.mock.module('socketMock'));<% } %> var scope; var mainComponent;<% if (filters.uirouter) {%> diff --git a/templates/app/client/app/main/main.controller.js b/templates/app/client/app/main/main.controller.js deleted file mode 100644 index 02f408164..000000000 --- a/templates/app/client/app/main/main.controller.js +++ /dev/null @@ -1,42 +0,0 @@ -'use strict'; - -(function() { - -class MainController { - - constructor($http<% if (filters.socketio) { %>, $scope, socket<% } %>) { - this.$http = $http;<% if (filters.socketio) { %> - this.socket = socket;<% } %> - this.awesomeThings = [];<% if (filters.socketio) { %> - - $scope.$on('$destroy', function() { - socket.unsyncUpdates('thing'); - });<% } %> - } - - $onInit() { - this.$http.get('/api/things').then(response => { - this.awesomeThings = response.data;<% if (filters.socketio) { %> - this.socket.syncUpdates('thing', this.awesomeThings);<% } %> - }); - }<% if (filters.models) { %> - - addThing() { - if (this.newThing) { - this.$http.post('/api/things', { name: this.newThing }); - this.newThing = ''; - } - } - - deleteThing(thing) { - this.$http.delete('/api/things/' + thing._id); - }<% } %> -} - -angular.module('<%= scriptAppName %>') - .component('main', { - templateUrl: 'app/main/main.html', - controller: MainController - }); - -})(); diff --git a/templates/app/client/app/main/main.js b/templates/app/client/app/main/main.js deleted file mode 100644 index 9d5f59887..000000000 --- a/templates/app/client/app/main/main.js +++ /dev/null @@ -1,15 +0,0 @@ -'use strict'; - -angular.module('<%= scriptAppName %>') - <% if (filters.ngroute) { %>.config(function($routeProvider) { - $routeProvider - .when('/', { - template: '
' - }); - });<% } %><% if (filters.uirouter) { %>.config(function($stateProvider) { - $stateProvider - .state('main', { - url: '/', - template: '
' - }); - });<% } %> diff --git a/templates/app/client/app/main/main.routes.js b/templates/app/client/app/main/main.routes.js new file mode 100644 index 000000000..95c7968a9 --- /dev/null +++ b/templates/app/client/app/main/main.routes.js @@ -0,0 +1,19 @@ +'use strict'; + +<%_ if(filters.ngroute) { _%> +export default function routes($routeProvider) { + 'ngInject'; + $routeProvider + .when('/', { + template: '
' + }); +};<% } %> +<%_ if(filters.uirouter) { _%> +export default function routes($stateProvider) { + 'ngInject'; + $stateProvider + .state('main', { + url: '/', + template: '
' + }); +};<% } %> diff --git a/templates/app/client/components/auth(auth)/auth.module.js b/templates/app/client/components/auth(auth)/auth.module.js index 60ce6e321..5ca42e3ca 100644 --- a/templates/app/client/components/auth(auth)/auth.module.js +++ b/templates/app/client/components/auth(auth)/auth.module.js @@ -1,12 +1,32 @@ 'use strict'; +import angular from 'angular'; +// import constants from '../../app/app.constant'; +import util from '../util/util.module'; +import ngCookies from 'angular-cookies'; +import {authInterceptor} from './interceptor.service'; +import {routerDecorator} from './router.decorator'; +import {AuthService} from './auth.service'; +import {UserResource} from './user.service'; +<%_ if (filters.ngroute) { _%> +import ngRoute from 'angular-route';<% } %> +<%_ if (filters.uirouter) { _%> +import uiRouter from 'angular-ui-router';<% } %> -angular.module('<%= scriptAppName %>.auth', [ +function addInterceptor($httpProvider) { + 'ngInject'; + $httpProvider.interceptors.push('authInterceptor'); +} + +export default angular.module('<%= scriptAppName %>.auth', [ '<%= scriptAppName %>.constants', - '<%= scriptAppName %>.util', - 'ngCookies'<% if (filters.ngroute) { %>, - 'ngRoute'<% } if (filters.uirouter) { %>, - 'ui.router'<% } %> + util, + ngCookies<% if(filters.ngroute) { %>, + ngRoute<% } if(filters.uirouter) { %>, + uiRouter<% } %> ]) - .config(function($httpProvider) { - $httpProvider.interceptors.push('authInterceptor'); - }); + .factory('authInterceptor', authInterceptor) + .run(routerDecorator) + .factory('Auth', AuthService) + .factory('User', UserResource) + .config(['$httpProvider', addInterceptor]) + .name; diff --git a/templates/app/client/components/auth(auth)/auth.service.js b/templates/app/client/components/auth(auth)/auth.service.js index 3a75c5a9a..a64e770f3 100644 --- a/templates/app/client/components/auth(auth)/auth.service.js +++ b/templates/app/client/components/auth(auth)/auth.service.js @@ -1,8 +1,7 @@ 'use strict'; -(function() { - -function AuthService($location, $http, $cookies, $q, appConfig, Util, User) { +export function AuthService($location, $http, $cookies, $q, appConfig, Util, User) { + 'ngInject'; var safeCb = Util.safeCb; var currentUser = {}; var userRoles = appConfig.userRoles || []; @@ -182,8 +181,3 @@ function AuthService($location, $http, $cookies, $q, appConfig, Util, User) { return Auth; } - -angular.module('<%= scriptAppName %>.auth') - .factory('Auth', AuthService); - -})(); diff --git a/templates/app/client/components/auth(auth)/interceptor.service.js b/templates/app/client/components/auth(auth)/interceptor.service.js index 72c3441b0..e868b8924 100644 --- a/templates/app/client/components/auth(auth)/interceptor.service.js +++ b/templates/app/client/components/auth(auth)/interceptor.service.js @@ -1,10 +1,10 @@ 'use strict'; -(function() { - -function authInterceptor($rootScope, $q, $cookies<% if (filters.ngroute) { %>, $location<% } if (filters.uirouter) { %>, $injector<% } %>, Util) { - <% if (filters.uirouter) { %>var state; - <% } %>return { +export function authInterceptor($rootScope, $q, $cookies<% if (filters.ngroute) { %>, $location<% } if (filters.uirouter) { %>, $injector<% } %>, Util) { + 'ngInject'; + <%_ if (filters.uirouter) { _%> + var state;<% } %> + return { // Add authorization token to headers request(config) { config.headers = config.headers || {}; @@ -17,7 +17,10 @@ function authInterceptor($rootScope, $q, $cookies<% if (filters.ngroute) { %>, $ // Intercept 401s and redirect you to login responseError(response) { if (response.status === 401) { - <% if (filters.ngroute) { %>$location.path('/login');<% } if (filters.uirouter) { %>(state || (state = $injector.get('$state'))).go('login');<% } %> + <%_ if (filters.ngroute) { _%> + $location.path('/login');<% } %> + <%_ if (filters.uirouter) { _%> + (state || (state = $injector.get('$state'))).go('login');<% } %> // remove any stale tokens $cookies.remove('token'); } @@ -25,8 +28,3 @@ function authInterceptor($rootScope, $q, $cookies<% if (filters.ngroute) { %>, $ } }; } - -angular.module('<%= scriptAppName %>.auth') - .factory('authInterceptor', authInterceptor); - -})(); diff --git a/templates/app/client/components/auth(auth)/router.decorator.js b/templates/app/client/components/auth(auth)/router.decorator.js index 5b8fb0e6a..8dff6c51b 100644 --- a/templates/app/client/components/auth(auth)/router.decorator.js +++ b/templates/app/client/components/auth(auth)/router.decorator.js @@ -1,39 +1,40 @@ 'use strict'; +import _ from 'lodash'; -(function() { +export function routerDecorator($rootScope<% if(filters.ngroute) { %>, $location<% } if(filters.uirouter) { %>, $state<% } %>, Auth) { + 'ngInject'; + // Redirect to login if route requires auth and the user is not logged in, or doesn't have required role + $rootScope.$on(<% if(filters.ngroute) { %>'$routeChangeStart'<% } %><% if(filters.uirouter) { %>'$stateChangeStart'<% } %>, function(event, next) { + if(!next.authenticate) { + return; + } -angular.module('<%= scriptAppName %>.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, or doesn't have required role - $rootScope.$on(<% if (filters.ngroute) { %>'$routeChangeStart'<% } %><% if (filters.uirouter) { %>'$stateChangeStart'<% } %>, function(event, next) { - if (!next.authenticate) { - return; - } + if(typeof next.authenticate === 'string') { + Auth.hasRole(next.authenticate, _.noop).then(has => { + if(has) { + return; + } - if (typeof next.authenticate === 'string') { - Auth.hasRole(next.authenticate, _.noop).then(has => { - if (has) { - return; - } - - event.preventDefault(); - return Auth.isLoggedIn(_.noop).then(is => {<% if (filters.ngroute) { %> - $location.path(is ? '/' : '/login');<% } if (filters.uirouter) { %> - $state.go(is ? 'main' : 'login');<% } %> - }); + event.preventDefault(); + return Auth.isLoggedIn(_.noop).then(is => { + <%_ if(filters.ngroute) { _%> + $location.path(is ? '/' : '/login');<% } %> + <%_ if(filters.uirouter) { _%> + $state.go(is ? 'main' : 'login');<% } %> }); - } else { - Auth.isLoggedIn(_.noop).then(is => { - if (is) { - return; - } + }); + } else { + Auth.isLoggedIn(_.noop).then(is => { + if(is) { + return; + } - event.preventDefault();<% if (filters.ngroute) { %> - $location.path('/');<% } if (filters.uirouter) { %> - $state.go('main');<% } %> - }); - } - }); + event.preventDefault(); + <%_ if(filters.ngroute) { _%> + $location.path('/');<% } %> + <%_ if(filters.uirouter) { _%> + $state.go('main');<% } %> + }); + } }); - -})(); +}; diff --git a/templates/app/client/components/auth(auth)/user.service.js b/templates/app/client/components/auth(auth)/user.service.js index 63f4040d0..a458a89a2 100644 --- a/templates/app/client/components/auth(auth)/user.service.js +++ b/templates/app/client/components/auth(auth)/user.service.js @@ -1,8 +1,7 @@ 'use strict'; -(function() { - -function UserResource($resource) { +export function UserResource($resource) { + 'ngInject'; return $resource('/api/users/:id/:controller', { id: '@_id' }, { @@ -20,8 +19,3 @@ function UserResource($resource) { } }); } - -angular.module('<%= scriptAppName %>.auth') - .factory('User', UserResource); - -})(); diff --git a/templates/app/client/components/footer/footer.component.js b/templates/app/client/components/footer/footer.component.js new file mode 100644 index 000000000..88b9312a7 --- /dev/null +++ b/templates/app/client/components/footer/footer.component.js @@ -0,0 +1,10 @@ +import angular from 'angular'; + +export class FooterComponent {} + +export default angular.module('directives.footer', []) + .component('footer', { + template: require('./footer.<%= templateExt %>'), + controller: FooterComponent + }) + .name; diff --git a/templates/app/client/components/footer/footer.directive.js b/templates/app/client/components/footer/footer.directive.js deleted file mode 100644 index 9ed31900c..000000000 --- a/templates/app/client/components/footer/footer.directive.js +++ /dev/null @@ -1,12 +0,0 @@ -'use strict'; - -angular.module('<%= scriptAppName %>') - .directive('footer', function() { - return { - templateUrl: 'components/footer/footer.html', - restrict: 'E', - link: function(scope, element) { - element.addClass('footer'); - } - }; - }); diff --git a/templates/app/client/components/modal(uibootstrap)/modal.service.js b/templates/app/client/components/modal(uibootstrap)/modal.service.js index d7807e6b5..921f3d068 100644 --- a/templates/app/client/components/modal(uibootstrap)/modal.service.js +++ b/templates/app/client/components/modal(uibootstrap)/modal.service.js @@ -1,73 +1,76 @@ 'use strict'; -angular.module('<%= scriptAppName %>') - .factory('Modal', function($rootScope, $uibModal) { - /** - * 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 $uibModal.open() returns - */ - function openModal(scope = {}, modalClass = 'modal-default') { - var modalScope = $rootScope.$new(); +export function Modal($rootScope, $uibModal) { + /** + * 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 $uibModal.open() returns + */ + function openModal(scope = {}, modalClass = 'modal-default') { + var modalScope = $rootScope.$new(); - angular.extend(modalScope, scope); + angular.extend(modalScope, scope); - return $uibModal.open({ - templateUrl: 'components/modal/modal.html', - windowClass: modalClass, - scope: modalScope - }); - } + return $uibModal.open({ + templateUrl: 'components/modal/modal.html', + windowClass: modalClass, + scope: modalScope + }); + } - // Public API here - return { + // Public API here + return { - /* Confirmation modals */ - confirm: { + /* 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 = angular.noop) { /** - * 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) + * Open a delete confirmation modal + * @param {String} name - name or info to show on modal + * @param {All} - any additional args are passed straight to del callback */ - delete(del = angular.noop) { - /** - * Open a delete confirmation modal - * @param {String} name - name or info to show on modal - * @param {All} - any additional args are passed straight to del callback - */ - return function() { - var args = Array.prototype.slice.call(arguments), - name = args.shift(), - deleteModal; + return function() { + var args = Array.prototype.slice.call(arguments), + name = args.shift(), + deleteModal; - deleteModal = openModal({ - modal: { - dismissable: true, - title: 'Confirm Delete', - html: '

Are you sure you want to delete ' + name + ' ?

', - buttons: [{ - classes: 'btn-danger', - text: 'Delete', - click: function(e) { - deleteModal.close(e); - } - }, { - classes: 'btn-default', - text: 'Cancel', - click: function(e) { - deleteModal.dismiss(e); - } - }] - } - }, 'modal-danger'); + deleteModal = openModal({ + modal: { + dismissable: true, + title: 'Confirm Delete', + html: '

Are you sure you want to delete ' + name + ' ?

', + buttons: [{ + classes: 'btn-danger', + text: 'Delete', + click: function(e) { + deleteModal.close(e); + } + }, { + classes: 'btn-default', + text: 'Cancel', + click: function(e) { + deleteModal.dismiss(e); + } + }] + } + }, 'modal-danger'); - deleteModal.result.then(function(event) { - del.apply(event, args); - }); - }; - } + deleteModal.result.then(function(event) { + del.apply(event, args); + }); + }; } - }; - }); + } + }; +} + +export default angular.module('<%= scriptAppName %>') + .factory('Modal', Modal) + .name; diff --git a/templates/app/client/components/navbar/navbar(html).html b/templates/app/client/components/navbar/navbar(html).html index 4b6692d36..79d7b5a78 100644 --- a/templates/app/client/components/navbar/navbar(html).html +++ b/templates/app/client/components/navbar/navbar(html).html @@ -1,7 +1,7 @@ -