Skip to content

Commit beac685

Browse files
@rnw/cli add package.json:codegenConfig.windows.outputDirectory (#11891)
* Add package.json:codegenConfig.windows.outputDirectory * Change files
1 parent 149a25d commit beac685

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "prerelease",
3+
"comment": "Add package.json:codegenConfig.windows.outputDirectory",
4+
"packageName": "@react-native-windows/cli",
5+
"email": "53799235+ZihanChen-MSFT@users.noreply.github.com",
6+
"dependentChangeType": "patch"
7+
}

packages/@react-native-windows/cli/src/codegen.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,8 @@ export class CodeGenWindows {
123123
const jsRootDir = pkgJson.codegenConfig.jsSrcsDir
124124
? path.join(this.root, pkgJson.codegenConfig.jsSrcsDir)
125125
: this.root;
126+
const codegenOutputDir =
127+
pkgJson.codegenConfig.windows.outputDirectory ?? 'codegen';
126128

127129
const generators = pkgJson.codegenConfig.windows.generators ?? [
128130
'modulesWindows',
@@ -143,7 +145,7 @@ export class CodeGenWindows {
143145
generators.indexOf('modulesTypeScriptTypes') !== -1,
144146
modulesWindows: generators.indexOf('modulesWindows') !== -1,
145147
namespace: projectNamespace,
146-
outputDirectory: path.join(this.root, 'codegen'),
148+
outputDirectory: path.join(this.root, codegenOutputDir),
147149
test: !!this.options.check,
148150
};
149151

0 commit comments

Comments
 (0)