@frontify/frontify-cli 6.0.0-alpha.0 → 6.0.0-alpha.2
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/index.mjs +221 -193
- package/dist/index.mjs.map +1 -1
- package/package.json +7 -9
package/dist/index.mjs
CHANGED
|
@@ -8,23 +8,22 @@ import s from "open";
|
|
|
8
8
|
import c from "picocolors";
|
|
9
9
|
import { copyFileSync as l, mkdirSync as u, readFileSync as d, readdirSync as f, statSync as p, writeFileSync as m } from "node:fs";
|
|
10
10
|
import h from "conf";
|
|
11
|
-
import
|
|
11
|
+
import g from "glob-to-regexp";
|
|
12
12
|
import "node:crypto";
|
|
13
|
-
import g from "node-fetch";
|
|
14
13
|
import { exec as _ } from "node:child_process";
|
|
15
|
-
import { URL as
|
|
14
|
+
import { URL as ee, fileURLToPath as te } from "node:url";
|
|
16
15
|
import "archiver";
|
|
17
16
|
import v from "@vitejs/plugin-react";
|
|
18
17
|
import { build as y, createServer as b, esmExternalRequirePlugin as x } from "vite";
|
|
19
|
-
import { viteExternalsPlugin as
|
|
20
|
-
import { array as S, boolean as
|
|
21
|
-
import
|
|
22
|
-
import
|
|
23
|
-
import * as
|
|
18
|
+
import { viteExternalsPlugin as ne } from "vite-plugin-externals";
|
|
19
|
+
import { array as S, boolean as re, number as ie, object as C, string as w, z as T } from "zod";
|
|
20
|
+
import ae from "@fastify/cors";
|
|
21
|
+
import oe from "fastify";
|
|
22
|
+
import * as se from "esbuild";
|
|
24
23
|
var E = {
|
|
25
24
|
name: "@frontify/frontify-cli",
|
|
26
25
|
type: "module",
|
|
27
|
-
version: "6.0.0-alpha.
|
|
26
|
+
version: "6.0.0-alpha.2",
|
|
28
27
|
author: "Frontify Developers <developers@frontify.com>",
|
|
29
28
|
repository: {
|
|
30
29
|
type: "git",
|
|
@@ -53,15 +52,14 @@ var E = {
|
|
|
53
52
|
archiver: "^7.0.1",
|
|
54
53
|
cac: "^7.0.0",
|
|
55
54
|
conf: "^15.1.0",
|
|
56
|
-
esbuild: "^0.
|
|
55
|
+
esbuild: "^0.28.0",
|
|
57
56
|
"fast-glob": "^3.3.3",
|
|
58
|
-
fastify: "^5.8.
|
|
57
|
+
fastify: "^5.8.4",
|
|
59
58
|
"glob-to-regexp": "^0.4.1",
|
|
60
|
-
"node-fetch": "^3.3.2",
|
|
61
59
|
open: "^11.0.0",
|
|
62
60
|
picocolors: "^1.1.1",
|
|
63
61
|
prompts: "^2.4.2",
|
|
64
|
-
vite: "^8.0.
|
|
62
|
+
vite: "^8.0.7",
|
|
65
63
|
"vite-plugin-externals": "^0.6.2",
|
|
66
64
|
zod: "^3.25.76"
|
|
67
65
|
},
|
|
@@ -72,15 +70,14 @@ var E = {
|
|
|
72
70
|
"@types/node": "^22.19.15",
|
|
73
71
|
"@types/prompts": "^2.4.9",
|
|
74
72
|
"@types/ws": "8.18.1",
|
|
75
|
-
"@vitest/coverage-v8": "4.1.
|
|
76
|
-
"@vitest/ui": "^4.1.
|
|
73
|
+
"@vitest/coverage-v8": "4.1.2",
|
|
74
|
+
"@vitest/ui": "^4.1.2",
|
|
77
75
|
eslint: "^9.39.4",
|
|
78
76
|
"eslint-plugin-notice": "^1.0.0",
|
|
79
|
-
nock: "^13.5.6",
|
|
80
77
|
prettier: "^3.7.4",
|
|
81
78
|
"ts-node": "^10.9.2",
|
|
82
79
|
typescript: "^5.9.3",
|
|
83
|
-
vitest: "^4.1.
|
|
80
|
+
vitest: "^4.1.2"
|
|
84
81
|
}
|
|
85
82
|
}, D = () => {
|
|
86
83
|
let e = /* @__PURE__ */ new Date();
|
|
@@ -99,14 +96,14 @@ var E = {
|
|
|
99
96
|
console.error(c.red(`[${D()}] ${e.join(" ")}`));
|
|
100
97
|
}
|
|
101
98
|
static spacer(e = 1) {
|
|
102
|
-
return
|
|
99
|
+
return " ".repeat(e);
|
|
103
100
|
}
|
|
104
101
|
}, k = class extends Error {
|
|
105
102
|
name = "FileNotFoundError";
|
|
106
103
|
constructor(e) {
|
|
107
104
|
super(), O.error(`The file at "${e}" was not found.`);
|
|
108
105
|
}
|
|
109
|
-
},
|
|
106
|
+
}, ce = class extends Error {
|
|
110
107
|
name = "ParseJsonError";
|
|
111
108
|
constructor(e) {
|
|
112
109
|
super(), O.error(`The file at "${e}" could not be parsed.`);
|
|
@@ -116,9 +113,9 @@ var E = {
|
|
|
116
113
|
let t = d(e, "utf8"), n = JSON.parse(t);
|
|
117
114
|
return new Proxy(n, { set: (t, n, r) => (t[n] = r, m(e, JSON.stringify(t, null, " ")), !0) });
|
|
118
115
|
} catch (t) {
|
|
119
|
-
throw t instanceof SyntaxError ? new
|
|
116
|
+
throw t instanceof SyntaxError ? new ce(e) : t instanceof Error && "code" in t && t.code === "ENOENT" ? new k(e) : Error(String(t));
|
|
120
117
|
}
|
|
121
|
-
}, j = (e) => A(t(e, "package.json")).dependencies["@frontify/app-bridge"],
|
|
118
|
+
}, j = (e) => A(t(e, "package.json")).dependencies["@frontify/app-bridge"], le = (e) => A(t(e, "package.json")).dependencies["@frontify/app-bridge-theme"], M = (e) => A(t(e, "package.json")).dependencies.react, N = class {
|
|
122
119
|
static conf = new h({ projectName: "frontify-cli" });
|
|
123
120
|
static set(e, t) {
|
|
124
121
|
this.conf.set(e, t);
|
|
@@ -129,7 +126,7 @@ var E = {
|
|
|
129
126
|
static delete(e) {
|
|
130
127
|
return this.conf.delete(e);
|
|
131
128
|
}
|
|
132
|
-
},
|
|
129
|
+
}, ue = (e) => {
|
|
133
130
|
try {
|
|
134
131
|
return f(e).length === 0;
|
|
135
132
|
} catch {
|
|
@@ -137,29 +134,29 @@ var E = {
|
|
|
137
134
|
}
|
|
138
135
|
}, P = (e, t, r) => {
|
|
139
136
|
u(t, { recursive: !0 });
|
|
140
|
-
let i = r?.exclude.map((e) =>
|
|
141
|
-
for (let r of f(e)) i !== void 0 && i.some((e) => e.test(r)) ||
|
|
142
|
-
},
|
|
137
|
+
let i = r?.exclude.map((e) => g(e));
|
|
138
|
+
for (let r of f(e)) i !== void 0 && i.some((e) => e.test(r)) || de(n(e, r), n(t, r));
|
|
139
|
+
}, de = (e, t) => {
|
|
143
140
|
p(e).isDirectory() ? P(e, t) : l(e, t);
|
|
144
|
-
},
|
|
141
|
+
}, fe = (e) => {
|
|
145
142
|
try {
|
|
146
143
|
return d(e, "utf-8");
|
|
147
144
|
} catch {
|
|
148
145
|
throw new k(e);
|
|
149
146
|
}
|
|
150
|
-
},
|
|
147
|
+
}, pe = (e) => {
|
|
151
148
|
try {
|
|
152
149
|
return d(e, "base64");
|
|
153
150
|
} catch {
|
|
154
151
|
throw new k(e);
|
|
155
152
|
}
|
|
156
|
-
},
|
|
153
|
+
}, me = (e) => {
|
|
157
154
|
try {
|
|
158
|
-
return
|
|
155
|
+
return fe(e).split(/\r?\n/).filter((e) => e !== "");
|
|
159
156
|
} catch {
|
|
160
157
|
throw new k(e);
|
|
161
158
|
}
|
|
162
|
-
},
|
|
159
|
+
}, he = class extends Error {
|
|
163
160
|
code = 0;
|
|
164
161
|
responseBody;
|
|
165
162
|
constructor(e, t) {
|
|
@@ -171,7 +168,7 @@ var E = {
|
|
|
171
168
|
this.baseUrl = e.replace(/^https?:\/\//, "");
|
|
172
169
|
}
|
|
173
170
|
async fetchExtended({ method: e, url: t, body: n, options: r }) {
|
|
174
|
-
let i = await
|
|
171
|
+
let i = await fetch(this.getAbsoluteUrl(t), {
|
|
175
172
|
method: e,
|
|
176
173
|
...n && { body: JSON.stringify(n) },
|
|
177
174
|
...r,
|
|
@@ -180,13 +177,13 @@ var E = {
|
|
|
180
177
|
...r?.headers
|
|
181
178
|
}
|
|
182
179
|
});
|
|
183
|
-
if (i.
|
|
180
|
+
if (i.ok) switch (i.headers.get("Content-Type")) {
|
|
184
181
|
case "application/json": return await i.json() || void 0;
|
|
185
182
|
default: return await i.text() || void 0;
|
|
186
183
|
}
|
|
187
184
|
else {
|
|
188
185
|
let e = await i.json();
|
|
189
|
-
throw new
|
|
186
|
+
throw new he(i.status, e);
|
|
190
187
|
}
|
|
191
188
|
}
|
|
192
189
|
get(e, t) {
|
|
@@ -222,26 +219,26 @@ var E = {
|
|
|
222
219
|
getAbsoluteUrl(e) {
|
|
223
220
|
return `https://${this.baseUrl}${e}`;
|
|
224
221
|
}
|
|
225
|
-
},
|
|
222
|
+
}, ge = (e) => {
|
|
226
223
|
let t = A(n(e, "package.json"));
|
|
227
224
|
t.name = e;
|
|
228
|
-
},
|
|
225
|
+
}, _e = (e) => e ? /^[_a-z-]+$/.test(e) ? ue(e) ? !0 : `The directory ./${e} already exist.` : "The project name needs to be \"a-z\" separated by \"-\" or \"_\"." : "The content block name can not be empty.", ve = class extends Error {
|
|
229
226
|
name = "CommandExecutionError";
|
|
230
227
|
constructor(e) {
|
|
231
228
|
super(), O.error(`The command execution failed: ${e}`);
|
|
232
229
|
}
|
|
233
230
|
}, I = (e, t = {}) => new Promise((n, r) => {
|
|
234
|
-
_(e, t, (e, t) => e ? r(new
|
|
235
|
-
}),
|
|
231
|
+
_(e, t, (e, t) => e ? r(new ve(`${e.message}${String(t)}`)) : n(String(t)));
|
|
232
|
+
}), ye = class extends Error {
|
|
236
233
|
name = "InvalidInstanceUrlError";
|
|
237
234
|
constructor(e) {
|
|
238
235
|
super(), e ? O.error(`The given URL "${e}" is invalid.`) : O.error("No instance URL was given.");
|
|
239
236
|
}
|
|
240
237
|
}, L = (e) => {
|
|
241
238
|
try {
|
|
242
|
-
return new
|
|
239
|
+
return new ee(`https://${e.replace(/^https?:\/\//, "")}`).hostname;
|
|
243
240
|
} catch {
|
|
244
|
-
throw new
|
|
241
|
+
throw new ye(e);
|
|
245
242
|
}
|
|
246
243
|
}, R = async (e, t) => {
|
|
247
244
|
let n = new F(e), r = t || N.get("tokens.access_token");
|
|
@@ -251,25 +248,29 @@ var E = {
|
|
|
251
248
|
O.error(`You are currently not logged in. You can use the command ${c.bold("frontify-cli login")} to log in.`);
|
|
252
249
|
return;
|
|
253
250
|
}
|
|
254
|
-
},
|
|
255
|
-
m(t(e, ".gitignore"),
|
|
256
|
-
},
|
|
251
|
+
}, be = (e, n) => {
|
|
252
|
+
m(t(e, ".gitignore"), xe[n]);
|
|
253
|
+
}, xe = {
|
|
257
254
|
"platform-app": "# Logs\nlogs\n*.log\nnpm-debug.log*\nyarn-debug.log*\nyarn-error.log*\npnpm-debug.log*\nlerna-debug.log*\n\nnode_modules\ndist\ndist-ssr\n*.localdist\n.idea\n.vscode\n\n# Editor directories and files\n.DS_Store\n*.suo\n*.ntvs*\n*.njsproj\n*.sln\n*.sw?\n.secret.json\n",
|
|
258
255
|
"content-block": "node_modules\ndist\n.idea\n.vscode\n"
|
|
259
|
-
},
|
|
256
|
+
}, Se = async ({ outputName: e, entryFile: t, projectPath: n = "" }) => {
|
|
260
257
|
let r = j(n), i = await y({
|
|
261
|
-
plugins: [v(),
|
|
258
|
+
plugins: [v(), ne({
|
|
262
259
|
react: "React",
|
|
263
260
|
"react-dom": "ReactDOM"
|
|
264
261
|
})],
|
|
265
262
|
root: n,
|
|
263
|
+
mode: "production",
|
|
266
264
|
define: { "process.env.NODE_ENV": JSON.stringify("production") },
|
|
267
265
|
build: {
|
|
266
|
+
minify: "terser",
|
|
267
|
+
cssMinify: "esbuild",
|
|
268
268
|
lib: {
|
|
269
269
|
entry: t,
|
|
270
270
|
name: e,
|
|
271
271
|
formats: ["iife"],
|
|
272
|
-
fileName: () => "index.js"
|
|
272
|
+
fileName: () => "index.js",
|
|
273
|
+
cssFileName: "style"
|
|
273
274
|
},
|
|
274
275
|
rollupOptions: {
|
|
275
276
|
external: ["react", "react-dom"],
|
|
@@ -282,7 +283,7 @@ var E = {
|
|
|
282
283
|
footer: `
|
|
283
284
|
window.${e} = ${e};
|
|
284
285
|
window.${e}.dependencies = window.${e}.packages || {};
|
|
285
|
-
window.${e}.dependencies['@frontify/app-bridge'] = '${r}';
|
|
286
|
+
window.${e}.dependencies['@frontify/app-bridge-app'] = '${r}';
|
|
286
287
|
`
|
|
287
288
|
}
|
|
288
289
|
}
|
|
@@ -292,9 +293,14 @@ var E = {
|
|
|
292
293
|
app: await y({
|
|
293
294
|
plugins: [v()],
|
|
294
295
|
root: n,
|
|
296
|
+
mode: "production",
|
|
295
297
|
define: { "process.env.NODE_ENV": JSON.stringify("production") },
|
|
296
298
|
base: "/__DYNAMIC_SEGMENT__/",
|
|
297
|
-
build: {
|
|
299
|
+
build: {
|
|
300
|
+
minify: "terser",
|
|
301
|
+
cssMinify: "esbuild",
|
|
302
|
+
emptyOutDir: !1
|
|
303
|
+
}
|
|
298
304
|
}),
|
|
299
305
|
settings: i
|
|
300
306
|
};
|
|
@@ -314,7 +320,9 @@ function B() {
|
|
|
314
320
|
config(n) {
|
|
315
321
|
n.optimizeDeps ??= {}, n.optimizeDeps.exclude = [...n.optimizeDeps.exclude ?? [], ...t];
|
|
316
322
|
let r = n.optimizeDeps;
|
|
317
|
-
|
|
323
|
+
r.rolldownOptions ??= {};
|
|
324
|
+
let i = r.rolldownOptions;
|
|
325
|
+
return i.plugins ??= [], i.plugins.push({
|
|
318
326
|
name: "externalize-react",
|
|
319
327
|
resolveId(n) {
|
|
320
328
|
return t.includes(n) ? (e.add(n), {
|
|
@@ -322,7 +330,7 @@ function B() {
|
|
|
322
330
|
external: !0
|
|
323
331
|
}) : null;
|
|
324
332
|
}
|
|
325
|
-
}),
|
|
333
|
+
}), i.plugins.push(x({ external: t })), null;
|
|
326
334
|
},
|
|
327
335
|
configResolved(t) {
|
|
328
336
|
let n = (t.base ?? "/").replaceAll(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
@@ -348,7 +356,7 @@ function B() {
|
|
|
348
356
|
}
|
|
349
357
|
//#endregion
|
|
350
358
|
//#region src/utils/compiler/compileBlock.ts
|
|
351
|
-
var
|
|
359
|
+
var Ce = async ({ projectPath: e, entryFile: t, outputName: n }) => y({
|
|
352
360
|
plugins: [v(), x({ external: z })],
|
|
353
361
|
define: { "process.env.NODE_ENV": JSON.stringify("production") },
|
|
354
362
|
root: e,
|
|
@@ -393,7 +401,7 @@ var V = async ({ projectPath: e, entryFile: t, outputName: n }) => y({
|
|
|
393
401
|
] }
|
|
394
402
|
}
|
|
395
403
|
}
|
|
396
|
-
}),
|
|
404
|
+
}), we = async ({ projectPath: e, entryFile: t, outputName: n }) => y({
|
|
397
405
|
plugins: [v(), x({ external: z })],
|
|
398
406
|
define: { "process.env.NODE_ENV": JSON.stringify("production") },
|
|
399
407
|
root: e,
|
|
@@ -438,26 +446,26 @@ var V = async ({ projectPath: e, entryFile: t, outputName: n }) => y({
|
|
|
438
446
|
] }
|
|
439
447
|
}
|
|
440
448
|
}
|
|
441
|
-
}),
|
|
449
|
+
}), V = [
|
|
442
450
|
"exe",
|
|
443
451
|
"dmg",
|
|
444
452
|
"cmd",
|
|
445
453
|
"sh",
|
|
446
454
|
"bat"
|
|
447
|
-
],
|
|
455
|
+
], H = (e) => `Invalid file extension, \`${e}.filenameExtension\` can not include: ${V.join(", ")}.`, U = C({ title: w().min(1).max(40) }).optional(), W = T.enum([
|
|
448
456
|
"audio",
|
|
449
457
|
"document",
|
|
450
458
|
"image",
|
|
451
459
|
"video",
|
|
452
460
|
"file",
|
|
453
461
|
"embeddedContent"
|
|
454
|
-
]),
|
|
462
|
+
]), G = W.exclude([
|
|
455
463
|
"audio",
|
|
456
464
|
"document",
|
|
457
465
|
"video",
|
|
458
466
|
"file",
|
|
459
467
|
"embeddedContent"
|
|
460
|
-
]),
|
|
468
|
+
]), K = T.enum(["svg"]), q = T.enum([
|
|
461
469
|
"svg",
|
|
462
470
|
"jpg",
|
|
463
471
|
"jpeg",
|
|
@@ -466,14 +474,14 @@ var V = async ({ projectPath: e, entryFile: t, outputName: n }) => y({
|
|
|
466
474
|
"png",
|
|
467
475
|
"tif",
|
|
468
476
|
"tiff"
|
|
469
|
-
]),
|
|
477
|
+
]), Te = T.enum([
|
|
470
478
|
"content-block",
|
|
471
479
|
"platform-app",
|
|
472
480
|
"theme"
|
|
473
|
-
]),
|
|
481
|
+
]), J = /* @__PURE__ */ new Set(), Ee = S(C({
|
|
474
482
|
label: w(),
|
|
475
|
-
key: w().min(1).max(80).refine((e) =>
|
|
476
|
-
})),
|
|
483
|
+
key: w().min(1).max(80).refine((e) => J.has(e) ? !1 : (J.add(e), /^\w+$/.test(e)), { message: "Secret Key must be unique and should only contain letters from a-z, A-Z, numbers from 0-9 and '_' without any spaces" })
|
|
484
|
+
})), De = C({
|
|
477
485
|
method: T.enum([
|
|
478
486
|
"GET",
|
|
479
487
|
"POST",
|
|
@@ -482,17 +490,17 @@ var V = async ({ projectPath: e, entryFile: t, outputName: n }) => y({
|
|
|
482
490
|
]),
|
|
483
491
|
headers: T.record(w()).optional(),
|
|
484
492
|
body: T.any().optional()
|
|
485
|
-
}),
|
|
486
|
-
name: w().refine((e) =>
|
|
493
|
+
}), Y = /* @__PURE__ */ new Set(), Oe = C({
|
|
494
|
+
name: w().refine((e) => Y.has(e) ? !1 : (Y.add(e), /^[\w-]*$/.test(e)), { message: "Endpoint name must be unique" }),
|
|
487
495
|
resource: w(),
|
|
488
|
-
options:
|
|
489
|
-
}),
|
|
496
|
+
options: De
|
|
497
|
+
}), ke = /^(([\dA-Za-z]|[\dA-Za-z][\dA-Za-z-]*[\dA-Za-z])\.)*([\dA-Za-z]|[\dA-Za-z][\dA-Za-z-]*[\dA-Za-z])$/, Ae = C({ permissions: C({ scopes: S(T.enum([
|
|
490
498
|
"basic:read",
|
|
491
499
|
"basic:write",
|
|
492
500
|
"account:read",
|
|
493
501
|
"webhook:read",
|
|
494
502
|
"webhook:write"
|
|
495
|
-
])).min(1, "At least one scope is required").max(5, "No more than 5 scopes are allowed").refine((e) => e.includes("basic:read"), { message: "'basic:read' is required in scopes" }) }).optional() }).optional(),
|
|
503
|
+
])).min(1, "At least one scope is required").max(5, "No more than 5 scopes are allowed").refine((e) => e.includes("basic:read"), { message: "'basic:read' is required in scopes" }) }).optional() }).optional(), X = C({
|
|
496
504
|
key: w(),
|
|
497
505
|
type: w(),
|
|
498
506
|
label: w()
|
|
@@ -500,103 +508,103 @@ var V = async ({ projectPath: e, entryFile: t, outputName: n }) => y({
|
|
|
500
508
|
id: w(),
|
|
501
509
|
title: w(),
|
|
502
510
|
iconUrl: w(),
|
|
503
|
-
returns: S(
|
|
504
|
-
version:
|
|
511
|
+
returns: S(X),
|
|
512
|
+
version: ie().int().positive(),
|
|
505
513
|
externalId: w(),
|
|
506
|
-
parameters: S(
|
|
514
|
+
parameters: S(X)
|
|
507
515
|
})).optional(), Me = C({
|
|
508
516
|
appId: w().length(25),
|
|
509
|
-
appType:
|
|
510
|
-
experimental:
|
|
511
|
-
secrets:
|
|
517
|
+
appType: Te,
|
|
518
|
+
experimental: re().optional(),
|
|
519
|
+
secrets: Ee.optional(),
|
|
512
520
|
network: C({
|
|
513
|
-
allowedHosts: S(w().refine((e) =>
|
|
514
|
-
endpoints: S(
|
|
521
|
+
allowedHosts: S(w().refine((e) => ke.test(e), { message: "Invalid host format" })).optional(),
|
|
522
|
+
endpoints: S(Oe).optional()
|
|
515
523
|
}).optional(),
|
|
516
|
-
permissionsSchema:
|
|
524
|
+
permissionsSchema: Ae,
|
|
517
525
|
automation: C({ actions: je }).optional(),
|
|
518
526
|
surfaces: C({
|
|
519
527
|
guideline: C({
|
|
520
528
|
pageAction: C({ title: w().min(2).max(28) }).optional(),
|
|
521
529
|
assetViewer: C({
|
|
522
530
|
title: w().min(2).max(28),
|
|
523
|
-
type: S(
|
|
524
|
-
filenameExtension: S(w().refine((e) => !
|
|
531
|
+
type: S(W),
|
|
532
|
+
filenameExtension: S(w().refine((e) => !V.includes(e), { message: H("guideline") }))
|
|
525
533
|
}).optional()
|
|
526
534
|
}).optional(),
|
|
527
535
|
mediaLibrary: C({
|
|
528
536
|
assetBulkActions: C({
|
|
529
537
|
title: w().min(2).max(28),
|
|
530
|
-
filenameExtensions: S(w().refine((e) => !
|
|
538
|
+
filenameExtensions: S(w().refine((e) => !V.includes(e), { message: H("mediaLibrary") }))
|
|
531
539
|
}).optional(),
|
|
532
540
|
assetAction: C({
|
|
533
541
|
title: w().min(2).max(28),
|
|
534
|
-
type: S(
|
|
535
|
-
filenameExtension: S(w().refine((e) => !
|
|
542
|
+
type: S(W),
|
|
543
|
+
filenameExtension: S(w().refine((e) => !V.includes(e), { message: H("mediaLibrary") }))
|
|
536
544
|
}).optional(),
|
|
537
|
-
assetCreation:
|
|
545
|
+
assetCreation: U
|
|
538
546
|
}).optional(),
|
|
539
547
|
iconLibrary: C({
|
|
540
548
|
assetBulkActions: C({
|
|
541
549
|
title: w().min(2).max(28),
|
|
542
|
-
filenameExtensions: S(
|
|
550
|
+
filenameExtensions: S(K)
|
|
543
551
|
}).optional(),
|
|
544
552
|
assetAction: C({
|
|
545
553
|
title: w().min(2).max(28),
|
|
546
|
-
type: S(
|
|
547
|
-
filenameExtension: S(
|
|
554
|
+
type: S(G),
|
|
555
|
+
filenameExtension: S(K)
|
|
548
556
|
}).optional(),
|
|
549
|
-
assetCreation:
|
|
557
|
+
assetCreation: U
|
|
550
558
|
}).optional(),
|
|
551
559
|
logoLibrary: C({
|
|
552
560
|
assetBulkActions: C({
|
|
553
561
|
title: w().min(2).max(28),
|
|
554
|
-
filenameExtensions: S(
|
|
562
|
+
filenameExtensions: S(q)
|
|
555
563
|
}).optional(),
|
|
556
564
|
assetAction: C({
|
|
557
565
|
title: w().min(2).max(28),
|
|
558
|
-
type: S(
|
|
559
|
-
filenameExtension: S(
|
|
566
|
+
type: S(G),
|
|
567
|
+
filenameExtension: S(q)
|
|
560
568
|
}).optional(),
|
|
561
|
-
assetCreation:
|
|
569
|
+
assetCreation: U
|
|
562
570
|
}).optional(),
|
|
563
571
|
documentLibrary: C({
|
|
564
572
|
assetBulkActions: C({
|
|
565
573
|
title: w().min(2).max(28),
|
|
566
|
-
filenameExtensions: S(w().refine((e) => !
|
|
574
|
+
filenameExtensions: S(w().refine((e) => !V.includes(e), { message: H("documentLibrary") }))
|
|
567
575
|
}).optional(),
|
|
568
576
|
assetAction: C({
|
|
569
577
|
title: w().min(2).max(28),
|
|
570
|
-
type: S(
|
|
571
|
-
filenameExtension: S(w().refine((e) => !
|
|
578
|
+
type: S(W),
|
|
579
|
+
filenameExtension: S(w().refine((e) => !V.includes(e), { message: H("documentLibrary") }))
|
|
572
580
|
}).optional(),
|
|
573
|
-
assetCreation:
|
|
581
|
+
assetCreation: U
|
|
574
582
|
}).optional(),
|
|
575
583
|
workspace: C({
|
|
576
584
|
assetBulkActions: C({
|
|
577
585
|
title: w().min(2).max(28),
|
|
578
|
-
filenameExtensions: S(w().refine((e) => !
|
|
586
|
+
filenameExtensions: S(w().refine((e) => !V.includes(e), { message: H("workspaceProject") }))
|
|
579
587
|
}).optional(),
|
|
580
588
|
assetAction: C({
|
|
581
589
|
title: w().min(2).max(28),
|
|
582
|
-
type: S(
|
|
583
|
-
filenameExtension: S(w().refine((e) => !
|
|
590
|
+
type: S(W),
|
|
591
|
+
filenameExtension: S(w().refine((e) => !V.includes(e), { message: H("workspaceProject") }))
|
|
584
592
|
}).optional(),
|
|
585
|
-
assetCreation:
|
|
593
|
+
assetCreation: U
|
|
586
594
|
}).optional()
|
|
587
595
|
}).optional(),
|
|
588
|
-
metadata: C({ version:
|
|
596
|
+
metadata: C({ version: ie().int() })
|
|
589
597
|
}), Ne = (e, t) => {
|
|
590
598
|
let n = t.safeParse(e);
|
|
591
599
|
if (!n.success) throw Error(n.error.message);
|
|
592
600
|
return n.data;
|
|
593
|
-
},
|
|
601
|
+
}, Z = async (e, t) => {
|
|
594
602
|
let n = await o(`${o.convertPathToPattern(e)}/**`, {
|
|
595
603
|
ignore: t,
|
|
596
604
|
dot: !0
|
|
597
605
|
});
|
|
598
|
-
return n.map((t) => t.replace(`${e}/`, "")).reduce((e, t, r) => (e[`/${t}`] =
|
|
599
|
-
},
|
|
606
|
+
return n.map((t) => t.replace(`${e}/`, "")).reduce((e, t, r) => (e[`/${t}`] = pe(n[r]), e), {});
|
|
607
|
+
}, Pe = ["**/*.*.map"], Fe = [
|
|
600
608
|
".git",
|
|
601
609
|
"node_modules",
|
|
602
610
|
"dist",
|
|
@@ -607,52 +615,65 @@ var V = async ({ projectPath: e, entryFile: t, outputName: n }) => y({
|
|
|
607
615
|
"README.md",
|
|
608
616
|
".DS_Store",
|
|
609
617
|
"**/*.graphql"
|
|
610
|
-
],
|
|
618
|
+
], Ie = (e, t) => {
|
|
619
|
+
let n = t || N.get("instanceUrl"), r = e || N.get("tokens.access_token");
|
|
620
|
+
return (!r || !n) && (O.error(`You are currently not logged in. You can use the command ${c.bold("frontify-cli login")} to log in, or pass --token=<token> --instance=<instance> to the deploy command.`), process.exit(-1)), {
|
|
621
|
+
instanceUrl: n,
|
|
622
|
+
accessToken: r
|
|
623
|
+
};
|
|
624
|
+
}, Le = async (e) => {
|
|
625
|
+
e || (O.info("Performing type checks..."), await I("npx tsc --noEmit"), O.info("Performing eslint checks..."), await I("npx eslint src"));
|
|
626
|
+
}, Re = async (e, n) => {
|
|
627
|
+
let r = Pe.map((t) => t.includes("*") ? `${o.convertPathToPattern(e)}/${t}` : o.convertPathToPattern(`${e}/${t}`)), i = [...me(t(e, ".gitignore")).filter((e) => e !== "manifest.json"), ...Fe].map((t) => t.includes("*") ? `${e}/${t}` : o.convertPathToPattern(`${e}/${t}`)), a = A(t(e, "package.json"));
|
|
628
|
+
return {
|
|
629
|
+
build_files: await Z(o.convertPathToPattern(`${e}/${n}`), r),
|
|
630
|
+
source_files: await Z(o.convertPathToPattern(e), i),
|
|
631
|
+
dependencies: a?.dependencies || {}
|
|
632
|
+
};
|
|
633
|
+
}, ze = (e) => {
|
|
634
|
+
typeof e == "string" ? O.error("The deployment has failed and was aborted due to an error:", e) : e instanceof Error ? O.error("The deployment has failed and was aborted due to an error:", e.message) : O.error("The deployment has failed and was aborted due to an unknown error."), process.exit(-1);
|
|
635
|
+
}, Be = async (e, n, { dryRun: r = !1, noVerify: i = !1, openInBrowser: a = !1, token: o, instance: l }, u) => {
|
|
611
636
|
try {
|
|
612
|
-
let
|
|
613
|
-
if (
|
|
614
|
-
|
|
615
|
-
let
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
} catch (e) {
|
|
638
|
-
O.error("An error occured while deploying:", e.responseBody.error), process.exit(-1);
|
|
639
|
-
}
|
|
640
|
-
}
|
|
637
|
+
let { instanceUrl: d, accessToken: f } = Ie(o, l);
|
|
638
|
+
if (r) O.info(c.blue("Dry run: enabled"));
|
|
639
|
+
else {
|
|
640
|
+
let e = await R(d, o);
|
|
641
|
+
if (e) O.info(`You are logged in as ${e.name} (${d}).`);
|
|
642
|
+
else return;
|
|
643
|
+
}
|
|
644
|
+
let p = process.cwd(), m = A(t(p, "manifest.json")), { appId: h } = m.appType === "platform-app" ? Ne(m, Me) : m;
|
|
645
|
+
await Le(i);
|
|
646
|
+
try {
|
|
647
|
+
await u({
|
|
648
|
+
projectPath: p,
|
|
649
|
+
entryFile: e,
|
|
650
|
+
outputName: h
|
|
651
|
+
});
|
|
652
|
+
} catch (e) {
|
|
653
|
+
O.error(e), process.exit(-1);
|
|
654
|
+
}
|
|
655
|
+
let g = await Re(p, n);
|
|
656
|
+
r && (O.success("The command has been executed without any issue."), process.exit(0)), O.info("Sending the files to Frontify Marketplace...");
|
|
657
|
+
let _ = new F(d);
|
|
658
|
+
try {
|
|
659
|
+
await _.put(`/api/marketplace/app/${h}`, g, { headers: { Authorization: `Bearer ${f}` } }), O.success("The new version has been pushed."), a && (O.info("Opening the Frontify Marketplace page..."), await s(`https://${d}/marketplace/apps/${h}`));
|
|
660
|
+
} catch (e) {
|
|
661
|
+
O.error("An error occurred while deploying:", e.responseBody.error), process.exit(-1);
|
|
641
662
|
}
|
|
642
663
|
} catch (e) {
|
|
643
|
-
|
|
664
|
+
ze(e);
|
|
644
665
|
}
|
|
645
|
-
},
|
|
666
|
+
}, Ve = class {
|
|
646
667
|
instanceUrl;
|
|
647
668
|
port;
|
|
648
669
|
httpClient;
|
|
649
|
-
fastifyServer =
|
|
670
|
+
fastifyServer = oe();
|
|
650
671
|
randomChallenge;
|
|
651
672
|
constructor(e, t = 5600) {
|
|
652
673
|
this.instanceUrl = e, this.port = t, this.httpClient = new F(e);
|
|
653
674
|
}
|
|
654
675
|
serveCallbackServer() {
|
|
655
|
-
this.registerPlugins(), this.registerRoutes(), this.fastifyServer.listen({ port: this.port });
|
|
676
|
+
this.registerPlugins(), this.registerRoutes(), this.fastifyServer.listen({ port: this.port }).catch(() => {});
|
|
656
677
|
}
|
|
657
678
|
registerRoutes() {
|
|
658
679
|
this.fastifyServer.get("/oauth", async (e, t) => {
|
|
@@ -664,7 +685,7 @@ var V = async ({ projectPath: e, entryFile: t, outputName: n }) => y({
|
|
|
664
685
|
});
|
|
665
686
|
}
|
|
666
687
|
registerPlugins() {
|
|
667
|
-
this.fastifyServer.register(
|
|
688
|
+
this.fastifyServer.register(ae);
|
|
668
689
|
}
|
|
669
690
|
async storeRandomCodeChallenge() {
|
|
670
691
|
try {
|
|
@@ -679,7 +700,7 @@ var V = async ({ projectPath: e, entryFile: t, outputName: n }) => y({
|
|
|
679
700
|
let e = [
|
|
680
701
|
"response_type=code",
|
|
681
702
|
"client_id=block-cli",
|
|
682
|
-
|
|
703
|
+
`redirect_uri=http://localhost:${this.port}/oauth`,
|
|
683
704
|
"scope=basic:read%2Bblocks:read%2Bblocks:write",
|
|
684
705
|
`code_challenge=${this.randomChallenge.sha256}`,
|
|
685
706
|
"code_challenge_method=S256"
|
|
@@ -692,7 +713,7 @@ var V = async ({ projectPath: e, entryFile: t, outputName: n }) => y({
|
|
|
692
713
|
return await this.httpClient.post("/api/oauth/accesstoken", {
|
|
693
714
|
grant_type: "authorization_code",
|
|
694
715
|
client_id: "block-cli",
|
|
695
|
-
redirect_uri:
|
|
716
|
+
redirect_uri: `http://localhost:${this.port}/oauth`,
|
|
696
717
|
scope: "basic:read+blocks:read+blocks:write",
|
|
697
718
|
code_verifier: this.randomChallenge.secret,
|
|
698
719
|
code: e
|
|
@@ -702,9 +723,9 @@ var V = async ({ projectPath: e, entryFile: t, outputName: n }) => y({
|
|
|
702
723
|
throw Error(`An error occurred while getting tokens: ${t}`);
|
|
703
724
|
}
|
|
704
725
|
}
|
|
705
|
-
},
|
|
726
|
+
}, He = async (e, t) => {
|
|
706
727
|
try {
|
|
707
|
-
let n = new
|
|
728
|
+
let n = new Ve(L(e), t);
|
|
708
729
|
n.serveCallbackServer(), await n.storeRandomCodeChallenge();
|
|
709
730
|
let r = n.getLoginUrl();
|
|
710
731
|
O.info("Attempting to open OAuth login page..."), O.info(`If a browser window doesn't automatically open, please open the following link manually: ${r}`), await s(r);
|
|
@@ -712,9 +733,9 @@ var V = async ({ projectPath: e, entryFile: t, outputName: n }) => y({
|
|
|
712
733
|
let t = e instanceof Error ? e.message : String(e);
|
|
713
734
|
O.error(`You need to enter a valid Frontify instance URL: ${t}`), process.exit(-1);
|
|
714
735
|
}
|
|
715
|
-
},
|
|
736
|
+
}, Ue = () => {
|
|
716
737
|
N.delete("tokens"), O.info("You are now logged out.");
|
|
717
|
-
},
|
|
738
|
+
}, We = class {
|
|
718
739
|
constructor(e, t, n) {
|
|
719
740
|
this.entryFilePath = e, this.port = t, this.allowExternal = n;
|
|
720
741
|
}
|
|
@@ -756,13 +777,13 @@ var V = async ({ projectPath: e, entryFile: t, outputName: n }) => y({
|
|
|
756
777
|
console.error(e), process.exit(1);
|
|
757
778
|
}
|
|
758
779
|
}
|
|
759
|
-
},
|
|
780
|
+
}, Ge = class {
|
|
760
781
|
constructor(e, t) {
|
|
761
782
|
this.entryFilePath = e, this.port = t;
|
|
762
783
|
}
|
|
763
784
|
async serve() {
|
|
764
785
|
try {
|
|
765
|
-
let t = await
|
|
786
|
+
let t = await se.context({
|
|
766
787
|
entryPoints: [this.entryFilePath],
|
|
767
788
|
outfile: "./dist/dev-settings.js",
|
|
768
789
|
minify: !0,
|
|
@@ -780,10 +801,10 @@ var V = async ({ projectPath: e, entryFile: t, outputName: n }) => y({
|
|
|
780
801
|
name: "prebuild-commands",
|
|
781
802
|
handleHotUpdate: ({ file: n, server: r }) => {
|
|
782
803
|
let i = e.relative(process.cwd(), n);
|
|
783
|
-
(i === "src/settings.ts" || i === "src/index.ts") && (t.rebuild(), r.restart());
|
|
804
|
+
(i === "src/settings.ts" || i === "src/index.ts") && (t.rebuild().catch(() => {}), r.restart().catch(() => {}));
|
|
784
805
|
},
|
|
785
806
|
buildStart: () => {
|
|
786
|
-
t.rebuild();
|
|
807
|
+
t.rebuild().catch(() => {});
|
|
787
808
|
}
|
|
788
809
|
}]
|
|
789
810
|
})).listen(this.port, !0)).printUrls();
|
|
@@ -791,13 +812,13 @@ var V = async ({ projectPath: e, entryFile: t, outputName: n }) => y({
|
|
|
791
812
|
console.error(e), process.exit(1);
|
|
792
813
|
}
|
|
793
814
|
}
|
|
794
|
-
},
|
|
815
|
+
}, Ke = class {
|
|
795
816
|
constructor(e, t, n) {
|
|
796
817
|
this.entryFilePath = e, this.port = t, this.allowExternal = n;
|
|
797
818
|
}
|
|
798
819
|
async serve() {
|
|
799
820
|
try {
|
|
800
|
-
let e =
|
|
821
|
+
let e = le(process.cwd()), t = M(process.cwd()), n = await b({
|
|
801
822
|
root: process.cwd(),
|
|
802
823
|
plugins: [v(), B()],
|
|
803
824
|
define: { "process.env.NODE_ENV": JSON.stringify("development") },
|
|
@@ -833,18 +854,42 @@ var V = async ({ projectPath: e, entryFile: t, outputName: n }) => y({
|
|
|
833
854
|
console.error(e), process.exit(1);
|
|
834
855
|
}
|
|
835
856
|
}
|
|
836
|
-
},
|
|
837
|
-
O.info("Starting the development server..."), await new
|
|
838
|
-
},
|
|
839
|
-
O.info("Starting the development server for theme..."), await new
|
|
840
|
-
},
|
|
841
|
-
O.info("Starting the development server for Apps..."), await new
|
|
842
|
-
},
|
|
857
|
+
}, qe = async (e, t, n) => {
|
|
858
|
+
O.info("Starting the development server..."), await new We(e, t, n).serve();
|
|
859
|
+
}, Je = async (e, t, n) => {
|
|
860
|
+
O.info("Starting the development server for theme..."), await new Ke(e, t, n).serve();
|
|
861
|
+
}, Ye = async (e, t) => {
|
|
862
|
+
O.info("Starting the development server for Apps..."), await new Ge(e, t).serve();
|
|
863
|
+
}, Xe = (e, t, r) => {
|
|
843
864
|
O.info(`Creating the ${r}...`);
|
|
844
865
|
let i = c.blue(`./${e}`);
|
|
845
|
-
O.info(`Scaffolding App in ${i}...`), P(n(
|
|
866
|
+
O.info(`Scaffolding App in ${i}...`), P(n(te(import.meta.url), `../../templates/${r}-${t}`), e, { exclude: ["node_modules"] }), be(e, r), ge(e), O.defaultInfo(`\n${O.spacer(11)}You can now access the project and install dependencies.`);
|
|
846
867
|
let a = c.blue(`./${e}`);
|
|
847
868
|
O.defaultInfo(`${O.spacer(4)}cd ${a}`), O.defaultInfo(`${O.spacer(4)}npm i`), O.defaultInfo(`${O.spacer(4)}npm run serve`), O.defaultInfo(`\n${O.spacer(11)}Happy hacking!`);
|
|
869
|
+
}, Q = /* @__PURE__ */ function(e) {
|
|
870
|
+
return e.PRIVATE = "PRIVATE", e.COMMUNITY = "COMMUNITY", e;
|
|
871
|
+
}({}), Ze = async ({ releaseNotes: e, availability: n = Q.PRIVATE, token: r, instance: i }) => {
|
|
872
|
+
try {
|
|
873
|
+
let a = i || N.get("instanceUrl"), o = r || N.get("tokens.access_token");
|
|
874
|
+
(!o || !a) && (O.error(`You are currently not logged in. You can use the command ${c.bold("frontify-cli login")} to log in, or pass --token=<token> --instance=<instance> to the publish command.`), process.exit(-1));
|
|
875
|
+
let s = await R(a, r);
|
|
876
|
+
s || process.exit(-1), O.info(`You are logged in as ${s.name} (${a}).`);
|
|
877
|
+
let { appId: l } = A(t(process.cwd(), "manifest.json")), u = new F(a), d = `mutation PublishMarketplaceApp {
|
|
878
|
+
publishMarketplaceApp(
|
|
879
|
+
input: {appId: "${l}", releaseNotes: ${JSON.stringify(e)}, availability: ${n}}
|
|
880
|
+
) {
|
|
881
|
+
id
|
|
882
|
+
}
|
|
883
|
+
}`;
|
|
884
|
+
O.info("Publishing the app to the Frontify Marketplace...");
|
|
885
|
+
try {
|
|
886
|
+
await u.post("/graphql", { query: d }, { headers: { Authorization: `Bearer ${o}` } }), O.success("The app has been published successfully.");
|
|
887
|
+
} catch (e) {
|
|
888
|
+
O.error("An error occurred while publishing:", e.responseBody.error), process.exit(-1);
|
|
889
|
+
}
|
|
890
|
+
} catch (e) {
|
|
891
|
+
typeof e == "string" ? O.error("The publishing has failed and was aborted due to an error:", e) : e instanceof Error ? O.error("The publishing has failed and was aborted due to an error:", e.message) : O.error("The publishing has failed and was aborted due to an unknown error."), process.exit(-1);
|
|
892
|
+
}
|
|
848
893
|
}, $ = i(E.name.split("/")[1]);
|
|
849
894
|
$.command("login [instanceUrl]", "log in to a Frontify instance").option("-i, --instance <instanceUrl>", "[string] url of the Frontify instance").option("-p, --port <port>", "[number] port for the oauth service", { default: process.env.PORT || 5600 }).action(async (e, t) => {
|
|
850
895
|
let n = e || t.instance || process.env.INSTANCE_URL;
|
|
@@ -856,43 +901,31 @@ $.command("login [instanceUrl]", "log in to a Frontify instance").option("-i, --
|
|
|
856
901
|
initial: "instanceName.frontify.com",
|
|
857
902
|
validate: (e) => e.trim() === "" ? "You need to enter a valid URL." : !0
|
|
858
903
|
}]);
|
|
859
|
-
i || r(0), await
|
|
860
|
-
}), $.command("logout", "log out of an instance").action(
|
|
861
|
-
for (let e of ["block", "theme"]) $.command(`${e} serve`, `[deprecated: use 'serve' instead] serve the ${e} locally`).alias(`${e} dev`).option("-e, --entryPath, --entry-path <entryPath>", `[string] path to the ${e} entry file`, { default: t("src", "index.tsx") }).option("--port <port>", "[number] specify port", { default: process.env.PORT || 5600 }).option("--allowExternal, --allow-external", "[boolean] allow external IPs to access the server", { default: !1 }).action(async (e) => {
|
|
862
|
-
await Ue(e.entryPath, e.port, e.allowExternal);
|
|
863
|
-
});
|
|
864
|
-
$.command("serve", "serve the app locally").alias("dev").option("-e, --entryPath, --entry-path <entryPath>", "[string] path to the entry file", { default: t("src", "index.ts") }).option("--port <port>", "[number] specify port", { default: process.env.PORT || 5600 }).option("--allowExternal, --allow-external", "[boolean] allow external IPs to access the server", { default: !1 }).option("--appType <appType>, --app-type", "[string] specify app type. Overrides manifest values").action(async (e) => {
|
|
865
|
-
let n = A(t(process.cwd(), "manifest.json")), r = e.appType || n.appType;
|
|
866
|
-
r === "platform-app" ? await Ge(e.entryPath, e.port) : r === "theme" ? await We(e.entryPath, e.port, e.allowExternal) : await Ue(e.entryPath, e.port, e.allowExternal);
|
|
867
|
-
});
|
|
868
|
-
for (let e of ["block", "theme"]) $.command(`${e} deploy`, `[deprecated: use 'deploy' instead] deploy the ${e} to the marketplace`).option("-e, --entryPath <entryPath>", "[string] path to the entry file", { default: t("src", "index.tsx") }).option("-o, --outDir <outDir>", "[string] path to the output directory", { default: "dist" }).option("--dryRun, --dry-run", "[boolean] enable the dry run mode", { default: !1 }).option("--noVerify, --no-verify", "[boolean] disable the linting and typechecking", { default: !1 }).option("--open", "[boolean] open the marketplace app page", { default: !1 }).action(async (t) => {
|
|
869
|
-
await Q(t.entryPath, t.outDir, {
|
|
870
|
-
dryRun: t.dryRun,
|
|
871
|
-
noVerify: t.noVerify,
|
|
872
|
-
openInBrowser: t.open
|
|
873
|
-
}, e === "theme" ? H : V);
|
|
874
|
-
});
|
|
875
|
-
$.command("deploy", "deploy the app to the marketplace").option("-e, --entryPath <entryPath>", "[string] path to the entry file", { default: t("src", "index.ts") }).option("-o, --outDir <outDir>", "[string] path to the output directory", { default: "dist" }).option("--dryRun, --dry-run", "[boolean] enable the dry run mode", { default: !1 }).option("--noVerify, --no-verify", "[boolean] disable the linting and typechecking", { default: !1 }).option("--open", "[boolean] open the marketplace app page", { default: !1 }).option("--appType [appType], --app-type", "[string] specify app type. Overrides manifest values").option("-i, --instance <instanceUrl>", "[string] url of the Frontify instance").option("-t, --token <accessToken>", "[string] the access token").action(async (e) => {
|
|
904
|
+
i || r(0), await He(L(i), t.port);
|
|
905
|
+
}), $.command("logout", "log out of an instance").action(Ue), $.command("serve", "serve the app locally").alias("dev").option("-e, --entryPath, --entry-path <entryPath>", "[string] path to the entry file", { default: t("src", "index.ts") }).option("--port <port>", "[number] specify port", { default: process.env.PORT || 5600 }).option("--allowExternal, --allow-external", "[boolean] allow external IPs to access the server", { default: !1 }).option("--appType <appType>, --app-type", "[string] specify app type. Overrides manifest values").action(async (e) => {
|
|
876
906
|
let n = A(t(process.cwd(), "manifest.json")), r = e.appType || n.appType;
|
|
877
|
-
r === "platform-app" ? await
|
|
907
|
+
r === "platform-app" ? await Ye(e.entryPath, e.port) : r === "theme" ? await Je(e.entryPath, e.port, e.allowExternal) : await qe(e.entryPath, e.port, e.allowExternal);
|
|
908
|
+
}), $.command("deploy", "deploy the app to the marketplace").option("-e, --entryPath <entryPath>", "[string] path to the entry file", { default: t("src", "index.ts") }).option("-o, --outDir <outDir>", "[string] path to the output directory", { default: "dist" }).option("--dryRun, --dry-run", "[boolean] enable the dry run mode", { default: !1 }).option("--noVerify, --no-verify", "[boolean] disable the linting and typechecking", { default: !1 }).option("--open", "[boolean] open the marketplace app page", { default: !1 }).option("--appType [appType], --app-type", "[string] specify app type. Overrides manifest values").option("-i, --instance <instanceUrl>", "[string] url of the Frontify instance").option("-t, --token <accessToken>", "[string] the access token").action(async (e) => {
|
|
909
|
+
let n = A(t(process.cwd(), "manifest.json")), r = e.appType || n.appType, i = {
|
|
910
|
+
"content-block": Ce,
|
|
911
|
+
"platform-app": Se,
|
|
912
|
+
theme: we
|
|
913
|
+
}, a = i[r ?? ""];
|
|
914
|
+
if (!a) throw Error(`Unknown app type "${r}". Expected one of: ${Object.keys(i).join(", ")}`);
|
|
915
|
+
await Be(e.entryPath, e.outDir, {
|
|
878
916
|
dryRun: e.dryRun,
|
|
879
917
|
noVerify: e.noVerify,
|
|
880
918
|
openInBrowser: e.open,
|
|
881
919
|
instance: e.instance,
|
|
882
920
|
token: e.token
|
|
883
|
-
},
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
token: e.token
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
noVerify: e.noVerify,
|
|
892
|
-
openInBrowser: e.open,
|
|
893
|
-
instance: e.instance,
|
|
894
|
-
token: e.token
|
|
895
|
-
}, V);
|
|
921
|
+
}, a);
|
|
922
|
+
}), $.command("publish", "publish the app to the marketplace").option("--releaseNotes, --release-notes <releaseNotes>", "[string] release notes for the publish").option("--availability [availability]", `[string] availability of the app (${Object.values(Q).join(", ")})`, { default: Q.PRIVATE }).option("-i, --instance <instanceUrl>", "[string] url of the Frontify instance").option("-t, --token <accessToken>", "[string] the access token").action(async (e) => {
|
|
923
|
+
e.releaseNotes || (O.error("Release notes are required. Use --releaseNotes=\"Your release notes\"."), process.exit(-1)), await Ze({
|
|
924
|
+
releaseNotes: e.releaseNotes,
|
|
925
|
+
availability: e.availability,
|
|
926
|
+
token: e.token,
|
|
927
|
+
instance: e.instance
|
|
928
|
+
});
|
|
896
929
|
}), $.command("create [appName]", "create a new marketplace app").action(async (e) => {
|
|
897
930
|
let { promptedAppName: t, stylingFramework: n, appType: i } = await a([
|
|
898
931
|
{
|
|
@@ -900,7 +933,7 @@ $.command("deploy", "deploy the app to the marketplace").option("-e, --entryPath
|
|
|
900
933
|
name: "promptedAppName",
|
|
901
934
|
message: "Enter your app name",
|
|
902
935
|
initial: e || "my-frontify-app",
|
|
903
|
-
validate: (e) => e.trim() === "" ? "You need to enter an app name." :
|
|
936
|
+
validate: (e) => e.trim() === "" ? "You need to enter an app name." : _e(e)
|
|
904
937
|
},
|
|
905
938
|
{
|
|
906
939
|
type: "select",
|
|
@@ -934,13 +967,8 @@ $.command("deploy", "deploy the app to the marketplace").option("-e, --entryPath
|
|
|
934
967
|
]
|
|
935
968
|
}
|
|
936
969
|
]);
|
|
937
|
-
(!t || !n || !i) && r(0),
|
|
938
|
-
});
|
|
939
|
-
for (let e of ["block", "theme"]) $.command(`${e} create [appName]`, `[deprecated: use 'create' instead] create a ${e} app locally`).action((e) => Ke(e, "css-modules", "content-block"));
|
|
940
|
-
$.help(), $.version(E.version), $.parse(((e) => {
|
|
941
|
-
let t = e.findIndex((e) => e === "block" || e === "theme");
|
|
942
|
-
return t !== -1 && (e[t + 1] === "serve" || e[t + 1] === "deploy" || e[t + 1] === "create") && (e[t] = `${e[t]} ${e[t + 1]}`, e.splice(t + 1, 1)), e;
|
|
943
|
-
})(process.argv));
|
|
970
|
+
(!t || !n || !i) && r(0), Xe(t, n, i);
|
|
971
|
+
}), $.help(), $.version(E.version), $.parse(process.argv);
|
|
944
972
|
//#endregion
|
|
945
973
|
|
|
946
974
|
//# sourceMappingURL=index.mjs.map
|