fix: 复制项目时要带有.gitignore和oak.config.json两个文件

This commit is contained in:
Pan Qiancheng 2025-11-04 13:45:29 +08:00
parent 00dab2c454
commit 1939358367
2 changed files with 20 additions and 0 deletions

View File

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

View File

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