[build] fixes for windows

This commit is contained in:
2019-09-03 20:57:28 +03:00
parent c2b0618c93
commit 42fd008a54
3 changed files with 41 additions and 15 deletions

16
tasks/gulp-publish.js Normal file → Executable file
View File

@@ -1,5 +1,6 @@
const gulp = require('gulp');
const fs = require('fs');
const fse = require('fs-extra');
const path = require('path');
const through = require('through2');
@@ -20,7 +21,7 @@ class Package {
['android', /^.*?\.apk$/],
['debian', /^.*?\.deb$/],
['linux', /^.*?linux\.tar\.gz$/],
['windows', /^.*?windows\.zip$/],
['windows', /^.*?win\.zip$/],
['windows', /^.*?\.exe$/],
]) {
if (r.test(filename)) {
@@ -64,11 +65,12 @@ class Package {
}
}
module.exports = (name, version, publishDir) => function publish(cb) {
module.exports = (name, version, publishDir, publishUrl) => function publish(cb) {
const packages = {};
fse.ensureDirSync(publishDir);
return gulp.series([
function copy() {
return gulp.src('target/client/@(android|archive|debian|windows)/*')
return gulp.src('target/client/@(android|archive|debian|installer)/*')
.pipe(through.obj(function (file, enc, cb) {
const pack = Package.parseFilename(file.path);
if (pack) {
@@ -81,7 +83,7 @@ module.exports = (name, version, publishDir) => function publish(cb) {
function generate() {
return gulp.src(`${publishDir}/*/*`)
.pipe(through.obj(function (file, enc, cb) {
const path = file.path.replace(file.base + '/', '');
const basepath = file.path.replace(file.base + path.sep, '');
const pack = Package.parseFilename(file.path);
if (pack) {
if (!packages[pack.key] || packages[pack.key].version < pack.version) {
@@ -89,9 +91,9 @@ module.exports = (name, version, publishDir) => function publish(cb) {
platform: pack.platform,
type: pack.type,
version: pack.version,
path: path,
filename: path.split('/').pop(),
url: `${publishDir}/${path}`,
path: basepath,
filename: basepath.split(path.sep).pop(),
url: `${publishUrl}/${basepath.replace(path.sep, "/")}`,
}
}
}