From bd7d78e7ac25c8dce32ca2772e773083f49e8500 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B3=A2=E4=BB=94=E7=B3=95?= Date: Sat, 28 Jun 2025 17:13:13 +0800 Subject: [PATCH] remove update.json and meta.json files in ppk (#15) * add logic to support SENTRY_PROPERTIES parameter * remove update.json and meta.json files in ppk * udpapte --- src/bundle.ts | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/bundle.ts b/src/bundle.ts index 9dc5b9e..ac22981 100644 --- a/src/bundle.ts +++ b/src/bundle.ts @@ -288,9 +288,22 @@ async function copyHarmonyBundle(outputFolder: string) { } await fs.remove(path.join(harmonyRawPath, 'update.json')); await fs.copy('update.json', path.join(harmonyRawPath, 'update.json')); - await fs.ensureDir(outputFolder); - await fs.copy(harmonyRawPath, outputFolder); + + const files = await fs.readdir(harmonyRawPath); + for (const file of files) { + if (file !== 'update.json' && file !== 'meta.json') { + const sourcePath = path.join(harmonyRawPath, file); + const destPath = path.join(outputFolder, file); + const stat = await fs.stat(sourcePath); + + if (stat.isFile()) { + await fs.copy(sourcePath, destPath); + } else if (stat.isDirectory()) { + await fs.copy(sourcePath, destPath); + } + } + } } catch (error: any) { console.error(t('copyHarmonyBundleError', { error })); throw new Error(t('copyFileFailed', { error: error.message }));