Skip to content

Commit d714c6d

Browse files
authored
Merge pull request #3 from MrLoh/master
Handle case of Several Plist files
2 parents b58aae8 + e7e1307 commit d714c6d

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

index.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ const info = helpers.getPackageInfo(pathToPackage);
1414

1515
const pathToPlist = argv.pathToPlist || `${pathToRoot}/ios/${info.name}/Info.plist`;
1616
const pathToGradle = argv.pathToGradle || `${pathToRoot}/android/app/build.gradle`;
17+
// handle case of several plist files
18+
const pathsToPlists = Array.isArray(pathToPlist) ? pathToPlist : [pathToPlist];
1719

1820

1921
// getting next version
@@ -25,7 +27,7 @@ let patch = helpers.version(versions[2], argv.patch, argv.major || argv.minor);
2527
const version = `${major}.${minor}.${patch}`;
2628

2729
// getting next build number
28-
const buildCurrent = helpers.getBuildNumberFromPlist(pathToPlist);
30+
const buildCurrent = helpers.getBuildNumberFromPlist(pathsToPlists[0]);
2931
const build = buildCurrent + 1;
3032

3133
// getting commit message
@@ -34,7 +36,7 @@ const message = messageTemplate.replace('${version}', version);
3436

3537
log.info('\nI\'m going to increase the version in:');
3638
log.info(`- package.json (${pathToPackage});`, 1);
37-
log.info(`- ios project (${pathToPlist});`, 1);
39+
log.info(`- ios project (${pathsToPlists.join(', ')});`, 1);
3840
log.info(`- android project (${pathToGradle}).`, 1);
3941

4042
log.notice(`\nThe version will be changed:`);
@@ -70,7 +72,9 @@ const update = chain.then(() => {
7072
}).then(() => {
7173
log.info('Updating version in xcode project...', 1);
7274

73-
helpers.changeVersionAndBuildInPlist(pathToPlist, version, build);
75+
pathsToPlists.forEach(pathToPlist => {
76+
helpers.changeVersionAndBuildInPlist(pathToPlist, version, build);
77+
});
7478
log.success(`Version and build number in ios project (plist file) changed.`, 2);
7579
}).then(() => {
7680
log.info('Updating version in android project...', 1);
@@ -91,7 +95,7 @@ const commit = update.then(() => {
9195
if (answer === 'y') {
9296
return helpers.commitVersionIncrease(version, message, [
9397
pathToPackage,
94-
pathToPlist,
98+
...pathsToPlists,
9599
pathToGradle
96100
]).then(() => {
97101
log.success(`Commit with files added. Run "git push".`, 1);

0 commit comments

Comments
 (0)