From d3e0430deac573fd44792e6005d5de20e9ad2797 Mon Sep 17 00:00:00 2001 From: Dmitry Rykun Date: Wed, 26 Jun 2024 01:59:54 -0700 Subject: [PATCH] Fix output path for generated artifacts (#45165) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/45165 This is a fix for https://github.com/facebook/react-native/issues/45112 This diff changes the codegen so that the output path is computed relative to project root (or `path` if provided) instead of current working directory. Changelog: [General][Fixed] - Codegen computes output path relative to project root instead of current working directory. Reviewed By: fkgozali Differential Revision: D59009821 fbshipit-source-id: 3a138a3508fc239c8600b8c9f242f1c665f8e3c0 --- .../react-native/scripts/codegen/generate-artifacts-executor.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react-native/scripts/codegen/generate-artifacts-executor.js b/packages/react-native/scripts/codegen/generate-artifacts-executor.js index df3c1e6ac03..074a397bf38 100644 --- a/packages/react-native/scripts/codegen/generate-artifacts-executor.js +++ b/packages/react-native/scripts/codegen/generate-artifacts-executor.js @@ -365,7 +365,7 @@ function computeOutputPath(projectRoot, baseOutputPath, pkgJson, platform) { if (baseOutputPath == null) { const outputDirFromPkgJson = readOutputDirFromPkgJson(pkgJson, platform); if (outputDirFromPkgJson != null) { - baseOutputPath = outputDirFromPkgJson; + baseOutputPath = path.join(projectRoot, outputDirFromPkgJson); } else { baseOutputPath = projectRoot; }