Make the bare command a check and require --write - #28
Merged
Merged
Conversation
friederbluemle
force-pushed
the
check-mode
branch
2 times, most recently
from
September 4, 2026 18:41
1e6f01c to
41d6f04
Compare
The CLI is about to gain a read-only default mode that compares the native files with the package.json version, which needs a library call that reads the current values of every platform next to the resolved target. checkVersions does that and syncVersions now returns the same per-platform status, read back after writing and with an updated flag, instead of bare file paths. The status also carries the package.json name and version as written, whether the target was overridden with versionName or versionCode, and the platforms whose native file was not found, which replaces the console warning so the caller decides how to present it. Both functions share one lookup of the native files. The updaters lose their verbose parameter and console output; reporting is the caller's job now that the status is returned. SyncOptions extends ReadOptions, so --configuration selects the iOS build configuration for the comparison as it does for reads.
Running rn-version-sync without arguments wrote to the native files, which is unusual for a tool of this kind and left no way to see the current state. The bare command now prints a table with one row per platform, each showing what its file says: js with the name and version from package.json, android and ios with app id, version name and code as written, plus a status of ok or outdated. It exits 1 when a platform is outdated, which makes it a CI check and, for existing `npm version` hooks that are not updated, turns a silent non-update into a loud failure pointing at --write. --write applies the update and prints the same table read back after writing, with updated or unchanged per platform. A platform whose file is not found gets a row saying so instead of a warning on stderr. When --version-name or --version-code replace the package.json values, the js row's status names the target, and the ios row names the configuration when --configuration is given. --dry-run and --verbose are gone: the check covers what --dry-run showed, and the table after --write replaces the verbose log.
friederbluemle
force-pushed
the
check-mode
branch
from
September 4, 2026 18:49
41d6f04 to
d355207
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.
The bare command no longer writes. It compares the native files with the
package.jsonversion and prints one table;--writeapplies the update, in the spirit of Prettier and Biome.jsrow ispackage.json(nameandversion), the native rows show app id, version name and code as written. When--version-nameor--version-codereplace thepackage.jsonvalues, thejsrow's status names the target, e.g.overridden 2.0.0 (20000);--reserve-buildsalone is derived and not marked.npm versionhooks that are not updated to--write: at hook time the native files lag behindpackage.json, so the old hook fails loudly with the hint instead of silently committing a bump that never reached the native files.--writeprints the same table read back after writing, marking each platformupdatedorunchanged.not found, pass --skip-ios to ignore) instead of a warning on stderr; skipped platforms are omitted. With--configuration Stagingthe iOS row is labeledios (Staging).--dry-runand--verboseare removed. The check shows what--dry-rundid and more, and the table after--writereplaces the verbose log. The--print*flags stay as they are for scripting.checkVersionsis new andsyncVersionsreturns the same per-platform status (values read back after writing, plus anupdatedflag) instead of bare paths, along withpackageName,packageVersion,overriddenandmissing. The updaters lose theirverboseparameter and console output.SyncOptionsextendsReadOptions.--writehook.One consequence to be aware of: both modes read the app id for the table, so a project where it cannot be resolved (Android flavors with their own
applicationId, or a variable bundle identifier) now fails in--writetoo, where the old sync worked. That matches the earlier decision to treat such projects as out of scope for now.This changes what the bare command does, so it should go out as 0.8.0 with a prominent release note.