@zalify/cli 0.17.1 → 0.17.2

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.
Files changed (2) hide show
  1. package/dist/cli.js +14 -13
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -11776,20 +11776,20 @@ function managerFor(binPath) {
11776
11776
  if (binPath.includes("/pnpm/") || binPath.includes("/.pnpm/")) {
11777
11777
  return {
11778
11778
  cmd: "pnpm",
11779
- update: (pkg) => ["add", "-g", `${pkg}@latest`],
11779
+ update: (spec) => ["add", "-g", spec],
11780
11780
  remove: `pnpm rm -g ${PACKAGES.join(" ")}`
11781
11781
  };
11782
11782
  }
11783
11783
  if (binPath.includes("/.bun/")) {
11784
11784
  return {
11785
11785
  cmd: "bun",
11786
- update: (pkg) => ["add", "-g", `${pkg}@latest`],
11786
+ update: (spec) => ["add", "-g", spec],
11787
11787
  remove: `bun remove -g ${PACKAGES.join(" ")}`
11788
11788
  };
11789
11789
  }
11790
11790
  return {
11791
11791
  cmd: "npm",
11792
- update: (pkg) => ["install", "-g", `${pkg}@latest`],
11792
+ update: (spec) => ["install", "-g", spec],
11793
11793
  remove: `npm rm -g ${PACKAGES.join(" ")}`
11794
11794
  };
11795
11795
  }
@@ -11819,25 +11819,26 @@ async function selfUpdate(currentVersion) {
11819
11819
  const running = real(process.argv[1] ?? "");
11820
11820
  const manager = managerFor(running);
11821
11821
  const pkg = packageFor(running);
11822
+ let latest = null;
11823
+ try {
11824
+ const info = await updateNotifier({
11825
+ pkg: { name: "@zalify/cli", version: currentVersion }
11826
+ }).fetchInfo();
11827
+ latest = info?.latest ?? null;
11828
+ } catch {}
11829
+ const target = latest ? `${pkg}@${latest}` : `${pkg}@latest`;
11822
11830
  console.log(`Current version: ${currentVersion}`);
11823
- console.log(`Updating via: ${manager.cmd} ${manager.update(pkg).join(" ")}
11831
+ console.log(`Updating via: ${manager.cmd} ${manager.update(target).join(" ")}
11824
11832
  `);
11825
- const result = spawnSync(manager.cmd, manager.update(pkg), {
11833
+ const result = spawnSync(manager.cmd, manager.update(target), {
11826
11834
  stdio: "inherit"
11827
11835
  });
11828
11836
  if (result.error || result.status !== 0) {
11829
11837
  console.error(`
11830
11838
  Update failed${result.error ? `: ${result.error.message}` : ""}.` + `
11831
- Try manually: ${manager.cmd} ${manager.update(pkg).join(" ")}`);
11839
+ Try manually: ${manager.cmd} ${manager.update(target).join(" ")}`);
11832
11840
  process.exit(result.status ?? 1);
11833
11841
  }
11834
- let latest = null;
11835
- try {
11836
- const info = await updateNotifier({
11837
- pkg: { name: "@zalify/cli", version: currentVersion }
11838
- }).fetchInfo();
11839
- latest = info?.latest ?? null;
11840
- } catch {}
11841
11842
  const hits = zalifysOnPath();
11842
11843
  const first = hits[0];
11843
11844
  const firstVersion = first ? versionOf(first) : null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zalify/cli",
3
- "version": "0.17.1",
3
+ "version": "0.17.2",
4
4
  "description": "Zalify CLI - command-line interface for Zalify",
5
5
  "type": "module",
6
6
  "main": "dist/cli.js",