@krx3d/tizentube2 1.15.990 → 1.30.0

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.
@@ -194,11 +194,56 @@ jobs:
194
194
  patch = 0;
195
195
  }
196
196
 
197
- const newVer = `${major}.${minor}.${patch}`;
198
- pkg.version = newVer;
199
-
200
- fs.writeFileSync(path, JSON.stringify(pkg, null, 2) + '\n', 'utf8');
201
- console.log(`Bumped version: ${ver} -> ${newVer}`);
197
+ // npm refuses forever to reuse a version number that was once
198
+ // published and later unpublished. The cleanup step in this same
199
+ // workflow unpublishes old releases, so 780 of the 857 numbers this
200
+ // package has ever used are permanently burned. Whenever
201
+ // package.json drops back into that range - a revert, a bad merge,
202
+ // an upstream sync - every run then fails with
203
+ // E400 Cannot publish over previously published version "x.y.z"
204
+ // and, because the bump is committed and pushed BEFORE publishing,
205
+ // main is left pinned on the burned number so every later run fails
206
+ // the same way. That is exactly what happened twice at 1.16.10.
207
+ //
208
+ // The registry time map lists every version ever used, live or not,
209
+ // so skipping past them makes the bump self-correcting.
210
+ //
211
+ // Wrapped in an async IIFE on purpose: this script is fed to `node -`
212
+ // on stdin, and a top-level await next to the require() above makes
213
+ // Node fail the whole script with ERR_AMBIGUOUS_MODULE_SYNTAX.
214
+ (async () => {
215
+ let used = null;
216
+ try {
217
+ const res = await fetch('https://registry.npmjs.org/' + pkg.name);
218
+ if (res.ok) {
219
+ const meta = await res.json();
220
+ const isSemver = (k) => /^[0-9]+[.][0-9]+[.][0-9]+$/.test(k);
221
+ used = new Set(Object.keys(meta.time || {}).filter(isSemver));
222
+ }
223
+ } catch (e) {
224
+ // Registry unreachable: fall through to the plain bump rather
225
+ // than blocking a release. A real collision still fails loudly
226
+ // at publish.
227
+ used = null;
228
+ }
229
+
230
+ let newVer = `${major}.${minor}.${patch}`;
231
+ if (used) {
232
+ const firstChoice = newVer;
233
+ let guard = 0;
234
+ while (used.has(newVer) && guard++ < 500) {
235
+ patch += 10;
236
+ if (patch >= 1000) { minor += 1; patch = 0; }
237
+ newVer = `${major}.${minor}.${patch}`;
238
+ }
239
+ if (used.has(newVer)) throw new Error('No unused version found near ' + ver);
240
+ if (newVer !== firstChoice) console.log('Skipped burned version numbers: ' + firstChoice + ' -> ' + newVer);
241
+ }
242
+
243
+ pkg.version = newVer;
244
+ fs.writeFileSync(path, JSON.stringify(pkg, null, 2) + String.fromCharCode(10), 'utf8');
245
+ console.log('Bumped version: ' + ver + ' -> ' + newVer);
246
+ })();
202
247
  NODE
203
248
 
204
249
  - name: Show current version (old -> new)