fix(uploads): ignorer ENOENT si CLI asyncapi/redocly absent (dev local sans Docker)
Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
This commit is contained in:
@@ -138,7 +138,9 @@ export class UploadsController {
|
|||||||
await execFileAsync('redocly', ['lint', mainPath], { env: execEnv, timeout: 30000 });
|
await execFileAsync('redocly', ['lint', mainPath], { env: execEnv, timeout: 30000 });
|
||||||
}
|
}
|
||||||
} catch (cliError) {
|
} catch (cliError) {
|
||||||
const err = cliError as { stdout?: string; stderr?: string };
|
const err = cliError as NodeJS.ErrnoException & { stdout?: string; stderr?: string };
|
||||||
|
/* CLI non installé (dev local sans Docker) → skip la validation complète */
|
||||||
|
if (err.code !== 'ENOENT') {
|
||||||
const output = (err.stdout || err.stderr || String(cliError)).trim();
|
const output = (err.stdout || err.stderr || String(cliError)).trim();
|
||||||
return {
|
return {
|
||||||
valid: false, type: detectedType, mainFile: mainFileName,
|
valid: false, type: detectedType, mainFile: mainFileName,
|
||||||
@@ -146,6 +148,8 @@ export class UploadsController {
|
|||||||
errors: [{ file: mainFileName, message: output }],
|
errors: [{ file: mainFileName, message: output }],
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
this.logger.warn(`CLI ${detectedType === 'ASYNCAPI' ? 'asyncapi' : 'redocly'} non trouvé — validation CLI ignorée`);
|
||||||
|
}
|
||||||
} finally {
|
} finally {
|
||||||
await fsPromises.rm(tempDir, { recursive: true, force: true }).catch(() => undefined);
|
await fsPromises.rm(tempDir, { recursive: true, force: true }).catch(() => undefined);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user