Skip to content

Commit 37d698a

Browse files
committed
fix(gulp): tests, build
1 parent 021534e commit 37d698a

File tree

1 file changed

+20
-12
lines changed

1 file changed

+20
-12
lines changed

Diff for: app/templates/gulpfile.babel(gulp).js

+20-12
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ const paths = {
4141
},
4242
server: {
4343
scripts: ['server/**/*.<%= scriptExt %>'],
44+
json: ['server/**/*.json'],
4445
test: [
4546
'server/**/*.spec.js',
4647
'server/**/*.mock.js',
@@ -177,12 +178,18 @@ gulp.task('styles', () => {
177178
.pipe(gulp.dest('.tmp/app'));
178179
});<% if(filters.babel || filters.coffee) { %>
179180

180-
gulp.task('transpile', () => {
181+
gulp.task('transpile:client', () => {
181182
return gulp.src(paths.client.scripts)
182183
.pipe(transpile())
183184
.pipe(gulp.dest('.tmp'));
184185
});<% } %>
185186

187+
gulp.task('transpile:server', () => {
188+
return gulp.src(_.union(paths.server.scripts, paths.server.json))
189+
.pipe(transpile())
190+
.pipe(gulp.dest(paths.dist + '/server'));
191+
});
192+
186193
gulp.task('lint:scripts', cb => runSequence(['lint:scripts:client', 'lint:scripts:server'], cb));
187194

188195
gulp.task('lint:scripts:client', () => {
@@ -246,12 +253,8 @@ gulp.task('watch', () => {
246253
});
247254

248255
gulp.task('serve', cb => {
249-
runSequence('clean:tmp',
250-
['lint:scripts'],
251-
'inject:js',
252-
'inject:css',
253-
'wiredep:client',<% if(filters.babel || filters.coffee) { %>
254-
['transpile', 'styles'],<% } else { %>
256+
runSequence(['clean:tmp', 'lint:scripts', 'inject', 'wiredep:client'],<% if(filters.babel || filters.coffee) { %>
257+
['transpile:client', 'styles'],<% } else { %>
255258
'styles',<% } %>
256259
['start:server', 'start:client'],
257260
'watch',
@@ -261,7 +264,12 @@ gulp.task('serve', cb => {
261264
gulp.task('test:server', () => {
262265
process.env.NODE_ENV = 'test';
263266
return gulp.src(paths.server.test)
264-
.pipe(plugins.mocha({reporter: 'spec'}));
267+
.pipe(plugins.mocha({
268+
reporter: 'spec',
269+
require: [
270+
'./mocha.conf'
271+
]
272+
}));
265273
});
266274

267275
gulp.task('test:client', () => {
@@ -321,14 +329,15 @@ gulp.task('build', cb => {
321329
'copy:extras',
322330
'copy:assets',
323331
'copy:server',
332+
'transpile:server',
324333
'build:client'
325334
],
326335
cb);
327336
});
328337

329338
gulp.task('clean:dist', () => gulp.src('dist', {read: false}).pipe(plugins.clean()));
330339

331-
gulp.task('build:client', ['transpile', 'styles', 'html'], () => {
340+
gulp.task('build:client', ['transpile:client', 'styles', 'html'], () => {
332341
var appFilter = plugins.filter('**/app.js');
333342
var jsFilter = plugins.filter('**/*.js');
334343
var cssFilter = plugins.filter('**/*.css');
@@ -362,7 +371,7 @@ gulp.task('build:client', ['transpile', 'styles', 'html'], () => {
362371
gulp.task('html', function () {
363372
return gulp.src('client/{app,components}/**/*.html')
364373
.pipe(plugins.angularTemplatecache({
365-
module: 'testApp'
374+
module: '<%= scriptAppName %>'
366375
}))
367376
.pipe(gulp.dest('.tmp'));
368377
});
@@ -394,8 +403,7 @@ gulp.task('copy:server', () => {
394403
return gulp.src([
395404
'package.json',
396405
'bower.json',
397-
'.bowerrc',
398-
'server/**/*'
406+
'.bowerrc'
399407
], {cwdbase: true})
400408
.pipe(gulp.dest(paths.dist));
401409
});

0 commit comments

Comments
 (0)