@decocms/blocks 8.9.1 → 8.11.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/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/protocol/channel.d.ts +98 -0
- package/dist/protocol/channel.d.ts.map +1 -0
- package/dist/protocol/channel.js +58 -0
- package/dist/protocol/channel.js.map +1 -0
- package/dist/protocol/client.js +2 -2
- package/dist/protocol/client.js.map +1 -1
- package/dist/protocol/conformance/blockMetaVectors.json +214 -0
- package/dist/protocol/conformance/contentHashFixtures.d.ts +22 -0
- package/dist/protocol/conformance/contentHashFixtures.d.ts.map +1 -1
- package/dist/protocol/conformance/contentHashFixtures.js +55 -0
- package/dist/protocol/conformance/contentHashFixtures.js.map +1 -1
- package/dist/protocol/conformance/index.d.ts +2 -1
- package/dist/protocol/conformance/index.d.ts.map +1 -1
- package/dist/protocol/conformance/index.js +2 -1
- package/dist/protocol/conformance/index.js.map +1 -1
- package/dist/protocol/conformance/vectors.d.ts +33 -0
- package/dist/protocol/conformance/vectors.d.ts.map +1 -0
- package/dist/protocol/conformance/vectors.js +3 -0
- package/dist/protocol/conformance/vectors.js.map +1 -0
- package/dist/protocol/index.d.ts +11 -1
- package/dist/protocol/index.d.ts.map +1 -1
- package/dist/protocol/index.js +11 -1
- package/dist/protocol/index.js.map +1 -1
- package/dist/protocol/keys.d.ts +1 -1
- package/dist/protocol/keys.js +1 -1
- package/dist/v8/background.d.ts +13 -0
- package/dist/v8/background.d.ts.map +1 -1
- package/dist/v8/background.js +41 -0
- package/dist/v8/background.js.map +1 -1
- package/dist/v8/blockMeta.d.ts +27 -0
- package/dist/v8/blockMeta.d.ts.map +1 -0
- package/dist/v8/blockMeta.js +75 -0
- package/dist/v8/blockMeta.js.map +1 -0
- package/dist/v8/blockStore.d.ts +43 -0
- package/dist/v8/blockStore.d.ts.map +1 -0
- package/dist/v8/blockStore.js +95 -0
- package/dist/v8/blockStore.js.map +1 -0
- package/dist/v8/boundedJson.d.ts +5 -0
- package/dist/v8/boundedJson.d.ts.map +1 -1
- package/dist/v8/boundedJson.js +10 -2
- package/dist/v8/boundedJson.js.map +1 -1
- package/dist/v8/boundedMap.d.ts +19 -0
- package/dist/v8/boundedMap.d.ts.map +1 -0
- package/dist/v8/boundedMap.js +52 -0
- package/dist/v8/boundedMap.js.map +1 -0
- package/dist/v8/builtins/data.d.ts +18 -2
- package/dist/v8/builtins/data.d.ts.map +1 -1
- package/dist/v8/builtins/data.js +17 -1
- package/dist/v8/builtins/data.js.map +1 -1
- package/dist/v8/builtins/index.d.ts.map +1 -1
- package/dist/v8/builtins/index.js +2 -1
- package/dist/v8/builtins/index.js.map +1 -1
- package/dist/v8/builtins/legacy.d.ts +6 -3
- package/dist/v8/builtins/legacy.d.ts.map +1 -1
- package/dist/v8/builtins/legacy.js +6 -3
- package/dist/v8/builtins/legacy.js.map +1 -1
- package/dist/v8/canonical.d.ts +8 -0
- package/dist/v8/canonical.d.ts.map +1 -1
- package/dist/v8/canonical.js +15 -0
- package/dist/v8/canonical.js.map +1 -1
- package/dist/v8/cli/builtins.d.ts.map +1 -1
- package/dist/v8/cli/builtins.js +1 -0
- package/dist/v8/cli/builtins.js.map +1 -1
- package/dist/v8/cli/check/index.d.ts +10 -0
- package/dist/v8/cli/check/index.d.ts.map +1 -1
- package/dist/v8/cli/check/index.js +91 -7
- package/dist/v8/cli/check/index.js.map +1 -1
- package/dist/v8/cli/content.d.ts +12 -25
- package/dist/v8/cli/content.d.ts.map +1 -1
- package/dist/v8/cli/content.js +46 -75
- package/dist/v8/cli/content.js.map +1 -1
- package/dist/v8/cli/index.d.ts +2 -2
- package/dist/v8/cli/index.d.ts.map +1 -1
- package/dist/v8/cli/index.js +2 -2
- package/dist/v8/cli/index.js.map +1 -1
- package/dist/v8/cli/remote/commands.d.ts +71 -0
- package/dist/v8/cli/remote/commands.d.ts.map +1 -0
- package/dist/v8/cli/remote/commands.js +644 -0
- package/dist/v8/cli/remote/commands.js.map +1 -0
- package/dist/v8/cli/remote/diff.d.ts +15 -0
- package/dist/v8/cli/remote/diff.d.ts.map +1 -0
- package/dist/v8/cli/remote/diff.js +102 -0
- package/dist/v8/cli/remote/diff.js.map +1 -0
- package/dist/v8/cli/remote/env.d.ts +35 -0
- package/dist/v8/cli/remote/env.d.ts.map +1 -0
- package/dist/v8/cli/remote/env.js +84 -0
- package/dist/v8/cli/remote/env.js.map +1 -0
- package/dist/v8/cli/remote/http.d.ts +149 -0
- package/dist/v8/cli/remote/http.d.ts.map +1 -0
- package/dist/v8/cli/remote/http.js +381 -0
- package/dist/v8/cli/remote/http.js.map +1 -0
- package/dist/v8/cli/remote/local.d.ts +90 -0
- package/dist/v8/cli/remote/local.d.ts.map +1 -0
- package/dist/v8/cli/remote/local.js +309 -0
- package/dist/v8/cli/remote/local.js.map +1 -0
- package/dist/v8/cli/root.d.ts +29 -0
- package/dist/v8/cli/root.d.ts.map +1 -1
- package/dist/v8/cli/root.js +28 -0
- package/dist/v8/cli/root.js.map +1 -1
- package/dist/v8/cli/run.d.ts +13 -1
- package/dist/v8/cli/run.d.ts.map +1 -1
- package/dist/v8/cli/run.js +310 -124
- package/dist/v8/cli/run.js.map +1 -1
- package/dist/v8/cli/schema/builtinSchemas.d.ts.map +1 -1
- package/dist/v8/cli/schema/builtinSchemas.js +28 -10
- package/dist/v8/cli/schema/builtinSchemas.js.map +1 -1
- package/dist/v8/cli/schema/generate.js +1 -1
- package/dist/v8/cli/schema/generate.js.map +1 -1
- package/dist/v8/cli/skills.d.ts +25 -0
- package/dist/v8/cli/skills.d.ts.map +1 -0
- package/dist/v8/cli/skills.js +70 -0
- package/dist/v8/cli/skills.js.map +1 -0
- package/dist/v8/client.d.ts +9 -9
- package/dist/v8/client.d.ts.map +1 -1
- package/dist/v8/client.js +138 -50
- package/dist/v8/client.js.map +1 -1
- package/dist/v8/cms.d.ts +2 -1
- package/dist/v8/cms.d.ts.map +1 -1
- package/dist/v8/cms.js +55 -46
- package/dist/v8/cms.js.map +1 -1
- package/dist/v8/content.d.ts +39 -78
- package/dist/v8/content.d.ts.map +1 -1
- package/dist/v8/content.js +155 -195
- package/dist/v8/content.js.map +1 -1
- package/dist/v8/contentIndex.d.ts +71 -0
- package/dist/v8/contentIndex.d.ts.map +1 -0
- package/dist/v8/contentIndex.js +137 -0
- package/dist/v8/contentIndex.js.map +1 -0
- package/dist/v8/draft.d.ts +7 -7
- package/dist/v8/draft.d.ts.map +1 -1
- package/dist/v8/draft.js +10 -9
- package/dist/v8/draft.js.map +1 -1
- package/dist/v8/draftChanges.d.ts +59 -32
- package/dist/v8/draftChanges.d.ts.map +1 -1
- package/dist/v8/draftChanges.js +139 -75
- package/dist/v8/draftChanges.js.map +1 -1
- package/dist/v8/errors.d.ts +21 -0
- package/dist/v8/errors.d.ts.map +1 -1
- package/dist/v8/errors.js +22 -0
- package/dist/v8/errors.js.map +1 -1
- package/dist/v8/hostedSource.d.ts +57 -0
- package/dist/v8/hostedSource.d.ts.map +1 -0
- package/dist/v8/hostedSource.js +18 -0
- package/dist/v8/hostedSource.js.map +1 -0
- package/dist/v8/identity.d.ts +1 -1
- package/dist/v8/identity.js +1 -1
- package/dist/v8/index.d.ts +1 -0
- package/dist/v8/index.d.ts.map +1 -1
- package/dist/v8/index.js +1 -0
- package/dist/v8/index.js.map +1 -1
- package/dist/v8/matchRoute.js +7 -4
- package/dist/v8/matchRoute.js.map +1 -1
- package/dist/v8/pin.d.ts +34 -0
- package/dist/v8/pin.d.ts.map +1 -0
- package/dist/v8/pin.js +156 -0
- package/dist/v8/pin.js.map +1 -0
- package/dist/v8/preview/StudioBridge.d.ts +8 -8
- package/dist/v8/preview/StudioBridge.d.ts.map +1 -1
- package/dist/v8/preview/StudioBridge.js +8 -10
- package/dist/v8/preview/StudioBridge.js.map +1 -1
- package/dist/v8/preview/StudioChannel.d.ts +51 -0
- package/dist/v8/preview/StudioChannel.d.ts.map +1 -0
- package/dist/v8/preview/StudioChannel.js +104 -0
- package/dist/v8/preview/StudioChannel.js.map +1 -0
- package/dist/v8/preview/index.d.ts +3 -0
- package/dist/v8/preview/index.d.ts.map +1 -1
- package/dist/v8/preview/index.js +3 -0
- package/dist/v8/preview/index.js.map +1 -1
- package/dist/v8/remoteLoader.d.ts +42 -5
- package/dist/v8/remoteLoader.d.ts.map +1 -1
- package/dist/v8/remoteLoader.js +317 -259
- package/dist/v8/remoteLoader.js.map +1 -1
- package/dist/v8/resolver.d.ts +22 -8
- package/dist/v8/resolver.d.ts.map +1 -1
- package/dist/v8/resolver.js +37 -32
- package/dist/v8/resolver.js.map +1 -1
- package/dist/v8/revisionId.d.ts +11 -0
- package/dist/v8/revisionId.d.ts.map +1 -0
- package/dist/v8/revisionId.js +13 -0
- package/dist/v8/revisionId.js.map +1 -0
- package/dist/v8/settings.d.ts +6 -6
- package/dist/v8/settings.d.ts.map +1 -1
- package/dist/v8/settings.js +8 -7
- package/dist/v8/settings.js.map +1 -1
- package/dist/v8/telemetry.d.ts +4 -2
- package/dist/v8/telemetry.d.ts.map +1 -1
- package/dist/v8/telemetry.js +2 -2
- package/dist/v8/telemetry.js.map +1 -1
- package/dist/v8/types.d.ts +52 -40
- package/dist/v8/types.d.ts.map +1 -1
- package/dist/v8/variants.d.ts +7 -2
- package/dist/v8/variants.d.ts.map +1 -1
- package/dist/v8/variants.js +21 -24
- package/dist/v8/variants.js.map +1 -1
- package/dist/v8/vite/index.d.ts +2 -2
- package/dist/v8/vite/index.js +1 -1
- package/dist/v8/vite/index.js.map +1 -1
- package/package.json +3 -2
- package/skills/deco-apps/SKILL.md +82 -0
- package/skills/deco-apps/references/algolia.md +51 -0
- package/skills/deco-apps/references/commerce-types.md +132 -0
- package/skills/deco-apps/references/instrumented-fetch.md +144 -0
- package/skills/deco-apps/references/magento.md +55 -0
- package/skills/deco-apps/references/messaging.md +76 -0
- package/skills/deco-apps/references/shopify.md +69 -0
- package/skills/deco-apps/references/vendored-loaders.md +135 -0
- package/skills/deco-apps/references/vtex-cookies-auth.md +146 -0
- package/skills/deco-apps/references/vtex.md +150 -0
- package/skills/deco-apps/references/wake.md +75 -0
- package/skills/deco-cms-schema/SKILL.md +80 -0
- package/skills/deco-cms-schema/references/annotations.md +147 -0
- package/skills/deco-cms-schema/references/content-hygiene.md +91 -0
- package/skills/deco-cms-schema/references/formats-and-widgets.md +112 -0
- package/skills/deco-cms-schema/references/shapes-that-break-the-form.md +165 -0
- package/skills/deco-cms-schema/references/types-to-fields.md +112 -0
- package/skills/deco-go-live/SKILL.md +127 -0
- package/skills/deco-go-live/references/content-releases.md +90 -0
- package/skills/deco-go-live/references/process.md +106 -0
- package/skills/deco-go-live/references/proxy-headers-checkout.md +139 -0
- package/skills/deco-go-live/references/qa-checklist-template.md +150 -0
- package/skills/deco-go-live/references/qa-inventory.md +120 -0
- package/skills/deco-go-live/references/react-spa.md +183 -0
- package/skills/deco-go-live/references/seo-analytics.md +114 -0
- package/skills/deco-go-live/references/traffic-ramp.md +87 -0
- package/skills/deco-go-live/references/worker-runtime.md +93 -0
- package/skills/deco-go-live/scripts/preflight.sh +221 -0
- package/skills/deco-images-media/SKILL.md +64 -0
- package/skills/deco-images-media/references/asset-upload.md +191 -0
- package/skills/deco-images-media/references/components-per-binding.md +167 -0
- package/skills/deco-images-media/references/providers-and-cdn.md +145 -0
- package/skills/deco-images-media/references/quality-and-lcp.md +93 -0
- package/skills/deco-images-media/references/troubleshooting.md +147 -0
- package/skills/deco-images-media/references/video.md +122 -0
- package/skills/deco-make-editable/SKILL.md +94 -0
- package/skills/deco-make-editable/references/a11y-and-e2e.md +104 -0
- package/skills/deco-make-editable/references/content-shapes.md +198 -0
- package/skills/deco-make-editable/references/from-figma.md +110 -0
- package/skills/deco-make-editable/references/i18n-fields.md +112 -0
- package/skills/deco-make-editable/references/inventory.md +79 -0
- package/skills/deco-make-editable/references/pixel-parity.md +175 -0
- package/skills/deco-make-editable/references/seeding-content.md +119 -0
- package/skills/deco-nextjs-site/SKILL.md +74 -0
- package/skills/deco-nextjs-site/references/caching.md +116 -0
- package/skills/deco-nextjs-site/references/metadata-seo.md +100 -0
- package/skills/deco-nextjs-site/references/proxy-and-drafts.md +177 -0
- package/skills/deco-nextjs-site/references/rendering.md +171 -0
- package/skills/deco-nextjs-site/references/setup.md +190 -0
- package/skills/deco-nextjs-site/references/studio-bridge.md +130 -0
- package/skills/deco-site-authoring/SKILL.md +75 -0
- package/skills/deco-site-authoring/references/lazy-blocks.md +155 -0
- package/skills/deco-site-authoring/references/loaders.md +192 -0
- package/skills/deco-site-authoring/references/pages.md +156 -0
- package/skills/deco-site-authoring/references/review-before-publish.md +95 -0
- package/skills/deco-site-authoring/references/sections.md +158 -0
- package/skills/deco-site-authoring/references/seo.md +116 -0
- package/skills/deco-site-workflow/SKILL.md +92 -0
- package/skills/deco-site-workflow/references/check.md +116 -0
- package/skills/deco-site-workflow/references/cli-reference.md +104 -0
- package/skills/deco-site-workflow/references/content-layout.md +93 -0
- package/skills/deco-site-workflow/references/content-sync.md +146 -0
- package/skills/deco-site-workflow/references/delivery.md +51 -0
- package/skills/deco-site-workflow/references/deploy.md +87 -0
- package/skills/deco-site-workflow/references/schema.md +173 -0
- package/skills/deco-site-workflow/references/serve-and-studio.md +138 -0
- package/skills/deco-storefront-caching/SKILL.md +67 -0
- package/skills/deco-storefront-caching/references/cache-keys.md +129 -0
- package/skills/deco-storefront-caching/references/case-study.md +82 -0
- package/skills/deco-storefront-caching/references/egress-traps.md +153 -0
- package/skills/deco-storefront-caching/references/nextjs.md +60 -0
- package/skills/deco-storefront-caching/references/perf-guardrails-e2e.md +123 -0
- package/skills/deco-storefront-caching/references/verification.md +136 -0
- package/skills/deco-storefront-caching/references/worker-page-cache.md +160 -0
- package/skills/deco-storefront-caching/scripts/html-anatomy.mjs +97 -0
- package/skills/deco-storefront-performance/SKILL.md +81 -0
- package/skills/deco-storefront-performance/references/cls-third-party.md +90 -0
- package/skills/deco-storefront-performance/references/hydration.md +116 -0
- package/skills/deco-storefront-performance/references/loaders-n-plus-1.md +107 -0
- package/skills/deco-storefront-performance/references/navigation-ux.md +130 -0
- package/skills/deco-storefront-performance/references/payload-trim.md +163 -0
- package/skills/deco-storefront-performance/references/render-location.md +152 -0
- package/skills/deco-storefront-performance/references/request-dedupe.md +147 -0
- package/skills/deco-storefront-performance/references/trace-reading.md +79 -0
- package/skills/deco-storefront-performance/references/worker-memory.md +176 -0
- package/skills/deco-tanstack-site/SKILL.md +68 -0
- package/skills/deco-tanstack-site/references/document-and-security.md +155 -0
- package/skills/deco-tanstack-site/references/router-and-navigation.md +137 -0
- package/skills/deco-tanstack-site/references/routes-and-pages.md +183 -0
- package/skills/deco-tanstack-site/references/server-functions.md +123 -0
- package/skills/deco-tanstack-site/references/setup.md +153 -0
- package/skills/deco-tanstack-site/references/worker-entry.md +152 -0
- package/skills/deco-v7-to-v8-migration/SKILL.md +122 -0
- package/skills/deco-v7-to-v8-migration/references/caching-and-privacy.md +10 -0
- package/skills/deco-v7-to-v8-migration/references/content.md +25 -0
- package/skills/deco-v7-to-v8-migration/references/editor-forms.md +27 -0
- package/skills/deco-v7-to-v8-migration/references/faststore.md +40 -0
- package/skills/deco-v7-to-v8-migration/references/framework-code.md +53 -0
- package/skills/deco-v7-to-v8-migration/references/hosted-releases.md +16 -0
- package/skills/deco-v7-to-v8-migration/references/import-map.md +81 -0
- package/skills/deco-v7-to-v8-migration/references/legacy-names.md +33 -0
- package/skills/deco-v7-to-v8-migration/references/manual-steps.md +10 -0
- package/skills/deco-v7-to-v8-migration/references/native-apps.md +43 -0
- package/skills/deco-v7-to-v8-migration/references/nextjs.md +19 -0
- package/skills/deco-v7-to-v8-migration/references/parity.md +66 -0
- package/skills/deco-v7-to-v8-migration/references/rendering.md +13 -0
- package/skills/deco-v7-to-v8-migration/references/running-the-script.md +29 -0
- package/skills/deco-v7-to-v8-migration/references/script-steps.md +13 -0
- package/skills/deco-v7-to-v8-migration/references/server-functions.md +15 -0
- package/skills/deco-v7-to-v8-migration/references/sibling-port.md +11 -0
- package/skills/deco-v7-to-v8-migration/references/site-code.md +15 -0
- package/skills/deco-v7-to-v8-migration/references/telemetry.md +10 -0
- package/skills/deco-v7-to-v8-migration/references/verify.md +20 -0
- package/skills/deco-v7-to-v8-migration/scripts/apps.ts +297 -0
- package/skills/deco-v7-to-v8-migration/scripts/asyncRendering.ts +73 -0
- package/skills/deco-v7-to-v8-migration/scripts/blockMap.ts +584 -0
- package/skills/deco-v7-to-v8-migration/scripts/ciSchemaCheck.ts +145 -0
- package/skills/deco-v7-to-v8-migration/scripts/compat.ts +357 -0
- package/skills/deco-v7-to-v8-migration/scripts/content.ts +121 -0
- package/skills/deco-v7-to-v8-migration/scripts/experiments.ts +81 -0
- package/skills/deco-v7-to-v8-migration/scripts/framework.ts +61 -0
- package/skills/deco-v7-to-v8-migration/scripts/imageCopy.ts +276 -0
- package/skills/deco-v7-to-v8-migration/scripts/imageModule.ts +285 -0
- package/skills/deco-v7-to-v8-migration/scripts/imports.ts +942 -0
- package/skills/deco-v7-to-v8-migration/scripts/invoke.ts +624 -0
- package/skills/deco-v7-to-v8-migration/scripts/legacyNames.ts +45 -0
- package/skills/deco-v7-to-v8-migration/scripts/main.ts +59 -0
- package/skills/deco-v7-to-v8-migration/scripts/matchers.ts +41 -0
- package/skills/deco-v7-to-v8-migration/scripts/migrate.ts +176 -0
- package/skills/deco-v7-to-v8-migration/scripts/redirects.ts +455 -0
- package/skills/deco-v7-to-v8-migration/scripts/report.ts +50 -0
- package/skills/deco-v7-to-v8-migration/scripts/scaffold.ts +1119 -0
- package/skills/deco-v7-to-v8-migration/scripts/secrets.ts +35 -0
- package/skills/deco-v7-to-v8-migration/scripts/sectionLoaders.ts +216 -0
- package/skills/deco-v7-to-v8-migration/scripts/siteSettings.ts +261 -0
- package/skills/deco-v7-to-v8-migration/scripts/stubs.ts +388 -0
- package/skills/deco-v7-to-v8-migration/scripts/tsconfig.json +7 -0
- package/skills/deco-v7-to-v8-migration/scripts/vendor.ts +249 -0
- package/skills/deco-v7-to-v8-migration/scripts/vtexInvoke.ts +240 -0
- package/skills/deco-v7-to-v8-migration/scripts/walk.ts +30 -0
- package/skills/deco-variants/SKILL.md +57 -0
- package/skills/deco-variants/references/caching-variants.md +63 -0
- package/skills/deco-variants/references/custom-matchers.md +83 -0
- package/skills/deco-variants/references/draft-preview.md +59 -0
- package/skills/deco-variants/references/experiments-and-campaigns.md +104 -0
- package/skills/deco-variants/references/multivariate.md +85 -0
- package/skills/deco-variants/references/v7-matchers.md +71 -0
- package/src/index.ts +2 -0
- package/src/protocol/channel.ts +127 -0
- package/src/protocol/client.ts +2 -2
- package/src/protocol/conformance/blockMetaVectors.json +214 -0
- package/src/protocol/conformance/contentHashFixtures.ts +74 -0
- package/src/protocol/conformance/index.ts +9 -1
- package/src/protocol/conformance/vectors.ts +36 -0
- package/src/protocol/index.ts +32 -0
- package/src/protocol/keys.ts +1 -1
- package/src/v8/background.ts +42 -0
- package/src/v8/blockMeta.ts +100 -0
- package/src/v8/blockStore.ts +124 -0
- package/src/v8/boundedJson.ts +20 -2
- package/src/v8/boundedMap.ts +53 -0
- package/src/v8/builtins/data.ts +26 -2
- package/src/v8/builtins/index.ts +2 -1
- package/src/v8/builtins/legacy.ts +6 -3
- package/src/v8/canonical.ts +15 -0
- package/src/v8/cli/builtins.ts +1 -0
- package/src/v8/cli/check/index.ts +97 -7
- package/src/v8/cli/content.ts +49 -91
- package/src/v8/cli/index.ts +2 -2
- package/src/v8/cli/remote/commands.ts +834 -0
- package/src/v8/cli/remote/diff.ts +100 -0
- package/src/v8/cli/remote/env.ts +107 -0
- package/src/v8/cli/remote/http.ts +484 -0
- package/src/v8/cli/remote/local.ts +343 -0
- package/src/v8/cli/root.ts +40 -0
- package/src/v8/cli/run.ts +366 -135
- package/src/v8/cli/schema/builtinSchemas.ts +29 -10
- package/src/v8/cli/schema/generate.ts +1 -1
- package/src/v8/cli/skills.ts +91 -0
- package/src/v8/client.ts +162 -60
- package/src/v8/cms.ts +62 -53
- package/src/v8/content.ts +179 -229
- package/src/v8/contentIndex.ts +183 -0
- package/src/v8/draft.ts +15 -14
- package/src/v8/draftChanges.ts +151 -85
- package/src/v8/errors.ts +37 -0
- package/src/v8/hostedSource.ts +67 -0
- package/src/v8/identity.ts +1 -1
- package/src/v8/index.ts +1 -0
- package/src/v8/matchRoute.ts +7 -4
- package/src/v8/pin.ts +176 -0
- package/src/v8/preview/StudioBridge.ts +8 -10
- package/src/v8/preview/StudioChannel.ts +116 -0
- package/src/v8/preview/index.ts +3 -0
- package/src/v8/remoteLoader.ts +350 -286
- package/src/v8/resolver.ts +56 -33
- package/src/v8/revisionId.ts +14 -0
- package/src/v8/settings.ts +10 -9
- package/src/v8/telemetry.ts +3 -3
- package/src/v8/types.ts +52 -40
- package/src/v8/variants.ts +30 -26
- package/src/v8/vite/index.ts +3 -3
- package/dist/v8/cli/serve/server.d.ts +0 -29
- package/dist/v8/cli/serve/server.d.ts.map +0 -1
- package/dist/v8/cli/serve/server.js +0 -296
- package/dist/v8/cli/serve/server.js.map +0 -1
- package/src/v8/cli/serve/server.ts +0 -348
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
# Sections
|
|
2
|
+
|
|
3
|
+
A section is a block function whose return type is a React element or a render
|
|
4
|
+
descriptor. `deco schema` reads the block map's default export and puts every key with
|
|
5
|
+
such a return type in Studio's section picker. Its first parameter's type becomes the
|
|
6
|
+
form.
|
|
7
|
+
|
|
8
|
+
## Write the component, then register it
|
|
9
|
+
|
|
10
|
+
1. Write the component in `src/` with a named `Props` interface. Keep it a plain React
|
|
11
|
+
component. It does not know it is a block.
|
|
12
|
+
2. Add a key to the block map. The key is the type name content saves in
|
|
13
|
+
`__resolveType`, so pick it once and keep it (kebab-case, like `promo-banner`).
|
|
14
|
+
3. Run `deco schema` (or keep `deco schema --watch` running), then place the section on
|
|
15
|
+
a page in Studio or in `.deco/blocks/<Page>.json`.
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
// src/model.ts
|
|
19
|
+
export interface PromoBannerProps {
|
|
20
|
+
/** @title Text */
|
|
21
|
+
title: string;
|
|
22
|
+
/** @title Link */
|
|
23
|
+
href: string;
|
|
24
|
+
}
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
```tsx
|
|
28
|
+
// src/PromoBanner.tsx
|
|
29
|
+
import type { PromoBannerProps } from "./model";
|
|
30
|
+
|
|
31
|
+
export default function PromoBanner({ title, href }: PromoBannerProps) {
|
|
32
|
+
return <a href={href}>{title}</a>;
|
|
33
|
+
}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
```json
|
|
37
|
+
{ "__resolveType": "promo-banner", "title": "Free shipping over $50", "href": "/shipping" }
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
The JSDoc tags, widgets (`ImageWidget`, `RichText`, `Color` from
|
|
41
|
+
`@decocms/compat-v7/types/widgets`), field order and shapes that break the form are in
|
|
42
|
+
the `deco-cms-schema` skill. Do not repeat them here.
|
|
43
|
+
|
|
44
|
+
## Descriptors or elements: follow the binding
|
|
45
|
+
|
|
46
|
+
What the block function returns depends on how the site renders. Check the existing
|
|
47
|
+
block map before you add a key, and do what the other sections do.
|
|
48
|
+
|
|
49
|
+
| Site | Block function returns | Who renders the component |
|
|
50
|
+
|---|---|---|
|
|
51
|
+
| TanStack Start (no RSC), as in `examples/tanstack-worker-smoke` | A descriptor: `{ component: "promo-banner", props: input }` | The catch-all route maps `component` to a React component |
|
|
52
|
+
| Next.js App Router (`examples/nextjs-binding-smoke`) or TanStack Start with RSC (`examples/tanstack-rsc-smoke`) | An element: `<PromoBanner {...input} />` | The block function, on the server |
|
|
53
|
+
|
|
54
|
+
Descriptor mode:
|
|
55
|
+
|
|
56
|
+
```ts
|
|
57
|
+
// .deco/index.ts
|
|
58
|
+
import type { Blocks, Seo } from "@decocms/blocks";
|
|
59
|
+
import type { BlockDescriptor, PromoBannerProps } from "../src/model";
|
|
60
|
+
|
|
61
|
+
export default {
|
|
62
|
+
seo: (input: Seo) => input,
|
|
63
|
+
"promo-banner": (input: PromoBannerProps): BlockDescriptor => ({
|
|
64
|
+
component: "promo-banner",
|
|
65
|
+
props: input,
|
|
66
|
+
}),
|
|
67
|
+
} satisfies Blocks;
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
`BlockDescriptor` is a union the site owns, one member per section:
|
|
71
|
+
|
|
72
|
+
```ts
|
|
73
|
+
export type BlockDescriptor =
|
|
74
|
+
| { component: "promo-banner"; props: PromoBannerProps }
|
|
75
|
+
| { component: "product-hero"; props: ProductHeroProps };
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Adding a section in descriptor mode takes three edits: the union member, the block map
|
|
79
|
+
key, and a `case` in the route's view switch. If you skip the `case`, the section
|
|
80
|
+
resolves but renders nothing. Why descriptors: on TanStack Start the page's block
|
|
81
|
+
promises go through a server function, so they carry data, not elements.
|
|
82
|
+
|
|
83
|
+
Element mode:
|
|
84
|
+
|
|
85
|
+
```tsx
|
|
86
|
+
// .deco/index.tsx
|
|
87
|
+
export default {
|
|
88
|
+
"promo-banner": (input: PromoBannerProps) => <PromoBanner {...input} />,
|
|
89
|
+
} satisfies Blocks;
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Keep `satisfies Blocks`, not a type annotation. `satisfies` keeps each function's exact
|
|
93
|
+
type, and `deco schema` needs it to build the forms and to know which blocks fit which
|
|
94
|
+
fields.
|
|
95
|
+
|
|
96
|
+
## Interactivity: client components, not islands or HTMX
|
|
97
|
+
|
|
98
|
+
v8 has no islands folder and no HTMX. A section is a normal React tree.
|
|
99
|
+
|
|
100
|
+
- Put state, effects and event handlers in a small component in its own file, marked
|
|
101
|
+
`"use client"` at the top (like `src/CartButton.tsx` in the examples), and render it
|
|
102
|
+
from the section.
|
|
103
|
+
- In element mode the section runs on the server as a Server Component, so hooks in the
|
|
104
|
+
section file itself fail. Only the `"use client"` file hydrates.
|
|
105
|
+
- In descriptor mode the whole route tree hydrates. The examples still keep
|
|
106
|
+
`"use client"` on interactive files, so the same component works in both modes.
|
|
107
|
+
- Keep the section's props serializable data. Do not pass functions or class instances
|
|
108
|
+
from content into a client component.
|
|
109
|
+
- An action that needs the server (add to cart, newsletter signup) is a server function
|
|
110
|
+
on TanStack Start or a server action on Next.js. There is no `/deco/invoke`. See the
|
|
111
|
+
`deco-tanstack-site` and `deco-nextjs-site` skills.
|
|
112
|
+
|
|
113
|
+
Porting a Fresh section: `class` becomes `className`, `islands/X.tsx` becomes a
|
|
114
|
+
`"use client"` component, and each `hx-*` request becomes a server function called from
|
|
115
|
+
a client component.
|
|
116
|
+
|
|
117
|
+
## Sections inside sections
|
|
118
|
+
|
|
119
|
+
A field typed `ReactNode` or `ReactNode[]` (in element mode) or the site's descriptor
|
|
120
|
+
type (in descriptor mode) becomes a section picker in Studio. Use it for layout
|
|
121
|
+
sections that hold other sections, like a two-column block. The children resolve before
|
|
122
|
+
the parent runs, so the parent gets finished elements or descriptors.
|
|
123
|
+
|
|
124
|
+
## Data a section needs
|
|
125
|
+
|
|
126
|
+
A section should not fetch. Give it a prop typed with the data it needs (`product:
|
|
127
|
+
Product`) and let the content plug a loader into that prop. A loader block whose
|
|
128
|
+
return type fits the prop shows up as a choice in the form. See
|
|
129
|
+
[loaders.md](./loaders.md).
|
|
130
|
+
|
|
131
|
+
If fetching the data is expensive and the section may not need it, type the prop
|
|
132
|
+
`Lazy<T>` and call it only when needed. See [lazy-blocks.md](./lazy-blocks.md).
|
|
133
|
+
|
|
134
|
+
## Things the generator warns about
|
|
135
|
+
|
|
136
|
+
`deco schema` prints these. Fix them before you push. An error (the last two) means
|
|
137
|
+
the schema file is not written at all.
|
|
138
|
+
|
|
139
|
+
- `"<key>": its props are typed any, so its form is empty`: give the parameter a real
|
|
140
|
+
type.
|
|
141
|
+
- `"<key>": returns any, so it isn't offered for any field`: annotate the return type.
|
|
142
|
+
- `"<key>" isn't a function`: every block map value must be a function.
|
|
143
|
+
- `"<key>": has a "path" field but its type doesn't extend Route`: a `path` field makes
|
|
144
|
+
a block routable. Rename the field, or extend `Route` on purpose (see
|
|
145
|
+
[pages.md](./pages.md)).
|
|
146
|
+
|
|
147
|
+
## Rendering rules
|
|
148
|
+
|
|
149
|
+
- **Render nothing for `undefined`.** A section an editor hid with a rule resolves to
|
|
150
|
+
`undefined` and is dropped from the list. The route must not crash on it.
|
|
151
|
+
- **Do not mutate what props hold.** The props object itself is a fresh copy, but a
|
|
152
|
+
loader result inside it is shared: the same block with the same inputs runs once per
|
|
153
|
+
request, and every place that uses it gets the same object. Copy before you change it.
|
|
154
|
+
- **Keep editable text in props.** A string a merchant would change belongs in the
|
|
155
|
+
Props type, not in the component.
|
|
156
|
+
- **Keep layout choices few.** A prop that only picks spacing or color is a design
|
|
157
|
+
token. Use one when editors truly need it, and keep content fields first. The
|
|
158
|
+
`deco-cms-schema` skill covers this.
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
# SEO and JSON-LD
|
|
2
|
+
|
|
3
|
+
A page's title, description, canonical and structured data come from its `seo` field.
|
|
4
|
+
It is a block like any other, resolved on the server before the response is sent, so
|
|
5
|
+
crawlers and people get the same HTML. There is no deferred SEO section, no HTMX
|
|
6
|
+
head-support, and no separate bot render on v8.
|
|
7
|
+
|
|
8
|
+
## The `seo` field
|
|
9
|
+
|
|
10
|
+
The built-in `page` has an optional `seo` field. Studio offers any block that returns:
|
|
11
|
+
|
|
12
|
+
- `Seo` from `@decocms/blocks`: `{ title: string; description: string }`, or
|
|
13
|
+
- an object whose fields are all optional, with a string `title` or `description`
|
|
14
|
+
(a richer type of the site's own, such as a `PageSeo` with `canonical` and `jsonLDs`).
|
|
15
|
+
|
|
16
|
+
A loader whose result has required fields (a post with a required `title` and
|
|
17
|
+
`excerpt`) is content, not SEO, and is not offered.
|
|
18
|
+
|
|
19
|
+
The smallest setup is the one in the examples: a block that returns its input.
|
|
20
|
+
|
|
21
|
+
```ts
|
|
22
|
+
export default {
|
|
23
|
+
seo: (input: Seo) => input,
|
|
24
|
+
// ...sections
|
|
25
|
+
} satisfies Blocks;
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
The page loader resolves `page.seo` (after starting every section, so SEO does not
|
|
29
|
+
delay them), and the route turns it into tags: `head()` on TanStack Start,
|
|
30
|
+
`generateMetadata` on Next.js. Without `seo`, the root layout's defaults apply. The
|
|
31
|
+
head wiring is in the `deco-tanstack-site` and `deco-nextjs-site` skills.
|
|
32
|
+
|
|
33
|
+
## Feed SEO from the same loader as the page
|
|
34
|
+
|
|
35
|
+
On a product or listing page, the title, description, canonical and JSON-LD come from
|
|
36
|
+
the same product or listing the page shows. Do not fetch it twice, and do not type it
|
|
37
|
+
by hand into content.
|
|
38
|
+
|
|
39
|
+
Write an SEO block that takes the same param as the section and resolves the same
|
|
40
|
+
loader through the current client:
|
|
41
|
+
|
|
42
|
+
```ts
|
|
43
|
+
import { currentClient } from "@decocms/blocks";
|
|
44
|
+
import type { Product } from "@decocms/compat-v7/commerce/types";
|
|
45
|
+
|
|
46
|
+
export interface PageSeo {
|
|
47
|
+
title?: string;
|
|
48
|
+
description?: string;
|
|
49
|
+
canonical?: string;
|
|
50
|
+
noIndexing?: boolean;
|
|
51
|
+
jsonLDs?: Record<string, unknown>[];
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export interface ProductSeoProps {
|
|
55
|
+
/** @ignore */
|
|
56
|
+
slug?: string;
|
|
57
|
+
/** @title Title template, %s is the product name */
|
|
58
|
+
titleTemplate?: string;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export async function productSeo({ slug, titleTemplate = "%s" }: ProductSeoProps): Promise<PageSeo> {
|
|
62
|
+
const client = currentClient(); // before any await
|
|
63
|
+
const [product, error] = await client.resolve<Product>({ __resolveType: "product-by-slug", slug });
|
|
64
|
+
if (error || !product) return { noIndexing: true };
|
|
65
|
+
return {
|
|
66
|
+
title: titleTemplate.replace("%s", product.name ?? ""),
|
|
67
|
+
description: product.description,
|
|
68
|
+
jsonLDs: [{ "@context": "https://schema.org", ...product }],
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
```json
|
|
74
|
+
"seo": { "__resolveType": "product-seo", "titleTemplate": "%s | Store" }
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
The page loader passes `slug` to `seo` the same way it passes it to the sections (see
|
|
78
|
+
[pages.md](./pages.md)). Both resolve `product-by-slug` with the same inputs on the
|
|
79
|
+
same client, so the upstream call runs once and both get the same object (see
|
|
80
|
+
[loaders.md](./loaders.md)). If they pass different inputs (one adds a field the other
|
|
81
|
+
does not), they make two calls. Keep the loader inputs identical.
|
|
82
|
+
|
|
83
|
+
For a listing page, do the same with the listing loader. `ProductListingPage` and
|
|
84
|
+
`ProductDetailsPage` in `@decocms/compat-v7/commerce/types` carry an optional `seo`
|
|
85
|
+
(`title`, `description`, `canonical`, `noIndexing`) when the platform provides one, and
|
|
86
|
+
`canonicalFromBreadcrumblist` in `@decocms/compat-v7/commerce/utils/canonical` returns
|
|
87
|
+
the `item` URL of the breadcrumb with the highest `position`.
|
|
88
|
+
|
|
89
|
+
## JSON-LD
|
|
90
|
+
|
|
91
|
+
- Emit each structured-data object once, as `<script type="application/ld+json">`. If
|
|
92
|
+
the route emits `jsonLDs` from `seo`, no section should render the same object again.
|
|
93
|
+
- Escape `<` in the serialized JSON (`JSON.stringify(x).replace(/</g, "\\u003c")`), so
|
|
94
|
+
a product description with `</script>` cannot end the tag.
|
|
95
|
+
- Product JSON-LD from a platform `Product` is large. Trim it to what rich results use
|
|
96
|
+
(name, image, description, sku, brand, offers with price, currency and availability,
|
|
97
|
+
aggregate rating) before you serialize it.
|
|
98
|
+
- A block that renders nothing and only feeds data (fonts, a JSON-LD helper) can take
|
|
99
|
+
its data as `Lazy<T>`, so nothing is fetched when it is not used. See
|
|
100
|
+
[lazy-blocks.md](./lazy-blocks.md).
|
|
101
|
+
|
|
102
|
+
## Checklist for a site
|
|
103
|
+
|
|
104
|
+
1. The root layout sets a default title, description, `og:site_name` and `lang`.
|
|
105
|
+
2. Every page has `seo`, or relies on the defaults on purpose.
|
|
106
|
+
3. Product and listing pages use an SEO block that resolves the same loader, with the
|
|
107
|
+
same inputs, as the main section.
|
|
108
|
+
4. Empty listing pages and not-found products set `noIndexing` (or the route returns
|
|
109
|
+
404). Drafts are already sent with `X-Robots-Tag: noindex, nofollow` by the
|
|
110
|
+
bindings' draft response headers.
|
|
111
|
+
5. A canonical URL is set on pages that can be reached with tracking or filter params.
|
|
112
|
+
6. JSON-LD appears once per object.
|
|
113
|
+
7. Check one page of each type with `curl -s <url> | grep -E "<title|og:|ld\+json|canonical"`.
|
|
114
|
+
v8 sends the same HTML to bots and people, so one request is enough.
|
|
115
|
+
|
|
116
|
+
Coverage audits, `robots.txt` and sitemaps are not part of this skill.
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: deco-site-workflow
|
|
3
|
+
description: "End-to-end workflow for a site on @decocms/blocks 8 with the `deco` CLI it ships. Covers where content lives (.deco/index.ts, .deco/schema.gen.json, .deco/blocks, block names and files), generating the schema (`deco schema`, `--check`, `--watch`) and sending it to Studio (`deco schema push`, run on every production deploy with a DECO_TOKEN), validating content (`deco check` against production, a draft or a revision), syncing content (`pull`, `diff`, `push --draft`, `drafts`, `publish`, `releases`, rollback), editing a site in deco Studio now that `deco serve` is gone (8.10+), how published releases reach the site from the CDN, every command, flag, env var (DECO_SITE, DECO_TOKEN, DECO_STUDIO_URL, DECO_STUDIO_ORIGIN) and exit code. Load it when setting up or deploying a v8 site, when Studio asks you to send the schema or connect deco serve, when a deco command fails or exits non-zero, when `deco check` fails, or when content differs between Studio, a draft, local dev and production."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Deco site workflow (@decocms/blocks 8)
|
|
7
|
+
|
|
8
|
+
A v8 site has two things that change on different schedules:
|
|
9
|
+
|
|
10
|
+
- **Code**: the block map in `.deco/index.ts` and the functions it registers. It ships with a deploy.
|
|
11
|
+
`deco schema` turns its types into `.deco/schema.gen.json`, which Studio uses to draw forms.
|
|
12
|
+
- **Content**: saved blocks (JSON). With `createCMS({ blocks, site })` the site reads them at runtime
|
|
13
|
+
from the delivery CDN. Studio and the `deco` CLI write drafts. Only `deco publish` (or Studio's
|
|
14
|
+
publish) makes a draft live, and no deploy is needed.
|
|
15
|
+
|
|
16
|
+
The `deco` CLI is the `bin` of `@decocms/blocks`. It connects the two: it sends the schema to Studio,
|
|
17
|
+
checks content against the code, and moves content between `.deco/blocks` and Studio.
|
|
18
|
+
|
|
19
|
+
This skill covers the 8.10+ CLI (content on the CDN). `deco serve` was removed in 8.10.0. See
|
|
20
|
+
[serve-and-studio.md](./references/serve-and-studio.md).
|
|
21
|
+
|
|
22
|
+
## When to load what
|
|
23
|
+
|
|
24
|
+
| Reference | Load it when |
|
|
25
|
+
|---|---|
|
|
26
|
+
| [`references/schema.md`](./references/schema.md) | Studio says to send the schema; forms are missing or stale; wiring `deco schema push` into CI or the deploy; `deco schema` fails |
|
|
27
|
+
| [`references/serve-and-studio.md`](./references/serve-and-studio.md) | Studio says to connect `deco serve`; connecting a site to Studio; the page doesn't load or edit inside Studio; a draft link shows production |
|
|
28
|
+
| [`references/content-sync.md`](./references/content-sync.md) | Editing content from the terminal: `pull`, `diff`, `push --draft`, conflicts, `drafts`, `publish`, `releases`, rollback |
|
|
29
|
+
| [`references/check.md`](./references/check.md) | `deco check` prints errors or warnings, or you want it as a gate |
|
|
30
|
+
| [`references/content-layout.md`](./references/content-layout.md) | What each file in `.deco/` is, block names and file names, `__resolveType`, references, the built-in blocks, what goes in git |
|
|
31
|
+
| [`references/delivery.md`](./references/delivery.md) | A publish doesn't show on the site; a site fails with `LOADER_FAILED`; how the CDN, polling and draft previews work |
|
|
32
|
+
| [`references/deploy.md`](./references/deploy.md) | Setting up CI and the deploy: order of schema push, check and publish; where `DECO_SITE`, `DECO_TOKEN` and other secrets live |
|
|
33
|
+
| [`references/cli-reference.md`](./references/cli-reference.md) | The exact flags, env vars, exit codes, `--json` output and common error lines of every command |
|
|
34
|
+
|
|
35
|
+
## The loop, in commands
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
# code changed
|
|
39
|
+
deco schema # .deco/index.ts -> .deco/schema.gen.json (commit it)
|
|
40
|
+
deco check # production content against this code
|
|
41
|
+
# ...deploy, then on production only:
|
|
42
|
+
deco schema push # Studio's forms follow the deployed code
|
|
43
|
+
|
|
44
|
+
# content from the terminal
|
|
45
|
+
deco pull # production into .deco/blocks (or --draft=<name>)
|
|
46
|
+
# edit .deco/blocks/*.json
|
|
47
|
+
deco diff
|
|
48
|
+
deco push --draft=my-change # never goes live; prints a preview link
|
|
49
|
+
deco check --draft=my-change # the draft as a whole, against this code
|
|
50
|
+
deco publish --draft=my-change # goes live; no deploy
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Every command finds `.deco/` by walking up from the current folder (or takes `--root`). Every command
|
|
54
|
+
takes `--json`.
|
|
55
|
+
|
|
56
|
+
## Exit codes
|
|
57
|
+
|
|
58
|
+
| Code | Meaning | What to do |
|
|
59
|
+
|---|---|---|
|
|
60
|
+
| 0 | ok | |
|
|
61
|
+
| 1 | failed (check errors, bad file, missing schema, CDN 4xx) | Read the message |
|
|
62
|
+
| 2 | conflict on `deco push` | Pull again, or push with `--ours` / `--theirs` |
|
|
63
|
+
| 3 | auth: no token, or Studio answered 401/403 | Set `DECO_TOKEN`, or `npx decocms auth login` |
|
|
64
|
+
| 4 | network: Studio or CDN unreachable, timed out, or 5xx | Retry later |
|
|
65
|
+
| 5 | busy: Studio answered 429, 503 `unavailable` or 409 `production_moved` | Run the same command again |
|
|
66
|
+
| 64 | usage: unknown command or flag, no `DECO_SITE`, no `.deco/` for a remote command | Fix the command line or config |
|
|
67
|
+
|
|
68
|
+
## Get these skills into a site
|
|
69
|
+
|
|
70
|
+
These skills live in the `decocms/blocks` repository, under `.agents/skills/` on `main`. The
|
|
71
|
+
`@decocms/blocks` package doesn't ship them and the `deco` CLI has no command that installs them.
|
|
72
|
+
Copy or link the folders you need into the site's `.claude/skills`.
|
|
73
|
+
|
|
74
|
+
## Related skills
|
|
75
|
+
|
|
76
|
+
- `deco-cms-schema`: how a Props type becomes a form, and the shapes that break it.
|
|
77
|
+
- `deco-site-authoring`: writing sections, pages and loaders.
|
|
78
|
+
- `deco-tanstack-site` / `deco-nextjs-site`: wiring `createCMS`, routes, the worker, the Studio bridge.
|
|
79
|
+
- `deco-make-editable`: turning hardcoded content into blocks and seeding it with `deco push`.
|
|
80
|
+
- `deco-variants`: multivariate blocks, tests and campaigns.
|
|
81
|
+
- `deco-storefront-caching`: page caches keyed on the content revision.
|
|
82
|
+
- `deco-v7-to-v8-migration`: sites still on v7 or on bundled content.
|
|
83
|
+
- `deco-control-plane-ops` (decocms/skills): env vars, secrets and deploys on deco's hosting.
|
|
84
|
+
|
|
85
|
+
## Rules
|
|
86
|
+
|
|
87
|
+
- Never commit a token. `DECO_TOKEN` lives in CI secrets or your shell, not in `.env` files in git.
|
|
88
|
+
- `deco push` never publishes. Only `deco publish` goes live. Check the draft before you publish it.
|
|
89
|
+
- Commit `.deco/schema.gen.json`. For a site with `DECO_SITE`, keep `.deco/blocks/` and
|
|
90
|
+
`.deco/pull.json` out of git: they are a working copy of Studio's content.
|
|
91
|
+
- Push the schema only from production deploys. A preview branch that pushes makes Studio's forms
|
|
92
|
+
describe code that isn't live.
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
# `deco check`: content against code
|
|
2
|
+
|
|
3
|
+
`deco check` validates saved blocks against `.deco/schema.gen.json`, the schema of the code in your
|
|
4
|
+
folder. It writes nothing, generates no schema and loads no TypeScript. So run `deco schema` first,
|
|
5
|
+
or it checks against a stale file.
|
|
6
|
+
|
|
7
|
+
## Which content it checks
|
|
8
|
+
|
|
9
|
+
| Command | Checks | Needs |
|
|
10
|
+
|---|---|---|
|
|
11
|
+
| `deco check` with `DECO_SITE` set | **Production**: the live release, read from the CDN | `DECO_SITE`; no token |
|
|
12
|
+
| `deco check` with no `DECO_SITE` anywhere | The local `.deco/blocks` (a bundled site) | nothing |
|
|
13
|
+
| `deco check --draft=<name>` | Production with that draft on top | `DECO_SITE` and a token |
|
|
14
|
+
| `deco check --revision=<id>` | One published revision (ids from `deco releases`) | `DECO_SITE` |
|
|
15
|
+
|
|
16
|
+
`--draft` and `--revision` together are a usage error (64). A malformed id is
|
|
17
|
+
`"<id>" isn't a revision id (deco releases lists them)` (64). An id the CDN doesn't have is
|
|
18
|
+
`no revision <id> on the CDN` (1).
|
|
19
|
+
|
|
20
|
+
**Trap:** on a hosted site, plain `deco check` ignores your local edits in `.deco/blocks`. It checks
|
|
21
|
+
production. To check edits, push them to a draft and run `deco check --draft=<name>`. Pushing never
|
|
22
|
+
publishes, so this is safe.
|
|
23
|
+
|
|
24
|
+
It prints `checking production (revision <id>)` (or the draft or revision), then problems grouped by
|
|
25
|
+
file, then a summary:
|
|
26
|
+
|
|
27
|
+
```text
|
|
28
|
+
.deco/blocks/Home.json
|
|
29
|
+
sections[2].title: 214 characters, max 60
|
|
30
|
+
warning: sections[4]: can never be picked: variants[0] has an always rule
|
|
31
|
+
39 saved blocks checked: 1 error, 1 warning
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Exit 0 when there are no errors (warnings don't fail it), 1 otherwise. With `--json`, stdout is
|
|
35
|
+
`{ ok, blocks, errors, warnings, problems: [{ file, path, message, severity }] }`.
|
|
36
|
+
|
|
37
|
+
## Use it as a gate
|
|
38
|
+
|
|
39
|
+
- **Before a deploy:** `deco schema && deco check` checks that the live content fits the new code. A
|
|
40
|
+
removed block type, a renamed or newly required field shows up here, before the deploy breaks pages.
|
|
41
|
+
- **Before a publish:** `deco check --draft=<name>`. `deco publish` doesn't check.
|
|
42
|
+
- **Before a rollback:** `deco check --revision=<id>`.
|
|
43
|
+
|
|
44
|
+
Where these go in CI: [deploy.md](./deploy.md).
|
|
45
|
+
|
|
46
|
+
## Field errors
|
|
47
|
+
|
|
48
|
+
Each line is `<path>: <message>`, with the path inside the block (`sections[2].title`).
|
|
49
|
+
|
|
50
|
+
| Message | Means | Fix |
|
|
51
|
+
|---|---|---|
|
|
52
|
+
| `required` | The type requires a field the content lacks | Add it, or make the field optional in the type |
|
|
53
|
+
| `unknown field` | The content has a field no type declares | Delete it, or add it to the type |
|
|
54
|
+
| `214 characters, max 60` / `min` | String length outside the type's limits | Shorten the text or relax the limit |
|
|
55
|
+
| `5, max 3` / `min`, `must be under`, `must be over` | Number out of range | |
|
|
56
|
+
| `4 items, max 3` / `min` | List length out of range | |
|
|
57
|
+
| `"xl" isn't one of "sm", "md", "lg"` | Not an allowed option | Use one of them, or add it to the type |
|
|
58
|
+
| `expected a string, got a number` | Wrong JSON type | |
|
|
59
|
+
| `"…" isn't a valid date-time` | Format check (`date`, `date-time`, `uri`) | ISO dates with an offset; absolute URLs |
|
|
60
|
+
| `doesn't match the pattern …` | Pattern check | |
|
|
61
|
+
| `doesn't match any allowed form` | A union where no branch fits | Compare with each branch of the type |
|
|
62
|
+
|
|
63
|
+
How types and JSDoc tags turn into these rules is the `deco-cms-schema` skill.
|
|
64
|
+
|
|
65
|
+
## Block errors
|
|
66
|
+
|
|
67
|
+
| Message | Means | Fix |
|
|
68
|
+
|---|---|---|
|
|
69
|
+
| `no saved block or block type "<name>"` | `__resolveType` names nothing: a deleted saved block still referenced, or a type the code no longer exports | Remove the reference, restore the block, or deploy the type first |
|
|
70
|
+
| `"<type>" doesn't fit here: its function doesn't return this field's type` | A block in a field whose type it doesn't produce | Use a block of the right kind |
|
|
71
|
+
| `"<type>" doesn't fit here: this field takes a plain value` | A block where a plain value is expected | Write the value |
|
|
72
|
+
| `saved block "<name>" (a "<type>") doesn't fit here: …` | A reference to a saved block of the wrong kind | Reference another block |
|
|
73
|
+
| `this field is Lazy<T>: wrap the value in a lazy block` / `a lazy block only fits a Lazy<T> field` | Lazy fields need `{ "__resolveType": "lazy", "value": … }`, and only they take one | Wrap or unwrap |
|
|
74
|
+
| `references form a cycle: A → B → A` | Saved blocks that reference each other | Break the loop |
|
|
75
|
+
| `saved block "<name>" has the name of an alias` (or `of a built-in block`, `of a block type`) | Saved block names share one namespace with block types, built-ins and v7 aliases | Rename it |
|
|
76
|
+
| `missing __resolveType: a saved block names the function it calls` | The file has no `__resolveType` | Add it |
|
|
77
|
+
| `"<path>" is also the path of "<other>"` / `matches the same URLs as …` | Two pages (or two redirect `from`s) route the same URLs | Change one path |
|
|
78
|
+
| `a rule must be a block whose function returns a boolean` | A variant `rule` that isn't a matcher | |
|
|
79
|
+
| `a variant's value must be a lazy block` | Variant values are wrapped in `lazy` | |
|
|
80
|
+
| `no test "<name>" in the saved block "experiments": this rule is always false` | An `experiment` rule names a missing test | Add the test or fix the name |
|
|
81
|
+
| `no campaign "<name>" in the saved block "campaigns": this rule is always false` | Same, for campaigns | |
|
|
82
|
+
| `unknown block type "date": …` | The prerelease `date` rule | Use a `campaign` rule as the message says |
|
|
83
|
+
| `unknown block type "secret"` (or `telemetry`, `analytics`, `date-windows`) `: …` | A removed built-in | Follow the message. Secrets belong in the deploy platform, read by code |
|
|
84
|
+
|
|
85
|
+
## Warnings
|
|
86
|
+
|
|
87
|
+
| Message | Fix |
|
|
88
|
+
|---|---|
|
|
89
|
+
| `can never be picked: variants[i] has an always rule` | Variants after an `always` rule are dead: reorder or delete |
|
|
90
|
+
| `this campaign rule names no campaign, so it is always false: …` | Name a campaign |
|
|
91
|
+
| `the campaign "<key>" ends before it starts, so it never runs: …` | Fix the dates |
|
|
92
|
+
| `not routed; move it into the redirects block` | A per-rule `redirect` block: move its rule into `Redirects` |
|
|
93
|
+
| `v7 redirect block (type …) isn't routed: …` | Fold its rules into `Redirects` and delete it |
|
|
94
|
+
| `another redirects block, "<name>", is the one routed; this one is ignored. …` | Keep one `redirects` block |
|
|
95
|
+
| `"CMS" is the name of the CMS settings block …`, `"experiments" is the saved block every experiment rule reads …` | A saved block uses a reserved role name with the wrong type: rename it |
|
|
96
|
+
| `the block map has its own "<name>", in place of the built-in: …` | Your block map replaces a built-in. Rename yours unless you mean it |
|
|
97
|
+
| `the site editor now keeps the addresses this site can be previewed on, …` | Delete the old `preview` field from the `CMS` block |
|
|
98
|
+
|
|
99
|
+
## File problems
|
|
100
|
+
|
|
101
|
+
| Message | Severity | Fix |
|
|
102
|
+
|---|---|---|
|
|
103
|
+
| `invalid JSON: …` | error | Fix the file |
|
|
104
|
+
| `a saved block must be a JSON object` | error | |
|
|
105
|
+
| `not a valid entry name (…); rename the file` | error | See the name rules in [content-layout.md](./content-layout.md) |
|
|
106
|
+
| `subfolders of .deco/blocks aren't read` | warning | Move the file up |
|
|
107
|
+
| `another spelling of "<name>"; <file> wins` | warning | Delete the other spelling |
|
|
108
|
+
|
|
109
|
+
A file error also stops `deco push` and `deco diff` before they send or compare anything.
|
|
110
|
+
|
|
111
|
+
## Schema file problems
|
|
112
|
+
|
|
113
|
+
| Message | Fix |
|
|
114
|
+
|---|---|
|
|
115
|
+
| `no <root>/.deco/schema.gen.json; run deco schema first` | `deco schema` |
|
|
116
|
+
| `… has no top-level "blocksMajor"; expected "blocksMajor": 8. …` | Regenerate with the v8 CLI, commit |
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
# `deco` CLI reference (@decocms/blocks 8.10+)
|
|
2
|
+
|
|
3
|
+
The `deco` bin ships in `@decocms/blocks` (`npx deco`, `bunx deco`, or `deco` in package scripts).
|
|
4
|
+
The same commands are importable from `@decocms/blocks/cli` (`runCli`, `schema`, `check`,
|
|
5
|
+
`content`).
|
|
6
|
+
|
|
7
|
+
## Commands
|
|
8
|
+
|
|
9
|
+
| Command | Flags | Does |
|
|
10
|
+
|---|---|---|
|
|
11
|
+
| `deco login` | | Prints how to log in: `npx decocms auth login --target=<studio>`, or set `DECO_TOKEN` to a Studio API key in CI. It doesn't log you in |
|
|
12
|
+
| `deco pull` | `--draft=<name>`, `--force` | Production, or production plus a draft, into `.deco/blocks` |
|
|
13
|
+
| `deco diff` | `--draft=<name>` | `.deco/blocks` against what was pulled, or against a draft |
|
|
14
|
+
| `deco push` | `--draft=<name>` (required), `--ours` \| `--theirs`, `--prune` | Changed blocks into a draft, as one save; deletes only with `--prune` |
|
|
15
|
+
| `deco publish` | `--draft=<name>` (required), `--message=<text>` | Makes a draft live |
|
|
16
|
+
| `deco drafts` | `list` \| `new <name>` \| `discard <name>` \| `url <name>` | Manage drafts |
|
|
17
|
+
| `deco releases` | `--cursor=<cursor>` | Published revisions, newest first, 50 a page |
|
|
18
|
+
| `deco check` | `--draft=<name>` \| `--revision=<id>` | Content against `.deco/schema.gen.json` |
|
|
19
|
+
| `deco content` | `--watch` | `.deco/blocks` into `.deco/blocks.gen.ts`, for content without a site |
|
|
20
|
+
| `deco schema` | `--watch` \| `--check` | `.deco/index.ts` into `.deco/schema.gen.json` |
|
|
21
|
+
| `deco schema push` | | Uploads `.deco/schema.gen.json` to Studio |
|
|
22
|
+
| `deco help`, `--help`, `-h` | | Usage (exit 0). No command at all prints usage and exits 64 |
|
|
23
|
+
|
|
24
|
+
Details: [content-sync.md](./content-sync.md) (pull, diff, push, drafts, publish, releases),
|
|
25
|
+
[check.md](./check.md), [schema.md](./schema.md).
|
|
26
|
+
|
|
27
|
+
`deco serve` (removed in 8.10.0), `deco dev`, `deco build`, `deco generate` and `deco migrate` are not
|
|
28
|
+
commands: `unknown command "<name>"`, exit 64. See [serve-and-studio.md](./serve-and-studio.md).
|
|
29
|
+
|
|
30
|
+
## Flags every command takes
|
|
31
|
+
|
|
32
|
+
| Flag | Does |
|
|
33
|
+
|---|---|
|
|
34
|
+
| `--root <dir>` | The folder that contains `.deco/` (else: walk up from the current folder) |
|
|
35
|
+
| `--json` | stdout carries exactly one JSON object; everything a person reads goes to stderr |
|
|
36
|
+
| `--color` / `--no-color` | Force colour on or off (default: on when stdout and stderr are terminals and no `--json`) |
|
|
37
|
+
|
|
38
|
+
Flag values take `--name=value` or `--name value`. Boolean flags take no value
|
|
39
|
+
(`--force=true` is a usage error). Unknown flags and extra arguments are usage errors (64).
|
|
40
|
+
|
|
41
|
+
## Environment
|
|
42
|
+
|
|
43
|
+
| Variable | Used for | Default |
|
|
44
|
+
|---|---|---|
|
|
45
|
+
| `DECO_SITE` | The Studio site of every remote command | none. Looked up in the environment, then `.env`, `.dev.vars`, `wrangler.jsonc`, `wrangler.json`, `wrangler.toml` (`vars.DECO_SITE`) in the root |
|
|
46
|
+
| `DECO_TOKEN` | Bearer token for Studio (a Studio API key) | the output of `npx decocms auth token --target=<DECO_STUDIO_URL>` |
|
|
47
|
+
| `DECO_STUDIO_URL` | Studio API base | `https://studio.decocms.com` |
|
|
48
|
+
|
|
49
|
+
Reads of production and of past revisions go to `https://delivery.decocms.com` with no token. Drafts
|
|
50
|
+
are resolved through Studio, so they need one.
|
|
51
|
+
|
|
52
|
+
## Exit codes
|
|
53
|
+
|
|
54
|
+
| Code | Name | When |
|
|
55
|
+
|---|---|---|
|
|
56
|
+
| 0 | ok | |
|
|
57
|
+
| 1 | failed | `deco check` found errors; `deco schema` had errors or `--check` found the file missing or stale; a bad local file; the CDN answered 4xx; Studio answered another 4xx; any other failure |
|
|
58
|
+
| 2 | conflict | `deco push`: a block changed in the draft since your pull |
|
|
59
|
+
| 3 | auth | No token; Studio answered 401 or 403; a save refused as unauthorized |
|
|
60
|
+
| 4 | network | Studio or the CDN unreachable or timed out (Studio 120 s, CDN 10 s); a 5xx |
|
|
61
|
+
| 5 | busy | Studio answered 429, 503 `unavailable`, or 409 `production_moved`; a save stopped part way. Run the same command again |
|
|
62
|
+
| 64 | usage | Unknown command or flag, bad flag value, bad draft or revision name, missing `--draft`, no `DECO_SITE`, no `.deco/` for a remote command |
|
|
63
|
+
|
|
64
|
+
`deco check` and the local commands exit 1 (not 64) when no `.deco/` is found.
|
|
65
|
+
|
|
66
|
+
## `--json`
|
|
67
|
+
|
|
68
|
+
Success: `{ "ok": true, …result }`. Failure:
|
|
69
|
+
|
|
70
|
+
```json
|
|
71
|
+
{ "ok": false, "exitCode": 2, "error": { "code": "conflict", "message": "…" }, "conflicts": { … } }
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
`error.code` values worth matching: `usage`, `not_logged_in`, `unauthorized`, `network`,
|
|
75
|
+
`unavailable`, `conflict`, `unpushed_changes`, `not_pulled`, `too_large`, `invalid_local_block`,
|
|
76
|
+
`invalid_config`, `revision_not_found`, `block_not_found`, `no_schema`, `invalid_schema`,
|
|
77
|
+
`check_failed`, `bad_answer`, `http_<status>`, and Studio's own codes (such as `production_moved`).
|
|
78
|
+
|
|
79
|
+
Per command, the result carries:
|
|
80
|
+
|
|
81
|
+
| Command | Fields |
|
|
82
|
+
|---|---|
|
|
83
|
+
| `pull` | `draft`, `revision`, `blocks` (count) |
|
|
84
|
+
| `diff` | `draft`, `revision`, `changes: [{ name, status }]` (`changed`, `new`, `deleted`) |
|
|
85
|
+
| `push` | `draft`, `pushed`, `batches`, `tookTheirs`, `previewUrl`, `pointer` |
|
|
86
|
+
| `publish` | `draft`, `result` (`published` or `up-to-date`), `revision`, `previous` (when published), `draftEmptied`, `changes` |
|
|
87
|
+
| `drafts` | `list`: `drafts`. `new`: `draft`. `discard`: `draft`, `discarded`. `url`: `draft`, `previewUrl`, `pointer` |
|
|
88
|
+
| `releases` | `live`, `revisions: [{ id, status, meta }]` (`status`: `current`, `listed`, `unreadable`), `nextCursor` |
|
|
89
|
+
| `check` | `blocks`, `errors`, `warnings`, `problems` |
|
|
90
|
+
| `schema push` | `etag`, `blocksMajor` |
|
|
91
|
+
| `login` | `command` |
|
|
92
|
+
|
|
93
|
+
## Common errors before any command runs
|
|
94
|
+
|
|
95
|
+
| Message | Exit | Fix |
|
|
96
|
+
|---|---|---|
|
|
97
|
+
| `no .deco/ found from <dir>; run inside your app or pass --root` | 64 (remote) / 1 | `cd` into the app or `--root` |
|
|
98
|
+
| `no .deco/ in <dir>; pass the folder that contains .deco/ as --root` | 64 / 1 | Fix `--root` |
|
|
99
|
+
| `no Studio site: set DECO_SITE …` | 64 | Set `DECO_SITE` |
|
|
100
|
+
| `DECO_SITE (from <source>) isn't a site name: "<value>"` | 64 | Letters, digits, `.`, `_`, `-` |
|
|
101
|
+
| `wrangler.jsonc: invalid JSON: …` | 1 | The CLI parses wrangler files to find `DECO_SITE` |
|
|
102
|
+
| `not logged in to <studio>; run: npx decocms auth login --target=<studio>` | 3 | Log in, or set `DECO_TOKEN` |
|
|
103
|
+
| `Studio answered 401: … (check DECO_TOKEN, or log in again with npx decocms auth login)` | 3 | New token |
|
|
104
|
+
| `Studio (<url>) unreachable (…)` / `timed out`, `the CDN (…) unreachable (…)` | 4 | Network; retry |
|