From ff03b149e76982096be3ca4f3aea9a30c463ccec Mon Sep 17 00:00:00 2001 From: Dmitry Rykun Date: Thu, 7 Mar 2024 09:19:09 -0800 Subject: [PATCH] Use fs.cpSync instead of execSync('cp ... (#43368) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/43368 This diff replaces direct invocation of the `cp` command with the platform agnostic `fs.cpSync`. Changelog: [Internal] Reviewed By: huntie Differential Revision: D54634108 fbshipit-source-id: 41fe7b44b6534026ef1b930da85725bf3eb1e7bb --- .../scripts/codegen/generate-artifacts-executor.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/react-native/scripts/codegen/generate-artifacts-executor.js b/packages/react-native/scripts/codegen/generate-artifacts-executor.js index 271a66e093d..df3c1e6ac03 100644 --- a/packages/react-native/scripts/codegen/generate-artifacts-executor.js +++ b/packages/react-native/scripts/codegen/generate-artifacts-executor.js @@ -465,8 +465,7 @@ function generateCode(outputPath, schemaInfo, includesGeneratedCode, platform) { const outputDir = reactNativeCoreLibraryOutputPath(libraryName, platform) ?? outputPath; fs.mkdirSync(outputDir, {recursive: true}); - // TODO: Fix this. This will not work on Windows. - execSync(`cp -R ${tmpOutputDir}/* "${outputDir}"`); + fs.cpSync(tmpOutputDir, outputDir, {recursive: true}); console.log(`[Codegen] Generated artifacts: ${outputDir}`); }