@payloadcms/figma 0.0.1-alpha.8 → 0.1.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/control-plane.d.ts +56 -7
- package/dist/api/control-plane.js +188 -74
- package/dist/api/error-response.d.ts +36 -0
- package/dist/api/error-response.js +66 -0
- package/dist/api/figma-api.d.ts +24 -3
- package/dist/api/figma-api.js +110 -34
- package/dist/auth/browser.d.ts +0 -1
- package/dist/auth/browser.js +0 -2
- package/dist/auth/callback-server.d.ts +19 -8
- package/dist/auth/callback-server.js +72 -32
- package/dist/auth/credentials.d.ts +20 -0
- package/dist/auth/credentials.js +19 -0
- package/dist/auth/crypto-utils.d.ts +28 -1
- package/dist/auth/crypto-utils.js +132 -23
- package/dist/auth/jwt-validator.d.ts +23 -6
- package/dist/auth/jwt-validator.js +35 -9
- package/dist/auth/oauth-flow.d.ts +19 -4
- package/dist/auth/oauth-flow.js +151 -34
- package/dist/auth/paste-code.d.ts +33 -0
- package/dist/auth/paste-code.js +87 -0
- package/dist/auth/pkce.d.ts +0 -1
- package/dist/auth/pkce.js +0 -2
- package/dist/auth/project-token.d.ts +32 -17
- package/dist/auth/project-token.js +176 -68
- package/dist/auth/refresh.d.ts +2 -2
- package/dist/auth/refresh.js +25 -14
- package/dist/auth/token-store-migration.d.ts +57 -0
- package/dist/auth/token-store-migration.js +154 -0
- package/dist/auth/token-store.d.ts +63 -98
- package/dist/auth/token-store.js +405 -124
- package/dist/auth/types.d.ts +40 -6
- package/dist/auth/types.js +1 -3
- package/dist/cli.d.ts +0 -1
- package/dist/cli.js +102 -8
- package/dist/commands/bootstrap.d.ts +17 -0
- package/dist/commands/bootstrap.js +88 -0
- package/dist/commands/build-lambda-zip.d.ts +4 -0
- package/dist/commands/build-lambda-zip.js +17 -0
- package/dist/commands/debug.d.ts +7 -0
- package/dist/commands/debug.js +178 -0
- package/dist/commands/deploy.d.ts +11 -1
- package/dist/commands/deploy.js +193 -153
- package/dist/commands/dump-tokens.d.ts +11 -0
- package/dist/commands/dump-tokens.js +67 -0
- package/dist/commands/env.d.ts +12 -0
- package/dist/commands/env.js +86 -0
- package/dist/commands/init.d.ts +9 -6
- package/dist/commands/init.js +232 -152
- package/dist/commands/list-tokens.d.ts +3 -4
- package/dist/commands/list-tokens.js +24 -11
- package/dist/commands/login.d.ts +8 -2
- package/dist/commands/login.js +34 -18
- package/dist/commands/logout.d.ts +5 -5
- package/dist/commands/logout.js +77 -17
- package/dist/commands/upgrade.d.ts +4 -0
- package/dist/commands/upgrade.js +329 -0
- package/dist/commands/upload-schema.d.ts +8 -0
- package/dist/commands/upload-schema.js +91 -0
- package/dist/config/oauth.d.ts +17 -12
- package/dist/config/oauth.js +38 -39
- package/dist/constants.d.ts +63 -19
- package/dist/constants.js +158 -20
- package/dist/db-content-api/generated/content-api-types.d.ts +7574 -0
- package/dist/db-content-api/generated/content-api-types.js +5 -0
- package/dist/db-content-api/index.d.ts +37 -0
- package/dist/db-content-api/index.js +938 -0
- package/dist/db-content-api/temp-utilities/slug.d.ts +1 -0
- package/dist/db-content-api/temp-utilities/slug.js +1 -0
- package/dist/db-content-api/temp-utilities/sorting.d.ts +2 -0
- package/dist/db-content-api/temp-utilities/sorting.js +37 -0
- package/dist/db-content-api/temp-utilities/types.d.ts +21 -0
- package/dist/db-content-api/temp-utilities/types.js +13 -0
- package/dist/db-content-api/temp-utilities/unwrapDocument.d.ts +38 -0
- package/dist/db-content-api/temp-utilities/unwrapDocument.js +62 -0
- package/dist/db-content-api/utilities/auth.d.ts +29 -0
- package/dist/db-content-api/utilities/auth.js +82 -0
- package/dist/db-content-api/utilities/data/applyDefaults.d.ts +6 -0
- package/dist/db-content-api/utilities/data/applyDefaults.js +75 -0
- package/dist/db-content-api/utilities/data/castFieldValue.d.ts +10 -0
- package/dist/db-content-api/utilities/data/castFieldValue.js +66 -0
- package/dist/db-content-api/utilities/data/index.d.ts +48 -0
- package/dist/db-content-api/utilities/data/index.js +299 -0
- package/dist/db-content-api/utilities/data/pointShape.d.ts +3 -0
- package/dist/db-content-api/utilities/data/pointShape.js +43 -0
- package/dist/db-content-api/utilities/data/removeVirtualFields.d.ts +11 -0
- package/dist/db-content-api/utilities/data/removeVirtualFields.js +52 -0
- package/dist/db-content-api/utilities/data/richTextShape.d.ts +3 -0
- package/dist/db-content-api/utilities/data/richTextShape.js +56 -0
- package/dist/db-content-api/utilities/data/stripFields.d.ts +47 -0
- package/dist/db-content-api/utilities/data/stripFields.js +170 -0
- package/dist/db-content-api/utilities/data/transformPublishedLocale.d.ts +22 -0
- package/dist/db-content-api/utilities/data/transformPublishedLocale.js +40 -0
- package/dist/db-content-api/utilities/data/validateRelationships.d.ts +6 -0
- package/dist/db-content-api/utilities/data/validateRelationships.js +100 -0
- package/dist/db-content-api/utilities/joins.d.ts +52 -0
- package/dist/db-content-api/utilities/joins.js +137 -0
- package/dist/db-content-api/utilities/locale/index.d.ts +9 -0
- package/dist/db-content-api/utilities/locale/index.js +19 -0
- package/dist/db-content-api/utilities/meta/buildLocalizedPaths.d.ts +10 -0
- package/dist/db-content-api/utilities/meta/buildLocalizedPaths.js +71 -0
- package/dist/db-content-api/utilities/meta/buildMeta.d.ts +41 -0
- package/dist/db-content-api/utilities/meta/buildMeta.js +39 -0
- package/dist/db-content-api/utilities/meta/buildPathTypes.d.ts +16 -0
- package/dist/db-content-api/utilities/meta/buildPathTypes.js +243 -0
- package/dist/db-content-api/utilities/meta/buildUniquePaths.d.ts +12 -0
- package/dist/db-content-api/utilities/meta/buildUniquePaths.js +60 -0
- package/dist/db-content-api/utilities/meta/normalizeLocaleInWhere.d.ts +9 -0
- package/dist/db-content-api/utilities/meta/normalizeLocaleInWhere.js +100 -0
- package/dist/db-content-api/utilities/resolveBlocks.d.ts +19 -0
- package/dist/db-content-api/utilities/resolveBlocks.js +31 -0
- package/dist/db-content-api/utilities/schema/buildDocumentSchema.d.ts +55 -0
- package/dist/db-content-api/utilities/schema/buildDocumentSchema.js +182 -0
- package/dist/db-content-api/utilities/where.d.ts +19 -0
- package/dist/db-content-api/utilities/where.js +106 -0
- package/dist/deploy/schedule-extract-plugin.d.ts +10 -0
- package/dist/deploy/schedule-extract-plugin.js +32 -0
- package/dist/endpoints/health.d.ts +2 -0
- package/dist/endpoints/health.js +9 -0
- package/dist/endpoints/schema.d.ts +2 -0
- package/dist/endpoints/schema.js +27 -0
- package/dist/exports/client.d.ts +2 -1
- package/dist/exports/client.js +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +3 -3
- package/dist/lib/download-skill.d.ts +12 -0
- package/dist/lib/download-skill.js +77 -0
- package/dist/oauth/components/FigmaAvatar/index.d.ts +3 -0
- package/dist/oauth/components/FigmaAvatar/index.js +25 -0
- package/dist/oauth/components/FigmaAvatar/index.scss +12 -0
- package/dist/oauth/components/FigmaAvatarCell/index.d.ts +4 -0
- package/dist/oauth/components/FigmaAvatarCell/index.js +23 -0
- package/dist/oauth/components/FigmaAvatarCell/index.scss +5 -0
- package/dist/oauth/components/FigmaAvatarPlaceholder/index.d.ts +8 -0
- package/dist/oauth/components/FigmaAvatarPlaceholder/index.js +35 -0
- package/dist/oauth/components/FigmaAvatarPlaceholder/index.scss +28 -0
- package/dist/oauth/components/LoginButton/iframeAutoLogin.d.ts +81 -0
- package/dist/oauth/components/LoginButton/iframeAutoLogin.js +168 -0
- package/dist/oauth/components/LoginButton/index.d.ts +0 -1
- package/dist/oauth/components/LoginButton/index.js +156 -18
- package/dist/oauth/components/LoginButton/index.scss +75 -3
- package/dist/oauth/components/LogoutButton/index.d.ts +0 -1
- package/dist/oauth/components/LogoutButton/index.js +20 -9
- package/dist/oauth/defaults.d.ts +3 -2
- package/dist/oauth/defaults.js +79 -12
- package/dist/oauth/endpoints/getLoginEndpoint.d.ts +0 -1
- package/dist/oauth/endpoints/getLoginEndpoint.js +87 -84
- package/dist/oauth/endpoints/getLogoutEndpoint.d.ts +0 -1
- package/dist/oauth/endpoints/getLogoutEndpoint.js +7 -6
- package/dist/oauth/endpoints/getMetaEndpoint.d.ts +0 -1
- package/dist/oauth/endpoints/getMetaEndpoint.js +18 -5
- package/dist/oauth/endpoints/getRedirectToLoginEndpoint.d.ts +0 -1
- package/dist/oauth/endpoints/getRedirectToLoginEndpoint.js +11 -4
- package/dist/oauth/exports/client.d.ts +0 -1
- package/dist/oauth/exports/client.js +0 -2
- package/dist/oauth/hooks/afterLogout.d.ts +0 -1
- package/dist/oauth/hooks/afterLogout.js +0 -2
- package/dist/oauth/hooks/me.d.ts +0 -1
- package/dist/oauth/hooks/me.js +0 -2
- package/dist/oauth/hooks/refresh.d.ts +0 -1
- package/dist/oauth/hooks/refresh.js +2 -3
- package/dist/oauth/index.d.ts +0 -1
- package/dist/oauth/index.js +27 -7
- package/dist/oauth/strategy/index.d.ts +0 -3
- package/dist/oauth/strategy/index.js +55 -34
- package/dist/oauth/types.d.ts +23 -7
- package/dist/oauth/types.js +0 -2
- package/dist/oauth/utilities/buildUnauthorizedRedirect.d.ts +14 -0
- package/dist/oauth/utilities/buildUnauthorizedRedirect.js +28 -0
- package/dist/oauth/utilities/clearCookie.d.ts +0 -1
- package/dist/oauth/utilities/clearCookie.js +5 -3
- package/dist/oauth/utilities/createCookieOptions.d.ts +0 -1
- package/dist/oauth/utilities/createCookieOptions.js +9 -4
- package/dist/oauth/utilities/createDebugLogger.d.ts +0 -1
- package/dist/oauth/utilities/createDebugLogger.js +0 -2
- package/dist/oauth/utilities/establishSession.d.ts +22 -0
- package/dist/oauth/utilities/establishSession.js +80 -0
- package/dist/oauth/utilities/exchangeCodeForAccessToken.d.ts +23 -0
- package/dist/oauth/utilities/exchangeCodeForAccessToken.js +26 -0
- package/dist/oauth/utilities/extractOrigin.d.ts +0 -1
- package/dist/oauth/utilities/extractOrigin.js +0 -2
- package/dist/oauth/utilities/figmaHostnames.d.ts +2 -0
- package/dist/oauth/utilities/figmaHostnames.js +24 -0
- package/dist/oauth/utilities/getAdminCollectionSlug.d.ts +0 -1
- package/dist/oauth/utilities/getAdminCollectionSlug.js +0 -2
- package/dist/oauth/utilities/getAuthorizeURL.d.ts +65 -2
- package/dist/oauth/utilities/getAuthorizeURL.js +57 -4
- package/dist/oauth/utilities/getCookieExpiration.d.ts +0 -1
- package/dist/oauth/utilities/getCookieExpiration.js +0 -2
- package/dist/oauth/utilities/getSecondsFromTokenExp.d.ts +0 -1
- package/dist/oauth/utilities/getSecondsFromTokenExp.js +0 -2
- package/dist/oauth/utilities/getTokenExp.d.ts +0 -1
- package/dist/oauth/utilities/getTokenExp.js +0 -2
- package/dist/oauth/utilities/getUsernameField.d.ts +0 -1
- package/dist/oauth/utilities/getUsernameField.js +0 -2
- package/dist/oauth/utilities/hasUserTokenPropsChanged.d.ts +0 -1
- package/dist/oauth/utilities/hasUserTokenPropsChanged.js +0 -2
- package/dist/oauth/utilities/isAbsoluteURL.d.ts +1 -0
- package/dist/oauth/utilities/isAbsoluteURL.js +1 -0
- package/dist/oauth/utilities/isDuplicateKeyError.d.ts +6 -0
- package/dist/oauth/utilities/isDuplicateKeyError.js +12 -0
- package/dist/oauth/utilities/mergeHeaders.d.ts +0 -1
- package/dist/oauth/utilities/mergeHeaders.js +0 -2
- package/dist/oauth/utilities/refreshTokens.d.ts +0 -1
- package/dist/oauth/utilities/refreshTokens.js +21 -13
- package/dist/oauth/utilities/withPartitionedCookie.d.ts +19 -0
- package/dist/oauth/utilities/withPartitionedCookie.js +26 -0
- package/dist/oauth/utils/getSearchParam.d.ts +17 -0
- package/dist/oauth/utils/getSearchParam.js +22 -0
- package/dist/plugin/adapter.d.ts +0 -1
- package/dist/plugin/adapter.js +0 -2
- package/dist/plugin/auth-preflight.d.ts +7 -0
- package/dist/plugin/auth-preflight.js +18 -0
- package/dist/plugin/bootstrap-preflight.d.ts +22 -0
- package/dist/plugin/bootstrap-preflight.js +43 -0
- package/dist/plugin/build-config.d.ts +27 -15
- package/dist/plugin/build-config.js +381 -18
- package/dist/plugin/dev-cookie-names.d.ts +13 -0
- package/dist/plugin/dev-cookie-names.js +17 -0
- package/dist/scss.d.js +2 -0
- package/dist/storage-content-api/api-types.d.ts +183 -0
- package/dist/storage-content-api/api-types.js +4 -0
- package/dist/storage-content-api/client-uploads/generate.d.ts +14 -0
- package/dist/storage-content-api/client-uploads/generate.js +69 -0
- package/dist/storage-content-api/client.d.ts +5 -0
- package/dist/storage-content-api/client.js +37 -0
- package/dist/storage-content-api/generateURL.d.ts +6 -0
- package/dist/storage-content-api/generateURL.js +6 -0
- package/dist/storage-content-api/handleDelete.d.ts +7 -0
- package/dist/storage-content-api/handleDelete.js +15 -0
- package/dist/storage-content-api/handleUpload.d.ts +10 -0
- package/dist/storage-content-api/handleUpload.js +162 -0
- package/dist/storage-content-api/index.d.ts +4 -0
- package/dist/storage-content-api/index.js +37 -0
- package/dist/storage-content-api/staticHandler.d.ts +9 -0
- package/dist/storage-content-api/staticHandler.js +61 -0
- package/dist/storage-content-api/types.d.ts +9 -0
- package/dist/storage-content-api/types.js +1 -0
- package/dist/storage-content-api/utilities/getSafeFilename.d.ts +11 -0
- package/dist/storage-content-api/utilities/getSafeFilename.js +59 -0
- package/dist/storage-content-api/utilities/index.d.ts +2 -0
- package/dist/storage-content-api/utilities/index.js +2 -0
- package/dist/storage-content-api/utilities/parseUploadReference.d.ts +17 -0
- package/dist/storage-content-api/utilities/parseUploadReference.js +27 -0
- package/dist/templates/.env.example +5 -0
- package/dist/templates/README.md +19 -0
- package/dist/types/config.d.ts +2 -2
- package/dist/types/config.js +0 -4
- package/dist/types.d.ts +10 -2
- package/dist/types.js +0 -2
- package/dist/utils/adapters/nextjs.d.ts +8 -0
- package/dist/utils/adapters/nextjs.js +61 -0
- package/dist/utils/adapters/nitro.d.ts +8 -0
- package/dist/utils/adapters/nitro.js +172 -0
- package/dist/utils/adapters/vite.d.ts +9 -0
- package/dist/utils/adapters/vite.js +31 -0
- package/dist/utils/asset-collection.d.ts +27 -7
- package/dist/utils/asset-collection.js +59 -32
- package/dist/utils/build-detection.d.ts +5 -12
- package/dist/utils/build-detection.js +74 -13
- package/dist/utils/build-lambda-zip.d.ts +25 -0
- package/dist/utils/build-lambda-zip.js +90 -0
- package/dist/utils/cache-bootstrap.d.ts +7 -0
- package/dist/utils/cache-bootstrap.js +16 -0
- package/dist/utils/config.d.ts +0 -1
- package/dist/utils/config.js +1 -3
- package/dist/utils/deploy-adapter.d.ts +45 -0
- package/dist/utils/deploy-adapter.js +56 -0
- package/dist/utils/download-template.d.ts +9 -2
- package/dist/utils/download-template.js +24 -20
- package/dist/utils/env-management.d.ts +24 -8
- package/dist/utils/env-management.js +119 -66
- package/dist/utils/format-env-suffix.d.ts +11 -0
- package/dist/utils/format-env-suffix.js +11 -0
- package/dist/utils/format.d.ts +0 -1
- package/dist/utils/format.js +0 -2
- package/dist/utils/formatter.d.ts +0 -1
- package/dist/utils/formatter.js +23 -13
- package/dist/utils/fs-utils.d.ts +12 -0
- package/dist/utils/fs-utils.js +55 -0
- package/dist/utils/git.d.ts +0 -1
- package/dist/utils/git.js +0 -2
- package/dist/utils/handle-upgrade.d.ts +8 -0
- package/dist/utils/handle-upgrade.js +39 -0
- package/dist/utils/is-debug.d.ts +0 -1
- package/dist/utils/is-debug.js +0 -2
- package/dist/utils/lambda-config.d.ts +3 -2
- package/dist/utils/lambda-config.js +75 -80
- package/dist/utils/load-payload-config.d.ts +9 -0
- package/dist/utils/load-payload-config.js +27 -0
- package/dist/utils/log.d.ts +0 -1
- package/dist/utils/log.js +0 -2
- package/dist/utils/messages.d.ts +1 -3
- package/dist/utils/messages.js +47 -13
- package/dist/utils/package-manager.d.ts +24 -1
- package/dist/utils/package-manager.js +53 -2
- package/dist/utils/parse-template-spec.d.ts +11 -0
- package/dist/utils/parse-template-spec.js +60 -0
- package/dist/utils/payload-config-ast.d.ts +27 -7
- package/dist/utils/payload-config-ast.js +106 -60
- package/dist/utils/payload-config-finder.d.ts +2 -3
- package/dist/utils/payload-config-finder.js +48 -11
- package/dist/utils/payload-config-modifier.d.ts +1 -2
- package/dist/utils/payload-config-modifier.js +114 -68
- package/dist/utils/payload-package-check.d.ts +28 -3
- package/dist/utils/payload-package-check.js +90 -31
- package/dist/utils/project.d.ts +8 -4
- package/dist/utils/project.js +63 -37
- package/dist/utils/resolve-environment.d.ts +13 -0
- package/dist/utils/resolve-environment.js +29 -0
- package/dist/utils/s3-upload.d.ts +7 -3
- package/dist/utils/s3-upload.js +44 -9
- package/dist/utils/token-display.d.ts +5 -2
- package/dist/utils/token-display.js +49 -24
- package/dist/utils/typescript-validator.d.ts +0 -1
- package/dist/utils/typescript-validator.js +4 -8
- package/dist/utils/version-check.d.ts +2 -0
- package/dist/utils/version-check.js +43 -0
- package/package.json +47 -16
- package/dist/api/control-plane.d.ts.map +0 -1
- package/dist/api/control-plane.js.map +0 -1
- package/dist/api/figma-api.d.ts.map +0 -1
- package/dist/api/figma-api.js.map +0 -1
- package/dist/auth/browser.d.ts.map +0 -1
- package/dist/auth/browser.js.map +0 -1
- package/dist/auth/callback-server.d.ts.map +0 -1
- package/dist/auth/callback-server.js.map +0 -1
- package/dist/auth/crypto-utils.d.ts.map +0 -1
- package/dist/auth/crypto-utils.js.map +0 -1
- package/dist/auth/jwt-validator.d.ts.map +0 -1
- package/dist/auth/jwt-validator.js.map +0 -1
- package/dist/auth/oauth-flow.d.ts.map +0 -1
- package/dist/auth/oauth-flow.js.map +0 -1
- package/dist/auth/pkce.d.ts.map +0 -1
- package/dist/auth/pkce.js.map +0 -1
- package/dist/auth/project-token.d.ts.map +0 -1
- package/dist/auth/project-token.js.map +0 -1
- package/dist/auth/refresh.d.ts.map +0 -1
- package/dist/auth/refresh.js.map +0 -1
- package/dist/auth/token-store.d.ts.map +0 -1
- package/dist/auth/token-store.js.map +0 -1
- package/dist/auth/types.d.ts.map +0 -1
- package/dist/auth/types.js.map +0 -1
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js.map +0 -1
- package/dist/commands/deploy.d.ts.map +0 -1
- package/dist/commands/deploy.js.map +0 -1
- package/dist/commands/init.d.ts.map +0 -1
- package/dist/commands/init.js.map +0 -1
- package/dist/commands/list-tokens.d.ts.map +0 -1
- package/dist/commands/list-tokens.js.map +0 -1
- package/dist/commands/login.d.ts.map +0 -1
- package/dist/commands/login.js.map +0 -1
- package/dist/commands/logout.d.ts.map +0 -1
- package/dist/commands/logout.js.map +0 -1
- package/dist/config/oauth.d.ts.map +0 -1
- package/dist/config/oauth.js.map +0 -1
- package/dist/constants.d.ts.map +0 -1
- package/dist/constants.js.map +0 -1
- package/dist/exports/client.d.ts.map +0 -1
- package/dist/exports/client.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/oauth/components/LoginButton/index.d.ts.map +0 -1
- package/dist/oauth/components/LoginButton/index.js.map +0 -1
- package/dist/oauth/components/LogoutButton/index.d.ts.map +0 -1
- package/dist/oauth/components/LogoutButton/index.js.map +0 -1
- package/dist/oauth/defaults.d.ts.map +0 -1
- package/dist/oauth/defaults.js.map +0 -1
- package/dist/oauth/endpoints/getLoginEndpoint.d.ts.map +0 -1
- package/dist/oauth/endpoints/getLoginEndpoint.js.map +0 -1
- package/dist/oauth/endpoints/getLogoutEndpoint.d.ts.map +0 -1
- package/dist/oauth/endpoints/getLogoutEndpoint.js.map +0 -1
- package/dist/oauth/endpoints/getMetaEndpoint.d.ts.map +0 -1
- package/dist/oauth/endpoints/getMetaEndpoint.js.map +0 -1
- package/dist/oauth/endpoints/getRedirectToLoginEndpoint.d.ts.map +0 -1
- package/dist/oauth/endpoints/getRedirectToLoginEndpoint.js.map +0 -1
- package/dist/oauth/exports/client.d.ts.map +0 -1
- package/dist/oauth/exports/client.js.map +0 -1
- package/dist/oauth/hooks/afterLogout.d.ts.map +0 -1
- package/dist/oauth/hooks/afterLogout.js.map +0 -1
- package/dist/oauth/hooks/me.d.ts.map +0 -1
- package/dist/oauth/hooks/me.js.map +0 -1
- package/dist/oauth/hooks/refresh.d.ts.map +0 -1
- package/dist/oauth/hooks/refresh.js.map +0 -1
- package/dist/oauth/index.d.ts.map +0 -1
- package/dist/oauth/index.js.map +0 -1
- package/dist/oauth/strategy/index.d.ts.map +0 -1
- package/dist/oauth/strategy/index.js.map +0 -1
- package/dist/oauth/types.d.ts.map +0 -1
- package/dist/oauth/types.js.map +0 -1
- package/dist/oauth/utilities/clearCookie.d.ts.map +0 -1
- package/dist/oauth/utilities/clearCookie.js.map +0 -1
- package/dist/oauth/utilities/createCookieOptions.d.ts.map +0 -1
- package/dist/oauth/utilities/createCookieOptions.js.map +0 -1
- package/dist/oauth/utilities/createDebugLogger.d.ts.map +0 -1
- package/dist/oauth/utilities/createDebugLogger.js.map +0 -1
- package/dist/oauth/utilities/extractOrigin.d.ts.map +0 -1
- package/dist/oauth/utilities/extractOrigin.js.map +0 -1
- package/dist/oauth/utilities/getAdminCollectionSlug.d.ts.map +0 -1
- package/dist/oauth/utilities/getAdminCollectionSlug.js.map +0 -1
- package/dist/oauth/utilities/getAdminPath.d.ts +0 -8
- package/dist/oauth/utilities/getAdminPath.d.ts.map +0 -1
- package/dist/oauth/utilities/getAdminPath.js +0 -9
- package/dist/oauth/utilities/getAdminPath.js.map +0 -1
- package/dist/oauth/utilities/getAuthorizeURL.d.ts.map +0 -1
- package/dist/oauth/utilities/getAuthorizeURL.js.map +0 -1
- package/dist/oauth/utilities/getCookieExpiration.d.ts.map +0 -1
- package/dist/oauth/utilities/getCookieExpiration.js.map +0 -1
- package/dist/oauth/utilities/getSecondsFromTokenExp.d.ts.map +0 -1
- package/dist/oauth/utilities/getSecondsFromTokenExp.js.map +0 -1
- package/dist/oauth/utilities/getTokenExp.d.ts.map +0 -1
- package/dist/oauth/utilities/getTokenExp.js.map +0 -1
- package/dist/oauth/utilities/getUsernameField.d.ts.map +0 -1
- package/dist/oauth/utilities/getUsernameField.js.map +0 -1
- package/dist/oauth/utilities/hasUserTokenPropsChanged.d.ts.map +0 -1
- package/dist/oauth/utilities/hasUserTokenPropsChanged.js.map +0 -1
- package/dist/oauth/utilities/mergeHeaders.d.ts.map +0 -1
- package/dist/oauth/utilities/mergeHeaders.js.map +0 -1
- package/dist/oauth/utilities/refreshTokens.d.ts.map +0 -1
- package/dist/oauth/utilities/refreshTokens.js.map +0 -1
- package/dist/plugin/adapter.d.ts.map +0 -1
- package/dist/plugin/adapter.js.map +0 -1
- package/dist/plugin/build-config.d.ts.map +0 -1
- package/dist/plugin/build-config.js.map +0 -1
- package/dist/types/config.d.ts.map +0 -1
- package/dist/types/config.js.map +0 -1
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js.map +0 -1
- package/dist/utils/asset-collection.d.ts.map +0 -1
- package/dist/utils/asset-collection.js.map +0 -1
- package/dist/utils/build-detection.d.ts.map +0 -1
- package/dist/utils/build-detection.js.map +0 -1
- package/dist/utils/config.d.ts.map +0 -1
- package/dist/utils/config.js.map +0 -1
- package/dist/utils/download-template.d.ts.map +0 -1
- package/dist/utils/download-template.js.map +0 -1
- package/dist/utils/env-management.d.ts.map +0 -1
- package/dist/utils/env-management.js.map +0 -1
- package/dist/utils/format.d.ts.map +0 -1
- package/dist/utils/format.js.map +0 -1
- package/dist/utils/formatter.d.ts.map +0 -1
- package/dist/utils/formatter.js.map +0 -1
- package/dist/utils/git.d.ts.map +0 -1
- package/dist/utils/git.js.map +0 -1
- package/dist/utils/is-debug.d.ts.map +0 -1
- package/dist/utils/is-debug.js.map +0 -1
- package/dist/utils/lambda-config.d.ts.map +0 -1
- package/dist/utils/lambda-config.js.map +0 -1
- package/dist/utils/log.d.ts.map +0 -1
- package/dist/utils/log.js.map +0 -1
- package/dist/utils/messages.d.ts.map +0 -1
- package/dist/utils/messages.js.map +0 -1
- package/dist/utils/package-manager.d.ts.map +0 -1
- package/dist/utils/package-manager.js.map +0 -1
- package/dist/utils/payload-config-ast.d.ts.map +0 -1
- package/dist/utils/payload-config-ast.js.map +0 -1
- package/dist/utils/payload-config-finder.d.ts.map +0 -1
- package/dist/utils/payload-config-finder.js.map +0 -1
- package/dist/utils/payload-config-modifier.d.ts.map +0 -1
- package/dist/utils/payload-config-modifier.js.map +0 -1
- package/dist/utils/payload-package-check.d.ts.map +0 -1
- package/dist/utils/payload-package-check.js.map +0 -1
- package/dist/utils/project.d.ts.map +0 -1
- package/dist/utils/project.js.map +0 -1
- package/dist/utils/s3-upload.d.ts.map +0 -1
- package/dist/utils/s3-upload.js.map +0 -1
- package/dist/utils/token-display.d.ts.map +0 -1
- package/dist/utils/token-display.js.map +0 -1
- package/dist/utils/typescript-validator.d.ts.map +0 -1
- package/dist/utils/typescript-validator.js.map +0 -1
package/dist/commands/init.d.ts
CHANGED
|
@@ -4,18 +4,22 @@
|
|
|
4
4
|
export interface InitCommandOptions {
|
|
5
5
|
/** Enable debug mode */
|
|
6
6
|
debug?: boolean;
|
|
7
|
+
/** Figma environment name (e.g. 'production', 'staging') */
|
|
8
|
+
env?: string;
|
|
7
9
|
/** Force reconfiguration of existing project */
|
|
8
10
|
force?: boolean;
|
|
9
|
-
/**
|
|
11
|
+
/** Content System ID to use */
|
|
10
12
|
id?: string;
|
|
11
13
|
/** Project name (for scaffolding) */
|
|
12
14
|
name?: string;
|
|
13
|
-
/**
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
|
|
15
|
+
/** Skip Payload skill installation */
|
|
16
|
+
noSkill?: boolean;
|
|
17
|
+
/** npm dist-tag or explicit version for core payload packages (e.g. 'canary', 'latest', '4.0.0-canary.16'); defaults to 'canary' */
|
|
18
|
+
payloadVersion?: string;
|
|
17
19
|
/** Skip authentication check (for testing/development) */
|
|
18
20
|
skipAuth?: boolean;
|
|
21
|
+
/** GitHub template override, e.g. "main:website" or "owner/repo#ref:template-path" */
|
|
22
|
+
template?: string;
|
|
19
23
|
/** Skip prompts and use defaults where possible */
|
|
20
24
|
yes?: boolean;
|
|
21
25
|
}
|
|
@@ -31,4 +35,3 @@ export interface InitCommandOptions {
|
|
|
31
35
|
* @param options - Command options
|
|
32
36
|
*/
|
|
33
37
|
export declare function initCommand(options: InitCommandOptions): Promise<void>;
|
|
34
|
-
//# sourceMappingURL=init.d.ts.map
|
package/dist/commands/init.js
CHANGED
|
@@ -2,30 +2,60 @@ import * as p from '@clack/prompts';
|
|
|
2
2
|
import fs from 'fs/promises';
|
|
3
3
|
import path from 'path';
|
|
4
4
|
import pc from 'picocolors';
|
|
5
|
-
import { ControlPlaneError,
|
|
5
|
+
import { ControlPlaneError, getBootstrapInfo } from '../api/control-plane.js';
|
|
6
6
|
import { FigmaApiError } from '../api/figma-api.js';
|
|
7
|
-
import {
|
|
7
|
+
import { tryGetCredential } from '../auth/oauth-flow.js';
|
|
8
8
|
import { getValidProjectToken, ProjectTokenError } from '../auth/project-token.js';
|
|
9
|
-
import {
|
|
9
|
+
import { getTokenStore } from '../auth/token-store.js';
|
|
10
|
+
import { getInfraEnvironment, getProjectNotFoundMessage } from '../constants.js';
|
|
11
|
+
import { downloadSkill } from '../lib/download-skill.js';
|
|
12
|
+
import { ensureGitignore } from '../utils/config.js';
|
|
13
|
+
import { addOrUpdateEnvVar } from '../utils/env-management.js';
|
|
10
14
|
import { isDebug } from '../utils/is-debug.js';
|
|
15
|
+
import { applyLambdaModifications } from '../utils/lambda-config.js';
|
|
11
16
|
import * as log from '../utils/log.js';
|
|
17
|
+
import { detectPackageManagerFromEnvironment, getRunCommand, resolvePackageManager } from '../utils/package-manager.js';
|
|
12
18
|
import { displayManualInstructions, ensurePayloadFigmaConfig } from '../utils/payload-config-modifier.js';
|
|
13
19
|
import { detectPayloadProject, hasRequiredDependencies, initializeGitRepo, installDependencies, isInProjectDirectory, scaffoldProject, validatePayloadVersion } from '../utils/project.js';
|
|
20
|
+
import { resolveEnvironment } from '../utils/resolve-environment.js';
|
|
21
|
+
import { checkForUpdates, getOwnVersion } from '../utils/version-check.js';
|
|
14
22
|
import { loginCommand } from './login.js';
|
|
23
|
+
import { cacheAllEnvironments } from '../utils/cache-bootstrap.js';
|
|
24
|
+
import { DEFAULT_TEMPLATE_SOURCE } from '../utils/download-template.js';
|
|
25
|
+
import { parseTemplateSpec, TemplateSpecParseError } from '../utils/parse-template-spec.js';
|
|
26
|
+
async function maybeInstallPayloadSkill(args) {
|
|
27
|
+
if (args.noSkill) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
const result = await downloadSkill({
|
|
31
|
+
projectDir: args.projectDir
|
|
32
|
+
});
|
|
33
|
+
if (result.ok) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
if (result.reason === 'already-installed') {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
p.log.warn(pc.yellow(`⚠ Could not install Payload skill (${result.reason}${result.detail ? `: ${result.detail}` : ''}). Continuing.`));
|
|
40
|
+
}
|
|
15
41
|
/**
|
|
16
|
-
* Generate and store project token for a
|
|
42
|
+
* Generate and store project token for a content system
|
|
17
43
|
* Non-blocking - will show warning but not exit on failure
|
|
18
44
|
* Only shows feedback if DEBUG mode is enabled, otherwise runs silently
|
|
19
45
|
*
|
|
20
46
|
* @param tokenStore - Token store instance
|
|
21
|
-
* @param
|
|
47
|
+
* @param contentSystemId - Content System ID to generate token for
|
|
22
48
|
* @param spinner - Clack spinner instance for status updates (only used in debug mode)
|
|
23
|
-
*/ async function generateProjectTokenWithFeedback(tokenStore,
|
|
49
|
+
*/ async function generateProjectTokenWithFeedback(tokenStore, contentSystemId, spinner, projectInfo) {
|
|
24
50
|
if (isDebug()) {
|
|
25
51
|
spinner.start('Generating project token...');
|
|
26
52
|
}
|
|
27
53
|
try {
|
|
28
|
-
const projectToken = await getValidProjectToken(
|
|
54
|
+
const projectToken = await getValidProjectToken({
|
|
55
|
+
projectInfo,
|
|
56
|
+
tenantId: contentSystemId,
|
|
57
|
+
tokenStore
|
|
58
|
+
});
|
|
29
59
|
if (isDebug()) {
|
|
30
60
|
if (projectToken) {
|
|
31
61
|
spinner.stop(pc.green('✓ Project token generated'));
|
|
@@ -58,108 +88,92 @@ import { loginCommand } from './login.js';
|
|
|
58
88
|
*
|
|
59
89
|
* @param options - Command options
|
|
60
90
|
*/ export async function initCommand(options) {
|
|
91
|
+
// Check for mismatched version (non-blocking)
|
|
92
|
+
const currentVersion = await getOwnVersion();
|
|
93
|
+
await checkForUpdates(currentVersion);
|
|
61
94
|
// Check authentication
|
|
62
|
-
const tokenStore =
|
|
95
|
+
const tokenStore = getTokenStore();
|
|
63
96
|
const s = p.spinner();
|
|
64
|
-
let accessToken;
|
|
65
97
|
if (options.skipAuth) {
|
|
66
98
|
// Skip authentication for testing/development
|
|
67
99
|
p.log.warn(pc.yellow('Skipping authentication (--skip-auth mode)'));
|
|
68
|
-
accessToken = 'mock-access-token';
|
|
69
100
|
} else {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
initialValue: true,
|
|
85
|
-
message: 'Would you like to authenticate now?'
|
|
86
|
-
});
|
|
87
|
-
if (p.isCancel(shouldAuth) || !shouldAuth) {
|
|
88
|
-
p.cancel('Operation cancelled');
|
|
89
|
-
process.exit(0);
|
|
90
|
-
}
|
|
91
|
-
// Run login command
|
|
92
|
-
await loginCommand();
|
|
93
|
-
// Get token after auth
|
|
94
|
-
const newToken = await getValidAccessToken(tokenStore);
|
|
95
|
-
if (!newToken) {
|
|
96
|
-
p.log.error('Authentication failed');
|
|
97
|
-
process.exit(1);
|
|
98
|
-
}
|
|
99
|
-
accessToken = newToken;
|
|
100
|
-
p.log.success(pc.green('✓ Authenticated'));
|
|
101
|
-
} else {
|
|
102
|
-
accessToken = token;
|
|
103
|
-
s.stop(pc.green('✓ Authenticated'));
|
|
101
|
+
// Check for valid cached tokens first (no API call needed)
|
|
102
|
+
if (!tokenStore.hasValidOauthToken()) {
|
|
103
|
+
// Need to refresh or authenticate - show spinner for API call
|
|
104
|
+
s.start('Checking authentication...');
|
|
105
|
+
const credential = await tryGetCredential(tokenStore);
|
|
106
|
+
if (!credential) {
|
|
107
|
+
s.stop('Authentication required to continue');
|
|
108
|
+
await loginCommand({
|
|
109
|
+
showNextSteps: false
|
|
110
|
+
});
|
|
111
|
+
const newCredential = await tryGetCredential(tokenStore);
|
|
112
|
+
if (!newCredential) {
|
|
113
|
+
p.log.error('Authentication failed');
|
|
114
|
+
process.exit(1);
|
|
104
115
|
}
|
|
116
|
+
} else {
|
|
117
|
+
s.stop(pc.green('✓ Authenticated'));
|
|
105
118
|
}
|
|
106
|
-
} catch (error) {
|
|
107
|
-
s.stop(pc.red('✗ Authentication failed'));
|
|
108
|
-
log.error(error instanceof Error ? error.message : 'Unknown error');
|
|
109
|
-
p.note('Run `figma auth` to authenticate', 'Tip');
|
|
110
|
-
process.exit(1);
|
|
111
119
|
}
|
|
112
120
|
}
|
|
113
121
|
// Note: We no longer check for figma.config.json here
|
|
114
122
|
// Instead, the AST detection will check if figma object already exists in payload.config.ts
|
|
115
123
|
// and skip modification if it does (unless --force is used)
|
|
116
|
-
// Step 3: Get CMS ID
|
|
124
|
+
// Step 3: Get CMS Resource ID (required argument)
|
|
117
125
|
log.debug('Configuring Project...');
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
validate: (value)=>{
|
|
127
|
-
if (!value || typeof value !== 'string') {
|
|
128
|
-
return 'CMS ID is required';
|
|
129
|
-
}
|
|
130
|
-
return undefined;
|
|
131
|
-
}
|
|
132
|
-
});
|
|
133
|
-
if (p.isCancel(input)) {
|
|
134
|
-
p.cancel('Operation cancelled');
|
|
135
|
-
process.exit(0);
|
|
136
|
-
}
|
|
137
|
-
tenantId = input;
|
|
138
|
-
}
|
|
139
|
-
// Try to fetch tenant details
|
|
126
|
+
if (!options.id) {
|
|
127
|
+
p.log.error('CMS Resource ID is required. Use --id <cms-resource-id>');
|
|
128
|
+
process.exit(1);
|
|
129
|
+
}
|
|
130
|
+
const cmsResourceId = options.id;
|
|
131
|
+
// Parse --template spec early so malformed values abort before any I/O
|
|
132
|
+
let templateSource;
|
|
133
|
+
if (options.template) {
|
|
140
134
|
try {
|
|
141
|
-
|
|
142
|
-
selectedTenant = await getTenantDetails(accessToken, tenantId);
|
|
143
|
-
log.debug(`Using: ${selectedTenant.domain}`);
|
|
135
|
+
templateSource = parseTemplateSpec(options.template);
|
|
144
136
|
} catch (error) {
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
137
|
+
const message = error instanceof TemplateSpecParseError ? error.message : 'Invalid --template value';
|
|
138
|
+
p.log.error(pc.red(`✗ ${message}`));
|
|
139
|
+
p.note('Format: [<owner>/<repo>#]<ref>:<template-path>\n' + 'Examples:\n' + ' blank\n' + ' main:website\n' + ' myorg/payload-fork#feat-x:templates/custom', 'Template spec');
|
|
140
|
+
process.exit(1);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
// Fetch bootstrap info (oauth creds + environments)
|
|
144
|
+
let bootstrapInfo = null;
|
|
145
|
+
let resolvedEnv = null;
|
|
146
|
+
let oauthClientId = null;
|
|
147
|
+
let oauthClientSecret = null;
|
|
148
|
+
if (!options.skipAuth) {
|
|
149
|
+
const credential = await tryGetCredential(tokenStore);
|
|
150
|
+
if (credential) {
|
|
151
|
+
try {
|
|
152
|
+
bootstrapInfo = await getBootstrapInfo(credential, cmsResourceId);
|
|
153
|
+
} catch (error) {
|
|
154
|
+
log.debug(`Control Plane Error: ${error.statusCode} - ${error.message}`);
|
|
155
|
+
if (error instanceof ControlPlaneError && (error.statusCode === 404 || error.statusCode === 410)) {
|
|
156
|
+
p.log.error(pc.red(getProjectNotFoundMessage({
|
|
157
|
+
environment: getInfraEnvironment(),
|
|
158
|
+
projectId: cmsResourceId
|
|
159
|
+
})));
|
|
160
|
+
process.exit(1);
|
|
161
|
+
}
|
|
162
|
+
const message = error instanceof Error ? error.message : 'Unknown error';
|
|
163
|
+
p.log.error(pc.red(`✗ Unable to fetch project info for "${cmsResourceId}"`));
|
|
164
|
+
p.log.error(pc.dim(`Details: ${message}`));
|
|
165
|
+
process.exit(1);
|
|
153
166
|
}
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
167
|
+
try {
|
|
168
|
+
const envName = options.env ?? process.env.FIGMA_ENVIRONMENT_NAME ?? undefined;
|
|
169
|
+
resolvedEnv = resolveEnvironment({
|
|
170
|
+
environmentName: envName,
|
|
171
|
+
environments: bootstrapInfo.environments
|
|
172
|
+
});
|
|
173
|
+
oauthClientId = bootstrapInfo.oauthCredentials.oauthClientId;
|
|
174
|
+
oauthClientSecret = bootstrapInfo.oauthCredentials.oauthClientSecret;
|
|
175
|
+
} catch (error) {
|
|
176
|
+
p.log.error(pc.red(error instanceof Error ? error.message : 'Unknown error'));
|
|
163
177
|
process.exit(1);
|
|
164
178
|
}
|
|
165
179
|
}
|
|
@@ -171,11 +185,12 @@ import { loginCommand } from './login.js';
|
|
|
171
185
|
log.debug('Project directory detected');
|
|
172
186
|
// Detect Payload
|
|
173
187
|
const projectInfo = await detectPayloadProject();
|
|
188
|
+
const packageManager = await resolvePackageManager(process.cwd());
|
|
174
189
|
if (projectInfo.hasPayload) {
|
|
175
190
|
// Validate existing Payload version
|
|
176
191
|
if (projectInfo.payloadVersion && !validatePayloadVersion(projectInfo.payloadVersion)) {
|
|
177
|
-
p.log.warn(pc.yellow(`Payload version ${projectInfo.payloadVersion} detected. Version
|
|
178
|
-
p.note('Upgrade to Payload
|
|
192
|
+
p.log.warn(pc.yellow(`Payload version ${projectInfo.payloadVersion} detected. Version 4.x or newer is required.`));
|
|
193
|
+
p.note('Upgrade to Payload 4.x or newer before continuing', 'Action Required');
|
|
179
194
|
process.exit(1);
|
|
180
195
|
}
|
|
181
196
|
p.log.success(pc.green(`✓ Payload ${projectInfo.payloadVersion || 'detected'}`));
|
|
@@ -190,19 +205,17 @@ import { loginCommand } from './login.js';
|
|
|
190
205
|
});
|
|
191
206
|
if (!p.isCancel(shouldInstall) && shouldInstall) {
|
|
192
207
|
s.start('Installing dependencies...');
|
|
193
|
-
await installDependencies(process.cwd(),
|
|
208
|
+
await installDependencies(process.cwd(), packageManager);
|
|
194
209
|
s.stop(pc.green('✓ Dependencies installed'));
|
|
195
210
|
}
|
|
196
211
|
}
|
|
197
212
|
s.start('Checking Payload configuration...');
|
|
198
|
-
const modResult = await ensurePayloadFigmaConfig(process.cwd(),
|
|
199
|
-
|
|
200
|
-
tenantId: selectedTenant.id,
|
|
201
|
-
useContentSystem: !options.noContentSystem
|
|
213
|
+
const modResult = await ensurePayloadFigmaConfig(process.cwd(), packageManager, {
|
|
214
|
+
contentSystemId: resolvedEnv?.contentSystemId ?? cmsResourceId
|
|
202
215
|
});
|
|
203
216
|
if (!modResult.success) {
|
|
204
217
|
s.stop(pc.red('✗ Configuration check failed'));
|
|
205
|
-
displayManualInstructions(modResult.error || 'Unknown error');
|
|
218
|
+
displayManualInstructions(modResult.error || 'Unknown error', packageManager);
|
|
206
219
|
process.exit(1);
|
|
207
220
|
}
|
|
208
221
|
if (modResult.modified) {
|
|
@@ -219,62 +232,93 @@ import { loginCommand } from './login.js';
|
|
|
219
232
|
p.log.warn(pc.yellow(`⚠ ${warning}`));
|
|
220
233
|
});
|
|
221
234
|
}
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
235
|
+
// Write environment variables to .env file
|
|
236
|
+
try {
|
|
237
|
+
await addOrUpdateEnvVar(process.cwd(), 'FIGMA_PROJECT_ID', cmsResourceId);
|
|
238
|
+
await addOrUpdateEnvVar(process.cwd(), 'FIGMA_ENVIRONMENT_NAME', resolvedEnv?.name ?? 'production');
|
|
239
|
+
log.debug('Added FIGMA_PROJECT_ID and FIGMA_ENVIRONMENT_NAME to .env file');
|
|
240
|
+
const infraEnv = getInfraEnvironment();
|
|
241
|
+
if (infraEnv !== 'production') {
|
|
242
|
+
await addOrUpdateEnvVar(process.cwd(), 'FIGMA_INFRA_ENV', infraEnv);
|
|
243
|
+
log.debug(`Added FIGMA_INFRA_ENV=${infraEnv} to .env file`);
|
|
244
|
+
}
|
|
245
|
+
// Cache all environments in local encrypted store
|
|
246
|
+
if (bootstrapInfo && oauthClientId && oauthClientSecret) {
|
|
247
|
+
cacheAllEnvironments(tokenStore, cmsResourceId, bootstrapInfo);
|
|
248
|
+
}
|
|
249
|
+
} catch (error) {
|
|
250
|
+
p.log.warn(pc.yellow(`⚠ Failed to update .env file: ${error instanceof Error ? error.message : 'Unknown error'}`));
|
|
236
251
|
}
|
|
237
|
-
|
|
238
|
-
p.log.
|
|
239
|
-
p.note('
|
|
252
|
+
} else {
|
|
253
|
+
p.log.warn(pc.yellow('⚠ Payload was not detected in this project'));
|
|
254
|
+
p.note('Run this command in a directory without an existing project or in an existing Payload project.', 'Action Required');
|
|
240
255
|
process.exit(1);
|
|
241
256
|
}
|
|
257
|
+
// npm leaves node_modules in a transient state after a sequence of
|
|
258
|
+
// add/remove calls; a final install reconciles it so the project is
|
|
259
|
+
// immediately buildable.
|
|
260
|
+
s.start('Reconciling dependencies...');
|
|
261
|
+
try {
|
|
262
|
+
await installDependencies(process.cwd(), packageManager);
|
|
263
|
+
s.stop(pc.green('✓ Dependencies reconciled'));
|
|
264
|
+
} catch (error) {
|
|
265
|
+
s.stop(pc.red('✗ Failed to reconcile dependencies'));
|
|
266
|
+
log.error(error instanceof Error ? error.message : 'Unknown error');
|
|
267
|
+
process.exit(1);
|
|
268
|
+
}
|
|
269
|
+
// Apply Lambda modifications (run.sh, standalone output, lambda:buildzip script)
|
|
270
|
+
await applyLambdaModifications(process.cwd(), packageManager);
|
|
271
|
+
// Ensure .gitignore has required entries
|
|
272
|
+
await ensureGitignore(process.cwd(), [
|
|
273
|
+
'.env',
|
|
274
|
+
'.env.local',
|
|
275
|
+
'lambda.zip'
|
|
276
|
+
]);
|
|
277
|
+
await maybeInstallPayloadSkill({
|
|
278
|
+
noSkill: options.noSkill,
|
|
279
|
+
projectDir: process.cwd()
|
|
280
|
+
});
|
|
242
281
|
// Generate project token (unless skipping auth)
|
|
243
|
-
if (!options.skipAuth) {
|
|
244
|
-
await generateProjectTokenWithFeedback(tokenStore,
|
|
282
|
+
if (!options.skipAuth && resolvedEnv) {
|
|
283
|
+
await generateProjectTokenWithFeedback(tokenStore, resolvedEnv.contentSystemId, s, {
|
|
284
|
+
environmentName: resolvedEnv.name,
|
|
285
|
+
projectId: cmsResourceId
|
|
286
|
+
});
|
|
245
287
|
}
|
|
246
288
|
// Success message for existing project
|
|
247
289
|
p.outro(pc.green('✓ Project initialized successfully!'));
|
|
248
290
|
const nextSteps = [
|
|
249
|
-
|
|
250
|
-
'Start development server: `pnpm dev`',
|
|
251
|
-
`Access your CMS at: ${pc.cyan(`https://${selectedTenant.domain}`)}`
|
|
291
|
+
`Start development server: \`${getRunCommand(packageManager)} dev\``
|
|
252
292
|
].filter(Boolean);
|
|
253
293
|
p.note(nextSteps.join('\n'), 'Next Steps');
|
|
254
294
|
} else {
|
|
255
295
|
// ===== NEW PROJECT FLOW =====
|
|
256
296
|
// p.log.info('No project detected - Creating New Project')
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
297
|
+
let projectPath;
|
|
298
|
+
if (options.name) {
|
|
299
|
+
projectPath = options.name;
|
|
300
|
+
} else {
|
|
301
|
+
const projectPathInput = await p.text({
|
|
302
|
+
initialValue: './',
|
|
303
|
+
message: 'Enter path to create project:',
|
|
304
|
+
placeholder: './my-cms-project',
|
|
305
|
+
validate: (value)=>{
|
|
306
|
+
if (!value) {
|
|
307
|
+
return 'Path is required';
|
|
308
|
+
}
|
|
309
|
+
// Allow relative or absolute paths
|
|
310
|
+
return undefined;
|
|
265
311
|
}
|
|
266
|
-
|
|
267
|
-
|
|
312
|
+
});
|
|
313
|
+
if (p.isCancel(projectPathInput)) {
|
|
314
|
+
p.cancel('Operation cancelled');
|
|
315
|
+
process.exit(0);
|
|
268
316
|
}
|
|
269
|
-
|
|
270
|
-
if (p.isCancel(projectPathInput)) {
|
|
271
|
-
p.cancel('Operation cancelled');
|
|
272
|
-
process.exit(0);
|
|
317
|
+
projectPath = projectPathInput;
|
|
273
318
|
}
|
|
274
|
-
const projectPath = projectPathInput;
|
|
275
319
|
const fullPath = path.resolve(process.cwd(), projectPath);
|
|
276
|
-
|
|
277
|
-
const
|
|
320
|
+
const projectName = path.basename(fullPath);
|
|
321
|
+
const packageManager = detectPackageManagerFromEnvironment();
|
|
278
322
|
// Create directory
|
|
279
323
|
try {
|
|
280
324
|
await fs.mkdir(fullPath, {
|
|
@@ -285,12 +329,16 @@ import { loginCommand } from './login.js';
|
|
|
285
329
|
process.exit(1);
|
|
286
330
|
}
|
|
287
331
|
// Scaffold project
|
|
288
|
-
|
|
332
|
+
const resolvedSource = {
|
|
333
|
+
...DEFAULT_TEMPLATE_SOURCE,
|
|
334
|
+
...templateSource
|
|
335
|
+
};
|
|
336
|
+
s.start(`Downloading template "${resolvedSource.templatePath}" from ` + `${resolvedSource.owner}/${resolvedSource.repo}@${resolvedSource.ref}...`);
|
|
289
337
|
try {
|
|
290
|
-
await scaffoldProject(fullPath, projectName);
|
|
338
|
+
await scaffoldProject(fullPath, projectName, packageManager, templateSource, options.payloadVersion);
|
|
291
339
|
s.stop(pc.green('✓ Template downloaded'));
|
|
292
340
|
s.start('Installing dependencies...');
|
|
293
|
-
await installDependencies(fullPath,
|
|
341
|
+
await installDependencies(fullPath, packageManager);
|
|
294
342
|
s.stop(pc.green('✓ Dependencies installed'));
|
|
295
343
|
} catch (error) {
|
|
296
344
|
s.stop(pc.red('✗ Failed'));
|
|
@@ -299,14 +347,12 @@ import { loginCommand } from './login.js';
|
|
|
299
347
|
}
|
|
300
348
|
// Modify Payload configuration
|
|
301
349
|
s.start('Checking Payload configuration...');
|
|
302
|
-
const modResult = await ensurePayloadFigmaConfig(fullPath,
|
|
303
|
-
|
|
304
|
-
tenantId: selectedTenant.id,
|
|
305
|
-
useContentSystem: !options.noContentSystem
|
|
350
|
+
const modResult = await ensurePayloadFigmaConfig(fullPath, packageManager, {
|
|
351
|
+
contentSystemId: resolvedEnv?.contentSystemId ?? cmsResourceId
|
|
306
352
|
});
|
|
307
353
|
if (!modResult.success) {
|
|
308
354
|
s.stop(pc.red('✗ Configuration check failed'));
|
|
309
|
-
displayManualInstructions(modResult.error || 'Unknown error');
|
|
355
|
+
displayManualInstructions(modResult.error || 'Unknown error', packageManager);
|
|
310
356
|
process.exit(1);
|
|
311
357
|
}
|
|
312
358
|
if (modResult.modified) {
|
|
@@ -323,9 +369,45 @@ import { loginCommand } from './login.js';
|
|
|
323
369
|
p.log.warn(pc.yellow(`⚠ ${warning}`));
|
|
324
370
|
});
|
|
325
371
|
}
|
|
372
|
+
// Write environment variables to .env file
|
|
373
|
+
try {
|
|
374
|
+
await addOrUpdateEnvVar(fullPath, 'FIGMA_PROJECT_ID', cmsResourceId);
|
|
375
|
+
await addOrUpdateEnvVar(fullPath, 'FIGMA_ENVIRONMENT_NAME', resolvedEnv?.name ?? 'production');
|
|
376
|
+
log.debug('Added FIGMA_PROJECT_ID and FIGMA_ENVIRONMENT_NAME to .env file');
|
|
377
|
+
const infraEnv = getInfraEnvironment();
|
|
378
|
+
if (infraEnv !== 'production') {
|
|
379
|
+
await addOrUpdateEnvVar(fullPath, 'FIGMA_INFRA_ENV', infraEnv);
|
|
380
|
+
log.debug(`Added FIGMA_INFRA_ENV=${infraEnv} to .env file`);
|
|
381
|
+
}
|
|
382
|
+
// Cache all environments in local encrypted store
|
|
383
|
+
if (bootstrapInfo && oauthClientId && oauthClientSecret) {
|
|
384
|
+
cacheAllEnvironments(tokenStore, cmsResourceId, bootstrapInfo);
|
|
385
|
+
}
|
|
386
|
+
} catch (error) {
|
|
387
|
+
p.log.warn(pc.yellow(`⚠ Failed to update .env file: ${error instanceof Error ? error.message : 'Unknown error'}`));
|
|
388
|
+
}
|
|
389
|
+
// npm leaves node_modules in a transient state after a sequence of
|
|
390
|
+
// add/remove calls; a final install reconciles it so the project is
|
|
391
|
+
// immediately buildable.
|
|
392
|
+
s.start('Reconciling dependencies...');
|
|
393
|
+
try {
|
|
394
|
+
await installDependencies(fullPath, packageManager);
|
|
395
|
+
s.stop(pc.green('✓ Dependencies reconciled'));
|
|
396
|
+
} catch (error) {
|
|
397
|
+
s.stop(pc.red('✗ Failed to reconcile dependencies'));
|
|
398
|
+
log.error(error instanceof Error ? error.message : 'Unknown error');
|
|
399
|
+
process.exit(1);
|
|
400
|
+
}
|
|
401
|
+
await maybeInstallPayloadSkill({
|
|
402
|
+
noSkill: options.noSkill,
|
|
403
|
+
projectDir: fullPath
|
|
404
|
+
});
|
|
326
405
|
// Generate project token (unless skipping auth)
|
|
327
|
-
if (!options.skipAuth) {
|
|
328
|
-
await generateProjectTokenWithFeedback(tokenStore,
|
|
406
|
+
if (!options.skipAuth && resolvedEnv) {
|
|
407
|
+
await generateProjectTokenWithFeedback(tokenStore, resolvedEnv.contentSystemId, s, {
|
|
408
|
+
environmentName: resolvedEnv.name,
|
|
409
|
+
projectId: cmsResourceId
|
|
410
|
+
});
|
|
329
411
|
}
|
|
330
412
|
// Initialize git repository (after all files including lock file are ready)
|
|
331
413
|
initializeGitRepo(fullPath);
|
|
@@ -337,10 +419,8 @@ import { loginCommand } from './login.js';
|
|
|
337
419
|
if (relativePath && relativePath !== '.') {
|
|
338
420
|
nextSteps.push(`cd ${relativePath}`);
|
|
339
421
|
}
|
|
340
|
-
nextSteps.push(
|
|
422
|
+
nextSteps.push(`${getRunCommand(packageManager)} dev or follow directions in README.md`, '', 'Documentation:', '- Getting Started: https://payloadcms.com/docs/getting-started/what-is-payload', '- Configuration: https://payloadcms.com/docs/configuration/overview');
|
|
341
423
|
p.note(nextSteps.join('\n'), 'Next Steps');
|
|
342
424
|
p.outro(pc.green('✓ Done'));
|
|
343
425
|
}
|
|
344
426
|
}
|
|
345
|
-
|
|
346
|
-
//# sourceMappingURL=init.js.map
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
* Options for list-tokens command
|
|
3
3
|
*/
|
|
4
4
|
export interface ListTokensCommandOptions {
|
|
5
|
+
/** Show all environments */
|
|
6
|
+
all?: boolean;
|
|
5
7
|
/** Enable debug mode */
|
|
6
8
|
debug?: boolean;
|
|
7
9
|
}
|
|
@@ -9,8 +11,5 @@ export interface ListTokensCommandOptions {
|
|
|
9
11
|
* Handle the `@payloadcms/figma list-tokens` command
|
|
10
12
|
*
|
|
11
13
|
* Displays stored token information including OAuth and project tokens.
|
|
12
|
-
*
|
|
13
|
-
* @param _options - Command options (unused)
|
|
14
14
|
*/
|
|
15
|
-
export declare function listTokensCommand(
|
|
16
|
-
//# sourceMappingURL=list-tokens.d.ts.map
|
|
15
|
+
export declare function listTokensCommand(options?: ListTokensCommandOptions): void;
|
|
@@ -1,25 +1,40 @@
|
|
|
1
1
|
import * as p from '@clack/prompts';
|
|
2
2
|
import pc from 'picocolors';
|
|
3
|
-
import {
|
|
3
|
+
import { getTokenStore } from '../auth/token-store.js';
|
|
4
|
+
import { getInfraEnvironment } from '../constants.js';
|
|
5
|
+
import { formatEnvSuffix } from '../utils/format-env-suffix.js';
|
|
4
6
|
import { isDebug } from '../utils/is-debug.js';
|
|
5
7
|
import { formatTimestamp, maskToken, showProjectTokens } from '../utils/token-display.js';
|
|
8
|
+
const ALL_ENVIRONMENTS = [
|
|
9
|
+
'production',
|
|
10
|
+
'staging'
|
|
11
|
+
];
|
|
6
12
|
/**
|
|
7
13
|
* Handle the `@payloadcms/figma list-tokens` command
|
|
8
14
|
*
|
|
9
15
|
* Displays stored token information including OAuth and project tokens.
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
16
|
+
*/ export function listTokensCommand(options = {}) {
|
|
17
|
+
if (options.all) {
|
|
18
|
+
// Show detailed info for all environments
|
|
19
|
+
for (const env of ALL_ENVIRONMENTS){
|
|
20
|
+
showTokenDetails(env);
|
|
21
|
+
}
|
|
22
|
+
} else {
|
|
23
|
+
// Show detailed info for current environment only
|
|
24
|
+
showTokenDetails(getInfraEnvironment());
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
function showTokenDetails(env) {
|
|
28
|
+
const tokenStore = getTokenStore(env);
|
|
29
|
+
const tokens = tokenStore.getOauthInfo();
|
|
15
30
|
if (!tokens) {
|
|
16
|
-
p.log.warn(pc.yellow(
|
|
31
|
+
p.log.warn(pc.yellow(`No tokens found${formatEnvSuffix(env, ' for ')}. Not authenticated.`));
|
|
17
32
|
p.note(`Run ${pc.cyan('@payloadcms/figma login')} to authenticate`, 'Tip');
|
|
18
33
|
return;
|
|
19
34
|
}
|
|
20
|
-
const isValid = tokenStore.
|
|
35
|
+
const isValid = tokenStore.hasValidOauthToken();
|
|
21
36
|
const status = isValid ? pc.green('✓ Valid') : pc.red('✗ Expired');
|
|
22
|
-
p.log.step(pc.bold('
|
|
37
|
+
p.log.step(pc.bold(`Token Status${formatEnvSuffix(env, ' (', ')')}`));
|
|
23
38
|
// Build OAuth token info display
|
|
24
39
|
const lines = [
|
|
25
40
|
`Status: ${status}`,
|
|
@@ -41,5 +56,3 @@ import { formatTimestamp, maskToken, showProjectTokens } from '../utils/token-di
|
|
|
41
56
|
// Show project tokens if any exist
|
|
42
57
|
showProjectTokens(tokenStore);
|
|
43
58
|
}
|
|
44
|
-
|
|
45
|
-
//# sourceMappingURL=list-tokens.js.map
|
package/dist/commands/login.d.ts
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
|
+
type LoginArgs = {
|
|
2
|
+
/** Set this to show next steps after login
|
|
3
|
+
* @default true
|
|
4
|
+
*/
|
|
5
|
+
showNextSteps: boolean;
|
|
6
|
+
};
|
|
1
7
|
/**
|
|
2
8
|
* Handle the `@payloadcms/figma login` command
|
|
3
9
|
*
|
|
4
10
|
* Authenticates the user with Figma OAuth2 and stores tokens locally.
|
|
5
11
|
* If valid tokens already exist, shows an error message.
|
|
6
12
|
*/
|
|
7
|
-
export declare function loginCommand(): Promise<void>;
|
|
8
|
-
|
|
13
|
+
export declare function loginCommand(args?: LoginArgs): Promise<void>;
|
|
14
|
+
export {};
|