diff --git a/bin/buildCocos.js b/bin/buildCocos.js index 1eb56fcdb3417ffb09c776aebe9350e5ddcaa981..1d4c8e900841924b8f2bc3a13623472d83c2e146 100644 --- a/bin/buildCocos.js +++ b/bin/buildCocos.js @@ -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); @@ -355,9 +352,11 @@ module.exports = { }, buildAndroid: async function () { - + // æž„å»ºå‰æ£€æŸ¥ 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();