Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

fix patch versioning after changing minor version

ammarahm-ed46d5c6b9e65d
diff --git a/apps/mobile/patches/react-native-cli-bump-version+1.3.0.patch b/apps/mobile/patches/react-native-cli-bump-version+1.3.0.patch
index 8d7a10bdb..09539f30e 100644
--- a/apps/mobile/patches/react-native-cli-bump-version+1.3.0.patch
+++ b/apps/mobile/patches/react-native-cli-bump-version+1.3.0.patch
@@ -1,8 +1,8 @@
diff --git a/node_modules/react-native-cli-bump-version/lib/index.js b/node_modules/react-native-cli-bump-version/lib/index.js
-index a319832..9366079 100644
+index a319832..be566b1 100644
--- a/node_modules/react-native-cli-bump-version/lib/index.js
+++ b/node_modules/react-native-cli-bump-version/lib/index.js
-@@ -23,9 +23,16 @@ const incrementSemVer = (current, type) => {
+@@ -23,9 +23,17 @@ const incrementSemVer = (current, type) => {
if (type === 'minor') {
return [major, minor + 1, 0].join('.');
}
@@ -13,13 +13,15 @@ index a319832..9366079 100644
+ }
+
if (type === 'patch') {
- return [major, minor, patch + 1].join('.');
+- return [major, minor, patch + 1].join('.');
++ let patchV = patch < 10 ? Math.floor((patch/10)) * 10 + 10 : patch + 1;
++ return [major, minor, patchV].join('.');
}
+
throw new Error(`'${type}' is not a semver type`);
};
class BaseFileManager {
-@@ -46,11 +53,27 @@ class BaseFileManager {
+@@ -46,11 +54,29 @@ class BaseFileManager {
}
}
class PBXManager extends BaseFileManager {
@@ -43,13 +45,15 @@ index a319832..9366079 100644
+ }
+
+ if (type ==="patch" || !type) {
-+ nextCode = currentCode + 1;
++ let patchVer = parseInt((currentCode).toString().slice(2));
++ nextCode = patchVer < 10 ? Math.floor((currentCode/10)) * 10 + 10 : currentCode + 1;
++
+ }
+
this.content = ramda_1.replace(codeRegex, `CURRENT_PROJECT_VERSION = ${nextCode};`, currentFile);
return {
current: currentCode,
-@@ -69,12 +92,29 @@ class PBXManager extends BaseFileManager {
+@@ -69,12 +95,30 @@ class PBXManager extends BaseFileManager {
}
}
class BuildGradleManager extends BaseFileManager {
@@ -75,13 +79,14 @@ index a319832..9366079 100644
+ }
+
+ if (type === "patch" || !type) {
-+ next = current + 1;
++ let patchVer = parseInt((current).toString().slice(2));
++ next = patchVer < 10 ? Math.floor((current/10)) * 10 + 10 : current + 1;
+ }
+
if (isNaN(next)) {
throw new Error(`Invalid versionCode version parsed (${versionMatch})`);
}
-@@ -144,13 +184,13 @@ class ProjectFilesManager {
+@@ -144,13 +188,13 @@ class ProjectFilesManager {
console.log(success(`package.json: ${packageCurrent} -> ${packageNext}`));
}
bumpCodes() {