@payloadcms/figma 0.1.0-alpha.1 → 0.1.0-alpha.11
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/LICENSE.md +1 -1
- package/dist/{utils → adapters}/asset-collection.d.ts +17 -3
- package/dist/adapters/asset-collection.js +242 -0
- package/dist/{utils → adapters}/build-lambda-zip.d.ts +8 -7
- package/dist/adapters/build-lambda-zip.js +111 -0
- package/dist/adapters/configureNextjsCache.d.ts +8 -0
- package/dist/adapters/configureNextjsCache.js +55 -0
- package/dist/adapters/deploy-output/inspectNextjsOutput/getNextRelativeAppDir.d.ts +1 -0
- package/dist/adapters/deploy-output/inspectNextjsOutput/getNextRelativeAppDir.js +15 -0
- package/dist/adapters/deploy-output/inspectNextjsOutput.d.ts +12 -0
- package/dist/adapters/deploy-output/inspectNextjsOutput.js +28 -0
- package/dist/adapters/deploy-output/inspectNitroOutput.d.ts +9 -0
- package/dist/adapters/deploy-output/inspectNitroOutput.js +13 -0
- package/dist/adapters/deploy-output/isFile.d.ts +1 -0
- package/dist/adapters/deploy-output/isFile.js +4 -0
- package/dist/adapters/deploy-output/readJson.d.ts +1 -0
- package/dist/adapters/deploy-output/readJson.js +9 -0
- package/dist/adapters/deploy-output/resolveNitroOutputLayout.d.ts +8 -0
- package/dist/adapters/deploy-output/resolveNitroOutputLayout.js +16 -0
- package/dist/adapters/deploy-output/resolveOutputPath.d.ts +2 -0
- package/dist/adapters/deploy-output/resolveOutputPath.js +9 -0
- package/dist/adapters/deploy-output/resolveWithin.d.ts +1 -0
- package/dist/adapters/deploy-output/resolveWithin.js +12 -0
- package/dist/adapters/fs-utils.d.ts +39 -0
- package/dist/adapters/fs-utils.js +135 -0
- package/dist/adapters/index.d.ts +4 -0
- package/dist/adapters/index.js +3 -0
- package/dist/adapters/lambda-runtime/nextjs-cache.d.ts +40 -0
- package/dist/adapters/lambda-runtime/nextjs-cache.js +174 -0
- package/dist/adapters/nextjs.d.ts +12 -0
- package/dist/adapters/nextjs.js +67 -0
- package/dist/adapters/nitro.d.ts +8 -0
- package/dist/adapters/nitro.js +193 -0
- package/dist/adapters/secret-files.d.ts +25 -0
- package/dist/adapters/secret-files.js +50 -0
- package/dist/adapters/types.d.ts +42 -0
- package/dist/adapters/types.js +1 -0
- package/dist/{utils/adapters → adapters}/vite.d.ts +2 -2
- package/dist/adapters/vite.js +33 -0
- package/dist/api/check-project-subdomain-availability.d.ts +12 -0
- package/dist/api/check-project-subdomain-availability.js +32 -0
- package/dist/api/control-plane-error.d.ts +6 -0
- package/dist/api/control-plane-error.js +8 -0
- package/dist/api/control-plane-fetch.d.ts +7 -0
- package/dist/api/control-plane-fetch.js +37 -0
- package/dist/api/control-plane.d.ts +10 -9
- package/dist/api/control-plane.js +27 -48
- package/dist/api/create-project.d.ts +18 -0
- package/dist/api/create-project.js +37 -0
- package/dist/api/list-project-workspaces.d.ts +8 -0
- package/dist/api/list-project-workspaces.js +28 -0
- package/dist/api/project-resource-type.d.ts +1 -0
- package/dist/api/project-resource-type.js +1 -0
- package/dist/auth/headless-oauth-flow.d.ts +23 -0
- package/dist/auth/headless-oauth-flow.js +69 -0
- package/dist/auth/oauth-flow.d.ts +2 -0
- package/dist/auth/oauth-flow.js +13 -8
- package/dist/auth/token-store.d.ts +20 -1
- package/dist/auth/token-store.js +47 -0
- package/dist/auth/types.d.ts +12 -0
- package/dist/cli.d.ts +39 -0
- package/dist/cli.js +71 -36
- package/dist/commands/bootstrap.js +2 -1
- package/dist/commands/build-lambda-zip.js +1 -1
- package/dist/commands/deploy.d.ts +12 -0
- package/dist/commands/deploy.js +63 -25
- package/dist/commands/detect-project-resource-type.d.ts +3 -0
- package/dist/commands/detect-project-resource-type.js +28 -0
- package/dist/commands/init.d.ts +2 -2
- package/dist/commands/init.js +235 -80
- package/dist/commands/login.d.ts +11 -1
- package/dist/commands/login.js +66 -4
- package/dist/commands/prompt-to-create-project/format-project-subdomain.d.ts +1 -0
- package/dist/commands/prompt-to-create-project/format-project-subdomain.js +3 -0
- package/dist/commands/prompt-to-create-project/format-unavailable-subdomain-reason.d.ts +1 -0
- package/dist/commands/prompt-to-create-project/format-unavailable-subdomain-reason.js +7 -0
- package/dist/commands/prompt-to-create-project/get-default-project-name.d.ts +1 -0
- package/dist/commands/prompt-to-create-project/get-default-project-name.js +13 -0
- package/dist/commands/prompt-to-create-project/prompt-for-available-subdomain.d.ts +7 -0
- package/dist/commands/prompt-to-create-project/prompt-for-available-subdomain.js +32 -0
- package/dist/commands/prompt-to-create-project/resolve-project-region.d.ts +8 -0
- package/dist/commands/prompt-to-create-project/resolve-project-region.js +27 -0
- package/dist/commands/prompt-to-create-project/resolve-project-subdomain.d.ts +9 -0
- package/dist/commands/prompt-to-create-project/resolve-project-subdomain.js +54 -0
- package/dist/commands/prompt-to-create-project/resolve-text-input.d.ts +9 -0
- package/dist/commands/prompt-to-create-project/resolve-text-input.js +23 -0
- package/dist/commands/prompt-to-create-project/resolve-workspace-plan-key.d.ts +12 -0
- package/dist/commands/prompt-to-create-project/resolve-workspace-plan-key.js +36 -0
- package/dist/commands/prompt-to-create-project/validate-subdomain.d.ts +1 -0
- package/dist/commands/prompt-to-create-project/validate-subdomain.js +9 -0
- package/dist/commands/prompt-to-create-project.d.ts +24 -0
- package/dist/commands/prompt-to-create-project.js +69 -0
- package/dist/commands/setup-agent.d.ts +12 -0
- package/dist/commands/setup-agent.js +123 -0
- package/dist/commands/upgrade.js +65 -1
- package/dist/commands/write-project-configuration.d.ts +12 -0
- package/dist/commands/write-project-configuration.js +16 -0
- package/dist/db-content-api/generated/content-api-types.d.ts +6 -2
- package/dist/db-content-api/index.d.ts +1 -1
- package/dist/db-content-api/index.js +121 -72
- package/dist/db-content-api/utilities/data/index.js +8 -2
- package/dist/db-content-api/utilities/data/injectGlobalType.d.ts +6 -0
- package/dist/db-content-api/utilities/data/injectGlobalType.js +11 -0
- package/dist/db-content-api/utilities/data/removeVirtualFields.d.ts +3 -11
- package/dist/db-content-api/utilities/data/removeVirtualFields.js +12 -50
- package/dist/db-content-api/utilities/isRecord.d.ts +9 -0
- package/dist/db-content-api/utilities/isRecord.js +19 -0
- package/dist/db-content-api/utilities/joins.js +5 -1
- package/dist/db-content-api/utilities/meta/resolvesToRelationshipValue.d.ts +10 -0
- package/dist/db-content-api/utilities/meta/resolvesToRelationshipValue.js +95 -0
- package/dist/db-content-api/utilities/meta/stringifyIdsInWhere.d.ts +9 -0
- package/dist/db-content-api/utilities/meta/stringifyIdsInWhere.js +112 -0
- package/dist/db-content-api/utilities/schema/buildDocumentSchema.js +9 -4
- package/dist/db-content-api/utilities/schema/getDocumentSchema.d.ts +3 -0
- package/dist/db-content-api/utilities/schema/getDocumentSchema.js +24 -0
- package/dist/db-content-api/utilities/where.d.ts +2 -6
- package/dist/db-content-api/utilities/where.js +20 -9
- package/dist/exports/client.d.ts +2 -0
- package/dist/exports/client.js +2 -0
- package/dist/exports/views.d.ts +1 -0
- package/dist/exports/views.js +1 -0
- package/dist/imageSizeOptions.d.ts +23 -0
- package/dist/imageSizeOptions.js +26 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/lib/write-agent-config.d.ts +12 -0
- package/dist/lib/write-agent-config.js +52 -0
- package/dist/next/image-loader.d.ts +6 -0
- package/dist/next/image-loader.js +14 -0
- package/dist/oauth/components/LoginButton/index.js +66 -19
- package/dist/oauth/components/LoginButton/index.scss +121 -15
- package/dist/oauth/defaults.js +4 -1
- package/dist/oauth/endpoints/getLoginEndpoint.js +5 -2
- package/dist/oauth/index.js +8 -7
- package/dist/oauth/utilities/getAdminCollectionSlug.d.ts +1 -1
- package/dist/oauth/utilities/getAuthorizeURL.d.ts +1 -0
- package/dist/oauth/utilities/getAuthorizeURL.js +5 -1
- package/dist/plugin/build-config.d.ts +13 -3
- package/dist/plugin/build-config.js +181 -36
- package/dist/plugin/cache-revalidation-hooks.d.ts +6 -0
- package/dist/plugin/cache-revalidation-hooks.js +69 -0
- package/dist/plugin/cloud-limits/CloudLimitModal/index.d.ts +9 -0
- package/dist/plugin/cloud-limits/CloudLimitModal/index.js +66 -0
- package/dist/plugin/cloud-limits/CloudLimitModal/index.scss +56 -0
- package/dist/plugin/cloud-limits/CloudLimitProvider/index.d.ts +4 -0
- package/dist/plugin/cloud-limits/CloudLimitProvider/index.js +110 -0
- package/dist/plugin/cloud-limits/LimitReachedView/index.css +14 -0
- package/dist/plugin/cloud-limits/LimitReachedView/index.d.ts +4 -0
- package/dist/plugin/cloud-limits/LimitReachedView/index.js +52 -0
- package/dist/plugin/cloud-limits/SlugRegistryContext/index.d.ts +7 -0
- package/dist/plugin/cloud-limits/SlugRegistryContext/index.js +3 -0
- package/dist/plugin/cloud-limits/SlugTracker/index.d.ts +1 -0
- package/dist/plugin/cloud-limits/SlugTracker/index.js +27 -0
- package/dist/plugin/cloud-limits/icons/ExternalLinkIcon.d.ts +3 -0
- package/dist/plugin/cloud-limits/icons/ExternalLinkIcon.js +30 -0
- package/dist/plugin/cloud-limits/routes.d.ts +2 -0
- package/dist/plugin/cloud-limits/routes.js +4 -0
- package/dist/plugin/cloud-limits/server/redirectInitialAutosaveCreate.d.ts +9 -0
- package/dist/plugin/cloud-limits/server/redirectInitialAutosaveCreate.js +28 -0
- package/dist/plugin/cloud-limits/shared.d.ts +10 -0
- package/dist/plugin/cloud-limits/shared.js +52 -0
- package/dist/plugin/cloud-limits/utilities/cloudLimitInterceptor.d.ts +2 -0
- package/dist/plugin/cloud-limits/utilities/cloudLimitInterceptor.js +134 -0
- package/dist/plugin/cloud-limits/utilities/toasts.d.ts +4 -0
- package/dist/plugin/cloud-limits/utilities/toasts.js +19 -0
- package/dist/plugin/make-permission-access/make-permission-access.d.ts +8 -0
- package/dist/plugin/make-permission-access/make-permission-access.js +24 -0
- package/dist/plugin/sandbox-upload-fetch.d.ts +32 -0
- package/dist/plugin/sandbox-upload-fetch.js +53 -0
- package/dist/skills/deploy-to-figma/SKILL.md +234 -0
- package/dist/skills/deploy-to-figma/references/cli-reference.md +146 -0
- package/dist/storage-content-api/api-types.d.ts +3 -0
- package/dist/storage-content-api/buildBaseMediaResponseHeaders.d.ts +1 -0
- package/dist/storage-content-api/buildBaseMediaResponseHeaders.js +8 -0
- package/dist/storage-content-api/buildClientUploadFetchBackHeaders.d.ts +12 -0
- package/dist/storage-content-api/buildClientUploadFetchBackHeaders.js +26 -0
- package/dist/storage-content-api/buildMediaRequestHeaders.d.ts +1 -0
- package/dist/storage-content-api/buildMediaRequestHeaders.js +14 -0
- package/dist/storage-content-api/buildMediaResponseHeaders.d.ts +4 -0
- package/dist/storage-content-api/buildMediaResponseHeaders.js +52 -0
- package/dist/storage-content-api/client-uploads/generate.js +2 -1
- package/dist/storage-content-api/getDownloadResponseHeaderPolicy.d.ts +11 -0
- package/dist/storage-content-api/getDownloadResponseHeaderPolicy.js +33 -0
- package/dist/storage-content-api/getMediaType.d.ts +1 -0
- package/dist/storage-content-api/getMediaType.js +3 -0
- package/dist/storage-content-api/hasSupportedContentEncoding.d.ts +1 -0
- package/dist/storage-content-api/hasSupportedContentEncoding.js +6 -0
- package/dist/storage-content-api/index.js +1 -0
- package/dist/storage-content-api/mediaErrorResponse.d.ts +1 -0
- package/dist/storage-content-api/mediaErrorResponse.js +12 -0
- package/dist/storage-content-api/resolveDownloadResponseHeaders.d.ts +5 -0
- package/dist/storage-content-api/resolveDownloadResponseHeaders.js +13 -0
- package/dist/storage-content-api/shouldAttachMedia.d.ts +1 -0
- package/dist/storage-content-api/shouldAttachMedia.js +34 -0
- package/dist/storage-content-api/staticHandler.js +93 -25
- package/dist/storage-content-api/types.d.ts +4 -1
- package/dist/translations/ar.d.ts +12 -0
- package/dist/translations/ar.js +12 -0
- package/dist/translations/az.d.ts +12 -0
- package/dist/translations/az.js +12 -0
- package/dist/translations/bg.d.ts +12 -0
- package/dist/translations/bg.js +12 -0
- package/dist/translations/bnBd.d.ts +12 -0
- package/dist/translations/bnBd.js +12 -0
- package/dist/translations/bnIn.d.ts +12 -0
- package/dist/translations/bnIn.js +12 -0
- package/dist/translations/ca.d.ts +12 -0
- package/dist/translations/ca.js +12 -0
- package/dist/translations/cs.d.ts +12 -0
- package/dist/translations/cs.js +12 -0
- package/dist/translations/da.d.ts +12 -0
- package/dist/translations/da.js +12 -0
- package/dist/translations/de.d.ts +12 -0
- package/dist/translations/de.js +12 -0
- package/dist/translations/en.d.ts +12 -0
- package/dist/translations/en.js +12 -0
- package/dist/translations/es.d.ts +12 -0
- package/dist/translations/es.js +12 -0
- package/dist/translations/et.d.ts +12 -0
- package/dist/translations/et.js +12 -0
- package/dist/translations/fa.d.ts +12 -0
- package/dist/translations/fa.js +12 -0
- package/dist/translations/fr.d.ts +12 -0
- package/dist/translations/fr.js +12 -0
- package/dist/translations/he.d.ts +12 -0
- package/dist/translations/he.js +12 -0
- package/dist/translations/hr.d.ts +12 -0
- package/dist/translations/hr.js +12 -0
- package/dist/translations/hu.d.ts +12 -0
- package/dist/translations/hu.js +12 -0
- package/dist/translations/hy.d.ts +12 -0
- package/dist/translations/hy.js +12 -0
- package/dist/translations/id.d.ts +12 -0
- package/dist/translations/id.js +12 -0
- package/dist/translations/index.d.ts +533 -0
- package/dist/translations/index.js +90 -0
- package/dist/translations/is.d.ts +12 -0
- package/dist/translations/is.js +12 -0
- package/dist/translations/it.d.ts +12 -0
- package/dist/translations/it.js +12 -0
- package/dist/translations/ja.d.ts +12 -0
- package/dist/translations/ja.js +12 -0
- package/dist/translations/ko.d.ts +12 -0
- package/dist/translations/ko.js +12 -0
- package/dist/translations/lt.d.ts +12 -0
- package/dist/translations/lt.js +12 -0
- package/dist/translations/lv.d.ts +12 -0
- package/dist/translations/lv.js +12 -0
- package/dist/translations/my.d.ts +12 -0
- package/dist/translations/my.js +12 -0
- package/dist/translations/nb.d.ts +12 -0
- package/dist/translations/nb.js +12 -0
- package/dist/translations/nl.d.ts +12 -0
- package/dist/translations/nl.js +12 -0
- package/dist/translations/pl.d.ts +12 -0
- package/dist/translations/pl.js +12 -0
- package/dist/translations/pt.d.ts +12 -0
- package/dist/translations/pt.js +12 -0
- package/dist/translations/ro.d.ts +12 -0
- package/dist/translations/ro.js +12 -0
- package/dist/translations/rs.d.ts +12 -0
- package/dist/translations/rs.js +12 -0
- package/dist/translations/rsLatin.d.ts +12 -0
- package/dist/translations/rsLatin.js +12 -0
- package/dist/translations/ru.d.ts +12 -0
- package/dist/translations/ru.js +12 -0
- package/dist/translations/sk.d.ts +12 -0
- package/dist/translations/sk.js +12 -0
- package/dist/translations/sl.d.ts +12 -0
- package/dist/translations/sl.js +12 -0
- package/dist/translations/sv.d.ts +12 -0
- package/dist/translations/sv.js +12 -0
- package/dist/translations/ta.d.ts +12 -0
- package/dist/translations/ta.js +12 -0
- package/dist/translations/th.d.ts +12 -0
- package/dist/translations/th.js +12 -0
- package/dist/translations/tr.d.ts +12 -0
- package/dist/translations/tr.js +12 -0
- package/dist/translations/uk.d.ts +12 -0
- package/dist/translations/uk.js +12 -0
- package/dist/translations/vi.d.ts +12 -0
- package/dist/translations/vi.js +12 -0
- package/dist/translations/zh.d.ts +12 -0
- package/dist/translations/zh.js +12 -0
- package/dist/translations/zhTw.d.ts +12 -0
- package/dist/translations/zhTw.js +12 -0
- package/dist/types.d.ts +11 -0
- package/dist/utils/assert-never.d.ts +1 -0
- package/dist/utils/assert-never.js +3 -0
- package/dist/utils/build-detection.d.ts +6 -1
- package/dist/utils/build-detection.js +68 -89
- package/dist/utils/deploy-adapter.d.ts +3 -35
- package/dist/utils/deploy-adapter.js +25 -14
- package/dist/utils/env-management.d.ts +15 -0
- package/dist/utils/env-management.js +47 -0
- package/dist/utils/lambda-config.js +18 -23
- package/dist/utils/messages.js +24 -3
- package/dist/utils/next-image-loader-config.d.ts +2 -0
- package/dist/utils/next-image-loader-config.js +63 -0
- package/dist/utils/next-image-loader-file.d.ts +2 -0
- package/dist/utils/next-image-loader-file.js +11 -0
- package/dist/utils/payload-config-ast.js +5 -2
- package/dist/utils/payload-generate.d.ts +10 -0
- package/dist/utils/payload-generate.js +59 -0
- package/dist/utils/payload-secret.d.ts +28 -0
- package/dist/utils/payload-secret.js +34 -0
- package/dist/utils/pnpm-builds.d.ts +14 -0
- package/dist/utils/pnpm-builds.js +125 -0
- package/dist/utils/s3-upload.js +4 -1
- package/package.json +33 -7
- package/dist/lib/download-skill.d.ts +0 -12
- package/dist/lib/download-skill.js +0 -77
- package/dist/utils/adapters/nextjs.d.ts +0 -8
- package/dist/utils/adapters/nextjs.js +0 -61
- package/dist/utils/adapters/nitro.d.ts +0 -8
- package/dist/utils/adapters/nitro.js +0 -172
- package/dist/utils/adapters/vite.js +0 -31
- package/dist/utils/asset-collection.js +0 -144
- package/dist/utils/build-lambda-zip.js +0 -90
- package/dist/utils/fs-utils.d.ts +0 -12
- package/dist/utils/fs-utils.js +0 -55
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export const thTranslations = {
|
|
2
|
+
figma: {
|
|
3
|
+
cloudLimitAssetStorageError: 'ไม่สามารถอัปโหลดได้ กรุณาเพิ่มพื้นที่ว่างเพื่อดำเนินการต่อ',
|
|
4
|
+
cloudLimitDocumentCountError: 'ไม่สามารถสร้าง Document ได้ เกินขีดจำกัดการจัดเก็บข้อมูลแล้ว',
|
|
5
|
+
cloudLimitDocumentDataSizeError: 'ไม่สามารถบันทึกเอกสารได้ ข้อความยาวเกินไป',
|
|
6
|
+
cloudLimitModalBody: 'คุณได้ถึงขีดจำกัดของเอกสารแล้ว กรุณาลบเอกสารที่มีอยู่บางส่วนเพื่อดำเนินการสร้างเอกสารต่อ',
|
|
7
|
+
cloudLimitModalConfirm: 'ได้รับแล้ว',
|
|
8
|
+
cloudLimitModalHeading: 'ไม่สามารถบันทึก Document ได้',
|
|
9
|
+
cloudLimitModalRetry: 'ลองอีกครั้ง',
|
|
10
|
+
cloudLimitModalReviewCollection: 'ตรวจสอบ {{collection}}'
|
|
11
|
+
}
|
|
12
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const trTranslations: {
|
|
2
|
+
figma: {
|
|
3
|
+
cloudLimitAssetStorageError: string;
|
|
4
|
+
cloudLimitDocumentCountError: string;
|
|
5
|
+
cloudLimitDocumentDataSizeError: string;
|
|
6
|
+
cloudLimitModalBody: string;
|
|
7
|
+
cloudLimitModalConfirm: string;
|
|
8
|
+
cloudLimitModalHeading: string;
|
|
9
|
+
cloudLimitModalRetry: string;
|
|
10
|
+
cloudLimitModalReviewCollection: string;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export const trTranslations = {
|
|
2
|
+
figma: {
|
|
3
|
+
cloudLimitAssetStorageError: 'Yükleme yapılamıyor. Devam edebilmek için alan boşaltın.',
|
|
4
|
+
cloudLimitDocumentCountError: 'Belge oluşturulamıyor. Depolama sınırına ulaşıldı.',
|
|
5
|
+
cloudLimitDocumentDataSizeError: 'Belge kaydedilemiyor, metin çok büyük.',
|
|
6
|
+
cloudLimitModalBody: 'Belge limitinize ulaştınız. Yeni belgeler oluşturabilmek için mevcut belgelerden bazılarını silin.',
|
|
7
|
+
cloudLimitModalConfirm: 'Anlaşıldı',
|
|
8
|
+
cloudLimitModalHeading: 'Belge kaydedilemedi',
|
|
9
|
+
cloudLimitModalRetry: 'Tekrar Dene',
|
|
10
|
+
cloudLimitModalReviewCollection: '{{collection}}’ı inceleyin'
|
|
11
|
+
}
|
|
12
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const ukTranslations: {
|
|
2
|
+
figma: {
|
|
3
|
+
cloudLimitAssetStorageError: string;
|
|
4
|
+
cloudLimitDocumentCountError: string;
|
|
5
|
+
cloudLimitDocumentDataSizeError: string;
|
|
6
|
+
cloudLimitModalBody: string;
|
|
7
|
+
cloudLimitModalConfirm: string;
|
|
8
|
+
cloudLimitModalHeading: string;
|
|
9
|
+
cloudLimitModalRetry: string;
|
|
10
|
+
cloudLimitModalReviewCollection: string;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export const ukTranslations = {
|
|
2
|
+
figma: {
|
|
3
|
+
cloudLimitAssetStorageError: 'Неможливо завантажити. Звільніть місце, щоб продовжити.',
|
|
4
|
+
cloudLimitDocumentCountError: 'Не вдалося створити документ. Досягнуто ліміту зберігання.',
|
|
5
|
+
cloudLimitDocumentDataSizeError: 'Неможливо зберегти документ, текст надто великий.',
|
|
6
|
+
cloudLimitModalBody: 'Ви досягли межі документів. Видаліть деякі наявні документи, щоб продовжити створення.',
|
|
7
|
+
cloudLimitModalConfirm: 'Зрозуміло',
|
|
8
|
+
cloudLimitModalHeading: 'Не вдалося зберегти документ',
|
|
9
|
+
cloudLimitModalRetry: 'Повторити',
|
|
10
|
+
cloudLimitModalReviewCollection: 'Переглянути {{collection}}'
|
|
11
|
+
}
|
|
12
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const viTranslations: {
|
|
2
|
+
figma: {
|
|
3
|
+
cloudLimitAssetStorageError: string;
|
|
4
|
+
cloudLimitDocumentCountError: string;
|
|
5
|
+
cloudLimitDocumentDataSizeError: string;
|
|
6
|
+
cloudLimitModalBody: string;
|
|
7
|
+
cloudLimitModalConfirm: string;
|
|
8
|
+
cloudLimitModalHeading: string;
|
|
9
|
+
cloudLimitModalRetry: string;
|
|
10
|
+
cloudLimitModalReviewCollection: string;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export const viTranslations = {
|
|
2
|
+
figma: {
|
|
3
|
+
cloudLimitAssetStorageError: 'Không thể tải lên. Hãy giải phóng dung lượng để tiếp tục.',
|
|
4
|
+
cloudLimitDocumentCountError: 'Không thể tạo tài liệu. Đã đạt giới hạn lưu trữ.',
|
|
5
|
+
cloudLimitDocumentDataSizeError: 'Không thể lưu tài liệu, văn bản quá lớn.',
|
|
6
|
+
cloudLimitModalBody: 'Bạn đã đạt đến giới hạn tài liệu. Vui lòng xóa một số tài liệu hiện có để tiếp tục tạo mới.',
|
|
7
|
+
cloudLimitModalConfirm: 'Đã hiểu',
|
|
8
|
+
cloudLimitModalHeading: 'Không thể lưu tài liệu',
|
|
9
|
+
cloudLimitModalRetry: 'Thử lại',
|
|
10
|
+
cloudLimitModalReviewCollection: 'Xem lại {{collection}}'
|
|
11
|
+
}
|
|
12
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const zhTranslations: {
|
|
2
|
+
figma: {
|
|
3
|
+
cloudLimitAssetStorageError: string;
|
|
4
|
+
cloudLimitDocumentCountError: string;
|
|
5
|
+
cloudLimitDocumentDataSizeError: string;
|
|
6
|
+
cloudLimitModalBody: string;
|
|
7
|
+
cloudLimitModalConfirm: string;
|
|
8
|
+
cloudLimitModalHeading: string;
|
|
9
|
+
cloudLimitModalRetry: string;
|
|
10
|
+
cloudLimitModalReviewCollection: string;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export const zhTranslations = {
|
|
2
|
+
figma: {
|
|
3
|
+
cloudLimitAssetStorageError: '无法上传。请释放空间以继续操作。',
|
|
4
|
+
cloudLimitDocumentCountError: '无法创建文档。已达到存储限制。',
|
|
5
|
+
cloudLimitDocumentDataSizeError: '无法保存文档,文本过大。',
|
|
6
|
+
cloudLimitModalBody: '您已达到文档数量上限。请删除部分现有文档以继续创建。',
|
|
7
|
+
cloudLimitModalConfirm: '明白',
|
|
8
|
+
cloudLimitModalHeading: '无法保存文档',
|
|
9
|
+
cloudLimitModalRetry: '重试',
|
|
10
|
+
cloudLimitModalReviewCollection: '审核 {{collection}}'
|
|
11
|
+
}
|
|
12
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const zhTwTranslations: {
|
|
2
|
+
figma: {
|
|
3
|
+
cloudLimitAssetStorageError: string;
|
|
4
|
+
cloudLimitDocumentCountError: string;
|
|
5
|
+
cloudLimitDocumentDataSizeError: string;
|
|
6
|
+
cloudLimitModalBody: string;
|
|
7
|
+
cloudLimitModalConfirm: string;
|
|
8
|
+
cloudLimitModalHeading: string;
|
|
9
|
+
cloudLimitModalRetry: string;
|
|
10
|
+
cloudLimitModalReviewCollection: string;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export const zhTwTranslations = {
|
|
2
|
+
figma: {
|
|
3
|
+
cloudLimitAssetStorageError: '無法上傳。請釋放空間以繼續。',
|
|
4
|
+
cloudLimitDocumentCountError: '無法建立文件。已達儲存空間上限。',
|
|
5
|
+
cloudLimitDocumentDataSizeError: '無法儲存 Document,文字內容過長。',
|
|
6
|
+
cloudLimitModalBody: '您已達到文件數量上限。請刪除部分現有文件以繼續建立新文件。',
|
|
7
|
+
cloudLimitModalConfirm: '了解',
|
|
8
|
+
cloudLimitModalHeading: '無法儲存文件',
|
|
9
|
+
cloudLimitModalRetry: '重試',
|
|
10
|
+
cloudLimitModalReviewCollection: '審查{{collection}}'
|
|
11
|
+
}
|
|
12
|
+
};
|
package/dist/types.d.ts
CHANGED
|
@@ -1,17 +1,28 @@
|
|
|
1
1
|
import type arg from 'arg';
|
|
2
2
|
export interface Args extends arg.Spec {
|
|
3
|
+
'--adapter': StringConstructor;
|
|
4
|
+
'--callback-url': StringConstructor;
|
|
5
|
+
'--complete': StringConstructor;
|
|
3
6
|
'--debug': BooleanConstructor;
|
|
7
|
+
'--description': StringConstructor;
|
|
4
8
|
'--dry-run': BooleanConstructor;
|
|
5
9
|
'--env': StringConstructor;
|
|
6
10
|
'--environment': string;
|
|
7
11
|
'--force': BooleanConstructor;
|
|
12
|
+
'--global': BooleanConstructor;
|
|
13
|
+
'--headless': BooleanConstructor;
|
|
8
14
|
'--help': BooleanConstructor;
|
|
9
15
|
'--id': StringConstructor;
|
|
10
16
|
'--infra-env': StringConstructor;
|
|
11
17
|
'--list': BooleanConstructor;
|
|
12
18
|
'--logout': BooleanConstructor;
|
|
13
19
|
'--name': StringConstructor;
|
|
20
|
+
'--output': StringConstructor;
|
|
21
|
+
'--project': BooleanConstructor;
|
|
22
|
+
'--region': StringConstructor;
|
|
23
|
+
'--subdomain': StringConstructor;
|
|
14
24
|
'--template': StringConstructor;
|
|
25
|
+
'--workspace': StringConstructor;
|
|
15
26
|
'--yes': BooleanConstructor;
|
|
16
27
|
'-e': string;
|
|
17
28
|
'-f': string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function assertNever(x: never): never;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { AdapterName } from './deploy-adapter.js';
|
|
1
2
|
/**
|
|
2
3
|
* Information about a detected build
|
|
3
4
|
*/
|
|
@@ -11,11 +12,15 @@ export interface BuildInfo {
|
|
|
11
12
|
/** Build timestamp */
|
|
12
13
|
timestamp: Date;
|
|
13
14
|
}
|
|
15
|
+
export interface DetectBuildOptions {
|
|
16
|
+
adapter?: AdapterName;
|
|
17
|
+
output?: string;
|
|
18
|
+
}
|
|
14
19
|
/**
|
|
15
20
|
* Detect a valid build across supported frameworks.
|
|
16
21
|
* Tries NextJS, then Nitro, then Vite. Returns the first match.
|
|
17
22
|
*/
|
|
18
|
-
export declare function detectBuild(projectPath: string): Promise<BuildInfo | null>;
|
|
23
|
+
export declare function detectBuild(projectPath: string, options: DetectBuildOptions): Promise<BuildInfo | null>;
|
|
19
24
|
/**
|
|
20
25
|
* Get the build command from package.json
|
|
21
26
|
*
|
|
@@ -1,103 +1,82 @@
|
|
|
1
1
|
import fs from 'fs/promises';
|
|
2
2
|
import path from 'path';
|
|
3
|
+
import { inspectNextjsOutput } from '../adapters/deploy-output/inspectNextjsOutput.js';
|
|
4
|
+
import { inspectNitroOutput } from '../adapters/deploy-output/inspectNitroOutput.js';
|
|
5
|
+
import { resolveOutputPath } from '../adapters/deploy-output/resolveOutputPath.js';
|
|
6
|
+
import { assertNever } from './assert-never.js';
|
|
3
7
|
/**
|
|
4
8
|
* Detect a valid build across supported frameworks.
|
|
5
9
|
* Tries NextJS, then Nitro, then Vite. Returns the first match.
|
|
6
|
-
*/ export async function detectBuild(projectPath) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
if (viteBuild) {
|
|
20
|
-
return viteBuild;
|
|
21
|
-
}
|
|
22
|
-
return null;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Detect NextJS standalone build (.next/standalone/server.js + .next/BUILD_ID)
|
|
26
|
-
*/ async function detectNextjsBuild(projectPath) {
|
|
27
|
-
try {
|
|
28
|
-
const serverPath = path.join(projectPath, '.next', 'standalone', 'server.js');
|
|
29
|
-
const serverStat = await fs.stat(serverPath);
|
|
30
|
-
const buildIdPath = path.join(projectPath, '.next', 'BUILD_ID');
|
|
31
|
-
const buildId = (await fs.readFile(buildIdPath, 'utf-8')).trim();
|
|
32
|
-
const lambdaZipPath = path.join(projectPath, 'lambda.zip');
|
|
33
|
-
let hasLambdaZip = false;
|
|
34
|
-
try {
|
|
35
|
-
await fs.stat(lambdaZipPath);
|
|
36
|
-
hasLambdaZip = true;
|
|
37
|
-
} catch {
|
|
38
|
-
hasLambdaZip = false;
|
|
10
|
+
*/ export async function detectBuild(projectPath, options) {
|
|
11
|
+
const adapters = options.adapter ? [
|
|
12
|
+
options.adapter
|
|
13
|
+
] : [
|
|
14
|
+
'nextjs',
|
|
15
|
+
'nitro',
|
|
16
|
+
'vite'
|
|
17
|
+
];
|
|
18
|
+
for (const adapter of adapters){
|
|
19
|
+
const outputPath = resolveOutputPath(projectPath, adapter, options.output);
|
|
20
|
+
const build = await detectAdapterBuild(projectPath, adapter, outputPath);
|
|
21
|
+
if (build) {
|
|
22
|
+
return build;
|
|
39
23
|
}
|
|
40
|
-
return {
|
|
41
|
-
buildId,
|
|
42
|
-
hasLambdaZip,
|
|
43
|
-
path: '.next/standalone',
|
|
44
|
-
timestamp: serverStat.mtime
|
|
45
|
-
};
|
|
46
|
-
} catch {
|
|
47
|
-
return null;
|
|
48
24
|
}
|
|
25
|
+
return null;
|
|
49
26
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
27
|
+
async function detectAdapterBuild(projectPath, adapter, outputPath) {
|
|
28
|
+
switch(adapter){
|
|
29
|
+
case 'nextjs':
|
|
30
|
+
{
|
|
31
|
+
const layout = await inspectNextjsOutput(outputPath);
|
|
32
|
+
if (!layout) {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
const stat = await fs.stat(layout.serverEntryPath);
|
|
36
|
+
return {
|
|
37
|
+
buildId: layout.buildId,
|
|
38
|
+
hasLambdaZip: await hasLambdaZip(projectPath),
|
|
39
|
+
path: path.relative(projectPath, layout.standalonePath),
|
|
40
|
+
timestamp: stat.mtime
|
|
41
|
+
};
|
|
63
42
|
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
43
|
+
case 'nitro':
|
|
44
|
+
{
|
|
45
|
+
const layout = await inspectNitroOutput(outputPath);
|
|
46
|
+
if (!layout) {
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
const stat = await fs.stat(layout.serverEntryPath);
|
|
50
|
+
return {
|
|
51
|
+
buildId: layout.buildId ?? stat.mtime.toISOString(),
|
|
52
|
+
hasLambdaZip: await hasLambdaZip(projectPath),
|
|
53
|
+
path: path.relative(projectPath, outputPath),
|
|
54
|
+
timestamp: stat.mtime
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
case 'vite':
|
|
58
|
+
{
|
|
59
|
+
try {
|
|
60
|
+
const stat = await fs.stat(path.join(outputPath, 'index.html'));
|
|
61
|
+
if (!stat.isFile()) {
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
return {
|
|
65
|
+
buildId: stat.mtime.toISOString(),
|
|
66
|
+
hasLambdaZip: false,
|
|
67
|
+
path: path.relative(projectPath, outputPath),
|
|
68
|
+
timestamp: stat.mtime
|
|
69
|
+
};
|
|
70
|
+
} catch {
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
default:
|
|
75
|
+
assertNever(adapter);
|
|
83
76
|
}
|
|
84
77
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
* Build ID is mtime of index.html as ISO string. No server, so hasLambdaZip is always false.
|
|
88
|
-
*/ async function detectViteBuild(projectPath) {
|
|
89
|
-
try {
|
|
90
|
-
const indexPath = path.join(projectPath, 'dist', 'index.html');
|
|
91
|
-
const indexStat = await fs.stat(indexPath);
|
|
92
|
-
return {
|
|
93
|
-
buildId: indexStat.mtime.toISOString(),
|
|
94
|
-
hasLambdaZip: false,
|
|
95
|
-
path: 'dist',
|
|
96
|
-
timestamp: indexStat.mtime
|
|
97
|
-
};
|
|
98
|
-
} catch {
|
|
99
|
-
return null;
|
|
100
|
-
}
|
|
78
|
+
async function hasLambdaZip(projectPath) {
|
|
79
|
+
return fs.stat(path.join(projectPath, 'lambda.zip')).then(()=>true).catch(()=>false);
|
|
101
80
|
}
|
|
102
81
|
/**
|
|
103
82
|
* Get the build command from package.json
|
|
@@ -1,37 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
pathMap: Record<string, string>;
|
|
4
|
-
/** Route → S3 upload keys for that route (e.g., { "/products": ["products.html", "products.rsc"] }) */
|
|
5
|
-
routeAssetMap: Record<string, string[]>;
|
|
6
|
-
/** Route paths for the manifest pages array (e.g., ["/products", "/blog"]) */
|
|
7
|
-
routes: string[];
|
|
8
|
-
/** S3 keys to upload (e.g., ["products.html", "products.rsc", "products.meta"]) */
|
|
9
|
-
uploadKeys: string[];
|
|
10
|
-
}
|
|
11
|
-
export interface AssetCollection {
|
|
12
|
-
/** S3 key → relative filesystem path from project root */
|
|
13
|
-
pathMap: Record<string, string>;
|
|
14
|
-
/** Route paths for the manifest assets array (e.g., ["/favicon.ico"]) */
|
|
15
|
-
routes: string[];
|
|
16
|
-
/** S3 keys to upload (same as routes for assets, without leading slash) */
|
|
17
|
-
uploadKeys: string[];
|
|
18
|
-
}
|
|
19
|
-
export type AdapterName = 'nextjs' | 'nitro' | 'vite';
|
|
20
|
-
export interface LambdaBundle {
|
|
21
|
-
/** Total size in bytes of the bundle contents before compression. */
|
|
22
|
-
unzippedBytes: number;
|
|
23
|
-
/** Absolute path to the built lambda.zip. */
|
|
24
|
-
zipPath: string;
|
|
25
|
-
}
|
|
26
|
-
export interface DeployAdapter {
|
|
27
|
-
collectAssets(projectPath: string): Promise<AssetCollection>;
|
|
28
|
-
collectPages(projectPath: string): Promise<PageCollection>;
|
|
29
|
-
/** SPA fallback path (e.g., "/index.html"). Undefined for SSR/SSG apps. */
|
|
30
|
-
fallback?: string;
|
|
31
|
-
name: AdapterName;
|
|
32
|
-
/** Assembles and zips the server bundle. Returns the bundle, or null if no server (e.g., Vite SPA). */
|
|
33
|
-
prepareLambdaBundle(projectPath: string): Promise<LambdaBundle | null>;
|
|
34
|
-
}
|
|
1
|
+
import type { AdapterName, DeployAdapter } from '../adapters/types.js';
|
|
2
|
+
export type { AdapterLogger, AdapterName, AssetCollection, DeployAdapter, LambdaBundle, PageCollection, PrepareLambdaBundleOptions, } from '../adapters/types.js';
|
|
35
3
|
/**
|
|
36
4
|
* Auto-detect the framework adapter based on build output.
|
|
37
5
|
*
|
|
@@ -42,4 +10,4 @@ export interface DeployAdapter {
|
|
|
42
10
|
* @param projectPath - Path to project root
|
|
43
11
|
* @param override - Explicit adapter name from --adapter flag
|
|
44
12
|
*/
|
|
45
|
-
export declare function detectAdapter(projectPath: string, override?: AdapterName): Promise<DeployAdapter>;
|
|
13
|
+
export declare function detectAdapter(projectPath: string, override?: AdapterName, output?: string): Promise<DeployAdapter>;
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
import fs from 'fs/promises';
|
|
2
2
|
import path from 'path';
|
|
3
|
+
import { inspectNextjsOutput } from '../adapters/deploy-output/inspectNextjsOutput.js';
|
|
4
|
+
import { inspectNitroOutput } from '../adapters/deploy-output/inspectNitroOutput.js';
|
|
5
|
+
import { resolveOutputPath } from '../adapters/deploy-output/resolveOutputPath.js';
|
|
6
|
+
import * as log from './log.js';
|
|
7
|
+
const adapterLogger = {
|
|
8
|
+
info: log.info,
|
|
9
|
+
warning: log.warning
|
|
10
|
+
};
|
|
3
11
|
/**
|
|
4
12
|
* Auto-detect the framework adapter based on build output.
|
|
5
13
|
*
|
|
@@ -9,40 +17,43 @@ import path from 'path';
|
|
|
9
17
|
*
|
|
10
18
|
* @param projectPath - Path to project root
|
|
11
19
|
* @param override - Explicit adapter name from --adapter flag
|
|
12
|
-
*/ export async function detectAdapter(projectPath, override) {
|
|
20
|
+
*/ export async function detectAdapter(projectPath, override, output) {
|
|
13
21
|
if (override) {
|
|
14
22
|
return loadAdapter(override);
|
|
15
23
|
}
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
const hasViteDist = await exists(path.join(projectPath, 'dist', 'index.html'));
|
|
19
|
-
if (hasNext) {
|
|
24
|
+
const nextOutput = resolveOutputPath(projectPath, 'nextjs', output);
|
|
25
|
+
if (await inspectNextjsOutput(nextOutput)) {
|
|
20
26
|
return loadAdapter('nextjs');
|
|
21
27
|
}
|
|
22
|
-
|
|
28
|
+
const nitroOutput = resolveOutputPath(projectPath, 'nitro', output);
|
|
29
|
+
if (await inspectNitroOutput(nitroOutput)) {
|
|
23
30
|
return loadAdapter('nitro');
|
|
24
31
|
}
|
|
25
|
-
|
|
32
|
+
const viteOutput = resolveOutputPath(projectPath, 'vite', output);
|
|
33
|
+
if (await exists(path.join(viteOutput, 'index.html'))) {
|
|
26
34
|
return loadAdapter('vite');
|
|
27
35
|
}
|
|
28
|
-
|
|
36
|
+
const location = output ? ` in ${path.resolve(projectPath, output)}` : '';
|
|
37
|
+
throw new Error(`Could not detect framework${location}. Expected Next.js BUILD_ID + standalone server, ` + 'Nitro server entry, or Vite index.html. ' + 'Use --adapter to specify explicitly.');
|
|
29
38
|
}
|
|
30
39
|
async function loadAdapter(name) {
|
|
31
40
|
switch(name){
|
|
32
41
|
case 'nextjs':
|
|
33
42
|
{
|
|
34
|
-
const mod = await import('
|
|
35
|
-
return mod.
|
|
43
|
+
const mod = await import('../adapters/nextjs.js');
|
|
44
|
+
return new mod.NextjsAdapter({
|
|
45
|
+
logger: adapterLogger
|
|
46
|
+
});
|
|
36
47
|
}
|
|
37
48
|
case 'nitro':
|
|
38
49
|
{
|
|
39
|
-
const mod = await import('
|
|
40
|
-
return mod.
|
|
50
|
+
const mod = await import('../adapters/nitro.js');
|
|
51
|
+
return new mod.NitroAdapter();
|
|
41
52
|
}
|
|
42
53
|
case 'vite':
|
|
43
54
|
{
|
|
44
|
-
const mod = await import('
|
|
45
|
-
return mod.
|
|
55
|
+
const mod = await import('../adapters/vite.js');
|
|
56
|
+
return new mod.ViteAdapter();
|
|
46
57
|
}
|
|
47
58
|
}
|
|
48
59
|
}
|
|
@@ -14,6 +14,8 @@ export declare function getEnvVar(projectPath: string, key: string): Promise<nul
|
|
|
14
14
|
* @returns The value if found, null otherwise
|
|
15
15
|
*/
|
|
16
16
|
export declare function getEnvVarSync(projectPath: string, key: string): null | string;
|
|
17
|
+
/** Read a dotenv-parsed value without populating process.env. */
|
|
18
|
+
export declare function getParsedEnvVarSync(projectPath: string, key: string): null | string;
|
|
17
19
|
/**
|
|
18
20
|
* Add or update an environment variable in .env file
|
|
19
21
|
*
|
|
@@ -22,6 +24,19 @@ export declare function getEnvVarSync(projectPath: string, key: string): null |
|
|
|
22
24
|
* @param value - Environment variable value
|
|
23
25
|
*/
|
|
24
26
|
export declare function addOrUpdateEnvVar(projectPath: string, key: string, value: string): Promise<void>;
|
|
27
|
+
/**
|
|
28
|
+
* Comment out an environment variable in .env file by prepending `# ` to any
|
|
29
|
+
* assignment line for the given key. Preserves the value so the developer can
|
|
30
|
+
* uncomment it later (or move it to another env file). No-op if the key is
|
|
31
|
+
* absent or every occurrence is already commented.
|
|
32
|
+
*
|
|
33
|
+
* @param projectPath - Path to project directory
|
|
34
|
+
* @param key - Environment variable name to disable
|
|
35
|
+
* @param annotation - Optional trailing comment appended to each disabled
|
|
36
|
+
* line, so the developer knows why it was disabled
|
|
37
|
+
* @returns true if at least one line was commented out, false otherwise
|
|
38
|
+
*/
|
|
39
|
+
export declare function commentOutEnvVar(projectPath: string, key: string, annotation?: string): Promise<boolean>;
|
|
25
40
|
/**
|
|
26
41
|
* Remove an environment variable from .env file
|
|
27
42
|
*
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { parse } from 'dotenv';
|
|
1
2
|
import fs from 'fs/promises';
|
|
2
3
|
import fsSync from 'node:fs';
|
|
3
4
|
import path from 'path';
|
|
@@ -54,6 +55,14 @@ import path from 'path';
|
|
|
54
55
|
return null;
|
|
55
56
|
}
|
|
56
57
|
}
|
|
58
|
+
/** Read a dotenv-parsed value without populating process.env. */ export function getParsedEnvVarSync(projectPath, key) {
|
|
59
|
+
try {
|
|
60
|
+
const contents = fsSync.readFileSync(path.join(projectPath, '.env'), 'utf-8');
|
|
61
|
+
return parse(contents)[key] ?? null;
|
|
62
|
+
} catch {
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
57
66
|
/**
|
|
58
67
|
* Add or update an environment variable in .env file
|
|
59
68
|
*
|
|
@@ -115,6 +124,44 @@ import path from 'path';
|
|
|
115
124
|
throw new Error(`Failed to update .env file: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
116
125
|
}
|
|
117
126
|
}
|
|
127
|
+
/**
|
|
128
|
+
* Comment out an environment variable in .env file by prepending `# ` to any
|
|
129
|
+
* assignment line for the given key. Preserves the value so the developer can
|
|
130
|
+
* uncomment it later (or move it to another env file). No-op if the key is
|
|
131
|
+
* absent or every occurrence is already commented.
|
|
132
|
+
*
|
|
133
|
+
* @param projectPath - Path to project directory
|
|
134
|
+
* @param key - Environment variable name to disable
|
|
135
|
+
* @param annotation - Optional trailing comment appended to each disabled
|
|
136
|
+
* line, so the developer knows why it was disabled
|
|
137
|
+
* @returns true if at least one line was commented out, false otherwise
|
|
138
|
+
*/ export async function commentOutEnvVar(projectPath, key, annotation) {
|
|
139
|
+
const envPath = path.join(projectPath, '.env');
|
|
140
|
+
try {
|
|
141
|
+
const contents = await fs.readFile(envPath, 'utf-8');
|
|
142
|
+
const lines = contents.split(/\r?\n/);
|
|
143
|
+
let changed = false;
|
|
144
|
+
const updated = lines.map((line)=>{
|
|
145
|
+
if (!line.includes('=') || line.trim().startsWith('#')) {
|
|
146
|
+
return line;
|
|
147
|
+
}
|
|
148
|
+
const equalsIndex = line.indexOf('=');
|
|
149
|
+
const lineKey = line.substring(0, equalsIndex).trim();
|
|
150
|
+
if (lineKey !== key) {
|
|
151
|
+
return line;
|
|
152
|
+
}
|
|
153
|
+
changed = true;
|
|
154
|
+
const suffix = annotation ? ` # ${annotation}` : '';
|
|
155
|
+
return `# ${line}${suffix}`;
|
|
156
|
+
});
|
|
157
|
+
if (changed) {
|
|
158
|
+
await fs.writeFile(envPath, updated.join('\n'), 'utf-8');
|
|
159
|
+
}
|
|
160
|
+
return changed;
|
|
161
|
+
} catch {
|
|
162
|
+
return false;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
118
165
|
/**
|
|
119
166
|
* Remove an environment variable from .env file
|
|
120
167
|
*
|