@neopress/cli 0.3.0 → 0.3.1

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/bin.cjs CHANGED
@@ -4174,7 +4174,13 @@ var NeopressClient = class {
4174
4174
  throw new NeopressApiError("CONNECTION_ERROR", `Cannot connect to ${this.baseUrl} \u2014 is the dev server running?`, 0);
4175
4175
  }
4176
4176
  clearTimeout(timeout);
4177
- const json = await response.json();
4177
+ const responseText = await response.text();
4178
+ let json;
4179
+ try {
4180
+ json = responseText ? JSON.parse(responseText) : {};
4181
+ } catch {
4182
+ throw new NeopressApiError("NON_JSON_RESPONSE", `Expected JSON from ${method} ${url} but received non-JSON response (${response.status} ${response.statusText})`, response.status, { body: responseText.slice(0, 500) });
4183
+ }
4178
4184
  if (!response.ok) {
4179
4185
  const err = json?.error || {};
4180
4186
  throw new NeopressApiError(err.code || "UNKNOWN", err.message || response.statusText, response.status, json);
@@ -4939,7 +4945,7 @@ function registerTemplateCommands(program3) {
4939
4945
 
4940
4946
  // src/bin.ts
4941
4947
  var program2 = new Command();
4942
- program2.name("neopress").description("Neopress CLI \u2014 manage your site from the terminal").version("0.3.0").option("--json", "Output in JSON format (for AI tools and pipes)").option("--no-input", "Non-interactive mode").hook("preAction", (thisCommand) => {
4948
+ program2.name("neopress").description("Neopress CLI \u2014 manage your site from the terminal").version("0.3.1").option("--json", "Output in JSON format (for AI tools and pipes)").option("--no-input", "Non-interactive mode").hook("preAction", (thisCommand) => {
4943
4949
  const opts = thisCommand.optsWithGlobals();
4944
4950
  if (opts.json) setJsonMode(true);
4945
4951
  });
package/dist/index.js CHANGED
@@ -493,7 +493,13 @@ var NeopressClient = class {
493
493
  throw new NeopressApiError("CONNECTION_ERROR", `Cannot connect to ${this.baseUrl} \u2014 is the dev server running?`, 0);
494
494
  }
495
495
  clearTimeout(timeout);
496
- const json = await response.json();
496
+ const responseText = await response.text();
497
+ let json;
498
+ try {
499
+ json = responseText ? JSON.parse(responseText) : {};
500
+ } catch {
501
+ throw new NeopressApiError("NON_JSON_RESPONSE", `Expected JSON from ${method} ${url} but received non-JSON response (${response.status} ${response.statusText})`, response.status, { body: responseText.slice(0, 500) });
502
+ }
497
503
  if (!response.ok) {
498
504
  const err = json?.error || {};
499
505
  throw new NeopressApiError(err.code || "UNKNOWN", err.message || response.statusText, response.status, json);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neopress/cli",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "Neopress CLI — manage your Neopress site from the terminal",
5
5
  "type": "module",
6
6
  "bin": {
@@ -19,7 +19,7 @@
19
19
  "commander": "^13.0.0",
20
20
  "tsup": "^8.5.1",
21
21
  "typescript": "^5.7.0",
22
- "@neopress/sdk": "0.3.0"
22
+ "@neopress/sdk": "0.3.1"
23
23
  },
24
24
  "scripts": {
25
25
  "build": "tsup",