Update to Gulp v4
This commit is contained in:
parent
eae1bdf3a6
commit
799dca7e1b
|
@ -1,7 +1,7 @@
|
||||||
language: node_js
|
language: node_js
|
||||||
|
|
||||||
node_js:
|
node_js:
|
||||||
- "8"
|
- latest
|
||||||
|
|
||||||
branches:
|
branches:
|
||||||
only:
|
only:
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
import gulp from 'gulp';
|
||||||
|
import pump from 'pump';
|
||||||
|
import babel from 'gulp-babel';
|
||||||
|
import watch from 'gulp-watch';
|
||||||
|
|
||||||
|
gulp.task('build', function () {
|
||||||
|
return pump([
|
||||||
|
gulp.src('src/**/*.js'),
|
||||||
|
babel(),
|
||||||
|
gulp.dest('dist')
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
|
||||||
|
gulp.task('watch', function () {
|
||||||
|
return pump([
|
||||||
|
watch('src/**/*.js'),
|
||||||
|
babel(),
|
||||||
|
gulp.dest('dist')
|
||||||
|
]);
|
||||||
|
});
|
|
@ -1,27 +0,0 @@
|
||||||
const
|
|
||||||
gulp = require('gulp'),
|
|
||||||
pump = require('pump'),
|
|
||||||
babel = require('gulp-babel'),
|
|
||||||
plumber = require('gulp-plumber'),
|
|
||||||
watch = require('gulp-watch');
|
|
||||||
|
|
||||||
const task_build = function () {
|
|
||||||
return pump([
|
|
||||||
gulp.src('src/**/*js'),
|
|
||||||
plumber(),
|
|
||||||
babel(),
|
|
||||||
gulp.dest('dist')
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
const task_watch = function () {
|
|
||||||
return pump([
|
|
||||||
watch('src/**/*js'),
|
|
||||||
plumber(),
|
|
||||||
babel(),
|
|
||||||
gulp.dest('dist')
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
gulp.task('build', task_build);
|
|
||||||
gulp.task('watch', task_watch);
|
|
|
@ -0,0 +1,86 @@
|
||||||
|
import gulp from 'gulp';
|
||||||
|
import pump from 'pump';
|
||||||
|
import del from 'del';
|
||||||
|
import copy from 'gulp-copy';
|
||||||
|
import rename from 'gulp-rename';
|
||||||
|
import inject from 'gulp-inject-string';
|
||||||
|
import copydeps from 'gulp-npm-copy-deps';
|
||||||
|
import file from 'gulp-file';
|
||||||
|
import editjson from 'gulp-json-editor';
|
||||||
|
|
||||||
|
import corepkg from './core/package';
|
||||||
|
import clientpkg from './client/package';
|
||||||
|
|
||||||
|
gulp.task('release-package', function () {
|
||||||
|
return pump([
|
||||||
|
gulp.src('package.json'),
|
||||||
|
editjson(function (mainpkg) {
|
||||||
|
delete mainpkg.main;
|
||||||
|
delete mainpkg.devDependencies;
|
||||||
|
delete mainpkg.scripts;
|
||||||
|
return mainpkg;
|
||||||
|
}),
|
||||||
|
gulp.dest('release')
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
|
||||||
|
gulp.task('client', function () {
|
||||||
|
return pump([
|
||||||
|
gulp.src('client/dist/*.client-release.js'),
|
||||||
|
rename(`client.${clientpkg.version}.js`),
|
||||||
|
gulp.dest('release')
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
|
||||||
|
gulp.task('core', function () {
|
||||||
|
return pump([
|
||||||
|
gulp.src('core/dist/main.js'),
|
||||||
|
inject.after("'use strict';\n", 'const PRODUCTION = true;\n'),
|
||||||
|
rename(`core.${corepkg.version}.js`),
|
||||||
|
gulp.dest('release')
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
|
||||||
|
gulp.task('sparkplug', function () {
|
||||||
|
return pump([
|
||||||
|
gulp.src('core/dist/sparkplug.js'),
|
||||||
|
gulp.dest('release')
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
|
||||||
|
gulp.task('core-modules', function () {
|
||||||
|
return pump([
|
||||||
|
gulp.src('core/dist/modules/**/*'),
|
||||||
|
copy('release', { prefix: 2 })
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
|
||||||
|
gulp.task('index', function () {
|
||||||
|
return pump([
|
||||||
|
file('index.js', `module.exports = require('./core.${corepkg.version}.js');`, {src: true}),
|
||||||
|
gulp.dest('release')
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
|
||||||
|
gulp.task('css-editor', function () {
|
||||||
|
return pump([
|
||||||
|
gulp.src('csseditor/dist/csseditor-release.js'),
|
||||||
|
rename('csseditor.js'),
|
||||||
|
gulp.dest('release/csseditor')
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
|
||||||
|
gulp.task('dependencies', function () {
|
||||||
|
return copydeps('.', 'release');
|
||||||
|
});
|
||||||
|
|
||||||
|
gulp.task('node-sass-bindings', function () {
|
||||||
|
return pump([
|
||||||
|
gulp.src('other/node_sass_bindings/**/*'),
|
||||||
|
copy('release/node_modules/node-sass/vendor', { prefix: 2 })
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
|
||||||
|
gulp.task('release', gulp.series(function () {
|
||||||
|
return del(['release/**/*']);
|
||||||
|
}, gulp.parallel('release-package', 'client', 'core', 'sparkplug', 'core-modules', 'index', 'css-editor', gulp.series('dependencies', 'node-sass-bindings'))));
|
82
gulpfile.js
82
gulpfile.js
|
@ -1,82 +0,0 @@
|
||||||
const
|
|
||||||
fs = require('fs'),
|
|
||||||
mkdirp = require('mkdirp'),
|
|
||||||
gulp = require('gulp'),
|
|
||||||
del = require('del'),
|
|
||||||
pump = require('pump'),
|
|
||||||
merge = require('gulp-merge'),
|
|
||||||
copy = require('gulp-copy'),
|
|
||||||
rename = require('gulp-rename'),
|
|
||||||
inject = require('gulp-inject-string'),
|
|
||||||
copydeps = require('gulp-npm-copy-deps');
|
|
||||||
|
|
||||||
const mainpkg = require('./package.json');
|
|
||||||
const corepkg = require('./core/package.json');
|
|
||||||
const clientpkg = require('./client/package.json');
|
|
||||||
const editorpkg = require('./csseditor/package.json');
|
|
||||||
|
|
||||||
const releasepkg = function() {
|
|
||||||
delete mainpkg.main;
|
|
||||||
delete mainpkg.devDependencies;
|
|
||||||
delete mainpkg.scripts;
|
|
||||||
mkdirp.sync('./release');
|
|
||||||
return fs.writeFileSync('./release/package.json', JSON.stringify(mainpkg, null, 2));
|
|
||||||
};
|
|
||||||
|
|
||||||
const client = function() {
|
|
||||||
return pump([
|
|
||||||
gulp.src('./client/dist/*.client-release.js'),
|
|
||||||
rename(`client.${clientpkg.version}.js`),
|
|
||||||
gulp.dest('./release')
|
|
||||||
]);
|
|
||||||
};
|
|
||||||
|
|
||||||
const core = function() {
|
|
||||||
return pump([
|
|
||||||
gulp.src('./core/dist/main.js'),
|
|
||||||
inject.after("'use strict';\n", 'const PRODUCTION = true;\n'),
|
|
||||||
rename(`core.${corepkg.version}.js`),
|
|
||||||
gulp.dest('./release')
|
|
||||||
]);
|
|
||||||
};
|
|
||||||
|
|
||||||
const sparkplug = function() {
|
|
||||||
return pump([
|
|
||||||
gulp.src('./core/dist/sparkplug.js'),
|
|
||||||
gulp.dest('./release')
|
|
||||||
]);
|
|
||||||
};
|
|
||||||
|
|
||||||
const core_modules = function() {
|
|
||||||
return pump([
|
|
||||||
gulp.src('./core/dist/modules/**/*'),
|
|
||||||
copy('release/', { prefix: 2 })
|
|
||||||
]);
|
|
||||||
};
|
|
||||||
|
|
||||||
const index = function() {
|
|
||||||
return fs.writeFileSync('./release/index.js', `module.exports = require('./core.${corepkg.version}.js');`);
|
|
||||||
};
|
|
||||||
|
|
||||||
const cssEditor = function() {
|
|
||||||
return pump([
|
|
||||||
gulp.src('./csseditor/dist/csseditor-release.js'),
|
|
||||||
rename('csseditor.js'),
|
|
||||||
gulp.dest('./release/csseditor')
|
|
||||||
]);
|
|
||||||
};
|
|
||||||
|
|
||||||
const deps = function() {
|
|
||||||
return copydeps('./', './release');
|
|
||||||
};
|
|
||||||
|
|
||||||
const node_sass_bindings = function() {
|
|
||||||
return pump([
|
|
||||||
gulp.src('./other/node_sass_bindings/**/*'),
|
|
||||||
copy('release/node_modules/node-sass/vendor', { prefix: 2 })
|
|
||||||
]);
|
|
||||||
};
|
|
||||||
|
|
||||||
gulp.task('release', function () {
|
|
||||||
return del(['./release/**/*']).then(() => merge(releasepkg(), client(), core(), sparkplug(), core_modules(), index(), cssEditor(), deps(), node_sass_bindings()));
|
|
||||||
});
|
|
File diff suppressed because it is too large
Load Diff
|
@ -36,13 +36,13 @@
|
||||||
"eslint-plugin-vue": "^4.3.0",
|
"eslint-plugin-vue": "^4.3.0",
|
||||||
"file-type": "^7.6.0",
|
"file-type": "^7.6.0",
|
||||||
"filewatcher": "^3.0.1",
|
"filewatcher": "^3.0.1",
|
||||||
"gulp": "^3.9.1",
|
"gulp": "^4.0.0",
|
||||||
"gulp-babel": "^7.0.0",
|
"gulp-babel": "^7.0.0",
|
||||||
"gulp-copy": "^1.1.0",
|
"gulp-copy": "^1.1.0",
|
||||||
|
"gulp-file": "^0.4.0",
|
||||||
"gulp-inject-string": "^1.1.1",
|
"gulp-inject-string": "^1.1.1",
|
||||||
"gulp-merge": "^0.1.1",
|
"gulp-json-editor": "^2.4.1",
|
||||||
"gulp-npm-copy-deps": "^1.0.2",
|
"gulp-npm-copy-deps": "^1.0.2",
|
||||||
"gulp-plumber": "^1.2.0",
|
|
||||||
"gulp-rename": "^1.2.2",
|
"gulp-rename": "^1.2.2",
|
||||||
"gulp-watch": "^5.0.0",
|
"gulp-watch": "^5.0.0",
|
||||||
"html-webpack-plugin": "^3.0.6",
|
"html-webpack-plugin": "^3.0.6",
|
||||||
|
|
Loading…
Reference in New Issue