@payloadcms/figma 0.0.1-alpha.24 → 0.0.1-alpha.26

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.
@@ -1,6 +1,6 @@
1
1
  /**
2
- * Find the Payload config file using Payload's built-in finder
3
- * Changes to project directory temporarily and restores afterward
2
+ * Find the Payload config file using Payload's built-in finder when available,
3
+ * with fallback to simple file search for npx environments where payload isn't installed.
4
4
  *
5
5
  * @param projectPath - Absolute path to project directory
6
6
  * @returns Absolute path to config file, or null if not found
@@ -1 +1 @@
1
- {"version":3,"file":"payload-config-finder.d.ts","sourceRoot":"","sources":["../../src/utils/payload-config-finder.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,wBAAsB,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,GAAG,MAAM,CAAC,CAmBnF"}
1
+ {"version":3,"file":"payload-config-finder.d.ts","sourceRoot":"","sources":["../../src/utils/payload-config-finder.ts"],"names":[],"mappings":"AAaA;;;;;;GAMG;AACH,wBAAsB,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,GAAG,MAAM,CAAC,CAWnF"}
@@ -1,26 +1,65 @@
1
- import { findConfig } from 'payload/node';
1
+ import fs from 'fs/promises';
2
+ import path from 'path';
3
+ import * as log from './log.js';
4
+ // Standard Payload config file names in priority order
5
+ const CONFIG_FILES = [
6
+ 'payload.config.ts',
7
+ 'payload.config.js',
8
+ 'src/payload.config.ts',
9
+ 'src/payload.config.js'
10
+ ];
2
11
  /**
3
- * Find the Payload config file using Payload's built-in finder
4
- * Changes to project directory temporarily and restores afterward
12
+ * Find the Payload config file using Payload's built-in finder when available,
13
+ * with fallback to simple file search for npx environments where payload isn't installed.
5
14
  *
6
15
  * @param projectPath - Absolute path to project directory
7
16
  * @returns Absolute path to config file, or null if not found
8
17
  */ export async function findPayloadConfig(projectPath) {
18
+ // First, try using Payload's official config finder (if payload is installed)
19
+ const configFromPayload = await findConfigWithPayload(projectPath);
20
+ if (configFromPayload) {
21
+ return configFromPayload;
22
+ }
23
+ // Fallback: Simple file search for standard config locations
24
+ // This works when running via npx before payload is installed
25
+ log.debug('Payload not available, using fallback config finder');
26
+ return findConfigFallback(projectPath);
27
+ }
28
+ /**
29
+ * Try to find config using Payload's findConfig function.
30
+ * Returns null if payload is not installed (dynamic import fails).
31
+ */ async function findConfigWithPayload(projectPath) {
9
32
  const originalCwd = process.cwd();
10
33
  try {
34
+ // Dynamic import - will fail gracefully if payload is not installed
35
+ const { findConfig } = await import('payload/node');
11
36
  // findConfig requires being in the project directory
12
37
  process.chdir(projectPath);
13
- // Use Payload's official config finder
14
38
  const configPath = findConfig();
15
- // Wrap in Promise.resolve to satisfy async requirement
16
- return await Promise.resolve(configPath || null);
17
- } catch {
18
- // Config not found or error occurred
39
+ return configPath || null;
40
+ } catch (error) {
41
+ // payload not installed or other error - return null to use fallback
42
+ log.debug(`Could not use Payload findConfig: ${error instanceof Error ? error.message : 'unknown'}`);
19
43
  return null;
20
44
  } finally{
21
- // Always restore original working directory
22
45
  process.chdir(originalCwd);
23
46
  }
24
47
  }
48
+ /**
49
+ * Fallback config finder that checks standard locations.
50
+ * Used when payload is not installed (e.g., running via npx).
51
+ */ async function findConfigFallback(projectPath) {
52
+ for (const configFile of CONFIG_FILES){
53
+ const fullPath = path.join(projectPath, configFile);
54
+ try {
55
+ await fs.access(fullPath);
56
+ log.debug(`Found config at: ${fullPath}`);
57
+ return fullPath;
58
+ } catch {
59
+ // File doesn't exist, try next
60
+ }
61
+ }
62
+ return null;
63
+ }
25
64
 
26
65
  //# sourceMappingURL=payload-config-finder.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/payload-config-finder.ts"],"sourcesContent":["import { findConfig } from 'payload/node'\n\n/**\n * Find the Payload config file using Payload's built-in finder\n * Changes to project directory temporarily and restores afterward\n *\n * @param projectPath - Absolute path to project directory\n * @returns Absolute path to config file, or null if not found\n */\nexport async function findPayloadConfig(projectPath: string): Promise<null | string> {\n const originalCwd = process.cwd()\n\n try {\n // findConfig requires being in the project directory\n process.chdir(projectPath)\n\n // Use Payload's official config finder\n const configPath = findConfig()\n\n // Wrap in Promise.resolve to satisfy async requirement\n return await Promise.resolve(configPath || null)\n } catch {\n // Config not found or error occurred\n return null\n } finally {\n // Always restore original working directory\n process.chdir(originalCwd)\n }\n}\n"],"names":["findConfig","findPayloadConfig","projectPath","originalCwd","process","cwd","chdir","configPath","Promise","resolve"],"mappings":"AAAA,SAASA,UAAU,QAAQ,eAAc;AAEzC;;;;;;CAMC,GACD,OAAO,eAAeC,kBAAkBC,WAAmB;IACzD,MAAMC,cAAcC,QAAQC,GAAG;IAE/B,IAAI;QACF,qDAAqD;QACrDD,QAAQE,KAAK,CAACJ;QAEd,uCAAuC;QACvC,MAAMK,aAAaP;QAEnB,uDAAuD;QACvD,OAAO,MAAMQ,QAAQC,OAAO,CAACF,cAAc;IAC7C,EAAE,OAAM;QACN,qCAAqC;QACrC,OAAO;IACT,SAAU;QACR,4CAA4C;QAC5CH,QAAQE,KAAK,CAACH;IAChB;AACF"}
