81 lines
4.0 KiB
JavaScript
81 lines
4.0 KiB
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.updateJsonType = exports.updateShared = exports.updateSound = exports.updateJson = exports.updateSpine = exports.updateUi = void 0;
|
|
const child_process_1 = require("child_process");
|
|
const fs_1 = require("fs");
|
|
const path_1 = require("path");
|
|
const update_1 = require("./update");
|
|
async function updateUi() {
|
|
(0, child_process_1.execSync)('svn up ' + (0, path_1.join)(Editor.Project.path, '../ui'));
|
|
let mapJson = JSON.parse((0, fs_1.readFileSync)((0, path_1.join)(Editor.Project.path, 'updateUiResourcesMap.json'), 'utf-8'));
|
|
await new update_1.Update(mapJson.map(v => {
|
|
return {
|
|
root: v.root instanceof Array ? v.root.map(r => `../${r}`) : `../${v.root}`,
|
|
target: v.target
|
|
};
|
|
})).start();
|
|
}
|
|
exports.updateUi = updateUi;
|
|
async function updateSpine() {
|
|
(0, child_process_1.execSync)('svn up ' + (0, path_1.join)(Editor.Project.path, '../spine'));
|
|
let mapJson = JSON.parse((0, fs_1.readFileSync)((0, path_1.join)(Editor.Project.path, 'updateSpineResourcesMap.json'), 'utf-8'));
|
|
await new update_1.Update(mapJson.map(v => {
|
|
return {
|
|
root: v.root instanceof Array ? v.root.map(r => `../${r}`) : `../${v.root}`,
|
|
target: v.target
|
|
};
|
|
})).start();
|
|
}
|
|
exports.updateSpine = updateSpine;
|
|
async function updateJson() {
|
|
if ((0, fs_1.existsSync)((0, path_1.join)(Editor.Project.path, '../cehua'))) {
|
|
(0, child_process_1.execSync)('svn up ' + (0, path_1.join)(Editor.Project.path, '../cehua/json'));
|
|
await new update_1.Update([{ root: '../cehua/json', target: 'resources/json/same' }]).start();
|
|
}
|
|
else {
|
|
const dir = (0, path_1.join)(Editor.Project.path, 'temp/cehuaJson');
|
|
if (!(0, fs_1.existsSync)(dir)) {
|
|
(0, fs_1.mkdirSync)(dir);
|
|
(0, child_process_1.execSync)(`svn co ${getSvnUrl() + 'cehua/json'} ${dir}`);
|
|
}
|
|
(0, child_process_1.execSync)(`svn up ${dir}`);
|
|
await new update_1.Update([{ root: 'temp/cehuaJson', target: 'resources/json/same' }]).start();
|
|
}
|
|
}
|
|
exports.updateJson = updateJson;
|
|
async function updateSound() {
|
|
(0, child_process_1.execSync)('svn up ' + (0, path_1.join)(Editor.Project.path, '../sound'));
|
|
await new update_1.Update([{ root: '../sound', target: 'resources/sound' }]).start();
|
|
}
|
|
exports.updateSound = updateSound;
|
|
async function updateShared() {
|
|
if ((0, fs_1.existsSync)((0, path_1.join)(Editor.Project.path, '../server'))) {
|
|
(0, child_process_1.execSync)('svn up ' + (0, path_1.join)(Editor.Project.path, '../server'));
|
|
await new update_1.Update([{ root: '../server/src/shared', target: 'src/shared' }]).start();
|
|
}
|
|
else {
|
|
const dir = (0, path_1.join)(Editor.Project.path, 'temp/backShared');
|
|
if (!(0, fs_1.existsSync)(dir)) {
|
|
(0, fs_1.mkdirSync)(dir);
|
|
(0, child_process_1.execSync)(`svn co ${getSvnUrl() + 'server/src/shared'} ${dir}`);
|
|
}
|
|
(0, child_process_1.execSync)(`svn up ${dir}`);
|
|
await new update_1.Update([{ root: 'temp/backShared', target: 'src/shared' }]).start();
|
|
}
|
|
}
|
|
exports.updateShared = updateShared;
|
|
async function updateJsonType() {
|
|
(0, child_process_1.execSync)('svn up ' + (0, path_1.join)(Editor.Project.path, '../cehua'));
|
|
(0, child_process_1.exec)(`node ${(0, path_1.join)(Editor.Project.path, '../cehua/_creatJsonType.js')} ${(0, path_1.join)(Editor.Project.path, 'assets/resources/json/client')}`, (err, stdout) => {
|
|
if (stdout) {
|
|
(0, fs_1.writeFileSync)((0, path_1.join)(Editor.Project.path, 'type_jsonType.d.ts'), stdout);
|
|
(0, child_process_1.execSync)(`svn ci -m json类型提示文件自动提交 ${(0, path_1.join)(Editor.Project.path, 'type_jsonType.d.ts')}`);
|
|
}
|
|
});
|
|
}
|
|
exports.updateJsonType = updateJsonType;
|
|
function getSvnUrl() {
|
|
let str = (0, child_process_1.execSync)(`svn info ${Editor.Project.path}`).toString();
|
|
return str.split('\n').filter(v => v.indexOf('URL: ') != -1)[0].split(': ')[1].replace('client', '');
|
|
}
|