syntaxshot-cli 1.0.1 → 1.0.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.
package/README.md CHANGED
@@ -73,6 +73,8 @@ syntaxshot logout # removes the license from this machine
73
73
  "lineNumbers": true,
74
74
  "quality": 0.95
75
75
  }
76
+ ```
77
+
76
78
 
77
79
  ## Available themes
78
80
 
package/bin/syntaxshot.js CHANGED
@@ -30,7 +30,8 @@ program
30
30
  const result = await activateLicense(licenseKey.trim());
31
31
  if (!result.ok) {
32
32
  console.error(`❌ ${result.error}`);
33
- process.exit(1);
33
+ process.exitCode = 1;
34
+ return;
34
35
  }
35
36
  console.log(`✅ License activated. Plan: ${result.plan}.`);
36
37
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "syntaxshot-cli",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "Genera capturas de codigo con resaltado de sintaxis desde la terminal",
5
5
  "type": "module",
6
6
  "bin": {
package/src/license.js CHANGED
@@ -11,7 +11,7 @@ const REVALIDATE_AFTER_MS = 24 * 60 * 60 * 1000; // 24h
11
11
  // license for this long before falling back to Free.
12
12
  const OFFLINE_GRACE_MS = 7 * 24 * 60 * 60 * 1000; // 7 days
13
13
 
14
- const API_URL = process.env.SYNTAXSHOT_API_URL || "https://api.syntaxshot.dev";
14
+ const API_URL = process.env.SYNTAXSHOT_API_URL || "https://syntaxshot-api.vercel.app";
15
15
 
16
16
  function readLicenseFile() {
17
17
  if (!fs.existsSync(LICENSE_FILE)) return null;
@@ -28,13 +28,20 @@ function writeLicenseFile(data) {
28
28
  }
29
29
 
30
30
  async function validateWithApi(licenseKey) {
31
- const res = await fetch(`${API_URL}/api/v1/validate`, {
32
- method: "POST",
33
- headers: { "Content-Type": "application/json" },
34
- body: JSON.stringify({ licenseKey }),
35
- signal: AbortSignal.timeout(8000),
36
- });
37
- return res.json();
31
+ const controller = new AbortController();
32
+ const timeoutId = setTimeout(() => controller.abort(), 8000);
33
+
34
+ try {
35
+ const res = await fetch(`${API_URL}/api/v1/validate`, {
36
+ method: "POST",
37
+ headers: { "Content-Type": "application/json" },
38
+ body: JSON.stringify({ licenseKey }),
39
+ signal: controller.signal,
40
+ });
41
+ return res.json();
42
+ } finally {
43
+ clearTimeout(timeoutId);
44
+ }
38
45
  }
39
46
 
40
47
  /** Called by `syntaxshot login <key>`. Validates once and stores it. */