From 512a5f94bfe2ec1f18f6b4b3564a6f54f1388b0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=9B=B9=E5=AE=87?= Date: Tue, 1 Jul 2025 14:16:42 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=84=E7=90=86=E6=89=93=E5=8C=85=E7=A9=BA?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E5=85=BC=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 王曹宇 --- build-tools/handleApiFiles.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/build-tools/handleApiFiles.js b/build-tools/handleApiFiles.js index 64ab86c912..3fcdaf9406 100755 --- a/build-tools/handleApiFiles.js +++ b/build-tools/handleApiFiles.js @@ -29,6 +29,15 @@ const DirType = { 'typeThree': 'noTagInEts2', }; +const NotNullFilePath = [ + 'api', + 'api/@internal/ets', + 'api/@internal/component/ets', + 'api/arkui/component', + 'arkts', + 'kits', +]; + const NOT_COPY_DIR = ['build-tools', '.git', '.gitee']; function isEtsFile(path) { @@ -102,6 +111,20 @@ function handleApiFiles(rootPath, type, output) { console.log('error===>', error); } } + if (type === DirType.typeTwo) { + NotNullFilePath.forEach((dir) => { + const outDir = path.join(output, dir); + if (!fs.existsSync(outDir)) { + fs.mkdirSync(outDir, { recursive: true }); + writeFile(path.join(outDir, '.keep'), ' '); + return; + } + const fileNames = fs.readdirSync(outDir); + if (fileNames.length === 0) { + writeFile(path.join(outDir, '.keep'), ' '); + } + }); + } } -- Gitee