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:
z3n
2026-06-24 09:22:17 +00:00
parent 403850f21d
commit 60ed177335

View File

@@ -138,13 +138,17 @@ 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 };
const output = (err.stdout || err.stderr || String(cliError)).trim(); /* CLI non installé (dev local sans Docker) → skip la validation complète */
return { if (err.code !== 'ENOENT') {
valid: false, type: detectedType, mainFile: mainFileName, const output = (err.stdout || err.stderr || String(cliError)).trim();
name: null, versionMajor: null, versionMinor: null, versionPatch: null, description: null, return {
errors: [{ file: mainFileName, message: output }], valid: false, type: detectedType, mainFile: mainFileName,
}; name: null, versionMajor: null, versionMinor: null, versionPatch: null, description: null,
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);