Switch from Rimraf to Del for deleting in Gulp.

This commit is contained in:
Jürg Lehni 2016-01-17 05:16:58 +01:00
parent 9dec7a1a77
commit bb20e3a4a7
2 changed files with 20 additions and 10 deletions

View file

@ -14,14 +14,14 @@ var gulp = require('gulp'),
qunit = require('gulp-qunit'), qunit = require('gulp-qunit'),
prepro = require('gulp-prepro'), prepro = require('gulp-prepro'),
rename = require('gulp-rename'), rename = require('gulp-rename'),
rimraf = require('gulp-rimraf'),
shell = require('gulp-shell'), shell = require('gulp-shell'),
symlink = require('gulp-symlink'), symlink = require('gulp-symlink'),
uglify = require('gulp-uglify'), uglify = require('gulp-uglify'),
uncomment = require('gulp-uncomment'), uncomment = require('gulp-uncomment'),
whitespace = require('gulp-whitespace'), whitespace = require('gulp-whitespace'),
zip = require('gulp-zip'),
merge = require('merge-stream'), merge = require('merge-stream'),
del = require('del'),
zip = require('gulp-zip'),
gitty = require('gitty')('.'), gitty = require('gitty')('.'),
fs = require('fs'); fs = require('fs');
@ -48,6 +48,8 @@ var uglifyOptions = {
var buildNames = Object.keys(buildOptions); var buildNames = Object.keys(buildOptions);
var docNames = Object.keys(docOptions); var docNames = Object.keys(docOptions);
gulp.task('default', ['dist']);
gulp.on('error', function(err) { gulp.on('error', function(err) {
console.error(err.toString()); console.error(err.toString());
gulp.emit('end'); gulp.emit('end');
@ -59,7 +61,7 @@ gulp.task('test', function() {
}); });
docNames.forEach(function(name) { docNames.forEach(function(name) {
gulp.task('docs:' + name, shell.task([ gulp.task('docs:' + name, ['clean:docs'], shell.task([
'java -cp jsrun.jar:lib/* JsRun app/run.js -c=conf/' + name + '.conf ' + 'java -cp jsrun.jar:lib/* JsRun app/run.js -c=conf/' + name + '.conf ' +
'-D="renderMode:' + docOptions[name] + '"', '-D="renderMode:' + docOptions[name] + '"',
], { ], {
@ -69,6 +71,13 @@ docNames.forEach(function(name) {
gulp.task('docs', ['docs:local']); gulp.task('docs', ['docs:local']);
gulp.task('clean:docs', function(callback) {
return del([
'dist/docs/**',
'dist/serverdocs/**'
]);
});
gulp.task('load', ['clean:load'], function() { gulp.task('load', ['clean:load'], function() {
return gulp.src('src/load.js') return gulp.src('src/load.js')
.pipe(symlink('dist/paper-full.js')) .pipe(symlink('dist/paper-full.js'))
@ -76,11 +85,10 @@ gulp.task('load', ['clean:load'], function() {
}); });
gulp.task('clean:load', function() { gulp.task('clean:load', function() {
return gulp.src([ return del([
'dist/paper-full.js', 'dist/paper-full.js',
'dist/paper-node.js' 'dist/paper-node.js'
], { read: false }) ]);
.pipe(rimraf());
}); });
gulp.task('build', gulp.task('build',
@ -150,8 +158,9 @@ buildNames.forEach(function(name) {
gulp.task('build:start', ['clean:build', 'minify:acorn']); gulp.task('build:start', ['clean:build', 'minify:acorn']);
gulp.task('clean:build', function() { gulp.task('clean:build', function() {
return gulp.src('dist/paper-*.js', { read: false }) return del([
.pipe(rimraf()); 'dist/paper-*.js'
]);
}); });
gulp.task('minify:acorn', function() { gulp.task('minify:acorn', function() {

View file

@ -36,6 +36,7 @@
"canvas": ">=1.2.9 <2.0.0" "canvas": ">=1.2.9 <2.0.0"
}, },
"devDependencies": { "devDependencies": {
"del": "^2.2.0",
"gitty": "^3.3.3", "gitty": "^3.3.3",
"gulp": "^3.9.0", "gulp": "^3.9.0",
"gulp-prepro": "^2.0.0", "gulp-prepro": "^2.0.0",