From 19393583679e5dca70a77a52517783b1ded4f46b Mon Sep 17 00:00:00 2001 From: qcqcqc <1220204124@zust.edu.cn> Date: Tue, 4 Nov 2025 13:45:29 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=A4=8D=E5=88=B6=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E6=97=B6=E8=A6=81=E5=B8=A6=E6=9C=89.gitignore=E5=92=8Coak.conf?= =?UTF-8?q?ig.json=E4=B8=A4=E4=B8=AA=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/create.js | 6 ++++++ src/create.ts | 14 ++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/lib/create.js b/lib/create.js index 350a1a7..401e23b 100644 --- a/lib/create.js +++ b/lib/create.js @@ -248,6 +248,12 @@ async function create(dirName, cmd) { (0, file_handle_1.checkFileExistsAndCreate)(tsConfigMpJsonPath, tsConfigMpJson, enum_1.checkFileExistsAndCreateType.FILE); // 创建tsconfig.web.json (0, file_handle_1.checkFileExistsAndCreate)(tsConfigWebJsonPath, tsConfigWebJson, enum_1.checkFileExistsAndCreateType.FILE); + // 复制.gitignore + const gitignoreContent = (0, file_handle_1.readFile)((0, path_1.join)(__dirname, '..', 'template', '.gitignore')); + (0, file_handle_1.checkFileExistsAndCreate)((0, path_1.join)(rootPath, '.gitignore'), gitignoreContent, enum_1.checkFileExistsAndCreateType.FILE); + // 复制oak.config.json + const oakConfigContent = (0, file_handle_1.readFile)((0, path_1.join)(__dirname, '..', 'template', config_1.USER_CONFIG_FILE_NAME)); + (0, file_handle_1.checkFileExistsAndCreate)((0, path_1.join)(rootPath, config_1.USER_CONFIG_FILE_NAME), oakConfigContent, enum_1.checkFileExistsAndCreateType.FILE); // 更新configuration/compiler.js (仅在非模块化模式下) if (!isModule) { (0, template_1.updateCompilerJsContent)(rootPath, deps); diff --git a/src/create.ts b/src/create.ts index 6e6c817..593f035 100644 --- a/src/create.ts +++ b/src/create.ts @@ -370,6 +370,20 @@ export async function create(dirName: string, cmd: any) { tsConfigWebJson, checkFileExistsAndCreateType.FILE ); + // 复制.gitignore + const gitignoreContent = readFile(join(__dirname, '..', 'template', '.gitignore')); + checkFileExistsAndCreate( + join(rootPath, '.gitignore'), + gitignoreContent, + checkFileExistsAndCreateType.FILE + ); + // 复制oak.config.json + const oakConfigContent = readFile(join(__dirname, '..', 'template', USER_CONFIG_FILE_NAME)); + checkFileExistsAndCreate( + join(rootPath, USER_CONFIG_FILE_NAME), + oakConfigContent, + checkFileExistsAndCreateType.FILE + ); // 更新configuration/compiler.js (仅在非模块化模式下) if (!isModule) { updateCompilerJsContent(rootPath, deps);