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