fix(0.81, macos-init): improve init flow and drop chalk dependency#2859
Open
Saadnajmi wants to merge 2 commits intomicrosoft:0.81-stablefrom
Open
fix(0.81, macos-init): improve init flow and drop chalk dependency#2859Saadnajmi wants to merge 2 commits intomicrosoft:0.81-stablefrom
Saadnajmi wants to merge 2 commits intomicrosoft:0.81-stablefrom
Conversation
|
- Remove redundant dependency install (generate-macos.js was running npm i/yarn after cli.ts already installed react-native-macos) - Show npm/yarn errors on install failure instead of hiding them with --silent flag - Validate peer dependencies before install and warn on mismatch - Auto-run pod install after template generation (non-fatal on failure) - Fix finish message: remove nonexistent yarn start:macos, show correct npx react-native run-macos and npx react-native start commands Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Drop the chalk dependency in favor of Node's built-in styleText API (available since Node 20.12). Add @types/node@^22 as a devDependency for proper type resolution. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
4bc094b to
2667352
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
generate-macos.jswas runningnpm i/yarna second time aftercli.tsalready installedreact-native-macos)--silentyarn start:macos, show correctpod install,npx react-native run-macosandnpx react-native startchalkwith Node's built-innode:utilstyleText(available since Node 20.12)Motivation
Users hitting
npx react-native-macos-initfrequently encounter silent failures from peer dependency mismatches (e.g.react-native-macos@0.81.4requiresreact-native@0.81.6exactly, but--version 0.81installs the latest patch). The--silentflag hid the actual error. The finish message referenced a nonexistentyarn start:macosscript.Addresses the same root issue as #2785 and #2793 but with a broader fix.
Backport of #2858.
Test plan
npx @react-native-community/cli init testapp --version 0.81.6react-native@0.81.5vs required0.81.6) — warning fires before install with clear message🤖 Generated with Claude Code