From f27542e71fdec453d8abcae79e5e1e8849838061 Mon Sep 17 00:00:00 2001 From: z3n Date: Fri, 29 May 2026 13:22:30 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20injecter=20node=5Fmodules/.bin=20dans=20?= =?UTF-8?q?le=20PATH=20des=20CLIs=20de=20g=C3=A9n=C3=A9ration?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit execFileAsync ne voit pas node_modules/.bin par défaut — on l'ajoute explicitement à l'env du process enfant pour asyncapi et redocly. Fonctionne aussi bien en local qu'en Docker (priorité locale, fallback global). Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude Co-Authored-By: Happy --- .../docs-generation/docs-generation.service.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/back/src/modules/docs-generation/docs-generation.service.ts b/back/src/modules/docs-generation/docs-generation.service.ts index 7dc5121..b5f08a4 100644 --- a/back/src/modules/docs-generation/docs-generation.service.ts +++ b/back/src/modules/docs-generation/docs-generation.service.ts @@ -7,6 +7,13 @@ import { ApisService } from '../apis/apis.service'; const execFileAsync = promisify(execFile); +/* Ajoute node_modules/.bin au PATH pour trouver asyncapi/redocly en local */ +const localBin = path.join(process.cwd(), 'node_modules', '.bin'); +const execEnv = { + ...process.env, + PATH: `${localBin}${path.delimiter}${process.env.PATH ?? ''}`, +}; + @Injectable() export class DocsGenerationService { private readonly outputDir = process.env.DOCS_OUTPUT_DIR ?? './docs-output'; @@ -51,7 +58,7 @@ export class DocsGenerationService { '--no-interactive', '--install', '--force-write', - ], { shell: true }); + ], { shell: true, env: execEnv }); } private async generateOpenApi(yamlPath: string, outputDir: string): Promise { @@ -59,6 +66,6 @@ export class DocsGenerationService { 'build-docs', yamlPath, '--output', path.join(outputDir, 'index.html'), - ], { shell: true }); + ], { shell: true, env: execEnv }); } }