Skip to content

Commit 53bd9fe

Browse files
committed
feat: only fetch the nitro version when the module type is nitro
1 parent 04a0b57 commit 53bd9fe

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

packages/create-react-native-library/src/index.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import { printErrorHelp, printNextSteps, printUsedRNVersion } from './inform';
2222

2323
const FALLBACK_BOB_VERSION = '0.32.0';
2424
const FALLBACK_NITRO_MODULES_VERSION = '0.18.0';
25-
const FALLBACK_NITRO_CODEGEN_VERSION = '0.18.0';
2625

2726
yargs
2827
.command(
@@ -54,10 +53,6 @@ async function create(_argv: yargs.Arguments<Args>) {
5453
'react-native-nitro-modules',
5554
FALLBACK_NITRO_MODULES_VERSION
5655
);
57-
const nitroCodegenVersionPromise = resolveNpmPackageVersion(
58-
'nitro-codegen',
59-
FALLBACK_NITRO_CODEGEN_VERSION
60-
);
6156

6257
const local = await promptLocalLibrary(argv);
6358
const folder = await promptPath(argv, local);
@@ -79,14 +74,18 @@ async function create(_argv: yargs.Arguments<Args>) {
7974
assertUserInput(questions, answers);
8075

8176
const bobVersion = await bobVersionPromise;
82-
const nitroModulesVersion = await nitroModulesVersionPromise;
83-
const nitroCodegenVersion = await nitroCodegenVersionPromise;
77+
78+
const nitroModulesVersion =
79+
answers.type === 'nitro-module'
80+
? await nitroModulesVersionPromise
81+
: undefined;
8482

8583
const config = generateTemplateConfiguration({
8684
versions: {
8785
bob: bobVersion,
8886
nitroModules: nitroModulesVersion,
89-
nitroCodegen: nitroCodegenVersion,
87+
// Nitro codegen's version is always the same as nitro modules version.
88+
nitroCodegen: nitroModulesVersion,
9089
},
9190
basename,
9291
answers,

packages/create-react-native-library/src/template.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ import type {
1010

1111
export type TemplateVersions = {
1212
bob: string;
13-
nitroModules: string;
14-
nitroCodegen: string;
13+
nitroModules?: string;
14+
nitroCodegen?: string;
1515
};
1616

1717
export type ModuleConfig =

0 commit comments

Comments
 (0)