@emailshepherd/cli 0.1.36 → 0.1.38
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/cli.js +32 -11
- package/package.json +9 -10
package/dist/cli.js
CHANGED
|
@@ -8,7 +8,7 @@ import updateNotifier from "update-notifier";
|
|
|
8
8
|
// package.json
|
|
9
9
|
var package_default = {
|
|
10
10
|
name: "@emailshepherd/cli",
|
|
11
|
-
version: "0.1.
|
|
11
|
+
version: "0.1.38",
|
|
12
12
|
type: "module",
|
|
13
13
|
publishConfig: {
|
|
14
14
|
registry: "https://registry.npmjs.org",
|
|
@@ -33,7 +33,6 @@ var package_default = {
|
|
|
33
33
|
prepublishOnly: "pnpm run build"
|
|
34
34
|
},
|
|
35
35
|
dependencies: {
|
|
36
|
-
"@emailshepherd/api-client": "workspace:*",
|
|
37
36
|
axios: "^1.13.2",
|
|
38
37
|
chokidar: "^4.0.3",
|
|
39
38
|
commander: "^14.0.2",
|
|
@@ -43,6 +42,7 @@ var package_default = {
|
|
|
43
42
|
"vite-plugin-checker": "^0.12.0"
|
|
44
43
|
},
|
|
45
44
|
devDependencies: {
|
|
45
|
+
"@emailshepherd/api-client": "workspace:*",
|
|
46
46
|
"@types/node": "^24.10.1",
|
|
47
47
|
"@types/update-notifier": "^6.0.8",
|
|
48
48
|
msw: "^2.12.7",
|
|
@@ -55,7 +55,31 @@ var package_default = {
|
|
|
55
55
|
|
|
56
56
|
// src/commands/validate.ts
|
|
57
57
|
import { AxiosError as AxiosError2 } from "axios";
|
|
58
|
-
|
|
58
|
+
|
|
59
|
+
// ../api-client/dist/index.js
|
|
60
|
+
import axios from "axios";
|
|
61
|
+
import axios2 from "axios";
|
|
62
|
+
var syncEmailDesignSystem = (workspaceId, id, syncEmailDesignSystemBody, options) => {
|
|
63
|
+
return axios.post(
|
|
64
|
+
`/api/v1/workspaces/${workspaceId}/email_design_systems/${id}/sync`,
|
|
65
|
+
syncEmailDesignSystemBody,
|
|
66
|
+
options
|
|
67
|
+
);
|
|
68
|
+
};
|
|
69
|
+
var renderEmailDesignSystem = (workspaceId, emailDesignSystemId, renderEmailDesignSystemBody, options) => {
|
|
70
|
+
return axios.post(
|
|
71
|
+
`/api/v1/workspaces/${workspaceId}/email_design_systems/${emailDesignSystemId}/renders`,
|
|
72
|
+
renderEmailDesignSystemBody,
|
|
73
|
+
options
|
|
74
|
+
);
|
|
75
|
+
};
|
|
76
|
+
function configureAxios(config) {
|
|
77
|
+
const baseUrl = config?.baseUrl ?? process.env.EMAILSHEPHERD_BASE_URL ?? "https://api.emailshepherd.com";
|
|
78
|
+
const apiKey = config?.apiKey ?? process.env.EMAILSHEPHERD_API_KEY;
|
|
79
|
+
axios2.defaults.baseURL = baseUrl;
|
|
80
|
+
axios2.defaults.headers.common["Authorization"] = `Bearer ${apiKey}`;
|
|
81
|
+
axios2.defaults.headers.common["Content-Type"] = "application/json";
|
|
82
|
+
}
|
|
59
83
|
|
|
60
84
|
// src/buildHtml.ts
|
|
61
85
|
import { AxiosError } from "axios";
|
|
@@ -63,7 +87,6 @@ import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
|
|
|
63
87
|
import { dirname, resolve } from "path";
|
|
64
88
|
import { fileURLToPath } from "url";
|
|
65
89
|
import { createServer } from "vite";
|
|
66
|
-
import { configureAxios, renderEmailDesignSystem } from "@emailshepherd/api-client";
|
|
67
90
|
var __dirname = dirname(fileURLToPath(import.meta.url));
|
|
68
91
|
var viteServer = null;
|
|
69
92
|
async function getViteServer() {
|
|
@@ -250,10 +273,10 @@ function registerValidateCommand(program2) {
|
|
|
250
273
|
console.error(typeCheck.output);
|
|
251
274
|
process.exit(1);
|
|
252
275
|
}
|
|
253
|
-
|
|
276
|
+
configureAxios();
|
|
254
277
|
const eds = await loadEDS2();
|
|
255
278
|
const objectRepresentation = await buildEmailDesignSystemObject(eds);
|
|
256
|
-
const response = await
|
|
279
|
+
const response = await renderEmailDesignSystem(
|
|
257
280
|
eds.workspace_id,
|
|
258
281
|
eds.email_design_system_id,
|
|
259
282
|
objectRepresentation
|
|
@@ -280,7 +303,6 @@ function registerValidateCommand(program2) {
|
|
|
280
303
|
|
|
281
304
|
// src/commands/save.ts
|
|
282
305
|
import { AxiosError as AxiosError3 } from "axios";
|
|
283
|
-
import { configureAxios as configureAxios3, syncEmailDesignSystem } from "@emailshepherd/api-client";
|
|
284
306
|
function registerSaveAllCommand(program2) {
|
|
285
307
|
program2.command("save").description("Save the Email Design System and all components to the server").action(async () => {
|
|
286
308
|
try {
|
|
@@ -291,7 +313,7 @@ function registerSaveAllCommand(program2) {
|
|
|
291
313
|
console.error(typeCheck.output);
|
|
292
314
|
process.exit(1);
|
|
293
315
|
}
|
|
294
|
-
|
|
316
|
+
configureAxios();
|
|
295
317
|
const eds = await loadEDS2();
|
|
296
318
|
console.log("Saving Email Design System...");
|
|
297
319
|
const edsResponse = await syncEmailDesignSystem(
|
|
@@ -332,7 +354,6 @@ import checker from "vite-plugin-checker";
|
|
|
332
354
|
import { mkdirSync as mkdirSync2, writeFileSync as writeFileSync2 } from "fs";
|
|
333
355
|
import { resolve as resolve3 } from "path";
|
|
334
356
|
import { AxiosError as AxiosError4 } from "axios";
|
|
335
|
-
import { configureAxios as configureAxios4, renderEmailDesignSystem as renderEmailDesignSystem3 } from "@emailshepherd/api-client";
|
|
336
357
|
function extractFieldSchema(field) {
|
|
337
358
|
const base = {
|
|
338
359
|
type: field.type,
|
|
@@ -386,11 +407,11 @@ function applyOverrides(eds, overrides) {
|
|
|
386
407
|
};
|
|
387
408
|
}
|
|
388
409
|
async function renderWithOverrides(overrides) {
|
|
389
|
-
|
|
410
|
+
configureAxios();
|
|
390
411
|
const eds = await loadEDS();
|
|
391
412
|
const modifiedEds = applyOverrides(eds, overrides);
|
|
392
413
|
const objectRepresentation = await buildEmailDesignSystemObject(modifiedEds);
|
|
393
|
-
const response = await
|
|
414
|
+
const response = await renderEmailDesignSystem(
|
|
394
415
|
modifiedEds.workspace_id,
|
|
395
416
|
modifiedEds.email_design_system_id,
|
|
396
417
|
objectRepresentation
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@emailshepherd/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.38",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org",
|
|
@@ -18,14 +18,7 @@
|
|
|
18
18
|
"files": [
|
|
19
19
|
"dist"
|
|
20
20
|
],
|
|
21
|
-
"scripts": {
|
|
22
|
-
"build": "tsup && cp -r src/templates dist/",
|
|
23
|
-
"test": "vitest run",
|
|
24
|
-
"test:watch": "vitest",
|
|
25
|
-
"prepublishOnly": "pnpm run build"
|
|
26
|
-
},
|
|
27
21
|
"dependencies": {
|
|
28
|
-
"@emailshepherd/api-client": "workspace:*",
|
|
29
22
|
"axios": "^1.13.2",
|
|
30
23
|
"chokidar": "^4.0.3",
|
|
31
24
|
"commander": "^14.0.2",
|
|
@@ -41,6 +34,12 @@
|
|
|
41
34
|
"tsup": "^8.5.1",
|
|
42
35
|
"tsx": "^4.21.0",
|
|
43
36
|
"typescript": "^5.9.3",
|
|
44
|
-
"vitest": "^4.0.16"
|
|
37
|
+
"vitest": "^4.0.16",
|
|
38
|
+
"@emailshepherd/api-client": "0.0.0"
|
|
39
|
+
},
|
|
40
|
+
"scripts": {
|
|
41
|
+
"build": "tsup && cp -r src/templates dist/",
|
|
42
|
+
"test": "vitest run",
|
|
43
|
+
"test:watch": "vitest"
|
|
45
44
|
}
|
|
46
|
-
}
|
|
45
|
+
}
|