@frontify/frontify-cli 5.9.3 → 5.9.5
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 +93 -85
- package/dist/index.mjs.map +1 -1
- package/package.json +17 -18
- package/templates/content-block-css/package.json +7 -7
- package/templates/content-block-css-modules/package.json +8 -8
- package/templates/content-block-tailwind/package.json +9 -9
- package/templates/platform-app-css/package.json +11 -11
- package/templates/platform-app-css-modules/package.json +11 -11
- package/templates/platform-app-tailwind/package.json +13 -13
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import ue, { join as
|
|
2
|
+
import ue, { join as m, resolve as O } from "node:path";
|
|
3
3
|
import { exit as W } from "node:process";
|
|
4
4
|
import { cac as he } from "cac";
|
|
5
5
|
import j from "prompts";
|
|
@@ -12,16 +12,16 @@ import be from "glob-to-regexp";
|
|
|
12
12
|
import "node:crypto";
|
|
13
13
|
import xe from "node-fetch";
|
|
14
14
|
import { exec as Ee } from "node:child_process";
|
|
15
|
-
import { URL as ke, fileURLToPath as
|
|
15
|
+
import { URL as ke, fileURLToPath as $e } from "node:url";
|
|
16
16
|
import "archiver";
|
|
17
17
|
import x from "@vitejs/plugin-react";
|
|
18
18
|
import { build as A, createServer as N } from "vite";
|
|
19
19
|
import { viteExternalsPlugin as C } from "vite-plugin-externals";
|
|
20
|
-
import { object as c, string as a, z as
|
|
20
|
+
import { object as c, string as a, z as w, array as l, number as te, boolean as Se } from "zod";
|
|
21
21
|
import Te from "@fastify/cors";
|
|
22
22
|
import Pe from "fastify";
|
|
23
23
|
import * as Ce from "esbuild";
|
|
24
|
-
const De = "@frontify/frontify-cli", Oe = "module", Ae = "5.9.
|
|
24
|
+
const De = "@frontify/frontify-cli", Oe = "module", Ae = "5.9.5", Fe = "Frontify Developers <developers@frontify.com>", Ue = {
|
|
25
25
|
type: "git",
|
|
26
26
|
url: "https://github.com/Frontify/brand-sdk",
|
|
27
27
|
directory: "packages/cli"
|
|
@@ -45,38 +45,37 @@ const De = "@frontify/frontify-cli", Oe = "module", Ae = "5.9.3", Fe = "Frontify
|
|
|
45
45
|
typecheck: "tsc --noEmit"
|
|
46
46
|
}, Be = {
|
|
47
47
|
"@fastify/cors": "^9.0.1",
|
|
48
|
-
"@vitejs/plugin-react": "^
|
|
48
|
+
"@vitejs/plugin-react": "^5.1.1",
|
|
49
49
|
archiver: "^7.0.1",
|
|
50
50
|
cac: "^6.7.14",
|
|
51
|
-
conf: "^
|
|
52
|
-
esbuild: "^0.
|
|
53
|
-
"fast-glob": "^3.3.
|
|
54
|
-
fastify: "^4.
|
|
51
|
+
conf: "^15.0.2",
|
|
52
|
+
esbuild: "^0.27.0",
|
|
53
|
+
"fast-glob": "^3.3.3",
|
|
54
|
+
fastify: "^4.29.1",
|
|
55
55
|
"glob-to-regexp": "^0.4.1",
|
|
56
56
|
"node-fetch": "^3.3.2",
|
|
57
|
-
open: "^
|
|
58
|
-
picocolors: "^1.
|
|
57
|
+
open: "^11.0.0",
|
|
58
|
+
picocolors: "^1.1.1",
|
|
59
59
|
prompts: "^2.4.2",
|
|
60
|
-
vite: "^5.4.
|
|
60
|
+
vite: "^5.4.21",
|
|
61
61
|
"vite-plugin-externals": "^0.6.2",
|
|
62
62
|
zod: "^3.25.76"
|
|
63
63
|
}, Ne = {
|
|
64
|
-
"@frontify/eslint-config-basic": "^1.0.
|
|
64
|
+
"@frontify/eslint-config-basic": "^1.0.8",
|
|
65
65
|
"@types/glob-to-regexp": "^0.4.4",
|
|
66
66
|
"@types/mock-fs": "^4.13.4",
|
|
67
|
-
"@types/node": "^
|
|
67
|
+
"@types/node": "^20.19.25",
|
|
68
68
|
"@types/prompts": "^2.4.9",
|
|
69
69
|
"@types/ws": "8.18.1",
|
|
70
|
-
"@vitest/coverage-v8": "
|
|
71
|
-
"@vitest/ui": "^
|
|
72
|
-
eslint: "^9.
|
|
70
|
+
"@vitest/coverage-v8": "4.0.15",
|
|
71
|
+
"@vitest/ui": "^4.0.15",
|
|
72
|
+
eslint: "^9.39.1",
|
|
73
73
|
"eslint-plugin-notice": "^1.0.0",
|
|
74
74
|
nock: "^13.5.6",
|
|
75
|
-
prettier: "^3.
|
|
75
|
+
prettier: "^3.7.4",
|
|
76
76
|
"ts-node": "^10.9.2",
|
|
77
|
-
typescript: "^5.9.
|
|
78
|
-
|
|
79
|
-
vitest: "^3.2.4"
|
|
77
|
+
typescript: "^5.9.3",
|
|
78
|
+
vitest: "^4.0.15"
|
|
80
79
|
}, F = {
|
|
81
80
|
name: De,
|
|
82
81
|
type: Oe,
|
|
@@ -122,7 +121,7 @@ class Le extends Error {
|
|
|
122
121
|
super(), this.name = "ParseJsonError", s.error(`The file at "${t}" could not be parsed.`);
|
|
123
122
|
}
|
|
124
123
|
}
|
|
125
|
-
const
|
|
124
|
+
const $ = (e) => {
|
|
126
125
|
try {
|
|
127
126
|
const t = B(e, "utf8"), n = JSON.parse(t);
|
|
128
127
|
return new Proxy(n, {
|
|
@@ -135,7 +134,7 @@ const S = (e) => {
|
|
|
135
134
|
} catch (t) {
|
|
136
135
|
throw t instanceof SyntaxError ? new Le(e) : t.code === "ENOENT" ? new U(e) : new Error(t);
|
|
137
136
|
}
|
|
138
|
-
}, L = (e) =>
|
|
137
|
+
}, L = (e) => $(m(e, "package.json")).dependencies["@frontify/app-bridge"];
|
|
139
138
|
class k {
|
|
140
139
|
static {
|
|
141
140
|
this.conf = new ve({
|
|
@@ -162,7 +161,7 @@ const Ve = (e) => {
|
|
|
162
161
|
ye(t, { recursive: !0 });
|
|
163
162
|
const r = n?.exclude.map((o) => be(o));
|
|
164
163
|
for (const o of ee(e)) {
|
|
165
|
-
if (r !== void 0 && r.some((
|
|
164
|
+
if (r !== void 0 && r.some((u) => u.test(o)))
|
|
166
165
|
continue;
|
|
167
166
|
const i = O(e, o), p = O(t, o);
|
|
168
167
|
Je(i, p);
|
|
@@ -209,12 +208,12 @@ class V {
|
|
|
209
208
|
if (i.status === 200)
|
|
210
209
|
switch (i.headers.get("Content-Type")) {
|
|
211
210
|
case "application/json": {
|
|
212
|
-
const
|
|
213
|
-
return
|
|
211
|
+
const u = await i.json();
|
|
212
|
+
return u || void 0;
|
|
214
213
|
}
|
|
215
214
|
default: {
|
|
216
|
-
const
|
|
217
|
-
return
|
|
215
|
+
const u = await i.text();
|
|
216
|
+
return u || void 0;
|
|
218
217
|
}
|
|
219
218
|
}
|
|
220
219
|
else {
|
|
@@ -239,7 +238,7 @@ class V {
|
|
|
239
238
|
}
|
|
240
239
|
}
|
|
241
240
|
const qe = (e) => {
|
|
242
|
-
const t = O(e, "package.json"), n =
|
|
241
|
+
const t = O(e, "package.json"), n = $(t);
|
|
243
242
|
n.name = e;
|
|
244
243
|
}, Ze = (e) => e ? /^[_a-z-]+$/.test(e) ? Ve(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.";
|
|
245
244
|
class Ke extends Error {
|
|
@@ -277,7 +276,7 @@ const re = (e) => {
|
|
|
277
276
|
return;
|
|
278
277
|
}
|
|
279
278
|
}, We = (e, t) => {
|
|
280
|
-
const n =
|
|
279
|
+
const n = m(e, ".gitignore");
|
|
281
280
|
X(n, Qe[t]);
|
|
282
281
|
}, Qe = {
|
|
283
282
|
"platform-app": `# Logs
|
|
@@ -395,7 +394,7 @@ dist
|
|
|
395
394
|
}
|
|
396
395
|
}
|
|
397
396
|
});
|
|
398
|
-
}, ae = (e) =>
|
|
397
|
+
}, ae = (e) => $(m(e, "package.json")).dependencies["@frontify/app-bridge-theme"], ie = async ({ projectPath: e, entryFile: t, outputName: n }) => {
|
|
399
398
|
const r = ae(e);
|
|
400
399
|
return A({
|
|
401
400
|
plugins: [
|
|
@@ -432,9 +431,9 @@ dist
|
|
|
432
431
|
}
|
|
433
432
|
}
|
|
434
433
|
});
|
|
435
|
-
},
|
|
434
|
+
}, g = ["exe", "dmg", "cmd", "sh", "bat"], v = (e) => `Invalid file extension, \`${e}.filenameExtension\` can not include: ${g.join(", ")}.`, T = c({
|
|
436
435
|
title: a().min(1).max(40)
|
|
437
|
-
}).optional(), P =
|
|
436
|
+
}).optional(), P = w.enum(["audio", "document", "image", "video", "file", "embeddedContent"]), z = P.exclude(["audio", "document", "video", "file", "embeddedContent"]), H = w.enum(["svg"]), Y = w.enum(["svg", "jpg", "jpeg", "ai", "eps", "png", "tif", "tiff"]), et = w.enum(["content-block", "platform-app", "theme"]), q = /* @__PURE__ */ new Set(), tt = c({
|
|
438
437
|
label: a(),
|
|
439
438
|
key: a().min(1).max(80).refine(
|
|
440
439
|
(e) => q.has(e) ? !1 : (q.add(e), /^\w+$/.test(e)),
|
|
@@ -443,9 +442,9 @@ dist
|
|
|
443
442
|
}
|
|
444
443
|
)
|
|
445
444
|
}), nt = l(tt), rt = c({
|
|
446
|
-
method:
|
|
447
|
-
headers:
|
|
448
|
-
body:
|
|
445
|
+
method: w.enum(["GET", "POST", "PUT", "DELETE"]),
|
|
446
|
+
headers: w.record(a()).optional(),
|
|
447
|
+
body: w.any().optional()
|
|
449
448
|
}), Z = /* @__PURE__ */ new Set(), ot = c({
|
|
450
449
|
name: a().refine(
|
|
451
450
|
(e) => Z.has(e) ? !1 : (Z.add(e), /^[\w-]*$/.test(e)),
|
|
@@ -455,7 +454,7 @@ dist
|
|
|
455
454
|
),
|
|
456
455
|
resource: a(),
|
|
457
456
|
options: rt
|
|
458
|
-
}), st = /^(([\dA-Za-z]|[\dA-Za-z][\dA-Za-z-]*[\dA-Za-z])\.)*([\dA-Za-z]|[\dA-Za-z][\dA-Za-z-]*[\dA-Za-z])$/, at =
|
|
457
|
+
}), st = /^(([\dA-Za-z]|[\dA-Za-z][\dA-Za-z-]*[\dA-Za-z])\.)*([\dA-Za-z]|[\dA-Za-z][\dA-Za-z-]*[\dA-Za-z])$/, at = w.enum(["basic:read", "basic:write", "account:read", "webhook:read", "webhook:write"]), it = c({
|
|
459
458
|
permissions: c({
|
|
460
459
|
scopes: l(at).min(1, "At least one scope is required").max(5, "No more than 5 scopes are allowed").refine((e) => e.includes("basic:read"), {
|
|
461
460
|
message: "'basic:read' is required in scopes"
|
|
@@ -476,7 +475,7 @@ dist
|
|
|
476
475
|
}), lt = l(ct).optional(), pt = c({
|
|
477
476
|
appId: a().length(25),
|
|
478
477
|
appType: et,
|
|
479
|
-
experimental:
|
|
478
|
+
experimental: Se().optional(),
|
|
480
479
|
secrets: nt.optional(),
|
|
481
480
|
network: c({
|
|
482
481
|
allowedHosts: l(
|
|
@@ -492,14 +491,14 @@ dist
|
|
|
492
491
|
}).optional(),
|
|
493
492
|
surfaces: c({
|
|
494
493
|
guideline: c({
|
|
495
|
-
|
|
494
|
+
pageAction: c({
|
|
496
495
|
title: a().min(2).max(28)
|
|
497
496
|
}).optional(),
|
|
498
497
|
assetViewer: c({
|
|
499
498
|
title: a().min(2).max(28),
|
|
500
499
|
type: l(P),
|
|
501
500
|
filenameExtension: l(
|
|
502
|
-
a().refine((e) => !
|
|
501
|
+
a().refine((e) => !g.includes(e), {
|
|
503
502
|
message: v("guideline")
|
|
504
503
|
})
|
|
505
504
|
)
|
|
@@ -509,7 +508,7 @@ dist
|
|
|
509
508
|
assetBulkActions: c({
|
|
510
509
|
title: a().min(2).max(28),
|
|
511
510
|
filenameExtensions: l(
|
|
512
|
-
a().refine((e) => !
|
|
511
|
+
a().refine((e) => !g.includes(e), {
|
|
513
512
|
message: v("mediaLibrary")
|
|
514
513
|
})
|
|
515
514
|
)
|
|
@@ -518,7 +517,7 @@ dist
|
|
|
518
517
|
title: a().min(2).max(28),
|
|
519
518
|
type: l(P),
|
|
520
519
|
filenameExtension: l(
|
|
521
|
-
a().refine((e) => !
|
|
520
|
+
a().refine((e) => !g.includes(e), {
|
|
522
521
|
message: v("mediaLibrary")
|
|
523
522
|
})
|
|
524
523
|
)
|
|
@@ -553,7 +552,7 @@ dist
|
|
|
553
552
|
assetBulkActions: c({
|
|
554
553
|
title: a().min(2).max(28),
|
|
555
554
|
filenameExtensions: l(
|
|
556
|
-
a().refine((e) => !
|
|
555
|
+
a().refine((e) => !g.includes(e), {
|
|
557
556
|
message: v("documentLibrary")
|
|
558
557
|
})
|
|
559
558
|
)
|
|
@@ -562,7 +561,7 @@ dist
|
|
|
562
561
|
title: a().min(2).max(28),
|
|
563
562
|
type: l(P),
|
|
564
563
|
filenameExtension: l(
|
|
565
|
-
a().refine((e) => !
|
|
564
|
+
a().refine((e) => !g.includes(e), {
|
|
566
565
|
message: v("documentLibrary")
|
|
567
566
|
})
|
|
568
567
|
)
|
|
@@ -573,7 +572,7 @@ dist
|
|
|
573
572
|
assetBulkActions: c({
|
|
574
573
|
title: a().min(2).max(28),
|
|
575
574
|
filenameExtensions: l(
|
|
576
|
-
a().refine((e) => !
|
|
575
|
+
a().refine((e) => !g.includes(e), {
|
|
577
576
|
message: v("workspaceProject")
|
|
578
577
|
})
|
|
579
578
|
)
|
|
@@ -582,7 +581,7 @@ dist
|
|
|
582
581
|
title: a().min(2).max(28),
|
|
583
582
|
type: l(P),
|
|
584
583
|
filenameExtension: l(
|
|
585
|
-
a().refine((e) => !
|
|
584
|
+
a().refine((e) => !g.includes(e), {
|
|
586
585
|
message: v("workspaceProject")
|
|
587
586
|
})
|
|
588
587
|
)
|
|
@@ -601,52 +600,61 @@ dist
|
|
|
601
600
|
}, G = async (e, t) => {
|
|
602
601
|
const n = await E(`${E.convertPathToPattern(e)}/**`, { ignore: t, dot: !0 });
|
|
603
602
|
return n.map((o) => o.replace(`${e}/`, "")).reduce((o, i, p) => (o[`/${i}`] = ze(n[p]), o), {});
|
|
604
|
-
}, mt = ["**/*.*.map"], ft = [
|
|
603
|
+
}, mt = ["**/*.*.map"], ft = [
|
|
604
|
+
".git",
|
|
605
|
+
"node_modules",
|
|
606
|
+
"dist",
|
|
607
|
+
".vscode",
|
|
608
|
+
".idea",
|
|
609
|
+
".eslintignore",
|
|
610
|
+
".prettierignore",
|
|
611
|
+
"README.md",
|
|
612
|
+
".DS_Store",
|
|
613
|
+
"**/*.graphql"
|
|
614
|
+
], D = async (e, t, { dryRun: n = !1, noVerify: r = !1, openInBrowser: o = !1, token: i, instance: p }, u) => {
|
|
605
615
|
try {
|
|
606
|
-
let
|
|
607
|
-
const
|
|
608
|
-
if ((!J ||
|
|
616
|
+
let h;
|
|
617
|
+
const S = p || k.get("instanceUrl"), J = i || k.get("tokens.access_token");
|
|
618
|
+
if ((!J || !S) && (s.error(
|
|
609
619
|
`You are currently not logged in. You can use the command ${b.bold(
|
|
610
620
|
"frontify-cli login"
|
|
611
621
|
)} to log in, or pass --token=<token> --instance=<instance> to the deploy command.`
|
|
612
|
-
), process.exit(-1)), n || (
|
|
622
|
+
), process.exit(-1)), n || (h = await oe(S, i), h && s.info(`You are logged in as ${h.name} (${S}).`)), h || n) {
|
|
613
623
|
n && s.info(b.blue("Dry run: enabled"));
|
|
614
|
-
const
|
|
624
|
+
const y = process.cwd(), R = $(m(y, "manifest.json")), { appId: _ } = R.appType === "platform-app" ? dt(R, pt) : R;
|
|
615
625
|
r || (s.info("Performing type checks..."), await M("npx tsc --noEmit"), s.info("Performing eslint checks..."), await M("npx eslint src"));
|
|
616
626
|
try {
|
|
617
|
-
await
|
|
618
|
-
} catch (
|
|
619
|
-
s.error(
|
|
627
|
+
await u({ projectPath: y, entryFile: e, outputName: _ });
|
|
628
|
+
} catch (d) {
|
|
629
|
+
s.error(d), process.exit(-1);
|
|
620
630
|
}
|
|
621
631
|
const pe = mt.map(
|
|
622
|
-
(
|
|
623
|
-
), de = [...He(
|
|
624
|
-
(
|
|
625
|
-
), ...ft].map(
|
|
626
|
-
(h) => E.convertPathToPattern(`${w}/${h}`)
|
|
627
|
-
), me = {
|
|
632
|
+
(d) => E.convertPathToPattern(y + d)
|
|
633
|
+
), de = [...He(m(y, ".gitignore")).filter(
|
|
634
|
+
(d) => d !== "manifest.json"
|
|
635
|
+
), ...ft].map((d) => d.includes("*") ? `${y}/${d}` : E.convertPathToPattern(`${y}/${d}`)), me = {
|
|
628
636
|
build_files: await G(
|
|
629
|
-
E.convertPathToPattern(`${
|
|
637
|
+
E.convertPathToPattern(`${y}/${t}`),
|
|
630
638
|
pe
|
|
631
639
|
),
|
|
632
|
-
source_files: await G(E.convertPathToPattern(
|
|
640
|
+
source_files: await G(E.convertPathToPattern(y), de)
|
|
633
641
|
};
|
|
634
642
|
if (n)
|
|
635
643
|
s.success("The command has been executed without any issue."), process.exit(0);
|
|
636
644
|
else {
|
|
637
645
|
s.info("Sending the files to Frontify Marketplace...");
|
|
638
|
-
const
|
|
646
|
+
const d = new V(S);
|
|
639
647
|
try {
|
|
640
|
-
await
|
|
648
|
+
await d.put(`/api/marketplace/app/${_}`, me, {
|
|
641
649
|
headers: { Authorization: `Bearer ${J}` }
|
|
642
|
-
}), s.success("The new version has been pushed."), o && (s.info("Opening the Frontify Marketplace page..."), await Q(`https://${
|
|
650
|
+
}), s.success("The new version has been pushed."), o && (s.info("Opening the Frontify Marketplace page..."), await Q(`https://${S}/marketplace/apps/${_}`));
|
|
643
651
|
} catch (fe) {
|
|
644
652
|
s.error("An error occured while deploying:", fe.responseBody.error), process.exit(-1);
|
|
645
653
|
}
|
|
646
654
|
}
|
|
647
655
|
}
|
|
648
|
-
} catch (
|
|
649
|
-
typeof
|
|
656
|
+
} catch (h) {
|
|
657
|
+
typeof h == "string" ? s.error("The deployment has failed and was aborted due to an error:", h) : h instanceof Error ? s.error("The deployment has failed and was aborted due to an error:", h.message) : s.error("The deployment has failed and was aborted due to an unknown error."), process.exit(-1);
|
|
650
658
|
}
|
|
651
659
|
};
|
|
652
660
|
class ut {
|
|
@@ -874,14 +882,14 @@ const ce = async (e, t, n) => {
|
|
|
874
882
|
s.info(`Creating the ${n}...`);
|
|
875
883
|
const r = b.blue(`./${e}`);
|
|
876
884
|
s.info(`Scaffolding App in ${r}...`);
|
|
877
|
-
const o = O(
|
|
885
|
+
const o = O($e(import.meta.url), `../../templates/${n}-${t}`);
|
|
878
886
|
ne(o, e, { exclude: ["node_modules"] }), We(e, n), qe(e), s.defaultInfo(`
|
|
879
887
|
${s.spacer(11)}You can now access the project and install dependencies.`);
|
|
880
888
|
const i = b.blue(`./${e}`);
|
|
881
889
|
s.defaultInfo(`${s.spacer(4)}cd ${i}`), s.defaultInfo(`${s.spacer(4)}npm i`), s.defaultInfo(`${s.spacer(4)}npm run serve`), s.defaultInfo(`
|
|
882
890
|
${s.spacer(11)}Happy hacking!`);
|
|
883
|
-
},
|
|
884
|
-
|
|
891
|
+
}, f = he(F.name.split("/")[1]);
|
|
892
|
+
f.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", {
|
|
885
893
|
default: process.env.PORT || 5600
|
|
886
894
|
}).action(async (e, t) => {
|
|
887
895
|
const n = e || t.instance || process.env.INSTANCE_URL;
|
|
@@ -899,10 +907,10 @@ m.command("login [instanceUrl]", "log in to a Frontify instance").option("-i, --
|
|
|
899
907
|
const o = re(r);
|
|
900
908
|
await ht(o, t.port);
|
|
901
909
|
});
|
|
902
|
-
|
|
910
|
+
f.command("logout", "log out of an instance").action(yt);
|
|
903
911
|
for (const e of ["block", "theme"])
|
|
904
|
-
|
|
905
|
-
default:
|
|
912
|
+
f.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`, {
|
|
913
|
+
default: m("src", "index.tsx")
|
|
906
914
|
}).option("--port <port>", "[number] specify port", {
|
|
907
915
|
default: process.env.PORT || 5600
|
|
908
916
|
}).option("--allowExternal, --allow-external", "[boolean] allow external IPs to access the server", {
|
|
@@ -910,18 +918,18 @@ for (const e of ["block", "theme"])
|
|
|
910
918
|
}).action(async (t) => {
|
|
911
919
|
await ce(t.entryPath, t.port, t.allowExternal);
|
|
912
920
|
});
|
|
913
|
-
|
|
914
|
-
default:
|
|
921
|
+
f.command("serve", "serve the app locally").alias("dev").option("-e, --entryPath, --entry-path <entryPath>", "[string] path to the entry file", {
|
|
922
|
+
default: m("src", "index.ts")
|
|
915
923
|
}).option("--port <port>", "[number] specify port", {
|
|
916
924
|
default: process.env.PORT || 5600
|
|
917
925
|
}).option("--allowExternal, --allow-external", "[boolean] allow external IPs to access the server", {
|
|
918
926
|
default: !1
|
|
919
927
|
}).option("--appType <appType>, --app-type", "[string] specify app type. Overrides manifest values").action(async (e) => {
|
|
920
|
-
const t =
|
|
928
|
+
const t = $(m(process.cwd(), "manifest.json")), n = e.appType || t.appType;
|
|
921
929
|
n === "platform-app" ? await xt(e.entryPath, e.port) : n === "theme" ? await bt(e.entryPath, e.port, e.allowExternal) : await ce(e.entryPath, e.port, e.allowExternal);
|
|
922
930
|
});
|
|
923
931
|
for (const e of ["block", "theme"])
|
|
924
|
-
|
|
932
|
+
f.command(`${e} deploy`, `[deprecated: use 'deploy' instead] deploy the ${e} to the marketplace`).option("-e, --entryPath <entryPath>", "[string] path to the entry file", { default: m("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) => {
|
|
925
933
|
await D(
|
|
926
934
|
t.entryPath,
|
|
927
935
|
t.outDir,
|
|
@@ -933,8 +941,8 @@ for (const e of ["block", "theme"])
|
|
|
933
941
|
e === "theme" ? ie : se
|
|
934
942
|
);
|
|
935
943
|
});
|
|
936
|
-
|
|
937
|
-
const t =
|
|
944
|
+
f.command("deploy", "deploy the app to the marketplace").option("-e, --entryPath <entryPath>", "[string] path to the entry file", { default: m("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) => {
|
|
945
|
+
const t = $(m(process.cwd(), "manifest.json")), n = e.appType || t.appType;
|
|
938
946
|
n === "platform-app" ? await D(
|
|
939
947
|
e.entryPath,
|
|
940
948
|
e.outDir,
|
|
@@ -970,7 +978,7 @@ m.command("deploy", "deploy the app to the marketplace").option("-e, --entryPath
|
|
|
970
978
|
se
|
|
971
979
|
);
|
|
972
980
|
});
|
|
973
|
-
|
|
981
|
+
f.command("create [appName]", "create a new marketplace app").action(async (e) => {
|
|
974
982
|
const { promptedAppName: t, stylingFramework: n, appType: r } = await j([
|
|
975
983
|
{
|
|
976
984
|
type: "text",
|
|
@@ -1002,15 +1010,15 @@ m.command("create [appName]", "create a new marketplace app").action(async (e) =
|
|
|
1002
1010
|
(!t || !n || !r) && W(0), le(t, n, r);
|
|
1003
1011
|
});
|
|
1004
1012
|
for (const e of ["block", "theme"])
|
|
1005
|
-
|
|
1013
|
+
f.command(
|
|
1006
1014
|
`${e} create [appName]`,
|
|
1007
1015
|
`[deprecated: use 'create' instead] create a ${e} app locally`
|
|
1008
1016
|
).action((t) => le(t, "css-modules", "content-block"));
|
|
1009
|
-
|
|
1010
|
-
|
|
1017
|
+
f.help();
|
|
1018
|
+
f.version(F.version);
|
|
1011
1019
|
const Et = (e) => {
|
|
1012
1020
|
const t = e.findIndex((n) => n === "block" || n === "theme");
|
|
1013
1021
|
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;
|
|
1014
1022
|
};
|
|
1015
|
-
|
|
1023
|
+
f.parse(Et(process.argv));
|
|
1016
1024
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../src/utils/date.ts","../src/utils/logger.ts","../src/errors/FileNotFoundError.ts","../src/errors/ParseJsonError.ts","../src/utils/reactiveJson.ts","../src/utils/appBridgeVersion.ts","../src/utils/configuration.ts","../src/utils/file.ts","../src/errors/HttpClientError.ts","../src/utils/httpClient.ts","../src/utils/npm.ts","../src/errors/CommandExecutionError.ts","../src/utils/promiseExec.ts","../src/errors/InvalidInstanceUrlError.ts","../src/utils/url.ts","../src/utils/user.ts","../src/utils/gitignoreTemplate.ts","../src/utils/compiler/compilePlatformApp.ts","../src/utils/compiler/compileBlock.ts","../src/utils/appBridgeThemeVersion.ts","../src/utils/compiler/compileTheme.ts","../src/utils/verifyManifest.ts","../src/commands/deploy.ts","../src/commands/login.ts","../src/commands/logout.ts","../src/servers/blockDevelopmentServer.ts","../src/servers/platformAppDevelopmentServer.ts","../src/servers/themeDevelopmentServer.ts","../src/commands/serve.ts","../src/commands/create.ts","../src/index.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nexport const getCurrentTime = (): string => {\n const now = new Date();\n return `${String(now.getHours()).padStart(2, '0')}:${String(now.getMinutes()).padStart(2, '0')}:${String(\n now.getSeconds(),\n ).padStart(2, '0')}`;\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport pc from 'picocolors';\n\nimport { getCurrentTime } from './date';\n\nexport class Logger {\n static defaultInfo(...messages: string[]): void {\n console.log(Logger.spacer(10), ...messages);\n }\n\n static info(...messages: string[]): void {\n console.log(`[${getCurrentTime()}] ${messages.join(' ')}`);\n }\n\n static success(...messages: string[]): void {\n console.log(`[${getCurrentTime()}] ${pc.green(messages.join(' '))}`);\n }\n\n static error(...messages: string[]): void {\n console.error(pc.red(`[${getCurrentTime()}] ${messages.join(' ')}`));\n }\n\n static spacer(width = 1): string {\n return Array(width + 1).join(' ');\n }\n}\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { Logger } from '../utils/logger';\n\nexport default class FileNotFoundError extends Error {\n readonly name = 'FileNotFoundError';\n constructor(path: string) {\n super();\n Logger.error(`The file at \"${path}\" was not found.`);\n }\n}\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { Logger } from '../utils/logger';\n\nexport default class ParseJsonError extends Error {\n readonly name = 'ParseJsonError';\n constructor(path: string) {\n super();\n Logger.error(`The file at \"${path}\" could not be parsed.`);\n }\n}\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { readFileSync, writeFileSync } from 'node:fs';\n\nimport FileNotFoundError from '../errors/FileNotFoundError';\nimport ParseJsonError from '../errors/ParseJsonError';\n\nexport const reactiveJson = <T>(path: string): T => {\n try {\n const jsonRaw = readFileSync(path, 'utf8');\n const jsonParsed = JSON.parse(jsonRaw);\n\n return new Proxy(jsonParsed, {\n set: (obj, prop, value) => {\n obj[prop] = value;\n\n const jsonString = JSON.stringify(obj, null, '\\t');\n\n writeFileSync(path, jsonString);\n\n return true;\n },\n });\n } catch (error) {\n if (error instanceof SyntaxError) {\n throw new ParseJsonError(path);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } else if ((error as any).code === 'ENOENT') {\n throw new FileNotFoundError(path);\n }\n\n throw new Error(error as string);\n }\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { join } from 'node:path';\n\nimport { type PackageJson } from './npm';\nimport { reactiveJson } from './reactiveJson';\n\nexport const getAppBridgeVersion = (rootPath: string) => {\n const packageJson = reactiveJson<PackageJson>(join(rootPath, 'package.json'));\n return packageJson.dependencies['@frontify/app-bridge'];\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport Conf from 'conf';\n\nexport class Configuration {\n private static readonly conf = new Conf<Record<string, string | undefined>>({\n projectName: 'frontify-cli',\n });\n\n static set(key: string, value: unknown): void {\n this.conf.set(key, value);\n }\n\n static get(key: string): string | undefined {\n return this.conf.get(key, undefined);\n }\n\n static delete(key: string): void {\n return this.conf.delete(key);\n }\n}\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { copyFileSync, mkdirSync, readFileSync, readdirSync, statSync } from 'node:fs';\nimport { resolve } from 'node:path';\n\nimport globToRegExp from 'glob-to-regexp';\n\nimport FileNotFoundError from '../errors/FileNotFoundError';\n\nexport const isDirectoryEmpty = (folderPath: string): boolean => {\n try {\n return readdirSync(folderPath).length === 0;\n } catch {\n return true;\n }\n};\n\nexport const copyFolder = (\n sourceFolderPath: string,\n destinationFolderPath: string,\n options?: { exclude: string[] },\n) => {\n mkdirSync(destinationFolderPath, { recursive: true });\n const excludePatterns = options?.exclude.map((glob) => globToRegExp(glob));\n\n for (const file of readdirSync(sourceFolderPath)) {\n if (excludePatterns !== undefined && excludePatterns.some((re) => re.test(file))) {\n continue;\n }\n const srcFile = resolve(sourceFolderPath, file);\n const destFile = resolve(destinationFolderPath, file);\n copyFile(srcFile, destFile);\n }\n};\n\nexport const copyFile = (sourceFilePath: string, destinationFilePath: string) => {\n const stat = statSync(sourceFilePath);\n if (stat.isDirectory()) {\n copyFolder(sourceFilePath, destinationFilePath);\n } else {\n copyFileSync(sourceFilePath, destinationFilePath);\n }\n};\n\nexport const readFile = (filePath: string): string => {\n try {\n return readFileSync(filePath, 'utf-8');\n } catch {\n throw new FileNotFoundError(filePath);\n }\n};\n\nexport const readFileAsBase64 = (filePath: string): string => {\n try {\n return readFileSync(filePath, 'base64');\n } catch {\n throw new FileNotFoundError(filePath);\n }\n};\n\nexport const readFileLinesAsArray = (filePath: string): string[] => {\n try {\n const content = readFile(filePath);\n return content.split(/\\r?\\n/).filter((line) => line !== '');\n } catch {\n throw new FileNotFoundError(filePath);\n }\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nexport class HttpClientError extends Error {\n public code = 0;\n public responseBody: { sucess: false; error: string };\n\n constructor(code: number, responseBody: { sucess: false; error: string }) {\n super(`Status code ${code}`);\n this.name = 'HttpClientError';\n this.code = code;\n this.responseBody = responseBody;\n }\n}\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport fetch from 'node-fetch';\n\nimport { HttpClientError } from '../errors/HttpClientError';\n\ninterface RequestOptions {\n headers?: {\n Authorization?: string;\n };\n}\n\ninterface FetchParameters {\n method: 'GET' | 'POST' | 'PUT' | 'DELETE';\n url: string;\n body?: Record<string, unknown>;\n options?: RequestOptions;\n}\n\nexport class HttpClient {\n private readonly baseUrl: string;\n\n constructor(baseUrl: string) {\n this.baseUrl = baseUrl.replace(/^https?:\\/\\//, '');\n }\n\n private async fetchExtended<T>({ method, url, body, options }: FetchParameters): Promise<T> {\n const response = await fetch(this.getAbsoluteUrl(url), {\n method,\n ...(body && {\n body: JSON.stringify(body),\n }),\n ...options,\n headers: { 'Content-Type': 'application/json', ...options?.headers },\n });\n\n if (response.status === 200) {\n const contentType = response.headers.get('Content-Type');\n\n switch (contentType) {\n case 'application/json': {\n const responseJson = await response.json();\n if (!responseJson) {\n return undefined as T;\n }\n return responseJson as T;\n }\n default: {\n const responseText = await response.text();\n if (!responseText) {\n return undefined as T;\n }\n return responseText as T;\n }\n }\n } else {\n const errorData = (await response.json()) as { sucess: false; error: string };\n throw new HttpClientError(response.status, errorData);\n }\n }\n\n public get<T>(url: string, options?: RequestOptions): Promise<T> {\n return this.fetchExtended<T>({ url, method: 'GET', options });\n }\n\n public post<T>(url: string, body?: Record<string, unknown>, options?: RequestOptions): Promise<T> {\n return this.fetchExtended({ url, method: 'POST', body, options });\n }\n\n public put<T>(url: string, body?: Record<string, unknown>, options?: RequestOptions): Promise<T> {\n return this.fetchExtended({ url, method: 'PUT', body, options });\n }\n\n public delete<T>(url: string, options?: RequestOptions): Promise<T> {\n return this.fetchExtended({ url, method: 'DELETE', options });\n }\n\n private getAbsoluteUrl(relativeUrl: string): string {\n return `https://${this.baseUrl}${relativeUrl}`;\n }\n}\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { resolve } from 'node:path';\n\nimport { isDirectoryEmpty } from './file';\nimport { reactiveJson } from './reactiveJson';\n\nexport type PackageJson = {\n name: string;\n version: string;\n main: string;\n dependencies: Record<string, string>;\n};\n\nexport const updatePackageJsonProjectName = (folderPath: string): void => {\n const packageJsonPath = resolve(folderPath, 'package.json');\n const packageJson = reactiveJson<PackageJson>(packageJsonPath);\n packageJson.name = folderPath;\n};\n\nexport const isValidName = (folderName: string): true | string => {\n if (!folderName) {\n return 'The content block name can not be empty.';\n } else if (!/^[_a-z-]+$/.test(folderName)) {\n return 'The project name needs to be \"a-z\" separated by \"-\" or \"_\".';\n } else if (!isDirectoryEmpty(folderName)) {\n return `The directory ./${folderName} already exist.`;\n } else {\n return true;\n }\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { Logger } from '../utils/logger';\n\nexport default class CommandExecutionError extends Error {\n readonly name = 'CommandExecutionError';\n constructor(error: string) {\n super();\n Logger.error(`The command execution failed: ${error}`);\n }\n}\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type ExecOptions, exec } from 'node:child_process';\n\nimport CommandExecutionError from '../errors/CommandExecutionError';\n\nexport const promiseExec = (command: string, options: ExecOptions = {}): Promise<string> => {\n return new Promise((resolve, reject) => {\n exec(command, options, (error, stdout) => {\n if (error) {\n // @ts-expect-error node typing change\n // eslint-disable-next-line @typescript-eslint/restrict-plus-operands\n return reject(new CommandExecutionError(error + stdout));\n } else {\n // @ts-expect-error node typing change\n return resolve(stdout);\n }\n });\n });\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { Logger } from '../utils/logger';\n\nexport default class InvalidInstanceUrlError extends Error {\n readonly name = 'InvalidInstanceUrlError';\n constructor(url: string) {\n super();\n if (url) {\n Logger.error(`The given URL \"${url}\" is invalid.`);\n } else {\n Logger.error('No instance URL was given.');\n }\n }\n}\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { URL } from 'node:url';\n\nimport InvalidInstanceUrlError from '../errors/InvalidInstanceUrlError';\n\nexport const getValidInstanceUrl = (url: string): string => {\n try {\n const cleanHost = url.replace(/^https?:\\/\\//, '');\n const parsedUrl = new URL(`https://${cleanHost}`);\n return parsedUrl.hostname;\n } catch {\n throw new InvalidInstanceUrlError(url);\n }\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport pc from 'picocolors';\n\nimport { Configuration } from './configuration';\nimport { HttpClient } from './httpClient';\nimport { Logger } from './logger';\n\nexport interface UserInfo {\n name: string;\n email: string;\n}\n\nexport const getUser = async (instanceUrl: string, token?: string): Promise<UserInfo | undefined> => {\n const httpClient = new HttpClient(instanceUrl);\n const accessToken = token || Configuration.get('tokens.access_token');\n\n try {\n const user = await httpClient.post<{ data: { currentUser: UserInfo } }>(\n '/graphql',\n { query: '{ currentUser { email name } }' },\n { headers: { Authorization: `Bearer ${accessToken}` } },\n );\n return user.data.currentUser;\n } catch {\n Logger.error(\n `You are currently not logged in. You can use the command ${pc.bold('frontify-cli login')} to log in.`,\n );\n return undefined;\n }\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { writeFileSync } from 'node:fs';\nimport { join } from 'node:path';\n\nexport const generateGitignoreFile = (destinationFolderPath: string, type: string): void => {\n const gitignorePath = join(destinationFolderPath, '.gitignore');\n writeFileSync(gitignorePath, gitignoreTemplate[type]);\n};\n\nconst gitignoreTemplate = {\n '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`,\n 'content-block': `node_modules\ndist\n.idea\n.vscode\n`,\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport react from '@vitejs/plugin-react';\nimport { build } from 'vite';\nimport { viteExternalsPlugin } from 'vite-plugin-externals';\n\nimport { getAppBridgeVersion } from '../appBridgeVersion';\n\nimport { type CompilerOptions } from './compilerOptions';\n\nexport const compilePlatformApp = async ({ outputName, entryFile, projectPath = '' }: CompilerOptions) => {\n const appBridgeVersion = getAppBridgeVersion(projectPath);\n\n const settings = await build({\n plugins: [\n react(),\n viteExternalsPlugin({\n react: 'React',\n 'react-dom': 'ReactDOM',\n }),\n ],\n root: projectPath,\n define: {\n 'process.env.NODE_ENV': JSON.stringify('production'),\n },\n build: {\n lib: {\n entry: entryFile,\n name: outputName,\n formats: ['iife'],\n fileName: () => 'index.js',\n },\n rollupOptions: {\n external: ['react', 'react-dom'],\n output: {\n globals: {\n react: 'React',\n 'react-dom': 'ReactDOM',\n },\n entryFileNames: 'settings.js',\n footer: `\n window.${outputName} = ${outputName};\n window.${outputName}.dependencies = window.${outputName}.packages || {};\n window.${outputName}.dependencies['@frontify/app-bridge'] = '${appBridgeVersion}';\n `,\n },\n },\n },\n });\n\n const app = await build({\n plugins: [react()],\n root: projectPath,\n define: {\n 'process.env.NODE_ENV': JSON.stringify('production'),\n },\n base: '/__DYNAMIC_SEGMENT__/',\n build: {\n emptyOutDir: false,\n },\n });\n return { app, settings };\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport react from '@vitejs/plugin-react';\nimport { build } from 'vite';\nimport { viteExternalsPlugin } from 'vite-plugin-externals';\n\nimport { getAppBridgeVersion } from '../appBridgeVersion';\n\nimport { type CompilerOptions } from './compilerOptions';\n\nexport const compileBlock = async ({ projectPath, entryFile, outputName }: CompilerOptions) => {\n const appBridgeVersion = getAppBridgeVersion(projectPath);\n return build({\n plugins: [\n react(),\n viteExternalsPlugin({\n react: 'React',\n 'react-dom': 'ReactDOM',\n }),\n ],\n define: {\n 'process.env.NODE_ENV': JSON.stringify('production'),\n },\n root: projectPath,\n build: {\n lib: {\n name: outputName,\n entry: entryFile,\n formats: ['iife'],\n fileName: () => 'index.js',\n },\n rollupOptions: {\n external: ['react', 'react-dom'],\n output: {\n globals: {\n react: 'React',\n 'react-dom': 'ReactDOM',\n },\n footer: `\n window.${outputName} = ${outputName};\n window.${outputName}.dependencies = window.${outputName}.packages || {};\n window.${outputName}.dependencies['@frontify/app-bridge'] = '${appBridgeVersion}';\n `,\n },\n },\n },\n });\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { join } from 'node:path';\n\nimport { type PackageJson } from './npm';\nimport { reactiveJson } from './reactiveJson';\n\nexport const getAppBridgeThemeVersion = (rootPath: string) => {\n const packageJson = reactiveJson<PackageJson>(join(rootPath, 'package.json'));\n return packageJson.dependencies['@frontify/app-bridge-theme'];\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport react from '@vitejs/plugin-react';\nimport { build } from 'vite';\nimport { viteExternalsPlugin } from 'vite-plugin-externals';\n\nimport { getAppBridgeThemeVersion } from '../appBridgeThemeVersion';\n\nimport { type CompilerOptions } from './compilerOptions';\n\nexport const compileTheme = async ({ projectPath, entryFile, outputName }: CompilerOptions) => {\n const appBridgeVersion = getAppBridgeThemeVersion(projectPath);\n return build({\n plugins: [\n react(),\n viteExternalsPlugin({\n react: 'React',\n 'react-dom': 'ReactDOM',\n }),\n ],\n define: {\n 'process.env.NODE_ENV': JSON.stringify('production'),\n },\n root: projectPath,\n build: {\n lib: {\n name: outputName,\n entry: entryFile,\n formats: ['iife'],\n fileName: () => 'index.js',\n },\n rollupOptions: {\n external: ['react', 'react-dom'],\n output: {\n globals: {\n react: 'React',\n 'react-dom': 'ReactDOM',\n },\n footer: `\n window.${outputName} = ${outputName};\n window.${outputName}.dependencies = window.${outputName}.packages || {};\n window.${outputName}.dependencies['@frontify/app-bridge-theme'] = '${appBridgeVersion}';\n `,\n },\n },\n },\n });\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { array, boolean, number, object, string, z } from 'zod';\n\nconst forbiddenExtensions = ['exe', 'dmg', 'cmd', 'sh', 'bat'];\nconst getForbiddenExtensionsErrorMessage = (surfaceName: string) =>\n `Invalid file extension, \\`${surfaceName}.filenameExtension\\` can not include: ${forbiddenExtensions.join(', ')}.`;\n\nconst assetCreationShape = object({\n title: string().min(1).max(40),\n}).optional();\n\nconst completeAssetType = z.enum(['audio', 'document', 'image', 'video', 'file', 'embeddedContent']);\nconst imageAssetType = completeAssetType.exclude(['audio', 'document', 'video', 'file', 'embeddedContent']);\n\nconst iconLibraryFilenameExtension = z.enum(['svg']);\nconst logoLibraryFilenameExtension = z.enum(['svg', 'jpg', 'jpeg', 'ai', 'eps', 'png', 'tif', 'tiff']);\n\nconst appType = z.enum(['content-block', 'platform-app', 'theme']);\n\nconst secretKeySet = new Set();\nexport function resetSecretKeySet() {\n secretKeySet.clear();\n}\n\nconst secretSchema = object({\n label: string(),\n key: string()\n .min(1)\n .max(80)\n .refine(\n (key) => {\n if (secretKeySet.has(key)) {\n return false;\n }\n\n secretKeySet.add(key);\n return /^\\w+$/.test(key);\n },\n {\n message:\n \"Secret Key must be unique and should only contain letters from a-z, A-Z, numbers from 0-9 and '_' without any spaces\",\n },\n ),\n});\nconst secretsArraySchema = array(secretSchema);\n\nconst requestOptionsSchema = object({\n method: z.enum(['GET', 'POST', 'PUT', 'DELETE']),\n headers: z.record(string()).optional(),\n body: z.any().optional(),\n});\n\nconst endpointNameSet = new Set();\nexport function resetEndpointNameSet() {\n endpointNameSet.clear();\n}\nconst endpointCallSchema = object({\n name: string().refine(\n (name) => {\n if (endpointNameSet.has(name)) {\n return false;\n }\n\n endpointNameSet.add(name);\n return /^[\\w-]*$/.test(name);\n },\n {\n message: 'Endpoint name must be unique',\n },\n ),\n resource: string(),\n options: requestOptionsSchema,\n});\n\nconst hostnameRegex =\n /^(([\\dA-Za-z]|[\\dA-Za-z][\\dA-Za-z-]*[\\dA-Za-z])\\.)*([\\dA-Za-z]|[\\dA-Za-z][\\dA-Za-z-]*[\\dA-Za-z])$/;\n\nconst ScopeEnum = z.enum(['basic:read', 'basic:write', 'account:read', 'webhook:read', 'webhook:write']);\n\nconst permissionsSchema = object({\n permissions: object({\n scopes: array(ScopeEnum)\n .min(1, 'At least one scope is required')\n .max(5, 'No more than 5 scopes are allowed')\n .refine((scopes) => scopes.includes('basic:read'), {\n message: \"'basic:read' is required in scopes\",\n }),\n }).optional(),\n}).optional();\n\nconst KeyTypeLabelSchema = object({\n key: string(),\n type: string(),\n label: string(),\n});\n\nconst ActionSchema = object({\n id: string(),\n title: string(),\n iconUrl: string(),\n returns: array(KeyTypeLabelSchema),\n version: number().int().positive(),\n externalId: string(),\n parameters: array(KeyTypeLabelSchema),\n});\n\nconst ActionsArraySchema = array(ActionSchema).optional();\n\nexport const platformAppManifestSchemaV1 = object({\n appId: string().length(25),\n appType,\n experimental: boolean().optional(),\n secrets: secretsArraySchema.optional(),\n network: object({\n allowedHosts: array(\n string().refine((value) => hostnameRegex.test(value), {\n message: 'Invalid host format',\n }),\n ).optional(),\n endpoints: array(endpointCallSchema).optional(),\n }).optional(),\n permissionsSchema,\n automation: object({\n actions: ActionsArraySchema,\n }).optional(),\n surfaces: object({\n guideline: object({\n themeAction: object({\n title: string().min(2).max(28),\n }).optional(),\n assetViewer: object({\n title: string().min(2).max(28),\n type: array(completeAssetType),\n filenameExtension: array(\n string().refine((value) => !forbiddenExtensions.includes(value), {\n message: getForbiddenExtensionsErrorMessage('guideline'),\n }),\n ),\n }).optional(),\n }).optional(),\n mediaLibrary: object({\n assetBulkActions: object({\n title: string().min(2).max(28),\n filenameExtensions: array(\n string().refine((value) => !forbiddenExtensions.includes(value), {\n message: getForbiddenExtensionsErrorMessage('mediaLibrary'),\n }),\n ),\n }).optional(),\n assetAction: object({\n title: string().min(2).max(28),\n type: array(completeAssetType),\n filenameExtension: array(\n string().refine((value) => !forbiddenExtensions.includes(value), {\n message: getForbiddenExtensionsErrorMessage('mediaLibrary'),\n }),\n ),\n }).optional(),\n assetCreation: assetCreationShape,\n }).optional(),\n iconLibrary: object({\n assetBulkActions: object({\n title: string().min(2).max(28),\n filenameExtensions: array(iconLibraryFilenameExtension),\n }).optional(),\n assetAction: object({\n title: string().min(2).max(28),\n type: array(imageAssetType),\n filenameExtension: array(iconLibraryFilenameExtension),\n }).optional(),\n assetCreation: assetCreationShape,\n }).optional(),\n logoLibrary: object({\n assetBulkActions: object({\n title: string().min(2).max(28),\n filenameExtensions: array(logoLibraryFilenameExtension),\n }).optional(),\n assetAction: object({\n title: string().min(2).max(28),\n type: array(imageAssetType),\n filenameExtension: array(logoLibraryFilenameExtension),\n }).optional(),\n assetCreation: assetCreationShape,\n }).optional(),\n documentLibrary: object({\n assetBulkActions: object({\n title: string().min(2).max(28),\n filenameExtensions: array(\n string().refine((value) => !forbiddenExtensions.includes(value), {\n message: getForbiddenExtensionsErrorMessage('documentLibrary'),\n }),\n ),\n }).optional(),\n assetAction: object({\n title: string().min(2).max(28),\n type: array(completeAssetType),\n filenameExtension: array(\n string().refine((value) => !forbiddenExtensions.includes(value), {\n message: getForbiddenExtensionsErrorMessage('documentLibrary'),\n }),\n ),\n }).optional(),\n assetCreation: assetCreationShape,\n }).optional(),\n workspace: object({\n assetBulkActions: object({\n title: string().min(2).max(28),\n filenameExtensions: array(\n string().refine((value) => !forbiddenExtensions.includes(value), {\n message: getForbiddenExtensionsErrorMessage('workspaceProject'),\n }),\n ),\n }).optional(),\n assetAction: object({\n title: string().min(2).max(28),\n type: array(completeAssetType),\n filenameExtension: array(\n string().refine((value) => !forbiddenExtensions.includes(value), {\n message: getForbiddenExtensionsErrorMessage('workspaceProject'),\n }),\n ),\n }).optional(),\n assetCreation: assetCreationShape,\n }).optional(),\n }).optional(),\n metadata: object({\n version: number().int(),\n }),\n});\n\nexport const verifyManifest = (manifest: unknown, schema: typeof platformAppManifestSchemaV1) => {\n const validatedManifest = schema.safeParse(manifest);\n\n if (!validatedManifest.success) {\n throw new Error(validatedManifest.error.message);\n }\n\n return validatedManifest.data;\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { join } from 'node:path';\n\nimport fastGlob from 'fast-glob';\nimport open from 'open';\nimport pc from 'picocolors';\n\nimport { type HttpClientError } from '../errors/HttpClientError';\nimport {\n type CompilerOptions,\n Configuration,\n HttpClient,\n Logger,\n type UserInfo,\n getUser,\n promiseExec,\n reactiveJson,\n readFileAsBase64,\n readFileLinesAsArray,\n} from '../utils/index';\nimport { platformAppManifestSchemaV1, verifyManifest } from '../utils/verifyManifest';\n\ntype Options = {\n dryRun?: boolean;\n noVerify?: boolean;\n openInBrowser?: boolean;\n token?: string;\n instance?: string;\n};\n\nexport type AppManifest = {\n appId: string;\n appType?: string;\n metadata?: {\n version?: number;\n };\n experimental?: boolean;\n};\n\nconst makeFilesDict = async (glob: string, ignoreGlobs?: string[]) => {\n const folderFiles = await fastGlob(`${fastGlob.convertPathToPattern(glob)}/**`, { ignore: ignoreGlobs, dot: true });\n const folderFilenames = folderFiles.map((filePath) => filePath.replace(`${glob}/`, ''));\n\n return folderFilenames.reduce((stack, filename, index) => {\n stack[`/${filename}`] = readFileAsBase64(folderFiles[index]);\n return stack;\n }, {});\n};\n\nconst BUILD_FILE_BLOCK_LIST = ['**/*.*.map'];\nconst SOURCE_FILE_BLOCK_LIST = ['.git', 'node_modules', 'dist', '.vscode', '.idea', 'README.md', '.DS_Store'];\n\nexport const createDeployment = async (\n entryFile: string,\n distPath: string,\n { dryRun = false, noVerify = false, openInBrowser = false, token, instance }: Options,\n compile: ({ projectPath, entryFile, outputName }: CompilerOptions) => Promise<unknown>,\n): Promise<void> => {\n try {\n let user: UserInfo | undefined;\n const instanceUrl = instance || Configuration.get('instanceUrl');\n const accessToken = token || Configuration.get('tokens.access_token');\n\n if (!accessToken || !instanceUrl) {\n Logger.error(\n `You are currently not logged in. You can use the command ${pc.bold(\n 'frontify-cli login',\n )} to log in, or pass --token=<token> --instance=<instance> to the deploy command.`,\n );\n process.exit(-1);\n }\n\n if (!dryRun) {\n user = await getUser(instanceUrl, token);\n if (user) {\n Logger.info(`You are logged in as ${user.name} (${instanceUrl}).`);\n }\n }\n\n if (user || dryRun) {\n if (dryRun) {\n Logger.info(pc.blue('Dry run: enabled'));\n }\n\n const projectPath = process.cwd();\n const manifestContent = reactiveJson<AppManifest>(join(projectPath, 'manifest.json'));\n const { appId } =\n manifestContent.appType === 'platform-app'\n ? verifyManifest(manifestContent, platformAppManifestSchemaV1)\n : manifestContent;\n\n if (!noVerify) {\n Logger.info('Performing type checks...');\n await promiseExec('npx tsc --noEmit');\n\n Logger.info('Performing eslint checks...');\n await promiseExec('npx eslint src');\n }\n\n try {\n await compile({ projectPath, entryFile, outputName: appId });\n } catch (error) {\n Logger.error(error as string);\n process.exit(-1);\n }\n\n const buildFilesToIgnore = BUILD_FILE_BLOCK_LIST.map((path) =>\n fastGlob.convertPathToPattern(projectPath + path),\n );\n\n const gitignoreEntries = readFileLinesAsArray(join(projectPath, '.gitignore')).filter(\n (entry) => entry !== 'manifest.json',\n );\n const sourceFilesToIgnore = [...gitignoreEntries, ...SOURCE_FILE_BLOCK_LIST].map((path) =>\n fastGlob.convertPathToPattern(`${projectPath}/${path}`),\n );\n\n const request = {\n build_files: await makeFilesDict(\n fastGlob.convertPathToPattern(`${projectPath}/${distPath}`),\n buildFilesToIgnore,\n ),\n source_files: await makeFilesDict(fastGlob.convertPathToPattern(projectPath), sourceFilesToIgnore),\n };\n\n if (!dryRun) {\n Logger.info('Sending the files to Frontify Marketplace...');\n\n const httpClient = new HttpClient(instanceUrl);\n\n try {\n await httpClient.put(`/api/marketplace/app/${appId}`, request, {\n headers: { Authorization: `Bearer ${accessToken}` },\n });\n\n Logger.success('The new version has been pushed.');\n\n if (openInBrowser) {\n Logger.info('Opening the Frontify Marketplace page...');\n await open(`https://${instanceUrl}/marketplace/apps/${appId}`);\n }\n } catch (error) {\n Logger.error('An error occured while deploying:', (error as HttpClientError).responseBody.error);\n process.exit(-1);\n }\n } else {\n Logger.success('The command has been executed without any issue.');\n process.exit(0);\n }\n }\n } catch (error) {\n if (typeof error === 'string') {\n Logger.error('The deployment has failed and was aborted due to an error:', error);\n } else if (error instanceof Error) {\n Logger.error('The deployment has failed and was aborted due to an error:', error.message);\n } else {\n Logger.error('The deployment has failed and was aborted due to an unknown error.');\n }\n process.exit(-1);\n }\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport FastifyCors from '@fastify/cors';\nimport Fastify from 'fastify';\nimport open from 'open';\n\nimport { Configuration, HttpClient, Logger, getUser, getValidInstanceUrl } from '../utils/index';\n\nexport interface OauthRandomCodeChallenge {\n secret: string;\n sha256: string;\n}\n\nexport interface OauthAccessTokenApiResponse {\n access_token: string;\n refresh_token: string;\n expires_in: number;\n token_type: string;\n}\n\nexport class Authenticator {\n private readonly instanceUrl: string;\n private readonly port: number;\n\n private readonly httpClient: HttpClient;\n private readonly fastifyServer = Fastify();\n\n private randomChallenge: OauthRandomCodeChallenge | undefined;\n\n constructor(instanceUrl: string, port = 5600) {\n this.instanceUrl = instanceUrl;\n this.port = port;\n\n this.httpClient = new HttpClient(instanceUrl);\n }\n\n serveCallbackServer(): void {\n this.registerPlugins();\n this.registerRoutes();\n\n this.fastifyServer.listen({ port: this.port });\n }\n\n private registerRoutes(): void {\n this.fastifyServer.get<{ Querystring: { code: string } }>('/oauth', async (req, res) => {\n Logger.info('Access granted, getting access token...');\n res.send('You can close this window.');\n\n const tokens = await this.getOauthCredentialDetails(req.query.code);\n Logger.info('Tokens received, storing tokens...');\n Configuration.set('tokens', tokens);\n Configuration.set('instanceUrl', this.instanceUrl);\n\n const user = await getUser(this.instanceUrl);\n if (user) {\n Logger.success(`Welcome back ${user.name} (${this.instanceUrl})!`);\n }\n\n process.exit(0);\n });\n }\n\n private registerPlugins(): void {\n this.fastifyServer.register(FastifyCors);\n }\n\n async storeRandomCodeChallenge(): Promise<void> {\n try {\n const randomCodeChallenge = await this.httpClient.get<{ data: OauthRandomCodeChallenge }>(\n '/api/oauth/random',\n );\n this.randomChallenge = randomCodeChallenge.data;\n } catch (error) {\n const errorText = error instanceof Error ? error.message : String(error);\n throw new Error(`An error occurred while getting the random challenge: ${errorText}`);\n }\n }\n\n getLoginUrl(): string {\n if (!this.randomChallenge) {\n throw new Error('Random challenge needs to be defined.');\n }\n\n const queryParams = [\n 'response_type=code',\n 'client_id=block-cli',\n 'redirect_uri=http://localhost:5600/oauth',\n 'scope=basic:read%2Bblocks:read%2Bblocks:write',\n `code_challenge=${this.randomChallenge.sha256}`,\n 'code_challenge_method=S256',\n ].join('&');\n\n return `https://${this.instanceUrl}/api/oauth/authorize?${queryParams}`;\n }\n\n async getOauthCredentialDetails(authorizationCode: string): Promise<OauthAccessTokenApiResponse> {\n if (!this.randomChallenge) {\n throw new Error('Random challenge needs to be defined.');\n }\n\n try {\n const tokens = await this.httpClient.post<OauthAccessTokenApiResponse>('/api/oauth/accesstoken', {\n grant_type: 'authorization_code',\n client_id: 'block-cli',\n redirect_uri: 'http://localhost:5600/oauth',\n scope: 'basic:read%2Bblocks:read%2Bblocks:write',\n code_verifier: this.randomChallenge.secret,\n code: authorizationCode,\n });\n\n return tokens;\n } catch (error) {\n const errorText = error instanceof Error ? error.message : String(error);\n throw new Error(`An error occurred while getting tokens: ${errorText}`);\n }\n }\n}\n\nexport const loginUser = async (instanceUrl: string, port: number): Promise<void> => {\n try {\n const cleanedInstanceUrl = getValidInstanceUrl(instanceUrl);\n const authenticator = new Authenticator(cleanedInstanceUrl, port);\n authenticator.serveCallbackServer();\n await authenticator.storeRandomCodeChallenge();\n\n const loginUrl = authenticator.getLoginUrl();\n\n Logger.info('Attempting to open OAuth login page...');\n Logger.info(\n `If a browser window doesn't automatically open, please open the following link manually: ${loginUrl}`,\n );\n await open(loginUrl);\n } catch (error) {\n const errorText = error instanceof Error ? error.message : String(error);\n Logger.error(`You need to enter a valid Frontify instance URL: ${errorText}`);\n process.exit(-1);\n }\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { Configuration } from '../utils/configuration';\nimport { Logger } from '../utils/logger';\n\nexport const logoutUser = (): void => {\n Configuration.delete('tokens');\n // TODO: Call API endpoint\n Logger.info('You are now logged out.');\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport react from '@vitejs/plugin-react';\nimport { createServer } from 'vite';\nimport { viteExternalsPlugin } from 'vite-plugin-externals';\n\nimport pkg from '../../package.json';\nimport { getAppBridgeVersion } from '../utils/appBridgeVersion';\n\nexport class BlockDevelopmentServer {\n constructor(\n private readonly entryFilePath: string,\n private readonly port: number,\n private readonly allowExternal: boolean,\n ) {}\n\n async serve(): Promise<void> {\n try {\n const viteServer = await createServer({\n root: process.cwd(),\n plugins: [\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n react(),\n viteExternalsPlugin({\n react: 'React',\n 'react-dom': 'ReactDOM',\n }),\n ],\n define: {\n 'process.env.NODE_ENV': JSON.stringify('development'),\n 'DevCustomBlock.dependencies.appBridge': JSON.stringify(getAppBridgeVersion(process.cwd())),\n },\n base: `http://localhost:${this.port}/`,\n appType: 'custom',\n server: {\n port: this.port,\n host: this.allowExternal ? '0.0.0.0' : 'localhost',\n cors: true,\n hmr: {\n port: this.port,\n host: this.allowExternal ? '0.0.0.0' : 'localhost',\n protocol: 'ws',\n },\n },\n });\n\n viteServer.middlewares.use('/', (req, res, next) => {\n if (req.url !== '/') {\n return next();\n }\n\n res.writeHead(200);\n return res.end('OK');\n });\n\n viteServer.middlewares.use('/_entrypoint', (req, res, next) => {\n if (req.url !== '/') {\n return next();\n }\n\n res.setHeader('Content-Type', 'application/json');\n res.writeHead(200);\n return res.end(\n JSON.stringify({\n url: `http://localhost:${this.port}/${this.entryFilePath}`,\n entryFilePath: this.entryFilePath,\n port: this.port,\n version: pkg.version,\n }),\n );\n });\n\n const server = await viteServer.listen(this.port, true);\n server.printUrls();\n } catch (error) {\n console.error(error);\n process.exit(1);\n }\n }\n}\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport path from 'node:path';\n\nimport react from '@vitejs/plugin-react';\nimport * as esbuild from 'esbuild';\nimport { createServer } from 'vite';\n\nexport class PlatformAppDevelopmentServer {\n constructor(\n private readonly entryFilePath: string,\n private readonly port: number,\n ) {}\n\n async serve(): Promise<void> {\n try {\n const settingsSchema = await esbuild.context({\n entryPoints: [this.entryFilePath],\n outfile: './dist/dev-settings.js',\n minify: true,\n globalName: 'devSettings',\n format: 'iife',\n bundle: true,\n loader: {\n '.css': 'empty',\n },\n });\n\n const viteServerDev = await createServer({\n root: process.cwd(),\n configFile: false,\n define: {\n 'process.env.NODE_ENV': JSON.stringify('development'),\n },\n server: { cors: true },\n plugins: [\n react(),\n {\n name: 'prebuild-commands',\n handleHotUpdate: ({ file, server }) => {\n const relativeFilePath = path.relative(process.cwd(), file);\n\n if (relativeFilePath === 'src/settings.ts' || relativeFilePath === 'src/index.ts') {\n // if the change is either in settings.ts or index.ts do a rebuild to load settings\n settingsSchema.rebuild();\n server.restart();\n }\n },\n buildStart: () => {\n settingsSchema.rebuild();\n },\n },\n ],\n });\n\n const server = await viteServerDev.listen(this.port, true);\n server.printUrls();\n } catch (error) {\n console.error(error);\n process.exit(1);\n }\n }\n}\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport react from '@vitejs/plugin-react';\nimport { createServer } from 'vite';\nimport { viteExternalsPlugin } from 'vite-plugin-externals';\n\nimport pkg from '../../package.json';\nimport { getAppBridgeThemeVersion } from '../utils/appBridgeThemeVersion';\n\nexport class ThemeDevelopmentServer {\n constructor(\n private readonly entryFilePath: string,\n private readonly port: number,\n private readonly allowExternal: boolean,\n ) {}\n\n async serve(): Promise<void> {\n try {\n const viteServer = await createServer({\n root: process.cwd(),\n plugins: [\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n react(),\n viteExternalsPlugin({\n react: 'React',\n 'react-dom': 'ReactDOM',\n }),\n ],\n define: {\n 'process.env.NODE_ENV': JSON.stringify('development'),\n 'DevCustomTheme.dependencies.appBridgeTheme': JSON.stringify(\n getAppBridgeThemeVersion(process.cwd()),\n ),\n },\n base: `http://localhost:${this.port}/`,\n appType: 'custom',\n server: {\n port: this.port,\n host: this.allowExternal ? '0.0.0.0' : 'localhost',\n cors: true,\n hmr: {\n port: this.port,\n host: this.allowExternal ? '0.0.0.0' : 'localhost',\n protocol: 'ws',\n },\n },\n });\n\n viteServer.middlewares.use('/', (req, res, next) => {\n if (req.url !== '/') {\n return next();\n }\n\n res.writeHead(200);\n return res.end('OK');\n });\n\n viteServer.middlewares.use('/_entrypoint', (req, res, next) => {\n if (req.url !== '/') {\n return next();\n }\n\n res.setHeader('Content-Type', 'application/json');\n res.writeHead(200);\n return res.end(\n JSON.stringify({\n url: `http://localhost:${this.port}/${this.entryFilePath}`,\n entryFilePath: this.entryFilePath,\n port: this.port,\n version: pkg.version,\n }),\n );\n });\n\n const server = await viteServer.listen(this.port, true);\n server.printUrls();\n } catch (error) {\n console.error(error);\n process.exit(1);\n }\n }\n}\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { BlockDevelopmentServer } from '../servers/blockDevelopmentServer';\nimport { PlatformAppDevelopmentServer } from '../servers/platformAppDevelopmentServer';\nimport { ThemeDevelopmentServer } from '../servers/themeDevelopmentServer';\nimport { Logger } from '../utils/logger';\n\nexport const createDevelopmentServer = async (\n entryFilePath: string,\n port: number,\n allowExternal: boolean,\n): Promise<void> => {\n Logger.info('Starting the development server...');\n\n const developmentServer = new BlockDevelopmentServer(entryFilePath, port, allowExternal);\n await developmentServer.serve();\n};\n\nexport const createDevelopmentServerForTheme = async (\n entryFilePath: string,\n port: number,\n allowExternal: boolean,\n): Promise<void> => {\n Logger.info('Starting the development server for theme...');\n\n const developmentServer = new ThemeDevelopmentServer(entryFilePath, port, allowExternal);\n await developmentServer.serve();\n};\n\nexport const createDevelopmentServerForPlatformApp = async (entryFilePath: string, port: number): Promise<void> => {\n Logger.info('Starting the development server for Apps...');\n\n const developmentServer = new PlatformAppDevelopmentServer(entryFilePath, port);\n await developmentServer.serve();\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { resolve } from 'node:path';\nimport { fileURLToPath } from 'node:url';\n\nimport pc from 'picocolors';\n\nimport { generateGitignoreFile, Logger, copyFolder, updatePackageJsonProjectName } from '../utils/index';\n\nexport const createNewApp = (appName: string, template: string, type: string): void => {\n Logger.info(`Creating the ${type}...`);\n\n const appInBlue = pc.blue(`./${appName}`);\n Logger.info(`Scaffolding App in ${appInBlue}...`);\n\n const templateDir = resolve(fileURLToPath(import.meta.url), `../../templates/${type}-${template}`);\n copyFolder(templateDir, appName, { exclude: ['node_modules'] });\n\n generateGitignoreFile(appName, type);\n updatePackageJsonProjectName(appName);\n\n Logger.defaultInfo(`\\n${Logger.spacer(11)}You can now access the project and install dependencies.`);\n const appNameInBlue = pc.blue(`./${appName}`);\n Logger.defaultInfo(`${Logger.spacer(4)}cd ${appNameInBlue}`);\n Logger.defaultInfo(`${Logger.spacer(4)}npm i`);\n Logger.defaultInfo(`${Logger.spacer(4)}npm run serve`);\n\n Logger.defaultInfo(`\\n${Logger.spacer(11)}Happy hacking!`);\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { join } from 'node:path';\nimport { exit } from 'node:process';\n\nimport { cac } from 'cac';\nimport prompts from 'prompts';\n\nimport pkg from '../package.json';\n\nimport {\n type AppManifest,\n createDeployment,\n createDevelopmentServer,\n createDevelopmentServerForPlatformApp,\n createDevelopmentServerForTheme,\n createNewApp,\n loginUser,\n logoutUser,\n} from './commands/index';\nimport {\n compileBlock,\n compilePlatformApp,\n compileTheme,\n getValidInstanceUrl,\n isValidName,\n reactiveJson,\n} from './utils/index';\n\nconst cli = cac(pkg.name.split('/')[1]);\n\ncli.command('login [instanceUrl]', 'log in to a Frontify instance')\n .option('-i, --instance <instanceUrl>', '[string] url of the Frontify instance')\n .option('-p, --port <port>', '[number] port for the oauth service', {\n default: process.env.PORT || 5600,\n })\n .action(async (instanceUrl: string, options) => {\n const computedInstanceUrl = instanceUrl || options.instance || process.env.INSTANCE_URL;\n if (computedInstanceUrl) {\n prompts.inject([computedInstanceUrl]);\n }\n\n const { promptedInstanceUrl } = await prompts([\n {\n type: 'text',\n name: 'promptedInstanceUrl',\n message: 'Enter a Frontify instance URL',\n initial: 'instanceName.frontify.com',\n validate: (value: string) => (value.trim() === '' ? 'You need to enter a valid URL.' : true),\n },\n ]);\n\n if (!promptedInstanceUrl) {\n exit(0);\n }\n\n const parsedInstanceUrl = getValidInstanceUrl(promptedInstanceUrl);\n\n await loginUser(parsedInstanceUrl, options.port);\n });\n\ncli.command('logout', 'log out of an instance').action(logoutUser);\n\n/**\n * @deprecated `block serve` and `theme serve` will be removed in version 4.0 in favour of `serve`\n */\nfor (const appType of ['block', 'theme']) {\n cli.command(`${appType} serve`, `[deprecated: use 'serve' instead] serve the ${appType} locally`)\n .alias(`${appType} dev`)\n .option('-e, --entryPath, --entry-path <entryPath>', `[string] path to the ${appType} entry file`, {\n default: join('src', 'index.tsx'),\n })\n .option('--port <port>', '[number] specify port', {\n default: process.env.PORT || 5600,\n })\n .option('--allowExternal, --allow-external', '[boolean] allow external IPs to access the server', {\n default: false,\n })\n .action(async (options) => {\n await createDevelopmentServer(options.entryPath, options.port, options.allowExternal);\n });\n}\n\ncli.command('serve', 'serve the app locally')\n .alias('dev')\n .option('-e, --entryPath, --entry-path <entryPath>', '[string] path to the entry file', {\n default: join('src', 'index.ts'),\n })\n .option('--port <port>', '[number] specify port', {\n default: process.env.PORT || 5600,\n })\n .option('--allowExternal, --allow-external', '[boolean] allow external IPs to access the server', {\n default: false,\n })\n .option('--appType <appType>, --app-type', '[string] specify app type. Overrides manifest values')\n .action(async (options) => {\n const manifest = reactiveJson<AppManifest>(join(process.cwd(), 'manifest.json'));\n const appType = options.appType || manifest.appType;\n\n if (appType === 'platform-app') {\n await createDevelopmentServerForPlatformApp(options.entryPath, options.port);\n } else if (appType === 'theme') {\n await createDevelopmentServerForTheme(options.entryPath, options.port, options.allowExternal);\n } else {\n await createDevelopmentServer(options.entryPath, options.port, options.allowExternal);\n }\n });\n\n/**\n * @deprecated `block deploy` and `theme deploy` will be removed in version 4.0 in favour of `deploy`\n */\nfor (const appType of ['block', 'theme']) {\n cli.command(`${appType} deploy`, `[deprecated: use 'deploy' instead] deploy the ${appType} to the marketplace`)\n .option('-e, --entryPath <entryPath>', '[string] path to the entry file', { default: join('src', 'index.tsx') })\n .option('-o, --outDir <outDir>', '[string] path to the output directory', { default: 'dist' })\n .option('--dryRun, --dry-run', '[boolean] enable the dry run mode', { default: false })\n .option('--noVerify, --no-verify', '[boolean] disable the linting and typechecking', { default: false })\n .option('--open', '[boolean] open the marketplace app page', { default: false })\n .action(async (options) => {\n await createDeployment(\n options.entryPath,\n options.outDir,\n {\n dryRun: options.dryRun,\n noVerify: options.noVerify,\n openInBrowser: options.open,\n },\n appType === 'theme' ? compileTheme : compileBlock,\n );\n });\n}\n\ncli.command('deploy', 'deploy the app to the marketplace')\n .option('-e, --entryPath <entryPath>', '[string] path to the entry file', { default: join('src', 'index.ts') })\n .option('-o, --outDir <outDir>', '[string] path to the output directory', { default: 'dist' })\n .option('--dryRun, --dry-run', '[boolean] enable the dry run mode', { default: false })\n .option('--noVerify, --no-verify', '[boolean] disable the linting and typechecking', { default: false })\n .option('--open', '[boolean] open the marketplace app page', { default: false })\n .option('--appType [appType], --app-type', '[string] specify app type. Overrides manifest values')\n .option('-i, --instance <instanceUrl>', '[string] url of the Frontify instance')\n .option('-t, --token <accessToken>', '[string] the access token')\n .action(async (options) => {\n const manifest = reactiveJson<AppManifest>(join(process.cwd(), 'manifest.json'));\n const appType = options.appType || manifest.appType;\n\n if (appType === 'platform-app') {\n await createDeployment(\n options.entryPath,\n options.outDir,\n {\n dryRun: options.dryRun,\n noVerify: options.noVerify,\n openInBrowser: options.open,\n instance: options.instance,\n token: options.token,\n },\n compilePlatformApp,\n );\n } else if (appType === 'theme') {\n await createDeployment(\n options.entryPath,\n options.outDir,\n {\n dryRun: options.dryRun,\n noVerify: options.noVerify,\n openInBrowser: options.open,\n instance: options.instance,\n token: options.token,\n },\n compileTheme,\n );\n } else {\n await createDeployment(\n options.entryPath,\n options.outDir,\n {\n dryRun: options.dryRun,\n noVerify: options.noVerify,\n openInBrowser: options.open,\n instance: options.instance,\n token: options.token,\n },\n compileBlock,\n );\n }\n });\n\ncli.command('create [appName]', 'create a new marketplace app').action(async (appName: string) => {\n const { promptedAppName, stylingFramework, appType } = await prompts([\n {\n type: 'text',\n name: 'promptedAppName',\n message: 'Enter your app name',\n initial: appName || 'my-frontify-app',\n validate: (value: string) => {\n if (value.trim() === '') {\n return 'You need to enter an app name.';\n }\n\n return isValidName(value);\n },\n },\n {\n type: 'select',\n name: 'appType',\n message: 'Select the type of your app',\n choices: [\n { title: 'App', value: 'platform-app' },\n { title: 'Block', value: 'content-block' },\n ],\n },\n {\n type: 'select',\n name: 'stylingFramework',\n message: 'Choose a styling framework',\n choices: [\n { title: 'Tailwind', value: 'tailwind' },\n { title: 'CSS Modules', value: 'css-modules' },\n { title: 'None', value: 'css' },\n ],\n },\n ]);\n\n if (!promptedAppName || !stylingFramework || !appType) {\n exit(0);\n }\n\n createNewApp(promptedAppName, stylingFramework, appType);\n});\n\n/**\n * @deprecated `block create` and `theme create` will be removed in version 4.0 in favour of `create`\n */\nfor (const appType of ['block', 'theme']) {\n cli.command(\n `${appType} create [appName]`,\n `[deprecated: use 'create' instead] create a ${appType} app locally`,\n ).action((appName: string) => createNewApp(appName, 'css-modules', 'content-block'));\n}\n\ncli.help();\ncli.version(pkg.version);\n\nconst mergeOldBlockThemeCommands = (cliArgs: string[]) => {\n const oldCommandIndex = cliArgs.findIndex((value) => value === 'block' || value === 'theme');\n if (\n oldCommandIndex !== -1 &&\n (cliArgs[oldCommandIndex + 1] === 'serve' ||\n cliArgs[oldCommandIndex + 1] === 'deploy' ||\n cliArgs[oldCommandIndex + 1] === 'create')\n ) {\n cliArgs[oldCommandIndex] = `${cliArgs[oldCommandIndex]} ${cliArgs[oldCommandIndex + 1]}`;\n cliArgs.splice(oldCommandIndex + 1, 1);\n }\n\n return cliArgs;\n};\n\ncli.parse(mergeOldBlockThemeCommands(process.argv));\n"],"names":["getCurrentTime","now","Logger","messages","pc","width","FileNotFoundError","path","ParseJsonError","reactiveJson","jsonRaw","readFileSync","jsonParsed","obj","prop","value","jsonString","writeFileSync","error","getAppBridgeVersion","rootPath","join","Configuration","Conf","key","isDirectoryEmpty","folderPath","readdirSync","copyFolder","sourceFolderPath","destinationFolderPath","options","mkdirSync","excludePatterns","glob","globToRegExp","file","re","srcFile","resolve","destFile","copyFile","sourceFilePath","destinationFilePath","statSync","copyFileSync","readFile","filePath","readFileAsBase64","readFileLinesAsArray","line","HttpClientError","code","responseBody","HttpClient","baseUrl","method","url","body","response","fetch","responseJson","responseText","errorData","relativeUrl","updatePackageJsonProjectName","packageJsonPath","packageJson","isValidName","folderName","CommandExecutionError","promiseExec","command","reject","exec","stdout","InvalidInstanceUrlError","getValidInstanceUrl","cleanHost","URL","getUser","instanceUrl","token","httpClient","accessToken","generateGitignoreFile","type","gitignorePath","gitignoreTemplate","compilePlatformApp","outputName","entryFile","projectPath","appBridgeVersion","settings","build","react","viteExternalsPlugin","compileBlock","getAppBridgeThemeVersion","compileTheme","forbiddenExtensions","getForbiddenExtensionsErrorMessage","surfaceName","assetCreationShape","object","string","completeAssetType","z","imageAssetType","iconLibraryFilenameExtension","logoLibraryFilenameExtension","appType","secretKeySet","secretSchema","secretsArraySchema","array","requestOptionsSchema","endpointNameSet","endpointCallSchema","name","hostnameRegex","ScopeEnum","permissionsSchema","scopes","KeyTypeLabelSchema","ActionSchema","number","ActionsArraySchema","platformAppManifestSchemaV1","boolean","verifyManifest","manifest","schema","validatedManifest","makeFilesDict","ignoreGlobs","folderFiles","fastGlob","stack","filename","index","BUILD_FILE_BLOCK_LIST","SOURCE_FILE_BLOCK_LIST","createDeployment","distPath","dryRun","noVerify","openInBrowser","instance","compile","user","manifestContent","appId","buildFilesToIgnore","sourceFilesToIgnore","entry","request","open","Authenticator","port","Fastify","req","res","tokens","FastifyCors","randomCodeChallenge","errorText","queryParams","authorizationCode","loginUser","cleanedInstanceUrl","authenticator","loginUrl","logoutUser","BlockDevelopmentServer","entryFilePath","allowExternal","viteServer","createServer","next","pkg","PlatformAppDevelopmentServer","settingsSchema","esbuild","server","relativeFilePath","ThemeDevelopmentServer","createDevelopmentServer","createDevelopmentServerForTheme","createDevelopmentServerForPlatformApp","createNewApp","appName","template","appInBlue","templateDir","fileURLToPath","appNameInBlue","cli","cac","computedInstanceUrl","prompts","promptedInstanceUrl","exit","parsedInstanceUrl","promptedAppName","stylingFramework","mergeOldBlockThemeCommands","cliArgs","oldCommandIndex"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAEaA,IAAiB,MAAc;AACxC,QAAMC,wBAAU,KAAA;AAChB,SAAO,GAAG,OAAOA,EAAI,SAAA,CAAU,EAAE,SAAS,GAAG,GAAG,CAAC,IAAI,OAAOA,EAAI,YAAY,EAAE,SAAS,GAAG,GAAG,CAAC,IAAI;AAAA,IAC9FA,EAAI,WAAA;AAAA,EAAW,EACjB,SAAS,GAAG,GAAG,CAAC;AACtB;ACDO,MAAMC,EAAO;AAAA,EAChB,OAAO,eAAeC,GAA0B;AAC5C,YAAQ,IAAID,EAAO,OAAO,EAAE,GAAG,GAAGC,CAAQ;AAAA,EAC9C;AAAA,EAEA,OAAO,QAAQA,GAA0B;AACrC,YAAQ,IAAI,IAAIH,EAAA,CAAgB,KAAKG,EAAS,KAAK,GAAG,CAAC,EAAE;AAAA,EAC7D;AAAA,EAEA,OAAO,WAAWA,GAA0B;AACxC,YAAQ,IAAI,IAAIH,EAAA,CAAgB,KAAKI,EAAG,MAAMD,EAAS,KAAK,GAAG,CAAC,CAAC,EAAE;AAAA,EACvE;AAAA,EAEA,OAAO,SAASA,GAA0B;AACtC,YAAQ,MAAMC,EAAG,IAAI,IAAIJ,GAAgB,KAAKG,EAAS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AAAA,EAAA,EACxD,OAAO,CAACgF,MAAoBD,GAAaC,GAAS,eAAe,eAAe,CAAC;AAGvFM,EAAI,KAAA;AACJA,EAAI,QAAQjB,EAAI,OAAO;AAEvB,MAAM0B,KAA6B,CAACC,MAAsB;AACtD,QAAMC,IAAkBD,EAAQ,UAAU,CAACjM,MAAUA,MAAU,WAAWA,MAAU,OAAO;AAC3F,SACIkM,MAAoB,OACnBD,EAAQC,IAAkB,CAAC,MAAM,WAC9BD,EAAQC,IAAkB,CAAC,MAAM,YACjCD,EAAQC,IAAkB,CAAC,MAAM,cAErCD,EAAQC,CAAe,IAAI,GAAGD,EAAQC,CAAe,CAAC,IAAID,EAAQC,IAAkB,CAAC,CAAC,IACtFD,EAAQ,OAAOC,IAAkB,GAAG,CAAC,IAGlCD;AACX;AAEAV,EAAI,MAAMS,GAA2B,QAAQ,IAAI,CAAC;"}
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../src/utils/date.ts","../src/utils/logger.ts","../src/errors/FileNotFoundError.ts","../src/errors/ParseJsonError.ts","../src/utils/reactiveJson.ts","../src/utils/appBridgeVersion.ts","../src/utils/configuration.ts","../src/utils/file.ts","../src/errors/HttpClientError.ts","../src/utils/httpClient.ts","../src/utils/npm.ts","../src/errors/CommandExecutionError.ts","../src/utils/promiseExec.ts","../src/errors/InvalidInstanceUrlError.ts","../src/utils/url.ts","../src/utils/user.ts","../src/utils/gitignoreTemplate.ts","../src/utils/compiler/compilePlatformApp.ts","../src/utils/compiler/compileBlock.ts","../src/utils/appBridgeThemeVersion.ts","../src/utils/compiler/compileTheme.ts","../src/utils/verifyManifest.ts","../src/commands/deploy.ts","../src/commands/login.ts","../src/commands/logout.ts","../src/servers/blockDevelopmentServer.ts","../src/servers/platformAppDevelopmentServer.ts","../src/servers/themeDevelopmentServer.ts","../src/commands/serve.ts","../src/commands/create.ts","../src/index.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nexport const getCurrentTime = (): string => {\n const now = new Date();\n return `${String(now.getHours()).padStart(2, '0')}:${String(now.getMinutes()).padStart(2, '0')}:${String(\n now.getSeconds(),\n ).padStart(2, '0')}`;\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport pc from 'picocolors';\n\nimport { getCurrentTime } from './date';\n\nexport class Logger {\n static defaultInfo(...messages: string[]): void {\n console.log(Logger.spacer(10), ...messages);\n }\n\n static info(...messages: string[]): void {\n console.log(`[${getCurrentTime()}] ${messages.join(' ')}`);\n }\n\n static success(...messages: string[]): void {\n console.log(`[${getCurrentTime()}] ${pc.green(messages.join(' '))}`);\n }\n\n static error(...messages: string[]): void {\n console.error(pc.red(`[${getCurrentTime()}] ${messages.join(' ')}`));\n }\n\n static spacer(width = 1): string {\n return Array(width + 1).join(' ');\n }\n}\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { Logger } from '../utils/logger';\n\nexport default class FileNotFoundError extends Error {\n readonly name = 'FileNotFoundError';\n constructor(path: string) {\n super();\n Logger.error(`The file at \"${path}\" was not found.`);\n }\n}\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { Logger } from '../utils/logger';\n\nexport default class ParseJsonError extends Error {\n readonly name = 'ParseJsonError';\n constructor(path: string) {\n super();\n Logger.error(`The file at \"${path}\" could not be parsed.`);\n }\n}\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { readFileSync, writeFileSync } from 'node:fs';\n\nimport FileNotFoundError from '../errors/FileNotFoundError';\nimport ParseJsonError from '../errors/ParseJsonError';\n\nexport const reactiveJson = <T>(path: string): T => {\n try {\n const jsonRaw = readFileSync(path, 'utf8');\n const jsonParsed = JSON.parse(jsonRaw);\n\n return new Proxy(jsonParsed, {\n set: (obj, prop, value) => {\n obj[prop] = value;\n\n const jsonString = JSON.stringify(obj, null, '\\t');\n\n writeFileSync(path, jsonString);\n\n return true;\n },\n });\n } catch (error) {\n if (error instanceof SyntaxError) {\n throw new ParseJsonError(path);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } else if ((error as any).code === 'ENOENT') {\n throw new FileNotFoundError(path);\n }\n\n throw new Error(error as string);\n }\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { join } from 'node:path';\n\nimport { type PackageJson } from './npm';\nimport { reactiveJson } from './reactiveJson';\n\nexport const getAppBridgeVersion = (rootPath: string) => {\n const packageJson = reactiveJson<PackageJson>(join(rootPath, 'package.json'));\n return packageJson.dependencies['@frontify/app-bridge'];\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport Conf from 'conf';\n\nexport class Configuration {\n private static readonly conf = new Conf<Record<string, string | undefined>>({\n projectName: 'frontify-cli',\n });\n\n static set(key: string, value: unknown): void {\n this.conf.set(key, value);\n }\n\n static get(key: string): string | undefined {\n return this.conf.get(key, undefined);\n }\n\n static delete(key: string): void {\n return this.conf.delete(key);\n }\n}\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { copyFileSync, mkdirSync, readFileSync, readdirSync, statSync } from 'node:fs';\nimport { resolve } from 'node:path';\n\nimport globToRegExp from 'glob-to-regexp';\n\nimport FileNotFoundError from '../errors/FileNotFoundError';\n\nexport const isDirectoryEmpty = (folderPath: string): boolean => {\n try {\n return readdirSync(folderPath).length === 0;\n } catch {\n return true;\n }\n};\n\nexport const copyFolder = (\n sourceFolderPath: string,\n destinationFolderPath: string,\n options?: { exclude: string[] },\n) => {\n mkdirSync(destinationFolderPath, { recursive: true });\n const excludePatterns = options?.exclude.map((glob) => globToRegExp(glob));\n\n for (const file of readdirSync(sourceFolderPath)) {\n if (excludePatterns !== undefined && excludePatterns.some((re) => re.test(file))) {\n continue;\n }\n const srcFile = resolve(sourceFolderPath, file);\n const destFile = resolve(destinationFolderPath, file);\n copyFile(srcFile, destFile);\n }\n};\n\nexport const copyFile = (sourceFilePath: string, destinationFilePath: string) => {\n const stat = statSync(sourceFilePath);\n if (stat.isDirectory()) {\n copyFolder(sourceFilePath, destinationFilePath);\n } else {\n copyFileSync(sourceFilePath, destinationFilePath);\n }\n};\n\nexport const readFile = (filePath: string): string => {\n try {\n return readFileSync(filePath, 'utf-8');\n } catch {\n throw new FileNotFoundError(filePath);\n }\n};\n\nexport const readFileAsBase64 = (filePath: string): string => {\n try {\n return readFileSync(filePath, 'base64');\n } catch {\n throw new FileNotFoundError(filePath);\n }\n};\n\nexport const readFileLinesAsArray = (filePath: string): string[] => {\n try {\n const content = readFile(filePath);\n return content.split(/\\r?\\n/).filter((line) => line !== '');\n } catch {\n throw new FileNotFoundError(filePath);\n }\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nexport class HttpClientError extends Error {\n public code = 0;\n public responseBody: { sucess: false; error: string };\n\n constructor(code: number, responseBody: { sucess: false; error: string }) {\n super(`Status code ${code}`);\n this.name = 'HttpClientError';\n this.code = code;\n this.responseBody = responseBody;\n }\n}\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport fetch from 'node-fetch';\n\nimport { HttpClientError } from '../errors/HttpClientError';\n\ninterface RequestOptions {\n headers?: {\n Authorization?: string;\n };\n}\n\ninterface FetchParameters {\n method: 'GET' | 'POST' | 'PUT' | 'DELETE';\n url: string;\n body?: Record<string, unknown>;\n options?: RequestOptions;\n}\n\nexport class HttpClient {\n private readonly baseUrl: string;\n\n constructor(baseUrl: string) {\n this.baseUrl = baseUrl.replace(/^https?:\\/\\//, '');\n }\n\n private async fetchExtended<T>({ method, url, body, options }: FetchParameters): Promise<T> {\n const response = await fetch(this.getAbsoluteUrl(url), {\n method,\n ...(body && {\n body: JSON.stringify(body),\n }),\n ...options,\n headers: { 'Content-Type': 'application/json', ...options?.headers },\n });\n\n if (response.status === 200) {\n const contentType = response.headers.get('Content-Type');\n\n switch (contentType) {\n case 'application/json': {\n const responseJson = await response.json();\n if (!responseJson) {\n return undefined as T;\n }\n return responseJson as T;\n }\n default: {\n const responseText = await response.text();\n if (!responseText) {\n return undefined as T;\n }\n return responseText as T;\n }\n }\n } else {\n const errorData = (await response.json()) as { sucess: false; error: string };\n throw new HttpClientError(response.status, errorData);\n }\n }\n\n public get<T>(url: string, options?: RequestOptions): Promise<T> {\n return this.fetchExtended<T>({ url, method: 'GET', options });\n }\n\n public post<T>(url: string, body?: Record<string, unknown>, options?: RequestOptions): Promise<T> {\n return this.fetchExtended({ url, method: 'POST', body, options });\n }\n\n public put<T>(url: string, body?: Record<string, unknown>, options?: RequestOptions): Promise<T> {\n return this.fetchExtended({ url, method: 'PUT', body, options });\n }\n\n public delete<T>(url: string, options?: RequestOptions): Promise<T> {\n return this.fetchExtended({ url, method: 'DELETE', options });\n }\n\n private getAbsoluteUrl(relativeUrl: string): string {\n return `https://${this.baseUrl}${relativeUrl}`;\n }\n}\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { resolve } from 'node:path';\n\nimport { isDirectoryEmpty } from './file';\nimport { reactiveJson } from './reactiveJson';\n\nexport type PackageJson = {\n name: string;\n version: string;\n main: string;\n dependencies: Record<string, string>;\n};\n\nexport const updatePackageJsonProjectName = (folderPath: string): void => {\n const packageJsonPath = resolve(folderPath, 'package.json');\n const packageJson = reactiveJson<PackageJson>(packageJsonPath);\n packageJson.name = folderPath;\n};\n\nexport const isValidName = (folderName: string): true | string => {\n if (!folderName) {\n return 'The content block name can not be empty.';\n } else if (!/^[_a-z-]+$/.test(folderName)) {\n return 'The project name needs to be \"a-z\" separated by \"-\" or \"_\".';\n } else if (!isDirectoryEmpty(folderName)) {\n return `The directory ./${folderName} already exist.`;\n } else {\n return true;\n }\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { Logger } from '../utils/logger';\n\nexport default class CommandExecutionError extends Error {\n readonly name = 'CommandExecutionError';\n constructor(error: string) {\n super();\n Logger.error(`The command execution failed: ${error}`);\n }\n}\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type ExecOptions, exec } from 'node:child_process';\n\nimport CommandExecutionError from '../errors/CommandExecutionError';\n\nexport const promiseExec = (command: string, options: ExecOptions = {}): Promise<string> => {\n return new Promise((resolve, reject) => {\n exec(command, options, (error, stdout) => {\n if (error) {\n // @ts-expect-error node typing change\n // eslint-disable-next-line @typescript-eslint/restrict-plus-operands\n return reject(new CommandExecutionError(error + stdout));\n } else {\n // @ts-expect-error node typing change\n return resolve(stdout);\n }\n });\n });\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { Logger } from '../utils/logger';\n\nexport default class InvalidInstanceUrlError extends Error {\n readonly name = 'InvalidInstanceUrlError';\n constructor(url: string) {\n super();\n if (url) {\n Logger.error(`The given URL \"${url}\" is invalid.`);\n } else {\n Logger.error('No instance URL was given.');\n }\n }\n}\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { URL } from 'node:url';\n\nimport InvalidInstanceUrlError from '../errors/InvalidInstanceUrlError';\n\nexport const getValidInstanceUrl = (url: string): string => {\n try {\n const cleanHost = url.replace(/^https?:\\/\\//, '');\n const parsedUrl = new URL(`https://${cleanHost}`);\n return parsedUrl.hostname;\n } catch {\n throw new InvalidInstanceUrlError(url);\n }\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport pc from 'picocolors';\n\nimport { Configuration } from './configuration';\nimport { HttpClient } from './httpClient';\nimport { Logger } from './logger';\n\nexport interface UserInfo {\n name: string;\n email: string;\n}\n\nexport const getUser = async (instanceUrl: string, token?: string): Promise<UserInfo | undefined> => {\n const httpClient = new HttpClient(instanceUrl);\n const accessToken = token || Configuration.get('tokens.access_token');\n\n try {\n const user = await httpClient.post<{ data: { currentUser: UserInfo } }>(\n '/graphql',\n { query: '{ currentUser { email name } }' },\n { headers: { Authorization: `Bearer ${accessToken}` } },\n );\n return user.data.currentUser;\n } catch {\n Logger.error(\n `You are currently not logged in. You can use the command ${pc.bold('frontify-cli login')} to log in.`,\n );\n return undefined;\n }\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { writeFileSync } from 'node:fs';\nimport { join } from 'node:path';\n\nexport const generateGitignoreFile = (destinationFolderPath: string, type: string): void => {\n const gitignorePath = join(destinationFolderPath, '.gitignore');\n writeFileSync(gitignorePath, gitignoreTemplate[type]);\n};\n\nconst gitignoreTemplate = {\n '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`,\n 'content-block': `node_modules\ndist\n.idea\n.vscode\n`,\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport react from '@vitejs/plugin-react';\nimport { build } from 'vite';\nimport { viteExternalsPlugin } from 'vite-plugin-externals';\n\nimport { getAppBridgeVersion } from '../appBridgeVersion';\n\nimport { type CompilerOptions } from './compilerOptions';\n\nexport const compilePlatformApp = async ({ outputName, entryFile, projectPath = '' }: CompilerOptions) => {\n const appBridgeVersion = getAppBridgeVersion(projectPath);\n\n const settings = await build({\n plugins: [\n react(),\n viteExternalsPlugin({\n react: 'React',\n 'react-dom': 'ReactDOM',\n }),\n ],\n root: projectPath,\n define: {\n 'process.env.NODE_ENV': JSON.stringify('production'),\n },\n build: {\n lib: {\n entry: entryFile,\n name: outputName,\n formats: ['iife'],\n fileName: () => 'index.js',\n },\n rollupOptions: {\n external: ['react', 'react-dom'],\n output: {\n globals: {\n react: 'React',\n 'react-dom': 'ReactDOM',\n },\n entryFileNames: 'settings.js',\n footer: `\n window.${outputName} = ${outputName};\n window.${outputName}.dependencies = window.${outputName}.packages || {};\n window.${outputName}.dependencies['@frontify/app-bridge'] = '${appBridgeVersion}';\n `,\n },\n },\n },\n });\n\n const app = await build({\n plugins: [react()],\n root: projectPath,\n define: {\n 'process.env.NODE_ENV': JSON.stringify('production'),\n },\n base: '/__DYNAMIC_SEGMENT__/',\n build: {\n emptyOutDir: false,\n },\n });\n return { app, settings };\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport react from '@vitejs/plugin-react';\nimport { build } from 'vite';\nimport { viteExternalsPlugin } from 'vite-plugin-externals';\n\nimport { getAppBridgeVersion } from '../appBridgeVersion';\n\nimport { type CompilerOptions } from './compilerOptions';\n\nexport const compileBlock = async ({ projectPath, entryFile, outputName }: CompilerOptions) => {\n const appBridgeVersion = getAppBridgeVersion(projectPath);\n return build({\n plugins: [\n react(),\n viteExternalsPlugin({\n react: 'React',\n 'react-dom': 'ReactDOM',\n }),\n ],\n define: {\n 'process.env.NODE_ENV': JSON.stringify('production'),\n },\n root: projectPath,\n build: {\n lib: {\n name: outputName,\n entry: entryFile,\n formats: ['iife'],\n fileName: () => 'index.js',\n },\n rollupOptions: {\n external: ['react', 'react-dom'],\n output: {\n globals: {\n react: 'React',\n 'react-dom': 'ReactDOM',\n },\n footer: `\n window.${outputName} = ${outputName};\n window.${outputName}.dependencies = window.${outputName}.packages || {};\n window.${outputName}.dependencies['@frontify/app-bridge'] = '${appBridgeVersion}';\n `,\n },\n },\n },\n });\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { join } from 'node:path';\n\nimport { type PackageJson } from './npm';\nimport { reactiveJson } from './reactiveJson';\n\nexport const getAppBridgeThemeVersion = (rootPath: string) => {\n const packageJson = reactiveJson<PackageJson>(join(rootPath, 'package.json'));\n return packageJson.dependencies['@frontify/app-bridge-theme'];\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport react from '@vitejs/plugin-react';\nimport { build } from 'vite';\nimport { viteExternalsPlugin } from 'vite-plugin-externals';\n\nimport { getAppBridgeThemeVersion } from '../appBridgeThemeVersion';\n\nimport { type CompilerOptions } from './compilerOptions';\n\nexport const compileTheme = async ({ projectPath, entryFile, outputName }: CompilerOptions) => {\n const appBridgeVersion = getAppBridgeThemeVersion(projectPath);\n return build({\n plugins: [\n react(),\n viteExternalsPlugin({\n react: 'React',\n 'react-dom': 'ReactDOM',\n }),\n ],\n define: {\n 'process.env.NODE_ENV': JSON.stringify('production'),\n },\n root: projectPath,\n build: {\n lib: {\n name: outputName,\n entry: entryFile,\n formats: ['iife'],\n fileName: () => 'index.js',\n },\n rollupOptions: {\n external: ['react', 'react-dom'],\n output: {\n globals: {\n react: 'React',\n 'react-dom': 'ReactDOM',\n },\n footer: `\n window.${outputName} = ${outputName};\n window.${outputName}.dependencies = window.${outputName}.packages || {};\n window.${outputName}.dependencies['@frontify/app-bridge-theme'] = '${appBridgeVersion}';\n `,\n },\n },\n },\n });\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { array, boolean, number, object, string, z } from 'zod';\n\nconst forbiddenExtensions = ['exe', 'dmg', 'cmd', 'sh', 'bat'];\nconst getForbiddenExtensionsErrorMessage = (surfaceName: string) =>\n `Invalid file extension, \\`${surfaceName}.filenameExtension\\` can not include: ${forbiddenExtensions.join(', ')}.`;\n\nconst assetCreationShape = object({\n title: string().min(1).max(40),\n}).optional();\n\nconst completeAssetType = z.enum(['audio', 'document', 'image', 'video', 'file', 'embeddedContent']);\nconst imageAssetType = completeAssetType.exclude(['audio', 'document', 'video', 'file', 'embeddedContent']);\n\nconst iconLibraryFilenameExtension = z.enum(['svg']);\nconst logoLibraryFilenameExtension = z.enum(['svg', 'jpg', 'jpeg', 'ai', 'eps', 'png', 'tif', 'tiff']);\n\nconst appType = z.enum(['content-block', 'platform-app', 'theme']);\n\nconst secretKeySet = new Set();\nexport function resetSecretKeySet() {\n secretKeySet.clear();\n}\n\nconst secretSchema = object({\n label: string(),\n key: string()\n .min(1)\n .max(80)\n .refine(\n (key) => {\n if (secretKeySet.has(key)) {\n return false;\n }\n\n secretKeySet.add(key);\n return /^\\w+$/.test(key);\n },\n {\n message:\n \"Secret Key must be unique and should only contain letters from a-z, A-Z, numbers from 0-9 and '_' without any spaces\",\n },\n ),\n});\nconst secretsArraySchema = array(secretSchema);\n\nconst requestOptionsSchema = object({\n method: z.enum(['GET', 'POST', 'PUT', 'DELETE']),\n headers: z.record(string()).optional(),\n body: z.any().optional(),\n});\n\nconst endpointNameSet = new Set();\nexport function resetEndpointNameSet() {\n endpointNameSet.clear();\n}\nconst endpointCallSchema = object({\n name: string().refine(\n (name) => {\n if (endpointNameSet.has(name)) {\n return false;\n }\n\n endpointNameSet.add(name);\n return /^[\\w-]*$/.test(name);\n },\n {\n message: 'Endpoint name must be unique',\n },\n ),\n resource: string(),\n options: requestOptionsSchema,\n});\n\nconst hostnameRegex =\n /^(([\\dA-Za-z]|[\\dA-Za-z][\\dA-Za-z-]*[\\dA-Za-z])\\.)*([\\dA-Za-z]|[\\dA-Za-z][\\dA-Za-z-]*[\\dA-Za-z])$/;\n\nconst ScopeEnum = z.enum(['basic:read', 'basic:write', 'account:read', 'webhook:read', 'webhook:write']);\n\nconst permissionsSchema = object({\n permissions: object({\n scopes: array(ScopeEnum)\n .min(1, 'At least one scope is required')\n .max(5, 'No more than 5 scopes are allowed')\n .refine((scopes) => scopes.includes('basic:read'), {\n message: \"'basic:read' is required in scopes\",\n }),\n }).optional(),\n}).optional();\n\nconst KeyTypeLabelSchema = object({\n key: string(),\n type: string(),\n label: string(),\n});\n\nconst ActionSchema = object({\n id: string(),\n title: string(),\n iconUrl: string(),\n returns: array(KeyTypeLabelSchema),\n version: number().int().positive(),\n externalId: string(),\n parameters: array(KeyTypeLabelSchema),\n});\n\nconst ActionsArraySchema = array(ActionSchema).optional();\n\nexport const platformAppManifestSchemaV1 = object({\n appId: string().length(25),\n appType,\n experimental: boolean().optional(),\n secrets: secretsArraySchema.optional(),\n network: object({\n allowedHosts: array(\n string().refine((value) => hostnameRegex.test(value), {\n message: 'Invalid host format',\n }),\n ).optional(),\n endpoints: array(endpointCallSchema).optional(),\n }).optional(),\n permissionsSchema,\n automation: object({\n actions: ActionsArraySchema,\n }).optional(),\n surfaces: object({\n guideline: object({\n pageAction: object({\n title: string().min(2).max(28),\n }).optional(),\n assetViewer: object({\n title: string().min(2).max(28),\n type: array(completeAssetType),\n filenameExtension: array(\n string().refine((value) => !forbiddenExtensions.includes(value), {\n message: getForbiddenExtensionsErrorMessage('guideline'),\n }),\n ),\n }).optional(),\n }).optional(),\n mediaLibrary: object({\n assetBulkActions: object({\n title: string().min(2).max(28),\n filenameExtensions: array(\n string().refine((value) => !forbiddenExtensions.includes(value), {\n message: getForbiddenExtensionsErrorMessage('mediaLibrary'),\n }),\n ),\n }).optional(),\n assetAction: object({\n title: string().min(2).max(28),\n type: array(completeAssetType),\n filenameExtension: array(\n string().refine((value) => !forbiddenExtensions.includes(value), {\n message: getForbiddenExtensionsErrorMessage('mediaLibrary'),\n }),\n ),\n }).optional(),\n assetCreation: assetCreationShape,\n }).optional(),\n iconLibrary: object({\n assetBulkActions: object({\n title: string().min(2).max(28),\n filenameExtensions: array(iconLibraryFilenameExtension),\n }).optional(),\n assetAction: object({\n title: string().min(2).max(28),\n type: array(imageAssetType),\n filenameExtension: array(iconLibraryFilenameExtension),\n }).optional(),\n assetCreation: assetCreationShape,\n }).optional(),\n logoLibrary: object({\n assetBulkActions: object({\n title: string().min(2).max(28),\n filenameExtensions: array(logoLibraryFilenameExtension),\n }).optional(),\n assetAction: object({\n title: string().min(2).max(28),\n type: array(imageAssetType),\n filenameExtension: array(logoLibraryFilenameExtension),\n }).optional(),\n assetCreation: assetCreationShape,\n }).optional(),\n documentLibrary: object({\n assetBulkActions: object({\n title: string().min(2).max(28),\n filenameExtensions: array(\n string().refine((value) => !forbiddenExtensions.includes(value), {\n message: getForbiddenExtensionsErrorMessage('documentLibrary'),\n }),\n ),\n }).optional(),\n assetAction: object({\n title: string().min(2).max(28),\n type: array(completeAssetType),\n filenameExtension: array(\n string().refine((value) => !forbiddenExtensions.includes(value), {\n message: getForbiddenExtensionsErrorMessage('documentLibrary'),\n }),\n ),\n }).optional(),\n assetCreation: assetCreationShape,\n }).optional(),\n workspace: object({\n assetBulkActions: object({\n title: string().min(2).max(28),\n filenameExtensions: array(\n string().refine((value) => !forbiddenExtensions.includes(value), {\n message: getForbiddenExtensionsErrorMessage('workspaceProject'),\n }),\n ),\n }).optional(),\n assetAction: object({\n title: string().min(2).max(28),\n type: array(completeAssetType),\n filenameExtension: array(\n string().refine((value) => !forbiddenExtensions.includes(value), {\n message: getForbiddenExtensionsErrorMessage('workspaceProject'),\n }),\n ),\n }).optional(),\n assetCreation: assetCreationShape,\n }).optional(),\n }).optional(),\n metadata: object({\n version: number().int(),\n }),\n});\n\nexport const verifyManifest = (manifest: unknown, schema: typeof platformAppManifestSchemaV1) => {\n const validatedManifest = schema.safeParse(manifest);\n\n if (!validatedManifest.success) {\n throw new Error(validatedManifest.error.message);\n }\n\n return validatedManifest.data;\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { join } from 'node:path';\n\nimport fastGlob from 'fast-glob';\nimport open from 'open';\nimport pc from 'picocolors';\n\nimport { type HttpClientError } from '../errors/HttpClientError';\nimport {\n type CompilerOptions,\n Configuration,\n HttpClient,\n Logger,\n type UserInfo,\n getUser,\n promiseExec,\n reactiveJson,\n readFileAsBase64,\n readFileLinesAsArray,\n} from '../utils/index';\nimport { platformAppManifestSchemaV1, verifyManifest } from '../utils/verifyManifest';\n\ntype Options = {\n dryRun?: boolean;\n noVerify?: boolean;\n openInBrowser?: boolean;\n token?: string;\n instance?: string;\n};\n\nexport type AppManifest = {\n appId: string;\n appType?: string;\n metadata?: {\n version?: number;\n };\n experimental?: boolean;\n};\n\nconst makeFilesDict = async (glob: string, ignoreGlobs?: string[]) => {\n const folderFiles = await fastGlob(`${fastGlob.convertPathToPattern(glob)}/**`, { ignore: ignoreGlobs, dot: true });\n const folderFilenames = folderFiles.map((filePath) => filePath.replace(`${glob}/`, ''));\n\n return folderFilenames.reduce((stack, filename, index) => {\n stack[`/${filename}`] = readFileAsBase64(folderFiles[index]);\n return stack;\n }, {});\n};\n\nconst BUILD_FILE_BLOCK_LIST = ['**/*.*.map'];\nconst SOURCE_FILE_BLOCK_LIST = [\n '.git',\n 'node_modules',\n 'dist',\n '.vscode',\n '.idea',\n '.eslintignore',\n '.prettierignore',\n 'README.md',\n '.DS_Store',\n '**/*.graphql',\n];\n\nexport const createDeployment = async (\n entryFile: string,\n distPath: string,\n { dryRun = false, noVerify = false, openInBrowser = false, token, instance }: Options,\n compile: ({ projectPath, entryFile, outputName }: CompilerOptions) => Promise<unknown>,\n): Promise<void> => {\n try {\n let user: UserInfo | undefined;\n const instanceUrl = instance || Configuration.get('instanceUrl');\n const accessToken = token || Configuration.get('tokens.access_token');\n\n if (!accessToken || !instanceUrl) {\n Logger.error(\n `You are currently not logged in. You can use the command ${pc.bold(\n 'frontify-cli login',\n )} to log in, or pass --token=<token> --instance=<instance> to the deploy command.`,\n );\n process.exit(-1);\n }\n\n if (!dryRun) {\n user = await getUser(instanceUrl, token);\n if (user) {\n Logger.info(`You are logged in as ${user.name} (${instanceUrl}).`);\n }\n }\n\n if (user || dryRun) {\n if (dryRun) {\n Logger.info(pc.blue('Dry run: enabled'));\n }\n\n const projectPath = process.cwd();\n const manifestContent = reactiveJson<AppManifest>(join(projectPath, 'manifest.json'));\n const { appId } =\n manifestContent.appType === 'platform-app'\n ? verifyManifest(manifestContent, platformAppManifestSchemaV1)\n : manifestContent;\n\n if (!noVerify) {\n Logger.info('Performing type checks...');\n await promiseExec('npx tsc --noEmit');\n\n Logger.info('Performing eslint checks...');\n await promiseExec('npx eslint src');\n }\n\n try {\n await compile({ projectPath, entryFile, outputName: appId });\n } catch (error) {\n Logger.error(error as string);\n process.exit(-1);\n }\n\n const buildFilesToIgnore = BUILD_FILE_BLOCK_LIST.map((path) =>\n fastGlob.convertPathToPattern(projectPath + path),\n );\n\n const gitignoreEntries = readFileLinesAsArray(join(projectPath, '.gitignore')).filter(\n (entry) => entry !== 'manifest.json',\n );\n\n const sourceFilesToIgnore = [...gitignoreEntries, ...SOURCE_FILE_BLOCK_LIST].map((path) => {\n if (path.includes('*')) {\n return `${projectPath}/${path}`;\n }\n return fastGlob.convertPathToPattern(`${projectPath}/${path}`);\n });\n\n const request = {\n build_files: await makeFilesDict(\n fastGlob.convertPathToPattern(`${projectPath}/${distPath}`),\n buildFilesToIgnore,\n ),\n source_files: await makeFilesDict(fastGlob.convertPathToPattern(projectPath), sourceFilesToIgnore),\n };\n\n if (!dryRun) {\n Logger.info('Sending the files to Frontify Marketplace...');\n\n const httpClient = new HttpClient(instanceUrl);\n\n try {\n await httpClient.put(`/api/marketplace/app/${appId}`, request, {\n headers: { Authorization: `Bearer ${accessToken}` },\n });\n\n Logger.success('The new version has been pushed.');\n\n if (openInBrowser) {\n Logger.info('Opening the Frontify Marketplace page...');\n await open(`https://${instanceUrl}/marketplace/apps/${appId}`);\n }\n } catch (error) {\n Logger.error('An error occured while deploying:', (error as HttpClientError).responseBody.error);\n process.exit(-1);\n }\n } else {\n Logger.success('The command has been executed without any issue.');\n process.exit(0);\n }\n }\n } catch (error) {\n if (typeof error === 'string') {\n Logger.error('The deployment has failed and was aborted due to an error:', error);\n } else if (error instanceof Error) {\n Logger.error('The deployment has failed and was aborted due to an error:', error.message);\n } else {\n Logger.error('The deployment has failed and was aborted due to an unknown error.');\n }\n process.exit(-1);\n }\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport FastifyCors from '@fastify/cors';\nimport Fastify from 'fastify';\nimport open from 'open';\n\nimport { Configuration, HttpClient, Logger, getUser, getValidInstanceUrl } from '../utils/index';\n\nexport interface OauthRandomCodeChallenge {\n secret: string;\n sha256: string;\n}\n\nexport interface OauthAccessTokenApiResponse {\n access_token: string;\n refresh_token: string;\n expires_in: number;\n token_type: string;\n}\n\nexport class Authenticator {\n private readonly instanceUrl: string;\n private readonly port: number;\n\n private readonly httpClient: HttpClient;\n private readonly fastifyServer = Fastify();\n\n private randomChallenge: OauthRandomCodeChallenge | undefined;\n\n constructor(instanceUrl: string, port = 5600) {\n this.instanceUrl = instanceUrl;\n this.port = port;\n\n this.httpClient = new HttpClient(instanceUrl);\n }\n\n serveCallbackServer(): void {\n this.registerPlugins();\n this.registerRoutes();\n\n this.fastifyServer.listen({ port: this.port });\n }\n\n private registerRoutes(): void {\n this.fastifyServer.get<{ Querystring: { code: string } }>('/oauth', async (req, res) => {\n Logger.info('Access granted, getting access token...');\n res.send('You can close this window.');\n\n const tokens = await this.getOauthCredentialDetails(req.query.code);\n Logger.info('Tokens received, storing tokens...');\n Configuration.set('tokens', tokens);\n Configuration.set('instanceUrl', this.instanceUrl);\n\n const user = await getUser(this.instanceUrl);\n if (user) {\n Logger.success(`Welcome back ${user.name} (${this.instanceUrl})!`);\n }\n\n process.exit(0);\n });\n }\n\n private registerPlugins(): void {\n this.fastifyServer.register(FastifyCors);\n }\n\n async storeRandomCodeChallenge(): Promise<void> {\n try {\n const randomCodeChallenge = await this.httpClient.get<{ data: OauthRandomCodeChallenge }>(\n '/api/oauth/random',\n );\n this.randomChallenge = randomCodeChallenge.data;\n } catch (error) {\n const errorText = error instanceof Error ? error.message : String(error);\n throw new Error(`An error occurred while getting the random challenge: ${errorText}`);\n }\n }\n\n getLoginUrl(): string {\n if (!this.randomChallenge) {\n throw new Error('Random challenge needs to be defined.');\n }\n\n const queryParams = [\n 'response_type=code',\n 'client_id=block-cli',\n 'redirect_uri=http://localhost:5600/oauth',\n 'scope=basic:read%2Bblocks:read%2Bblocks:write',\n `code_challenge=${this.randomChallenge.sha256}`,\n 'code_challenge_method=S256',\n ].join('&');\n\n return `https://${this.instanceUrl}/api/oauth/authorize?${queryParams}`;\n }\n\n async getOauthCredentialDetails(authorizationCode: string): Promise<OauthAccessTokenApiResponse> {\n if (!this.randomChallenge) {\n throw new Error('Random challenge needs to be defined.');\n }\n\n try {\n const tokens = await this.httpClient.post<OauthAccessTokenApiResponse>('/api/oauth/accesstoken', {\n grant_type: 'authorization_code',\n client_id: 'block-cli',\n redirect_uri: 'http://localhost:5600/oauth',\n scope: 'basic:read%2Bblocks:read%2Bblocks:write',\n code_verifier: this.randomChallenge.secret,\n code: authorizationCode,\n });\n\n return tokens;\n } catch (error) {\n const errorText = error instanceof Error ? error.message : String(error);\n throw new Error(`An error occurred while getting tokens: ${errorText}`);\n }\n }\n}\n\nexport const loginUser = async (instanceUrl: string, port: number): Promise<void> => {\n try {\n const cleanedInstanceUrl = getValidInstanceUrl(instanceUrl);\n const authenticator = new Authenticator(cleanedInstanceUrl, port);\n authenticator.serveCallbackServer();\n await authenticator.storeRandomCodeChallenge();\n\n const loginUrl = authenticator.getLoginUrl();\n\n Logger.info('Attempting to open OAuth login page...');\n Logger.info(\n `If a browser window doesn't automatically open, please open the following link manually: ${loginUrl}`,\n );\n await open(loginUrl);\n } catch (error) {\n const errorText = error instanceof Error ? error.message : String(error);\n Logger.error(`You need to enter a valid Frontify instance URL: ${errorText}`);\n process.exit(-1);\n }\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { Configuration } from '../utils/configuration';\nimport { Logger } from '../utils/logger';\n\nexport const logoutUser = (): void => {\n Configuration.delete('tokens');\n // TODO: Call API endpoint\n Logger.info('You are now logged out.');\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport react from '@vitejs/plugin-react';\nimport { createServer } from 'vite';\nimport { viteExternalsPlugin } from 'vite-plugin-externals';\n\nimport pkg from '../../package.json';\nimport { getAppBridgeVersion } from '../utils/appBridgeVersion';\n\nexport class BlockDevelopmentServer {\n constructor(\n private readonly entryFilePath: string,\n private readonly port: number,\n private readonly allowExternal: boolean,\n ) {}\n\n async serve(): Promise<void> {\n try {\n const viteServer = await createServer({\n root: process.cwd(),\n plugins: [\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n react(),\n viteExternalsPlugin({\n react: 'React',\n 'react-dom': 'ReactDOM',\n }),\n ],\n define: {\n 'process.env.NODE_ENV': JSON.stringify('development'),\n 'DevCustomBlock.dependencies.appBridge': JSON.stringify(getAppBridgeVersion(process.cwd())),\n },\n base: `http://localhost:${this.port}/`,\n appType: 'custom',\n server: {\n port: this.port,\n host: this.allowExternal ? '0.0.0.0' : 'localhost',\n cors: true,\n hmr: {\n port: this.port,\n host: this.allowExternal ? '0.0.0.0' : 'localhost',\n protocol: 'ws',\n },\n },\n });\n\n viteServer.middlewares.use('/', (req, res, next) => {\n if (req.url !== '/') {\n return next();\n }\n\n res.writeHead(200);\n return res.end('OK');\n });\n\n viteServer.middlewares.use('/_entrypoint', (req, res, next) => {\n if (req.url !== '/') {\n return next();\n }\n\n res.setHeader('Content-Type', 'application/json');\n res.writeHead(200);\n return res.end(\n JSON.stringify({\n url: `http://localhost:${this.port}/${this.entryFilePath}`,\n entryFilePath: this.entryFilePath,\n port: this.port,\n version: pkg.version,\n }),\n );\n });\n\n const server = await viteServer.listen(this.port, true);\n server.printUrls();\n } catch (error) {\n console.error(error);\n process.exit(1);\n }\n }\n}\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport path from 'node:path';\n\nimport react from '@vitejs/plugin-react';\nimport * as esbuild from 'esbuild';\nimport { createServer } from 'vite';\n\nexport class PlatformAppDevelopmentServer {\n constructor(\n private readonly entryFilePath: string,\n private readonly port: number,\n ) {}\n\n async serve(): Promise<void> {\n try {\n const settingsSchema = await esbuild.context({\n entryPoints: [this.entryFilePath],\n outfile: './dist/dev-settings.js',\n minify: true,\n globalName: 'devSettings',\n format: 'iife',\n bundle: true,\n loader: {\n '.css': 'empty',\n },\n });\n\n const viteServerDev = await createServer({\n root: process.cwd(),\n configFile: false,\n define: {\n 'process.env.NODE_ENV': JSON.stringify('development'),\n },\n server: { cors: true },\n plugins: [\n react(),\n {\n name: 'prebuild-commands',\n handleHotUpdate: ({ file, server }) => {\n const relativeFilePath = path.relative(process.cwd(), file);\n\n if (relativeFilePath === 'src/settings.ts' || relativeFilePath === 'src/index.ts') {\n // if the change is either in settings.ts or index.ts do a rebuild to load settings\n settingsSchema.rebuild();\n server.restart();\n }\n },\n buildStart: () => {\n settingsSchema.rebuild();\n },\n },\n ],\n });\n\n const server = await viteServerDev.listen(this.port, true);\n server.printUrls();\n } catch (error) {\n console.error(error);\n process.exit(1);\n }\n }\n}\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport react from '@vitejs/plugin-react';\nimport { createServer } from 'vite';\nimport { viteExternalsPlugin } from 'vite-plugin-externals';\n\nimport pkg from '../../package.json';\nimport { getAppBridgeThemeVersion } from '../utils/appBridgeThemeVersion';\n\nexport class ThemeDevelopmentServer {\n constructor(\n private readonly entryFilePath: string,\n private readonly port: number,\n private readonly allowExternal: boolean,\n ) {}\n\n async serve(): Promise<void> {\n try {\n const viteServer = await createServer({\n root: process.cwd(),\n plugins: [\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n react(),\n viteExternalsPlugin({\n react: 'React',\n 'react-dom': 'ReactDOM',\n }),\n ],\n define: {\n 'process.env.NODE_ENV': JSON.stringify('development'),\n 'DevCustomTheme.dependencies.appBridgeTheme': JSON.stringify(\n getAppBridgeThemeVersion(process.cwd()),\n ),\n },\n base: `http://localhost:${this.port}/`,\n appType: 'custom',\n server: {\n port: this.port,\n host: this.allowExternal ? '0.0.0.0' : 'localhost',\n cors: true,\n hmr: {\n port: this.port,\n host: this.allowExternal ? '0.0.0.0' : 'localhost',\n protocol: 'ws',\n },\n },\n });\n\n viteServer.middlewares.use('/', (req, res, next) => {\n if (req.url !== '/') {\n return next();\n }\n\n res.writeHead(200);\n return res.end('OK');\n });\n\n viteServer.middlewares.use('/_entrypoint', (req, res, next) => {\n if (req.url !== '/') {\n return next();\n }\n\n res.setHeader('Content-Type', 'application/json');\n res.writeHead(200);\n return res.end(\n JSON.stringify({\n url: `http://localhost:${this.port}/${this.entryFilePath}`,\n entryFilePath: this.entryFilePath,\n port: this.port,\n version: pkg.version,\n }),\n );\n });\n\n const server = await viteServer.listen(this.port, true);\n server.printUrls();\n } catch (error) {\n console.error(error);\n process.exit(1);\n }\n }\n}\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { BlockDevelopmentServer } from '../servers/blockDevelopmentServer';\nimport { PlatformAppDevelopmentServer } from '../servers/platformAppDevelopmentServer';\nimport { ThemeDevelopmentServer } from '../servers/themeDevelopmentServer';\nimport { Logger } from '../utils/logger';\n\nexport const createDevelopmentServer = async (\n entryFilePath: string,\n port: number,\n allowExternal: boolean,\n): Promise<void> => {\n Logger.info('Starting the development server...');\n\n const developmentServer = new BlockDevelopmentServer(entryFilePath, port, allowExternal);\n await developmentServer.serve();\n};\n\nexport const createDevelopmentServerForTheme = async (\n entryFilePath: string,\n port: number,\n allowExternal: boolean,\n): Promise<void> => {\n Logger.info('Starting the development server for theme...');\n\n const developmentServer = new ThemeDevelopmentServer(entryFilePath, port, allowExternal);\n await developmentServer.serve();\n};\n\nexport const createDevelopmentServerForPlatformApp = async (entryFilePath: string, port: number): Promise<void> => {\n Logger.info('Starting the development server for Apps...');\n\n const developmentServer = new PlatformAppDevelopmentServer(entryFilePath, port);\n await developmentServer.serve();\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { resolve } from 'node:path';\nimport { fileURLToPath } from 'node:url';\n\nimport pc from 'picocolors';\n\nimport { generateGitignoreFile, Logger, copyFolder, updatePackageJsonProjectName } from '../utils/index';\n\nexport const createNewApp = (appName: string, template: string, type: string): void => {\n Logger.info(`Creating the ${type}...`);\n\n const appInBlue = pc.blue(`./${appName}`);\n Logger.info(`Scaffolding App in ${appInBlue}...`);\n\n const templateDir = resolve(fileURLToPath(import.meta.url), `../../templates/${type}-${template}`);\n copyFolder(templateDir, appName, { exclude: ['node_modules'] });\n\n generateGitignoreFile(appName, type);\n updatePackageJsonProjectName(appName);\n\n Logger.defaultInfo(`\\n${Logger.spacer(11)}You can now access the project and install dependencies.`);\n const appNameInBlue = pc.blue(`./${appName}`);\n Logger.defaultInfo(`${Logger.spacer(4)}cd ${appNameInBlue}`);\n Logger.defaultInfo(`${Logger.spacer(4)}npm i`);\n Logger.defaultInfo(`${Logger.spacer(4)}npm run serve`);\n\n Logger.defaultInfo(`\\n${Logger.spacer(11)}Happy hacking!`);\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { join } from 'node:path';\nimport { exit } from 'node:process';\n\nimport { cac } from 'cac';\nimport prompts from 'prompts';\n\nimport pkg from '../package.json';\n\nimport {\n type AppManifest,\n createDeployment,\n createDevelopmentServer,\n createDevelopmentServerForPlatformApp,\n createDevelopmentServerForTheme,\n createNewApp,\n loginUser,\n logoutUser,\n} from './commands/index';\nimport {\n compileBlock,\n compilePlatformApp,\n compileTheme,\n getValidInstanceUrl,\n isValidName,\n reactiveJson,\n} from './utils/index';\n\nconst cli = cac(pkg.name.split('/')[1]);\n\ncli.command('login [instanceUrl]', 'log in to a Frontify instance')\n .option('-i, --instance <instanceUrl>', '[string] url of the Frontify instance')\n .option('-p, --port <port>', '[number] port for the oauth service', {\n default: process.env.PORT || 5600,\n })\n .action(async (instanceUrl: string, options) => {\n const computedInstanceUrl = instanceUrl || options.instance || process.env.INSTANCE_URL;\n if (computedInstanceUrl) {\n prompts.inject([computedInstanceUrl]);\n }\n\n const { promptedInstanceUrl } = await prompts([\n {\n type: 'text',\n name: 'promptedInstanceUrl',\n message: 'Enter a Frontify instance URL',\n initial: 'instanceName.frontify.com',\n validate: (value: string) => (value.trim() === '' ? 'You need to enter a valid URL.' : true),\n },\n ]);\n\n if (!promptedInstanceUrl) {\n exit(0);\n }\n\n const parsedInstanceUrl = getValidInstanceUrl(promptedInstanceUrl);\n\n await loginUser(parsedInstanceUrl, options.port);\n });\n\ncli.command('logout', 'log out of an instance').action(logoutUser);\n\n/**\n * @deprecated `block serve` and `theme serve` will be removed in version 4.0 in favour of `serve`\n */\nfor (const appType of ['block', 'theme']) {\n cli.command(`${appType} serve`, `[deprecated: use 'serve' instead] serve the ${appType} locally`)\n .alias(`${appType} dev`)\n .option('-e, --entryPath, --entry-path <entryPath>', `[string] path to the ${appType} entry file`, {\n default: join('src', 'index.tsx'),\n })\n .option('--port <port>', '[number] specify port', {\n default: process.env.PORT || 5600,\n })\n .option('--allowExternal, --allow-external', '[boolean] allow external IPs to access the server', {\n default: false,\n })\n .action(async (options) => {\n await createDevelopmentServer(options.entryPath, options.port, options.allowExternal);\n });\n}\n\ncli.command('serve', 'serve the app locally')\n .alias('dev')\n .option('-e, --entryPath, --entry-path <entryPath>', '[string] path to the entry file', {\n default: join('src', 'index.ts'),\n })\n .option('--port <port>', '[number] specify port', {\n default: process.env.PORT || 5600,\n })\n .option('--allowExternal, --allow-external', '[boolean] allow external IPs to access the server', {\n default: false,\n })\n .option('--appType <appType>, --app-type', '[string] specify app type. Overrides manifest values')\n .action(async (options) => {\n const manifest = reactiveJson<AppManifest>(join(process.cwd(), 'manifest.json'));\n const appType = options.appType || manifest.appType;\n\n if (appType === 'platform-app') {\n await createDevelopmentServerForPlatformApp(options.entryPath, options.port);\n } else if (appType === 'theme') {\n await createDevelopmentServerForTheme(options.entryPath, options.port, options.allowExternal);\n } else {\n await createDevelopmentServer(options.entryPath, options.port, options.allowExternal);\n }\n });\n\n/**\n * @deprecated `block deploy` and `theme deploy` will be removed in version 4.0 in favour of `deploy`\n */\nfor (const appType of ['block', 'theme']) {\n cli.command(`${appType} deploy`, `[deprecated: use 'deploy' instead] deploy the ${appType} to the marketplace`)\n .option('-e, --entryPath <entryPath>', '[string] path to the entry file', { default: join('src', 'index.tsx') })\n .option('-o, --outDir <outDir>', '[string] path to the output directory', { default: 'dist' })\n .option('--dryRun, --dry-run', '[boolean] enable the dry run mode', { default: false })\n .option('--noVerify, --no-verify', '[boolean] disable the linting and typechecking', { default: false })\n .option('--open', '[boolean] open the marketplace app page', { default: false })\n .action(async (options) => {\n await createDeployment(\n options.entryPath,\n options.outDir,\n {\n dryRun: options.dryRun,\n noVerify: options.noVerify,\n openInBrowser: options.open,\n },\n appType === 'theme' ? compileTheme : compileBlock,\n );\n });\n}\n\ncli.command('deploy', 'deploy the app to the marketplace')\n .option('-e, --entryPath <entryPath>', '[string] path to the entry file', { default: join('src', 'index.ts') })\n .option('-o, --outDir <outDir>', '[string] path to the output directory', { default: 'dist' })\n .option('--dryRun, --dry-run', '[boolean] enable the dry run mode', { default: false })\n .option('--noVerify, --no-verify', '[boolean] disable the linting and typechecking', { default: false })\n .option('--open', '[boolean] open the marketplace app page', { default: false })\n .option('--appType [appType], --app-type', '[string] specify app type. Overrides manifest values')\n .option('-i, --instance <instanceUrl>', '[string] url of the Frontify instance')\n .option('-t, --token <accessToken>', '[string] the access token')\n .action(async (options) => {\n const manifest = reactiveJson<AppManifest>(join(process.cwd(), 'manifest.json'));\n const appType = options.appType || manifest.appType;\n\n if (appType === 'platform-app') {\n await createDeployment(\n options.entryPath,\n options.outDir,\n {\n dryRun: options.dryRun,\n noVerify: options.noVerify,\n openInBrowser: options.open,\n instance: options.instance,\n token: options.token,\n },\n compilePlatformApp,\n );\n } else if (appType === 'theme') {\n await createDeployment(\n options.entryPath,\n options.outDir,\n {\n dryRun: options.dryRun,\n noVerify: options.noVerify,\n openInBrowser: options.open,\n instance: options.instance,\n token: options.token,\n },\n compileTheme,\n );\n } else {\n await createDeployment(\n options.entryPath,\n options.outDir,\n {\n dryRun: options.dryRun,\n noVerify: options.noVerify,\n openInBrowser: options.open,\n instance: options.instance,\n token: options.token,\n },\n compileBlock,\n );\n }\n });\n\ncli.command('create [appName]', 'create a new marketplace app').action(async (appName: string) => {\n const { promptedAppName, stylingFramework, appType } = await prompts([\n {\n type: 'text',\n name: 'promptedAppName',\n message: 'Enter your app name',\n initial: appName || 'my-frontify-app',\n validate: (value: string) => {\n if (value.trim() === '') {\n return 'You need to enter an app name.';\n }\n\n return isValidName(value);\n },\n },\n {\n type: 'select',\n name: 'appType',\n message: 'Select the type of your app',\n choices: [\n { title: 'App', value: 'platform-app' },\n { title: 'Block', value: 'content-block' },\n ],\n },\n {\n type: 'select',\n name: 'stylingFramework',\n message: 'Choose a styling framework',\n choices: [\n { title: 'Tailwind', value: 'tailwind' },\n { title: 'CSS Modules', value: 'css-modules' },\n { title: 'None', value: 'css' },\n ],\n },\n ]);\n\n if (!promptedAppName || !stylingFramework || !appType) {\n exit(0);\n }\n\n createNewApp(promptedAppName, stylingFramework, appType);\n});\n\n/**\n * @deprecated `block create` and `theme create` will be removed in version 4.0 in favour of `create`\n */\nfor (const appType of ['block', 'theme']) {\n cli.command(\n `${appType} create [appName]`,\n `[deprecated: use 'create' instead] create a ${appType} app locally`,\n ).action((appName: string) => createNewApp(appName, 'css-modules', 'content-block'));\n}\n\ncli.help();\ncli.version(pkg.version);\n\nconst mergeOldBlockThemeCommands = (cliArgs: string[]) => {\n const oldCommandIndex = cliArgs.findIndex((value) => value === 'block' || value === 'theme');\n if (\n oldCommandIndex !== -1 &&\n (cliArgs[oldCommandIndex + 1] === 'serve' ||\n cliArgs[oldCommandIndex + 1] === 'deploy' ||\n cliArgs[oldCommandIndex + 1] === 'create')\n ) {\n cliArgs[oldCommandIndex] = `${cliArgs[oldCommandIndex]} ${cliArgs[oldCommandIndex + 1]}`;\n cliArgs.splice(oldCommandIndex + 1, 1);\n }\n\n return cliArgs;\n};\n\ncli.parse(mergeOldBlockThemeCommands(process.argv));\n"],"names":["getCurrentTime","now","Logger","messages","pc","width","FileNotFoundError","path","ParseJsonError","reactiveJson","jsonRaw","readFileSync","jsonParsed","obj","prop","value","jsonString","writeFileSync","error","getAppBridgeVersion","rootPath","join","Configuration","Conf","key","isDirectoryEmpty","folderPath","readdirSync","copyFolder","sourceFolderPath","destinationFolderPath","options","mkdirSync","excludePatterns","glob","globToRegExp","file","re","srcFile","resolve","destFile","copyFile","sourceFilePath","destinationFilePath","statSync","copyFileSync","readFile","filePath","readFileAsBase64","readFileLinesAsArray","line","HttpClientError","code","responseBody","HttpClient","baseUrl","method","url","body","response","fetch","responseJson","responseText","errorData","relativeUrl","updatePackageJsonProjectName","packageJsonPath","packageJson","isValidName","folderName","CommandExecutionError","promiseExec","command","reject","exec","stdout","InvalidInstanceUrlError","getValidInstanceUrl","cleanHost","URL","getUser","instanceUrl","token","httpClient","accessToken","generateGitignoreFile","type","gitignorePath","gitignoreTemplate","compilePlatformApp","outputName","entryFile","projectPath","appBridgeVersion","settings","build","react","viteExternalsPlugin","compileBlock","getAppBridgeThemeVersion","compileTheme","forbiddenExtensions","getForbiddenExtensionsErrorMessage","surfaceName","assetCreationShape","object","string","completeAssetType","z","imageAssetType","iconLibraryFilenameExtension","logoLibraryFilenameExtension","appType","secretKeySet","secretSchema","secretsArraySchema","array","requestOptionsSchema","endpointNameSet","endpointCallSchema","name","hostnameRegex","ScopeEnum","permissionsSchema","scopes","KeyTypeLabelSchema","ActionSchema","number","ActionsArraySchema","platformAppManifestSchemaV1","boolean","verifyManifest","manifest","schema","validatedManifest","makeFilesDict","ignoreGlobs","folderFiles","fastGlob","stack","filename","index","BUILD_FILE_BLOCK_LIST","SOURCE_FILE_BLOCK_LIST","createDeployment","distPath","dryRun","noVerify","openInBrowser","instance","compile","user","manifestContent","appId","buildFilesToIgnore","sourceFilesToIgnore","entry","request","open","Authenticator","port","Fastify","req","res","tokens","FastifyCors","randomCodeChallenge","errorText","queryParams","authorizationCode","loginUser","cleanedInstanceUrl","authenticator","loginUrl","logoutUser","BlockDevelopmentServer","entryFilePath","allowExternal","viteServer","createServer","next","pkg","PlatformAppDevelopmentServer","settingsSchema","esbuild","server","relativeFilePath","ThemeDevelopmentServer","createDevelopmentServer","createDevelopmentServerForTheme","createDevelopmentServerForPlatformApp","createNewApp","appName","template","appInBlue","templateDir","fileURLToPath","appNameInBlue","cli","cac","computedInstanceUrl","prompts","promptedInstanceUrl","exit","parsedInstanceUrl","promptedAppName","stylingFramework","mergeOldBlockThemeCommands","cliArgs","oldCommandIndex"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAEaA,IAAiB,MAAc;AACxC,QAAMC,wBAAU,KAAA;AAChB,SAAO,GAAG,OAAOA,EAAI,SAAA,CAAU,EAAE,SAAS,GAAG,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;AAEAV,EAAI,MAAMS,GAA2B,QAAQ,IAAI,CAAC;"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@frontify/frontify-cli",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "5.9.
|
|
4
|
+
"version": "5.9.5",
|
|
5
5
|
"author": "Frontify Developers <developers@frontify.com>",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -20,39 +20,38 @@
|
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@fastify/cors": "^9.0.1",
|
|
23
|
-
"@vitejs/plugin-react": "^
|
|
23
|
+
"@vitejs/plugin-react": "^5.1.1",
|
|
24
24
|
"archiver": "^7.0.1",
|
|
25
25
|
"cac": "^6.7.14",
|
|
26
|
-
"conf": "^
|
|
27
|
-
"esbuild": "^0.
|
|
28
|
-
"fast-glob": "^3.3.
|
|
29
|
-
"fastify": "^4.
|
|
26
|
+
"conf": "^15.0.2",
|
|
27
|
+
"esbuild": "^0.27.0",
|
|
28
|
+
"fast-glob": "^3.3.3",
|
|
29
|
+
"fastify": "^4.29.1",
|
|
30
30
|
"glob-to-regexp": "^0.4.1",
|
|
31
31
|
"node-fetch": "^3.3.2",
|
|
32
|
-
"open": "^
|
|
33
|
-
"picocolors": "^1.
|
|
32
|
+
"open": "^11.0.0",
|
|
33
|
+
"picocolors": "^1.1.1",
|
|
34
34
|
"prompts": "^2.4.2",
|
|
35
|
-
"vite": "^5.4.
|
|
35
|
+
"vite": "^5.4.21",
|
|
36
36
|
"vite-plugin-externals": "^0.6.2",
|
|
37
37
|
"zod": "^3.25.76"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@frontify/eslint-config-basic": "^1.0.
|
|
40
|
+
"@frontify/eslint-config-basic": "^1.0.8",
|
|
41
41
|
"@types/glob-to-regexp": "^0.4.4",
|
|
42
42
|
"@types/mock-fs": "^4.13.4",
|
|
43
|
-
"@types/node": "^
|
|
43
|
+
"@types/node": "^20.19.25",
|
|
44
44
|
"@types/prompts": "^2.4.9",
|
|
45
45
|
"@types/ws": "8.18.1",
|
|
46
|
-
"@vitest/coverage-v8": "
|
|
47
|
-
"@vitest/ui": "^
|
|
48
|
-
"eslint": "^9.
|
|
46
|
+
"@vitest/coverage-v8": "4.0.15",
|
|
47
|
+
"@vitest/ui": "^4.0.15",
|
|
48
|
+
"eslint": "^9.39.1",
|
|
49
49
|
"eslint-plugin-notice": "^1.0.0",
|
|
50
50
|
"nock": "^13.5.6",
|
|
51
|
-
"prettier": "^3.
|
|
51
|
+
"prettier": "^3.7.4",
|
|
52
52
|
"ts-node": "^10.9.2",
|
|
53
|
-
"typescript": "^5.9.
|
|
54
|
-
"
|
|
55
|
-
"vitest": "^3.2.4"
|
|
53
|
+
"typescript": "^5.9.3",
|
|
54
|
+
"vitest": "^4.0.15"
|
|
56
55
|
},
|
|
57
56
|
"scripts": {
|
|
58
57
|
"build": "vite build",
|
|
@@ -14,18 +14,18 @@
|
|
|
14
14
|
"zustand": "4.5.5"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@frontify/app-bridge": "^3.
|
|
17
|
+
"@frontify/app-bridge": "^3.12.0",
|
|
18
18
|
"react": "^18.2.0",
|
|
19
19
|
"react-dom": "^18.2.0"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@frontify/eslint-config-react": "^0.17.6",
|
|
23
|
-
"@frontify/frontify-cli": "^5.
|
|
24
|
-
"@frontify/guideline-blocks-settings": "^0.
|
|
25
|
-
"@types/react": "^18.
|
|
26
|
-
"@types/react-dom": "^18.
|
|
23
|
+
"@frontify/frontify-cli": "^5.9.4",
|
|
24
|
+
"@frontify/guideline-blocks-settings": "^1.0.12",
|
|
25
|
+
"@types/react": "^18.3.27",
|
|
26
|
+
"@types/react-dom": "^18.3.7",
|
|
27
27
|
"eslint": "^8.57.0",
|
|
28
|
-
"prettier": "^3.
|
|
29
|
-
"typescript": "^5.
|
|
28
|
+
"prettier": "^3.7.4",
|
|
29
|
+
"typescript": "^5.9.3"
|
|
30
30
|
}
|
|
31
31
|
}
|
|
@@ -14,18 +14,18 @@
|
|
|
14
14
|
"zustand": "4.5.5"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@frontify/app-bridge": "^3.
|
|
17
|
+
"@frontify/app-bridge": "^3.12.0",
|
|
18
18
|
"react": "^18.2.0",
|
|
19
19
|
"react-dom": "^18.2.0"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@frontify/eslint-config-react": "^0.17.6",
|
|
23
|
-
"@frontify/frontify-cli": "^5.
|
|
24
|
-
"@frontify/guideline-blocks-settings": "^0.
|
|
25
|
-
"@types/react": "^18.
|
|
26
|
-
"@types/react-dom": "^18.
|
|
27
|
-
"eslint": "^8.57.
|
|
28
|
-
"prettier": "^3.
|
|
29
|
-
"typescript": "^5.
|
|
23
|
+
"@frontify/frontify-cli": "^5.9.4",
|
|
24
|
+
"@frontify/guideline-blocks-settings": "^1.0.12",
|
|
25
|
+
"@types/react": "^18.3.27",
|
|
26
|
+
"@types/react-dom": "^18.3.7",
|
|
27
|
+
"eslint": "^8.57.1",
|
|
28
|
+
"prettier": "^3.7.4",
|
|
29
|
+
"typescript": "^5.9.3"
|
|
30
30
|
}
|
|
31
31
|
}
|
|
@@ -14,20 +14,20 @@
|
|
|
14
14
|
"zustand": "4.5.5"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@frontify/app-bridge": "^3.
|
|
17
|
+
"@frontify/app-bridge": "^3.12.0",
|
|
18
18
|
"react": "^18.2.0",
|
|
19
19
|
"react-dom": "^18.2.0"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@frontify/eslint-config-react": "^0.17.6",
|
|
23
|
-
"@frontify/frontify-cli": "^5.
|
|
24
|
-
"@frontify/guideline-blocks-settings": "^0.
|
|
25
|
-
"@types/react": "^18.
|
|
26
|
-
"@types/react-dom": "^18.
|
|
27
|
-
"autoprefixer": "^10.4.
|
|
28
|
-
"eslint": "^8.57.
|
|
29
|
-
"prettier": "^3.
|
|
23
|
+
"@frontify/frontify-cli": "^5.9.4",
|
|
24
|
+
"@frontify/guideline-blocks-settings": "^1.0.12",
|
|
25
|
+
"@types/react": "^18.3.27",
|
|
26
|
+
"@types/react-dom": "^18.3.7",
|
|
27
|
+
"autoprefixer": "^10.4.22",
|
|
28
|
+
"eslint": "^8.57.1",
|
|
29
|
+
"prettier": "^3.7.4",
|
|
30
30
|
"tailwindcss": "^3.4.3",
|
|
31
|
-
"typescript": "^5.
|
|
31
|
+
"typescript": "^5.9.3"
|
|
32
32
|
}
|
|
33
33
|
}
|
|
@@ -14,23 +14,23 @@
|
|
|
14
14
|
"zustand": "4.5.5"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@frontify/app-bridge-app": "^0.1.
|
|
18
|
-
"@frontify/fondue": "^12.
|
|
19
|
-
"@frontify/platform-app": "^0.1.
|
|
17
|
+
"@frontify/app-bridge-app": "^0.1.11",
|
|
18
|
+
"@frontify/fondue": "^12.14.4",
|
|
19
|
+
"@frontify/platform-app": "^0.1.20",
|
|
20
20
|
"react": "^18.3.1",
|
|
21
21
|
"react-dom": "^18.3.1"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@eslint/js": "^9.
|
|
25
|
-
"@frontify/frontify-cli": "^5.
|
|
24
|
+
"@eslint/js": "^9.39.1",
|
|
25
|
+
"@frontify/frontify-cli": "^5.9.4",
|
|
26
26
|
"@types/react": "^18.3.3",
|
|
27
27
|
"@types/react-dom": "^18.3.0",
|
|
28
|
-
"eslint": "^9.
|
|
28
|
+
"eslint": "^9.39.1",
|
|
29
29
|
"eslint-plugin-react-hooks": "^5.1.0-rc.0",
|
|
30
|
-
"eslint-plugin-react-refresh": "^0.4.
|
|
31
|
-
"globals": "^
|
|
32
|
-
"prettier": "^3.
|
|
33
|
-
"typescript": "^5.
|
|
34
|
-
"typescript-eslint": "^8.
|
|
30
|
+
"eslint-plugin-react-refresh": "^0.4.24",
|
|
31
|
+
"globals": "^16.5.0",
|
|
32
|
+
"prettier": "^3.7.4",
|
|
33
|
+
"typescript": "^5.9.3",
|
|
34
|
+
"typescript-eslint": "^8.48.1"
|
|
35
35
|
}
|
|
36
36
|
}
|
|
@@ -14,23 +14,23 @@
|
|
|
14
14
|
"zustand": "4.5.5"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@frontify/app-bridge-app": "^0.1.
|
|
18
|
-
"@frontify/fondue": "^12.
|
|
19
|
-
"@frontify/platform-app": "^0.1.
|
|
17
|
+
"@frontify/app-bridge-app": "^0.1.11",
|
|
18
|
+
"@frontify/fondue": "^12.14.4",
|
|
19
|
+
"@frontify/platform-app": "^0.1.20",
|
|
20
20
|
"react": "^18.3.1",
|
|
21
21
|
"react-dom": "^18.3.1"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@eslint/js": "^9.
|
|
25
|
-
"@frontify/frontify-cli": "^5.
|
|
24
|
+
"@eslint/js": "^9.39.1",
|
|
25
|
+
"@frontify/frontify-cli": "^5.9.4",
|
|
26
26
|
"@types/react": "^18.3.3",
|
|
27
27
|
"@types/react-dom": "^18.3.0",
|
|
28
|
-
"eslint": "^9.
|
|
28
|
+
"eslint": "^9.39.1",
|
|
29
29
|
"eslint-plugin-react-hooks": "^5.1.0-rc.0",
|
|
30
|
-
"eslint-plugin-react-refresh": "^0.4.
|
|
31
|
-
"globals": "^
|
|
32
|
-
"prettier": "^3.
|
|
33
|
-
"typescript": "^5.
|
|
34
|
-
"typescript-eslint": "^8.
|
|
30
|
+
"eslint-plugin-react-refresh": "^0.4.24",
|
|
31
|
+
"globals": "^16.5.0",
|
|
32
|
+
"prettier": "^3.7.4",
|
|
33
|
+
"typescript": "^5.9.3",
|
|
34
|
+
"typescript-eslint": "^8.48.1"
|
|
35
35
|
}
|
|
36
36
|
}
|
|
@@ -14,26 +14,26 @@
|
|
|
14
14
|
"zustand": "4.5.5"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@frontify/app-bridge-app": "^0.1.
|
|
18
|
-
"@frontify/fondue": "^12.
|
|
19
|
-
"@frontify/platform-app": "^0.1.
|
|
17
|
+
"@frontify/app-bridge-app": "^0.1.11",
|
|
18
|
+
"@frontify/fondue": "^12.14.4",
|
|
19
|
+
"@frontify/platform-app": "^0.1.20",
|
|
20
20
|
"react": "^18.3.1",
|
|
21
21
|
"react-dom": "^18.3.1"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@eslint/js": "^9.
|
|
25
|
-
"@frontify/frontify-cli": "^5.
|
|
24
|
+
"@eslint/js": "^9.39.1",
|
|
25
|
+
"@frontify/frontify-cli": "^5.9.4",
|
|
26
26
|
"@types/react": "^18.3.3",
|
|
27
27
|
"@types/react-dom": "^18.3.0",
|
|
28
|
-
"autoprefixer": "^10.4.
|
|
29
|
-
"eslint": "^9.
|
|
28
|
+
"autoprefixer": "^10.4.22",
|
|
29
|
+
"eslint": "^9.39.1",
|
|
30
30
|
"eslint-plugin-react-hooks": "^5.1.0-rc.0",
|
|
31
|
-
"eslint-plugin-react-refresh": "^0.4.
|
|
32
|
-
"globals": "^
|
|
33
|
-
"postcss": "^8.
|
|
34
|
-
"prettier": "^3.
|
|
31
|
+
"eslint-plugin-react-refresh": "^0.4.24",
|
|
32
|
+
"globals": "^16.5.0",
|
|
33
|
+
"postcss": "^8.5.6",
|
|
34
|
+
"prettier": "^3.7.4",
|
|
35
35
|
"tailwindcss": "^3.4.3",
|
|
36
|
-
"typescript": "^5.
|
|
37
|
-
"typescript-eslint": "^8.
|
|
36
|
+
"typescript": "^5.9.3",
|
|
37
|
+
"typescript-eslint": "^8.48.1"
|
|
38
38
|
}
|
|
39
39
|
}
|