fix: 完善后处理清理逻辑
✅ postProcessCleanup 增强: - 修复 !xxx === 'yyy' → xxx !== 'yyy' (通用) - 修复 this.config.get('xxx' + yyy).exists() → fs.existsSync(...) 🎯 效果: - 解决更多逻辑运算符优先级问题 - 正确处理复杂表达式的exists()调用
This commit is contained in:
@@ -80,6 +80,13 @@ class ServiceMethodConverter {
|
|||||||
return `if (${configCall} !== ${value})`;
|
return `if (${configCall} !== ${value})`;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// 3. 修复 !xxx === "yyy" → xxx !== "yyy" (通用)
|
||||||
|
tsBody = tsBody.replace(/!\s*([a-zA-Z_$.()[\]]+)\s*===\s*([^;)\n]+)/g, '$1 !== $2');
|
||||||
|
|
||||||
|
// 4. 修复复杂表达式的 .exists()
|
||||||
|
// this.config.get('xxx' + yyy).exists() → fs.existsSync(this.config.get('xxx' + yyy))
|
||||||
|
tsBody = tsBody.replace(/(this\.config\.get\([^)]+\))\.exists\(\)/g, 'fs.existsSync($1)');
|
||||||
|
|
||||||
return tsBody;
|
return tsBody;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ export class AddonDevelopBuildServiceImplService {
|
|||||||
* build
|
* build
|
||||||
*/
|
*/
|
||||||
async build(...args: any[]): Promise<any> {
|
async build(...args: any[]): Promise<any> {
|
||||||
if (!this.config.get('runActive') === "dev") throw new BadRequestException("只有在开发环境下才可以进行打包操作");
|
if (this.config.get('runActive') !== "dev") throw new BadRequestException("只有在开发环境下才可以进行打包操作");
|
||||||
|
|
||||||
if (!this.config.get('projectNiucloudAddon' + addon).exists()) throw new BadRequestException("插件不存在");
|
if (!this.config.get('projectNiucloudAddon' + addon).exists()) throw new BadRequestException("插件不存在");
|
||||||
const infoFile: string = this.config.get('projectNiucloudAddon' + addon + "/src/main/resources/info.json");
|
const infoFile: string = this.config.get('projectNiucloudAddon' + addon + "/src/main/resources/info.json");
|
||||||
@@ -26,7 +26,7 @@ export class AddonDevelopBuildServiceImplService {
|
|||||||
this.addonPath = this.config.get('webRootDownAddon') + addon + "/";
|
this.addonPath = this.config.get('webRootDownAddon') + addon + "/";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
for (const child of this.fs.readdirSync(addonPath)) {
|
for (const child of fs.readdirSync(addonPath)) {
|
||||||
if (fs.lstatSync(child).isDirectory() && !path.basename(child) === "sql") fs.rmSync(child, { recursive: true, force: true });
|
if (fs.lstatSync(child).isDirectory() && !path.basename(child) === "sql") fs.rmSync(child, { recursive: true, force: true });
|
||||||
}
|
}
|
||||||
fs.copyFileSync(infoFile, this.addonPath + "info.json");
|
fs.copyFileSync(infoFile, this.addonPath + "info.json");
|
||||||
|
|||||||
@@ -327,7 +327,7 @@ export class GenerateServiceImplService {
|
|||||||
const zipFile: string = ZipUtil.zip(packageDir, tempDir + "package.zip");
|
const zipFile: string = ZipUtil.zip(packageDir, tempDir + "package.zip");
|
||||||
} else {
|
} else {
|
||||||
// 同步
|
// 同步
|
||||||
if (!this.config.get('envType') === "dev") throw new BadRequestException("只有在开发模式下才能进行同步代码");
|
if (this.config.get('envType') !== "dev") throw new BadRequestException("只有在开发模式下才能进行同步代码");
|
||||||
|
|
||||||
for (const coreGenerateTemplateVo of list) {
|
for (const coreGenerateTemplateVo of list) {
|
||||||
if (coreGenerateTemplateVo.getType() === "sql") {
|
if (coreGenerateTemplateVo.getType() === "sql") {
|
||||||
|
|||||||
Reference in New Issue
Block a user