Bump gulp to version 4.0.2.

This commit is contained in:
Phyks (Lucas Verney) 2019-06-20 17:26:18 +02:00
parent ef41a9e5ff
commit 057104331b
4 changed files with 962 additions and 380 deletions

View file

@ -84,11 +84,18 @@ var paths = {
destName: 'brouter-web' destName: 'brouter-web'
}; };
gulp.task('clean', function(cb) {
del(paths.dest + '/**/*', cb);
});
// libs that require loading before config.js // libs that require loading before config.js
gulp.task('scripts_config', ['clean'], function() { gulp.task(
'scripts_config',
gulp.series('clean', function() {
// just copy for now // just copy for now
return gulp.src(paths.scriptsConfig).pipe(gulp.dest(paths.dest)); return gulp.src(paths.scriptsConfig).pipe(gulp.dest(paths.dest));
}); })
);
gulp.task('scripts', function() { gulp.task('scripts', function() {
if (debug) gutil.log(gutil.colors.yellow('Running in Debug mode')); if (debug) gutil.log(gutil.colors.yellow('Running in Debug mode'));
@ -142,22 +149,18 @@ gulp.task('styles', function() {
.pipe(gulp.dest(paths.dest)); .pipe(gulp.dest(paths.dest));
}); });
gulp.task('images', ['clean'], function() { gulp.task('images', function() {
return gulp.src(paths.images).pipe(gulp.dest(paths.dest + '/images')); return gulp.src(paths.images).pipe(gulp.dest(paths.dest + '/images'));
}); });
gulp.task('fonts', ['clean'], function() { gulp.task('fonts', function() {
return gulp.src(paths.fonts).pipe(gulp.dest(paths.dest + '/fonts')); return gulp.src(paths.fonts).pipe(gulp.dest(paths.dest + '/fonts'));
}); });
gulp.task('locales', ['clean'], function() { gulp.task('locales', function() {
return gulp.src(paths.locales).pipe(gulp.dest(paths.dest + '/locales')); return gulp.src(paths.locales).pipe(gulp.dest(paths.dest + '/locales'));
}); });
gulp.task('clean', function(cb) {
del(paths.dest + '/**/*', cb);
});
gulp.task('watch', function() { gulp.task('watch', function() {
debug = true; debug = true;
var watcher = gulp.watch(paths.scripts, ['scripts']); var watcher = gulp.watch(paths.scripts, ['scripts']);
@ -200,17 +203,6 @@ gulp.task('inject', function() {
.pipe(gulp.dest('.')); .pipe(gulp.dest('.'));
}); });
gulp.task('default', [
'clean',
'scripts_config',
'layers',
'scripts',
'styles',
'images',
'fonts',
'locales'
]);
gulp.task('debug', function() { gulp.task('debug', function() {
debug = true; debug = true;
gulp.start('default'); gulp.start('default');
@ -259,17 +251,20 @@ gulp.task('release:init', function() {
return; return;
}); });
gulp.task('bump', ['bump:json', 'bump:html']); gulp.task(
'bump:json',
gulp.task('bump:json', ['release:init'], function() { gulp.series('release:init', function() {
gutil.log(gutil.colors.green('Bump to ' + nextVersion)); gutil.log(gutil.colors.green('Bump to ' + nextVersion));
return gulp return gulp
.src(['./package.json']) .src(['./package.json'])
.pipe(bump({ version: nextVersion })) .pipe(bump({ version: nextVersion }))
.pipe(gulp.dest('./')); .pipe(gulp.dest('./'));
}); })
);
gulp.task('bump:html', ['release:init'], function() { gulp.task(
'bump:html',
gulp.series('release:init', function() {
return gulp return gulp
.src('./index.html') .src('./index.html')
.pipe( .pipe(
@ -279,58 +274,37 @@ gulp.task('bump:html', ['release:init'], function() {
) )
) )
.pipe(gulp.dest('.')); .pipe(gulp.dest('.'));
}); })
);
gulp.task('release:commit', ['bump'], function() { gulp.task('bump', gulp.series('bump:json', 'bump:html'));
gulp.task(
'release:commit',
gulp.series('bump', function() {
return gulp return gulp
.src(['./index.html', './package.json']) .src(['./index.html', './package.json'])
.pipe(git.commit('release: ' + nextVersion)); .pipe(git.commit('release: ' + nextVersion));
}); })
);
gulp.task('release:tag', ['release:commit'], function() { gulp.task(
'release:tag',
gulp.series('release:commit', function() {
return git.tag(nextVersion, '', function(err) { return git.tag(nextVersion, '', function(err) {
if (err) throw err; if (err) throw err;
}); });
}); })
);
gulp.task('release:push', ['release:tag'], function() { gulp.task(
'release:push',
gulp.series('release:tag', function() {
git.push('origin', 'master', { args: '--tags' }, function(err) { git.push('origin', 'master', { args: '--tags' }, function(err) {
if (err) throw err; if (err) throw err;
}); });
});
gulp.task('release:zip', ['release:tag', 'default'], function() {
gutil.log(gutil.colors.green('Build brouter-web.' + nextVersion + '.zip'));
return gulp
.src(
['dist/**', 'index.html', 'config.template.js', 'keys.template.js'],
{
base: '.'
}
)
.pipe(zip('brouter-web.' + nextVersion + '.zip'))
.pipe(gulp.dest('.'));
});
gulp.task('release:publish', ['release:zip'], function() {
gulp.src('./brouter-web.' + nextVersion + '.zip').pipe(
release({
tag: nextVersion,
token: ghToken,
manifest: pkg
}) })
); );
});
gulp.task('release', [
'release:init',
'bump',
'release:commit',
'release:tag',
'release:push',
'release:zip',
'release:publish'
]);
gulp.task('i18next', function() { gulp.task('i18next', function() {
return gulp return gulp
@ -366,7 +340,9 @@ gulp.task('layers_config', function() {
}); });
// Bundles layer files. To download and extract run "yarn layers" // Bundles layer files. To download and extract run "yarn layers"
gulp.task('layers', ['layers_config'], function() { gulp.task(
'layers',
gulp.series('layers_config', function() {
return ( return (
gulp gulp
.src(paths.layers) .src(paths.layers)
@ -388,4 +364,68 @@ gulp.task('layers', ['layers_config'], function() {
) )
.pipe(gulp.dest(paths.dest)) .pipe(gulp.dest(paths.dest))
); );
}); })
);
gulp.task(
'default',
gulp.series(
'clean',
'scripts_config',
'layers',
'scripts',
'styles',
'images',
'fonts',
'locales'
)
);
gulp.task(
'release:zip',
gulp.series('release:tag', 'default', function() {
gutil.log(
gutil.colors.green('Build brouter-web.' + nextVersion + '.zip')
);
return gulp
.src(
[
'dist/**',
'index.html',
'config.template.js',
'keys.template.js'
],
{
base: '.'
}
)
.pipe(zip('brouter-web.' + nextVersion + '.zip'))
.pipe(gulp.dest('.'));
})
);
gulp.task(
'release:publish',
gulp.series('release:zip', function() {
gulp.src('./brouter-web.' + nextVersion + '.zip').pipe(
release({
tag: nextVersion,
token: ghToken,
manifest: pkg
})
);
})
);
gulp.task(
'release',
gulp.series(
'release:init',
'bump',
'release:commit',
'release:tag',
'release:push',
'release:zip',
'release:publish'
)
);

View file

@ -63,7 +63,7 @@
"devDependencies": { "devDependencies": {
"autoprefixer": "^8.1.0", "autoprefixer": "^8.1.0",
"del": "^1.1.1", "del": "^1.1.1",
"gulp": "^3.8.11", "gulp": "^4.0.2",
"gulp-bump": "^2.7.0", "gulp-bump": "^2.7.0",
"gulp-cached": "^1.0.4", "gulp-cached": "^1.0.4",
"gulp-clean-css": "^4.0.0", "gulp-clean-css": "^4.0.0",

1080
yarn.lock

File diff suppressed because it is too large Load diff