1
+ {"version":3,"sources":["../../src/utils/payload-config-finder.ts"],"sourcesContent":["import fs from 'fs/promises'\nimport path from 'path'\n\nimport * as log from './log.js'\n\n// Standard Payload config file names in priority order\nconst CONFIG_FILES = [\n 'payload.config.ts',\n 'payload.config.js',\n 'src/payload.config.ts',\n 'src/payload.config.js',\n]\n\n/**\n * Find the Payload config file using Payload's built-in finder when available,\n * with fallback to simple file search for npx environments where payload isn't installed.\n *\n * @param projectPath - Absolute path to project directory\n * @returns Absolute path to config file, or null if not found\n */\nexport async function findPayloadConfig(projectPath: string): Promise<null | string> {\n // First, try using Payload's official config finder (if payload is installed)\n const configFromPayload = await findConfigWithPayload(projectPath)\n if (configFromPayload) {\n return configFromPayload\n }\n\n // Fallback: Simple file search for standard config locations\n // This works when running via npx before payload is installed\n log.debug('Payload not available, using fallback config finder')\n return findConfigFallback(projectPath)\n}\n\n/**\n * Try to find config using Payload's findConfig function.\n * Returns null if payload is not installed (dynamic import fails).\n */\nasync function findConfigWithPayload(projectPath: string): Promise<null | string> {\n const originalCwd = process.cwd()\n\n try {\n // Dynamic import - will fail gracefully if payload is not installed\n const { findConfig } = await import('payload/node')\n\n // findConfig requires being in the project directory\n process.chdir(projectPath)\n const configPath = findConfig()\n return configPath || null\n } catch (error) {\n // payload not installed or other error - return null to use fallback\n log.debug(\n `Could not use Payload findConfig: ${error instanceof Error ? error.message : 'unknown'}`,\n )\n return null\n } finally {\n process.chdir(originalCwd)\n }\n}\n\n/**\n * Fallback config finder that checks standard locations.\n * Used when payload is not installed (e.g., running via npx).\n */\nasync function findConfigFallback(projectPath: string): Promise<null | string> {\n for (const configFile of CONFIG_FILES) {\n const fullPath = path.join(projectPath, configFile)\n try {\n await fs.access(fullPath)\n log.debug(`Found config at: ${fullPath}`)\n return fullPath\n } catch {\n // File doesn't exist, try next\n }\n }\n\n return null\n}\n"],"names":["fs","path","log","CONFIG_FILES","findPayloadConfig","projectPath","configFromPayload","findConfigWithPayload","debug","findConfigFallback","originalCwd","process","cwd","findConfig","chdir","configPath","error","Error","message","configFile","fullPath","join","access"],"mappings":"AAAA,OAAOA,QAAQ,cAAa;AAC5B,OAAOC,UAAU,OAAM;AAEvB,YAAYC,SAAS,WAAU;AAE/B,uDAAuD;AACvD,MAAMC,eAAe;IACnB;IACA;IACA;IACA;CACD;AAED;;;;;;CAMC,GACD,OAAO,eAAeC,kBAAkBC,WAAmB;IACzD,8EAA8E;IAC9E,MAAMC,oBAAoB,MAAMC,sBAAsBF;IACtD,IAAIC,mBAAmB;QACrB,OAAOA;IACT;IAEA,6DAA6D;IAC7D,8DAA8D;IAC9DJ,IAAIM,KAAK,CAAC;IACV,OAAOC,mBAAmBJ;AAC5B;AAEA;;;CAGC,GACD,eAAeE,sBAAsBF,WAAmB;IACtD,MAAMK,cAAcC,QAAQC,GAAG;IAE/B,IAAI;QACF,oEAAoE;QACpE,MAAM,EAAEC,UAAU,EAAE,GAAG,MAAM,MAAM,CAAC;QAEpC,qDAAqD;QACrDF,QAAQG,KAAK,CAACT;QACd,MAAMU,aAAaF;QACnB,OAAOE,cAAc;IACvB,EAAE,OAAOC,OAAO;QACd,qEAAqE;QACrEd,IAAIM,KAAK,CACP,CAAC,kCAAkC,EAAEQ,iBAAiBC,QAAQD,MAAME,OAAO,GAAG,WAAW;QAE3F,OAAO;IACT,SAAU;QACRP,QAAQG,KAAK,CAACJ;IAChB;AACF;AAEA;;;CAGC,GACD,eAAeD,mBAAmBJ,WAAmB;IACnD,KAAK,MAAMc,cAAchB,aAAc;QACrC,MAAMiB,WAAWnB,KAAKoB,IAAI,CAAChB,aAAac;QACxC,IAAI;YACF,MAAMnB,GAAGsB,MAAM,CAACF;YAChBlB,IAAIM,KAAK,CAAC,CAAC,iBAAiB,EAAEY,UAAU;YACxC,OAAOA;QACT,EAAE,OAAM;QACN,+BAA+B;QACjC;IACF;IAEA,OAAO;AACT"}
@@ -1 +1 @@
1
- {"version":3,"file":"payload-config-modifier.d.ts","sourceRoot":"","sources":["../../src/utils/payload-config-modifier.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAI1D,OAAO,EAIL,KAAK,mBAAmB,EACzB,MAAM,yBAAyB,CAAA;AAKhC,MAAM,MAAM,kBAAkB,GAAG;IAC/B,OAAO,EAAE,MAAM,EAAE,CAAA;IACjB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,OAAO,CAAA;IACjB,OAAO,EAAE,OAAO,CAAA;IAChB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;CACpB,CAAA;AAED;;;GAGG;AACH,wBAAsB,wBAAwB,CAC5C,WAAW,EAAE,MAAM,EACnB,cAAc,EAAE,cAAc,EAC9B,WAAW,CAAC,EAAE,mBAAmB,GAChC,OAAO,CAAC,kBAAkB,CAAC,CAqL7B;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAwC9D"}
1
+ {"version":3,"file":"payload-config-modifier.d.ts","sourceRoot":"","sources":["../../src/utils/payload-config-modifier.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAI1D,OAAO,EAIL,KAAK,mBAAmB,EACzB,MAAM,yBAAyB,CAAA;AAKhC,MAAM,MAAM,kBAAkB,GAAG;IAC/B,OAAO,EAAE,MAAM,EAAE,CAAA;IACjB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,OAAO,CAAA;IACjB,OAAO,EAAE,OAAO,CAAA;IAChB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;CACpB,CAAA;AAED;;;GAGG;AACH,wBAAsB,wBAAwB,CAC5C,WAAW,EAAE,MAAM,EACnB,cAAc,EAAE,cAAc,EAC9B,WAAW,CAAC,EAAE,mBAAmB,GAChC,OAAO,CAAC,kBAAkB,CAAC,CAuN7B;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAwC9D"}
@@ -103,13 +103,38 @@ import { runTypeScriptCheck } from './typescript-validator.js';
103
103
  if (modified) {
104
104
  await sourceFile.save();
105
105
  log.debug('Config file saved');
106
- // 7. Uninstall orphaned packages
106
+ // 7. Handle package management
107
107
  const packagesToUninstall = [];
108
+ // Uninstall db adapter (buildFigmaConfig provides its own)
108
109
  if (detection.dbProperty) {
109
110
  packagesToUninstall.push(detection.dbProperty.importSource);
110
111
  }
111
- if (detection.editorProperty?.isDefault) {
112
- packagesToUninstall.push(detection.editorProperty.importSource);
112
+ // Ensure lexical is installed if user doesn't have a custom editor
113
+ // (buildFigmaConfig uses lexicalEditor() as default)
114
+ if (!detection.editorProperty) {
115
+ log.debug('No editor property detected - will ensure lexical is installed for default editor');
116
+ } else if (detection.editorProperty.isDefault) {
117
+ log.debug('Default lexicalEditor() detected - will ensure lexical is installed');
118
+ } else {
119
+ log.debug(`Custom editor detected (${detection.editorProperty.importSource}) - skipping lexical installation`);
120
+ }
121
+ if (!detection.editorProperty || detection.editorProperty.isDefault) {
122
+ log.debug('Checking if @payloadcms/richtext-lexical is installed...');
123
+ const hasLexical = await checkPackageInstalled(projectPath, '@payloadcms/richtext-lexical');
124
+ if (!hasLexical) {
125
+ log.debug('@payloadcms/richtext-lexical not found, installing...');
126
+ try {
127
+ await installPackage(projectPath, '@payloadcms/richtext-lexical', packageManager);
128
+ changes.push('Installed @payloadcms/richtext-lexical (default editor)');
129
+ log.debug('Successfully installed @payloadcms/richtext-lexical');
130
+ } catch (error) {
131
+ log.debug(`Failed to install @payloadcms/richtext-lexical: ${error instanceof Error ? error.message : 'Unknown error'}`);
132
+ // Don't fail on install error - user can install manually if needed
133
+ warnings.push('Could not install @payloadcms/richtext-lexical - you may need to install it manually');
134
+ }
135
+ } else {
136
+ log.debug('@payloadcms/richtext-lexical already installed, skipping');
137
+ }
113
138
  }
114
139
  if (packagesToUninstall.length > 0) {
115
140
  log.debug(`Uninstalling ${packagesToUninstall.length} orphaned packages...`);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/payload-config-modifier.ts"],"sourcesContent":["import pc from 'picocolors'\nimport { Project } from 'ts-morph'\n\nimport type { PackageManager } from './package-manager.js'\n\nimport { formatFile } from './formatter.js'\nimport * as log from './log.js'\nimport {\n addFigmaProperty,\n applyModifications,\n detectRequiredChanges,\n type FigmaPropertyConfig,\n} from './payload-config-ast.js'\nimport { findPayloadConfig } from './payload-config-finder.js'\nimport { checkPackageInstalled, installPackage, uninstallPackage } from './payload-package-check.js'\nimport { runTypeScriptCheck } from './typescript-validator.js'\n\nexport type ModificationResult = {\n changes: string[]\n error?: string\n modified: boolean\n success: boolean\n warnings?: string[]\n}\n\n/**\n * Main orchestrator for payload config modification\n * Checks package, detects needed changes, applies modifications\n */\nexport async function ensurePayloadFigmaConfig(\n projectPath: string,\n packageManager: PackageManager,\n figmaConfig?: FigmaPropertyConfig,\n): Promise<ModificationResult> {\n const changes: string[] = []\n const warnings: string[] = []\n let modified = false\n\n try {\n log.debug(`Starting payload config modification for: ${projectPath}`)\n\n // 1. Find config file\n const configPath = await findPayloadConfig(projectPath)\n if (!configPath) {\n log.debug(`Config file not found in: ${projectPath}`)\n return {\n changes: [],\n error: 'payload.config.ts not found in project',\n modified: false,\n success: false,\n }\n }\n\n log.debug(`Found config file: ${configPath}`)\n\n // 2. Check/install @payloadcms/figma package\n const isInstalled = await checkPackageInstalled(projectPath, '@payloadcms/figma')\n if (!isInstalled) {\n log.debug('@payloadcms/figma not installed, attempting installation...')\n try {\n await installPackage(projectPath, '@payloadcms/figma', packageManager)\n changes.push('Installed @payloadcms/figma')\n modified = true\n log.debug('@payloadcms/figma installed successfully')\n } catch (error) {\n log.debug(\n `Failed to install @payloadcms/figma: ${error instanceof Error ? error.message : 'Unknown error'}`,\n )\n return {\n changes: [],\n error: 'Failed to install @payloadcms/figma',\n modified: false,\n success: false,\n }\n }\n } else {\n log.debug('@payloadcms/figma already installed')\n }\n\n // 3. Parse config with ts-morph\n log.debug('Parsing config file with ts-morph...')\n const project = new Project({\n skipAddingFilesFromTsConfig: true,\n })\n const sourceFile = project.addSourceFileAtPath(configPath)\n\n // 4. Detect required changes\n log.debug('Detecting required changes...')\n const detection = detectRequiredChanges(sourceFile)\n\n log.debug(\n `Detection results: needsImportChange=${detection.needsImportChange}, hasAlias=${detection.hasAlias}, hasBuildConfig=${detection.hasBuildConfig}`,\n )\n\n // Handle failure modes\n if (detection.hasAlias) {\n log.debug('Config uses import alias (e.g., buildConfig as X)')\n return {\n changes,\n error: 'Config uses import alias - manual modification required',\n modified,\n success: false,\n }\n }\n\n if (detection.hasBuildConfig === false) {\n log.debug('No buildConfig call found in config file')\n return {\n changes,\n error: 'Config structure not recognized (no buildConfig call found)',\n modified,\n success: false,\n }\n }\n\n // 5. Apply modifications\n log.debug('Applying modifications...')\n const modResult = applyModifications(sourceFile, detection)\n if (modResult.modified) {\n changes.push(...modResult.changes)\n modified = true\n\n log.debug(`Applied ${modResult.changes.length} modifications`)\n }\n\n // 6. Add figma property if config provided and doesn't exist\n if (figmaConfig && !detection.figmaObjectExists) {\n log.debug('Adding figma property to buildConfig...')\n const figmaResult = addFigmaProperty(sourceFile, figmaConfig)\n if (figmaResult.modified) {\n changes.push(...figmaResult.changes)\n modified = true\n log.debug(`Added figma property`)\n } else {\n log.debug('Figma property not added (may already exist)')\n }\n } else if (detection.figmaObjectExists) {\n log.debug('Figma property already exists, skipping')\n }\n\n // Save file if any modifications were made\n if (modified) {\n await sourceFile.save()\n log.debug('Config file saved')\n\n // 7. Uninstall orphaned packages\n const packagesToUninstall: string[] = []\n\n if (detection.dbProperty) {\n packagesToUninstall.push(detection.dbProperty.importSource)\n }\n\n if (detection.editorProperty?.isDefault) {\n packagesToUninstall.push(detection.editorProperty.importSource)\n }\n\n if (packagesToUninstall.length > 0) {\n log.debug(`Uninstalling ${packagesToUninstall.length} orphaned packages...`)\n }\n\n for (const pkg of packagesToUninstall) {\n try {\n await uninstallPackage(projectPath, pkg, packageManager)\n changes.push(`Uninstalled ${pkg}`)\n log.debug(`Uninstalled ${pkg}`)\n } catch (error) {\n log.debug(\n `Failed to uninstall ${pkg}: ${error instanceof Error ? error.message : 'Unknown error'}`,\n )\n // Don't fail on uninstall errors - orphaned package is better than broken config\n }\n }\n\n // 8. Format file\n log.debug('Formatting config file...')\n const formatResult = await formatFile(configPath, packageManager)\n if (!formatResult.success && formatResult.warning) {\n warnings.push(formatResult.warning)\n log.debug(`Formatting warning: ${formatResult.warning}`)\n }\n\n // 9. Run TypeScript validation\n log.debug('Running TypeScript validation...')\n const tsResult = await runTypeScriptCheck(projectPath, packageManager)\n if (!tsResult.success && tsResult.errors.length > 0) {\n warnings.push(\"TypeScript validation found issues - run 'pnpm build' for details\")\n log.debug(`TypeScript validation found ${tsResult.errors.length} issues`)\n }\n } else {\n log.debug('No modifications needed - config already correct')\n }\n\n log.debug('Payload config modification completed successfully')\n\n return {\n changes,\n modified,\n success: true,\n warnings: warnings.length > 0 ? warnings : undefined,\n }\n } catch (error) {\n log.debug(\n `Unexpected error in ensurePayloadFigmaConfig: ${error instanceof Error ? error.message : 'Unknown error'}`,\n )\n if (error instanceof Error && error.stack) {\n log.debug(`Stack trace: ${error.stack}`)\n }\n return {\n changes,\n error: error instanceof Error ? error.message : 'Unknown error occurred',\n modified,\n success: false,\n }\n }\n}\n\n/**\n * Display manual configuration instructions\n */\nexport function displayManualInstructions(reason: string): void {\n const leftLineWrap = (message: string): string => {\n // Add '┌ ' prefix to first line, '│ ' to subsequent lines, and '└ ' to last line\n return message\n .split('\\n')\n .map((line, index, arr) => {\n if (index === 0) {\n return `${pc.dim('┌ ')}${line}`\n } else if (index === arr.length - 1) {\n return `${pc.dim('└ ')}${line}`\n } else {\n return `${pc.dim('│ ')}${line}`\n }\n })\n .join('\\n')\n }\n\n const message = leftLineWrap(`${pc.cyan(pc.bold('Manual Configuration Required'))}\n\nUnable to automatically modify payload.config.ts\nReason: ${pc.yellow(reason)}\n\n${pc.bold('Required changes:')}\n\n1. Replace buildConfig import:\n ${pc.dim('- FROM: ')}${pc.cyan(\"import { buildConfig } from 'payload'\")}\n ${pc.dim('- TO: ')}${pc.cyan(\"import { buildFigmaConfig } from '@payloadcms/figma'\")}\n\n2. Remove these properties from buildConfig():\n • db\n • secret\n • editor (if using default lexicalEditor())\n\n3. Install package:\n ${pc.cyan('pnpm add @payloadcms/figma')}\n\nThen run: ${pc.cyan('npx @payloadcms/figma init')}`)\n\n // eslint-disable-next-line no-console\n console.log(message)\n}\n"],"names":["pc","Project","formatFile","log","addFigmaProperty","applyModifications","detectRequiredChanges","findPayloadConfig","checkPackageInstalled","installPackage","uninstallPackage","runTypeScriptCheck","ensurePayloadFigmaConfig","projectPath","packageManager","figmaConfig","changes","warnings","modified","debug","configPath","error","success","isInstalled","push","Error","message","project","skipAddingFilesFromTsConfig","sourceFile","addSourceFileAtPath","detection","needsImportChange","hasAlias","hasBuildConfig","modResult","length","figmaObjectExists","figmaResult","save","packagesToUninstall","dbProperty","importSource","editorProperty","isDefault","pkg","formatResult","warning","tsResult","errors","undefined","stack","displayManualInstructions","reason","leftLineWrap","split","map","line","index","arr","dim","join","cyan","bold","yellow","console"],"mappings":"AAAA,OAAOA,QAAQ,aAAY;AAC3B,SAASC,OAAO,QAAQ,WAAU;AAIlC,SAASC,UAAU,QAAQ,iBAAgB;AAC3C,YAAYC,SAAS,WAAU;AAC/B,SACEC,gBAAgB,EAChBC,kBAAkB,EAClBC,qBAAqB,QAEhB,0BAAyB;AAChC,SAASC,iBAAiB,QAAQ,6BAA4B;AAC9D,SAASC,qBAAqB,EAAEC,cAAc,EAAEC,gBAAgB,QAAQ,6BAA4B;AACpG,SAASC,kBAAkB,QAAQ,4BAA2B;AAU9D;;;CAGC,GACD,OAAO,eAAeC,yBACpBC,WAAmB,EACnBC,cAA8B,EAC9BC,WAAiC;IAEjC,MAAMC,UAAoB,EAAE;IAC5B,MAAMC,WAAqB,EAAE;IAC7B,IAAIC,WAAW;IAEf,IAAI;QACFf,IAAIgB,KAAK,CAAC,CAAC,0CAA0C,EAAEN,aAAa;QAEpE,sBAAsB;QACtB,MAAMO,aAAa,MAAMb,kBAAkBM;QAC3C,IAAI,CAACO,YAAY;YACfjB,IAAIgB,KAAK,CAAC,CAAC,0BAA0B,EAAEN,aAAa;YACpD,OAAO;gBACLG,SAAS,EAAE;gBACXK,OAAO;gBACPH,UAAU;gBACVI,SAAS;YACX;QACF;QAEAnB,IAAIgB,KAAK,CAAC,CAAC,mBAAmB,EAAEC,YAAY;QAE5C,6CAA6C;QAC7C,MAAMG,cAAc,MAAMf,sBAAsBK,aAAa;QAC7D,IAAI,CAACU,aAAa;YAChBpB,IAAIgB,KAAK,CAAC;YACV,IAAI;gBACF,MAAMV,eAAeI,aAAa,qBAAqBC;gBACvDE,QAAQQ,I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,GAAG;gBACf,OAAO,GAAG1D,GAAG4D,GAAG,CAAC,SAASH,MAAM;YAClC,OAAO,IAAIC,UAAUC,IAAIvB,MAAM,GAAG,GAAG;gBACnC,OAAO,GAAGpC,GAAG4D,GAAG,CAAC,SAASH,MAAM;YAClC,OAAO;gBACL,OAAO,GAAGzD,GAAG4D,GAAG,CAAC,SAASH,MAAM;YAClC;QACF,GACCI,IAAI,CAAC;IACV;IAEA,MAAMnC,UAAU4B,aAAa,GAAGtD,GAAG8D,IAAI,CAAC9D,GAAG+D,IAAI,CAAC,kCAAkC;;;QAG5E,EAAE/D,GAAGgE,MAAM,CAACX,QAAQ;;AAE5B,EAAErD,GAAG+D,IAAI,CAAC,qBAAqB;;;GAG5B,EAAE/D,GAAG4D,GAAG,CAAC,cAAc5D,GAAG8D,IAAI,CAAC,yCAAyC;GACxE,EAAE9D,GAAG4D,GAAG,CAAC,cAAc5D,GAAG8D,IAAI,CAAC,wDAAwD;;;;;;;;GAQvF,EAAE9D,GAAG8D,IAAI,CAAC,8BAA8B;;UAEjC,EAAE9D,GAAG8D,IAAI,CAAC,+BAA+B;IAEjD,sCAAsC;IACtCG,QAAQ9D,GAAG,CAACuB;AACd"}
1
+ {"version":3,"sources":["../../src/utils/payload-config-modifier.ts"],"sourcesContent":["import pc from 'picocolors'\nimport { Project } from 'ts-morph'\n\nimport type { PackageManager } from './package-manager.js'\n\nimport { formatFile } from './formatter.js'\nimport * as log from './log.js'\nimport {\n addFigmaProperty,\n applyModifications,\n detectRequiredChanges,\n type FigmaPropertyConfig,\n} from './payload-config-ast.js'\nimport { findPayloadConfig } from './payload-config-finder.js'\nimport { checkPackageInstalled, installPackage, uninstallPackage } from './payload-package-check.js'\nimport { runTypeScriptCheck } from './typescript-validator.js'\n\nexport type ModificationResult = {\n changes: string[]\n error?: string\n modified: boolean\n success: boolean\n warnings?: string[]\n}\n\n/**\n * Main orchestrator for payload config modification\n * Checks package, detects needed changes, applies modifications\n */\nexport async function ensurePayloadFigmaConfig(\n projectPath: string,\n packageManager: PackageManager,\n figmaConfig?: FigmaPropertyConfig,\n): Promise<ModificationResult> {\n const changes: string[] = []\n const warnings: string[] = []\n let modified = false\n\n try {\n log.debug(`Starting payload config modification for: ${projectPath}`)\n\n // 1. Find config file\n const configPath = await findPayloadConfig(projectPath)\n if (!configPath) {\n log.debug(`Config file not found in: ${projectPath}`)\n return {\n changes: [],\n error: 'payload.config.ts not found in project',\n modified: false,\n success: false,\n }\n }\n\n log.debug(`Found config file: ${configPath}`)\n\n // 2. Check/install @payloadcms/figma package\n const isInstalled = await checkPackageInstalled(projectPath, '@payloadcms/figma')\n if (!isInstalled) {\n log.debug('@payloadcms/figma not installed, attempting installation...')\n try {\n await installPackage(projectPath, '@payloadcms/figma', packageManager)\n changes.push('Installed @payloadcms/figma')\n modified = true\n log.debug('@payloadcms/figma installed successfully')\n } catch (error) {\n log.debug(\n `Failed to install @payloadcms/figma: ${error instanceof Error ? error.message : 'Unknown error'}`,\n )\n return {\n changes: [],\n error: 'Failed to install @payloadcms/figma',\n modified: false,\n success: false,\n }\n }\n } else {\n log.debug('@payloadcms/figma already installed')\n }\n\n // 3. Parse config with ts-morph\n log.debug('Parsing config file with ts-morph...')\n const project = new Project({\n skipAddingFilesFromTsConfig: true,\n })\n const sourceFile = project.addSourceFileAtPath(configPath)\n\n // 4. Detect required changes\n log.debug('Detecting required changes...')\n const detection = detectRequiredChanges(sourceFile)\n\n log.debug(\n `Detection results: needsImportChange=${detection.needsImportChange}, hasAlias=${detection.hasAlias}, hasBuildConfig=${detection.hasBuildConfig}`,\n )\n\n // Handle failure modes\n if (detection.hasAlias) {\n log.debug('Config uses import alias (e.g., buildConfig as X)')\n return {\n changes,\n error: 'Config uses import alias - manual modification required',\n modified,\n success: false,\n }\n }\n\n if (detection.hasBuildConfig === false) {\n log.debug('No buildConfig call found in config file')\n return {\n changes,\n error: 'Config structure not recognized (no buildConfig call found)',\n modified,\n success: false,\n }\n }\n\n // 5. Apply modifications\n log.debug('Applying modifications...')\n const modResult = applyModifications(sourceFile, detection)\n if (modResult.modified) {\n changes.push(...modResult.changes)\n modified = true\n\n log.debug(`Applied ${modResult.changes.length} modifications`)\n }\n\n // 6. Add figma property if config provided and doesn't exist\n if (figmaConfig && !detection.figmaObjectExists) {\n log.debug('Adding figma property to buildConfig...')\n const figmaResult = addFigmaProperty(sourceFile, figmaConfig)\n if (figmaResult.modified) {\n changes.push(...figmaResult.changes)\n modified = true\n log.debug(`Added figma property`)\n } else {\n log.debug('Figma property not added (may already exist)')\n }\n } else if (detection.figmaObjectExists) {\n log.debug('Figma property already exists, skipping')\n }\n\n // Save file if any modifications were made\n if (modified) {\n await sourceFile.save()\n log.debug('Config file saved')\n\n // 7. Handle package management\n const packagesToUninstall: string[] = []\n\n // Uninstall db adapter (buildFigmaConfig provides its own)\n if (detection.dbProperty) {\n packagesToUninstall.push(detection.dbProperty.importSource)\n }\n\n // Ensure lexical is installed if user doesn't have a custom editor\n // (buildFigmaConfig uses lexicalEditor() as default)\n if (!detection.editorProperty) {\n log.debug(\n 'No editor property detected - will ensure lexical is installed for default editor',\n )\n } else if (detection.editorProperty.isDefault) {\n log.debug('Default lexicalEditor() detected - will ensure lexical is installed')\n } else {\n log.debug(\n `Custom editor detected (${detection.editorProperty.importSource}) - skipping lexical installation`,\n )\n }\n\n if (!detection.editorProperty || detection.editorProperty.isDefault) {\n log.debug('Checking if @payloadcms/richtext-lexical is installed...')\n const hasLexical = await checkPackageInstalled(projectPath, '@payloadcms/richtext-lexical')\n if (!hasLexical) {\n log.debug('@payloadcms/richtext-lexical not found, installing...')\n try {\n await installPackage(projectPath, '@payloadcms/richtext-lexical', packageManager)\n changes.push('Installed @payloadcms/richtext-lexical (default editor)')\n log.debug('Successfully installed @payloadcms/richtext-lexical')\n } catch (error) {\n log.debug(\n `Failed to install @payloadcms/richtext-lexical: ${error instanceof Error ? error.message : 'Unknown error'}`,\n )\n // Don't fail on install error - user can install manually if needed\n warnings.push(\n 'Could not install @payloadcms/richtext-lexical - you may need to install it manually',\n )\n }\n } else {\n log.debug('@payloadcms/richtext-lexical already installed, skipping')\n }\n }\n\n if (packagesToUninstall.length > 0) {\n log.debug(`Uninstalling ${packagesToUninstall.length} orphaned packages...`)\n }\n\n for (const pkg of packagesToUninstall) {\n try {\n await uninstallPackage(projectPath, pkg, packageManager)\n changes.push(`Uninstalled ${pkg}`)\n log.debug(`Uninstalled ${pkg}`)\n } catch (error) {\n log.debug(\n `Failed to uninstall ${pkg}: ${error instanceof Error ? error.message : 'Unknown error'}`,\n )\n // Don't fail on uninstall errors - orphaned package is better than broken config\n }\n }\n\n // 8. Format file\n log.debug('Formatting config file...')\n const formatResult = await formatFile(configPath, packageManager)\n if (!formatResult.success && formatResult.warning) {\n warnings.push(formatResult.warning)\n log.debug(`Formatting warning: ${formatResult.warning}`)\n }\n\n // 9. Run TypeScript validation\n log.debug('Running TypeScript validation...')\n const tsResult = await runTypeScriptCheck(projectPath, packageManager)\n if (!tsResult.success && tsResult.errors.length > 0) {\n warnings.push(\"TypeScript validation found issues - run 'pnpm build' for details\")\n log.debug(`TypeScript validation found ${tsResult.errors.length} issues`)\n }\n } else {\n log.debug('No modifications needed - config already correct')\n }\n\n log.debug('Payload config modification completed successfully')\n\n return {\n changes,\n modified,\n success: true,\n warnings: warnings.length > 0 ? warnings : undefined,\n }\n } catch (error) {\n log.debug(\n `Unexpected error in ensurePayloadFigmaConfig: ${error instanceof Error ? error.message : 'Unknown error'}`,\n )\n if (error instanceof Error && error.stack) {\n log.debug(`Stack trace: ${error.stack}`)\n }\n return {\n changes,\n error: error instanceof Error ? error.message : 'Unknown error occurred',\n modified,\n success: false,\n }\n }\n}\n\n/**\n * Display manual configuration instructions\n */\nexport function displayManualInstructions(reason: string): void {\n const leftLineWrap = (message: string): string => {\n // Add '┌ ' prefix to first line, '│ ' to subsequent lines, and '└ ' to last line\n return message\n .split('\\n')\n .map((line, index, arr) => {\n if (index === 0) {\n return `${pc.dim('┌ ')}${line}`\n } else if (index === arr.length - 1) {\n return `${pc.dim('└ ')}${line}`\n } else {\n return `${pc.dim('│ ')}${line}`\n }\n })\n .join('\\n')\n }\n\n const message = leftLineWrap(`${pc.cyan(pc.bold('Manual Configuration Required'))}\n\nUnable to automatically modify payload.config.ts\nReason: ${pc.yellow(reason)}\n\n${pc.bold('Required changes:')}\n\n1. Replace buildConfig import:\n ${pc.dim('- FROM: ')}${pc.cyan(\"import { buildConfig } from 'payload'\")}\n ${pc.dim('- TO: ')}${pc.cyan(\"import { buildFigmaConfig } from '@payloadcms/figma'\")}\n\n2. Remove these properties from buildConfig():\n • db\n • secret\n • editor (if using default lexicalEditor())\n\n3. Install package:\n ${pc.cyan('pnpm add @payloadcms/figma')}\n\nThen run: ${pc.cyan('npx @payloadcms/figma init')}`)\n\n // eslint-disable-next-line no-console\n console.log(message)\n}\n"],"names":["pc","Project","formatFile","log","addFigmaProperty","applyModifications","detectRequiredChanges","findPayloadConfig","checkPackageInstalled","installPackage","uninstallPackage","runTypeScriptCheck","ensurePayloadFigmaConfig","projectPath","packageManager","figmaConfig","changes","warnings","modified","debug","configPath","error","success","isInstalled","push","Error","message","project","skipAddingFilesFromTsConfig","sourceFile","addSourceFileAtPath","detection","needsImportChange","hasAlias","hasBuildConfig","modResult","length","figmaObjectExists","figmaResult","save","packagesToUninstall","dbProperty","importSource","editorProperty","isDefault","hasLexical","pkg","formatResult","warning","tsResult","errors","undefined","stack","displayManualInstructions","reason","leftLineWrap","split","map","line","index","arr","dim","join","cyan","bold","yellow","console"],"mappings":"AAAA,OAAOA,QAAQ,aAAY;AAC3B,SAASC,OAAO,QAAQ,WAAU;AAIlC,SAASC,UAAU,QAAQ,iBAAgB;AAC3C,YAAYC,SAAS,WAAU;AAC/B,SACEC,gBAAgB,EAChBC,kBAAkB,EAClBC,qBAAqB,QAEhB,0BAAyB;AAChC,SAASC,iBAAiB,QAAQ,6BAA4B;AAC9D,SAASC,qBAAqB,EAAEC,cAAc,EAAEC,gBAAgB,QAA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,OAAO,GAAG;YAChDR;YACAI,SAAS;QACX;IACF;AACF;AAEA;;CAEC,GACD,OAAO,SAAS+B,0BAA0BC,MAAc;IACtD,MAAMC,eAAe,CAAC7B;QACpB,oFAAoF;QACpF,OAAOA,QACJ8B,KAAK,CAAC,MACNC,GAAG,CAAC,CAACC,MAAMC,OAAOC;YACjB,IAAID,UAAU,GAAG;gBACf,OAAO,GAAG3D,GAAG6D,GAAG,CAAC,SAASH,MAAM;YAClC,OAAO,IAAIC,UAAUC,IAAIxB,MAAM,GAAG,GAAG;gBACnC,OAAO,GAAGpC,GAAG6D,GAAG,CAAC,SAASH,MAAM;YAClC,OAAO;gBACL,OAAO,GAAG1D,GAAG6D,GAAG,CAAC,SAASH,MAAM;YAClC;QACF,GACCI,IAAI,CAAC;IACV;IAEA,MAAMpC,UAAU6B,aAAa,GAAGvD,GAAG+D,IAAI,CAAC/D,GAAGgE,IAAI,CAAC,kCAAkC;;;QAG5E,EAAEhE,GAAGiE,MAAM,CAACX,QAAQ;;AAE5B,EAAEtD,GAAGgE,IAAI,CAAC,qBAAqB;;;GAG5B,EAAEhE,GAAG6D,GAAG,CAAC,cAAc7D,GAAG+D,IAAI,CAAC,yCAAyC;GACxE,EAAE/D,GAAG6D,GAAG,CAAC,cAAc7D,GAAG+D,IAAI,CAAC,wDAAwD;;;;;;;;GAQvF,EAAE/D,GAAG+D,IAAI,CAAC,8BAA8B;;UAEjC,EAAE/D,GAAG+D,IAAI,CAAC,+BAA+B;IAEjD,sCAAsC;IACtCG,QAAQ/D,GAAG,CAACuB;AACd"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@payloadcms/figma",
3
- "version": "0.0.1-alpha.24",
3
+ "version": "0.0.1-alpha.26",
4
4
  "license": "SEE LICENSE IN LICENSE.md",
5
5
  "type": "module",
6
6
  "exports": {
@@ -28,7 +28,6 @@
28
28
  "dependencies": {
29
29
  "@clack/prompts": "^0.11.0",
30
30
  "@figma/rest-api-spec": "^0.34.0",
31
- "@payloadcms/richtext-lexical": "^3.54.0",
32
31
  "@sindresorhus/slugify": "^3.0.0",
33
32
  "arg": "^5.0.2",
34
33
  "conf": "^13.0.1",
@@ -37,7 +36,6 @@
37
36
  "jose": "6.0.12",
38
37
  "jsonwebtoken": "9.0.2",
39
38
  "open": "^10.1.0",
40
- "payload": "^3.54.0",
41
39
  "picocolors": "1.1.1",
42
40
  "tar": "^7.4.3",
43
41
  "terminal-link": "^5.0.0",
@@ -49,6 +47,15 @@
49
47
  "typescript": "5.9.3",
50
48
  "vitest": "3.2.4"
51
49
  },
50
+ "peerDependencies": {
51
+ "@payloadcms/richtext-lexical": "^3.0.0",
52
+ "payload": "^3.0.0"
53
+ },
54
+ "peerDependenciesMeta": {
55
+ "@payloadcms/richtext-lexical": {
56
+ "optional": true
57
+ }
58
+ },
52
59
  "publishConfig": {
53
60
  "registry": "https://registry.npmjs.org/"
54
61
  },