Skip to content

Commit e61daa8

Browse files
mdvaccafacebook-github-bot
authored andcommitted
Introduce parameter to customize libraryGenerators used in the codegen (facebook#51991)
Summary: Pull Request resolved: facebook#51991 This diff introduces a new parameter to customize libraryGenerators used in the codegen, since I'm adding a default object, this diff shoulnd't change any behavior changelog: [internal] internal Reviewed By: christophpurrer Differential Revision: D76472495 fbshipit-source-id: 50b9095c7c554e368f65e4c0b5539be0cca51a51
1 parent a8386aa commit e61daa8

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

packages/react-native-codegen/src/generators/RNCodegen.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ type LibraryOptions = $ReadOnly<{
9494
packageName?: string, // Some platforms have a notion of package, which should be configurable.
9595
assumeNonnull: boolean,
9696
useLocalIncludePaths?: boolean,
97+
libraryGenerators?: LibraryGeneratorsFunctions,
9798
}>;
9899

99100
type SchemasOptions = $ReadOnly<{
@@ -254,6 +255,7 @@ module.exports = {
254255
packageName,
255256
assumeNonnull,
256257
useLocalIncludePaths,
258+
libraryGenerators = LIBRARY_GENERATORS,
257259
}: LibraryOptions,
258260
{generators, test}: LibraryConfig,
259261
): boolean {
@@ -290,7 +292,7 @@ module.exports = {
290292
const generatedFiles: Array<CodeGenFile> = [];
291293

292294
for (const name of generators) {
293-
for (const generator of LIBRARY_GENERATORS[name]) {
295+
for (const generator of libraryGenerators[name]) {
294296
generator(
295297
libraryName,
296298
schema,

0 commit comments

Comments
 (0)