uloop-cli 0.48.2 → 0.48.4
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/dist/cli.bundle.cjs +58 -4
- package/dist/cli.bundle.cjs.map +2 -2
- package/package.json +1 -1
- package/src/cli.ts +67 -2
- package/src/default-tools.json +1 -1
- package/src/version.ts +1 -1
package/package.json
CHANGED
package/src/cli.ts
CHANGED
|
@@ -351,10 +351,70 @@ compdef _uloop uloop`;
|
|
|
351
351
|
/* eslint-enable no-useless-escape */
|
|
352
352
|
}
|
|
353
353
|
|
|
354
|
+
/**
|
|
355
|
+
* Get the currently installed version of uloop-cli from npm.
|
|
356
|
+
*/
|
|
357
|
+
function getInstalledVersion(callback: (version: string | null) => void): void {
|
|
358
|
+
const npmCommand = process.platform === 'win32' ? 'npm.cmd' : 'npm';
|
|
359
|
+
const child = spawn(npmCommand, ['list', '-g', 'uloop-cli', '--json'], {
|
|
360
|
+
shell: true,
|
|
361
|
+
});
|
|
362
|
+
|
|
363
|
+
let stdout = '';
|
|
364
|
+
child.stdout.on('data', (data: Buffer) => {
|
|
365
|
+
stdout += data.toString();
|
|
366
|
+
});
|
|
367
|
+
|
|
368
|
+
child.on('close', (code) => {
|
|
369
|
+
if (code !== 0) {
|
|
370
|
+
callback(null);
|
|
371
|
+
return;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
let parsed: unknown;
|
|
375
|
+
try {
|
|
376
|
+
parsed = JSON.parse(stdout);
|
|
377
|
+
} catch {
|
|
378
|
+
callback(null);
|
|
379
|
+
return;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
if (typeof parsed !== 'object' || parsed === null) {
|
|
383
|
+
callback(null);
|
|
384
|
+
return;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
const deps = (parsed as Record<string, unknown>)['dependencies'];
|
|
388
|
+
if (typeof deps !== 'object' || deps === null) {
|
|
389
|
+
callback(null);
|
|
390
|
+
return;
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
const uloopCli = (deps as Record<string, unknown>)['uloop-cli'];
|
|
394
|
+
if (typeof uloopCli !== 'object' || uloopCli === null) {
|
|
395
|
+
callback(null);
|
|
396
|
+
return;
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
const version = (uloopCli as Record<string, unknown>)['version'];
|
|
400
|
+
if (typeof version !== 'string') {
|
|
401
|
+
callback(null);
|
|
402
|
+
return;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
callback(version);
|
|
406
|
+
});
|
|
407
|
+
|
|
408
|
+
child.on('error', () => {
|
|
409
|
+
callback(null);
|
|
410
|
+
});
|
|
411
|
+
}
|
|
412
|
+
|
|
354
413
|
/**
|
|
355
414
|
* Update uloop CLI to the latest version using npm.
|
|
356
415
|
*/
|
|
357
416
|
function updateCli(): void {
|
|
417
|
+
const previousVersion = VERSION;
|
|
358
418
|
console.log('Updating uloop-cli to the latest version...');
|
|
359
419
|
|
|
360
420
|
const npmCommand = process.platform === 'win32' ? 'npm.cmd' : 'npm';
|
|
@@ -365,8 +425,13 @@ function updateCli(): void {
|
|
|
365
425
|
|
|
366
426
|
child.on('close', (code) => {
|
|
367
427
|
if (code === 0) {
|
|
368
|
-
|
|
369
|
-
|
|
428
|
+
getInstalledVersion((newVersion) => {
|
|
429
|
+
if (newVersion && newVersion !== previousVersion) {
|
|
430
|
+
console.log(`\n✅ uloop-cli updated: v${previousVersion} -> v${newVersion}`);
|
|
431
|
+
} else {
|
|
432
|
+
console.log(`\n✅ Already up to date (v${previousVersion})`);
|
|
433
|
+
}
|
|
434
|
+
});
|
|
370
435
|
} else {
|
|
371
436
|
console.error(`\n❌ Update failed with exit code ${code}`);
|
|
372
437
|
process.exit(1);
|
package/src/default-tools.json
CHANGED
package/src/version.ts
CHANGED
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* This file exists to avoid bundling the entire package.json into the CLI bundle.
|
|
5
5
|
* This version is automatically updated by release-please.
|
|
6
6
|
*/
|
|
7
|
-
export const VERSION = '0.48.
|
|
7
|
+
export const VERSION = '0.48.4'; // x-release-please-version
|