@neopress/cli 0.1.0 → 0.2.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/dist/bin.cjs +50 -0
- package/dist/index.js +21 -0
- package/package.json +2 -2
package/dist/bin.cjs
CHANGED
|
@@ -4088,6 +4088,25 @@ var AnalyticsEndpoint = class {
|
|
|
4088
4088
|
}
|
|
4089
4089
|
};
|
|
4090
4090
|
|
|
4091
|
+
// ../sdk/dist/endpoints/templates.js
|
|
4092
|
+
var TemplatesEndpoint = class {
|
|
4093
|
+
client;
|
|
4094
|
+
constructor(client) {
|
|
4095
|
+
this.client = client;
|
|
4096
|
+
}
|
|
4097
|
+
get basePath() {
|
|
4098
|
+
return `${this.client.siteBasePath}/template`;
|
|
4099
|
+
}
|
|
4100
|
+
async get() {
|
|
4101
|
+
const res = await this.client.get(this.basePath);
|
|
4102
|
+
return res.data;
|
|
4103
|
+
}
|
|
4104
|
+
async mark(data) {
|
|
4105
|
+
const res = await this.client.post(this.basePath, data);
|
|
4106
|
+
return res.data;
|
|
4107
|
+
}
|
|
4108
|
+
};
|
|
4109
|
+
|
|
4091
4110
|
// ../sdk/dist/client.js
|
|
4092
4111
|
var NeopressClient = class {
|
|
4093
4112
|
baseUrl;
|
|
@@ -4104,6 +4123,7 @@ var NeopressClient = class {
|
|
|
4104
4123
|
publish;
|
|
4105
4124
|
entryReferences;
|
|
4106
4125
|
analytics;
|
|
4126
|
+
templates;
|
|
4107
4127
|
constructor(options) {
|
|
4108
4128
|
this.baseUrl = (options.baseUrl || "https://app.neopress.ai").replace(/\/$/, "");
|
|
4109
4129
|
this.accessToken = options.accessToken || "";
|
|
@@ -4119,6 +4139,7 @@ var NeopressClient = class {
|
|
|
4119
4139
|
this.publish = new PublishEndpoint(this);
|
|
4120
4140
|
this.entryReferences = new EntryReferencesEndpoint(this);
|
|
4121
4141
|
this.analytics = new AnalyticsEndpoint(this);
|
|
4142
|
+
this.templates = new TemplatesEndpoint(this);
|
|
4122
4143
|
}
|
|
4123
4144
|
get siteBasePath() {
|
|
4124
4145
|
return `/api/v1/sites/${this.siteId}`;
|
|
@@ -4869,6 +4890,34 @@ function registerAnalyticsCommands(program3) {
|
|
|
4869
4890
|
});
|
|
4870
4891
|
}
|
|
4871
4892
|
|
|
4893
|
+
// src/commands/templates.ts
|
|
4894
|
+
function collectPreviewImgUrl(value, previous = []) {
|
|
4895
|
+
return previous.concat(value);
|
|
4896
|
+
}
|
|
4897
|
+
function registerTemplateCommands(program3) {
|
|
4898
|
+
const templates = program3.command("templates").description("Manage template metadata for the active site");
|
|
4899
|
+
templates.command("get").description("Get template metadata for the active site").action(async () => {
|
|
4900
|
+
const client = await getClientAsync();
|
|
4901
|
+
const template = await client.templates.get();
|
|
4902
|
+
output(template);
|
|
4903
|
+
});
|
|
4904
|
+
templates.command("mark").description("Mark or update the active site as a template").requiredOption("--name <name>", "Template display name").requiredOption("--industry <industry>", "Template industry key").requiredOption("--category <category>", "Template category key").option(
|
|
4905
|
+
"--preview-img-url <url>",
|
|
4906
|
+
"Preview image URL. Repeat for multiple images.",
|
|
4907
|
+
collectPreviewImgUrl,
|
|
4908
|
+
[]
|
|
4909
|
+
).action(async (options) => {
|
|
4910
|
+
const client = await getClientAsync();
|
|
4911
|
+
const template = await client.templates.mark({
|
|
4912
|
+
name: options.name,
|
|
4913
|
+
industry: options.industry,
|
|
4914
|
+
category: options.category,
|
|
4915
|
+
previewImgUrls: options.previewImgUrl.length > 0 ? options.previewImgUrl : void 0
|
|
4916
|
+
});
|
|
4917
|
+
output(template);
|
|
4918
|
+
});
|
|
4919
|
+
}
|
|
4920
|
+
|
|
4872
4921
|
// src/bin.ts
|
|
4873
4922
|
var program2 = new Command();
|
|
4874
4923
|
program2.name("neopress").description("Neopress CLI \u2014 manage your site from the terminal").version("0.1.0").option("--json", "Output in JSON format (for AI tools and pipes)").option("--no-input", "Non-interactive mode").hook("preAction", (thisCommand) => {
|
|
@@ -4887,6 +4936,7 @@ registerRedirectCommands(program2);
|
|
|
4887
4936
|
registerLayoutCommands(program2);
|
|
4888
4937
|
registerEntryReferenceCommands(program2);
|
|
4889
4938
|
registerAnalyticsCommands(program2);
|
|
4939
|
+
registerTemplateCommands(program2);
|
|
4890
4940
|
program2.parseAsync(process.argv).catch((err) => {
|
|
4891
4941
|
if (err?.code) {
|
|
4892
4942
|
console.error(JSON.stringify({ ok: false, error: err.message, code: err.code }));
|
package/dist/index.js
CHANGED
|
@@ -407,6 +407,25 @@ var AnalyticsEndpoint = class {
|
|
|
407
407
|
}
|
|
408
408
|
};
|
|
409
409
|
|
|
410
|
+
// ../sdk/dist/endpoints/templates.js
|
|
411
|
+
var TemplatesEndpoint = class {
|
|
412
|
+
client;
|
|
413
|
+
constructor(client) {
|
|
414
|
+
this.client = client;
|
|
415
|
+
}
|
|
416
|
+
get basePath() {
|
|
417
|
+
return `${this.client.siteBasePath}/template`;
|
|
418
|
+
}
|
|
419
|
+
async get() {
|
|
420
|
+
const res = await this.client.get(this.basePath);
|
|
421
|
+
return res.data;
|
|
422
|
+
}
|
|
423
|
+
async mark(data) {
|
|
424
|
+
const res = await this.client.post(this.basePath, data);
|
|
425
|
+
return res.data;
|
|
426
|
+
}
|
|
427
|
+
};
|
|
428
|
+
|
|
410
429
|
// ../sdk/dist/client.js
|
|
411
430
|
var NeopressClient = class {
|
|
412
431
|
baseUrl;
|
|
@@ -423,6 +442,7 @@ var NeopressClient = class {
|
|
|
423
442
|
publish;
|
|
424
443
|
entryReferences;
|
|
425
444
|
analytics;
|
|
445
|
+
templates;
|
|
426
446
|
constructor(options) {
|
|
427
447
|
this.baseUrl = (options.baseUrl || "https://app.neopress.ai").replace(/\/$/, "");
|
|
428
448
|
this.accessToken = options.accessToken || "";
|
|
@@ -438,6 +458,7 @@ var NeopressClient = class {
|
|
|
438
458
|
this.publish = new PublishEndpoint(this);
|
|
439
459
|
this.entryReferences = new EntryReferencesEndpoint(this);
|
|
440
460
|
this.analytics = new AnalyticsEndpoint(this);
|
|
461
|
+
this.templates = new TemplatesEndpoint(this);
|
|
441
462
|
}
|
|
442
463
|
get siteBasePath() {
|
|
443
464
|
return `/api/v1/sites/${this.siteId}`;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@neopress/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
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.
|
|
22
|
+
"@neopress/sdk": "0.2.0"
|
|
23
23
|
},
|
|
24
24
|
"scripts": {
|
|
25
25
|
"build": "tsup",
|