Read project settings from package.json - #29
Merged
friederbluemle merged 1 commit intoSep 5, 2026
Merged
Conversation
Options such as --reserve-builds change the version code every command compares against or writes, so they had to be repeated on each call. Forgetting one silently checks against the wrong code or, with --write, writes a lower code than the native files already hold. Settings that are permanent for a project can now be stored under an "rn-version-sync" key in package.json: reserveBuilds, gradlePath, pbxprojPath, configuration, skipAndroid and skipIos. A command line option takes precedence over the configured value, relative paths are resolved against the project directory, and unknown settings or values of the wrong type are rejected. package.json is the usual place for small tool configuration in the npm ecosystem, and the tool already reads it, so no new file, lookup or dependency is needed. The library functions apply the configuration as well, so programmatic use and the CLI agree.
friederbluemle
force-pushed
the
package-json-config
branch
from
September 5, 2026 00:59
427f58a to
e6c81b8
Compare
Contributor
|
🎉 Released in v0.8.0 |
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.
Options such as
--reserve-buildschange the version code every command compares against or writes, so they had to be repeated on each call. Forgetting one silently checks against the wrong code or, with--write, writes a lower code than the native files already hold. Settings that are permanent for a project can now live inpackage.json:{ "rn-version-sync": { "reserveBuilds": 100 } }reserveBuilds,gradlePath,pbxprojPath,configuration,skipAndroidandskipIosmap to the flags of the same name. Per-invocation flags (--write,--version-name,--version-code, the--print*family and--format) stay command line only.reserveBuildis caught), a value of the wrong type names the expected type, and a key that is not an object is rejected. A missingpackage.jsonmeans no configuration, so--version-nameplus--version-codekeep working without one.checkVersions,syncVersions,resolveVersions,readNativeValuesandformatTemplatefill in options that are not passed explicitly, sosyncVersions(dir)from a script and the CLI agree.loadConfigand theProjectConfigtype are exported, andSyncOptionsnow extendsProjectConfig.configuration. The iOS row readsios (Staging)whether the configuration comes from the flag or frompackage.json.--helpand README document the key, the settings table and the precedence rule; the--reserve-buildsrow points to it.package.jsonis the usual place for small tool configuration in the npm ecosystem, and the tool already reads it, so no new file, lookup or dependency is needed. Deferred for now: an rc file as an alternative location, and a guard that refuses to write a lower version code than the native files hold.