-
Notifications
You must be signed in to change notification settings - Fork 4
Feat/nitro bump up #344
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat/nitro bump up #344
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -29,5 +29,5 @@ updates: | |
| - 'react-native' | ||
| nitro: | ||
| patterns: | ||
| - 'nitro-codegen' | ||
| - 'nitrogen' | ||
| - 'react-native-nitro-modules' | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -52,5 +52,5 @@ updates: | |
| - '@react-native/*' | ||
| nitro: | ||
| patterns: | ||
| - 'nitro-codegen' | ||
| - 'nitrogen' | ||
| - 'react-native-nitro-modules' | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -180,16 +180,16 @@ export class NitroModuleFactory { | |||||||||||||||||
| newWorkspacePackageJsonFile.scripts = { | ||||||||||||||||||
| ...newWorkspacePackageJsonFile.scripts, | ||||||||||||||||||
| build: `${this.config.pm} run typecheck && bob build`, | ||||||||||||||||||
| codegen: `nitro-codegen --logLevel="debug" && ${this.config.pm} run build${this.config.langs.includes(SupportedLang.KOTLIN) ? ' && node post-script.js' : ''}`, | ||||||||||||||||||
| codegen: `nitrogen --logLevel="debug" && ${this.config.pm} run build${this.config.langs.includes(SupportedLang.KOTLIN) ? ' && node post-script.js' : ''}`, | ||||||||||||||||||
| postcodegen: this.getPostCodegenScript(), | ||||||||||||||||||
| } | ||||||||||||||||||
|
|
||||||||||||||||||
| // Resolve and pin latest Nitro tools to concrete versions | ||||||||||||||||||
| const nitroGen = 'nitro-codegen' | ||||||||||||||||||
| const nitrogen = 'nitrogen' | ||||||||||||||||||
| const nitroModules = 'react-native-nitro-modules' | ||||||||||||||||||
| const [nitroModulesVersion, nitroCodegenVersion] = await Promise.all([ | ||||||||||||||||||
| const [nitroModulesVersion, nitrogenVersion] = await Promise.all([ | ||||||||||||||||||
| this.getLatestVersion(nitroModules), | ||||||||||||||||||
| this.getLatestVersion(nitroGen), | ||||||||||||||||||
| this.getLatestVersion(nitrogen), | ||||||||||||||||||
| ]) | ||||||||||||||||||
| this.nitroModulesVersion = nitroModulesVersion | ||||||||||||||||||
| newWorkspacePackageJsonFile.devDependencies = { | ||||||||||||||||||
|
|
@@ -198,10 +198,10 @@ export class NitroModuleFactory { | |||||||||||||||||
| nitroModulesVersion ?? | ||||||||||||||||||
| newWorkspacePackageJsonFile.devDependencies?.[nitroModules] ?? | ||||||||||||||||||
| templatePackageJson.devDependencies[nitroModules], | ||||||||||||||||||
| [nitroGen]: | ||||||||||||||||||
| nitroCodegenVersion ?? | ||||||||||||||||||
| newWorkspacePackageJsonFile.devDependencies?.[nitroGen] ?? | ||||||||||||||||||
| templatePackageJson.devDependencies[nitroGen], | ||||||||||||||||||
| [nitrogen]: | ||||||||||||||||||
| nitrogenVersion ?? | ||||||||||||||||||
| newWorkspacePackageJsonFile.devDependencies?.[nitrogen] ?? | ||||||||||||||||||
| templatePackageJson.devDependencies[nitrogen], | ||||||||||||||||||
| } | ||||||||||||||||||
|
|
||||||||||||||||||
| newWorkspacePackageJsonFile.keywords = [ | ||||||||||||||||||
|
|
@@ -497,7 +497,7 @@ export class NitroModuleFactory { | |||||||||||||||||
| await execAsync(`${this.config.pm} install`, { cwd: this.config.cwd }) | ||||||||||||||||||
| let packageManager = | ||||||||||||||||||
| this.config.pm === 'npm' ? 'npx --yes' : this.config.pm | ||||||||||||||||||
| let codegenCommand = `${packageManager} nitro-codegen --logLevel="debug" && ${this.config.pm} run build${this.config.langs.includes(SupportedLang.KOTLIN) ? ' && node post-script.js' : ''}` | ||||||||||||||||||
| let codegenCommand = `${packageManager} nitrogen --logLevel="debug" && ${this.config.pm} run build${this.config.langs.includes(SupportedLang.KOTLIN) ? ' && node post-script.js' : ''}` | ||||||||||||||||||
| await execAsync(codegenCommand, { cwd: this.config.cwd }) | ||||||||||||||||||
| } | ||||||||||||||||||
|
Comment on lines
498
to
502
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Codegen invocation breaks for pnpm/bun; prefer running the script or PM-aware exec
You already define a Apply: - let packageManager =
- this.config.pm === 'npm' ? 'npx --yes' : this.config.pm
- let codegenCommand = `${packageManager} nitrogen --logLevel="debug" && ${this.config.pm} run build${this.config.langs.includes(SupportedLang.KOTLIN) ? ' && node post-script.js' : ''}`
- await execAsync(codegenCommand, { cwd: this.config.cwd })
+ await execAsync(`${this.config.pm} run codegen`, { cwd: this.config.cwd })Alternative (PM-aware exec) if you don’t want to rely on the script: - let packageManager =
- this.config.pm === 'npm' ? 'npx --yes' : this.config.pm
- let codegenCommand = `${packageManager} nitrogen --logLevel="debug" && ${this.config.pm} run build${this.config.langs.includes(SupportedLang.KOTLIN) ? ' && node post-script.js' : ''}`
- await execAsync(codegenCommand, { cwd: this.config.cwd })
+ const pm = this.config.pm
+ const x =
+ pm === 'npm' ? 'npx --yes' :
+ pm === 'pnpm' ? 'pnpm exec' :
+ pm === 'yarn' ? 'yarn dlx' :
+ pm === 'bun' ? 'bunx' : null
+ if (!x) throw new Error(`Unsupported package manager: ${pm}`)
+ await execAsync(`${x} nitrogen --logLevel="debug"`, { cwd: this.config.cwd })
+ await execAsync(`${pm} run build${this.config.langs.includes(SupportedLang.KOTLIN) ? ' && node post-script.js' : ''}`, { cwd: this.config.cwd })📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||
|
|
||||||||||||||||||
|
|
||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
🧩 Analysis chain
Suspicious version string for react-native-nitro-modules — likely typo
^0.2942looks malformed (missing a dot). This will fail resolution and could cascade into install failures whengetLatestVersionreturns null and we fall back to the template value.Proposed fix (pick a valid semver for the intended bump; placeholder uses the nearest plausible range):
To verify available versions:
🏁 Script executed:
Length of output: 122
Fix malformed react-native-nitro-modules version
Replace in assets/template/package.json:
to match the latest published 0.29.4 release.
📝 Committable suggestion
🤖 Prompt for AI Agents