Skip to content

Commit

Permalink
Merge pull request #105 from onefinestay/sequentially-delete-dist-bef…
Browse files Browse the repository at this point in the history
…ore-building

Sequentially delete dist folder before building
  • Loading branch information
AlanFoster committed Nov 5, 2015
2 parents 562d7bd + bf2d989 commit 2f6d25b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
15 changes: 10 additions & 5 deletions gulpfile.babel.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import React from 'react';
import webpack from 'webpack';
import { Server as KarmaServer } from 'karma';
import clean from 'del';
import runSequence from 'run-sequence';

const plugins = gulpLoadPlugins();
const PRODUCTION = (process.env.NODE_ENV === 'production');
Expand Down Expand Up @@ -109,11 +110,11 @@ gulp.task('test-coverage', ['lint'], function (done) {
}, done).start();
});

gulp.task('clean-dist-js', function() {
gulp.task('clean-dist', function() {
return clean('dist');
});

gulp.task('build-dist-js', ['clean-dist-js'], function() {
gulp.task('build-dist-js', function() {
// build javascript files
return gulp.src(['src/**/*.{js,jsx}', '!src/**/tests/**', '!src/tests.webpack.js'])
.pipe(plugins.babel({
Expand All @@ -131,6 +132,10 @@ gulp.task('build-dist-scss', function() {
.pipe(gulp.dest('./dist/css'));
});

gulp.task('build-dist', function(callback) {
runSequence('clean-dist', ['build-dist-js', 'build-dist-scss'], callback);
});

gulp.task('build-example-js', function() {
var compiler = plugins.webpack(webpackConfig, webpack);

Expand Down Expand Up @@ -180,10 +185,10 @@ gulp.task('example-server', function() {
});
});

gulp.task('build', ['build-dist-js', 'build-example', 'build-example-js', 'build-example-scss']);
gulp.task('build', ['build-dist', 'build-example', 'build-example-js', 'build-example-scss']);
gulp.task('develop', ['test-unit', 'build-example', 'watch-example-js', 'watch-example-scss', 'example-server']);

gulp.task('deploy-example', ['build'], function() {
return gulp.src(paths.src)
.pipe(plugins.deploy());
return gulp.src('./example/**/*')
.pipe(plugins.ghPages());
});
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"test": "gulp test-coverage",
"lint": "gulp lint",
"deploy-example": "gulp deploy-example",
"prepublish": "gulp build-dist-scss"
"prepublish": "gulp build-dist"
},
"style": "./dist/css/react-calendar.css",
"files": [
Expand Down Expand Up @@ -86,6 +86,7 @@
"karma-webpack": "^1.7.0",
"object.assign": "^1.1.1",
"phantomjs": "^1.9.18",
"run-sequence": "~1.1.4",
"timekeeper": "0.0.5",
"transform-loader": "^0.2.1",
"underscore": "^1.8.3",
Expand Down

0 comments on commit 2f6d25b

Please sign in to comment.