@frontify/frontify-cli 5.10.1 → 5.10.3
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 +7 -65
- package/dist/index.mjs.map +1 -1
- package/package.json +11 -10
package/dist/index.mjs
CHANGED
|
@@ -21,62 +21,7 @@ import { object as c, string as a, z as w, array as l, number as te, boolean as
|
|
|
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.10.
|
|
25
|
-
type: "git",
|
|
26
|
-
url: "https://github.com/Frontify/brand-sdk",
|
|
27
|
-
directory: "packages/cli"
|
|
28
|
-
}, Re = {
|
|
29
|
-
"frontify-cli": "dist/index.mjs"
|
|
30
|
-
}, _e = [
|
|
31
|
-
"dist",
|
|
32
|
-
"templates"
|
|
33
|
-
], Ie = {
|
|
34
|
-
node: ">=18"
|
|
35
|
-
}, je = {
|
|
36
|
-
build: "vite build",
|
|
37
|
-
format: "prettier --write .",
|
|
38
|
-
lint: "eslint .",
|
|
39
|
-
"lint:fix": "eslint --fix .",
|
|
40
|
-
start: "npm run build && node dist/index.mjs",
|
|
41
|
-
test: "vitest run --silent",
|
|
42
|
-
"test:watch": "vitest",
|
|
43
|
-
"test:coverage": "vitest run --coverage",
|
|
44
|
-
"test:ui": "vitest --ui",
|
|
45
|
-
typecheck: "tsc --noEmit"
|
|
46
|
-
}, Ne = {
|
|
47
|
-
"@fastify/cors": "^11.2.0",
|
|
48
|
-
"@vitejs/plugin-react": "^5.1.3",
|
|
49
|
-
archiver: "^7.0.1",
|
|
50
|
-
cac: "^6.7.14",
|
|
51
|
-
conf: "^15.0.2",
|
|
52
|
-
esbuild: "^0.27.2",
|
|
53
|
-
"fast-glob": "^3.3.3",
|
|
54
|
-
fastify: "^5.7.4",
|
|
55
|
-
"glob-to-regexp": "^0.4.1",
|
|
56
|
-
"node-fetch": "^3.3.2",
|
|
57
|
-
open: "^11.0.0",
|
|
58
|
-
picocolors: "^1.1.1",
|
|
59
|
-
prompts: "^2.4.2",
|
|
60
|
-
vite: "^5.4.21",
|
|
61
|
-
"vite-plugin-externals": "^0.6.2",
|
|
62
|
-
zod: "^3.25.76"
|
|
63
|
-
}, Be = {
|
|
64
|
-
"@frontify/eslint-config-basic": "^1.0.8",
|
|
65
|
-
"@types/glob-to-regexp": "^0.4.4",
|
|
66
|
-
"@types/mock-fs": "^4.13.4",
|
|
67
|
-
"@types/node": "^20.19.25",
|
|
68
|
-
"@types/prompts": "^2.4.9",
|
|
69
|
-
"@types/ws": "8.18.1",
|
|
70
|
-
"@vitest/coverage-v8": "4.0.18",
|
|
71
|
-
"@vitest/ui": "^4.0.18",
|
|
72
|
-
eslint: "^9.39.2",
|
|
73
|
-
"eslint-plugin-notice": "^1.0.0",
|
|
74
|
-
nock: "^13.5.6",
|
|
75
|
-
prettier: "^3.7.4",
|
|
76
|
-
"ts-node": "^10.9.2",
|
|
77
|
-
typescript: "^5.9.3",
|
|
78
|
-
vitest: "^4.0.18"
|
|
79
|
-
}, F = {
|
|
24
|
+
const De = "@frontify/frontify-cli", Oe = "module", Ae = "5.10.3", Fe = "Frontify Developers <developers@frontify.com>", Ue = { type: "git", url: "https://github.com/Frontify/brand-sdk", directory: "packages/cli" }, Re = { "frontify-cli": "dist/index.mjs" }, _e = ["dist", "templates"], Ie = { node: ">=18" }, je = { build: "vite build", dev: "vite build --watch", format: "prettier --write .", lint: "eslint .", "lint:fix": "eslint --fix .", start: "npm run build && node dist/index.mjs", test: "vitest run --silent", "test:watch": "vitest", "test:coverage": "vitest run --coverage", "test:ui": "vitest --ui", typecheck: "tsc --noEmit" }, Ne = { "@fastify/cors": "^11.2.0", "@vitejs/plugin-react": "^5.2.0", archiver: "^7.0.1", cac: "^6.7.14", conf: "^15.1.0", esbuild: "^0.27.4", "fast-glob": "^3.3.3", fastify: "^5.8.4", "glob-to-regexp": "^0.4.1", "node-fetch": "^3.3.2", open: "^11.0.0", picocolors: "^1.1.1", prompts: "^2.4.2", vite: "^7.3.1", "vite-plugin-externals": "^0.6.2", zod: "^3.25.76" }, Be = { "@frontify/eslint-config-basic": "^1.0.8", "@types/glob-to-regexp": "^0.4.4", "@types/mock-fs": "^4.13.4", "@types/node": "^20.19.25", "@types/prompts": "^2.4.9", "@types/ws": "8.18.1", "@vitest/coverage-v8": "4.1.2", "@vitest/ui": "^4.1.2", eslint: "^9.39.4", "eslint-plugin-notice": "^1.0.0", nock: "^13.5.6", prettier: "^3.7.4", "ts-node": "^10.9.2", typescript: "^5.9.3", vitest: "^4.1.2" }, F = {
|
|
80
25
|
name: De,
|
|
81
26
|
type: Oe,
|
|
82
27
|
version: Ae,
|
|
@@ -206,15 +151,12 @@ class V {
|
|
|
206
151
|
headers: { "Content-Type": "application/json", ...o?.headers }
|
|
207
152
|
});
|
|
208
153
|
if (i.status === 200)
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
const u = await i.text();
|
|
216
|
-
return u || void 0;
|
|
217
|
-
}
|
|
154
|
+
if (i.headers.get("Content-Type") === "application/json") {
|
|
155
|
+
const u = await i.json();
|
|
156
|
+
return u || void 0;
|
|
157
|
+
} else {
|
|
158
|
+
const u = await i.text();
|
|
159
|
+
return u || void 0;
|
|
218
160
|
}
|
|
219
161
|
else {
|
|
220
162
|
const p = await i.json();
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../src/utils/date.ts","../src/utils/logger.ts","../src/errors/FileNotFoundError.ts","../src/errors/ParseJsonError.ts","../src/utils/reactiveJson.ts","../src/utils/appBridgeVersion.ts","../src/utils/configuration.ts","../src/utils/file.ts","../src/errors/HttpClientError.ts","../src/utils/httpClient.ts","../src/utils/npm.ts","../src/errors/CommandExecutionError.ts","../src/utils/promiseExec.ts","../src/errors/InvalidInstanceUrlError.ts","../src/utils/url.ts","../src/utils/user.ts","../src/utils/gitignoreTemplate.ts","../src/utils/compiler/compilePlatformApp.ts","../src/utils/compiler/compileBlock.ts","../src/utils/appBridgeThemeVersion.ts","../src/utils/compiler/compileTheme.ts","../src/utils/verifyManifest.ts","../src/commands/deploy.ts","../src/commands/login.ts","../src/commands/logout.ts","../src/servers/blockDevelopmentServer.ts","../src/servers/platformAppDevelopmentServer.ts","../src/servers/themeDevelopmentServer.ts","../src/commands/serve.ts","../src/commands/create.ts","../src/index.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nexport const getCurrentTime = (): string => {\n const now = new Date();\n return `${String(now.getHours()).padStart(2, '0')}:${String(now.getMinutes()).padStart(2, '0')}:${String(\n now.getSeconds(),\n ).padStart(2, '0')}`;\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport pc from 'picocolors';\n\nimport { getCurrentTime } from './date';\n\nexport class Logger {\n static defaultInfo(...messages: string[]): void {\n console.log(Logger.spacer(10), ...messages);\n }\n\n static info(...messages: string[]): void {\n console.log(`[${getCurrentTime()}] ${messages.join(' ')}`);\n }\n\n static success(...messages: string[]): void {\n console.log(`[${getCurrentTime()}] ${pc.green(messages.join(' '))}`);\n }\n\n static error(...messages: string[]): void {\n console.error(pc.red(`[${getCurrentTime()}] ${messages.join(' ')}`));\n }\n\n static spacer(width = 1): string {\n return Array(width + 1).join(' ');\n }\n}\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { Logger } from '../utils/logger';\n\nexport default class FileNotFoundError extends Error {\n readonly name = 'FileNotFoundError';\n constructor(path: string) {\n super();\n Logger.error(`The file at \"${path}\" was not found.`);\n }\n}\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { Logger } from '../utils/logger';\n\nexport default class ParseJsonError extends Error {\n readonly name = 'ParseJsonError';\n constructor(path: string) {\n super();\n Logger.error(`The file at \"${path}\" could not be parsed.`);\n }\n}\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { readFileSync, writeFileSync } from 'node:fs';\n\nimport FileNotFoundError from '../errors/FileNotFoundError';\nimport ParseJsonError from '../errors/ParseJsonError';\n\nexport const reactiveJson = <T>(path: string): T => {\n try {\n const jsonRaw = readFileSync(path, 'utf8');\n const jsonParsed = JSON.parse(jsonRaw);\n\n return new Proxy(jsonParsed, {\n set: (obj, prop, value) => {\n obj[prop] = value;\n\n const jsonString = JSON.stringify(obj, null, '\\t');\n\n writeFileSync(path, jsonString);\n\n return true;\n },\n });\n } catch (error) {\n if (error instanceof SyntaxError) {\n throw new ParseJsonError(path);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } else if ((error as any).code === 'ENOENT') {\n throw new FileNotFoundError(path);\n }\n\n throw new Error(error as string);\n }\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { join } from 'node:path';\n\nimport { type PackageJson } from './npm';\nimport { reactiveJson } from './reactiveJson';\n\nexport const getAppBridgeVersion = (rootPath: string) => {\n const packageJson = reactiveJson<PackageJson>(join(rootPath, 'package.json'));\n return packageJson.dependencies['@frontify/app-bridge'];\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport Conf from 'conf';\n\nexport class Configuration {\n private static readonly conf = new Conf<Record<string, string | undefined>>({\n projectName: 'frontify-cli',\n });\n\n static set(key: string, value: unknown): void {\n this.conf.set(key, value);\n }\n\n static get(key: string): string | undefined {\n return this.conf.get(key, undefined);\n }\n\n static delete(key: string): void {\n return this.conf.delete(key);\n }\n}\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { copyFileSync, mkdirSync, readFileSync, readdirSync, statSync } from 'node:fs';\nimport { resolve } from 'node:path';\n\nimport globToRegExp from 'glob-to-regexp';\n\nimport FileNotFoundError from '../errors/FileNotFoundError';\n\nexport const isDirectoryEmpty = (folderPath: string): boolean => {\n try {\n return readdirSync(folderPath).length === 0;\n } catch {\n return true;\n }\n};\n\nexport const copyFolder = (\n sourceFolderPath: string,\n destinationFolderPath: string,\n options?: { exclude: string[] },\n) => {\n mkdirSync(destinationFolderPath, { recursive: true });\n const excludePatterns = options?.exclude.map((glob) => globToRegExp(glob));\n\n for (const file of readdirSync(sourceFolderPath)) {\n if (excludePatterns !== undefined && excludePatterns.some((re) => re.test(file))) {\n continue;\n }\n const srcFile = resolve(sourceFolderPath, file);\n const destFile = resolve(destinationFolderPath, file);\n copyFile(srcFile, destFile);\n }\n};\n\nexport const copyFile = (sourceFilePath: string, destinationFilePath: string) => {\n const stat = statSync(sourceFilePath);\n if (stat.isDirectory()) {\n copyFolder(sourceFilePath, destinationFilePath);\n } else {\n copyFileSync(sourceFilePath, destinationFilePath);\n }\n};\n\nexport const readFile = (filePath: string): string => {\n try {\n return readFileSync(filePath, 'utf-8');\n } catch {\n throw new FileNotFoundError(filePath);\n }\n};\n\nexport const readFileAsBase64 = (filePath: string): string => {\n try {\n return readFileSync(filePath, 'base64');\n } catch {\n throw new FileNotFoundError(filePath);\n }\n};\n\nexport const readFileLinesAsArray = (filePath: string): string[] => {\n try {\n const content = readFile(filePath);\n return content.split(/\\r?\\n/).filter((line) => line !== '');\n } catch {\n throw new FileNotFoundError(filePath);\n }\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nexport class HttpClientError extends Error {\n public code = 0;\n public responseBody: { sucess: false; error: string };\n\n constructor(code: number, responseBody: { sucess: false; error: string }) {\n super(`Status code ${code}`);\n this.name = 'HttpClientError';\n this.code = code;\n this.responseBody = responseBody;\n }\n}\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport fetch from 'node-fetch';\n\nimport { HttpClientError } from '../errors/HttpClientError';\n\ninterface RequestOptions {\n headers?: {\n Authorization?: string;\n };\n}\n\ninterface FetchParameters {\n method: 'GET' | 'POST' | 'PUT' | 'DELETE';\n url: string;\n body?: Record<string, unknown>;\n options?: RequestOptions;\n}\n\nexport class HttpClient {\n private readonly baseUrl: string;\n\n constructor(baseUrl: string) {\n this.baseUrl = baseUrl.replace(/^https?:\\/\\//, '');\n }\n\n private async fetchExtended<T>({ method, url, body, options }: FetchParameters): Promise<T> {\n const response = await fetch(this.getAbsoluteUrl(url), {\n method,\n ...(body && {\n body: JSON.stringify(body),\n }),\n ...options,\n headers: { 'Content-Type': 'application/json', ...options?.headers },\n });\n\n if (response.status === 200) {\n const contentType = response.headers.get('Content-Type');\n\n switch (contentType) {\n case 'application/json': {\n const responseJson = await response.json();\n if (!responseJson) {\n return undefined as T;\n }\n return responseJson as T;\n }\n default: {\n const responseText = await response.text();\n if (!responseText) {\n return undefined as T;\n }\n return responseText as T;\n }\n }\n } else {\n const errorData = (await response.json()) as { sucess: false; error: string };\n throw new HttpClientError(response.status, errorData);\n }\n }\n\n public get<T>(url: string, options?: RequestOptions): Promise<T> {\n return this.fetchExtended<T>({ url, method: 'GET', options });\n }\n\n public post<T>(url: string, body?: Record<string, unknown>, options?: RequestOptions): Promise<T> {\n return this.fetchExtended({ url, method: 'POST', body, options });\n }\n\n public put<T>(url: string, body?: Record<string, unknown>, options?: RequestOptions): Promise<T> {\n return this.fetchExtended({ url, method: 'PUT', body, options });\n }\n\n public delete<T>(url: string, options?: RequestOptions): Promise<T> {\n return this.fetchExtended({ url, method: 'DELETE', options });\n }\n\n private getAbsoluteUrl(relativeUrl: string): string {\n return `https://${this.baseUrl}${relativeUrl}`;\n }\n}\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { resolve } from 'node:path';\n\nimport { isDirectoryEmpty } from './file';\nimport { reactiveJson } from './reactiveJson';\n\nexport type PackageJson = {\n name: string;\n version: string;\n main: string;\n dependencies: Record<string, string>;\n};\n\nexport const updatePackageJsonProjectName = (folderPath: string): void => {\n const packageJsonPath = resolve(folderPath, 'package.json');\n const packageJson = reactiveJson<PackageJson>(packageJsonPath);\n packageJson.name = folderPath;\n};\n\nexport const isValidName = (folderName: string): true | string => {\n if (!folderName) {\n return 'The content block name can not be empty.';\n } else if (!/^[_a-z-]+$/.test(folderName)) {\n return 'The project name needs to be \"a-z\" separated by \"-\" or \"_\".';\n } else if (!isDirectoryEmpty(folderName)) {\n return `The directory ./${folderName} already exist.`;\n } else {\n return true;\n }\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { Logger } from '../utils/logger';\n\nexport default class CommandExecutionError extends Error {\n readonly name = 'CommandExecutionError';\n constructor(error: string) {\n super();\n Logger.error(`The command execution failed: ${error}`);\n }\n}\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type ExecOptions, exec } from 'node:child_process';\n\nimport CommandExecutionError from '../errors/CommandExecutionError';\n\nexport const promiseExec = (command: string, options: ExecOptions = {}): Promise<string> => {\n return new Promise((resolve, reject) => {\n exec(command, options, (error, stdout) => {\n if (error) {\n // @ts-expect-error node typing change\n // eslint-disable-next-line @typescript-eslint/restrict-plus-operands\n return reject(new CommandExecutionError(error + stdout));\n } else {\n // @ts-expect-error node typing change\n return resolve(stdout);\n }\n });\n });\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { Logger } from '../utils/logger';\n\nexport default class InvalidInstanceUrlError extends Error {\n readonly name = 'InvalidInstanceUrlError';\n constructor(url: string) {\n super();\n if (url) {\n Logger.error(`The given URL \"${url}\" is invalid.`);\n } else {\n Logger.error('No instance URL was given.');\n }\n }\n}\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { URL } from 'node:url';\n\nimport InvalidInstanceUrlError from '../errors/InvalidInstanceUrlError';\n\nexport const getValidInstanceUrl = (url: string): string => {\n try {\n const cleanHost = url.replace(/^https?:\\/\\//, '');\n const parsedUrl = new URL(`https://${cleanHost}`);\n return parsedUrl.hostname;\n } catch {\n throw new InvalidInstanceUrlError(url);\n }\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport pc from 'picocolors';\n\nimport { Configuration } from './configuration';\nimport { HttpClient } from './httpClient';\nimport { Logger } from './logger';\n\nexport interface UserInfo {\n name: string;\n email: string;\n}\n\nexport const getUser = async (instanceUrl: string, token?: string): Promise<UserInfo | undefined> => {\n const httpClient = new HttpClient(instanceUrl);\n const accessToken = token || Configuration.get('tokens.access_token');\n\n try {\n const user = await httpClient.post<{ data: { currentUser: UserInfo } }>(\n '/graphql',\n { query: '{ currentUser { email name } }' },\n { headers: { Authorization: `Bearer ${accessToken}` } },\n );\n return user.data.currentUser;\n } catch {\n Logger.error(\n `You are currently not logged in. You can use the command ${pc.bold('frontify-cli login')} to log in.`,\n );\n return undefined;\n }\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { writeFileSync } from 'node:fs';\nimport { join } from 'node:path';\n\nexport const generateGitignoreFile = (destinationFolderPath: string, type: string): void => {\n const gitignorePath = join(destinationFolderPath, '.gitignore');\n writeFileSync(gitignorePath, gitignoreTemplate[type]);\n};\n\nconst gitignoreTemplate = {\n 'platform-app': `# Logs\nlogs\n*.log\nnpm-debug.log*\nyarn-debug.log*\nyarn-error.log*\npnpm-debug.log*\nlerna-debug.log*\n\nnode_modules\ndist\ndist-ssr\n*.localdist\n.idea\n.vscode\n\n# Editor directories and files\n.DS_Store\n*.suo\n*.ntvs*\n*.njsproj\n*.sln\n*.sw?\n.secret.json\n`,\n 'content-block': `node_modules\ndist\n.idea\n.vscode\n`,\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport react from '@vitejs/plugin-react';\nimport { build } from 'vite';\nimport { viteExternalsPlugin } from 'vite-plugin-externals';\n\nimport { getAppBridgeVersion } from '../appBridgeVersion';\n\nimport { type CompilerOptions } from './compilerOptions';\n\nexport const compilePlatformApp = async ({ outputName, entryFile, projectPath = '' }: CompilerOptions) => {\n const appBridgeVersion = getAppBridgeVersion(projectPath);\n\n const settings = await build({\n plugins: [\n react(),\n viteExternalsPlugin({\n react: 'React',\n 'react-dom': 'ReactDOM',\n }),\n ],\n root: projectPath,\n define: {\n 'process.env.NODE_ENV': JSON.stringify('production'),\n },\n build: {\n lib: {\n entry: entryFile,\n name: outputName,\n formats: ['iife'],\n fileName: () => 'index.js',\n },\n rollupOptions: {\n external: ['react', 'react-dom'],\n output: {\n globals: {\n react: 'React',\n 'react-dom': 'ReactDOM',\n },\n entryFileNames: 'settings.js',\n footer: `\n window.${outputName} = ${outputName};\n window.${outputName}.dependencies = window.${outputName}.packages || {};\n window.${outputName}.dependencies['@frontify/app-bridge'] = '${appBridgeVersion}';\n `,\n },\n },\n },\n });\n\n const app = await build({\n plugins: [react()],\n root: projectPath,\n define: {\n 'process.env.NODE_ENV': JSON.stringify('production'),\n },\n base: '/__DYNAMIC_SEGMENT__/',\n build: {\n emptyOutDir: false,\n },\n });\n return { app, settings };\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport react from '@vitejs/plugin-react';\nimport { build } from 'vite';\nimport { viteExternalsPlugin } from 'vite-plugin-externals';\n\nimport { getAppBridgeVersion } from '../appBridgeVersion';\n\nimport { type CompilerOptions } from './compilerOptions';\n\nexport const compileBlock = async ({ projectPath, entryFile, outputName }: CompilerOptions) => {\n const appBridgeVersion = getAppBridgeVersion(projectPath);\n return build({\n plugins: [\n react(),\n viteExternalsPlugin({\n react: 'React',\n 'react-dom': 'ReactDOM',\n }),\n ],\n define: {\n 'process.env.NODE_ENV': JSON.stringify('production'),\n },\n root: projectPath,\n build: {\n lib: {\n name: outputName,\n entry: entryFile,\n formats: ['iife'],\n fileName: () => 'index.js',\n },\n rollupOptions: {\n external: ['react', 'react-dom'],\n output: {\n globals: {\n react: 'React',\n 'react-dom': 'ReactDOM',\n },\n footer: `\n window.${outputName} = ${outputName};\n window.${outputName}.dependencies = window.${outputName}.packages || {};\n window.${outputName}.dependencies['@frontify/app-bridge'] = '${appBridgeVersion}';\n `,\n },\n },\n },\n });\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { join } from 'node:path';\n\nimport { type PackageJson } from './npm';\nimport { reactiveJson } from './reactiveJson';\n\nexport const getAppBridgeThemeVersion = (rootPath: string) => {\n const packageJson = reactiveJson<PackageJson>(join(rootPath, 'package.json'));\n return packageJson.dependencies['@frontify/app-bridge-theme'];\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport react from '@vitejs/plugin-react';\nimport { build } from 'vite';\nimport { viteExternalsPlugin } from 'vite-plugin-externals';\n\nimport { getAppBridgeThemeVersion } from '../appBridgeThemeVersion';\n\nimport { type CompilerOptions } from './compilerOptions';\n\nexport const compileTheme = async ({ projectPath, entryFile, outputName }: CompilerOptions) => {\n const appBridgeVersion = getAppBridgeThemeVersion(projectPath);\n return build({\n plugins: [\n react(),\n viteExternalsPlugin({\n react: 'React',\n 'react-dom': 'ReactDOM',\n }),\n ],\n define: {\n 'process.env.NODE_ENV': JSON.stringify('production'),\n },\n root: projectPath,\n build: {\n lib: {\n name: outputName,\n entry: entryFile,\n formats: ['iife'],\n fileName: () => 'index.js',\n },\n rollupOptions: {\n external: ['react', 'react-dom'],\n output: {\n globals: {\n react: 'React',\n 'react-dom': 'ReactDOM',\n },\n footer: `\n window.${outputName} = ${outputName};\n window.${outputName}.dependencies = window.${outputName}.packages || {};\n window.${outputName}.dependencies['@frontify/app-bridge-theme'] = '${appBridgeVersion}';\n `,\n },\n },\n },\n });\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { array, boolean, number, object, string, z } from 'zod';\n\nconst forbiddenExtensions = ['exe', 'dmg', 'cmd', 'sh', 'bat'];\nconst getForbiddenExtensionsErrorMessage = (surfaceName: string) =>\n `Invalid file extension, \\`${surfaceName}.filenameExtension\\` can not include: ${forbiddenExtensions.join(', ')}.`;\n\nconst assetCreationShape = object({\n title: string().min(1).max(40),\n}).optional();\n\nconst completeAssetType = z.enum(['audio', 'document', 'image', 'video', 'file', 'embeddedContent']);\nconst imageAssetType = completeAssetType.exclude(['audio', 'document', 'video', 'file', 'embeddedContent']);\n\nconst iconLibraryFilenameExtension = z.enum(['svg']);\nconst logoLibraryFilenameExtension = z.enum(['svg', 'jpg', 'jpeg', 'ai', 'eps', 'png', 'tif', 'tiff']);\n\nconst appType = z.enum(['content-block', 'platform-app', 'theme']);\n\nconst secretKeySet = new Set();\nexport function resetSecretKeySet() {\n secretKeySet.clear();\n}\n\nconst secretSchema = object({\n label: string(),\n key: string()\n .min(1)\n .max(80)\n .refine(\n (key) => {\n if (secretKeySet.has(key)) {\n return false;\n }\n\n secretKeySet.add(key);\n return /^\\w+$/.test(key);\n },\n {\n message:\n \"Secret Key must be unique and should only contain letters from a-z, A-Z, numbers from 0-9 and '_' without any spaces\",\n },\n ),\n});\nconst secretsArraySchema = array(secretSchema);\n\nconst requestOptionsSchema = object({\n method: z.enum(['GET', 'POST', 'PUT', 'DELETE']),\n headers: z.record(string()).optional(),\n body: z.any().optional(),\n});\n\nconst endpointNameSet = new Set();\nexport function resetEndpointNameSet() {\n endpointNameSet.clear();\n}\nconst endpointCallSchema = object({\n name: string().refine(\n (name) => {\n if (endpointNameSet.has(name)) {\n return false;\n }\n\n endpointNameSet.add(name);\n return /^[\\w-]*$/.test(name);\n },\n {\n message: 'Endpoint name must be unique',\n },\n ),\n resource: string(),\n options: requestOptionsSchema,\n});\n\nconst hostnameRegex =\n /^(([\\dA-Za-z]|[\\dA-Za-z][\\dA-Za-z-]*[\\dA-Za-z])\\.)*([\\dA-Za-z]|[\\dA-Za-z][\\dA-Za-z-]*[\\dA-Za-z])$/;\n\nconst ScopeEnum = z.enum(['basic:read', 'basic:write', 'account:read', 'webhook:read', 'webhook:write']);\n\nconst permissionsSchema = object({\n permissions: object({\n scopes: array(ScopeEnum)\n .min(1, 'At least one scope is required')\n .max(5, 'No more than 5 scopes are allowed')\n .refine((scopes) => scopes.includes('basic:read'), {\n message: \"'basic:read' is required in scopes\",\n }),\n }).optional(),\n}).optional();\n\nconst KeyTypeLabelSchema = object({\n key: string(),\n type: string(),\n label: string(),\n});\n\nconst ActionSchema = object({\n id: string(),\n title: string(),\n iconUrl: string(),\n returns: array(KeyTypeLabelSchema),\n version: number().int().positive(),\n externalId: string(),\n parameters: array(KeyTypeLabelSchema),\n});\n\nconst ActionsArraySchema = array(ActionSchema).optional();\n\nexport const platformAppManifestSchemaV1 = object({\n appId: string().length(25),\n appType,\n experimental: boolean().optional(),\n secrets: secretsArraySchema.optional(),\n network: object({\n allowedHosts: array(\n string().refine((value) => hostnameRegex.test(value), {\n message: 'Invalid host format',\n }),\n ).optional(),\n endpoints: array(endpointCallSchema).optional(),\n }).optional(),\n permissionsSchema,\n automation: object({\n actions: ActionsArraySchema,\n }).optional(),\n surfaces: object({\n guideline: object({\n 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+blocks:read+blocks: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,GAAG;AAAA,EACpC;AACJ;ACtBA,MAAqBC,UAA0B,MAAM;AAAA,EAEjD,Y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AAA;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+blocks:read+blocks: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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
|
|
5
5
|
"author": "Frontify Developers <developers@frontify.com>",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -20,19 +20,19 @@
|
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@fastify/cors": "^11.2.0",
|
|
23
|
-
"@vitejs/plugin-react": "^5.
|
|
23
|
+
"@vitejs/plugin-react": "^5.2.0",
|
|
24
24
|
"archiver": "^7.0.1",
|
|
25
25
|
"cac": "^6.7.14",
|
|
26
|
-
"conf": "^15.0
|
|
27
|
-
"esbuild": "^0.27.
|
|
26
|
+
"conf": "^15.1.0",
|
|
27
|
+
"esbuild": "^0.27.4",
|
|
28
28
|
"fast-glob": "^3.3.3",
|
|
29
|
-
"fastify": "^5.
|
|
29
|
+
"fastify": "^5.8.4",
|
|
30
30
|
"glob-to-regexp": "^0.4.1",
|
|
31
31
|
"node-fetch": "^3.3.2",
|
|
32
32
|
"open": "^11.0.0",
|
|
33
33
|
"picocolors": "^1.1.1",
|
|
34
34
|
"prompts": "^2.4.2",
|
|
35
|
-
"vite": "^
|
|
35
|
+
"vite": "^7.3.1",
|
|
36
36
|
"vite-plugin-externals": "^0.6.2",
|
|
37
37
|
"zod": "^3.25.76"
|
|
38
38
|
},
|
|
@@ -43,18 +43,19 @@
|
|
|
43
43
|
"@types/node": "^20.19.25",
|
|
44
44
|
"@types/prompts": "^2.4.9",
|
|
45
45
|
"@types/ws": "8.18.1",
|
|
46
|
-
"@vitest/coverage-v8": "4.
|
|
47
|
-
"@vitest/ui": "^4.
|
|
48
|
-
"eslint": "^9.39.
|
|
46
|
+
"@vitest/coverage-v8": "4.1.2",
|
|
47
|
+
"@vitest/ui": "^4.1.2",
|
|
48
|
+
"eslint": "^9.39.4",
|
|
49
49
|
"eslint-plugin-notice": "^1.0.0",
|
|
50
50
|
"nock": "^13.5.6",
|
|
51
51
|
"prettier": "^3.7.4",
|
|
52
52
|
"ts-node": "^10.9.2",
|
|
53
53
|
"typescript": "^5.9.3",
|
|
54
|
-
"vitest": "^4.
|
|
54
|
+
"vitest": "^4.1.2"
|
|
55
55
|
},
|
|
56
56
|
"scripts": {
|
|
57
57
|
"build": "vite build",
|
|
58
|
+
"dev": "vite build --watch",
|
|
58
59
|
"format": "prettier --write .",
|
|
59
60
|
"lint": "eslint .",
|
|
60
61
|
"lint:fix": "eslint --fix .",
|