Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 9 additions & 20 deletions app/templates/Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ module.exports = function (grunt) {
},
dev: {
options: {
script: 'server/app.js',
script: 'server',
debug: true
}
},
prod: {
options: {
script: 'dist/server/app.js'
script: 'dist/server'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

explain!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nevermind, I see you made a bootstrap index.js 👍

}
}
},
Expand All @@ -61,7 +61,7 @@ module.exports = function (grunt) {
'!<%%= yeoman.client %>/{app,components}/**/*.spec.js',
'!<%%= yeoman.client %>/{app,components}/**/*.mock.js',
'!<%%= yeoman.client %>/app/app.js'],
tasks: ['injector:scripts']
tasks: [<% if(filters.babel) { %>'newer:babel:client', <% } %>'injector:scripts']
},
injectCss: {
files: [
Expand Down Expand Up @@ -128,13 +128,6 @@ module.exports = function (grunt) {
'<%%= yeoman.client %>/{app,components}/**/*.spec.{coffee,litcoffee,coffee.md}'
],
tasks: ['karma']
},<% } %><% if(filters.babel) { %>
babel: {
files: [
'<%%= yeoman.client %>/{app,components}/**/*.js',
'!<%%= yeoman.client %>/{app,components}/**/*.spec.js'
],
tasks: ['babel']
},<% } %>
gruntfile: {
files: ['Gruntfile.js']
Expand All @@ -143,11 +136,7 @@ module.exports = function (grunt) {
files: [
'{.tmp,<%%= yeoman.client %>}/{app,components}/**/*.css',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't need the config?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're already watching the exact same files in the watch.injectJS config; so we can just add our task there.

'{.tmp,<%%= yeoman.client %>}/{app,components}/**/*.html',
<% if(filters.babel) { %>
'.tmp/{app,components}/**/*.js',
<% } else { %>
'{.tmp,<%%= yeoman.client %>}/{app,components}/**/*.js',
<% } %>
'!{.tmp,<%%= yeoman.client %>}{app,components}/**/*.spec.js',
'!{.tmp,<%%= yeoman.client %>}/{app,components}/**/*.mock.js',
'<%%= yeoman.client %>/assets/images/{,*//*}*.{png,jpg,jpeg,gif,webp,svg}'
Expand Down Expand Up @@ -261,7 +250,7 @@ module.exports = function (grunt) {
// Use nodemon to run server in debug mode with an initial breakpoint
nodemon: {
debug: {
script: 'server/app.js',
script: 'server',
options: {
nodeArgs: ['--debug-brk'],
env: {
Expand Down Expand Up @@ -470,15 +459,15 @@ module.exports = function (grunt) {
concurrent: {
server: [<% if(filters.coffee) { %>
'coffee',<% } %><% if(filters.babel) { %>
'babel',<% } %><% if(filters.jade) { %>
'newer:babel:client',<% } %><% if(filters.jade) { %>
'jade',<% } %><% if(filters.stylus) { %>
'stylus',<% } %><% if(filters.sass) { %>
'sass',<% } %><% if(filters.less) { %>
'less',<% } %>
],
test: [<% if(filters.coffee) { %>
'coffee',<% } %><% if(filters.babel) { %>
'babel',<% } %><% if(filters.jade) { %>
'newer:babel:client',<% } %><% if(filters.jade) { %>
'jade',<% } %><% if(filters.stylus) { %>
'stylus',<% } %><% if(filters.sass) { %>
'sass',<% } %><% if(filters.less) { %>
Expand All @@ -495,7 +484,7 @@ module.exports = function (grunt) {
},
dist: [<% if(filters.coffee) { %>
'coffee',<% } %><% if(filters.babel) { %>
'babel',<% } %><% if(filters.jade) { %>
'newer:babel:client',<% } %><% if(filters.jade) { %>
'jade',<% } %><% if(filters.stylus) { %>
'stylus',<% } %><% if(filters.sass) { %>
'sass',<% } %><% if(filters.less) { %>
Expand Down Expand Up @@ -639,10 +628,10 @@ module.exports = function (grunt) {
options: {
sourceMap: true
},
server: {
client: {
files: [{
expand: true,
cwd: 'client',
cwd: '<%%= yeoman.client %>',
src: [
'{app,components}/**/*.js',
'!{app,components}/**/*.spec.js'
Expand Down
5 changes: 3 additions & 2 deletions app/templates/_package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"express-session": "~1.0.2",
"errorhandler": "~1.0.0",
"compression": "~1.0.1",
"lodash": "~2.4.1",<% if (filters.jade) { %>
"lodash": "~2.4.1",<% if(filters.babel) { %>
"babel-core": "^5.6.4",<% } %><% if (filters.jade) { %>
"jade": "~1.2.0",<% } %><% if (filters.html) { %>
"ejs": "~0.8.4",<% } %><% if (filters.mongoose) { %>
"mongoose": "~3.8.8",
Expand Down Expand Up @@ -106,7 +107,7 @@
"node": ">=0.10.0"
},
"scripts": {
"start": "node server/app.js",
"start": "node server",
"test": "grunt test",
"update-webdriver": "node node_modules/grunt-protractor-runner/node_modules/protractor/bin/webdriver-manager update"
},
Expand Down
5 changes: 4 additions & 1 deletion app/templates/mocha.conf.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
'use strict';
'use strict';<% if(filters.babel) { %>

// Register the Babel require hook
require('babel-core/register');<% } %>

var chai = require('chai');

Expand Down
7 changes: 7 additions & 0 deletions app/templates/server/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
'use strict';<% if (filters.babel) { %>

// Register the Babel require hook
require('babel-core/register');<% } %>

// Export the application
exports = module.exports = require('./app');
45 changes: 2 additions & 43 deletions test/test-file-creation.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ var recursiveReadDir = require('recursive-readdir');
describe('angular-fullstack generator', function () {
var gen, defaultOptions = {
script: 'js',
babel: true,
markup: 'html',
stylesheet: 'sass',
router: 'uirouter',
Expand Down Expand Up @@ -176,6 +177,7 @@ describe('angular-fullstack generator', function () {
'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',
Expand Down Expand Up @@ -476,49 +478,6 @@ describe('angular-fullstack generator', function () {
}
});

describe('with Babel ES6 preprocessor', function() {
beforeEach(function() {
helpers.mockPrompt(gen, {
script: 'js',
babel: true,
markup: 'jade',
stylesheet: 'less',
router: 'uirouter'
});
});

it('should run client tests successfully', function(done) {
this.timeout(60000);
gen.run({}, function () {
exec('grunt test:client', function (error, stdout, stderr) {
expect(stdout, 'Client tests failed \n' + stdout ).to.contain('Executed 1 of 1 SUCCESS');
done();
});
});
});

it('should pass jshint', function(done) {
this.timeout(60000);
gen.run({}, function () {
exec('grunt jshint', function (error, stdout, stderr) {
expect(stdout).to.contain('Done, without errors.');
done();
});
});
});

it('should run server tests successfully', function(done) {
this.timeout(60000);
gen.run({}, function () {
exec('grunt test:server', function (error, stdout, stderr) {
expect(stdout, 'Server tests failed (do you have mongoDB running?) \n' + stdout).to.contain('Done, without errors.');
done();
});
});
});
});


describe('with other preprocessors and oauth', function() {
var testOptions = {
script: 'coffee',
Expand Down