Skip to content

Commit 3b8be35

Browse files
authored
Merge pull request #1 from Grohden/bugfix/ios-marketing-version
Fix issue with MARKETING_VERSION being updated only at one place
2 parents 88565e0 + eb02014 commit 3b8be35

3 files changed

Lines changed: 22 additions & 6 deletions

File tree

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-cli-bump-version",
3-
"version": "1.0.0",
3+
"version": "1.0.1",
44
"main": "src/index.ts",
55
"types": "lib/index.d.ts",
66
"license": "MIT",
@@ -14,6 +14,7 @@
1414
},
1515
"devDependencies": {
1616
"@types/node": "^13.9.1",
17+
"@types/ramda": "^0.27.0",
1718
"ts-node": "8.6.2",
1819
"typescript": "3.8.3"
1920
}

src/index.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import fs from 'fs'
22
import path from 'path'
33
import chalk from 'chalk'
4-
// @ts-ignore
5-
import { pipe, match, split, curry, map, replace } from 'ramda'
4+
import { pipe, split, curry, map, replace } from 'ramda'
65

76
export type SemVer = 'major' | 'minor' | 'patch'
87
export type Platforms = 'android' | 'ios' | 'all'
@@ -26,7 +25,11 @@ const parseDecimal = (it: string) => parseInt(it, 10)
2625

2726
const parseSemVer = pipe(split('.'), map(parseDecimal))
2827

29-
const matchFirst = curry((reg: RegExp, value: string) => match(reg, value)[1])
28+
const matchFirst = curry((reg: RegExp, value: string) => {
29+
const [, first] = ([] as string[]).concat(reg.exec(value)!)
30+
31+
return first
32+
})
3033

3134
const incrementSemVer = (version: string, type: SemVer | undefined) => {
3235
const [major, minor, patch] = parseSemVer(version)
@@ -72,7 +75,7 @@ abstract class BaseFileManager {
7275
class PBXManager extends BaseFileManager {
7376
bumpProjectVersion() {
7477
const currentFile = this.read()
75-
const codeRegex = /CURRENT_PROJECT_VERSION = (\d+);/
78+
const codeRegex = /CURRENT_PROJECT_VERSION = (\d+);/g
7679
const currentCode = pipe(
7780
matchFirst(codeRegex),
7881
parseDecimal
@@ -93,7 +96,7 @@ class PBXManager extends BaseFileManager {
9396

9497
setMarketingVersion(nextVersion: string) {
9598
const currentFile = this.read()
96-
const versionRegex = /MARKETING_VERSION = (.*);/
99+
const versionRegex = /MARKETING_VERSION = (.*);/g
97100
const currentVersion = matchFirst(versionRegex, currentFile)
98101

99102
this.content = replace(

yarn.lock

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,13 @@
1212
resolved "https://registry.yarnpkg.com/@types/node/-/node-13.9.1.tgz#96f606f8cd67fb018847d9b61e93997dabdefc72"
1313
integrity sha512-E6M6N0blf/jiZx8Q3nb0vNaswQeEyn0XlupO+xN6DtJ6r6IT4nXrTry7zhIfYvFCl3/8Cu6WIysmUBKiqV0bqQ==
1414

15+
"@types/ramda@^0.27.0":
16+
version "0.27.0"
17+
resolved "https://registry.yarnpkg.com/@types/ramda/-/ramda-0.27.0.tgz#e6df564a5f9637c93e708b4fdb948c6a5457ecad"
18+
integrity sha512-/Iw94cBUhU8RS6HvFs0WNrxLrOHS4VdCbaWWemrqaXM4GqNYdw/wtWQXk8nAjMj4YC4EXMumbYGO+D9yhACCLQ==
19+
dependencies:
20+
ts-toolbelt "^6.3.3"
21+
1522
ansi-styles@^4.1.0:
1623
version "4.2.1"
1724
resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.2.1.tgz#90ae75c424d008d2624c5bf29ead3177ebfcf359"
@@ -101,6 +108,11 @@ ts-node@8.6.2:
101108
source-map-support "^0.5.6"
102109
yn "3.1.1"
103110

111+
ts-toolbelt@^6.3.3:
112+
version "6.3.6"
113+
resolved "https://registry.yarnpkg.com/ts-toolbelt/-/ts-toolbelt-6.3.6.tgz#2bde29106c013ed520c32f30e1248daf8fd4f5f9"
114+
integrity sha512-eVzym+LyQodOCfyVyQDQ6FGYbO2Xf9Nc4dGLRKlKSUpAs+8qQWHG+grDiA3ciEuNPNZ0qJnNIYkdqBW1rCWuUA==
115+
104116
typescript@3.8.3:
105117
version "3.8.3"
106118
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.8.3.tgz#409eb8544ea0335711205869ec458ab109ee1061"

0 commit comments

Comments
 (0)