@zapier/zapier-sdk-cli 0.14.0 → 0.15.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zapier/zapier-sdk-cli",
3
- "version": "0.14.0",
3
+ "version": "0.15.0",
4
4
  "description": "Command line interface for Zapier SDK",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",
@@ -44,10 +44,11 @@
44
44
  "ora": "^8.2.0",
45
45
  "package-json": "^10.0.1",
46
46
  "pkce-challenge": "^5.0.0",
47
+ "semver": "^7.7.3",
47
48
  "typescript": "^5.8.3",
48
49
  "zod": "^3.25.67",
49
- "@zapier/zapier-sdk-cli-login": "0.3.4",
50
50
  "@zapier/zapier-sdk": "0.15.2",
51
+ "@zapier/zapier-sdk-cli-login": "0.3.4",
51
52
  "@zapier/zapier-sdk-mcp": "0.3.26"
52
53
  },
53
54
  "devDependencies": {
@@ -55,6 +56,7 @@
55
56
  "@types/inquirer": "^9.0.8",
56
57
  "@types/jsonwebtoken": "^9.0.10",
57
58
  "@types/node": "^24.0.1",
59
+ "@types/semver": "^7.7.1",
58
60
  "tsup": "^8.5.0",
59
61
  "vitest": "^3.2.3"
60
62
  },
@@ -53,31 +53,31 @@ export function getUpdateCommand(packageName: string): string {
53
53
  // Global update commands
54
54
  switch (pm.name) {
55
55
  case "yarn":
56
- return `yarn global upgrade ${packageName}`;
56
+ return `yarn global upgrade ${packageName}@latest`;
57
57
  case "pnpm":
58
- return `pnpm update -g ${packageName}`;
58
+ return `pnpm update -g ${packageName}@latest`;
59
59
  case "bun":
60
- return `bun update -g ${packageName}`;
60
+ return `bun update -g ${packageName}@latest`;
61
61
  case "npm":
62
- return `npm update -g ${packageName}`;
62
+ return `npm update -g ${packageName}@latest`;
63
63
  case "unknown":
64
64
  // Default to npm since it's most widely supported
65
- return `npm update -g ${packageName}`;
65
+ return `npm update -g ${packageName}@latest`;
66
66
  }
67
67
  } else {
68
68
  // Local update commands
69
69
  switch (pm.name) {
70
70
  case "yarn":
71
- return `yarn upgrade ${packageName}`;
71
+ return `yarn upgrade ${packageName}@latest`;
72
72
  case "pnpm":
73
- return `pnpm update ${packageName}`;
73
+ return `pnpm update ${packageName}@latest`;
74
74
  case "bun":
75
- return `bun update ${packageName}`;
75
+ return `bun update ${packageName}@latest`;
76
76
  case "npm":
77
- return `npm update ${packageName}`;
77
+ return `npm update ${packageName}@latest`;
78
78
  case "unknown":
79
79
  // Default to npm since it's most widely supported
80
- return `npm update ${packageName}`;
80
+ return `npm update ${packageName}@latest`;
81
81
  }
82
82
  }
83
83
  }
@@ -68,6 +68,46 @@ describe("version-checker", () => {
68
68
  });
69
69
  });
70
70
 
71
+ it("should not suggest update when current version is newer than latest", async () => {
72
+ mockPackageJson.mockResolvedValue({
73
+ version: "1.0.0",
74
+ deprecated: false,
75
+ });
76
+
77
+ const result = await checkForUpdates({
78
+ packageName: "test-package",
79
+ currentVersion: "1.0.1",
80
+ });
81
+
82
+ expect(result).toEqual({
83
+ hasUpdate: false,
84
+ latestVersion: "1.0.0",
85
+ currentVersion: "1.0.1",
86
+ isDeprecated: false,
87
+ deprecationMessage: undefined,
88
+ });
89
+ });
90
+
91
+ it("should handle pre-release versions correctly", async () => {
92
+ mockPackageJson.mockResolvedValue({
93
+ version: "1.0.0-beta.2",
94
+ deprecated: false,
95
+ });
96
+
97
+ const result = await checkForUpdates({
98
+ packageName: "test-package",
99
+ currentVersion: "1.0.0-beta.1",
100
+ });
101
+
102
+ expect(result).toEqual({
103
+ hasUpdate: true,
104
+ latestVersion: "1.0.0-beta.2",
105
+ currentVersion: "1.0.0-beta.1",
106
+ isDeprecated: false,
107
+ deprecationMessage: undefined,
108
+ });
109
+ });
110
+
71
111
  it("should detect when package is deprecated", async () => {
72
112
  mockPackageJson.mockResolvedValue({
73
113
  version: "1.0.0",
@@ -3,6 +3,7 @@ import chalk from "chalk";
3
3
  import log from "./log";
4
4
  import Conf from "conf";
5
5
  import { getUpdateCommand } from "./package-manager-detector";
6
+ import semver from "semver";
6
7
 
7
8
  interface VersionInfo {
8
9
  hasUpdate: boolean;
@@ -147,7 +148,7 @@ export async function checkForUpdates({
147
148
  // Get latest version info (with caching)
148
149
  const latestPackageInfo = await fetchCachedPackageInfo(packageName);
149
150
  const latestVersion = latestPackageInfo.version;
150
- const hasUpdate = currentVersion !== latestVersion;
151
+ const hasUpdate = semver.gt(latestVersion, currentVersion);
151
152
 
152
153
  // Check deprecation status of the current version (with caching)
153
154
  let currentPackageInfo: CachedPackageInfo;