11import fs from 'fs'
22import path from 'path'
33import 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
76export type SemVer = 'major' | 'minor' | 'patch'
87export type Platforms = 'android' | 'ios' | 'all'
@@ -26,7 +25,11 @@ const parseDecimal = (it: string) => parseInt(it, 10)
2625
2726const 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
3134const incrementSemVer = ( version : string , type : SemVer | undefined ) => {
3235 const [ major , minor , patch ] = parseSemVer ( version )
@@ -72,7 +75,7 @@ abstract class BaseFileManager {
7275class PBXManager extends BaseFileManager {
7376 bumpProjectVersion ( ) {
7477 const currentFile = this . read ( )
75- const codeRegex = / C U R R E N T _ P R O J E C T _ V E R S I O N = ( \d + ) ; /
78+ const codeRegex = / C U R R E N T _ P R O J E C T _ V E R S I O N = ( \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 = / M A R K E T I N G _ V E R S I O N = ( .* ) ; /
99+ const versionRegex = / M A R K E T I N G _ V E R S I O N = ( .* ) ; / g
97100 const currentVersion = matchFirst ( versionRegex , currentFile )
98101
99102 this . content = replace (
0 commit comments