@windrun-huaiin/dev-scripts 14.1.0 → 14.1.1

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.
@@ -1 +1 @@
1
- {"version":3,"file":"diaomao-update.d.ts","sourceRoot":"","sources":["../../src/commands/diaomao-update.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAA;AAoN7D,wBAAsB,aAAa,CACjC,MAAM,EAAE,gBAAgB,EACxB,GAAG,GAAE,MAA6D,GACjE,OAAO,CAAC,MAAM,CAAC,CAyKjB"}
1
+ {"version":3,"file":"diaomao-update.d.ts","sourceRoot":"","sources":["../../src/commands/diaomao-update.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAA;AA0O7D,wBAAsB,aAAa,CACjC,MAAM,EAAE,gBAAgB,EACxB,GAAG,GAAE,MAA6D,GACjE,OAAO,CAAC,MAAM,CAAC,CA6LjB"}
@@ -59,17 +59,31 @@ function stripProtocolPrefix(version) {
59
59
  }
60
60
  return version;
61
61
  }
62
+ function isTagVersion(version) {
63
+ return version === 'latest';
64
+ }
65
+ function getComparableMinVersion(version) {
66
+ try {
67
+ return semver.minVersion(version);
68
+ }
69
+ catch {
70
+ return null;
71
+ }
72
+ }
62
73
  function compareVersionSpecs(currentVersion, targetVersion) {
74
+ const normalizedCurrent = stripProtocolPrefix(currentVersion);
75
+ const normalizedTarget = stripProtocolPrefix(targetVersion);
76
+ if (isTagVersion(normalizedCurrent) || isTagVersion(normalizedTarget)) {
77
+ return 'uncomparable';
78
+ }
63
79
  if (currentVersion === targetVersion) {
64
80
  return 'same';
65
81
  }
66
- const normalizedCurrent = stripProtocolPrefix(currentVersion);
67
- const normalizedTarget = stripProtocolPrefix(targetVersion);
68
82
  if (normalizedCurrent === normalizedTarget) {
69
83
  return 'same';
70
84
  }
71
- const currentMin = semver.minVersion(normalizedCurrent);
72
- const targetMin = semver.minVersion(normalizedTarget);
85
+ const currentMin = getComparableMinVersion(normalizedCurrent);
86
+ const targetMin = getComparableMinVersion(normalizedTarget);
73
87
  if (currentMin && targetMin) {
74
88
  const comparison = semver.compare(currentMin, targetMin);
75
89
  if (comparison > 0) {
@@ -80,7 +94,7 @@ function compareVersionSpecs(currentVersion, targetVersion) {
80
94
  }
81
95
  return 'update';
82
96
  }
83
- return 'update';
97
+ return 'uncomparable';
84
98
  }
85
99
  function extractCatalog(workspaceContent) {
86
100
  const parsed = yaml.parse(workspaceContent);
@@ -235,6 +249,15 @@ async function diaomaoUpdate(config, cwd = typeof process !== 'undefined' ? proc
235
249
  });
236
250
  continue;
237
251
  }
252
+ if (decision === 'uncomparable') {
253
+ skipRows.push({
254
+ packageName,
255
+ currentVersion: localCatalogVersion,
256
+ targetVersion,
257
+ reason: 'skipped-uncomparable'
258
+ });
259
+ continue;
260
+ }
238
261
  localCatalog[packageName] = targetVersion;
239
262
  workspaceChanged = true;
240
263
  updatedRows.push({
@@ -263,6 +286,15 @@ async function diaomaoUpdate(config, cwd = typeof process !== 'undefined' ? proc
263
286
  });
264
287
  continue;
265
288
  }
289
+ if (decision === 'uncomparable') {
290
+ skipRows.push({
291
+ packageName,
292
+ currentVersion: currentSpecifier,
293
+ targetVersion,
294
+ reason: 'skipped-uncomparable'
295
+ });
296
+ continue;
297
+ }
266
298
  dependencies[packageName] = targetVersion;
267
299
  packageJsonChanged = true;
268
300
  updatedRows.push({
@@ -57,17 +57,31 @@ function stripProtocolPrefix(version) {
57
57
  }
58
58
  return version;
59
59
  }
60
+ function isTagVersion(version) {
61
+ return version === 'latest';
62
+ }
63
+ function getComparableMinVersion(version) {
64
+ try {
65
+ return semver.minVersion(version);
66
+ }
67
+ catch {
68
+ return null;
69
+ }
70
+ }
60
71
  function compareVersionSpecs(currentVersion, targetVersion) {
72
+ const normalizedCurrent = stripProtocolPrefix(currentVersion);
73
+ const normalizedTarget = stripProtocolPrefix(targetVersion);
74
+ if (isTagVersion(normalizedCurrent) || isTagVersion(normalizedTarget)) {
75
+ return 'uncomparable';
76
+ }
61
77
  if (currentVersion === targetVersion) {
62
78
  return 'same';
63
79
  }
64
- const normalizedCurrent = stripProtocolPrefix(currentVersion);
65
- const normalizedTarget = stripProtocolPrefix(targetVersion);
66
80
  if (normalizedCurrent === normalizedTarget) {
67
81
  return 'same';
68
82
  }
69
- const currentMin = semver.minVersion(normalizedCurrent);
70
- const targetMin = semver.minVersion(normalizedTarget);
83
+ const currentMin = getComparableMinVersion(normalizedCurrent);
84
+ const targetMin = getComparableMinVersion(normalizedTarget);
71
85
  if (currentMin && targetMin) {
72
86
  const comparison = semver.compare(currentMin, targetMin);
73
87
  if (comparison > 0) {
@@ -78,7 +92,7 @@ function compareVersionSpecs(currentVersion, targetVersion) {
78
92
  }
79
93
  return 'update';
80
94
  }
81
- return 'update';
95
+ return 'uncomparable';
82
96
  }
83
97
  function extractCatalog(workspaceContent) {
84
98
  const parsed = parse(workspaceContent);
@@ -233,6 +247,15 @@ async function diaomaoUpdate(config, cwd = typeof process !== 'undefined' ? proc
233
247
  });
234
248
  continue;
235
249
  }
250
+ if (decision === 'uncomparable') {
251
+ skipRows.push({
252
+ packageName,
253
+ currentVersion: localCatalogVersion,
254
+ targetVersion,
255
+ reason: 'skipped-uncomparable'
256
+ });
257
+ continue;
258
+ }
236
259
  localCatalog[packageName] = targetVersion;
237
260
  workspaceChanged = true;
238
261
  updatedRows.push({
@@ -261,6 +284,15 @@ async function diaomaoUpdate(config, cwd = typeof process !== 'undefined' ? proc
261
284
  });
262
285
  continue;
263
286
  }
287
+ if (decision === 'uncomparable') {
288
+ skipRows.push({
289
+ packageName,
290
+ currentVersion: currentSpecifier,
291
+ targetVersion,
292
+ reason: 'skipped-uncomparable'
293
+ });
294
+ continue;
295
+ }
264
296
  dependencies[packageName] = targetVersion;
265
297
  packageJsonChanged = true;
266
298
  updatedRows.push({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@windrun-huaiin/dev-scripts",
3
- "version": "14.1.0",
3
+ "version": "14.1.1",
4
4
  "description": "Development scripts for multilingual projects",
5
5
  "main": "dist/index.js",
6
6
  "bin": {