@frontify/frontify-cli 5.9.3 → 5.9.4

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 CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import ue, { join as d, resolve as O } from "node:path";
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 Se } from "node:url";
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 g, array as l, number as te, boolean as $e } from "zod";
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.3", Fe = "Frontify Developers <developers@frontify.com>", Ue = {
24
+ const De = "@frontify/frontify-cli", Oe = "module", Ae = "5.9.4", 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"
@@ -122,7 +122,7 @@ class Le extends Error {
122
122
  super(), this.name = "ParseJsonError", s.error(`The file at "${t}" could not be parsed.`);
123
123
  }
124
124
  }
125
- const S = (e) => {
125
+ const $ = (e) => {
126
126
  try {
127
127
  const t = B(e, "utf8"), n = JSON.parse(t);
128
128
  return new Proxy(n, {
@@ -135,7 +135,7 @@ const S = (e) => {
135
135
  } catch (t) {
136
136
  throw t instanceof SyntaxError ? new Le(e) : t.code === "ENOENT" ? new U(e) : new Error(t);
137
137
  }
138
- }, L = (e) => S(d(e, "package.json")).dependencies["@frontify/app-bridge"];
138
+ }, L = (e) => $(m(e, "package.json")).dependencies["@frontify/app-bridge"];
139
139
  class k {
140
140
  static {
141
141
  this.conf = new ve({
@@ -162,7 +162,7 @@ const Ve = (e) => {
162
162
  ye(t, { recursive: !0 });
163
163
  const r = n?.exclude.map((o) => be(o));
164
164
  for (const o of ee(e)) {
165
- if (r !== void 0 && r.some((f) => f.test(o)))
165
+ if (r !== void 0 && r.some((u) => u.test(o)))
166
166
  continue;
167
167
  const i = O(e, o), p = O(t, o);
168
168
  Je(i, p);
@@ -209,12 +209,12 @@ class V {
209
209
  if (i.status === 200)
210
210
  switch (i.headers.get("Content-Type")) {
211
211
  case "application/json": {
212
- const f = await i.json();
213
- return f || void 0;
212
+ const u = await i.json();
213
+ return u || void 0;
214
214
  }
215
215
  default: {
216
- const f = await i.text();
217
- return f || void 0;
216
+ const u = await i.text();
217
+ return u || void 0;
218
218
  }
219
219
  }
220
220
  else {
@@ -239,7 +239,7 @@ class V {
239
239
  }
240
240
  }
241
241
  const qe = (e) => {
242
- const t = O(e, "package.json"), n = S(t);
242
+ const t = O(e, "package.json"), n = $(t);
243
243
  n.name = e;
244
244
  }, 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
245
  class Ke extends Error {
@@ -277,7 +277,7 @@ const re = (e) => {
277
277
  return;
278
278
  }
279
279
  }, We = (e, t) => {
280
- const n = d(e, ".gitignore");
280
+ const n = m(e, ".gitignore");
281
281
  X(n, Qe[t]);
282
282
  }, Qe = {
283
283
  "platform-app": `# Logs
@@ -395,7 +395,7 @@ dist
395
395
  }
396
396
  }
397
397
  });
398
- }, ae = (e) => S(d(e, "package.json")).dependencies["@frontify/app-bridge-theme"], ie = async ({ projectPath: e, entryFile: t, outputName: n }) => {
398
+ }, ae = (e) => $(m(e, "package.json")).dependencies["@frontify/app-bridge-theme"], ie = async ({ projectPath: e, entryFile: t, outputName: n }) => {
399
399
  const r = ae(e);
400
400
  return A({
401
401
  plugins: [
@@ -432,9 +432,9 @@ dist
432
432
  }
433
433
  }
434
434
  });
435
- }, y = ["exe", "dmg", "cmd", "sh", "bat"], v = (e) => `Invalid file extension, \`${e}.filenameExtension\` can not include: ${y.join(", ")}.`, T = c({
435
+ }, g = ["exe", "dmg", "cmd", "sh", "bat"], v = (e) => `Invalid file extension, \`${e}.filenameExtension\` can not include: ${g.join(", ")}.`, T = c({
436
436
  title: a().min(1).max(40)
437
- }).optional(), P = g.enum(["audio", "document", "image", "video", "file", "embeddedContent"]), z = P.exclude(["audio", "document", "video", "file", "embeddedContent"]), H = g.enum(["svg"]), Y = g.enum(["svg", "jpg", "jpeg", "ai", "eps", "png", "tif", "tiff"]), et = g.enum(["content-block", "platform-app", "theme"]), q = /* @__PURE__ */ new Set(), tt = c({
437
+ }).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
438
  label: a(),
439
439
  key: a().min(1).max(80).refine(
440
440
  (e) => q.has(e) ? !1 : (q.add(e), /^\w+$/.test(e)),
@@ -443,9 +443,9 @@ dist
443
443
  }
444
444
  )
445
445
  }), nt = l(tt), rt = c({
446
- method: g.enum(["GET", "POST", "PUT", "DELETE"]),
447
- headers: g.record(a()).optional(),
448
- body: g.any().optional()
446
+ method: w.enum(["GET", "POST", "PUT", "DELETE"]),
447
+ headers: w.record(a()).optional(),
448
+ body: w.any().optional()
449
449
  }), Z = /* @__PURE__ */ new Set(), ot = c({
450
450
  name: a().refine(
451
451
  (e) => Z.has(e) ? !1 : (Z.add(e), /^[\w-]*$/.test(e)),
@@ -455,7 +455,7 @@ dist
455
455
  ),
456
456
  resource: a(),
457
457
  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 = g.enum(["basic:read", "basic:write", "account:read", "webhook:read", "webhook:write"]), it = c({
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 = w.enum(["basic:read", "basic:write", "account:read", "webhook:read", "webhook:write"]), it = c({
459
459
  permissions: c({
460
460
  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
461
  message: "'basic:read' is required in scopes"
@@ -476,7 +476,7 @@ dist
476
476
  }), lt = l(ct).optional(), pt = c({
477
477
  appId: a().length(25),
478
478
  appType: et,
479
- experimental: $e().optional(),
479
+ experimental: Se().optional(),
480
480
  secrets: nt.optional(),
481
481
  network: c({
482
482
  allowedHosts: l(
@@ -492,14 +492,14 @@ dist
492
492
  }).optional(),
493
493
  surfaces: c({
494
494
  guideline: c({
495
- themeAction: c({
495
+ pageAction: c({
496
496
  title: a().min(2).max(28)
497
497
  }).optional(),
498
498
  assetViewer: c({
499
499
  title: a().min(2).max(28),
500
500
  type: l(P),
501
501
  filenameExtension: l(
502
- a().refine((e) => !y.includes(e), {
502
+ a().refine((e) => !g.includes(e), {
503
503
  message: v("guideline")
504
504
  })
505
505
  )
@@ -509,7 +509,7 @@ dist
509
509
  assetBulkActions: c({
510
510
  title: a().min(2).max(28),
511
511
  filenameExtensions: l(
512
- a().refine((e) => !y.includes(e), {
512
+ a().refine((e) => !g.includes(e), {
513
513
  message: v("mediaLibrary")
514
514
  })
515
515
  )
@@ -518,7 +518,7 @@ dist
518
518
  title: a().min(2).max(28),
519
519
  type: l(P),
520
520
  filenameExtension: l(
521
- a().refine((e) => !y.includes(e), {
521
+ a().refine((e) => !g.includes(e), {
522
522
  message: v("mediaLibrary")
523
523
  })
524
524
  )
@@ -553,7 +553,7 @@ dist
553
553
  assetBulkActions: c({
554
554
  title: a().min(2).max(28),
555
555
  filenameExtensions: l(
556
- a().refine((e) => !y.includes(e), {
556
+ a().refine((e) => !g.includes(e), {
557
557
  message: v("documentLibrary")
558
558
  })
559
559
  )
@@ -562,7 +562,7 @@ dist
562
562
  title: a().min(2).max(28),
563
563
  type: l(P),
564
564
  filenameExtension: l(
565
- a().refine((e) => !y.includes(e), {
565
+ a().refine((e) => !g.includes(e), {
566
566
  message: v("documentLibrary")
567
567
  })
568
568
  )
@@ -573,7 +573,7 @@ dist
573
573
  assetBulkActions: c({
574
574
  title: a().min(2).max(28),
575
575
  filenameExtensions: l(
576
- a().refine((e) => !y.includes(e), {
576
+ a().refine((e) => !g.includes(e), {
577
577
  message: v("workspaceProject")
578
578
  })
579
579
  )
@@ -582,7 +582,7 @@ dist
582
582
  title: a().min(2).max(28),
583
583
  type: l(P),
584
584
  filenameExtension: l(
585
- a().refine((e) => !y.includes(e), {
585
+ a().refine((e) => !g.includes(e), {
586
586
  message: v("workspaceProject")
587
587
  })
588
588
  )
@@ -601,52 +601,61 @@ dist
601
601
  }, G = async (e, t) => {
602
602
  const n = await E(`${E.convertPathToPattern(e)}/**`, { ignore: t, dot: !0 });
603
603
  return n.map((o) => o.replace(`${e}/`, "")).reduce((o, i, p) => (o[`/${i}`] = ze(n[p]), o), {});
604
- }, mt = ["**/*.*.map"], ft = [".git", "node_modules", "dist", ".vscode", ".idea", "README.md", ".DS_Store"], D = async (e, t, { dryRun: n = !1, noVerify: r = !1, openInBrowser: o = !1, token: i, instance: p }, f) => {
604
+ }, mt = ["**/*.*.map"], ft = [
605
+ ".git",
606
+ "node_modules",
607
+ "dist",
608
+ ".vscode",
609
+ ".idea",
610
+ ".eslintignore",
611
+ ".prettierignore",
612
+ "README.md",
613
+ ".DS_Store",
614
+ "**/*.graphql"
615
+ ], D = async (e, t, { dryRun: n = !1, noVerify: r = !1, openInBrowser: o = !1, token: i, instance: p }, u) => {
605
616
  try {
606
- let u;
607
- const $ = p || k.get("instanceUrl"), J = i || k.get("tokens.access_token");
608
- if ((!J || !$) && (s.error(
617
+ let h;
618
+ const S = p || k.get("instanceUrl"), J = i || k.get("tokens.access_token");
619
+ if ((!J || !S) && (s.error(
609
620
  `You are currently not logged in. You can use the command ${b.bold(
610
621
  "frontify-cli login"
611
622
  )} to log in, or pass --token=<token> --instance=<instance> to the deploy command.`
612
- ), process.exit(-1)), n || (u = await oe($, i), u && s.info(`You are logged in as ${u.name} (${$}).`)), u || n) {
623
+ ), process.exit(-1)), n || (h = await oe(S, i), h && s.info(`You are logged in as ${h.name} (${S}).`)), h || n) {
613
624
  n && s.info(b.blue("Dry run: enabled"));
614
- const w = process.cwd(), R = S(d(w, "manifest.json")), { appId: _ } = R.appType === "platform-app" ? dt(R, pt) : R;
625
+ const y = process.cwd(), R = $(m(y, "manifest.json")), { appId: _ } = R.appType === "platform-app" ? dt(R, pt) : R;
615
626
  r || (s.info("Performing type checks..."), await M("npx tsc --noEmit"), s.info("Performing eslint checks..."), await M("npx eslint src"));
616
627
  try {
617
- await f({ projectPath: w, entryFile: e, outputName: _ });
618
- } catch (h) {
619
- s.error(h), process.exit(-1);
628
+ await u({ projectPath: y, entryFile: e, outputName: _ });
629
+ } catch (d) {
630
+ s.error(d), process.exit(-1);
620
631
  }
621
632
  const pe = mt.map(
622
- (h) => E.convertPathToPattern(w + h)
623
- ), de = [...He(d(w, ".gitignore")).filter(
624
- (h) => h !== "manifest.json"
625
- ), ...ft].map(
626
- (h) => E.convertPathToPattern(`${w}/${h}`)
627
- ), me = {
633
+ (d) => E.convertPathToPattern(y + d)
634
+ ), de = [...He(m(y, ".gitignore")).filter(
635
+ (d) => d !== "manifest.json"
636
+ ), ...ft].map((d) => d.includes("*") ? `${y}/${d}` : E.convertPathToPattern(`${y}/${d}`)), me = {
628
637
  build_files: await G(
629
- E.convertPathToPattern(`${w}/${t}`),
638
+ E.convertPathToPattern(`${y}/${t}`),
630
639
  pe
631
640
  ),
632
- source_files: await G(E.convertPathToPattern(w), de)
641
+ source_files: await G(E.convertPathToPattern(y), de)
633
642
  };
634
643
  if (n)
635
644
  s.success("The command has been executed without any issue."), process.exit(0);
636
645
  else {
637
646
  s.info("Sending the files to Frontify Marketplace...");
638
- const h = new V($);
647
+ const d = new V(S);
639
648
  try {
640
- await h.put(`/api/marketplace/app/${_}`, me, {
649
+ await d.put(`/api/marketplace/app/${_}`, me, {
641
650
  headers: { Authorization: `Bearer ${J}` }
642
- }), s.success("The new version has been pushed."), o && (s.info("Opening the Frontify Marketplace page..."), await Q(`https://${$}/marketplace/apps/${_}`));
651
+ }), s.success("The new version has been pushed."), o && (s.info("Opening the Frontify Marketplace page..."), await Q(`https://${S}/marketplace/apps/${_}`));
643
652
  } catch (fe) {
644
653
  s.error("An error occured while deploying:", fe.responseBody.error), process.exit(-1);
645
654
  }
646
655
  }
647
656
  }
648
- } catch (u) {
649
- typeof u == "string" ? s.error("The deployment has failed and was aborted due to an error:", u) : u instanceof Error ? s.error("The deployment has failed and was aborted due to an error:", u.message) : s.error("The deployment has failed and was aborted due to an unknown error."), process.exit(-1);
657
+ } catch (h) {
658
+ 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
659
  }
651
660
  };
652
661
  class ut {
@@ -874,14 +883,14 @@ const ce = async (e, t, n) => {
874
883
  s.info(`Creating the ${n}...`);
875
884
  const r = b.blue(`./${e}`);
876
885
  s.info(`Scaffolding App in ${r}...`);
877
- const o = O(Se(import.meta.url), `../../templates/${n}-${t}`);
886
+ const o = O($e(import.meta.url), `../../templates/${n}-${t}`);
878
887
  ne(o, e, { exclude: ["node_modules"] }), We(e, n), qe(e), s.defaultInfo(`
879
888
  ${s.spacer(11)}You can now access the project and install dependencies.`);
880
889
  const i = b.blue(`./${e}`);
881
890
  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
891
  ${s.spacer(11)}Happy hacking!`);
883
- }, m = he(F.name.split("/")[1]);
884
- m.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", {
892
+ }, f = he(F.name.split("/")[1]);
893
+ 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
894
  default: process.env.PORT || 5600
886
895
  }).action(async (e, t) => {
887
896
  const n = e || t.instance || process.env.INSTANCE_URL;
@@ -899,10 +908,10 @@ m.command("login [instanceUrl]", "log in to a Frontify instance").option("-i, --
899
908
  const o = re(r);
900
909
  await ht(o, t.port);
901
910
  });
902
- m.command("logout", "log out of an instance").action(yt);
911
+ f.command("logout", "log out of an instance").action(yt);
903
912
  for (const e of ["block", "theme"])
904
- m.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`, {
905
- default: d("src", "index.tsx")
913
+ 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`, {
914
+ default: m("src", "index.tsx")
906
915
  }).option("--port <port>", "[number] specify port", {
907
916
  default: process.env.PORT || 5600
908
917
  }).option("--allowExternal, --allow-external", "[boolean] allow external IPs to access the server", {
@@ -910,18 +919,18 @@ for (const e of ["block", "theme"])
910
919
  }).action(async (t) => {
911
920
  await ce(t.entryPath, t.port, t.allowExternal);
912
921
  });
913
- m.command("serve", "serve the app locally").alias("dev").option("-e, --entryPath, --entry-path <entryPath>", "[string] path to the entry file", {
914
- default: d("src", "index.ts")
922
+ f.command("serve", "serve the app locally").alias("dev").option("-e, --entryPath, --entry-path <entryPath>", "[string] path to the entry file", {
923
+ default: m("src", "index.ts")
915
924
  }).option("--port <port>", "[number] specify port", {
916
925
  default: process.env.PORT || 5600
917
926
  }).option("--allowExternal, --allow-external", "[boolean] allow external IPs to access the server", {
918
927
  default: !1
919
928
  }).option("--appType <appType>, --app-type", "[string] specify app type. Overrides manifest values").action(async (e) => {
920
- const t = S(d(process.cwd(), "manifest.json")), n = e.appType || t.appType;
929
+ const t = $(m(process.cwd(), "manifest.json")), n = e.appType || t.appType;
921
930
  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
931
  });
923
932
  for (const e of ["block", "theme"])
924
- m.command(`${e} deploy`, `[deprecated: use 'deploy' instead] deploy the ${e} to the marketplace`).option("-e, --entryPath <entryPath>", "[string] path to the entry file", { default: d("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) => {
933
+ 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
934
  await D(
926
935
  t.entryPath,
927
936
  t.outDir,
@@ -933,8 +942,8 @@ for (const e of ["block", "theme"])
933
942
  e === "theme" ? ie : se
934
943
  );
935
944
  });
936
- m.command("deploy", "deploy the app to the marketplace").option("-e, --entryPath <entryPath>", "[string] path to the entry file", { default: d("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) => {
937
- const t = S(d(process.cwd(), "manifest.json")), n = e.appType || t.appType;
945
+ 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) => {
946
+ const t = $(m(process.cwd(), "manifest.json")), n = e.appType || t.appType;
938
947
  n === "platform-app" ? await D(
939
948
  e.entryPath,
940
949
  e.outDir,
@@ -970,7 +979,7 @@ m.command("deploy", "deploy the app to the marketplace").option("-e, --entryPath
970
979
  se
971
980
  );
972
981
  });
973
- m.command("create [appName]", "create a new marketplace app").action(async (e) => {
982
+ f.command("create [appName]", "create a new marketplace app").action(async (e) => {
974
983
  const { promptedAppName: t, stylingFramework: n, appType: r } = await j([
975
984
  {
976
985
  type: "text",
@@ -1002,15 +1011,15 @@ m.command("create [appName]", "create a new marketplace app").action(async (e) =
1002
1011
  (!t || !n || !r) && W(0), le(t, n, r);
1003
1012
  });
1004
1013
  for (const e of ["block", "theme"])
1005
- m.command(
1014
+ f.command(
1006
1015
  `${e} create [appName]`,
1007
1016
  `[deprecated: use 'create' instead] create a ${e} app locally`
1008
1017
  ).action((t) => le(t, "css-modules", "content-block"));
1009
- m.help();
1010
- m.version(F.version);
1018
+ f.help();
1019
+ f.version(F.version);
1011
1020
  const Et = (e) => {
1012
1021
  const t = e.findIndex((n) => n === "block" || n === "theme");
1013
1022
  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
1023
  };
1015
- m.parse(Et(process.argv));
1024
+ f.parse(Et(process.argv));
1016
1025
  //# sourceMappingURL=index.mjs.map
@@ -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;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7C;AAAA,IAEJ;AAAA,MACI,MAAM;AAAA,MACN,MAAM;AAAA,MACN,SAAS;AAAA,MACT,SAAS;AAAA,QACL,EAAE,OAAO,YAAY,OAAO,WAAA;AAAA,QAC5B,EAAE,OAAO,eAAe,OAAO,cAAA;AAAA,QAC/B,EAAE,OAAO,QAAQ,OAAO,MAAA;AAAA,MAAM;AAAA,IAClC;AAAA,EACJ,CACH;AAED,GAAI,CAAC8L,KAAmB,CAACC,KAAoB,CAAC9F,MAC1C2F,EAAK,CAAC,GAGVZ,GAAac,GAAiBC,GAAkB9F,CAAO;AAC3D,CAAC;AAKD,WAAWA,KAAW,CAAC,SAAS,OAAO;AACnC,EAAAsF,EAAI;AAAA,IACA,GAAGtF,CAAO;AAAA,IACV,+CAA+CA,CAAO;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,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,KAAK,GAAG,CAAC,EAAE,CAAC;AAAA,EACvE;AAAA,EAEA,OAAO,OAAOE,IAAQ,GAAW;AAC7B,WAAO,MAAMA,IAAQ,CAAC,EAAE,KAAK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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;"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@frontify/frontify-cli",
3
3
  "type": "module",
4
- "version": "5.9.3",
4
+ "version": "5.9.4",
5
5
  "author": "Frontify Developers <developers@frontify.com>",
6
6
  "repository": {
7
7
  "type": "git",