@payloadcms/figma 0.0.1-alpha.4 → 0.0.1-alpha.41
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/api/control-plane.d.ts +22 -1
- package/dist/api/control-plane.d.ts.map +1 -1
- package/dist/api/control-plane.js +55 -22
- package/dist/api/control-plane.js.map +1 -1
- package/dist/api/figma-api.d.ts.map +1 -1
- package/dist/api/figma-api.js +45 -26
- package/dist/api/figma-api.js.map +1 -1
- package/dist/auth/callback-server.d.ts.map +1 -1
- package/dist/auth/callback-server.js +2 -1
- package/dist/auth/callback-server.js.map +1 -1
- package/dist/auth/crypto-utils.d.ts.map +1 -1
- package/dist/auth/crypto-utils.js +5 -5
- package/dist/auth/crypto-utils.js.map +1 -1
- package/dist/auth/jwt-validator.d.ts +2 -1
- package/dist/auth/jwt-validator.d.ts.map +1 -1
- package/dist/auth/jwt-validator.js +2 -2
- package/dist/auth/jwt-validator.js.map +1 -1
- package/dist/auth/oauth-flow.d.ts +1 -1
- package/dist/auth/oauth-flow.d.ts.map +1 -1
- package/dist/auth/oauth-flow.js +9 -8
- package/dist/auth/oauth-flow.js.map +1 -1
- package/dist/auth/project-token.d.ts.map +1 -1
- package/dist/auth/project-token.js +9 -4
- package/dist/auth/project-token.js.map +1 -1
- package/dist/auth/refresh.d.ts.map +1 -1
- package/dist/auth/refresh.js +14 -9
- package/dist/auth/refresh.js.map +1 -1
- package/dist/auth/token-store.d.ts +10 -0
- package/dist/auth/token-store.d.ts.map +1 -1
- package/dist/auth/token-store.js +20 -0
- package/dist/auth/token-store.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +31 -0
- package/dist/cli.js.map +1 -1
- package/dist/commands/build-lambda-zip.d.ts +5 -0
- package/dist/commands/build-lambda-zip.d.ts.map +1 -0
- package/dist/commands/build-lambda-zip.js +19 -0
- package/dist/commands/build-lambda-zip.js.map +1 -0
- package/dist/commands/deploy.d.ts +4 -0
- package/dist/commands/deploy.d.ts.map +1 -1
- package/dist/commands/deploy.js +71 -129
- package/dist/commands/deploy.js.map +1 -1
- package/dist/commands/init.d.ts +1 -5
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +94 -85
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/list-tokens.d.ts.map +1 -1
- package/dist/commands/list-tokens.js +6 -3
- package/dist/commands/list-tokens.js.map +1 -1
- package/dist/commands/login.d.ts +8 -1
- package/dist/commands/login.d.ts.map +1 -1
- package/dist/commands/login.js +21 -11
- package/dist/commands/login.js.map +1 -1
- package/dist/commands/logout.js +2 -2
- package/dist/commands/logout.js.map +1 -1
- package/dist/config/oauth.d.ts +4 -14
- package/dist/config/oauth.d.ts.map +1 -1
- package/dist/config/oauth.js +19 -40
- package/dist/config/oauth.js.map +1 -1
- package/dist/constants.d.ts +26 -18
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +34 -20
- package/dist/constants.js.map +1 -1
- package/dist/db-content-api/README.md +98 -0
- package/dist/db-content-api/generated/content-api-types.d.ts +3854 -0
- package/dist/db-content-api/generated/content-api-types.d.ts.map +1 -0
- package/dist/db-content-api/generated/content-api-types.js +7 -0
- package/dist/db-content-api/generated/content-api-types.js.map +1 -0
- package/dist/db-content-api/index.d.ts +18 -0
- package/dist/db-content-api/index.d.ts.map +1 -0
- package/dist/db-content-api/index.js +578 -0
- package/dist/db-content-api/index.js.map +1 -0
- package/dist/db-content-api/temp-utilities/pagination.d.ts +13 -0
- package/dist/db-content-api/temp-utilities/pagination.d.ts.map +1 -0
- package/dist/db-content-api/temp-utilities/pagination.js +45 -0
- package/dist/db-content-api/temp-utilities/pagination.js.map +1 -0
- package/dist/db-content-api/temp-utilities/slug.d.ts +2 -0
- package/dist/db-content-api/temp-utilities/slug.d.ts.map +1 -0
- package/dist/db-content-api/temp-utilities/slug.js +3 -0
- package/dist/db-content-api/temp-utilities/slug.js.map +1 -0
- package/dist/db-content-api/temp-utilities/sorting.d.ts +3 -0
- package/dist/db-content-api/temp-utilities/sorting.d.ts.map +1 -0
- package/dist/db-content-api/temp-utilities/sorting.js +32 -0
- package/dist/db-content-api/temp-utilities/sorting.js.map +1 -0
- package/dist/db-content-api/temp-utilities/unwrapDocument.d.ts +4 -0
- package/dist/db-content-api/temp-utilities/unwrapDocument.d.ts.map +1 -0
- package/dist/db-content-api/temp-utilities/unwrapDocument.js +53 -0
- package/dist/db-content-api/temp-utilities/unwrapDocument.js.map +1 -0
- package/dist/db-content-api/utilities/auth.d.ts +30 -0
- package/dist/db-content-api/utilities/auth.d.ts.map +1 -0
- package/dist/db-content-api/utilities/auth.js +81 -0
- package/dist/db-content-api/utilities/auth.js.map +1 -0
- package/dist/db-content-api/utilities/data/applyDefaults.d.ts +7 -0
- package/dist/db-content-api/utilities/data/applyDefaults.d.ts.map +1 -0
- package/dist/db-content-api/utilities/data/applyDefaults.js +59 -0
- package/dist/db-content-api/utilities/data/applyDefaults.js.map +1 -0
- package/dist/db-content-api/utilities/data/castFieldValue.d.ts +11 -0
- package/dist/db-content-api/utilities/data/castFieldValue.d.ts.map +1 -0
- package/dist/db-content-api/utilities/data/castFieldValue.js +66 -0
- package/dist/db-content-api/utilities/data/castFieldValue.js.map +1 -0
- package/dist/db-content-api/utilities/data/index.d.ts +30 -0
- package/dist/db-content-api/utilities/data/index.d.ts.map +1 -0
- package/dist/db-content-api/utilities/data/index.js +182 -0
- package/dist/db-content-api/utilities/data/index.js.map +1 -0
- package/dist/db-content-api/utilities/data/removeVirtualFields.d.ts +12 -0
- package/dist/db-content-api/utilities/data/removeVirtualFields.d.ts.map +1 -0
- package/dist/db-content-api/utilities/data/removeVirtualFields.js +54 -0
- package/dist/db-content-api/utilities/data/removeVirtualFields.js.map +1 -0
- package/dist/db-content-api/utilities/data/stripFields.d.ts +48 -0
- package/dist/db-content-api/utilities/data/stripFields.d.ts.map +1 -0
- package/dist/db-content-api/utilities/data/stripFields.js +195 -0
- package/dist/db-content-api/utilities/data/stripFields.js.map +1 -0
- package/dist/db-content-api/utilities/joins.d.ts +55 -0
- package/dist/db-content-api/utilities/joins.d.ts.map +1 -0
- package/dist/db-content-api/utilities/joins.js +136 -0
- package/dist/db-content-api/utilities/joins.js.map +1 -0
- package/dist/db-content-api/utilities/where.d.ts +12 -0
- package/dist/db-content-api/utilities/where.d.ts.map +1 -0
- package/dist/db-content-api/utilities/where.js +107 -0
- package/dist/db-content-api/utilities/where.js.map +1 -0
- package/dist/endpoints/health.d.ts +3 -0
- package/dist/endpoints/health.d.ts.map +1 -0
- package/dist/endpoints/health.js +11 -0
- package/dist/endpoints/health.js.map +1 -0
- package/dist/exports/client.d.ts +4 -0
- package/dist/exports/client.d.ts.map +1 -0
- package/dist/exports/client.js +5 -0
- package/dist/exports/client.js.map +1 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/oauth/components/LoginButton/index.d.ts.map +1 -1
- package/dist/oauth/components/LoginButton/index.js +50 -6
- package/dist/oauth/components/LoginButton/index.js.map +1 -1
- package/dist/oauth/components/LoginButton/index.scss +50 -3
- package/dist/oauth/components/LogoutButton/index.d.ts.map +1 -1
- package/dist/oauth/components/LogoutButton/index.js +0 -1
- package/dist/oauth/components/LogoutButton/index.js.map +1 -1
- package/dist/oauth/defaults.d.ts.map +1 -1
- package/dist/oauth/defaults.js +29 -5
- package/dist/oauth/defaults.js.map +1 -1
- package/dist/oauth/endpoints/getLoginEndpoint.d.ts.map +1 -1
- package/dist/oauth/endpoints/getLoginEndpoint.js +4 -4
- package/dist/oauth/endpoints/getLoginEndpoint.js.map +1 -1
- package/dist/oauth/index.d.ts.map +1 -1
- package/dist/oauth/index.js +42 -7
- package/dist/oauth/index.js.map +1 -1
- package/dist/oauth/strategy/index.d.ts +0 -2
- package/dist/oauth/strategy/index.d.ts.map +1 -1
- package/dist/oauth/strategy/index.js +38 -15
- package/dist/oauth/strategy/index.js.map +1 -1
- package/dist/oauth/types.d.ts +6 -6
- package/dist/oauth/types.d.ts.map +1 -1
- package/dist/oauth/types.js.map +1 -1
- package/dist/oauth/utilities/createCookieOptions.d.ts.map +1 -1
- package/dist/oauth/utilities/createCookieOptions.js.map +1 -1
- package/dist/oauth/utilities/isDuplicateKeyError.d.ts +7 -0
- package/dist/oauth/utilities/isDuplicateKeyError.d.ts.map +1 -0
- package/dist/oauth/utilities/isDuplicateKeyError.js +14 -0
- package/dist/oauth/utilities/isDuplicateKeyError.js.map +1 -0
- package/dist/oauth/utilities/refreshTokens.d.ts.map +1 -1
- package/dist/oauth/utilities/refreshTokens.js +1 -1
- package/dist/oauth/utilities/refreshTokens.js.map +1 -1
- package/dist/plugin/build-config.d.ts +21 -4
- package/dist/plugin/build-config.d.ts.map +1 -1
- package/dist/plugin/build-config.js +114 -8
- package/dist/plugin/build-config.js.map +1 -1
- package/dist/storage-content-api/api-types.d.ts +161 -0
- package/dist/storage-content-api/api-types.d.ts.map +1 -0
- package/dist/storage-content-api/api-types.js +6 -0
- package/dist/storage-content-api/api-types.js.map +1 -0
- package/dist/storage-content-api/client-uploads/ClientUploadHandler.d.ts +9 -0
- package/dist/storage-content-api/client-uploads/ClientUploadHandler.d.ts.map +1 -0
- package/dist/storage-content-api/client-uploads/ClientUploadHandler.js +42 -0
- package/dist/storage-content-api/client-uploads/ClientUploadHandler.js.map +1 -0
- package/dist/storage-content-api/client-uploads/generateSignedURL.d.ts +13 -0
- package/dist/storage-content-api/client-uploads/generateSignedURL.d.ts.map +1 -0
- package/dist/storage-content-api/client-uploads/generateSignedURL.js +31 -0
- package/dist/storage-content-api/client-uploads/generateSignedURL.js.map +1 -0
- package/dist/storage-content-api/client.d.ts +6 -0
- package/dist/storage-content-api/client.d.ts.map +1 -0
- package/dist/storage-content-api/client.js +36 -0
- package/dist/storage-content-api/client.js.map +1 -0
- package/dist/storage-content-api/generateURL.d.ts +7 -0
- package/dist/storage-content-api/generateURL.d.ts.map +1 -0
- package/dist/storage-content-api/generateURL.js +7 -0
- package/dist/storage-content-api/generateURL.js.map +1 -0
- package/dist/storage-content-api/handleDelete.d.ts +8 -0
- package/dist/storage-content-api/handleDelete.d.ts.map +1 -0
- package/dist/storage-content-api/handleDelete.js +15 -0
- package/dist/storage-content-api/handleDelete.js.map +1 -0
- package/dist/storage-content-api/handleUpload.d.ts +11 -0
- package/dist/storage-content-api/handleUpload.d.ts.map +1 -0
- package/dist/storage-content-api/handleUpload.js +136 -0
- package/dist/storage-content-api/handleUpload.js.map +1 -0
- package/dist/storage-content-api/index.d.ts +5 -0
- package/dist/storage-content-api/index.d.ts.map +1 -0
- package/dist/storage-content-api/index.js +31 -0
- package/dist/storage-content-api/index.js.map +1 -0
- package/dist/storage-content-api/staticHandler.d.ts +10 -0
- package/dist/storage-content-api/staticHandler.d.ts.map +1 -0
- package/dist/storage-content-api/staticHandler.js +55 -0
- package/dist/storage-content-api/staticHandler.js.map +1 -0
- package/dist/storage-content-api/types.d.ts +10 -0
- package/dist/storage-content-api/types.d.ts.map +1 -0
- package/dist/storage-content-api/types.js +3 -0
- package/dist/storage-content-api/types.js.map +1 -0
- package/dist/templates/README.md +19 -0
- package/dist/types.d.ts +1 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/utils/asset-collection.d.ts +3 -6
- package/dist/utils/asset-collection.d.ts.map +1 -1
- package/dist/utils/asset-collection.js +10 -34
- package/dist/utils/asset-collection.js.map +1 -1
- package/dist/utils/build-lambda-zip.d.ts +14 -0
- package/dist/utils/build-lambda-zip.d.ts.map +1 -0
- package/dist/utils/build-lambda-zip.js +81 -0
- package/dist/utils/build-lambda-zip.js.map +1 -0
- package/dist/utils/config.js +1 -1
- package/dist/utils/config.js.map +1 -1
- package/dist/utils/env-management.d.ts +9 -8
- package/dist/utils/env-management.d.ts.map +1 -1
- package/dist/utils/env-management.js +73 -74
- package/dist/utils/env-management.js.map +1 -1
- package/dist/utils/formatter.d.ts.map +1 -1
- package/dist/utils/formatter.js +3 -5
- package/dist/utils/formatter.js.map +1 -1
- package/dist/utils/lambda-config.d.ts +3 -1
- package/dist/utils/lambda-config.d.ts.map +1 -1
- package/dist/utils/lambda-config.js +13 -21
- package/dist/utils/lambda-config.js.map +1 -1
- package/dist/utils/messages.d.ts.map +1 -1
- package/dist/utils/messages.js +8 -7
- package/dist/utils/messages.js.map +1 -1
- package/dist/utils/payload-config-ast.d.ts +22 -3
- package/dist/utils/payload-config-ast.d.ts.map +1 -1
- package/dist/utils/payload-config-ast.js +89 -31
- package/dist/utils/payload-config-ast.js.map +1 -1
- package/dist/utils/payload-config-finder.d.ts +2 -2
- package/dist/utils/payload-config-finder.d.ts.map +1 -1
- package/dist/utils/payload-config-finder.js +48 -9
- package/dist/utils/payload-config-finder.js.map +1 -1
- package/dist/utils/payload-config-modifier.d.ts.map +1 -1
- package/dist/utils/payload-config-modifier.js +54 -6
- package/dist/utils/payload-config-modifier.js.map +1 -1
- package/dist/utils/payload-package-check.d.ts +12 -1
- package/dist/utils/payload-package-check.d.ts.map +1 -1
- package/dist/utils/payload-package-check.js +63 -5
- package/dist/utils/payload-package-check.js.map +1 -1
- package/dist/utils/project.d.ts.map +1 -1
- package/dist/utils/project.js +8 -5
- package/dist/utils/project.js.map +1 -1
- package/dist/utils/s3-upload.d.ts +0 -1
- package/dist/utils/s3-upload.d.ts.map +1 -1
- package/dist/utils/s3-upload.js +10 -3
- package/dist/utils/s3-upload.js.map +1 -1
- package/dist/utils/token-display.d.ts.map +1 -1
- package/dist/utils/token-display.js +11 -5
- package/dist/utils/token-display.js.map +1 -1
- package/dist/utils/typescript-validator.d.ts.map +1 -1
- package/dist/utils/typescript-validator.js +4 -6
- package/dist/utils/typescript-validator.js.map +1 -1
- package/dist/utils/version-check.d.ts +3 -0
- package/dist/utils/version-check.d.ts.map +1 -0
- package/dist/utils/version-check.js +38 -0
- package/dist/utils/version-check.js.map +1 -0
- package/package.json +31 -7
|
@@ -1,97 +1,96 @@
|
|
|
1
|
-
import { randomBytes } from 'crypto';
|
|
2
1
|
import fs from 'fs/promises';
|
|
3
2
|
import path from 'path';
|
|
4
3
|
/**
|
|
5
|
-
*
|
|
4
|
+
* Get an environment variable value from .env file
|
|
6
5
|
*
|
|
7
|
-
* @
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
processedLines.push(line);
|
|
30
|
-
continue;
|
|
31
|
-
}
|
|
32
|
-
const [key] = line.split('=');
|
|
33
|
-
const trimmedKey = key.trim();
|
|
34
|
-
// Skip duplicate keys
|
|
35
|
-
if (seenKeys.has(trimmedKey)) {
|
|
36
|
-
continue;
|
|
37
|
-
}
|
|
38
|
-
seenKeys.add(trimmedKey);
|
|
39
|
-
// Replace PAYLOAD_SECRET with actual value
|
|
40
|
-
if (trimmedKey === 'PAYLOAD_SECRET' || trimmedKey === 'PAYLOAD_SECRET_KEY') {
|
|
41
|
-
processedLines.push(`PAYLOAD_SECRET=${payloadSecret}`);
|
|
42
|
-
} else {
|
|
43
|
-
processedLines.push(line);
|
|
6
|
+
* @param projectPath - Path to project directory
|
|
7
|
+
* @param key - Environment variable name to retrieve
|
|
8
|
+
* @returns The value if found, null otherwise
|
|
9
|
+
*/ export async function getEnvVar(projectPath, key) {
|
|
10
|
+
const envPath = path.join(projectPath, '.env');
|
|
11
|
+
try {
|
|
12
|
+
const contents = await fs.readFile(envPath, 'utf-8');
|
|
13
|
+
const lines = contents.split(/\r?\n/);
|
|
14
|
+
for (const line of lines){
|
|
15
|
+
// Skip empty lines and comments
|
|
16
|
+
if (!line.trim() || line.trim().startsWith('#')) {
|
|
17
|
+
continue;
|
|
18
|
+
}
|
|
19
|
+
// Skip lines without =
|
|
20
|
+
if (!line.includes('=')) {
|
|
21
|
+
continue;
|
|
22
|
+
}
|
|
23
|
+
const equalsIndex = line.indexOf('=');
|
|
24
|
+
const lineKey = line.substring(0, equalsIndex).trim();
|
|
25
|
+
if (lineKey === key) {
|
|
26
|
+
return line.substring(equalsIndex + 1);
|
|
27
|
+
}
|
|
44
28
|
}
|
|
29
|
+
return null;
|
|
30
|
+
} catch {
|
|
31
|
+
// File doesn't exist or can't be read
|
|
32
|
+
return null;
|
|
45
33
|
}
|
|
46
|
-
// Add PAYLOAD_SECRET if not present
|
|
47
|
-
if (!seenKeys.has('PAYLOAD_SECRET') && !seenKeys.has('PAYLOAD_SECRET_KEY')) {
|
|
48
|
-
processedLines.push(`PAYLOAD_SECRET=${payloadSecret}`);
|
|
49
|
-
}
|
|
50
|
-
return processedLines.join('\n');
|
|
51
34
|
}
|
|
52
35
|
/**
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
* Creates .env from .env.example (if exists) and populates PAYLOAD_SECRET
|
|
36
|
+
* Add or update an environment variable in .env file
|
|
56
37
|
*
|
|
57
38
|
* @param projectPath - Path to project directory
|
|
58
|
-
* @
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
const envExamplePath = path.join(projectPath, '.env.example');
|
|
39
|
+
* @param key - Environment variable name
|
|
40
|
+
* @param value - Environment variable value
|
|
41
|
+
*/ export async function addOrUpdateEnvVar(projectPath, key, value) {
|
|
62
42
|
const envPath = path.join(projectPath, '.env');
|
|
63
43
|
try {
|
|
64
|
-
|
|
65
|
-
let envExampleContents = '';
|
|
66
|
-
try {
|
|
67
|
-
envExampleContents = await fs.readFile(envExamplePath, 'utf-8');
|
|
68
|
-
} catch {
|
|
69
|
-
// No .env.example, create minimal .env
|
|
70
|
-
envExampleContents = '';
|
|
71
|
-
}
|
|
72
|
-
// Check if .env already exists
|
|
44
|
+
let contents = '';
|
|
73
45
|
let envExists = false;
|
|
46
|
+
// Try to read existing .env file
|
|
74
47
|
try {
|
|
75
|
-
await fs.
|
|
48
|
+
contents = await fs.readFile(envPath, 'utf-8');
|
|
76
49
|
envExists = true;
|
|
77
50
|
} catch {
|
|
78
|
-
// .env doesn't exist
|
|
51
|
+
// .env doesn't exist, will create it
|
|
79
52
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
//
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
const sanitized = sanitizeEnv(existingContents, payloadSecret);
|
|
89
|
-
await fs.writeFile(envPath, sanitized, 'utf-8');
|
|
53
|
+
const lines = contents.split(/\r?\n/);
|
|
54
|
+
const seenKeys = new Set();
|
|
55
|
+
const processedLines = [];
|
|
56
|
+
let keyUpdated = false;
|
|
57
|
+
for (const line of lines){
|
|
58
|
+
// Skip empty lines at start if file didn't exist
|
|
59
|
+
if (!envExists && !line.trim()) {
|
|
60
|
+
continue;
|
|
90
61
|
}
|
|
62
|
+
// Preserve empty lines and comments
|
|
63
|
+
if (!line.trim() || line.trim().startsWith('#')) {
|
|
64
|
+
processedLines.push(line);
|
|
65
|
+
continue;
|
|
66
|
+
}
|
|
67
|
+
// Skip lines without =
|
|
68
|
+
if (!line.includes('=')) {
|
|
69
|
+
processedLines.push(line);
|
|
70
|
+
continue;
|
|
71
|
+
}
|
|
72
|
+
const [lineKey] = line.split('=');
|
|
73
|
+
const trimmedKey = lineKey.trim();
|
|
74
|
+
// Skip duplicate keys (keep first occurrence)
|
|
75
|
+
if (seenKeys.has(trimmedKey)) {
|
|
76
|
+
continue;
|
|
77
|
+
}
|
|
78
|
+
seenKeys.add(trimmedKey);
|
|
79
|
+
// Update or keep the line
|
|
80
|
+
if (trimmedKey === key) {
|
|
81
|
+
processedLines.push(`${key}=${value}`);
|
|
82
|
+
keyUpdated = true;
|
|
83
|
+
} else {
|
|
84
|
+
processedLines.push(line);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
// Add key if not present
|
|
88
|
+
if (!keyUpdated) {
|
|
89
|
+
processedLines.push(`${key}=${value}`);
|
|
91
90
|
}
|
|
92
|
-
|
|
91
|
+
await fs.writeFile(envPath, processedLines.join('\n'), 'utf-8');
|
|
93
92
|
} catch (error) {
|
|
94
|
-
throw new Error(`Failed to
|
|
93
|
+
throw new Error(`Failed to update .env file: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
95
94
|
}
|
|
96
95
|
}
|
|
97
96
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/env-management.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"sources":["../../src/utils/env-management.ts"],"sourcesContent":["import fs from 'fs/promises'\nimport path from 'path'\n\n/**\n * Get an environment variable value from .env file\n *\n * @param projectPath - Path to project directory\n * @param key - Environment variable name to retrieve\n * @returns The value if found, null otherwise\n */\nexport async function getEnvVar(projectPath: string, key: string): Promise<null | string> {\n const envPath = path.join(projectPath, '.env')\n\n try {\n const contents = await fs.readFile(envPath, 'utf-8')\n const lines = contents.split(/\\r?\\n/)\n\n for (const line of lines) {\n // Skip empty lines and comments\n if (!line.trim() || line.trim().startsWith('#')) {\n continue\n }\n\n // Skip lines without =\n if (!line.includes('=')) {\n continue\n }\n\n const equalsIndex = line.indexOf('=')\n const lineKey = line.substring(0, equalsIndex).trim()\n\n if (lineKey === key) {\n return line.substring(equalsIndex + 1)\n }\n }\n\n return null\n } catch {\n // File doesn't exist or can't be read\n return null\n }\n}\n\n/**\n * Add or update an environment variable in .env file\n *\n * @param projectPath - Path to project directory\n * @param key - Environment variable name\n * @param value - Environment variable value\n */\nexport async function addOrUpdateEnvVar(\n projectPath: string,\n key: string,\n value: string,\n): Promise<void> {\n const envPath = path.join(projectPath, '.env')\n\n try {\n let contents = ''\n let envExists = false\n\n // Try to read existing .env file\n try {\n contents = await fs.readFile(envPath, 'utf-8')\n envExists = true\n } catch {\n // .env doesn't exist, will create it\n }\n\n const lines = contents.split(/\\r?\\n/)\n const seenKeys = new Set<string>()\n const processedLines: string[] = []\n let keyUpdated = false\n\n for (const line of lines) {\n // Skip empty lines at start if file didn't exist\n if (!envExists && !line.trim()) {\n continue\n }\n\n // Preserve empty lines and comments\n if (!line.trim() || line.trim().startsWith('#')) {\n processedLines.push(line)\n continue\n }\n\n // Skip lines without =\n if (!line.includes('=')) {\n processedLines.push(line)\n continue\n }\n\n const [lineKey] = line.split('=')\n const trimmedKey = lineKey.trim()\n\n // Skip duplicate keys (keep first occurrence)\n if (seenKeys.has(trimmedKey)) {\n continue\n }\n seenKeys.add(trimmedKey)\n\n // Update or keep the line\n if (trimmedKey === key) {\n processedLines.push(`${key}=${value}`)\n keyUpdated = true\n } else {\n processedLines.push(line)\n }\n }\n\n // Add key if not present\n if (!keyUpdated) {\n processedLines.push(`${key}=${value}`)\n }\n\n await fs.writeFile(envPath, processedLines.join('\\n'), 'utf-8')\n } catch (error) {\n throw new Error(\n `Failed to update .env file: ${error instanceof Error ? error.message : 'Unknown error'}`,\n )\n }\n}\n"],"names":["fs","path","getEnvVar","projectPath","key","envPath","join","contents","readFile","lines","split","line","trim","startsWith","includes","equalsIndex","indexOf","lineKey","substring","addOrUpdateEnvVar","value","envExists","seenKeys","Set","processedLines","keyUpdated","push","trimmedKey","has","add","writeFile","error","Error","message"],"mappings":"AAAA,OAAOA,QAAQ,cAAa;AAC5B,OAAOC,UAAU,OAAM;AAEvB;;;;;;CAMC,GACD,OAAO,eAAeC,UAAUC,WAAmB,EAAEC,GAAW;IAC9D,MAAMC,UAAUJ,KAAKK,IAAI,CAACH,aAAa;IAEvC,IAAI;QACF,MAAMI,WAAW,MAAMP,GAAGQ,QAAQ,CAACH,SAAS;QAC5C,MAAMI,QAAQF,SAASG,KAAK,CAAC;QAE7B,KAAK,MAAMC,QAAQF,MAAO;YACxB,gCAAgC;YAChC,IAAI,CAACE,KAAKC,IAAI,MAAMD,KAAKC,IAAI,GAAGC,UAAU,CAAC,MAAM;gBAC/C;YACF;YAEA,uBAAuB;YACv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AEb,0BAA0B;YAC1B,IAAIA,eAAevB,KAAK;gBACtBoB,eAAeE,IAAI,CAAC,GAAGtB,IAAI,CAAC,EAAEgB,OAAO;gBACrCK,aAAa;YACf,OAAO;gBACLD,eAAeE,IAAI,CAACf;YACtB;QACF;QAEA,yBAAyB;QACzB,IAAI,CAACc,YAAY;YACfD,eAAeE,IAAI,CAAC,GAAGtB,IAAI,CAAC,EAAEgB,OAAO;QACvC;QAEA,MAAMpB,GAAG8B,SAAS,CAACzB,SAASmB,eAAelB,IAAI,CAAC,OAAO;IACzD,EAAE,OAAOyB,OAAO;QACd,MAAM,IAAIC,MACR,CAAC,4BAA4B,EAAED,iBAAiBC,QAAQD,MAAME,OAAO,GAAG,iBAAiB;IAE7F;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatter.d.ts","sourceRoot":"","sources":["../../src/utils/formatter.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAE1D,MAAM,MAAM,YAAY,GAAG;IACzB,OAAO,EAAE,OAAO,CAAA;IAChB,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB,CAAA;AAED;;;GAGG;AACH,wBAAsB,UAAU,CAC9B,QAAQ,EAAE,MAAM,EAChB,cAAc,EAAE,cAAc,GAC7B,OAAO,CAAC,YAAY,CAAC,
|
|
1
|
+
{"version":3,"file":"formatter.d.ts","sourceRoot":"","sources":["../../src/utils/formatter.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAE1D,MAAM,MAAM,YAAY,GAAG;IACzB,OAAO,EAAE,OAAO,CAAA;IAChB,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB,CAAA;AAED;;;GAGG;AACH,wBAAsB,UAAU,CAC9B,QAAQ,EAAE,MAAM,EAChB,cAAc,EAAE,cAAc,GAC7B,OAAO,CAAC,YAAY,CAAC,CAgCvB"}
|
package/dist/utils/formatter.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import spawn from 'cross-spawn';
|
|
2
2
|
import path from 'path';
|
|
3
3
|
/**
|
|
4
4
|
* Format file with Prettier
|
|
@@ -6,15 +6,13 @@ import path from 'path';
|
|
|
6
6
|
*/ export async function formatFile(filePath, packageManager) {
|
|
7
7
|
return new Promise((resolve)=>{
|
|
8
8
|
try {
|
|
9
|
-
const
|
|
9
|
+
const child = spawn(packageManager, [
|
|
10
10
|
'exec',
|
|
11
11
|
'prettier',
|
|
12
12
|
'--write',
|
|
13
13
|
filePath
|
|
14
|
-
]
|
|
15
|
-
const child = spawn(packageManager, args, {
|
|
14
|
+
], {
|
|
16
15
|
cwd: path.dirname(filePath),
|
|
17
|
-
shell: true,
|
|
18
16
|
stdio: 'pipe'
|
|
19
17
|
});
|
|
20
18
|
child.on('close', (code)=>{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/formatter.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"sources":["../../src/utils/formatter.ts"],"sourcesContent":["import spawn from 'cross-spawn'\nimport path from 'path'\n\nimport type { PackageManager } from './package-manager.js'\n\nexport type FormatResult = {\n success: boolean\n warning?: string\n}\n\n/**\n * Format file with Prettier\n * Returns warning if formatting fails but does not throw\n */\nexport async function formatFile(\n filePath: string,\n packageManager: PackageManager,\n): Promise<FormatResult> {\n return new Promise((resolve) => {\n try {\n const child = spawn(packageManager, ['exec', 'prettier', '--write', filePath], {\n cwd: path.dirname(filePath),\n stdio: 'pipe',\n })\n\n child.on('close', (code) => {\n if (code === 0) {\n resolve({ success: true })\n } else {\n resolve({\n success: false,\n warning: 'Could not format file with Prettier',\n })\n }\n })\n\n child.on('error', () => {\n resolve({\n success: false,\n warning: 'Could not format file with Prettier',\n })\n })\n } catch {\n resolve({\n success: false,\n warning: 'Could not format file with Prettier',\n })\n }\n })\n}\n"],"names":["spawn","path","formatFile","filePath","packageManager","Promise","resolve","child","cwd","dirname","stdio","on","code","success","warning"],"mappings":"AAAA,OAAOA,WAAW,cAAa;AAC/B,OAAOC,UAAU,OAAM;AASvB;;;CAGC,GACD,OAAO,eAAeC,WACpBC,QAAgB,EAChBC,cAA8B;IAE9B,OAAO,IAAIC,QAAQ,CAACC;QAClB,IAAI;YACF,MAAMC,QAAQP,MAAMI,gBAAgB;gBAAC;gBAAQ;gBAAY;gBAAWD;aAAS,EAAE;gBAC7EK,KAAKP,KAAKQ,OAAO,CAACN;gBAClBO,OAAO;YACT;YAEAH,MAAMI,EAAE,CAAC,SAAS,CAACC;gBACjB,IAAIA,SAAS,GAAG;oBACdN,QAAQ;wBAAEO,SAAS;oBAAK;gBAC1B,OAAO;oBACLP,QAAQ;wBACNO,SAAS;wBACTC,SAAS;oBACX;gBACF;YACF;YAEAP,MAAMI,EAAE,CAAC,SAAS;gBAChBL,QAAQ;oBACNO,SAAS;oBACTC,SAAS;gBACX;YACF;QACF,EAAE,OAAM;YACNR,QAAQ;gBACNO,SAAS;gBACTC,SAAS;YACX;QACF;IACF;AACF"}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import type { PackageManager } from './package-manager.js';
|
|
1
2
|
/**
|
|
2
3
|
* Apply Lambda-specific modifications to a Payload project
|
|
3
4
|
*
|
|
4
5
|
* @param projectPath - Path to project directory
|
|
6
|
+
* @param packageManager - Package manager to use in scripts (defaults to 'pnpm')
|
|
5
7
|
*/
|
|
6
|
-
export declare function applyLambdaModifications(projectPath: string): Promise<void>;
|
|
8
|
+
export declare function applyLambdaModifications(projectPath: string, packageManager?: PackageManager): Promise<void>;
|
|
7
9
|
//# sourceMappingURL=lambda-config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lambda-config.d.ts","sourceRoot":"","sources":["../../src/utils/lambda-config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"lambda-config.d.ts","sourceRoot":"","sources":["../../src/utils/lambda-config.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAS1D;;;;;GAKG;AACH,wBAAsB,wBAAwB,CAC5C,WAAW,EAAE,MAAM,EACnB,cAAc,GAAE,cAAuB,GACtC,OAAO,CAAC,IAAI,CAAC,CA2Bf"}
|
|
@@ -7,30 +7,19 @@ const RUN_SH_CONTENT = `#!/bin/bash -x
|
|
|
7
7
|
|
|
8
8
|
NODE_ENV=production exec node server.js
|
|
9
9
|
`;
|
|
10
|
-
const BUILD_FOR_LAMBDA_SH_CONTENT = `#!/bin/bash
|
|
11
|
-
|
|
12
|
-
cp -r .next/static .next/standalone/.next/static
|
|
13
|
-
cp run.sh .next/standalone/run.sh
|
|
14
|
-
cd .next/standalone
|
|
15
|
-
zip -r --symlinks lambda.zip .
|
|
16
|
-
mv lambda.zip ../..
|
|
17
|
-
`;
|
|
18
10
|
/**
|
|
19
11
|
* Apply Lambda-specific modifications to a Payload project
|
|
20
12
|
*
|
|
21
13
|
* @param projectPath - Path to project directory
|
|
22
|
-
|
|
14
|
+
* @param packageManager - Package manager to use in scripts (defaults to 'pnpm')
|
|
15
|
+
*/ export async function applyLambdaModifications(projectPath, packageManager = 'pnpm') {
|
|
23
16
|
// 1. Create run.sh
|
|
24
17
|
const runShPath = path.join(projectPath, 'run.sh');
|
|
25
18
|
await fs.writeFile(runShPath, RUN_SH_CONTENT, 'utf-8');
|
|
26
|
-
await fs.chmod(runShPath, 0o755);
|
|
27
|
-
// 2.
|
|
28
|
-
const buildShPath = path.join(projectPath, 'build_for_lambda.sh');
|
|
29
|
-
await fs.writeFile(buildShPath, BUILD_FOR_LAMBDA_SH_CONTENT, 'utf-8');
|
|
30
|
-
await fs.chmod(buildShPath, 0o755);
|
|
31
|
-
// 3. Modify next config to add standalone output
|
|
19
|
+
await fs.chmod(runShPath, 0o755);
|
|
20
|
+
// 2. Modify next config to add standalone output
|
|
32
21
|
await addStandaloneToNextConfig(projectPath);
|
|
33
|
-
//
|
|
22
|
+
// 3. Create/update .npmrc
|
|
34
23
|
const npmrcPath = path.join(projectPath, '.npmrc');
|
|
35
24
|
let npmrcContent = '';
|
|
36
25
|
try {
|
|
@@ -43,8 +32,8 @@ mv lambda.zip ../..
|
|
|
43
32
|
npmrcContent += 'node-linker=hoisted\n';
|
|
44
33
|
await fs.writeFile(npmrcPath, npmrcContent, 'utf-8');
|
|
45
34
|
}
|
|
46
|
-
//
|
|
47
|
-
await addLambdaBuildScript(projectPath);
|
|
35
|
+
// 4. Add lambda:buildzip script to package.json
|
|
36
|
+
await addLambdaBuildScript(projectPath, packageManager);
|
|
48
37
|
}
|
|
49
38
|
/**
|
|
50
39
|
* Find the Next.js config file (next.config.js or next.config.mjs)
|
|
@@ -114,7 +103,7 @@ mv lambda.zip ../..
|
|
|
114
103
|
throw new Error(`Could not find Next.js config object in ${path.basename(nextConfigPath)}. ` + `Expected either 'export default { ... }' or 'export default wrapper(configVar, ...)'`);
|
|
115
104
|
}
|
|
116
105
|
const { loc } = targetObjectExpression;
|
|
117
|
-
const lines = content.split(
|
|
106
|
+
const lines = content.split(/\r?\n/);
|
|
118
107
|
// Insert output: 'standalone' as first property
|
|
119
108
|
const insertLine = loc.start.line - 1;
|
|
120
109
|
const insertColumn = loc.start.column + 1 // After opening brace
|
|
@@ -130,14 +119,17 @@ mv lambda.zip ../..
|
|
|
130
119
|
}
|
|
131
120
|
/**
|
|
132
121
|
* Add lambda:buildzip script to package.json
|
|
133
|
-
*/ async function addLambdaBuildScript(projectPath) {
|
|
122
|
+
*/ async function addLambdaBuildScript(projectPath, packageManager) {
|
|
134
123
|
const packageJsonPath = path.join(projectPath, 'package.json');
|
|
135
124
|
const content = await fs.readFile(packageJsonPath, 'utf-8');
|
|
136
125
|
const packageJson = JSON.parse(content);
|
|
137
126
|
if (!packageJson.scripts) {
|
|
138
127
|
packageJson.scripts = {};
|
|
139
128
|
}
|
|
140
|
-
|
|
129
|
+
// Use package manager's run and exec commands
|
|
130
|
+
const runCmd = packageManager === 'npm' ? 'npm run' : packageManager;
|
|
131
|
+
const execCmd = packageManager === 'npm' ? 'npx' : `${packageManager} exec`;
|
|
132
|
+
packageJson.scripts['lambda:buildzip'] = `${runCmd} build && ${execCmd} payloadcms-figma build-lambda-zip`;
|
|
141
133
|
await fs.writeFile(packageJsonPath, JSON.stringify(packageJson, null, 2) + '\n', 'utf-8');
|
|
142
134
|
}
|
|
143
135
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/lambda-config.ts"],"sourcesContent":["import { parseModule, Syntax } from 'esprima-next'\nimport fs from 'fs/promises'\nimport path from 'path'\n\nconst RUN_SH_CONTENT = `#!/bin/bash -x\n\n[ ! -d '/tmp/cache' ] && mkdir -p /tmp/cache\n\nNODE_ENV=production exec node server.js\n`\n\nconst BUILD_FOR_LAMBDA_SH_CONTENT = `#!/bin/bash\n\ncp -r .next/static .next/standalone/.next/static\ncp run.sh .next/standalone/run.sh\ncd .next/standalone\nzip -r --symlinks lambda.zip .\nmv lambda.zip ../..\n`\n\n/**\n * Apply Lambda-specific modifications to a Payload project\n *\n * @param projectPath - Path to project directory\n */\nexport async function applyLambdaModifications(projectPath: string): Promise<void> {\n // 1. Create run.sh\n const runShPath = path.join(projectPath, 'run.sh')\n await fs.writeFile(runShPath, RUN_SH_CONTENT, 'utf-8')\n await fs.chmod(runShPath, 0o755) // rwxr-xr-x\n\n // 2. Create build_for_lambda.sh\n const buildShPath = path.join(projectPath, 'build_for_lambda.sh')\n await fs.writeFile(buildShPath, BUILD_FOR_LAMBDA_SH_CONTENT, 'utf-8')\n await fs.chmod(buildShPath, 0o755)\n\n // 3. Modify next config to add standalone output\n await addStandaloneToNextConfig(projectPath)\n\n // 4. Create/update .npmrc\n const npmrcPath = path.join(projectPath, '.npmrc')\n let npmrcContent = ''\n\n try {\n npmrcContent = await fs.readFile(npmrcPath, 'utf-8')\n } catch {\n // File doesn't exist, start fresh\n }\n\n if (!npmrcContent.includes('node-linker=hoisted')) {\n npmrcContent += npmrcContent && !npmrcContent.endsWith('\\n') ? '\\n' : ''\n npmrcContent += 'node-linker=hoisted\\n'\n await fs.writeFile(npmrcPath, npmrcContent, 'utf-8')\n }\n\n // 5. Add lambda:buildzip script to package.json\n await addLambdaBuildScript(projectPath)\n}\n\n/**\n * Find the Next.js config file (next.config.js or next.config.mjs)\n *\n * @todo Support TypeScript config files in future\n */\nasync function findNextConfigPath(projectPath: string): Promise<string> {\n const configFiles = ['next.config.js', 'next.config.mjs']\n\n for (const configFile of configFiles) {\n const configPath = path.join(projectPath, configFile)\n try {\n await fs.access(configPath)\n return configPath\n } catch {\n // File doesn't exist, try next one\n }\n }\n\n throw new Error('Could not find next.config.js or next.config.mjs')\n}\n\n/**\n * Add standalone output to Next.js config using AST parsing\n */\nasync function addStandaloneToNextConfig(projectPath: string): Promise<void> {\n const nextConfigPath = await findNextConfigPath(projectPath)\n const content = await fs.readFile(nextConfigPath, 'utf-8')\n\n // Check if output already configured (quick check before parsing)\n if (content.includes('output:')) {\n return // Already configured\n }\n\n const ast = parseModule(content, { loc: true })\n\n // Find export default declaration\n const exportDefaultDeclaration = ast.body.find(\n (p) => p.type === Syntax.ExportDefaultDeclaration,\n ) as ExportDefaultDeclaration | undefined\n\n if (!exportDefaultDeclaration?.declaration?.loc) {\n throw new Error(`Could not find export default declaration in ${path.basename(nextConfigPath)}`)\n }\n\n // Find the object expression to modify\n let targetObjectExpression: ObjectExpressionNode | undefined\n\n if (exportDefaultDeclaration.declaration.type === 'ObjectExpression') {\n // Direct export: export default { ... }\n targetObjectExpression = exportDefaultDeclaration.declaration as ObjectExpressionNode\n } else if (exportDefaultDeclaration.declaration.type === 'CallExpression') {\n // Wrapped export: export default withPayload(nextConfig, ...)\n const callExpr = exportDefaultDeclaration.declaration as CallExpressionNode\n const firstArg = callExpr.arguments?.[0]\n\n if (firstArg?.type === 'Identifier') {\n // Find the variable declaration for this identifier\n const configVarName = (firstArg as IdentifierNode).name\n const varDeclaration = ast.body.find((node) => {\n if (node.type === Syntax.VariableDeclaration) {\n const varNode = node as VariableDeclarationNode\n return varNode.declarations?.some(\n (decl) =>\n decl.id?.type === 'Identifier' &&\n (decl.id as IdentifierNode).name === configVarName &&\n decl.init?.type === 'ObjectExpression',\n )\n }\n return false\n }) as undefined | VariableDeclarationNode\n\n if (varDeclaration) {\n const declarator = varDeclaration.declarations?.find(\n (decl) =>\n decl.id?.type === 'Identifier' && (decl.id as IdentifierNode).name === configVarName,\n )\n if (declarator?.init?.type === 'ObjectExpression') {\n targetObjectExpression = declarator.init as ObjectExpressionNode\n }\n }\n }\n }\n\n if (!targetObjectExpression?.loc) {\n throw new Error(\n `Could not find Next.js config object in ${path.basename(nextConfigPath)}. ` +\n `Expected either 'export default { ... }' or 'export default wrapper(configVar, ...)'`,\n )\n }\n\n const { loc } = targetObjectExpression\n const lines = content.split('\\n')\n\n // Insert output: 'standalone' as first property\n const insertLine = loc.start.line - 1\n const insertColumn = loc.start.column + 1 // After opening brace\n\n // Find the content of the line with the opening brace\n const targetLine = lines[insertLine]\n if (!targetLine) {\n throw new Error(`Could not find target line in ${path.basename(nextConfigPath)}`)\n }\n\n lines[insertLine] =\n targetLine.slice(0, insertColumn) + \"\\n output: 'standalone',\" + targetLine.slice(insertColumn)\n\n const modifiedContent = lines.join('\\n')\n await fs.writeFile(nextConfigPath, modifiedContent, 'utf-8')\n}\n\ntype ExportDefaultDeclaration = {\n declaration: {\n arguments?: unknown[]\n loc: {\n end: { column: number; line: number }\n start: { column: number; line: number }\n }\n type: string\n }\n type: string\n}\n\ntype ObjectExpressionNode = {\n loc: {\n end: { column: number; line: number }\n start: { column: number; line: number }\n }\n type: 'ObjectExpression'\n}\n\ntype IdentifierNode = {\n name: string\n type: 'Identifier'\n}\n\ntype CallExpressionNode = {\n arguments?: Array<{ type: string }>\n type: 'CallExpression'\n}\n\ntype VariableDeclarationNode = {\n declarations?: Array<{\n id?: { name?: string; type: string }\n init?: { loc?: ObjectExpressionNode['loc']; type: string }\n }>\n type: 'VariableDeclaration'\n}\n\n/**\n * Add lambda:buildzip script to package.json\n */\nasync function addLambdaBuildScript(projectPath: string): Promise<void> {\n const packageJsonPath = path.join(projectPath, 'package.json')\n const content = await fs.readFile(packageJsonPath, 'utf-8')\n const packageJson = JSON.parse(content)\n\n if (!packageJson.scripts) {\n packageJson.scripts = {}\n }\n\n packageJson.scripts['lambda:buildzip'] = 'npm run build && ./build_for_lambda.sh'\n\n await fs.writeFile(packageJsonPath, JSON.stringify(packageJson, null, 2) + '\\n', 'utf-8')\n}\n"],"names":["parseModule","Syntax","fs","path","RUN_SH_CONTENT","BUILD_FOR_LAMBDA_SH_CONTENT","applyLambdaModifications","projectPath","runShPath","join","writeFile","chmod","buildShPath","addStandaloneToNextConfig","npmrcPath","npmrcContent","readFile","includes","endsWith","addLambdaBuildScript","findNextConfigPath","configFiles","configFile","configPath","access","Error","nextConfigPath","content","ast","loc","exportDefaultDeclaration","body","find","p","type","ExportDefaultDeclaration","declaration","basename","targetObjectExpression","callExpr","firstArg","arguments","configVarName","name","varDeclaration","node","VariableDeclaration","varNode","declarations","some","decl","id","init","declarator","lines","split","insertLine","start","line","insertColumn","column","targetLine","slice","modifiedContent","packageJsonPath","packageJson","JSON","parse","scripts","stringify"],"mappings":"AAAA,SAASA,WAAW,EAAEC,MAAM,QAAQ,eAAc;AAClD,OAAOC,QAAQ,cAAa;AAC5B,OAAOC,UAAU,OAAM;AAEvB,MAAMC,iBAAiB,CAAC;;;;;AAKxB,CAAC;AAED,MAAMC,8BAA8B,CAAC;;;;;;;AAOrC,CAAC;AAED;;;;CAIC,GACD,OAAO,eAAeC,yBAAyBC,WAAmB;IAChE,mBAAmB;IACnB,MAAMC,YAAYL,KAAKM,IAAI,CAACF,aAAa;IACzC,MAAML,GAAGQ,SAAS,CAACF,WAAWJ,gBAAgB;IAC9C,MAAMF,GAAGS,KAAK,CAACH,WAAW,QAAO,YAAY;IAE7C,gCAAgC;IAChC,M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,KAAKkC,QAAQ,CAACX,gBAAgB,EAAE,CAAC,GAC1E,CAAC,oFAAoF,CAAC;IAE5F;IAEA,MAAM,EAAEG,GAAG,EAAE,GAAGS;IAChB,MAAMgB,QAAQ3B,QAAQ4B,KAAK,CAAC;IAE5B,gDAAgD;IAChD,MAAMC,aAAa3B,IAAI4B,KAAK,CAACC,IAAI,GAAG;IACpC,MAAMC,eAAe9B,IAAI4B,KAAK,CAACG,MAAM,GAAG,EAAE,sBAAsB;;IAEhE,sDAAsD;IACtD,MAAMC,aAAaP,KAAK,CAACE,WAAW;IACpC,IAAI,CAACK,YAAY;QACf,MAAM,IAAIpC,MAAM,CAAC,8BAA8B,EAAEtB,KAAKkC,QAAQ,CAACX,iBAAiB;IAClF;IAEA4B,KAAK,CAACE,WAAW,GACfK,WAAWC,KAAK,CAAC,GAAGH,gBAAgB,8BAA8BE,WAAWC,KAAK,CAACH;IAErF,MAAMI,kBAAkBT,MAAM7C,IAAI,CAAC;IACnC,MAAMP,GAAGQ,SAAS,CAACgB,gBAAgBqC,iBAAiB;AACtD;AAwCA;;CAEC,GACD,eAAe5C,qBAAqBZ,WAAmB;IACrD,MAAMyD,kBAAkB7D,KAAKM,IAAI,CAACF,aAAa;IAC/C,MAAMoB,UAAU,MAAMzB,GAAGc,QAAQ,CAACgD,iBAAiB;IACnD,MAAMC,cAAcC,KAAKC,KAAK,CAACxC;IAE/B,IAAI,CAACsC,YAAYG,OAAO,EAAE;QACxBH,YAAYG,OAAO,GAAG,CAAC;IACzB;IAEAH,YAAYG,OAAO,CAAC,kBAAkB,GAAG;IAEzC,MAAMlE,GAAGQ,SAAS,CAACsD,iBAAiBE,KAAKG,SAAS,CAACJ,aAAa,MAAM,KAAK,MAAM;AACnF"}
|
|
1
|
+
{"version":3,"sources":["../../src/utils/lambda-config.ts"],"sourcesContent":["import { parseModule, Syntax } from 'esprima-next'\nimport fs from 'fs/promises'\nimport path from 'path'\n\nimport type { PackageManager } from './package-manager.js'\n\nconst RUN_SH_CONTENT = `#!/bin/bash -x\n\n[ ! -d '/tmp/cache' ] && mkdir -p /tmp/cache\n\nNODE_ENV=production exec node server.js\n`\n\n/**\n * Apply Lambda-specific modifications to a Payload project\n *\n * @param projectPath - Path to project directory\n * @param packageManager - Package manager to use in scripts (defaults to 'pnpm')\n */\nexport async function applyLambdaModifications(\n projectPath: string,\n packageManager: PackageManager = 'pnpm',\n): Promise<void> {\n // 1. Create run.sh\n const runShPath = path.join(projectPath, 'run.sh')\n await fs.writeFile(runShPath, RUN_SH_CONTENT, 'utf-8')\n await fs.chmod(runShPath, 0o755)\n\n // 2. Modify next config to add standalone output\n await addStandaloneToNextConfig(projectPath)\n\n // 3. Create/update .npmrc\n const npmrcPath = path.join(projectPath, '.npmrc')\n let npmrcContent = ''\n\n try {\n npmrcContent = await fs.readFile(npmrcPath, 'utf-8')\n } catch {\n // File doesn't exist, start fresh\n }\n\n if (!npmrcContent.includes('node-linker=hoisted')) {\n npmrcContent += npmrcContent && !npmrcContent.endsWith('\\n') ? '\\n' : ''\n npmrcContent += 'node-linker=hoisted\\n'\n await fs.writeFile(npmrcPath, npmrcContent, 'utf-8')\n }\n\n // 4. Add lambda:buildzip script to package.json\n await addLambdaBuildScript(projectPath, packageManager)\n}\n\n/**\n * Find the Next.js config file (next.config.js or next.config.mjs)\n *\n * @todo Support TypeScript config files in future\n */\nasync function findNextConfigPath(projectPath: string): Promise<string> {\n const configFiles = ['next.config.js', 'next.config.mjs']\n\n for (const configFile of configFiles) {\n const configPath = path.join(projectPath, configFile)\n try {\n await fs.access(configPath)\n return configPath\n } catch {\n // File doesn't exist, try next one\n }\n }\n\n throw new Error('Could not find next.config.js or next.config.mjs')\n}\n\n/**\n * Add standalone output to Next.js config using AST parsing\n */\nasync function addStandaloneToNextConfig(projectPath: string): Promise<void> {\n const nextConfigPath = await findNextConfigPath(projectPath)\n const content = await fs.readFile(nextConfigPath, 'utf-8')\n\n // Check if output already configured (quick check before parsing)\n if (content.includes('output:')) {\n return // Already configured\n }\n\n const ast = parseModule(content, { loc: true })\n\n // Find export default declaration\n const exportDefaultDeclaration = ast.body.find(\n (p) => p.type === Syntax.ExportDefaultDeclaration,\n ) as ExportDefaultDeclaration | undefined\n\n if (!exportDefaultDeclaration?.declaration?.loc) {\n throw new Error(`Could not find export default declaration in ${path.basename(nextConfigPath)}`)\n }\n\n // Find the object expression to modify\n let targetObjectExpression: ObjectExpressionNode | undefined\n\n if (exportDefaultDeclaration.declaration.type === 'ObjectExpression') {\n // Direct export: export default { ... }\n targetObjectExpression = exportDefaultDeclaration.declaration as ObjectExpressionNode\n } else if (exportDefaultDeclaration.declaration.type === 'CallExpression') {\n // Wrapped export: export default withPayload(nextConfig, ...)\n const callExpr = exportDefaultDeclaration.declaration as CallExpressionNode\n const firstArg = callExpr.arguments?.[0]\n\n if (firstArg?.type === 'Identifier') {\n // Find the variable declaration for this identifier\n const configVarName = (firstArg as IdentifierNode).name\n const varDeclaration = ast.body.find((node) => {\n if (node.type === Syntax.VariableDeclaration) {\n const varNode = node as VariableDeclarationNode\n return varNode.declarations?.some(\n (decl) =>\n decl.id?.type === 'Identifier' &&\n (decl.id as IdentifierNode).name === configVarName &&\n decl.init?.type === 'ObjectExpression',\n )\n }\n return false\n }) as undefined | VariableDeclarationNode\n\n if (varDeclaration) {\n const declarator = varDeclaration.declarations?.find(\n (decl) =>\n decl.id?.type === 'Identifier' && (decl.id as IdentifierNode).name === configVarName,\n )\n if (declarator?.init?.type === 'ObjectExpression') {\n targetObjectExpression = declarator.init as ObjectExpressionNode\n }\n }\n }\n }\n\n if (!targetObjectExpression?.loc) {\n throw new Error(\n `Could not find Next.js config object in ${path.basename(nextConfigPath)}. ` +\n `Expected either 'export default { ... }' or 'export default wrapper(configVar, ...)'`,\n )\n }\n\n const { loc } = targetObjectExpression\n const lines = content.split(/\\r?\\n/)\n\n // Insert output: 'standalone' as first property\n const insertLine = loc.start.line - 1\n const insertColumn = loc.start.column + 1 // After opening brace\n\n // Find the content of the line with the opening brace\n const targetLine = lines[insertLine]\n if (!targetLine) {\n throw new Error(`Could not find target line in ${path.basename(nextConfigPath)}`)\n }\n\n lines[insertLine] =\n targetLine.slice(0, insertColumn) + \"\\n output: 'standalone',\" + targetLine.slice(insertColumn)\n\n const modifiedContent = lines.join('\\n')\n await fs.writeFile(nextConfigPath, modifiedContent, 'utf-8')\n}\n\ntype ExportDefaultDeclaration = {\n declaration: {\n arguments?: unknown[]\n loc: {\n end: { column: number; line: number }\n start: { column: number; line: number }\n }\n type: string\n }\n type: string\n}\n\ntype ObjectExpressionNode = {\n loc: {\n end: { column: number; line: number }\n start: { column: number; line: number }\n }\n type: 'ObjectExpression'\n}\n\ntype IdentifierNode = {\n name: string\n type: 'Identifier'\n}\n\ntype CallExpressionNode = {\n arguments?: Array<{ type: string }>\n type: 'CallExpression'\n}\n\ntype VariableDeclarationNode = {\n declarations?: Array<{\n id?: { name?: string; type: string }\n init?: { loc?: ObjectExpressionNode['loc']; type: string }\n }>\n type: 'VariableDeclaration'\n}\n\n/**\n * Add lambda:buildzip script to package.json\n */\nasync function addLambdaBuildScript(\n projectPath: string,\n packageManager: PackageManager,\n): Promise<void> {\n const packageJsonPath = path.join(projectPath, 'package.json')\n const content = await fs.readFile(packageJsonPath, 'utf-8')\n const packageJson = JSON.parse(content)\n\n if (!packageJson.scripts) {\n packageJson.scripts = {}\n }\n\n // Use package manager's run and exec commands\n const runCmd = packageManager === 'npm' ? 'npm run' : packageManager\n const execCmd = packageManager === 'npm' ? 'npx' : `${packageManager} exec`\n\n packageJson.scripts['lambda:buildzip'] =\n `${runCmd} build && ${execCmd} payloadcms-figma build-lambda-zip`\n\n await fs.writeFile(packageJsonPath, JSON.stringify(packageJson, null, 2) + '\\n', 'utf-8')\n}\n"],"names":["parseModule","Syntax","fs","path","RUN_SH_CONTENT","applyLambdaModifications","projectPath","packageManager","runShPath","join","writeFile","chmod","addStandaloneToNextConfig","npmrcPath","npmrcContent","readFile","includes","endsWith","addLambdaBuildScript","findNextConfigPath","configFiles","configFile","configPath","access","Error","nextConfigPath","content","ast","loc","exportDefaultDeclaration","body","find","p","type","ExportDefaultDeclaration","declaration","basename","targetObjectExpression","callExpr","firstArg","arguments","configVarName","name","varDeclaration","node","VariableDeclaration","varNode","declarations","some","decl","id","init","declarator","lines","split","insertLine","start","line","insertColumn","column","targetLine","slice","modifiedContent","packageJsonPath","packageJson","JSON","parse","scripts","runCmd","execCmd","stringify"],"mappings":"AAAA,SAASA,WAAW,EAAEC,MAAM,QAAQ,eAAc;AAClD,OAAOC,QAAQ,cAAa;AAC5B,OAAOC,UAAU,OAAM;AAIvB,MAAMC,iBAAiB,CAAC;;;;;AAKxB,CAAC;AAED;;;;;CAKC,GACD,OAAO,eAAeC,yBACpBC,WAAmB,EACnBC,iBAAiC,MAAM;IAEvC,mBAAmB;IACnB,MAAMC,YAAYL,KAAKM,IAAI,CAACH,aAAa;IACzC,MAAMJ,GAAGQ,SAAS,CAACF,WAAWJ,gBAAgB;IAC9C,MAAMF,GAAGS,KAAK,CAACH,WAAW;IAE1B,iDAAiD;IACjD,MAAMI,0BAA0BN;IAEhC,0BAA0B;IAC1B,MAAMO,YAAYV,KAAKM,IAAI,CAACH,aAAa;IACzC,IAAIQ,eAAe;IAEnB,IAAI;QACFA,eAAe,MAAMZ,GAAGa,QAAQ,CAACF,WAAW;IAC9C,EAAE,OAAM;IACN,kCAAkC;IACpC;IAEA,IAAI,CAACC,aAAaE,QAAQ,CAAC,wBAAwB;QACjDF,gBAAgBA,gBAAgB,CAACA,aAAaG,QAAQ,CAAC,QAAQ,OAAO;QACtEH,gBAAgB;QAChB,MAAMZ,GAAGQ,SAAS,CAACG,WAAWC,cAAc;IAC9C;IAEA,gDAAgD;IAChD,MAAMI,qBAAqBZ,aAAaC;AAC1C;AAEA;;;;CAIC,GACD,eAAeY,mBAAmBb,WAAmB;IACnD,MAAMc,cAAc;QAAC;QAAkB;KAAkB;IAEzD,KAAK,MAAMC,cAAcD,YAAa;QACpC,MAAME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,EACnBC,cAA8B;IAE9B,MAAMwD,kBAAkB5D,KAAKM,IAAI,CAACH,aAAa;IAC/C,MAAMoB,UAAU,MAAMxB,GAAGa,QAAQ,CAACgD,iBAAiB;IACnD,MAAMC,cAAcC,KAAKC,KAAK,CAACxC;IAE/B,IAAI,CAACsC,YAAYG,OAAO,EAAE;QACxBH,YAAYG,OAAO,GAAG,CAAC;IACzB;IAEA,8CAA8C;IAC9C,MAAMC,SAAS7D,mBAAmB,QAAQ,YAAYA;IACtD,MAAM8D,UAAU9D,mBAAmB,QAAQ,QAAQ,GAAGA,eAAe,KAAK,CAAC;IAE3EyD,YAAYG,OAAO,CAAC,kBAAkB,GACpC,GAAGC,OAAO,UAAU,EAAEC,QAAQ,kCAAkC,CAAC;IAEnE,MAAMnE,GAAGQ,SAAS,CAACqD,iBAAiBE,KAAKK,SAAS,CAACN,aAAa,MAAM,KAAK,MAAM;AACnF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../src/utils/messages.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAIjD,wBAAgB,WAAW,IAAI,IAAI,
|
|
1
|
+
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../src/utils/messages.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAIjD,wBAAgB,WAAW,IAAI,IAAI,CA4ClC;AASD,wBAAgB,cAAc,CAAC,UAAU,EAAE,MAAM,EAAE,cAAc,EAAE,cAAc,GAAG,MAAM,CAiBzF;AAED,wBAAgB,kBAAkB,IAAI,MAAM,CAO3C;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAgBpF;AAED,wBAAgB,aAAa,IAAI,MAAM,CAEtC"}
|
package/dist/utils/messages.js
CHANGED
|
@@ -15,11 +15,14 @@ export function helpMessage() {
|
|
|
15
15
|
${pc.cyan('list-tokens')} Show stored token information
|
|
16
16
|
${pc.cyan('init')} Initialize a Figma CMS project
|
|
17
17
|
${pc.cyan('deploy')} Deploy your project to Figma
|
|
18
|
+
${pc.cyan('build-lambda-zip')} Build Lambda deployment zip
|
|
18
19
|
|
|
19
20
|
${pc.bold('OPTIONS')}
|
|
20
21
|
|
|
21
22
|
${pc.dim('-h, --help Show help')}
|
|
23
|
+
${pc.dim('-v, --version Show CLI version')}
|
|
22
24
|
${pc.dim('--debug Enable debug logging')}
|
|
25
|
+
${pc.dim('--env <env> Set environment: prod or staging')}
|
|
23
26
|
|
|
24
27
|
${pc.bold('AUTHENTICATION')}
|
|
25
28
|
|
|
@@ -29,16 +32,14 @@ export function helpMessage() {
|
|
|
29
32
|
|
|
30
33
|
${pc.bold('INIT COMMAND')}
|
|
31
34
|
|
|
32
|
-
${pc.cyan('@payloadcms/figma init --id <
|
|
33
|
-
${pc.cyan('@payloadcms/figma init')}
|
|
34
|
-
${pc.cyan('@payloadcms/figma init --name my-cms')} Specify project name for new projects
|
|
35
|
-
${pc.cyan('@payloadcms/figma init --force')} Force reconfiguration of existing project
|
|
36
|
-
${pc.cyan('@payloadcms/figma init --skip-auth')} Skip authentication (testing only)
|
|
35
|
+
${pc.cyan('@payloadcms/figma init --id <content-system-id>')} Initialize project with Content System ID
|
|
36
|
+
${pc.cyan('@payloadcms/figma init --force')} Force reconfiguration of existing project
|
|
37
37
|
|
|
38
38
|
${pc.bold('DEPLOY COMMAND')}
|
|
39
39
|
|
|
40
|
-
${pc.cyan('@payloadcms/figma deploy')}
|
|
41
|
-
${pc.dim('--yes, -y')}
|
|
40
|
+
${pc.cyan('@payloadcms/figma deploy')} Deploy your project to Figma
|
|
41
|
+
${pc.dim('--yes, -y')} Skip confirmation prompts
|
|
42
|
+
${pc.dim('--skip-build')} Skip building and use existing build
|
|
42
43
|
|
|
43
44
|
${pc.bold('DOCUMENTATION')}
|
|
44
45
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/messages.ts"],"sourcesContent":["/* eslint-disable no-console */\nimport path from 'path'\nimport pc from 'picocolors'\nimport terminalLink from 'terminal-link'\n\nimport type { PackageManager } from '../types.js'\n\nconst header = (message: string): string => pc.bold(message)\n\nexport function helpMessage(): void {\n console.log(`\n ${pc.bold('USAGE')}\n\n ${pc.dim('@payloadcms/figma <command> [options]')}\n\n ${pc.bold('COMMANDS')}\n\n ${pc.cyan('login')} Authenticate with Figma OAuth2\n ${pc.cyan('logout')} Clear all stored tokens\n ${pc.cyan('list-tokens')} Show stored token information\n ${pc.cyan('init')} Initialize a Figma CMS project\n ${pc.cyan('deploy')} Deploy your project to Figma\n\n ${pc.bold('OPTIONS')}\n\n ${pc.dim('-h, --help Show help')}\n ${pc.dim('--debug Enable debug logging')}\n\n ${pc.bold('AUTHENTICATION')}\n\n ${pc.cyan('@payloadcms/figma login')} Authenticate with Figma\n ${pc.cyan('@payloadcms/figma logout')} Clear all tokens (with confirmation)\n ${pc.cyan('@payloadcms/figma list-tokens')} Display stored OAuth and project tokens\n\n ${pc.bold('INIT COMMAND')}\n\n ${pc.cyan('@payloadcms/figma init --id <
|
|
1
|
+
{"version":3,"sources":["../../src/utils/messages.ts"],"sourcesContent":["/* eslint-disable no-console */\nimport path from 'path'\nimport pc from 'picocolors'\nimport terminalLink from 'terminal-link'\n\nimport type { PackageManager } from '../types.js'\n\nconst header = (message: string): string => pc.bold(message)\n\nexport function helpMessage(): void {\n console.log(`\n ${pc.bold('USAGE')}\n\n ${pc.dim('@payloadcms/figma <command> [options]')}\n\n ${pc.bold('COMMANDS')}\n\n ${pc.cyan('login')} Authenticate with Figma OAuth2\n ${pc.cyan('logout')} Clear all stored tokens\n ${pc.cyan('list-tokens')} Show stored token information\n ${pc.cyan('init')} Initialize a Figma CMS project\n ${pc.cyan('deploy')} Deploy your project to Figma\n ${pc.cyan('build-lambda-zip')} Build Lambda deployment zip\n\n ${pc.bold('OPTIONS')}\n\n ${pc.dim('-h, --help Show help')}\n ${pc.dim('-v, --version Show CLI version')}\n ${pc.dim('--debug Enable debug logging')}\n ${pc.dim('--env <env> Set environment: prod or staging')}\n\n ${pc.bold('AUTHENTICATION')}\n\n ${pc.cyan('@payloadcms/figma login')} Authenticate with Figma\n ${pc.cyan('@payloadcms/figma logout')} Clear all tokens (with confirmation)\n ${pc.cyan('@payloadcms/figma list-tokens')} Display stored OAuth and project tokens\n\n ${pc.bold('INIT COMMAND')}\n\n ${pc.cyan('@payloadcms/figma init --id <content-system-id>')} Initialize project with Content System ID\n ${pc.cyan('@payloadcms/figma init --force')} Force reconfiguration of existing project\n\n ${pc.bold('DEPLOY COMMAND')}\n\n ${pc.cyan('@payloadcms/figma deploy')} Deploy your project to Figma\n ${pc.dim('--yes, -y')} Skip confirmation prompts\n ${pc.dim('--skip-build')} Skip building and use existing build\n\n ${pc.bold('DOCUMENTATION')}\n\n ${createTerminalLink('Getting Started', 'https://payloadcms.com/docs/getting-started/what-is-payload')}\n ${createTerminalLink('Figma CMS Docs', 'https://www.figma.com/developers/api')}\n`)\n}\n\n// Create terminalLink with fallback for unsupported terminals\nfunction createTerminalLink(text: string, url: string) {\n return terminalLink(text, url, {\n fallback: (text, url) => `${text}: ${url}`,\n })\n}\n\nexport function successMessage(projectDir: string, packageManager: PackageManager): string {\n const relativePath = path.relative(process.cwd(), projectDir)\n return `\n${header('Launch Application:')}\n\n - cd ./${relativePath}\n - ${packageManager === 'npm' ? 'npm run' : packageManager} dev or follow directions in README.md\n\n${header('Documentation:')}\n\n - ${createTerminalLink(\n 'Getting Started',\n 'https://payloadcms.com/docs/getting-started/what-is-payload',\n )}\n - ${createTerminalLink('Configuration', 'https://payloadcms.com/docs/configuration/overview')}\n\n`\n}\n\nexport function successfulNextInit(): string {\n return `- ${createTerminalLink(\n 'Getting Started',\n 'https://payloadcms.com/docs/getting-started/what-is-payload',\n )}\n- ${createTerminalLink('Configuration', 'https://payloadcms.com/docs/configuration/overview')}\n`\n}\n\nexport function moveMessage(args: { nextAppDir: string; projectDir: string }): string {\n const relativeAppDir = path.relative(process.cwd(), args.nextAppDir)\n return `\n${header('Next Steps:')}\n\nPayload does not support a top-level layout.tsx file in the app directory.\n\n${pc.bold('To continue:')}\n\n- Create a new directory in ./${relativeAppDir} such as ./${relativeAppDir}/${pc.bold('(app)')}\n- Move all files from ./${relativeAppDir} into that directory\n\nIt is recommended to do this from your IDE if your app has existing file references.\n\nOnce moved, rerun the @payloadcms/figma command again.\n`\n}\n\nexport function feedbackOutro(): string {\n return `${pc.bgCyan(pc.black(' Have feedback? '))} Visit us on ${createTerminalLink('GitHub', 'https://github.com/payloadcms/payload')}.`\n}\n"],"names":["path","pc","terminalLink","header","message","bold","helpMessage","console","log","dim","cyan","createTerminalLink","text","url","fallback","successMessage","projectDir","packageManager","relativePath","relative","process","cwd","successfulNextInit","moveMessage","args","relativeAppDir","nextAppDir","feedbackOutro","bgCyan","black"],"mappings":"AAAA,6BAA6B,GAC7B,OAAOA,UAAU,OAAM;AACvB,OAAOC,QAAQ,aAAY;AAC3B,OAAOC,kBAAkB,gBAAe;AAIxC,MAAMC,SAAS,CAACC,UAA4BH,GAAGI,IAAI,CAACD;AAEpD,OAAO,SAASE;IACdC,QAAQC,GAAG,CAAC,CAAC;EACb,EAAEP,GAAGI,IAAI,CAAC,SAAS;;MAEf,EAAEJ,GAAGQ,GAAG,CAAC,yCAAyC;;EAEtD,EAAER,GAAGI,IAAI,CAAC,YAAY;;MAElB,EAAEJ,GAAGS,IAAI,CAAC,SAAS;MACnB,EAAET,GAAGS,IAAI,CAAC,UAAU;MACpB,EAAET,GAAGS,IAAI,CAAC,eAAe;MACzB,EAAET,GAAGS,IAAI,CAAC,QAAQ;MAClB,EAAET,GAAGS,IAAI,CAAC,UAAU;MACpB,EAAET,GAAGS,IAAI,CAAC,oBAAoB;;EAElC,EAAET,GAAGI,IAAI,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,EAAEA,mBAAmB,iBAAiB,sDAAsD;;AAEhG,CAAC;AACD;AAEA,OAAO,SAASW;IACd,OAAO,CAAC,EAAE,EAAEX,mBACV,mBACA,+DACA;EACF,EAAEA,mBAAmB,iBAAiB,sDAAsD;AAC9F,CAAC;AACD;AAEA,OAAO,SAASY,YAAYC,IAAgD;IAC1E,MAAMC,iBAAiBzB,KAAKmB,QAAQ,CAACC,QAAQC,GAAG,IAAIG,KAAKE,UAAU;IACnE,OAAO,CAAC;AACV,EAAEvB,OAAO,eAAe;;;;AAIxB,EAAEF,GAAGI,IAAI,CAAC,gBAAgB;;8BAEI,EAAEoB,eAAe,WAAW,EAAEA,eAAe,CAAC,EAAExB,GAAGI,IAAI,CAAC,SAAS;wBACvE,EAAEoB,eAAe;;;;;AAKzC,CAAC;AACD;AAEA,OAAO,SAASE;IACd,OAAO,GAAG1B,GAAG2B,MAAM,CAAC3B,GAAG4B,KAAK,CAAC,qBAAqB,aAAa,EAAElB,mBAAmB,UAAU,yCAAyC,CAAC,CAAC;AAC3I"}
|
|
@@ -1,19 +1,39 @@
|
|
|
1
1
|
import type { SourceFile } from 'ts-morph';
|
|
2
|
+
/**
|
|
3
|
+
* Result of detecting what changes are needed in a payload config file
|
|
4
|
+
*/
|
|
2
5
|
export type DetectionResult = {
|
|
6
|
+
/** Database adapter configuration if present */
|
|
3
7
|
dbProperty?: {
|
|
8
|
+
/** Name of the adapter function (e.g., 'mongooseAdapter', 'postgresAdapter') */
|
|
4
9
|
adapter: string;
|
|
10
|
+
/** NPM package the adapter is imported from (e.g., '@payloadcms/db-mongodb') */
|
|
5
11
|
importSource: string;
|
|
6
12
|
};
|
|
13
|
+
/** Editor configuration if present */
|
|
7
14
|
editorProperty?: {
|
|
15
|
+
/** NPM package the editor is imported from (e.g., '@payloadcms/richtext-lexical') */
|
|
8
16
|
importSource: string;
|
|
17
|
+
/** Whether this is a default editor with no custom configuration */
|
|
9
18
|
isDefault: boolean;
|
|
10
19
|
};
|
|
20
|
+
/** Whether the config already has a `figma` property */
|
|
11
21
|
figmaObjectExists: boolean;
|
|
22
|
+
/** Whether buildConfig/buildFigmaConfig uses an import alias (e.g., 'buildConfig as createConfig') */
|
|
12
23
|
hasAlias: boolean;
|
|
24
|
+
/** Whether a buildConfig or buildFigmaConfig call was found (undefined if not checked) */
|
|
13
25
|
hasBuildConfig?: boolean;
|
|
26
|
+
/** Whether there are other imports from 'payload' besides buildConfig (e.g., types) */
|
|
14
27
|
hasOtherPayloadImports: boolean;
|
|
28
|
+
/** Whether the import needs to be changed from 'payload' to '@payloadcms/figma' */
|
|
15
29
|
needsImportChange: boolean;
|
|
30
|
+
/** Whether a `secret` property exists in the config */
|
|
16
31
|
secretProperty?: boolean;
|
|
32
|
+
/** Sharp configuration if present */
|
|
33
|
+
sharpProperty?: {
|
|
34
|
+
/** NPM package sharp is imported from (always 'sharp') */
|
|
35
|
+
importSource: string;
|
|
36
|
+
};
|
|
17
37
|
};
|
|
18
38
|
/**
|
|
19
39
|
* Detect what changes are needed in the payload config file
|
|
@@ -29,9 +49,8 @@ export type ASTModificationResult = {
|
|
|
29
49
|
*/
|
|
30
50
|
export declare function applyModifications(sourceFile: SourceFile, detection: DetectionResult): ASTModificationResult;
|
|
31
51
|
export type FigmaPropertyConfig = {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
useContentSystem: boolean;
|
|
52
|
+
contentSystemId: string;
|
|
53
|
+
useContentSystem?: boolean;
|
|
35
54
|
};
|
|
36
55
|
/**
|
|
37
56
|
* Add figma property to buildConfig if it doesn't exist
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"payload-config-ast.d.ts","sourceRoot":"","sources":["../../src/utils/payload-config-ast.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAM1C,MAAM,MAAM,eAAe,GAAG;IAC5B,UAAU,CAAC,EAAE;QACX,OAAO,EAAE,MAAM,CAAA;QACf,YAAY,EAAE,MAAM,CAAA;KACrB,CAAA;IACD,cAAc,CAAC,EAAE;QACf,YAAY,EAAE,MAAM,CAAA;QACpB,SAAS,EAAE,OAAO,CAAA;KACnB,CAAA;IACD,iBAAiB,EAAE,OAAO,CAAA;IAC1B,QAAQ,EAAE,OAAO,CAAA;IACjB,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,sBAAsB,EAAE,OAAO,CAAA;IAC/B,iBAAiB,EAAE,OAAO,CAAA;IAC1B,cAAc,CAAC,EAAE,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"payload-config-ast.d.ts","sourceRoot":"","sources":["../../src/utils/payload-config-ast.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAM1C;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,gDAAgD;IAChD,UAAU,CAAC,EAAE;QACX,gFAAgF;QAChF,OAAO,EAAE,MAAM,CAAA;QACf,gFAAgF;QAChF,YAAY,EAAE,MAAM,CAAA;KACrB,CAAA;IACD,sCAAsC;IACtC,cAAc,CAAC,EAAE;QACf,qFAAqF;QACrF,YAAY,EAAE,MAAM,CAAA;QACpB,oEAAoE;QACpE,SAAS,EAAE,OAAO,CAAA;KACnB,CAAA;IACD,wDAAwD;IACxD,iBAAiB,EAAE,OAAO,CAAA;IAC1B,sGAAsG;IACtG,QAAQ,EAAE,OAAO,CAAA;IACjB,0FAA0F;IAC1F,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,uFAAuF;IACvF,sBAAsB,EAAE,OAAO,CAAA;IAC/B,mFAAmF;IACnF,iBAAiB,EAAE,OAAO,CAAA;IAC1B,uDAAuD;IACvD,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,qCAAqC;IACrC,aAAa,CAAC,EAAE;QACd,0DAA0D;QAC1D,YAAY,EAAE,MAAM,CAAA;KACrB,CAAA;CACF,CAAA;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,UAAU,EAAE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