Merge pull request #209 from Phyks/gulp4

Bump gulp to version 4.0.2
This commit is contained in:
Norbert Renner 2019-06-20 22:49:59 +02:00 committed by GitHub
commit ebfdd7129a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 962 additions and 380 deletions

View file

@ -84,11 +84,18 @@ var paths = {
destName: 'brouter-web'
};
gulp.task('clean', function(cb) {
del(paths.dest + '/**/*', cb);
});
// 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
return gulp.src(paths.scriptsConfig).pipe(gulp.dest(paths.dest));
});
})
);
gulp.task('scripts', function() {
if (debug) gutil.log(gutil.colors.yellow('Running in Debug mode'));
@ -142,22 +149,18 @@ gulp.task('styles', function() {
.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'));
});
gulp.task('fonts', ['clean'], function() {
gulp.task('fonts', function() {
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'));
});
gulp.task('clean', function(cb) {
del(paths.dest + '/**/*', cb);
});
gulp.task('watch', function() {
debug = true;
var watcher = gulp.watch(paths.scripts, ['scripts']);
@ -200,17 +203,6 @@ gulp.task('inject', function() {
.pipe(gulp.dest('.'));
});
gulp.task('default', [
'clean',
'scripts_config',
'layers',
'scripts',
'styles',
'images',
'fonts',
'locales'
]);
gulp.task('debug', function() {
debug = true;
gulp.start('default');
@ -259,17 +251,20 @@ gulp.task('release:init', function() {
return;
});
gulp.task('bump', ['bump:json', 'bump:html']);
gulp.task('bump:json', ['release:init'], function() {
gulp.task(
'bump:json',
gulp.series('release:init', function() {
gutil.log(gutil.colors.green('Bump to ' + nextVersion));
return gulp
.src(['./package.json'])
.pipe(bump({ version: nextVersion }))
.pipe(gulp.dest('./'));
});
})
);
gulp.task('bump:html', ['release:init'], function() {
gulp.task(
'bump:html',
gulp.series('release:init', function() {
return gulp
.src('./index.html')
.pipe(
@ -279,58 +274,37 @@ gulp.task('bump:html', ['release:init'], function() {
)
)
.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
.src(['./index.html', './package.json'])
.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) {
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) {
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() {
return gulp
@ -366,7 +340,9 @@ gulp.task('layers_config', function() {
});
// 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 (
gulp
.src(paths.layers)
@ -388,4 +364,68 @@ gulp.task('layers', ['layers_config'], function() {
)
.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": {
"autoprefixer": "^8.1.0",
"del": "^1.1.1",
"gulp": "^3.8.11",
"gulp": "^4.0.2",
"gulp-bump": "^2.7.0",
"gulp-cached": "^1.0.4",
"gulp-clean-css": "^4.0.0",

1080
yarn.lock

File diff suppressed because it is too large Load diff