@capawesome/cli 2.1.4-dev.6aa4113.1756747592 → 2.1.4-dev.6aa4113.1756747593
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -12,22 +12,35 @@ export default defineCommand({
|
|
|
12
12
|
process.exit(1);
|
|
13
13
|
}
|
|
14
14
|
const firstVersion = versions[0].version;
|
|
15
|
-
// Check
|
|
16
|
-
const
|
|
15
|
+
// Check major.minor.patch synchronization for all platforms
|
|
16
|
+
const allVersionsInSync = versions.every((pv) => {
|
|
17
17
|
return (pv.version.major === firstVersion.major &&
|
|
18
18
|
pv.version.minor === firstVersion.minor &&
|
|
19
19
|
pv.version.patch === firstVersion.patch);
|
|
20
20
|
});
|
|
21
|
-
|
|
21
|
+
// Check hotfix synchronization between iOS and Android
|
|
22
|
+
const iosVersion = versions.find((pv) => pv.platform === 'ios');
|
|
23
|
+
const androidVersion = versions.find((pv) => pv.platform === 'android');
|
|
24
|
+
let hotfixInSync = true;
|
|
25
|
+
if (iosVersion && androidVersion) {
|
|
26
|
+
const iosHotfix = iosVersion.version.hotfix || 0;
|
|
27
|
+
const androidHotfix = androidVersion.version.hotfix || 0;
|
|
28
|
+
hotfixInSync = iosHotfix === androidHotfix;
|
|
29
|
+
}
|
|
30
|
+
if (!allVersionsInSync || !hotfixInSync) {
|
|
22
31
|
consola.error('Versions are not synchronized across platforms:');
|
|
23
32
|
versions.forEach((pv) => {
|
|
24
33
|
const versionStr = versionToString(pv.version);
|
|
25
|
-
|
|
34
|
+
const hotfixStr = pv.platform !== 'web' && pv.version.hotfix ? ` (hotfix: ${pv.version.hotfix})` : '';
|
|
35
|
+
consola.log(` ${pv.platform}: ${versionStr}${hotfixStr} (${pv.source})`);
|
|
26
36
|
});
|
|
27
37
|
process.exit(1);
|
|
28
38
|
}
|
|
29
39
|
const versionStr = versionToString(firstVersion);
|
|
30
|
-
|
|
40
|
+
// Show hotfix if iOS or Android has one
|
|
41
|
+
const platformWithHotfix = versions.find((pv) => pv.platform !== 'web' && pv.version.hotfix && pv.version.hotfix > 0);
|
|
42
|
+
const hotfixStr = platformWithHotfix ? ` (hotfix: ${platformWithHotfix.version.hotfix})` : '';
|
|
43
|
+
consola.success(`Version: ${versionStr}${hotfixStr}`);
|
|
31
44
|
versions.forEach((pv) => {
|
|
32
45
|
consola.log(` ${pv.platform}: ${pv.source}`);
|
|
33
46
|
});
|
|
@@ -9,9 +9,11 @@ export default defineCommand({
|
|
|
9
9
|
const currentVersion = await versionService.ensureVersionsInSync();
|
|
10
10
|
const newVersion = incrementHotfix(currentVersion);
|
|
11
11
|
const versionStr = versionToString(currentVersion);
|
|
12
|
-
|
|
12
|
+
const currentHotfix = currentVersion.hotfix || 0;
|
|
13
|
+
const newHotfix = newVersion.hotfix || 0;
|
|
14
|
+
consola.info(`Incrementing hotfix for version ${versionStr} (${currentHotfix} -> ${newHotfix})...`);
|
|
13
15
|
await versionService.setVersion(newVersion);
|
|
14
|
-
consola.success(`Hotfix incremented for version ${versionStr}`);
|
|
16
|
+
consola.success(`Hotfix incremented for version ${versionStr} (now ${newHotfix})`);
|
|
15
17
|
}
|
|
16
18
|
catch (error) {
|
|
17
19
|
consola.error(error instanceof Error ? error.message : String(error));
|
|
@@ -15,12 +15,14 @@ export default defineCommand({
|
|
|
15
15
|
consola.info('Current versions:');
|
|
16
16
|
versions.forEach((pv) => {
|
|
17
17
|
const versionStr = versionToString(pv.version);
|
|
18
|
-
|
|
18
|
+
const hotfixStr = pv.platform !== 'web' && pv.version.hotfix ? ` (hotfix: ${pv.version.hotfix})` : '';
|
|
19
|
+
consola.log(` ${pv.platform}: ${versionStr}${hotfixStr}`);
|
|
19
20
|
});
|
|
20
21
|
const highestVersionStr = versionToString(highestVersion);
|
|
21
|
-
|
|
22
|
+
const hotfixStr = highestVersion.hotfix ? ` (hotfix: ${highestVersion.hotfix})` : '';
|
|
23
|
+
consola.info(`Syncing all platforms to highest version: ${highestVersionStr}${hotfixStr}...`);
|
|
22
24
|
await versionService.setVersion(highestVersion);
|
|
23
|
-
consola.success(`All platforms synced to version ${highestVersionStr}`);
|
|
25
|
+
consola.success(`All platforms synced to version ${highestVersionStr}${hotfixStr}`);
|
|
24
26
|
}
|
|
25
27
|
catch (error) {
|
|
26
28
|
consola.error(error instanceof Error ? error.message : String(error));
|
|
@@ -38,7 +38,7 @@ export class VersionService {
|
|
|
38
38
|
if (!project.ios) {
|
|
39
39
|
return null;
|
|
40
40
|
}
|
|
41
|
-
const iosProject =
|
|
41
|
+
const iosProject = project.ios.getPbxProject();
|
|
42
42
|
if (!iosProject) {
|
|
43
43
|
return null;
|
|
44
44
|
}
|
|
@@ -161,16 +161,32 @@ export class VersionService {
|
|
|
161
161
|
if (!firstVersion) {
|
|
162
162
|
throw new Error('No platform versions found');
|
|
163
163
|
}
|
|
164
|
-
//
|
|
165
|
-
const
|
|
164
|
+
// Check major.minor.patch synchronization for all platforms
|
|
165
|
+
const allVersionsInSync = versions.every((pv) => pv.version.major === firstVersion.major &&
|
|
166
166
|
pv.version.minor === firstVersion.minor &&
|
|
167
167
|
pv.version.patch === firstVersion.patch);
|
|
168
|
-
if (!
|
|
169
|
-
const versionStrings = versions.map((pv) =>
|
|
168
|
+
if (!allVersionsInSync) {
|
|
169
|
+
const versionStrings = versions.map((pv) => {
|
|
170
|
+
const versionStr = versionToString(pv.version);
|
|
171
|
+
const hotfixStr = pv.platform !== 'web' && pv.version.hotfix ? ` (hotfix: ${pv.version.hotfix})` : '';
|
|
172
|
+
return `${pv.platform}: ${versionStr}${hotfixStr} (${pv.source})`;
|
|
173
|
+
});
|
|
170
174
|
throw new Error(`Versions are not synchronized across platforms:\n${versionStrings.join('\n')}`);
|
|
171
175
|
}
|
|
172
|
-
//
|
|
173
|
-
const
|
|
176
|
+
// Check hotfix synchronization between iOS and Android only
|
|
177
|
+
const iosVersion = versions.find((pv) => pv.platform === 'ios');
|
|
178
|
+
const androidVersion = versions.find((pv) => pv.platform === 'android');
|
|
179
|
+
if (iosVersion && androidVersion) {
|
|
180
|
+
const iosHotfix = iosVersion.version.hotfix || 0;
|
|
181
|
+
const androidHotfix = androidVersion.version.hotfix || 0;
|
|
182
|
+
if (iosHotfix !== androidHotfix) {
|
|
183
|
+
throw new Error(`Hotfix versions are not synchronized between iOS and Android:\n` +
|
|
184
|
+
`iOS: ${versionToString(iosVersion.version)} (hotfix: ${iosHotfix})\n` +
|
|
185
|
+
`Android: ${versionToString(androidVersion.version)} (hotfix: ${androidHotfix})`);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
// Return version with hotfix from iOS or Android if available
|
|
189
|
+
const versionWithHotfix = versions.find((pv) => pv.platform !== 'web' && pv.version.hotfix && pv.version.hotfix > 0);
|
|
174
190
|
return versionWithHotfix ? versionWithHotfix.version : firstVersion;
|
|
175
191
|
}
|
|
176
192
|
async getHighestVersion() {
|
package/dist/utils/version.js
CHANGED
|
@@ -12,7 +12,7 @@ export const parseVersion = (versionString) => {
|
|
|
12
12
|
if (major < 0 || minor < 0 || patch < 0) {
|
|
13
13
|
throw new Error(`Invalid version format: ${versionString}. Version parts must be non-negative.`);
|
|
14
14
|
}
|
|
15
|
-
return { major, minor, patch
|
|
15
|
+
return { major, minor, patch };
|
|
16
16
|
};
|
|
17
17
|
export const parseBuildNumber = (buildNumber) => {
|
|
18
18
|
const buildStr = buildNumber.toString();
|
|
@@ -37,38 +37,39 @@ export const versionToBuildNumber = (version) => {
|
|
|
37
37
|
const majorStr = version.major.toString();
|
|
38
38
|
const minor = version.minor.toString().padStart(3, '0');
|
|
39
39
|
const patch = version.patch.toString().padStart(2, '0');
|
|
40
|
-
const hotfix = version.hotfix.toString().padStart(2, '0');
|
|
40
|
+
const hotfix = (version.hotfix || 0).toString().padStart(2, '0');
|
|
41
41
|
if (version.minor > 999) {
|
|
42
42
|
throw new Error(`Minor version ${version.minor} exceeds maximum value of 999`);
|
|
43
43
|
}
|
|
44
44
|
if (version.patch > 99) {
|
|
45
45
|
throw new Error(`Patch version ${version.patch} exceeds maximum value of 99`);
|
|
46
46
|
}
|
|
47
|
-
if (version.hotfix > 99) {
|
|
47
|
+
if (version.hotfix && version.hotfix > 99) {
|
|
48
48
|
throw new Error(`Hotfix version ${version.hotfix} exceeds maximum value of 99`);
|
|
49
49
|
}
|
|
50
50
|
return parseInt(`${majorStr}${minor}${patch}${hotfix}`, 10);
|
|
51
51
|
};
|
|
52
52
|
export const incrementMajor = (version) => {
|
|
53
53
|
const newMajor = version.major + 1;
|
|
54
|
-
return { major: newMajor, minor: 0, patch: 0
|
|
54
|
+
return { major: newMajor, minor: 0, patch: 0 };
|
|
55
55
|
};
|
|
56
56
|
export const incrementMinor = (version) => {
|
|
57
57
|
const newMinor = version.minor + 1;
|
|
58
58
|
if (newMinor > 999) {
|
|
59
59
|
throw new Error(`Cannot increment minor version: would exceed maximum value of 999`);
|
|
60
60
|
}
|
|
61
|
-
return {
|
|
61
|
+
return { major: version.major, minor: newMinor, patch: 0 };
|
|
62
62
|
};
|
|
63
63
|
export const incrementPatch = (version) => {
|
|
64
64
|
const newPatch = version.patch + 1;
|
|
65
65
|
if (newPatch > 99) {
|
|
66
66
|
throw new Error(`Cannot increment patch version: would exceed maximum value of 99`);
|
|
67
67
|
}
|
|
68
|
-
return {
|
|
68
|
+
return { major: version.major, minor: version.minor, patch: newPatch };
|
|
69
69
|
};
|
|
70
70
|
export const incrementHotfix = (version) => {
|
|
71
|
-
const
|
|
71
|
+
const currentHotfix = version.hotfix || 0;
|
|
72
|
+
const newHotfix = currentHotfix + 1;
|
|
72
73
|
if (newHotfix > 99) {
|
|
73
74
|
throw new Error(`Cannot increment hotfix version: would exceed maximum value of 99`);
|
|
74
75
|
}
|
|
@@ -81,10 +82,15 @@ export const compareVersions = (v1, v2) => {
|
|
|
81
82
|
return v1.minor - v2.minor;
|
|
82
83
|
if (v1.patch !== v2.patch)
|
|
83
84
|
return v1.patch - v2.patch;
|
|
84
|
-
|
|
85
|
-
|
|
85
|
+
const h1 = v1.hotfix || 0;
|
|
86
|
+
const h2 = v2.hotfix || 0;
|
|
87
|
+
if (h1 !== h2)
|
|
88
|
+
return h1 - h2;
|
|
86
89
|
return 0;
|
|
87
90
|
};
|
|
88
|
-
export const versionsEqual = (v1, v2) => {
|
|
91
|
+
export const versionsEqual = (v1, v2, ignoreHotfix = false) => {
|
|
92
|
+
if (ignoreHotfix) {
|
|
93
|
+
return v1.major === v2.major && v1.minor === v2.minor && v1.patch === v2.patch;
|
|
94
|
+
}
|
|
89
95
|
return compareVersions(v1, v2) === 0;
|
|
90
96
|
};
|
package/package.json
CHANGED