Commit 37620075 authored by liujiangnan's avatar liujiangnan

feat: 替换的文件名

parent ab89e285
......@@ -223,6 +223,7 @@ function changeSettingsToBundle () {
editFolderMeta(path, folderName, true);
}
function replaceUuids () {
console.log('build_step_0 开始~!');
......@@ -243,8 +244,6 @@ function replaceUuids () {
metaData.isBundle = false;
fs.writeFileSync(metaPath, JSON.stringify(metaData));
}
function fileReplace(path, replaceStr, newStr) {
if (!fs.existsSync(path)) {
return;
......@@ -254,26 +253,24 @@ function replaceUuids () {
const newFileStr = fileStr.toString().replace(new RegExp(replaceStr.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), 'g'), newStr);
fs.writeFileSync(path, newFileStr);
}
function getShortUuid(uuid) {
const bytes = parse(uuid).subarray(1);
return uuid.substring(0, 5) + Base64.fromUint8Array(bytes).substring(2);
}
const path = 'assets'
const folderName = getFolderName(path);
editFolderMeta(path, folderName);
const oldFireUuid = '57ea7c61-9b8b-498a-b024-c98ee9124beb';
const oldFireUuid = '0737ce42-24f0-45c6-8e1a-8bdab4f74ba3';
const newFireUuid = v4();
fileReplace(`assets/${folderName}/scene/${folderName}.fire.meta`, oldFireUuid, newFireUuid);
fileReplace(`assets/${folderName}/scene/${folderName}.fire`, oldFireUuid, newFireUuid);
fileReplace('settings/builder.json', oldFireUuid, newFireUuid);
function getShortUuid(uuid) {
const bytes = parse(uuid).subarray(1);
return uuid.substring(0, 5) + Base64.fromUint8Array(bytes).substring(2);
}
const oldJsUuid = 'f4ede462-f8d7-4069-ba80-915611c058ca';
const oldJsShortUuid = 'f4edeRi+NdAabqAkVYRwFjK';
const oldJsId = 'e687yyoRBIzZAOVRL8Sseh';
const oldJsUuid = '408a67f8-65fa-4cf1-8cf2-83e20e1a0fd5';
const oldJsShortUuid = '408a6f4ZfpM8Yzyg+IOGg/V';
const oldJsId = 'eaTVUpqahPfZeO9+sUI7RP';
const newJsUuid = v4();
const newJsShortUuid = getShortUuid(newJsUuid);
const newJsId = v4().replace(/-/g, '').substring(0, oldJsId.length);
......@@ -358,6 +355,8 @@ module.exports = {
// 构建前检查
const projectName = build_check();
// 替换uuid
replaceUuids();
// 改设置为bundle
changeSettingsToBundle();
......@@ -373,8 +372,11 @@ module.exports = {
},
buildIos: async function () {
// 构建前检查
const projectName = build_check();
// 替换uuid
replaceUuids();
// 改设置为bundle
changeSettingsToBundle();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment