Migrate from gulp 3.x to 4.x dirtily

This commit is contained in:
Ilya Ig. Petrov 2019-02-24 16:47:27 +00:00
parent 2ce48cbd50
commit 927fd7d043
4 changed files with 2827 additions and 1157 deletions

View File

@ -1,8 +1,5 @@
# Install
Nodejs 10 and gulp have [issues](https://github.com/nodejs/node/issues/20285),
use nodejs 8 instead for a while.
```
npm install
cd src/extension-common/pages/options/
@ -14,10 +11,7 @@ use your build/extension-beta
# Release
1. `vim src/extension-common/pages/options/src/components/App.js`
2. Change github link there.
3. `npm run release`
4. Change `App.js` back to original: `git checkout src/extension-common/pages/options/src/components/App.js`
5. `vim src/templates-data.js` and bump version.
6. Commit bumped version.
7. Merge development to production (usually after deployment and testing and many patches).
1. `npm run release`
2. `vim src/templates-data.js` and bump version.
3. Commit bumped version.
4. Merge development to production (usually after deployment and testing and many patches).

View File

@ -3,7 +3,7 @@
const gulp = require('gulp');
const del = require('del');
const through = require('through2');
const PluginError = require('gulp-util').PluginError;
const PluginError = require('plugin-error');
const changed = require('gulp-changed');
const PluginName = 'Template literals';
@ -29,7 +29,7 @@ const templatePlugin = (context) => through.obj(function(file, encoding, cb) {
}, { keys: [], values: [] });
try {
file.contents = new Buffer(
file.contents = Buffer.from(
(new Function(...keys, 'return `' + String(file.contents) + '`;'))(...values)
);
} catch(e) {
@ -43,14 +43,13 @@ const templatePlugin = (context) => through.obj(function(file, encoding, cb) {
});
gulp.task('default', ['build:beta']);
gulp.task('clean', function(cb) {
const clean = function(cb) {
//return del.sync('./build');
return cb();
});
};
const contexts = require('./src/templates-data').contexts;
@ -69,16 +68,16 @@ const firefoxSrc = './src/extension-firefox/**/*';
const joinSrc = (...args) => [...args, ...excluded];
gulp.task('_cp-mini', function(cb) {
const copyMini = function(cb) {
gulp.src(joinSrc(commonSrc, miniSrc))
//.pipe(changed(miniDst))
.pipe(templatePlugin(contexts.mini))
.pipe(gulp.dest(miniDst))
.on('end', cb);
});
};
gulp.task('_cp-full', function(cb) {
const copyFull = function(cb) {
gulp.src(joinSrc(commonSrc, fullSrc))
//.pipe(changed(fullDst))
@ -86,19 +85,9 @@ gulp.task('_cp-full', function(cb) {
.pipe(gulp.dest(fullDst))
.on('end', cb);
});
};
gulp.task('_cp-firefox', function(cb) {
gulp.src(joinSrc(commonSrc, fullSrc, firefoxSrc))
//.pipe(changed(fullDst))
.pipe(templatePlugin(contexts.firefox))
.pipe(gulp.dest(firefoxDst))
.on('end', cb);
});
gulp.task('_cp-beta', function(cb) {
const copyBeta = function(cb) {
gulp.src(joinSrc(commonSrc, fullSrc))
//.pipe(changed(fullDst))
@ -106,8 +95,13 @@ gulp.task('_cp-beta', function(cb) {
.pipe(gulp.dest(betaDst))
.on('end', cb);
});
};
gulp.task('build:all', ['_cp-mini', '_cp-full', '_cp-beta', '_cp-firefox']);
gulp.task('build:beta', ['_cp-beta']);
gulp.task('build:firefox', ['_cp-firefox']);
const buildAll = gulp.parallel(copyMini, copyFull, copyBeta);
const buildBeta = copyBeta;
module.exports = {
default: buildAll,
buildAll,
buildBeta,
};

File diff suppressed because it is too large Load Diff

View File

@ -8,8 +8,8 @@
"test": "mocha --recursive ./src/**/test/*",
"subpages": "cd ./src/extension-common/pages/options/ && npm run build && cd -",
"subpages:dev": "cd ./src/extension-common/pages/options/ && npm run build:dev:nocomp && cd -",
"start": "npm run subpages:dev && npm run gulp build:beta",
"release": "npm run subpages && npm run gulp build:all"
"start": "npm run subpages:dev && npm run gulp buildAll",
"release": "npm run subpages && npm run gulp buildAll"
},
"author": "Ilya Ig. Petrov",
"license": "GPLv3",
@ -23,8 +23,9 @@
"symlink-to": "^0.0.4"
},
"dependencies": {
"del": "^2.2.2",
"gulp": "^3.9.1",
"through2": "^2.0.3"
"del": "^3.0.0",
"gulp": "^4.0.0",
"plugin-error": "^1.0.1",
"through2": "^3.0.0"
}
}