gt 2.14.20 → 2.14.21
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.
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# gtx-cli
|
|
2
2
|
|
|
3
|
+
## 2.14.21
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#1261](https://github.com/generaltranslation/gt/pull/1261) [`a2c5c2e`](https://github.com/generaltranslation/gt/commit/a2c5c2e8c748c9d3d81dc3c99800ea17e2f2c9b9) Thanks [@ErnestM1234](https://github.com/ErnestM1234)! - fix(cli): enforcement of gt-react-native and gt-react sync
|
|
8
|
+
|
|
3
9
|
## 2.14.20
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const PACKAGE_VERSION = "2.14.
|
|
1
|
+
export declare const PACKAGE_VERSION = "2.14.21";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// This file is auto-generated. Do not edit manually.
|
|
2
|
-
export const PACKAGE_VERSION = '2.14.
|
|
2
|
+
export const PACKAGE_VERSION = '2.14.21';
|
|
@@ -3,7 +3,14 @@ import path from 'node:path';
|
|
|
3
3
|
import fg from 'fast-glob';
|
|
4
4
|
import chalk from 'chalk';
|
|
5
5
|
import { logger } from '../console/logger.js';
|
|
6
|
+
import { Libraries } from '../types/libraries.js';
|
|
6
7
|
import { resolveConfig } from '../config/resolveConfig.js';
|
|
8
|
+
const SYNCED_VERSION_GROUPS = [
|
|
9
|
+
{
|
|
10
|
+
packages: [Libraries.GT_REACT, Libraries.GT_REACT_NATIVE],
|
|
11
|
+
minVersion: '10.19.1',
|
|
12
|
+
},
|
|
13
|
+
];
|
|
7
14
|
const LOCKFILES = [
|
|
8
15
|
'pnpm-lock.yaml',
|
|
9
16
|
'package-lock.json',
|
|
@@ -111,17 +118,90 @@ function findVersionMismatches(workspaceDirs, readPkgJson, libraries) {
|
|
|
111
118
|
const mismatches = [];
|
|
112
119
|
for (const [packageName, versionMap] of packageVersions) {
|
|
113
120
|
if (versionMap.size > 1) {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
versions
|
|
121
|
+
mismatches.push({
|
|
122
|
+
packageName,
|
|
123
|
+
versions: getSortedVersionInfo(versionMap),
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
return [
|
|
128
|
+
...mismatches,
|
|
129
|
+
...findSyncedPackageVersionMismatches(packageVersions, libraries),
|
|
130
|
+
];
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Find mismatches between package names that must stay on the same version.
|
|
134
|
+
*/
|
|
135
|
+
function findSyncedPackageVersionMismatches(packageVersions, libraries) {
|
|
136
|
+
const enabledLibraries = new Set(libraries);
|
|
137
|
+
const mismatches = [];
|
|
138
|
+
for (const group of SYNCED_VERSION_GROUPS) {
|
|
139
|
+
const enabledGroupPackages = group.packages.filter((pkg) => enabledLibraries.has(pkg));
|
|
140
|
+
if (enabledGroupPackages.length <= 1)
|
|
141
|
+
continue;
|
|
142
|
+
const presentGroupPackages = enabledGroupPackages.filter((pkg) => packageVersions.has(pkg));
|
|
143
|
+
if (presentGroupPackages.length <= 1)
|
|
144
|
+
continue;
|
|
145
|
+
const versionMap = new Map();
|
|
146
|
+
for (const packageName of presentGroupPackages) {
|
|
147
|
+
const packageVersionMap = packageVersions.get(packageName);
|
|
148
|
+
for (const [version, workspaces] of packageVersionMap) {
|
|
149
|
+
const locations = versionMap.get(version) ?? [];
|
|
150
|
+
locations.push(...workspaces.map((workspace) => `${packageName} in ${workspace}`));
|
|
151
|
+
versionMap.set(version, locations);
|
|
117
152
|
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
153
|
+
}
|
|
154
|
+
if (versionMap.size > 1 &&
|
|
155
|
+
shouldCheckSyncedVersionGroup(group, versionMap)) {
|
|
156
|
+
mismatches.push({
|
|
157
|
+
packageName: presentGroupPackages.join(' / '),
|
|
158
|
+
versions: getSortedVersionInfo(versionMap),
|
|
159
|
+
});
|
|
121
160
|
}
|
|
122
161
|
}
|
|
123
162
|
return mismatches;
|
|
124
163
|
}
|
|
164
|
+
function shouldCheckSyncedVersionGroup(group, versionMap) {
|
|
165
|
+
const { minVersion } = group;
|
|
166
|
+
if (!minVersion)
|
|
167
|
+
return true;
|
|
168
|
+
return [...versionMap.keys()].some((version) => isVersionAtLeast(version, minVersion));
|
|
169
|
+
}
|
|
170
|
+
function isVersionAtLeast(version, minVersion) {
|
|
171
|
+
const parsedVersion = parseSemverVersion(version);
|
|
172
|
+
const parsedMinVersion = parseSemverVersion(minVersion);
|
|
173
|
+
if (!parsedVersion || !parsedMinVersion)
|
|
174
|
+
return true;
|
|
175
|
+
return compareSemverVersions(parsedVersion, parsedMinVersion) >= 0;
|
|
176
|
+
}
|
|
177
|
+
function parseSemverVersion(version) {
|
|
178
|
+
const match = version
|
|
179
|
+
.trim()
|
|
180
|
+
.match(/^[\^~<>=\s]*(\d+)(?:\.(\d+))?(?:\.(\d+))?/);
|
|
181
|
+
if (!match)
|
|
182
|
+
return null;
|
|
183
|
+
return {
|
|
184
|
+
major: Number(match[1]),
|
|
185
|
+
minor: Number(match[2] ?? 0),
|
|
186
|
+
patch: Number(match[3] ?? 0),
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
function compareSemverVersions(a, b) {
|
|
190
|
+
if (a.major !== b.major)
|
|
191
|
+
return a.major - b.major;
|
|
192
|
+
if (a.minor !== b.minor)
|
|
193
|
+
return a.minor - b.minor;
|
|
194
|
+
return a.patch - b.patch;
|
|
195
|
+
}
|
|
196
|
+
function getSortedVersionInfo(versionMap) {
|
|
197
|
+
const versions = [];
|
|
198
|
+
for (const [version, workspaces] of versionMap) {
|
|
199
|
+
versions.push({ version, workspaces });
|
|
200
|
+
}
|
|
201
|
+
// Sort by version descending so the latest appears first
|
|
202
|
+
versions.sort((a, b) => b.version.localeCompare(a.version, undefined, { numeric: true }));
|
|
203
|
+
return versions;
|
|
204
|
+
}
|
|
125
205
|
/**
|
|
126
206
|
* Get a human-readable name for a workspace directory.
|
|
127
207
|
*/
|