uloop-cli 0.48.2 → 0.48.3

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.
@@ -5621,7 +5621,7 @@ var import_path3 = require("path");
5621
5621
 
5622
5622
  // src/default-tools.json
5623
5623
  var default_tools_default = {
5624
- version: "0.48.2",
5624
+ version: "0.48.3",
5625
5625
  tools: [
5626
5626
  {
5627
5627
  name: "compile",
@@ -6042,7 +6042,7 @@ function getCacheFilePath() {
6042
6042
  }
6043
6043
 
6044
6044
  // src/version.ts
6045
- var VERSION = "0.48.2";
6045
+ var VERSION = "0.48.3";
6046
6046
 
6047
6047
  // src/spinner.ts
6048
6048
  var SPINNER_FRAMES = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
@@ -6900,7 +6900,54 @@ _uloop() {
6900
6900
  }
6901
6901
  compdef _uloop uloop`;
6902
6902
  }
6903
+ function getInstalledVersion(callback) {
6904
+ const npmCommand = process.platform === "win32" ? "npm.cmd" : "npm";
6905
+ const child = (0, import_child_process.spawn)(npmCommand, ["list", "-g", "uloop-cli", "--json"], {
6906
+ shell: true
6907
+ });
6908
+ let stdout = "";
6909
+ child.stdout.on("data", (data) => {
6910
+ stdout += data.toString();
6911
+ });
6912
+ child.on("close", (code) => {
6913
+ if (code !== 0) {
6914
+ callback(null);
6915
+ return;
6916
+ }
6917
+ let parsed;
6918
+ try {
6919
+ parsed = JSON.parse(stdout);
6920
+ } catch {
6921
+ callback(null);
6922
+ return;
6923
+ }
6924
+ if (typeof parsed !== "object" || parsed === null) {
6925
+ callback(null);
6926
+ return;
6927
+ }
6928
+ const deps = parsed["dependencies"];
6929
+ if (typeof deps !== "object" || deps === null) {
6930
+ callback(null);
6931
+ return;
6932
+ }
6933
+ const uloopCli = deps["uloop-cli"];
6934
+ if (typeof uloopCli !== "object" || uloopCli === null) {
6935
+ callback(null);
6936
+ return;
6937
+ }
6938
+ const version = uloopCli["version"];
6939
+ if (typeof version !== "string") {
6940
+ callback(null);
6941
+ return;
6942
+ }
6943
+ callback(version);
6944
+ });
6945
+ child.on("error", () => {
6946
+ callback(null);
6947
+ });
6948
+ }
6903
6949
  function updateCli() {
6950
+ const previousVersion = VERSION;
6904
6951
  console.log("Updating uloop-cli to the latest version...");
6905
6952
  const npmCommand = process.platform === "win32" ? "npm.cmd" : "npm";
6906
6953
  const child = (0, import_child_process.spawn)(npmCommand, ["install", "-g", "uloop-cli@latest"], {
@@ -6909,8 +6956,15 @@ function updateCli() {
6909
6956
  });
6910
6957
  child.on("close", (code) => {
6911
6958
  if (code === 0) {
6912
- console.log("\n\u2705 uloop-cli has been updated successfully!");
6913
- console.log('Run "uloop --version" to check the new version.');
6959
+ getInstalledVersion((newVersion) => {
6960
+ if (newVersion && newVersion !== previousVersion) {
6961
+ console.log(`
6962
+ \u2705 uloop-cli updated: v${previousVersion} -> v${newVersion}`);
6963
+ } else {
6964
+ console.log(`
6965
+ \u2705 Already up to date (v${previousVersion})`);
6966
+ }
6967
+ });
6914
6968
  } else {
6915
6969
  console.error(`
6916
6970
  \u274C Update failed with exit code ${code}`);