-
Notifications
You must be signed in to change notification settings - Fork 14
Bump is broken if no version is specified #4
Copy link
Copy link
Closed
Description
Hi!
I came across an issue where specifying some options would actually fail to do any processing on the files.
λ yarn bump:minor
yarn run v1.22.5
$ react-native bump-version --type minor --skip-code-for all
iOS project.pbxproj version: 0.6.0 -> function(str, flags) {
if (arguments.length === 0) return this._version;
this._version = str;
flags = flags || '-V, --version';
var versionOption = new Option(flags, 'output the version number');
this._versionOptionName = versionOption.long.substr(2) || 'version';
this.options.push(versionOption);
this.on('option:' + this._versionOptionName, function() {
process.stdout.write(str + '\n');
process.exit(0);
});
return this;
}
error flags.indexOf is not a function. Run CLI with --verbose flag for more details.
TypeError: flags.indexOf is not a function
at new Option (C:\Projects\<myProject>\node_modules\commander\index.js:46:25)
at Command.version (C:\Projects\<myProject>\node_modules\commander\index.js:855:23)
at String.replace (<anonymous>)
at BuildGradleManager.setVersionName (C:\Projects\<myProject>\node_modules\react-native-cli-bump-version\lib\index.js:95:40)
at ProjectFilesManager.syncSemver (C:\Projects\<myProject>\node_modules\react-native-cli-bump-version\lib\index.js:151:83)
at ProjectFilesManager.dryRun (C:\Projects\<myProject>\node_modules\react-native-cli-bump-version\lib\index.js:195:18)
at ProjectFilesManager.run (C:\Projects\<myProject>\node_modules\react-native-cli-bump-version\lib\index.js:169:14)
at exports.versioner (C:\Projects\<myProject>\node_modules\react-native-cli-bump-version\lib\index.js:202:38)
at Object.func (C:\Projects\<myProject>\node_modules\react-native-cli-bump-version\react-native.config.js:25:13)
at Command.handleAction (C:\<myProject>\node_modules\@react-native-community\cli\build\index.js:191:23)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.I traced the problem down to the use of the new version flag, which is read from args.version. The problem here is that the Commander package does not pass pure objects as args, but rather a Command object. That object does not have a key for version, but has a version() method attached to the prototype, which is the code that you see in the console output.
I have tested this with:
- react-native-cli-bump-version 1.0.4
- commander 2.20.3
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels