[build] update publish task
This commit is contained in:
32
gulpfile.js
32
gulpfile.js
@@ -6,10 +6,9 @@ const Config = require('./config.json');
|
||||
const packageInfo = require('./package.json');
|
||||
const {Sdk, Haxe, Project, FlashPlayer} = require('gulp-haxetool');
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
const through = require('through2');
|
||||
const dateformat = require('dateformat');
|
||||
const argv = require('yargs').argv;
|
||||
const publish = require('./tasks/gulp-publish');
|
||||
|
||||
if (Config.SdkDir) {
|
||||
Sdk.dir = Config.SdkDir;
|
||||
@@ -89,7 +88,10 @@ const client = new Project(
|
||||
],
|
||||
config.branch({
|
||||
name: 'client',
|
||||
sources: ['src/client/haxe'],
|
||||
sources: [
|
||||
'src/fixes/haxe',
|
||||
'src/client/haxe',
|
||||
],
|
||||
main: 'ru.m.tankz.Client',
|
||||
preloader: 'ru.m.tankz.Preloader',
|
||||
assets: [
|
||||
@@ -157,29 +159,7 @@ const server = new Project(
|
||||
/**
|
||||
* publish
|
||||
*/
|
||||
exports.publish = function publish() {
|
||||
const packages = [];
|
||||
return gulp.src('target/client/@(android|archive|debian)/*')
|
||||
.pipe(through.obj(function (file, enc, cb) {
|
||||
const path = file.path.replace(file.base + '/', '');
|
||||
packages.push({
|
||||
type: path.split('/').shift(),
|
||||
path: path,
|
||||
filename: path.split('/').pop(),
|
||||
url: `${Config.PublishUrl}/${path}`,
|
||||
});
|
||||
this.push(file);
|
||||
cb(null);
|
||||
}))
|
||||
.pipe(gulp.dest(Config.PublishDir))
|
||||
.on('end', function () {
|
||||
fs.writeFileSync(path.join(Config.PublishDir, 'packages.json'), JSON.stringify({
|
||||
'name': packageInfo.name,
|
||||
'version': packageInfo.version,
|
||||
'packages': packages,
|
||||
}, null, 4));
|
||||
});
|
||||
};
|
||||
module.exports.publish = publish(config.name, config.version, Config.PublishDir);
|
||||
|
||||
/**
|
||||
* default
|
||||
|
||||
Reference in New Issue
Block a user