Skip to content

Commit e6eff5d

Browse files
committed
feat(app): grunt build now moves all files into a dist folder
this creates a cleaner folder structure, and makes it much more clear what files need to be deployed. this also depricates the heroku task, use grunt build instead. yo angular-fullstack:deploy heroku will also use the dist folder now. closes #24
1 parent 7e001d3 commit e6eff5d

File tree

3 files changed

+48
-58
lines changed

3 files changed

+48
-58
lines changed

Diff for: deploy/index.js

+8-8
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,15 @@ Generator.prototype.checkInstallation = function checkInstallation() {
2828

2929
Generator.prototype.copyProcfile = function copyProcfile() {
3030
if(this.name.toLowerCase() != "heroku") return;
31-
this.template('../deploy/heroku/Procfile', 'heroku/Procfile');
31+
this.template('../deploy/heroku/Procfile', 'dist/Procfile');
3232
};
3333

3434
Generator.prototype.gruntBuild = function gruntBuild() {
3535
if(this.name.toLowerCase() != "heroku") return;
3636
var done = this.async();
3737

38-
console.log(chalk.bold('Building heroku folder, please wait...'));
39-
exec('grunt heroku', function (err, stdout) {
38+
console.log(chalk.bold('Building dist folder, please wait...'));
39+
exec('grunt build', function (err, stdout) {
4040
console.log('stdout: ' + stdout);
4141

4242
if (err) {
@@ -50,7 +50,7 @@ Generator.prototype.gitInit = function gitInit() {
5050
if(this.name.toLowerCase() != "heroku") return;
5151
var done = this.async();
5252

53-
exec('git init && git add -A && git commit -m "Initial commit"', { cwd: 'heroku' }, function (err) {
53+
exec('git init && git add -A && git commit -m "Initial commit"', { cwd: 'dist' }, function (err) {
5454
if (err) {
5555
this.log.error(err);
5656
}
@@ -62,15 +62,15 @@ Generator.prototype.herokuCreate = function herokuCreate() {
6262
if(this.name.toLowerCase() != "heroku") return;
6363
var done = this.async();
6464

65-
exec('heroku apps:create && heroku config:set NODE_ENV=production', { cwd: 'heroku' }, function (err, stdout, stderr) {
65+
exec('heroku apps:create && heroku config:set NODE_ENV=production', { cwd: 'dist' }, function (err, stdout, stderr) {
6666
if (err) {
6767
this.log.error(err);
6868
} else {
6969
console.log('stdout: ' + stdout);
7070
console.log(chalk.green('You\'re all set! Now push to heroku with\n\t' + chalk.bold('git push heroku master') +
71-
'\nfrom your new heroku folder'));
72-
console.log(chalk.yellow('After app modification run\n\t' + chalk.bold('grunt heroku') +
73-
'\nthen commit and push the heroku folder'));
71+
'\nfrom your new distribution folder'));
72+
console.log(chalk.yellow('After app modification run\n\t' + chalk.bold('grunt build') +
73+
'\nthen commit and push the dist folder'));
7474
}
7575
done();
7676
}.bind(this));

Diff for: templates/common/Gruntfile.js

+39-50
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Generated on <%= (new Date).toISOString().split('T')[0] %> using <%= pkg.name %> <%= pkg.version %>
1+
// Generated on <%%= (new Date).toISOString().split('T')[0] %> using <%%= pkg.name %> <%%= pkg.version %>
22
'use strict';
33

44
// # Globbing
@@ -22,8 +22,7 @@ module.exports = function (grunt) {
2222
yeoman: {
2323
// configurable paths
2424
app: require('./bower.json').appPath || 'app',
25-
dist: 'public',
26-
views: 'views'
25+
dist: 'dist'
2726
},
2827
express: {
2928
options: {
@@ -37,7 +36,7 @@ module.exports = function (grunt) {
3736
},
3837
prod: {
3938
options: {
40-
script: 'server.js',
39+
script: 'dist/server.js',
4140
node_env: 'production'
4241
}
4342
}
@@ -80,7 +79,7 @@ module.exports = function (grunt) {
8079
},
8180
livereload: {
8281
files: [
83-
'<%%= yeoman.app %>/<%%= yeoman.views %>/{,*//*}*.{html,jade}',
82+
'<%%= yeoman.app %>/views/{,*//*}*.{html,jade}',
8483
'{.tmp,<%%= yeoman.app %>}/styles/{,*//*}*.css',
8584
'{.tmp,<%%= yeoman.app %>}/scripts/{,*//*}*.js',
8685
'<%%= yeoman.app %>/images/{,*//*}*.{png,jpg,jpeg,gif,webp,svg}',
@@ -133,9 +132,9 @@ module.exports = function (grunt) {
133132
dot: true,
134133
src: [
135134
'.tmp',
136-
'<%%= yeoman.views %>/*',
137-
'<%%= yeoman.dist %>/*',
138-
'!<%%= yeoman.dist %>/.git*'
135+
'<%%= yeoman.dist %>/views/*',
136+
'<%%= yeoman.dist %>/public/*',
137+
'!<%%= yeoman.dist %>/public/.git*',
139138
]
140139
}]
141140
},
@@ -174,8 +173,8 @@ module.exports = function (grunt) {
174173
html: '<%%= yeoman.app %>/views/index.html',<% } %>
175174
ignorePath: '<%%= yeoman.app %>/'
176175
}
177-
},
178-
<% if (coffee) { %>
176+
},<% if (coffee) { %>
177+
179178
// Compiles CoffeeScript to JavaScript
180179
coffee: {
181180
options: {
@@ -200,8 +199,8 @@ module.exports = function (grunt) {
200199
ext: '.js'
201200
}]
202201
}
203-
},<% } %>
204-
<% if (compass) { %>
202+
},<% } %><% if (compass) { %>
203+
205204
// Compiles Sass to CSS and generates necessary files if requested
206205
compass: {
207206
options: {
@@ -221,7 +220,7 @@ module.exports = function (grunt) {
221220
},
222221
dist: {
223222
options: {
224-
generatedImagesDir: '<%%= yeoman.dist %>/images/generated'
223+
generatedImagesDir: '<%%= yeoman.dist %>/public/images/generated'
225224
}
226225
},
227226
server: {
@@ -236,10 +235,10 @@ module.exports = function (grunt) {
236235
dist: {
237236
files: {
238237
src: [
239-
'<%%= yeoman.dist %>/scripts/{,*/}*.js',
240-
'<%%= yeoman.dist %>/styles/{,*/}*.css',
241-
'<%%= yeoman.dist %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}',
242-
'<%%= yeoman.dist %>/styles/fonts/*'
238+
'<%%= yeoman.dist %>/public/scripts/{,*/}*.js',
239+
'<%%= yeoman.dist %>/public/styles/{,*/}*.css',
240+
'<%%= yeoman.dist %>/public/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}',
241+
'<%%= yeoman.dist %>/public/styles/fonts/*'
243242
]
244243
}
245244
}
@@ -249,20 +248,20 @@ module.exports = function (grunt) {
249248
// concat, minify and revision files. Creates configurations in memory so
250249
// additional tasks can operate on them
251250
useminPrepare: {
252-
html: ['<%%= yeoman.app %>/<%%= yeoman.views %>/index.html',
253-
'<%%= yeoman.app %>/<%%= yeoman.views %>/index.jade'],
251+
html: ['<%%= yeoman.app %>/views/index.html',
252+
'<%%= yeoman.app %>/views/index.jade'],
254253
options: {
255-
dest: '<%%= yeoman.dist %>'
254+
dest: '<%%= yeoman.dist %>/public'
256255
}
257256
},
258257

259258
// Performs rewrites based on rev and the useminPrepare configuration
260259
usemin: {
261-
html: ['<%%= yeoman.views %>/{,*/}*.html',
262-
'<%%= yeoman.views %>/{,*/}*.jade'],
260+
html: ['<%%= yeoman.dist %>/views/{,*/}*.html',
261+
'<%%= yeoman.dist %>/views/{,*/}*.jade'],
263262
css: ['<%%= yeoman.dist %>/styles/{,*/}*.css'],
264263
options: {
265-
assetsDirs: ['<%%= yeoman.dist %>']
264+
assetsDirs: ['<%%= yeoman.dist %>/public']
266265
}
267266
},
268267

@@ -273,20 +272,22 @@ module.exports = function (grunt) {
273272
expand: true,
274273
cwd: '<%%= yeoman.app %>/images',
275274
src: '{,*/}*.{png,jpg,jpeg,gif}',
276-
dest: '<%%= yeoman.dist %>/images'
275+
dest: '<%%= yeoman.dist %>/public/images'
277276
}]
278277
}
279278
},
279+
280280
svgmin: {
281281
dist: {
282282
files: [{
283283
expand: true,
284284
cwd: '<%%= yeoman.app %>/images',
285285
src: '{,*/}*.svg',
286-
dest: '<%%= yeoman.dist %>/images'
286+
dest: '<%%= yeoman.dist %>/public/images'
287287
}]
288288
}
289289
},
290+
290291
htmlmin: {
291292
dist: {
292293
options: {
@@ -297,9 +298,9 @@ module.exports = function (grunt) {
297298
},
298299
files: [{
299300
expand: true,
300-
cwd: '<%%= yeoman.app %>/<%%= yeoman.views %>',
301+
cwd: '<%%= yeoman.app %>/views',
301302
src: ['*.html', 'partials/*.html'],
302-
dest: '<%%= yeoman.views %>'
303+
dest: '<%%= yeoman.dist %>/views'
303304
}]
304305
}
305306
},
@@ -320,7 +321,7 @@ module.exports = function (grunt) {
320321
// Replace Google CDN references
321322
cdnify: {
322323
dist: {
323-
html: ['<%%= yeoman.views %>/*.html']
324+
html: ['<%%= yeoman.dist %>/views/*.html']
324325
}
325326
},
326327

@@ -331,7 +332,7 @@ module.exports = function (grunt) {
331332
expand: true,
332333
dot: true,
333334
cwd: '<%%= yeoman.app %>',
334-
dest: '<%%= yeoman.dist %>',
335+
dest: '<%%= yeoman.dist %>/public',
335336
src: [
336337
'*.{ico,png,txt}',
337338
'.htaccess',
@@ -342,28 +343,17 @@ module.exports = function (grunt) {
342343
}, {
343344
expand: true,
344345
dot: true,
345-
cwd: '<%%= yeoman.app %>/<%%= yeoman.views %>',
346-
dest: '<%%= yeoman.views %>',
347-
src: '**/*.jade',
346+
cwd: '<%%= yeoman.app %>/views',
347+
dest: '<%%= yeoman.dist %>/views',
348+
src: '**/*.jade'
348349
}, {
349350
expand: true,
350351
cwd: '.tmp/images',
351-
dest: '<%%= yeoman.dist %>/images',
352+
dest: '<%%= yeoman.dist %>/public/images',
352353
src: ['generated/*']
353-
}]
354-
},
355-
heroku: {
356-
files: [{
357-
expand: true,
358-
dot: true,
359-
dest: 'heroku',
360-
src: [
361-
'<%%= yeoman.dist %>/**',
362-
'<%%= yeoman.views %>/**'
363-
]
364354
}, {
365355
expand: true,
366-
dest: 'heroku',
356+
dest: '<%%= yeoman.dist %>',
367357
src: [
368358
'package.json',
369359
'server.js',
@@ -484,11 +474,10 @@ module.exports = function (grunt) {
484474
'usemin'
485475
]);
486476

487-
grunt.registerTask('heroku', [
488-
'build',
489-
'clean:heroku',
490-
'copy:heroku'
491-
]);
477+
grunt.registerTask('heroku', function () {
478+
grunt.log.warn('The `heroku` task has been deprecated. Use `grunt build` to build for deployment.');
479+
grunt.task.run(['build']);
480+
});
492481

493482
grunt.registerTask('default', [
494483
'newer:jshint',

Diff for: templates/common/gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ public
55
app/bower_components
66
heroku
77
/views
8+
dist

0 commit comments

Comments
 (0)