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);