@payloadcms/figma 0.0.1-alpha.50 → 0.0.1-alpha.51

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.
@@ -7,6 +7,7 @@ import { addFigmaProperty, applyModifications, detectRequiredChanges } from './p
7
7
  import { findPayloadConfig } from './payload-config-finder.js';
8
8
  import { checkPackageInstalled, getPayloadVersion, installPackage, uninstallPackage } from './payload-package-check.js';
9
9
  import { runTypeScriptCheck } from './typescript-validator.js';
10
+ import { getOwnVersion } from './version-check.js';
10
11
  /**
11
12
  * Main orchestrator for payload config modification
12
13
  * Checks package, detects needed changes, applies modifications
@@ -36,7 +37,8 @@ import { runTypeScriptCheck } from './typescript-validator.js';
36
37
  if (!isInstalled) {
37
38
  log.debug('@payloadcms/figma not installed, attempting installation...');
38
39
  try {
39
- await installPackage(projectPath, '@payloadcms/figma', packageManager);
40
+ const figmaVersion = await getOwnVersion();
41
+ await installPackage(projectPath, '@payloadcms/figma', packageManager, figmaVersion);
40
42
  changes.push('Installed @payloadcms/figma');
41
43
  modified = true;
42
44
  log.debug('@payloadcms/figma installed successfully');
@@ -9,6 +9,7 @@ import { downloadTemplateFromGitHub } from './download-template.js';
9
9
  import { tryInitRepoAndCommit } from './git.js';
10
10
  import { applyLambdaModifications } from './lambda-config.js';
11
11
  import { getRunCommand } from './package-manager.js';
12
+ import { getOwnVersion } from './version-check.js';
12
13
  /**
13
14
  * Detect if current directory has a Payload project
14
15
  *
@@ -86,26 +87,28 @@ import { getRunCommand } from './package-manager.js';
86
87
  *
87
88
  * @param packageJson - Package JSON object to update
88
89
  * @param latestVersion - Latest Payload version to use
89
- */ function replaceWorkspaceVersions(packageJson, latestVersion) {
90
+ */ function replaceWorkspaceVersions(packageJson, latestVersion, figmaVersion) {
90
91
  const deps = packageJson.dependencies;
91
92
  if (!deps) {
92
93
  return;
93
94
  }
94
95
  for (const [key, value] of Object.entries(deps)){
95
- // Replace workspace:* or workspace:^ with actual version
96
- if (typeof value === 'string' && value.startsWith('workspace:')) {
96
+ if (key === '@payloadcms/figma') {
97
+ deps[key] = figmaVersion;
98
+ } else if (typeof value === 'string' && value.startsWith('workspace:')) {
97
99
  deps[key] = latestVersion;
98
100
  } else if (key === 'payload' || key.startsWith('@payloadcms/')) {
99
101
  deps[key] = latestVersion;
100
102
  }
101
103
  }
102
- // Also handle devDependencies if present
103
104
  const devDeps = packageJson.devDependencies;
104
105
  if (!devDeps) {
105
106
  return;
106
107
  }
107
108
  for (const [key, value] of Object.entries(devDeps)){
108
- if (typeof value === 'string' && value.startsWith('workspace:')) {
109
+ if (key === '@payloadcms/figma') {
110
+ devDeps[key] = figmaVersion;
111
+ } else if (typeof value === 'string' && value.startsWith('workspace:')) {
109
112
  devDeps[key] = latestVersion;
110
113
  } else if (key === 'payload' || key.startsWith('@payloadcms/')) {
111
114
  devDeps[key] = latestVersion;
@@ -127,8 +130,11 @@ import { getRunCommand } from './package-manager.js';
127
130
  // Apply Lambda modifications BEFORE updating package.json
128
131
  // This ensures we don't overwrite version replacements
129
132
  await applyLambdaModifications(projectPath, packageManager);
130
- // Get latest Payload version from npm
131
- const latestVersion = await getLatestPackageVersion('payload');
133
+ // Get latest Payload version from npm and CLI's own version
134
+ const [latestVersion, figmaVersion] = await Promise.all([
135
+ getLatestPackageVersion('payload'),
136
+ getOwnVersion()
137
+ ]);
132
138
  // Delete any existing lock files from template (they reference workspace:* versions)
133
139
  // This ensures pnpm install creates a fresh lock file with actual versions
134
140
  const lockFiles = [
@@ -150,7 +156,7 @@ import { getRunCommand } from './package-manager.js';
150
156
  const packageJson = JSON.parse(packageJsonContent);
151
157
  packageJson.name = projectName;
152
158
  // Replace workspace:* versions with actual versions
153
- replaceWorkspaceVersions(packageJson, latestVersion);
159
+ replaceWorkspaceVersions(packageJson, latestVersion, figmaVersion);
154
160
  await fs.writeFile(packageJsonPath, JSON.stringify(packageJson, null, 2) + '\n', 'utf-8');
155
161
  // Ensure .gitignore has required entries
156
162
  // Note: .env file is created by init command with FIGMA_CONTENT_API_CONTENT_SYSTEM_ID
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@payloadcms/figma",
3
- "version": "0.0.1-alpha.50",
3
+ "version": "0.0.1-alpha.51",
4
4
  "license": "SEE LICENSE IN LICENSE.md",
5
5
  "type": "module",
6
6
  "exports": {