BetterDiscordApp-v2/gulpfile.js

70 lines
1.7 KiB
JavaScript
Raw Normal View History

2018-03-19 23:02:44 +01:00
const
2018-03-20 07:54:33 +01:00
fs = require('fs'),
2018-03-19 23:02:44 +01:00
gulp = require('gulp'),
2018-03-20 07:54:33 +01:00
del = require('del'),
2018-03-19 23:02:44 +01:00
pump = require('pump'),
merge = require('gulp-merge'),
copy = require('gulp-copy'),
2018-03-20 07:54:33 +01:00
rename = require('gulp-rename'),
2018-03-19 23:02:44 +01:00
copydeps = require('gulp-npm-copy-deps');
2018-03-20 07:54:33 +01:00
const corepkg = require('./core/package.json');
const clientpkg = require('./client/package.json');
const editorpkg = require('./csseditor/package.json');
2018-03-19 23:02:44 +01:00
const client = function() {
return pump([
gulp.src('./client/dist/*.client.js'),
2018-03-20 07:54:33 +01:00
rename(`client.${clientpkg.version}.js`),
gulp.dest('./release')
2018-03-19 23:02:44 +01:00
]);
}
const core = function() {
return pump([
2018-03-20 07:54:33 +01:00
gulp.src('./core/dist/modules/**/*'),
2018-03-19 23:02:44 +01:00
copy('release/', { prefix: 2 })
]);
}
const core2 = function() {
return pump([
2018-03-20 07:54:33 +01:00
gulp.src('./core/dist/main.js'),
rename(`core.${corepkg.version}.js`),
gulp.dest('./release')
2018-03-19 23:02:44 +01:00
]);
}
2018-03-20 07:54:33 +01:00
const core3 = function() {
return fs.writeFileSync('./release/index.js', `module.exports = require('./core.${corepkg.version}.js');`);
}
const sparkplug = function() {
return pump([
gulp.src('./core/dist/sparkplug.js'),
gulp.dest('./release')
]);
}
2018-03-19 23:02:44 +01:00
const cssEditor = function() {
return pump([
gulp.src('./csseditor/dist/**/*'),
copy('release/csseditor', { prefix: 2 })
]);
}
const deps = function() {
return copydeps('./', './release');
}
const bindings = function() {
return pump([
gulp.src('./other/node_sass_bindings/**/*'),
copy('release/node_modules/node-sass/vendor', { prefix: 2 })
]);
}
2018-03-20 07:54:33 +01:00
gulp.task('release', function () {
2018-03-20 11:47:03 +01:00
del(['./release/**/*']).then(() => merge(client(), core(), core2(), core3(), sparkplug(), cssEditor(), deps(), bindings()));
2018-03-20 07:54:33 +01:00
});