Skip to content

Commit 44ebc93

Browse files
authored
fix: run codegen script in sourceDir (#292)
* fix: run codegen script in sourceDir * changeset
1 parent d2134be commit 44ebc93

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

.changeset/plenty-cooks-eat.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@rnef/platform-apple-helpers': patch
3+
---
4+
5+
fix: run codegen script in sourceDir

packages/platform-apple-helpers/src/lib/utils/codegen.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,13 @@ interface CodegenOptions {
99
projectRoot: string;
1010
platformName: ApplePlatform;
1111
reactNativePath: string;
12+
sourceDir: string;
1213
}
1314

1415
async function runCodegen(options: CodegenOptions) {
15-
if (fs.existsSync('build')) {
16-
fs.rmSync('build', { recursive: true });
16+
const buildDir = path.join(options.sourceDir, 'build');
17+
if (fs.existsSync(buildDir)) {
18+
fs.rmSync(buildDir, { recursive: true });
1719
}
1820

1921
const codegenScript = path.join(
@@ -27,7 +29,7 @@ async function runCodegen(options: CodegenOptions) {
2729
'-p',
2830
options.projectRoot,
2931
'-o',
30-
process.cwd(),
32+
options.sourceDir,
3133
'-t',
3234
options.platformName,
3335
]);

packages/platform-apple-helpers/src/lib/utils/pods.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export async function installPodsIfNeeded(
4242
: true;
4343

4444
if (!podsDirExists || hashChanged) {
45-
await runCodegen({ projectRoot, platformName, reactNativePath });
45+
await runCodegen({ projectRoot, platformName, reactNativePath, sourceDir });
4646
await installPods({ projectRoot, sourceDir, podfilePath, newArch });
4747
cacheManager.set(
4848
cacheKey,

0 commit comments

Comments
 (0)