Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions react-native.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ module.exports = {
pbxprojPath: config.project.ios.pbxprojPath,
buildGradlePath: appGradlePath,
type: args.type,
version: args.version,
skipCodeFor: args.skipCodeFor
? args.skipCodeFor.split(' ')
: [],
Expand All @@ -36,6 +37,10 @@ module.exports = {
name: '--type [major|minor|patch]',
description: 'SemVer release type, optional if --skip-semver-for all is passed'
},
{
name: '--version [String]',
description: 'Pass release version if known. Overwrites calculated SemVer. Optional.'
},
{
name: '--skip-semver-for [android|ios|all]',
description: 'Skips bump SemVer for specified platform'
Expand Down
9 changes: 5 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export type Platforms = 'android' | 'ios' | 'all'

type Configs = {
type?: SemVer
version?: string
skipSemVerFor: Platforms[]
skipCodeFor: Platforms[]
root: string
Expand All @@ -30,8 +31,8 @@ const matchFirst = curry((reg: RegExp, value: string) => {
return first
})

const incrementSemVer = (version: string, type: SemVer | undefined) => {
const [major, minor, patch] = parseSemVer(version)
const incrementSemVer = (current: string, type: SemVer | undefined) => {
const [major, minor, patch] = parseSemVer(current)

if (type === 'major') {
return [major + 1, 0, 0].join('.')
Expand Down Expand Up @@ -272,9 +273,9 @@ export class ProjectFilesManager {
* This executes changes but don't actually write anything to fs
*/
dryRun() {
const { type, skipSemVerFor, skipCodeFor } = this.configs
const { type, version, skipSemVerFor, skipCodeFor } = this.configs
const current = this.packageJSON.getVersion()
const next = incrementSemVer(current, type ?? 'minor')
const next = version ?? incrementSemVer(current, type ?? 'minor')

if (!skipCodeFor.includes('all')) {
this.bumpCodes()
Expand Down