@frontify/frontify-cli 6.0.0-alpha.2 → 6.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -23,7 +23,7 @@ import * as se from "esbuild";
23
23
  var E = {
24
24
  name: "@frontify/frontify-cli",
25
25
  type: "module",
26
- version: "6.0.0-alpha.2",
26
+ version: "6.0.0",
27
27
  author: "Frontify Developers <developers@frontify.com>",
28
28
  repository: {
29
29
  type: "git",
@@ -59,7 +59,7 @@ var E = {
59
59
  open: "^11.0.0",
60
60
  picocolors: "^1.1.1",
61
61
  prompts: "^2.4.2",
62
- vite: "^8.0.7",
62
+ vite: "^8.0.8",
63
63
  "vite-plugin-externals": "^0.6.2",
64
64
  zod: "^3.25.76"
65
65
  },
@@ -70,14 +70,14 @@ var E = {
70
70
  "@types/node": "^22.19.15",
71
71
  "@types/prompts": "^2.4.9",
72
72
  "@types/ws": "8.18.1",
73
- "@vitest/coverage-v8": "4.1.2",
74
- "@vitest/ui": "^4.1.2",
73
+ "@vitest/coverage-v8": "4.1.4",
74
+ "@vitest/ui": "^4.1.4",
75
75
  eslint: "^9.39.4",
76
76
  "eslint-plugin-notice": "^1.0.0",
77
77
  prettier: "^3.7.4",
78
78
  "ts-node": "^10.9.2",
79
79
  typescript: "^5.9.3",
80
- vitest: "^4.1.2"
80
+ vitest: "^4.1.4"
81
81
  }
82
82
  }, D = () => {
83
83
  let e = /* @__PURE__ */ new Date();
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../package.json","../src/utils/date.ts","../src/utils/logger.ts","../src/errors/FileNotFoundError.ts","../src/errors/ParseJsonError.ts","../src/utils/reactiveJson.ts","../src/utils/getPackageVersion.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/vitePlugins.ts","../src/utils/compiler/compileBlock.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/commands/publish.ts","../src/index.ts"],"sourcesContent":["{\n \"name\": \"@frontify/frontify-cli\",\n \"type\": \"module\",\n \"version\": \"6.0.0-alpha.2\",\n \"author\": \"Frontify Developers <developers@frontify.com>\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/Frontify/brand-sdk\",\n \"directory\": \"packages/cli\"\n },\n \"bin\": {\n \"frontify-cli\": \"dist/index.mjs\"\n },\n \"files\": [\n \"dist\",\n \"templates\"\n ],\n \"engines\": {\n \"node\": \">=22\"\n },\n \"scripts\": {\n \"build\": \"vite build\",\n \"dev\": \"vite build --watch\",\n \"format\": \"prettier --write .\",\n \"lint\": \"eslint .\",\n \"lint:fix\": \"eslint --fix .\",\n \"start\": \"npm run build && node dist/index.mjs\",\n \"test\": \"vitest run --silent\",\n \"test:watch\": \"vitest\",\n \"test:coverage\": \"vitest run --coverage\",\n \"test:ui\": \"vitest --ui\",\n \"typecheck\": \"tsc --noEmit\"\n },\n \"dependencies\": {\n \"@fastify/cors\": \"^11.2.0\",\n \"@vitejs/plugin-react\": \"^6.0.1\",\n \"archiver\": \"^7.0.1\",\n \"cac\": \"^7.0.0\",\n \"conf\": \"^15.1.0\",\n \"esbuild\": \"^0.28.0\",\n \"fast-glob\": \"^3.3.3\",\n \"fastify\": \"^5.8.4\",\n \"glob-to-regexp\": \"^0.4.1\",\n \"open\": \"^11.0.0\",\n \"picocolors\": \"^1.1.1\",\n \"prompts\": \"^2.4.2\",\n \"vite\": \"^8.0.7\",\n \"vite-plugin-externals\": \"^0.6.2\",\n \"zod\": \"^3.25.76\"\n },\n \"devDependencies\": {\n \"@frontify/eslint-config-basic\": \"^1.0.8\",\n \"@types/glob-to-regexp\": \"^0.4.4\",\n \"@types/mock-fs\": \"^4.13.4\",\n \"@types/node\": \"^22.19.15\",\n \"@types/prompts\": \"^2.4.9\",\n \"@types/ws\": \"8.18.1\",\n \"@vitest/coverage-v8\": \"4.1.2\",\n \"@vitest/ui\": \"^4.1.2\",\n \"eslint\": \"^9.39.4\",\n \"eslint-plugin-notice\": \"^1.0.0\",\n \"prettier\": \"^3.7.4\",\n \"ts-node\": \"^10.9.2\",\n \"typescript\": \"^5.9.3\",\n \"vitest\": \"^4.1.2\"\n }\n}\n","/* (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 ' '.repeat(width);\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: T = JSON.parse(jsonRaw) as T;\n\n return new Proxy(jsonParsed as object, {\n set: (obj: Record<string | symbol, unknown>, prop, value: unknown) => {\n obj[prop] = value;\n\n const jsonString = JSON.stringify(obj, null, '\\t');\n\n writeFileSync(path, jsonString);\n\n return true;\n },\n }) as T;\n } catch (error) {\n if (error instanceof SyntaxError) {\n throw new ParseJsonError(path);\n } else if (error instanceof Error && 'code' in error && error.code === 'ENOENT') {\n throw new FileNotFoundError(path);\n }\n\n throw new Error(String(error));\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\nexport const getAppBridgeThemeVersion = (rootPath: string) => {\n const packageJson = reactiveJson<PackageJson>(join(rootPath, 'package.json'));\n return packageJson.dependencies['@frontify/app-bridge-theme'];\n};\n\nexport const getReactVersion = (rootPath: string) => {\n const packageJson = reactiveJson<PackageJson>(join(rootPath, 'package.json'));\n return packageJson.dependencies.react;\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: { success: false; error: string };\n\n constructor(code: number, responseBody: { success: 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 { 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.ok) {\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 { success: 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 return reject(new CommandExecutionError(`${error.message}${String(stdout)}`));\n } else {\n return resolve(String(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 as keyof typeof gitignoreTemplate]);\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 '../getPackageVersion';\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 mode: 'production',\n define: {\n 'process.env.NODE_ENV': JSON.stringify('production'),\n },\n build: {\n minify: 'terser',\n cssMinify: 'esbuild',\n lib: {\n entry: entryFile,\n name: outputName,\n formats: ['iife'],\n fileName: () => 'index.js',\n cssFileName: 'style',\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-app'] = '${appBridgeVersion}';\n `,\n },\n },\n },\n });\n\n const app = await build({\n plugins: [react()],\n root: projectPath,\n mode: 'production',\n define: {\n 'process.env.NODE_ENV': JSON.stringify('production'),\n },\n base: '/__DYNAMIC_SEGMENT__/',\n build: {\n minify: 'terser',\n cssMinify: 'esbuild',\n emptyOutDir: false,\n },\n });\n return { app, settings };\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type Plugin, type ResolvedConfig, esmExternalRequirePlugin } from 'vite';\n\nexport const REACT_MODULES = ['react', 'react/jsx-runtime', 'react/jsx-dev-runtime', 'react-dom', 'react-dom/client'];\n\n/**\n * Keeps bare `import X from 'react'` specifiers in the browser output so the\n * host page's import map resolves them at runtime instead of Vite pre-bundling\n * them into a CJS-wrapped chunk.\n */\nexport function reactBareExternalPlugin(): Plugin {\n const resolved = new Set<string>();\n const modules = [...REACT_MODULES] as string[];\n\n return {\n name: 'vite-plugin-react-bare-external',\n enforce: 'pre',\n apply: 'serve',\n\n config(config) {\n config.optimizeDeps ??= {};\n config.optimizeDeps.exclude = [...(config.optimizeDeps.exclude ?? []), ...modules];\n\n const optimizeDeps = config.optimizeDeps as Record<string, unknown>;\n optimizeDeps.rolldownOptions ??= {};\n const rolldownOptions = optimizeDeps.rolldownOptions as Record<string, unknown>;\n rolldownOptions.plugins ??= [];\n (rolldownOptions.plugins as unknown[]).push({\n name: 'externalize-react',\n resolveId(source: string) {\n if (modules.includes(source)) {\n resolved.add(source);\n return { id: source, external: true };\n }\n return null;\n },\n });\n (rolldownOptions.plugins as unknown[]).push(esmExternalRequirePlugin({ external: modules }));\n\n return null;\n },\n\n configResolved(resolvedConfig: ResolvedConfig) {\n const base = resolvedConfig.base ?? '/';\n const escapedBase = base.replaceAll(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n\n (resolvedConfig.plugins as Plugin[]).push({\n name: 'vite-plugin-react-bare-restore',\n transform(code: string) {\n if (resolved.size === 0) {\n return null;\n }\n const regex = new RegExp(`${escapedBase}@id\\\\/(${[...resolved].join('|')})`, 'g');\n return code.replace(regex, (_, mod: string) => mod);\n },\n });\n },\n\n resolveId(id) {\n if (modules.includes(id)) {\n resolved.add(id);\n return { id, external: true };\n }\n return null;\n },\n\n load(id) {\n if (resolved.has(id)) {\n return 'export default {};';\n }\n return null;\n },\n };\n}\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport react from '@vitejs/plugin-react';\nimport { build, esmExternalRequirePlugin } from 'vite';\n\nimport { REACT_MODULES } from '../vitePlugins';\n\nimport { type CompilerOptions } from './compilerOptions';\n\nexport const compileBlock = async ({ projectPath, entryFile, outputName }: CompilerOptions) => {\n return build({\n plugins: [react(), esmExternalRequirePlugin({ external: REACT_MODULES })],\n define: {\n 'process.env.NODE_ENV': JSON.stringify('production'),\n },\n root: projectPath,\n mode: 'production',\n build: {\n minify: 'terser',\n cssMinify: 'lightningcss',\n lib: {\n name: outputName,\n entry: entryFile,\n formats: ['es'],\n fileName: () => 'index.js',\n cssFileName: 'style',\n },\n rolldownOptions: {\n platform: 'browser',\n treeshake: {\n // TODO: Fix in Fondue\n moduleSideEffects: [\n { test: /@frontify\\/fondue-components/, sideEffects: false },\n { test: /@frontify\\/fondue-icons/, sideEffects: false },\n { test: /@frontify\\/fondue-tokens/, sideEffects: false },\n { test: /@frontify\\/fondue-charts/, sideEffects: false },\n { test: /@frontify\\/fondue-rte/, sideEffects: false },\n { test: /\\.css$/, sideEffects: true },\n ],\n },\n },\n },\n });\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport react from '@vitejs/plugin-react';\nimport { build, esmExternalRequirePlugin } from 'vite';\n\nimport { REACT_MODULES } from '../vitePlugins';\n\nimport { type CompilerOptions } from './compilerOptions';\n\nexport const compileTheme = async ({ projectPath, entryFile, outputName }: CompilerOptions) => {\n return build({\n plugins: [react(), esmExternalRequirePlugin({ external: REACT_MODULES })],\n define: {\n 'process.env.NODE_ENV': JSON.stringify('production'),\n },\n root: projectPath,\n mode: 'production',\n build: {\n minify: 'terser',\n cssMinify: 'lightningcss',\n lib: {\n name: outputName,\n entry: entryFile,\n formats: ['es'],\n fileName: () => 'index.js',\n cssFileName: 'style',\n },\n rolldownOptions: {\n platform: 'browser',\n treeshake: {\n // TODO: Fix in Fondue\n moduleSideEffects: [\n { test: /@frontify\\/fondue-components/, sideEffects: false },\n { test: /@frontify\\/fondue-icons/, sideEffects: false },\n { test: /@frontify\\/fondue-tokens/, sideEffects: false },\n { test: /@frontify\\/fondue-charts/, sideEffects: false },\n { test: /@frontify\\/fondue-rte/, sideEffects: false },\n { test: /\\.css$/, sideEffects: true },\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 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 resolveCredentials = (token?: string, instance?: string) => {\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 return { instanceUrl, accessToken };\n};\n\nexport const verifyCode = async (noVerify: boolean) => {\n if (noVerify) {\n return;\n }\n\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\nexport const collectFiles = async (projectPath: string, distPath: string) => {\n const buildFilesToIgnore = BUILD_FILE_BLOCK_LIST.map((pattern) => {\n if (pattern.includes('*')) {\n return `${fastGlob.convertPathToPattern(projectPath)}/${pattern}`;\n }\n return fastGlob.convertPathToPattern(`${projectPath}/${pattern}`);\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 packageJsonContent = reactiveJson<{ dependencies?: Record<string, string> }>(\n join(projectPath, 'package.json'),\n );\n\n return {\n build_files: await makeFilesDict(\n fastGlob.convertPathToPattern(`${projectPath}/${distPath}`),\n buildFilesToIgnore,\n ),\n source_files: await makeFilesDict(fastGlob.convertPathToPattern(projectPath), sourceFilesToIgnore),\n dependencies: packageJsonContent?.dependencies || {},\n };\n};\n\nexport const handleDeployError = (error: unknown): never => {\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\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 const { instanceUrl, accessToken } = resolveCredentials(token, instance);\n\n if (dryRun) {\n Logger.info(pc.blue('Dry run: enabled'));\n } else {\n const user = await getUser(instanceUrl, token);\n if (user) {\n Logger.info(`You are logged in as ${user.name} (${instanceUrl}).`);\n } else {\n return;\n }\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 await verifyCode(noVerify);\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 request = await collectFiles(projectPath, distPath);\n\n if (dryRun) {\n Logger.success('The command has been executed without any issue.');\n process.exit(0);\n }\n\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 occurred while deploying:', (error as HttpClientError).responseBody.error);\n process.exit(-1);\n }\n } catch (error) {\n handleDeployError(error);\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 }).catch(() => {});\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:${this.port}/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:${this.port}/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';\n\nimport pkg from '../../package.json';\nimport { getAppBridgeVersion, getReactVersion } from '../utils/getPackageVersion';\nimport { reactBareExternalPlugin } from '../utils/vitePlugins';\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 appBridgeVersion = getAppBridgeVersion(process.cwd());\n const reactVersion = getReactVersion(process.cwd());\n\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 reactBareExternalPlugin(),\n ],\n define: {\n 'process.env.NODE_ENV': JSON.stringify('development'),\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 forwardConsole: false,\n },\n });\n\n viteServer.middlewares.use('/', (req, res, next) => {\n if (req.url !== '/') {\n return next();\n }\n\n res.setHeader('Access-Control-Allow-Origin', '*');\n res.setHeader('Access-Control-Allow-Methods', 'GET, OPTIONS');\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 const host = req.headers.host || `localhost:${this.port}`;\n const actualPort = parseInt(host.split(':')[1] || String(this.port), 10);\n\n res.setHeader('Access-Control-Allow-Origin', '*');\n res.setHeader('Access-Control-Allow-Methods', 'GET, OPTIONS');\n res.setHeader('Content-Type', 'application/json');\n res.writeHead(200);\n return res.end(\n JSON.stringify({\n url: `http://${host}/${this.entryFilePath}`,\n entryFilePath: this.entryFilePath,\n port: actualPort,\n version: pkg.version,\n dependencies: {\n ...(appBridgeVersion ? { '@frontify/app-bridge': appBridgeVersion } : {}),\n react: reactVersion,\n },\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().catch(() => {});\n server.restart().catch(() => {});\n }\n },\n buildStart: () => {\n settingsSchema.rebuild().catch(() => {});\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';\n\nimport pkg from '../../package.json';\nimport { getAppBridgeThemeVersion, getReactVersion } from '../utils/getPackageVersion';\nimport { reactBareExternalPlugin } from '../utils/vitePlugins';\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 appBridgeThemeVersion = getAppBridgeThemeVersion(process.cwd());\n const reactVersion = getReactVersion(process.cwd());\n\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 reactBareExternalPlugin(),\n ],\n define: {\n 'process.env.NODE_ENV': JSON.stringify('development'),\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 forwardConsole: false,\n },\n });\n\n viteServer.middlewares.use('/', (req, res, next) => {\n if (req.url !== '/') {\n return next();\n }\n\n res.setHeader('Access-Control-Allow-Origin', '*');\n res.setHeader('Access-Control-Allow-Methods', 'GET, OPTIONS');\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 const host = req.headers.host || `localhost:${this.port}`;\n const actualPort = parseInt(host.split(':')[1] || String(this.port), 10);\n\n res.setHeader('Access-Control-Allow-Origin', '*');\n res.setHeader('Access-Control-Allow-Methods', 'GET, OPTIONS');\n res.setHeader('Content-Type', 'application/json');\n res.writeHead(200);\n return res.end(\n JSON.stringify({\n url: `http://${host}/${this.entryFilePath}`,\n entryFilePath: this.entryFilePath,\n port: actualPort,\n version: pkg.version,\n dependencies: {\n ...(appBridgeThemeVersion ? { '@frontify/app-bridge-theme': appBridgeThemeVersion } : {}),\n react: reactVersion,\n },\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';\n\nimport pc from 'picocolors';\n\nimport { type HttpClientError } from '../errors/HttpClientError';\nimport { Configuration, HttpClient, Logger, type UserInfo, getUser, reactiveJson } from '../utils/index';\n\nimport { type AppManifest } from './deploy';\n\nexport enum Availability {\n PRIVATE = 'PRIVATE',\n COMMUNITY = 'COMMUNITY',\n}\n\ntype PublishOptions = {\n releaseNotes: string;\n availability?: Availability;\n token?: string;\n instance?: string;\n};\n\nexport const publishApp = async ({\n releaseNotes,\n availability = Availability.PRIVATE,\n token,\n instance,\n}: PublishOptions): Promise<void> => {\n try {\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 publish command.`,\n );\n process.exit(-1);\n }\n\n const user: UserInfo | undefined = await getUser(instanceUrl, token);\n if (!user) {\n process.exit(-1);\n }\n\n Logger.info(`You are logged in as ${user.name} (${instanceUrl}).`);\n\n const projectPath = process.cwd();\n const manifestContent = reactiveJson<AppManifest>(join(projectPath, 'manifest.json'));\n const { appId } = manifestContent;\n\n const httpClient = new HttpClient(instanceUrl);\n\n const query = `mutation PublishMarketplaceApp {\n publishMarketplaceApp(\n input: {appId: \"${appId}\", releaseNotes: ${JSON.stringify(releaseNotes)}, availability: ${availability}}\n ) {\n id\n }\n}`;\n\n Logger.info('Publishing the app to the Frontify Marketplace...');\n\n try {\n await httpClient.post<{ data: { publishMarketplaceApp: { id: string } } }>(\n '/graphql',\n { query },\n { headers: { Authorization: `Bearer ${accessToken}` } },\n );\n\n Logger.success('The app has been published successfully.');\n } catch (error) {\n Logger.error('An error occurred while publishing:', (error as HttpClientError).responseBody.error);\n process.exit(-1);\n }\n } catch (error) {\n if (typeof error === 'string') {\n Logger.error('The publishing has failed and was aborted due to an error:', error);\n } else if (error instanceof Error) {\n Logger.error('The publishing has failed and was aborted due to an error:', error.message);\n } else {\n Logger.error('The publishing 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 { 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 publishApp,\n Availability,\n} from './commands/index';\nimport {\n type CompilerOptions,\n Logger,\n compileBlock,\n compilePlatformApp,\n compileTheme,\n getValidInstanceUrl,\n isValidName,\n reactiveJson,\n} from './utils/index';\n\ntype LoginOptions = { instance: string; port: number };\ntype ServeOptions = { entryPath: string; port: number; allowExternal: boolean; appType?: string };\ntype DeployOptions = {\n entryPath: string;\n outDir: string;\n dryRun: boolean;\n noVerify: boolean;\n open: boolean;\n appType?: string;\n instance?: string;\n token?: string;\n};\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: LoginOptions) => {\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 ])) as { promptedInstanceUrl: string };\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\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: ServeOptions) => {\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\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: DeployOptions) => {\n const manifest = reactiveJson<AppManifest>(join(process.cwd(), 'manifest.json'));\n const appType = options.appType || manifest.appType;\n\n const compilers: Record<string, (options: CompilerOptions) => Promise<unknown>> = {\n 'content-block': compileBlock,\n 'platform-app': compilePlatformApp,\n theme: compileTheme,\n };\n\n const compiler = compilers[appType ?? ''];\n if (!compiler) {\n throw new Error(`Unknown app type \"${appType}\". Expected one of: ${Object.keys(compilers).join(', ')}`);\n }\n\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 compiler,\n );\n });\n\ncli.command('publish', 'publish the app to the marketplace')\n .option('--releaseNotes, --release-notes <releaseNotes>', '[string] release notes for the publish')\n .option(\n '--availability [availability]',\n `[string] availability of the app (${Object.values(Availability).join(', ')})`,\n { default: Availability.PRIVATE },\n )\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 if (!options.releaseNotes) {\n Logger.error('Release notes are required. Use --releaseNotes=\"Your release notes\".');\n process.exit(-1);\n }\n\n await publishApp({\n releaseNotes: options.releaseNotes,\n availability: options.availability,\n token: options.token,\n instance: options.instance,\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 ])) as { promptedAppName: string; stylingFramework: string; appType: string };\n\n if (!promptedAppName || !stylingFramework || !appType) {\n exit(0);\n }\n\n createNewApp(promptedAppName, stylingFramework, appType);\n});\n\ncli.help();\ncli.version(pkg.version);\n\ncli.parse(process.argv);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GCEa,UAA+B;CACxC,IAAM,oBAAM,IAAI,MAAM;AACtB,QAAO,GAAG,OAAO,EAAI,UAAU,CAAC,CAAC,SAAS,GAAG,IAAI,CAAC,GAAG,OAAO,EAAI,YAAY,CAAC,CAAC,SAAS,GAAG,IAAI,CAAC,GAAG,OAC9F,EAAI,YAAY,CACnB,CAAC,SAAS,GAAG,IAAI;GCAT,IAAb,MAAa,EAAO;CAChB,OAAO,YAAY,GAAG,GAA0B;AAC5C,UAAQ,IAAI,EAAO,OAAO,GAAG,EAAE,GAAG,EAAS;;CAG/C,OAAO,KAAK,GAAG,GAA0B;AACrC,UAAQ,IAAI,IAAI,GAAgB,CAAC,IAAI,EAAS,KAAK,IAAI,GAAG;;CAG9D,OAAO,QAAQ,GAAG,GAA0B;AACxC,UAAQ,IAAI,IAAI,GAAgB,CAAC,IAAI,EAAG,MAAM,EAAS,KAAK,IAAI,CAAC,GAAG;;CAGxE,OAAO,MAAM,GAAG,GAA0B;AACtC,UAAQ,MAAM,EAAG,IAAI,IAAI,GAAgB,CAAC,IAAI,EAAS,KAAK,IAAI,GAAG,CAAC;;CAGxE,OAAO,OAAO,IAAQ,GAAW;AAC7B,SAAO,IAAI,OAAO,EAAM;;GCpBX,IAArB,cAA+C,MAAM;CACjD,OAAgB;CAChB,YAAY,GAAc;AAEtB,EADA,OAAO,EACP,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AQ,iBACT,EAAO,MAAM,yEAAuE,EACpF,QAAQ,KAAK,GAAG,GAGpB,MAAM,GAAW;EACb,cAAc,EAAQ;EACtB,cAAc,EAAQ;EACtB,OAAO,EAAQ;EACf,UAAU,EAAQ;EACrB,CAAC;EACJ,EAEN,EAAI,QAAQ,oBAAoB,+BAA+B,CAAC,OAAO,OAAO,MAAoB;CAC9F,IAAM,EAAE,oBAAiB,qBAAkB,eAAa,MAAM,EAAQ;EAClE;GACI,MAAM;GACN,MAAM;GACN,SAAS;GACT,SAAS,KAAW;GACpB,WAAW,MACH,EAAM,MAAM,KAAK,KACV,mCAGJ,GAAY,EAAM;GAEhC;EACD;GACI,MAAM;GACN,MAAM;GACN,SAAS;GACT,SAAS,CACL;IAAE,OAAO;IAAO,OAAO;IAAgB,EACvC;IAAE,OAAO;IAAS,OAAO;IAAiB,CAC7C;GACJ;EACD;GACI,MAAM;GACN,MAAM;GACN,SAAS;GACT,SAAS;IACL;KAAE,OAAO;KAAY,OAAO;KAAY;IACxC;KAAE,OAAO;KAAe,OAAO;KAAe;IAC9C;KAAE,OAAO;KAAQ,OAAO;KAAO;IAClC;GACJ;EACJ,CAAC;AAMF,EAJI,CAAC,KAAmB,CAAC,KAAoB,CAAC,MAC1C,EAAK,EAAE,EAGX,GAAa,GAAiB,GAAkB,EAAQ;EAC1D,EAEF,EAAI,MAAM,EACV,EAAI,QAAQ,EAAI,QAAQ,EAExB,EAAI,MAAM,QAAQ,KAAK"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../package.json","../src/utils/date.ts","../src/utils/logger.ts","../src/errors/FileNotFoundError.ts","../src/errors/ParseJsonError.ts","../src/utils/reactiveJson.ts","../src/utils/getPackageVersion.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/vitePlugins.ts","../src/utils/compiler/compileBlock.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/commands/publish.ts","../src/index.ts"],"sourcesContent":["{\n \"name\": \"@frontify/frontify-cli\",\n \"type\": \"module\",\n \"version\": \"6.0.0\",\n \"author\": \"Frontify Developers <developers@frontify.com>\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/Frontify/brand-sdk\",\n \"directory\": \"packages/cli\"\n },\n \"bin\": {\n \"frontify-cli\": \"dist/index.mjs\"\n },\n \"files\": [\n \"dist\",\n \"templates\"\n ],\n \"engines\": {\n \"node\": \">=22\"\n },\n \"scripts\": {\n \"build\": \"vite build\",\n \"dev\": \"vite build --watch\",\n \"format\": \"prettier --write .\",\n \"lint\": \"eslint .\",\n \"lint:fix\": \"eslint --fix .\",\n \"start\": \"npm run build && node dist/index.mjs\",\n \"test\": \"vitest run --silent\",\n \"test:watch\": \"vitest\",\n \"test:coverage\": \"vitest run --coverage\",\n \"test:ui\": \"vitest --ui\",\n \"typecheck\": \"tsc --noEmit\"\n },\n \"dependencies\": {\n \"@fastify/cors\": \"^11.2.0\",\n \"@vitejs/plugin-react\": \"^6.0.1\",\n \"archiver\": \"^7.0.1\",\n \"cac\": \"^7.0.0\",\n \"conf\": \"^15.1.0\",\n \"esbuild\": \"^0.28.0\",\n \"fast-glob\": \"^3.3.3\",\n \"fastify\": \"^5.8.4\",\n \"glob-to-regexp\": \"^0.4.1\",\n \"open\": \"^11.0.0\",\n \"picocolors\": \"^1.1.1\",\n \"prompts\": \"^2.4.2\",\n \"vite\": \"^8.0.8\",\n \"vite-plugin-externals\": \"^0.6.2\",\n \"zod\": \"^3.25.76\"\n },\n \"devDependencies\": {\n \"@frontify/eslint-config-basic\": \"^1.0.8\",\n \"@types/glob-to-regexp\": \"^0.4.4\",\n \"@types/mock-fs\": \"^4.13.4\",\n \"@types/node\": \"^22.19.15\",\n \"@types/prompts\": \"^2.4.9\",\n \"@types/ws\": \"8.18.1\",\n \"@vitest/coverage-v8\": \"4.1.4\",\n \"@vitest/ui\": \"^4.1.4\",\n \"eslint\": \"^9.39.4\",\n \"eslint-plugin-notice\": \"^1.0.0\",\n \"prettier\": \"^3.7.4\",\n \"ts-node\": \"^10.9.2\",\n \"typescript\": \"^5.9.3\",\n \"vitest\": \"^4.1.4\"\n }\n}\n","/* (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 ' '.repeat(width);\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: T = JSON.parse(jsonRaw) as T;\n\n return new Proxy(jsonParsed as object, {\n set: (obj: Record<string | symbol, unknown>, prop, value: unknown) => {\n obj[prop] = value;\n\n const jsonString = JSON.stringify(obj, null, '\\t');\n\n writeFileSync(path, jsonString);\n\n return true;\n },\n }) as T;\n } catch (error) {\n if (error instanceof SyntaxError) {\n throw new ParseJsonError(path);\n } else if (error instanceof Error && 'code' in error && error.code === 'ENOENT') {\n throw new FileNotFoundError(path);\n }\n\n throw new Error(String(error));\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\nexport const getAppBridgeThemeVersion = (rootPath: string) => {\n const packageJson = reactiveJson<PackageJson>(join(rootPath, 'package.json'));\n return packageJson.dependencies['@frontify/app-bridge-theme'];\n};\n\nexport const getReactVersion = (rootPath: string) => {\n const packageJson = reactiveJson<PackageJson>(join(rootPath, 'package.json'));\n return packageJson.dependencies.react;\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: { success: false; error: string };\n\n constructor(code: number, responseBody: { success: 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 { 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.ok) {\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 { success: 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 return reject(new CommandExecutionError(`${error.message}${String(stdout)}`));\n } else {\n return resolve(String(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 as keyof typeof gitignoreTemplate]);\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 '../getPackageVersion';\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 mode: 'production',\n define: {\n 'process.env.NODE_ENV': JSON.stringify('production'),\n },\n build: {\n minify: 'terser',\n cssMinify: 'esbuild',\n lib: {\n entry: entryFile,\n name: outputName,\n formats: ['iife'],\n fileName: () => 'index.js',\n cssFileName: 'style',\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-app'] = '${appBridgeVersion}';\n `,\n },\n },\n },\n });\n\n const app = await build({\n plugins: [react()],\n root: projectPath,\n mode: 'production',\n define: {\n 'process.env.NODE_ENV': JSON.stringify('production'),\n },\n base: '/__DYNAMIC_SEGMENT__/',\n build: {\n minify: 'terser',\n cssMinify: 'esbuild',\n emptyOutDir: false,\n },\n });\n return { app, settings };\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type Plugin, type ResolvedConfig, esmExternalRequirePlugin } from 'vite';\n\nexport const REACT_MODULES = ['react', 'react/jsx-runtime', 'react/jsx-dev-runtime', 'react-dom', 'react-dom/client'];\n\n/**\n * Keeps bare `import X from 'react'` specifiers in the browser output so the\n * host page's import map resolves them at runtime instead of Vite pre-bundling\n * them into a CJS-wrapped chunk.\n */\nexport function reactBareExternalPlugin(): Plugin {\n const resolved = new Set<string>();\n const modules = [...REACT_MODULES] as string[];\n\n return {\n name: 'vite-plugin-react-bare-external',\n enforce: 'pre',\n apply: 'serve',\n\n config(config) {\n config.optimizeDeps ??= {};\n config.optimizeDeps.exclude = [...(config.optimizeDeps.exclude ?? []), ...modules];\n\n const optimizeDeps = config.optimizeDeps as Record<string, unknown>;\n optimizeDeps.rolldownOptions ??= {};\n const rolldownOptions = optimizeDeps.rolldownOptions as Record<string, unknown>;\n rolldownOptions.plugins ??= [];\n (rolldownOptions.plugins as unknown[]).push({\n name: 'externalize-react',\n resolveId(source: string) {\n if (modules.includes(source)) {\n resolved.add(source);\n return { id: source, external: true };\n }\n return null;\n },\n });\n (rolldownOptions.plugins as unknown[]).push(esmExternalRequirePlugin({ external: modules }));\n\n return null;\n },\n\n configResolved(resolvedConfig: ResolvedConfig) {\n const base = resolvedConfig.base ?? '/';\n const escapedBase = base.replaceAll(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n\n (resolvedConfig.plugins as Plugin[]).push({\n name: 'vite-plugin-react-bare-restore',\n transform(code: string) {\n if (resolved.size === 0) {\n return null;\n }\n const regex = new RegExp(`${escapedBase}@id\\\\/(${[...resolved].join('|')})`, 'g');\n return code.replace(regex, (_, mod: string) => mod);\n },\n });\n },\n\n resolveId(id) {\n if (modules.includes(id)) {\n resolved.add(id);\n return { id, external: true };\n }\n return null;\n },\n\n load(id) {\n if (resolved.has(id)) {\n return 'export default {};';\n }\n return null;\n },\n };\n}\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport react from '@vitejs/plugin-react';\nimport { build, esmExternalRequirePlugin } from 'vite';\n\nimport { REACT_MODULES } from '../vitePlugins';\n\nimport { type CompilerOptions } from './compilerOptions';\n\nexport const compileBlock = async ({ projectPath, entryFile, outputName }: CompilerOptions) => {\n return build({\n plugins: [react(), esmExternalRequirePlugin({ external: REACT_MODULES })],\n define: {\n 'process.env.NODE_ENV': JSON.stringify('production'),\n },\n root: projectPath,\n mode: 'production',\n build: {\n minify: 'terser',\n cssMinify: 'lightningcss',\n lib: {\n name: outputName,\n entry: entryFile,\n formats: ['es'],\n fileName: () => 'index.js',\n cssFileName: 'style',\n },\n rolldownOptions: {\n platform: 'browser',\n treeshake: {\n // TODO: Fix in Fondue\n moduleSideEffects: [\n { test: /@frontify\\/fondue-components/, sideEffects: false },\n { test: /@frontify\\/fondue-icons/, sideEffects: false },\n { test: /@frontify\\/fondue-tokens/, sideEffects: false },\n { test: /@frontify\\/fondue-charts/, sideEffects: false },\n { test: /@frontify\\/fondue-rte/, sideEffects: false },\n { test: /\\.css$/, sideEffects: true },\n ],\n },\n },\n },\n });\n};\n","/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport react from '@vitejs/plugin-react';\nimport { build, esmExternalRequirePlugin } from 'vite';\n\nimport { REACT_MODULES } from '../vitePlugins';\n\nimport { type CompilerOptions } from './compilerOptions';\n\nexport const compileTheme = async ({ projectPath, entryFile, outputName }: CompilerOptions) => {\n return build({\n plugins: [react(), esmExternalRequirePlugin({ external: REACT_MODULES })],\n define: {\n 'process.env.NODE_ENV': JSON.stringify('production'),\n },\n root: projectPath,\n mode: 'production',\n build: {\n minify: 'terser',\n cssMinify: 'lightningcss',\n lib: {\n name: outputName,\n entry: entryFile,\n formats: ['es'],\n fileName: () => 'index.js',\n cssFileName: 'style',\n },\n rolldownOptions: {\n platform: 'browser',\n treeshake: {\n // TODO: Fix in Fondue\n moduleSideEffects: [\n { test: /@frontify\\/fondue-components/, sideEffects: false },\n { test: /@frontify\\/fondue-icons/, sideEffects: false },\n { test: /@frontify\\/fondue-tokens/, sideEffects: false },\n { test: /@frontify\\/fondue-charts/, sideEffects: false },\n { test: /@frontify\\/fondue-rte/, sideEffects: false },\n { test: /\\.css$/, sideEffects: true },\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 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 resolveCredentials = (token?: string, instance?: string) => {\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 return { instanceUrl, accessToken };\n};\n\nexport const verifyCode = async (noVerify: boolean) => {\n if (noVerify) {\n return;\n }\n\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\nexport const collectFiles = async (projectPath: string, distPath: string) => {\n const buildFilesToIgnore = BUILD_FILE_BLOCK_LIST.map((pattern) => {\n if (pattern.includes('*')) {\n return `${fastGlob.convertPathToPattern(projectPath)}/${pattern}`;\n }\n return fastGlob.convertPathToPattern(`${projectPath}/${pattern}`);\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 packageJsonContent = reactiveJson<{ dependencies?: Record<string, string> }>(\n join(projectPath, 'package.json'),\n );\n\n return {\n build_files: await makeFilesDict(\n fastGlob.convertPathToPattern(`${projectPath}/${distPath}`),\n buildFilesToIgnore,\n ),\n source_files: await makeFilesDict(fastGlob.convertPathToPattern(projectPath), sourceFilesToIgnore),\n dependencies: packageJsonContent?.dependencies || {},\n };\n};\n\nexport const handleDeployError = (error: unknown): never => {\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\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 const { instanceUrl, accessToken } = resolveCredentials(token, instance);\n\n if (dryRun) {\n Logger.info(pc.blue('Dry run: enabled'));\n } else {\n const user = await getUser(instanceUrl, token);\n if (user) {\n Logger.info(`You are logged in as ${user.name} (${instanceUrl}).`);\n } else {\n return;\n }\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 await verifyCode(noVerify);\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 request = await collectFiles(projectPath, distPath);\n\n if (dryRun) {\n Logger.success('The command has been executed without any issue.');\n process.exit(0);\n }\n\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 occurred while deploying:', (error as HttpClientError).responseBody.error);\n process.exit(-1);\n }\n } catch (error) {\n handleDeployError(error);\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 }).catch(() => {});\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:${this.port}/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:${this.port}/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';\n\nimport pkg from '../../package.json';\nimport { getAppBridgeVersion, getReactVersion } from '../utils/getPackageVersion';\nimport { reactBareExternalPlugin } from '../utils/vitePlugins';\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 appBridgeVersion = getAppBridgeVersion(process.cwd());\n const reactVersion = getReactVersion(process.cwd());\n\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 reactBareExternalPlugin(),\n ],\n define: {\n 'process.env.NODE_ENV': JSON.stringify('development'),\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 forwardConsole: false,\n },\n });\n\n viteServer.middlewares.use('/', (req, res, next) => {\n if (req.url !== '/') {\n return next();\n }\n\n res.setHeader('Access-Control-Allow-Origin', '*');\n res.setHeader('Access-Control-Allow-Methods', 'GET, OPTIONS');\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 const host = req.headers.host || `localhost:${this.port}`;\n const actualPort = parseInt(host.split(':')[1] || String(this.port), 10);\n\n res.setHeader('Access-Control-Allow-Origin', '*');\n res.setHeader('Access-Control-Allow-Methods', 'GET, OPTIONS');\n res.setHeader('Content-Type', 'application/json');\n res.writeHead(200);\n return res.end(\n JSON.stringify({\n url: `http://${host}/${this.entryFilePath}`,\n entryFilePath: this.entryFilePath,\n port: actualPort,\n version: pkg.version,\n dependencies: {\n ...(appBridgeVersion ? { '@frontify/app-bridge': appBridgeVersion } : {}),\n react: reactVersion,\n },\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().catch(() => {});\n server.restart().catch(() => {});\n }\n },\n buildStart: () => {\n settingsSchema.rebuild().catch(() => {});\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';\n\nimport pkg from '../../package.json';\nimport { getAppBridgeThemeVersion, getReactVersion } from '../utils/getPackageVersion';\nimport { reactBareExternalPlugin } from '../utils/vitePlugins';\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 appBridgeThemeVersion = getAppBridgeThemeVersion(process.cwd());\n const reactVersion = getReactVersion(process.cwd());\n\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 reactBareExternalPlugin(),\n ],\n define: {\n 'process.env.NODE_ENV': JSON.stringify('development'),\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 forwardConsole: false,\n },\n });\n\n viteServer.middlewares.use('/', (req, res, next) => {\n if (req.url !== '/') {\n return next();\n }\n\n res.setHeader('Access-Control-Allow-Origin', '*');\n res.setHeader('Access-Control-Allow-Methods', 'GET, OPTIONS');\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 const host = req.headers.host || `localhost:${this.port}`;\n const actualPort = parseInt(host.split(':')[1] || String(this.port), 10);\n\n res.setHeader('Access-Control-Allow-Origin', '*');\n res.setHeader('Access-Control-Allow-Methods', 'GET, OPTIONS');\n res.setHeader('Content-Type', 'application/json');\n res.writeHead(200);\n return res.end(\n JSON.stringify({\n url: `http://${host}/${this.entryFilePath}`,\n entryFilePath: this.entryFilePath,\n port: actualPort,\n version: pkg.version,\n dependencies: {\n ...(appBridgeThemeVersion ? { '@frontify/app-bridge-theme': appBridgeThemeVersion } : {}),\n react: reactVersion,\n },\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';\n\nimport pc from 'picocolors';\n\nimport { type HttpClientError } from '../errors/HttpClientError';\nimport { Configuration, HttpClient, Logger, type UserInfo, getUser, reactiveJson } from '../utils/index';\n\nimport { type AppManifest } from './deploy';\n\nexport enum Availability {\n PRIVATE = 'PRIVATE',\n COMMUNITY = 'COMMUNITY',\n}\n\ntype PublishOptions = {\n releaseNotes: string;\n availability?: Availability;\n token?: string;\n instance?: string;\n};\n\nexport const publishApp = async ({\n releaseNotes,\n availability = Availability.PRIVATE,\n token,\n instance,\n}: PublishOptions): Promise<void> => {\n try {\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 publish command.`,\n );\n process.exit(-1);\n }\n\n const user: UserInfo | undefined = await getUser(instanceUrl, token);\n if (!user) {\n process.exit(-1);\n }\n\n Logger.info(`You are logged in as ${user.name} (${instanceUrl}).`);\n\n const projectPath = process.cwd();\n const manifestContent = reactiveJson<AppManifest>(join(projectPath, 'manifest.json'));\n const { appId } = manifestContent;\n\n const httpClient = new HttpClient(instanceUrl);\n\n const query = `mutation PublishMarketplaceApp {\n publishMarketplaceApp(\n input: {appId: \"${appId}\", releaseNotes: ${JSON.stringify(releaseNotes)}, availability: ${availability}}\n ) {\n id\n }\n}`;\n\n Logger.info('Publishing the app to the Frontify Marketplace...');\n\n try {\n await httpClient.post<{ data: { publishMarketplaceApp: { id: string } } }>(\n '/graphql',\n { query },\n { headers: { Authorization: `Bearer ${accessToken}` } },\n );\n\n Logger.success('The app has been published successfully.');\n } catch (error) {\n Logger.error('An error occurred while publishing:', (error as HttpClientError).responseBody.error);\n process.exit(-1);\n }\n } catch (error) {\n if (typeof error === 'string') {\n Logger.error('The publishing has failed and was aborted due to an error:', error);\n } else if (error instanceof Error) {\n Logger.error('The publishing has failed and was aborted due to an error:', error.message);\n } else {\n Logger.error('The publishing 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 { 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 publishApp,\n Availability,\n} from './commands/index';\nimport {\n type CompilerOptions,\n Logger,\n compileBlock,\n compilePlatformApp,\n compileTheme,\n getValidInstanceUrl,\n isValidName,\n reactiveJson,\n} from './utils/index';\n\ntype LoginOptions = { instance: string; port: number };\ntype ServeOptions = { entryPath: string; port: number; allowExternal: boolean; appType?: string };\ntype DeployOptions = {\n entryPath: string;\n outDir: string;\n dryRun: boolean;\n noVerify: boolean;\n open: boolean;\n appType?: string;\n instance?: string;\n token?: string;\n};\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: LoginOptions) => {\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 ])) as { promptedInstanceUrl: string };\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\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: ServeOptions) => {\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\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: DeployOptions) => {\n const manifest = reactiveJson<AppManifest>(join(process.cwd(), 'manifest.json'));\n const appType = options.appType || manifest.appType;\n\n const compilers: Record<string, (options: CompilerOptions) => Promise<unknown>> = {\n 'content-block': compileBlock,\n 'platform-app': compilePlatformApp,\n theme: compileTheme,\n };\n\n const compiler = compilers[appType ?? ''];\n if (!compiler) {\n throw new Error(`Unknown app type \"${appType}\". Expected one of: ${Object.keys(compilers).join(', ')}`);\n }\n\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 compiler,\n );\n });\n\ncli.command('publish', 'publish the app to the marketplace')\n .option('--releaseNotes, --release-notes <releaseNotes>', '[string] release notes for the publish')\n .option(\n '--availability [availability]',\n `[string] availability of the app (${Object.values(Availability).join(', ')})`,\n { default: Availability.PRIVATE },\n )\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 if (!options.releaseNotes) {\n Logger.error('Release notes are required. Use --releaseNotes=\"Your release notes\".');\n process.exit(-1);\n }\n\n await publishApp({\n releaseNotes: options.releaseNotes,\n availability: options.availability,\n token: options.token,\n instance: options.instance,\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 ])) as { promptedAppName: string; stylingFramework: string; appType: string };\n\n if (!promptedAppName || !stylingFramework || !appType) {\n exit(0);\n }\n\n createNewApp(promptedAppName, stylingFramework, appType);\n});\n\ncli.help();\ncli.version(pkg.version);\n\ncli.parse(process.argv);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GCEa,UAA+B;CACxC,IAAM,oBAAM,IAAI,MAAM;AACtB,QAAO,GAAG,OAAO,EAAI,UAAU,CAAC,CAAC,SAAS,GAAG,IAAI,CAAC,GAAG,OAAO,EAAI,YAAY,CAAC,CAAC,SAAS,GAAG,IAAI,CAAC,GAAG,OAC9F,EAAI,YAAY,CACnB,CAAC,SAAS,GAAG,IAAI;GCAT,IAAb,MAAa,EAAO;CAChB,OAAO,YAAY,GAAG,GAA0B;AAC5C,UAAQ,IAAI,EAAO,OAAO,GAAG,EAAE,GAAG,EAAS;;CAG/C,OAAO,KAAK,GAAG,GAA0B;AACrC,UAAQ,IAAI,IAAI,GAAgB,CAAC,IAAI,EAAS,KAAK,IAAI,GAAG;;CAG9D,OAAO,QAAQ,GAAG,GAA0B;AACxC,UAAQ,IAAI,IAAI,GAAgB,CAAC,IAAI,EAAG,MAAM,EAAS,KAAK,IAAI,CAAC,GAAG;;CAGxE,OAAO,MAAM,GAAG,GAA0B;AACtC,UAAQ,MAAM,EAAG,IAAI,IAAI,GAAgB,CAAC,IAAI,EAAS,KAAK,IAAI,GAAG,CAAC;;CAGxE,OAAO,OAAO,IAAQ,GAAW;AAC7B,SAAO,IAAI,OAAO,EAAM;;GCpBX,IAArB,cAA+C,MAAM;CACjD,OAAgB;CAChB,YAAY,GAAc;AAEtB,EADA,OAAO,EACP,EAAO,MAAM,gBAAgB,EAAK,kBAAkB;;GCJ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AQ,KAAK,GAAG,GAGpB,MAAM,GAAW;EACb,cAAc,EAAQ;EACtB,cAAc,EAAQ;EACtB,OAAO,EAAQ;EACf,UAAU,EAAQ;EACrB,CAAC;EACJ,EAEN,EAAI,QAAQ,oBAAoB,+BAA+B,CAAC,OAAO,OAAO,MAAoB;CAC9F,IAAM,EAAE,oBAAiB,qBAAkB,eAAa,MAAM,EAAQ;EAClE;GACI,MAAM;GACN,MAAM;GACN,SAAS;GACT,SAAS,KAAW;GACpB,WAAW,MACH,EAAM,MAAM,KAAK,KACV,mCAGJ,GAAY,EAAM;GAEhC;EACD;GACI,MAAM;GACN,MAAM;GACN,SAAS;GACT,SAAS,CACL;IAAE,OAAO;IAAO,OAAO;IAAgB,EACvC;IAAE,OAAO;IAAS,OAAO;IAAiB,CAC7C;GACJ;EACD;GACI,MAAM;GACN,MAAM;GACN,SAAS;GACT,SAAS;IACL;KAAE,OAAO;KAAY,OAAO;KAAY;IACxC;KAAE,OAAO;KAAe,OAAO;KAAe;IAC9C;KAAE,OAAO;KAAQ,OAAO;KAAO;IAClC;GACJ;EACJ,CAAC;AAMF,EAJI,CAAC,KAAmB,CAAC,KAAoB,CAAC,MAC1C,EAAK,EAAE,EAGX,GAAa,GAAiB,GAAkB,EAAQ;EAC1D,EAEF,EAAI,MAAM,EACV,EAAI,QAAQ,EAAI,QAAQ,EAExB,EAAI,MAAM,QAAQ,KAAK"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@frontify/frontify-cli",
3
3
  "type": "module",
4
- "version": "6.0.0-alpha.2",
4
+ "version": "6.0.0",
5
5
  "author": "Frontify Developers <developers@frontify.com>",
6
6
  "repository": {
7
7
  "type": "git",
@@ -31,7 +31,7 @@
31
31
  "open": "^11.0.0",
32
32
  "picocolors": "^1.1.1",
33
33
  "prompts": "^2.4.2",
34
- "vite": "^8.0.7",
34
+ "vite": "^8.0.8",
35
35
  "vite-plugin-externals": "^0.6.2",
36
36
  "zod": "^3.25.76"
37
37
  },
@@ -42,14 +42,14 @@
42
42
  "@types/node": "^22.19.15",
43
43
  "@types/prompts": "^2.4.9",
44
44
  "@types/ws": "8.18.1",
45
- "@vitest/coverage-v8": "4.1.2",
46
- "@vitest/ui": "^4.1.2",
45
+ "@vitest/coverage-v8": "4.1.4",
46
+ "@vitest/ui": "^4.1.4",
47
47
  "eslint": "^9.39.4",
48
48
  "eslint-plugin-notice": "^1.0.0",
49
49
  "prettier": "^3.7.4",
50
50
  "ts-node": "^10.9.2",
51
51
  "typescript": "^5.9.3",
52
- "vitest": "^4.1.2"
52
+ "vitest": "^4.1.4"
53
53
  },
54
54
  "scripts": {
55
55
  "build": "vite build",
@@ -10,18 +10,15 @@
10
10
  "lint:fix": "eslint . --fix",
11
11
  "typecheck": "tsc --noEmit"
12
12
  },
13
- "peerDependencies": {
14
- "zustand": "4.5.5"
15
- },
16
13
  "dependencies": {
17
- "@frontify/app-bridge": "^3.12.0",
18
- "react": "^18.2.0",
19
- "react-dom": "^18.2.0"
14
+ "@frontify/app-bridge": "^3.12.8",
15
+ "react": "^18.3.1",
16
+ "react-dom": "^18.3.1"
20
17
  },
21
18
  "devDependencies": {
22
19
  "@frontify/eslint-config-react": "^0.17.6",
23
- "@frontify/frontify-cli": "^5.9.4",
24
- "@frontify/guideline-blocks-settings": "^1.0.12",
20
+ "@frontify/frontify-cli": "^6.0.0",
21
+ "@frontify/guideline-blocks-settings": "^2.1.18",
25
22
  "@types/react": "^18.3.27",
26
23
  "@types/react-dom": "^18.3.7",
27
24
  "eslint": "^8.57.0",
@@ -10,18 +10,15 @@
10
10
  "lint:fix": "eslint . --fix",
11
11
  "typecheck": "tsc --noEmit"
12
12
  },
13
- "peerDependencies": {
14
- "zustand": "4.5.5"
15
- },
16
13
  "dependencies": {
17
- "@frontify/app-bridge": "^3.12.0",
18
- "react": "^18.2.0",
19
- "react-dom": "^18.2.0"
14
+ "@frontify/app-bridge": "^3.12.8",
15
+ "react": "^18.3.1",
16
+ "react-dom": "^18.3.1"
20
17
  },
21
18
  "devDependencies": {
22
19
  "@frontify/eslint-config-react": "^0.17.6",
23
- "@frontify/frontify-cli": "^5.9.4",
24
- "@frontify/guideline-blocks-settings": "^1.0.12",
20
+ "@frontify/frontify-cli": "^6.0.0",
21
+ "@frontify/guideline-blocks-settings": "^2.1.18",
25
22
  "@types/react": "^18.3.27",
26
23
  "@types/react-dom": "^18.3.7",
27
24
  "eslint": "^8.57.1",
@@ -10,18 +10,15 @@
10
10
  "lint:fix": "eslint . --fix",
11
11
  "typecheck": "tsc --noEmit"
12
12
  },
13
- "peerDependencies": {
14
- "zustand": "4.5.5"
15
- },
16
13
  "dependencies": {
17
- "@frontify/app-bridge": "^3.12.0",
18
- "react": "^18.2.0",
19
- "react-dom": "^18.2.0"
14
+ "@frontify/app-bridge": "^3.12.8",
15
+ "react": "^18.3.1",
16
+ "react-dom": "^18.3.1"
20
17
  },
21
18
  "devDependencies": {
22
19
  "@frontify/eslint-config-react": "^0.17.6",
23
- "@frontify/frontify-cli": "^5.9.4",
24
- "@frontify/guideline-blocks-settings": "^1.0.12",
20
+ "@frontify/frontify-cli": "^6.0.0",
21
+ "@frontify/guideline-blocks-settings": "^2.1.18",
25
22
  "@types/react": "^18.3.27",
26
23
  "@types/react-dom": "^18.3.7",
27
24
  "autoprefixer": "^10.4.22",