From 376200751b2b1210f45a1897089273f2f4330e59 Mon Sep 17 00:00:00 2001 From: liujiangnan <695541723@qq.com> Date: Wed, 1 Dec 2021 14:20:12 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=9B=BF=E6=8D=A2=E7=9A=84=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/buildCocos.js | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/bin/buildCocos.js b/bin/buildCocos.js index 1eb56fc..1d4c8e9 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(); -- 2.21.0