bsmnt 0.4.3 → 0.6.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/README.md +1 -0
- package/dist/application/add-hooks/index.d.ts.map +1 -1
- package/dist/application/add-hooks/index.js +1 -0
- package/dist/application/add-hooks/index.js.map +1 -1
- package/dist/application/add-integration/index.d.ts +33 -8
- package/dist/application/add-integration/index.d.ts.map +1 -1
- package/dist/application/add-integration/index.js +221 -90
- package/dist/application/add-integration/index.js.map +1 -1
- package/dist/application/create-project/build-context.d.ts +3 -1
- package/dist/application/create-project/build-context.d.ts.map +1 -1
- package/dist/application/create-project/build-context.js +2 -1
- package/dist/application/create-project/build-context.js.map +1 -1
- package/dist/application/create-project/index.d.ts +3 -1
- package/dist/application/create-project/index.d.ts.map +1 -1
- package/dist/application/create-project/index.js +4 -2
- package/dist/application/create-project/index.js.map +1 -1
- package/dist/application/create-project/map-selection-to-registry.js +1 -1
- package/dist/application/create-project/map-selection-to-registry.js.map +1 -1
- package/dist/application/install-skills/index.js +1 -1
- package/dist/application/install-skills/index.js.map +1 -1
- package/dist/application/shared/project-detection.d.ts +2 -2
- package/dist/application/shared/project-detection.d.ts.map +1 -1
- package/dist/application/shared/project-detection.js +2 -2
- package/dist/application/shared/project-detection.js.map +1 -1
- package/dist/core/create/execute-plan.d.ts +4 -0
- package/dist/core/create/execute-plan.d.ts.map +1 -1
- package/dist/core/create/execute-plan.js +8 -0
- package/dist/core/create/execute-plan.js.map +1 -1
- package/dist/core/create/internal-ids.d.ts +4 -1
- package/dist/core/create/internal-ids.d.ts.map +1 -1
- package/dist/core/create/internal-ids.js +6 -1
- package/dist/core/create/internal-ids.js.map +1 -1
- package/dist/core/create/types.d.ts +2 -0
- package/dist/core/create/types.d.ts.map +1 -1
- package/dist/domain/cms.d.ts +0 -7
- package/dist/domain/cms.d.ts.map +1 -1
- package/dist/domain/cms.js.map +1 -1
- package/dist/domain/forms.d.ts +17 -0
- package/dist/domain/forms.d.ts.map +1 -0
- package/dist/domain/forms.js +13 -0
- package/dist/domain/forms.js.map +1 -0
- package/dist/domain/integration.d.ts +30 -0
- package/dist/domain/integration.d.ts.map +1 -0
- package/dist/domain/integration.js +12 -0
- package/dist/domain/integration.js.map +1 -0
- package/dist/domain/skills.d.ts +58 -0
- package/dist/domain/skills.d.ts.map +1 -1
- package/dist/domain/skills.js +52 -0
- package/dist/domain/skills.js.map +1 -1
- package/dist/index.js +114 -38
- package/dist/index.js.map +1 -1
- package/dist/infrastructure/agents/register-sanity-mcp.js +9 -6
- package/dist/infrastructure/agents/register-sanity-mcp.js.map +1 -1
- package/dist/infrastructure/create/apply-package-json.d.ts.map +1 -1
- package/dist/infrastructure/create/apply-package-json.js +19 -0
- package/dist/infrastructure/create/apply-package-json.js.map +1 -1
- package/dist/infrastructure/create/executor.d.ts.map +1 -1
- package/dist/infrastructure/create/executor.js +5 -0
- package/dist/infrastructure/create/executor.js.map +1 -1
- package/dist/infrastructure/create/install-dependencies.d.ts.map +1 -1
- package/dist/infrastructure/create/install-dependencies.js +4 -0
- package/dist/infrastructure/create/install-dependencies.js.map +1 -1
- package/dist/infrastructure/create/lifecycle-registry.d.ts.map +1 -1
- package/dist/infrastructure/create/lifecycle-registry.js +2 -0
- package/dist/infrastructure/create/lifecycle-registry.js.map +1 -1
- package/dist/infrastructure/create/merge-registry.d.ts.map +1 -1
- package/dist/infrastructure/create/merge-registry.js +8 -0
- package/dist/infrastructure/create/merge-registry.js.map +1 -1
- package/dist/infrastructure/create/setup-agent.d.ts +2 -0
- package/dist/infrastructure/create/setup-agent.d.ts.map +1 -1
- package/dist/infrastructure/create/setup-agent.js +32 -8
- package/dist/infrastructure/create/setup-agent.js.map +1 -1
- package/dist/infrastructure/create/setup-dotenvx.d.ts +41 -0
- package/dist/infrastructure/create/setup-dotenvx.d.ts.map +1 -0
- package/dist/infrastructure/create/setup-dotenvx.js +502 -0
- package/dist/infrastructure/create/setup-dotenvx.js.map +1 -0
- package/dist/infrastructure/create/setup-sanity.d.ts +13 -1
- package/dist/infrastructure/create/setup-sanity.d.ts.map +1 -1
- package/dist/infrastructure/create/setup-sanity.js +74 -31
- package/dist/infrastructure/create/setup-sanity.js.map +1 -1
- package/dist/infrastructure/integrations/inject-integration.d.ts +3 -3
- package/dist/infrastructure/integrations/inject-integration.d.ts.map +1 -1
- package/dist/infrastructure/integrations/inject-integration.js +81 -37
- package/dist/infrastructure/integrations/inject-integration.js.map +1 -1
- package/dist/modules/features/cms/sanity/config.d.ts.map +1 -1
- package/dist/modules/features/cms/sanity/config.js +13 -6
- package/dist/modules/features/cms/sanity/config.js.map +1 -1
- package/dist/modules/features/cms/sanity/index.js +8 -2
- package/dist/modules/features/cms/sanity/index.js.map +1 -1
- package/dist/modules/features/cms/sanity/mergers/ci-workflow.d.ts +13 -0
- package/dist/modules/features/cms/sanity/mergers/ci-workflow.d.ts.map +1 -0
- package/dist/modules/features/cms/sanity/mergers/ci-workflow.js +38 -0
- package/dist/modules/features/cms/sanity/mergers/ci-workflow.js.map +1 -0
- package/dist/modules/features/cms/sanity/mergers/knip.d.ts +12 -0
- package/dist/modules/features/cms/sanity/mergers/knip.d.ts.map +1 -0
- package/dist/modules/features/cms/sanity/mergers/knip.js +38 -0
- package/dist/modules/features/cms/sanity/mergers/knip.js.map +1 -0
- package/dist/modules/features/cms/sanity/mergers/layout.d.ts.map +1 -1
- package/dist/modules/features/cms/sanity/mergers/layout.js +17 -3
- package/dist/modules/features/cms/sanity/mergers/layout.js.map +1 -1
- package/dist/modules/features/cms/sanity/mergers/sitemap.d.ts +3 -3
- package/dist/modules/features/cms/sanity/mergers/sitemap.d.ts.map +1 -1
- package/dist/modules/features/cms/sanity/mergers/sitemap.js +48 -62
- package/dist/modules/features/cms/sanity/mergers/sitemap.js.map +1 -1
- package/dist/modules/features/cms/sanity-pagebuilder/config.d.ts.map +1 -1
- package/dist/modules/features/cms/sanity-pagebuilder/config.js +8 -5
- package/dist/modules/features/cms/sanity-pagebuilder/config.js.map +1 -1
- package/dist/modules/features/cms/sanity-pagebuilder/index.js +2 -2
- package/dist/modules/features/cms/sanity-pagebuilder/index.js.map +1 -1
- package/dist/modules/features/env/dotenvx/config.d.ts +13 -0
- package/dist/modules/features/env/dotenvx/config.d.ts.map +1 -0
- package/dist/modules/features/env/dotenvx/config.js +47 -0
- package/dist/modules/features/env/dotenvx/config.js.map +1 -0
- package/dist/modules/features/forms/hubspot/config.d.ts +31 -0
- package/dist/modules/features/forms/hubspot/config.d.ts.map +1 -0
- package/dist/modules/features/forms/hubspot/config.js +25 -0
- package/dist/modules/features/forms/hubspot/config.js.map +1 -0
- package/dist/paths.d.ts +16 -0
- package/dist/paths.d.ts.map +1 -1
- package/dist/paths.js +16 -0
- package/dist/paths.js.map +1 -1
- package/package.json +21 -9
- package/src/agent-skills/json-ld/SKILL.md +85 -0
- package/src/agent-skills/manage-env/SKILL.md +67 -0
- package/src/assets/check-node-version.mjs +22 -0
- package/src/modules/features/cms/sanity/files/app/blog/[slug]/page.tsx +48 -21
- package/src/modules/features/cms/sanity/files/app/blog/page.tsx +54 -0
- package/src/modules/features/cms/sanity/files/app/feed.xml/route.ts +36 -0
- package/src/modules/features/cms/sanity/files/components/sanity/structured-data.tsx +83 -0
- package/src/modules/features/cms/sanity/files/lib/integrations/sanity/components/disable-draft-mode.tsx +3 -3
- package/src/modules/features/cms/sanity/files/lib/integrations/sanity/queries.ts +14 -0
- package/src/modules/features/cms/sanity/files/lib/integrations/sanity/sanity.config.ts +19 -3
- package/src/modules/features/cms/sanity/files/lib/integrations/sanity/sanity.types.ts +1 -0
- package/src/modules/features/cms/sanity/files/lib/integrations/sanity/schemas/article.ts +7 -7
- package/src/modules/features/cms/sanity/files/lib/integrations/sanity/schemas/index.ts +36 -1
- package/src/modules/features/cms/sanity/files/lib/integrations/sanity/schemas/metadata.ts +12 -1
- package/src/modules/features/cms/sanity/files/lib/integrations/sanity/schemas/structured-data-blocks.ts +416 -0
- package/src/modules/features/cms/sanity/files/lib/integrations/sanity/schemas/structured-data.ts +100 -0
- package/src/modules/features/cms/sanity/files/lib/integrations/sanity/structure.ts +37 -2
- package/src/modules/features/cms/sanity/files/lib/integrations/sanity/utils/page-json-ld.ts +208 -0
- package/src/modules/features/cms/sanity/files/lib/scripts/setup-ci-secrets.ts +117 -0
- package/src/modules/features/cms/sanity/files/lib/utils/rss.ts +96 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/.knip.json +8 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/app/api/[[...slug]]/route.ts +100 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/app/api/draft-mode/disable/route.ts +7 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/app/api/draft-mode/enable/route.ts +20 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/app/api/revalidate/route.ts +126 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/app/feed.xml/route.ts +40 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/app/sitemap.md/route.ts +124 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/app/studio/[[...tool]]/page.tsx +8 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/components/sanity/draft-mode-toggle.tsx +27 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/components/sanity/rich-text.tsx +87 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/components/sanity/visual-editing.tsx +28 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/components/ui/sanity-image/index.tsx +41 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/check-integration.ts +5 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/client.ts +27 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/components/disable-draft-mode.tsx +23 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/components/page-builder-input.tsx +39 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/components/page-category-input.tsx +50 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/components/same-as-input.tsx +66 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/components/slug-field.tsx +18 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/components/slug-input.tsx +14 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/confirm-publish-action.ts +40 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/env.ts +34 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/fetchers/layout.ts +67 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/fetchers/redirects.ts +17 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/icons.ts +79 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/live/index.tsx +88 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/markdown-proxy.config.ts +50 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/page-builder-config.ts +130 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/page-category.ts +28 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/page-tree-pane.tsx +420 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/pinned-pages.ts +54 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/presentation.ts +119 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/queries.ts +407 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/sanity.cli.ts +29 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/sanity.config.ts +113 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/schemas/components/index.ts +4 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/schemas/components/reusable/blog-content.ts +89 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/schemas/components/reusable/description.ts +29 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/schemas/components/reusable/hero.ts +28 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/schemas/components/singleton/content-collection.ts +45 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/schemas/content/author.ts +70 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/schemas/content/blog-category.ts +55 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/schemas/index.ts +124 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/schemas/layout/company-data.ts +70 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/schemas/layout/footer.ts +79 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/schemas/layout/navbar.ts +75 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/schemas/layout/redirect.ts +120 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/schemas/layout/structured-data.ts +124 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/schemas/shared/link.ts +125 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/schemas/shared/logo-field.ts +9 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/schemas/shared/metadata.ts +79 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/schemas/shared/nav-objects.ts +192 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/schemas/shared/page-builder.ts +39 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/schemas/shared/page-folder.ts +124 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/schemas/shared/page.ts +242 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/schemas/shared/richText.ts +63 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/schemas/shared/structured-data-blocks.ts +436 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/singletons.ts +51 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/structure.ts +330 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/utils/image.ts +8 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/utils/link.ts +140 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/utils/page-builder-markdown.ts +81 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/integrations/sanity/utils/page-json-ld.ts +208 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/scripts/sanity-typegen.ts +45 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/utils/check-redirect.ts +30 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/utils/json-ld.tsx +521 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/utils/metadata.ts +167 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/utils/rss.ts +96 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/lib/utils/sitemap.ts +40 -0
- package/src/modules/features/cms/sanity-pagebuilder/files/proxy.ts +81 -0
- package/src/modules/features/env/dotenvx/files/decrypt-env.mjs +45 -0
- package/src/modules/features/env/dotenvx/files/gitleaks.yml +25 -0
- package/src/modules/features/env/dotenvx/files/instrumentation.ts +14 -0
- package/src/modules/features/env/dotenvx/files/push-keys.mjs +129 -0
- package/src/modules/features/env/dotenvx/files/save-key.mjs +108 -0
- package/src/modules/features/env/dotenvx/files/setup-env.mjs +67 -0
- package/src/modules/features/env/dotenvx/files/vercelignore +4 -0
- package/src/modules/features/env/dotenvx/files/write-env.mjs +47 -0
- package/src/templates/next-default/.env.example +14 -6
- package/src/templates/next-default/.github/workflows/ci.yml +83 -0
- package/src/templates/next-default/.vscode/extensions.json +3 -0
- package/src/templates/next-default/README.md +53 -0
- package/src/templates/next-default/knip.json +14 -0
- package/src/templates/next-default/lefthook.yml +5 -0
- package/src/templates/next-default/lib/utils/json-ld.tsx +327 -21
- package/src/templates/next-default/next.config.ts +6 -0
- package/src/templates/next-default/package.json +8 -4
- package/src/templates/next-experiments/.env.example +14 -6
- package/src/templates/next-experiments/.github/workflows/ci.yml +83 -0
- package/src/templates/next-experiments/.vscode/extensions.json +3 -0
- package/src/templates/next-experiments/README.md +53 -0
- package/src/templates/next-experiments/knip.json +14 -0
- package/src/templates/next-experiments/lefthook.yml +30 -0
- package/src/templates/next-experiments/lib/utils/json-ld.tsx +327 -21
- package/src/templates/next-experiments/next.config.ts +6 -0
- package/src/templates/next-experiments/package.json +10 -2
- package/src/templates/next-pagebuilder/.env.example +19 -1
- package/src/templates/next-pagebuilder/.github/workflows/ci.yml +90 -0
- package/src/templates/next-pagebuilder/.vscode/extensions.json +3 -0
- package/src/templates/next-pagebuilder/README.md +65 -0
- package/src/templates/next-pagebuilder/app/(content)/[[...slug]]/page.tsx +6 -1
- package/src/templates/next-pagebuilder/app/(content)/layout.tsx +3 -12
- package/src/templates/next-pagebuilder/components/layout/footer/index.tsx +11 -10
- package/src/templates/next-pagebuilder/components/layout/header/index.tsx +5 -3
- package/src/templates/next-pagebuilder/components/layout/json-ld/index.tsx +38 -26
- package/src/templates/next-pagebuilder/components/layout/wrapper/index.tsx +3 -11
- package/src/templates/next-pagebuilder/components/page-builder/components/content-collection/index.tsx +1 -1
- package/src/templates/next-pagebuilder/components/page-document/index.tsx +38 -0
- package/src/templates/next-pagebuilder/knip.json +27 -0
- package/src/templates/next-pagebuilder/lefthook.yml +5 -0
- package/src/templates/next-pagebuilder/lib/integrations/sanity/sanity.types.ts +36 -2
- package/src/templates/next-pagebuilder/lib/scripts/setup-ci-secrets.ts +117 -0
- package/src/templates/next-pagebuilder/next.config.ts +6 -0
- package/src/templates/next-pagebuilder/package.json +9 -3
- package/src/templates/next-webgl/.env.example +14 -6
- package/src/templates/next-webgl/.github/workflows/ci.yml +83 -0
- package/src/templates/next-webgl/.vscode/extensions.json +3 -0
- package/src/templates/next-webgl/README.md +53 -0
- package/src/templates/next-webgl/knip.json +13 -0
- package/src/templates/next-webgl/lefthook.yml +5 -0
- package/src/templates/next-webgl/lib/utils/json-ld.tsx +327 -21
- package/src/templates/next-webgl/next.config.ts +6 -0
- package/src/templates/next-webgl/package.json +8 -4
- package/src/modules/features/cms/sanity/files/lib/utils/json-ld.tsx +0 -244
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import { stegaClean } from "@sanity/client/stega";
|
|
2
|
+
import type { Thing, WithContext } from "schema-dts";
|
|
3
|
+
import {
|
|
4
|
+
type FaqJsonLdItem,
|
|
5
|
+
generateEventJsonLd,
|
|
6
|
+
generateFaqJsonLd,
|
|
7
|
+
generateItemListJsonLd,
|
|
8
|
+
generateJobPostingJsonLd,
|
|
9
|
+
generateSoftwareApplicationJsonLd,
|
|
10
|
+
generateVideoJsonLd,
|
|
11
|
+
type ItemListEntry,
|
|
12
|
+
} from "@/lib/utils/json-ld";
|
|
13
|
+
import { urlForImage } from "./image";
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Turns `metadata.jsonLd` blocks from Sanity into renderable JSON-LD —
|
|
17
|
+
* stega-cleaned, with image refs resolved to absolute CDN URLs.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
type SanityImageRef = Parameters<typeof urlForImage>[0];
|
|
21
|
+
|
|
22
|
+
type JsonLdBlock = {
|
|
23
|
+
_type?: string;
|
|
24
|
+
_key?: string;
|
|
25
|
+
[key: string]: unknown;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const clean = (value: unknown): string | undefined => {
|
|
29
|
+
const cleaned = stegaClean(value);
|
|
30
|
+
return typeof cleaned === "string" && cleaned.trim() !== ""
|
|
31
|
+
? cleaned
|
|
32
|
+
: undefined;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const resolveImage = (value: unknown): string | undefined => {
|
|
36
|
+
if (!value || typeof value !== "object") return undefined;
|
|
37
|
+
try {
|
|
38
|
+
return urlForImage(value as SanityImageRef).url();
|
|
39
|
+
} catch {
|
|
40
|
+
return undefined;
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const buildFaq = (block: JsonLdBlock): WithContext<Thing> | null => {
|
|
45
|
+
const questions = Array.isArray(block.questions) ? block.questions : [];
|
|
46
|
+
const items = questions
|
|
47
|
+
.map((entry): FaqJsonLdItem | null => {
|
|
48
|
+
const question = clean((entry as JsonLdBlock)?.question);
|
|
49
|
+
const answer = clean((entry as JsonLdBlock)?.answer);
|
|
50
|
+
return question && answer ? { question, answer } : null;
|
|
51
|
+
})
|
|
52
|
+
.filter((item): item is FaqJsonLdItem => item !== null);
|
|
53
|
+
return items.length ? generateFaqJsonLd(items) : null;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
const buildJobPosting = (block: JsonLdBlock): WithContext<Thing> | null => {
|
|
57
|
+
const title = clean(block.title);
|
|
58
|
+
const description = clean(block.description);
|
|
59
|
+
const datePosted = clean(block.datePosted);
|
|
60
|
+
if (!title || !description || !datePosted) return null;
|
|
61
|
+
return generateJobPostingJsonLd({
|
|
62
|
+
title,
|
|
63
|
+
description,
|
|
64
|
+
datePosted,
|
|
65
|
+
validThrough: clean(block.validThrough),
|
|
66
|
+
employmentType: clean(block.employmentType),
|
|
67
|
+
organizationName: clean(block.organizationName),
|
|
68
|
+
organizationUrl: clean(block.organizationUrl),
|
|
69
|
+
remote: block.remote === true,
|
|
70
|
+
locality: clean(block.locality),
|
|
71
|
+
region: clean(block.region),
|
|
72
|
+
country: clean(block.country),
|
|
73
|
+
});
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
const buildSoftwareApplication = (
|
|
77
|
+
block: JsonLdBlock,
|
|
78
|
+
): WithContext<Thing> | null => {
|
|
79
|
+
const name = clean(block.name);
|
|
80
|
+
if (!name) return null;
|
|
81
|
+
const priceValue = stegaClean(block.price);
|
|
82
|
+
const price =
|
|
83
|
+
typeof priceValue === "number" && Number.isFinite(priceValue)
|
|
84
|
+
? priceValue
|
|
85
|
+
: undefined;
|
|
86
|
+
return generateSoftwareApplicationJsonLd({
|
|
87
|
+
name,
|
|
88
|
+
description: clean(block.description),
|
|
89
|
+
applicationCategory: clean(block.applicationCategory),
|
|
90
|
+
operatingSystem: clean(block.operatingSystem),
|
|
91
|
+
price,
|
|
92
|
+
currency: clean(block.currency),
|
|
93
|
+
url: clean(block.url),
|
|
94
|
+
image: resolveImage(block.image),
|
|
95
|
+
});
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
const buildItemList = (block: JsonLdBlock): WithContext<Thing> | null => {
|
|
99
|
+
const rawItems = Array.isArray(block.items) ? block.items : [];
|
|
100
|
+
const items = rawItems
|
|
101
|
+
.map((entry): ItemListEntry | null => {
|
|
102
|
+
const name = clean((entry as JsonLdBlock)?.name);
|
|
103
|
+
if (!name) return null;
|
|
104
|
+
return { name, url: clean((entry as JsonLdBlock)?.url) };
|
|
105
|
+
})
|
|
106
|
+
.filter((item): item is ItemListEntry => item !== null);
|
|
107
|
+
if (!items.length) return null;
|
|
108
|
+
return generateItemListJsonLd({ name: clean(block.name), items });
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
const buildEvent = (block: JsonLdBlock): WithContext<Thing> | null => {
|
|
112
|
+
const name = clean(block.name);
|
|
113
|
+
const startDate = clean(block.startDate);
|
|
114
|
+
if (!name || !startDate) return null;
|
|
115
|
+
return generateEventJsonLd({
|
|
116
|
+
name,
|
|
117
|
+
startDate,
|
|
118
|
+
endDate: clean(block.endDate),
|
|
119
|
+
description: clean(block.description),
|
|
120
|
+
locationName: clean(block.locationName),
|
|
121
|
+
locationAddress: clean(block.locationAddress),
|
|
122
|
+
url: clean(block.url),
|
|
123
|
+
image: resolveImage(block.image),
|
|
124
|
+
});
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
const buildVideo = (block: JsonLdBlock): WithContext<Thing> | null => {
|
|
128
|
+
const name = clean(block.name);
|
|
129
|
+
const description = clean(block.description);
|
|
130
|
+
const uploadDate = clean(block.uploadDate);
|
|
131
|
+
const thumbnail = resolveImage(block.thumbnail);
|
|
132
|
+
if (!name || !description || !uploadDate || !thumbnail) return null;
|
|
133
|
+
return generateVideoJsonLd({
|
|
134
|
+
name,
|
|
135
|
+
description,
|
|
136
|
+
thumbnail,
|
|
137
|
+
uploadDate,
|
|
138
|
+
contentUrl: clean(block.contentUrl),
|
|
139
|
+
embedUrl: clean(block.embedUrl),
|
|
140
|
+
});
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
const buildCustom = (block: JsonLdBlock): WithContext<Thing> | null => {
|
|
144
|
+
const raw = clean(block.json);
|
|
145
|
+
if (!raw) return null;
|
|
146
|
+
try {
|
|
147
|
+
const parsed = JSON.parse(raw);
|
|
148
|
+
// Skip structurally-incomplete blocks: schema.org requires an @type.
|
|
149
|
+
if (
|
|
150
|
+
typeof parsed !== "object" ||
|
|
151
|
+
parsed === null ||
|
|
152
|
+
Array.isArray(parsed) ||
|
|
153
|
+
!("@type" in parsed)
|
|
154
|
+
) {
|
|
155
|
+
return null;
|
|
156
|
+
}
|
|
157
|
+
// Default @context so editors can omit the boilerplate (an explicit
|
|
158
|
+
// @context in the pasted object always wins).
|
|
159
|
+
return {
|
|
160
|
+
"@context": "https://schema.org",
|
|
161
|
+
...parsed,
|
|
162
|
+
} as WithContext<Thing>;
|
|
163
|
+
} catch {
|
|
164
|
+
return null;
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
export type PageJsonLd = { key: string; data: WithContext<Thing> };
|
|
169
|
+
|
|
170
|
+
export function buildPageJsonLd(blocks: unknown): PageJsonLd[] {
|
|
171
|
+
if (!Array.isArray(blocks)) return [];
|
|
172
|
+
|
|
173
|
+
return blocks
|
|
174
|
+
.map((entry, index): PageJsonLd | null => {
|
|
175
|
+
const block = entry as JsonLdBlock;
|
|
176
|
+
let data: WithContext<Thing> | null;
|
|
177
|
+
switch (block._type) {
|
|
178
|
+
case "faqJsonLd":
|
|
179
|
+
data = buildFaq(block);
|
|
180
|
+
break;
|
|
181
|
+
case "eventJsonLd":
|
|
182
|
+
data = buildEvent(block);
|
|
183
|
+
break;
|
|
184
|
+
case "videoJsonLd":
|
|
185
|
+
data = buildVideo(block);
|
|
186
|
+
break;
|
|
187
|
+
case "jobPostingJsonLd":
|
|
188
|
+
data = buildJobPosting(block);
|
|
189
|
+
break;
|
|
190
|
+
case "softwareApplicationJsonLd":
|
|
191
|
+
data = buildSoftwareApplication(block);
|
|
192
|
+
break;
|
|
193
|
+
case "itemListJsonLd":
|
|
194
|
+
data = buildItemList(block);
|
|
195
|
+
break;
|
|
196
|
+
case "customJsonLd":
|
|
197
|
+
data = buildCustom(block);
|
|
198
|
+
break;
|
|
199
|
+
default:
|
|
200
|
+
data = null;
|
|
201
|
+
}
|
|
202
|
+
if (!data) return null;
|
|
203
|
+
const key =
|
|
204
|
+
typeof block._key === "string" ? block._key : `jsonld-${index}`;
|
|
205
|
+
return { key, data };
|
|
206
|
+
})
|
|
207
|
+
.filter((item): item is PageJsonLd => item !== null);
|
|
208
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wrapper around `sanity schema extract && sanity typegen generate`
|
|
3
|
+
* that gracefully skips when Sanity is not configured.
|
|
4
|
+
*/
|
|
5
|
+
import { execSync } from "node:child_process";
|
|
6
|
+
import { existsSync } from "node:fs";
|
|
7
|
+
import { resolve } from "node:path";
|
|
8
|
+
|
|
9
|
+
const sanityDir = resolve(import.meta.dir, "../integrations/sanity");
|
|
10
|
+
const envFile = resolve(import.meta.dir, "../../.env.local");
|
|
11
|
+
|
|
12
|
+
// Check if Sanity project ID is configured
|
|
13
|
+
const hasEnvFile = existsSync(envFile);
|
|
14
|
+
|
|
15
|
+
if (!hasEnvFile) {
|
|
16
|
+
console.log(" Skipping sanity:typegen — .env.local not found");
|
|
17
|
+
process.exit(0);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// Read .env.local to check for project ID
|
|
21
|
+
const envContent = Bun.file(envFile);
|
|
22
|
+
const text = await envContent.text();
|
|
23
|
+
const hasProjectId = text
|
|
24
|
+
.split("\n")
|
|
25
|
+
.some(
|
|
26
|
+
(line) =>
|
|
27
|
+
line.startsWith("NEXT_PUBLIC_SANITY_PROJECT_ID=") &&
|
|
28
|
+
line.split("=")[1]?.trim() !== "",
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
if (!hasProjectId) {
|
|
32
|
+
console.log(
|
|
33
|
+
" Skipping sanity:typegen — NEXT_PUBLIC_SANITY_PROJECT_ID not set",
|
|
34
|
+
);
|
|
35
|
+
process.exit(0);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
try {
|
|
39
|
+
execSync(
|
|
40
|
+
`cd ${sanityDir} && bun --env-file ../../../.env.local sanity schema extract && bun --env-file ../../../.env.local sanity typegen generate && bun biome check --write --unsafe`,
|
|
41
|
+
{ stdio: "inherit" },
|
|
42
|
+
);
|
|
43
|
+
} catch {
|
|
44
|
+
console.warn(" sanity:typegen failed — continuing anyway");
|
|
45
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { stegaClean } from "@sanity/client/stega";
|
|
2
|
+
import type { Route } from "next";
|
|
3
|
+
import { permanentRedirect, redirect } from "next/navigation";
|
|
4
|
+
import { getRedirects } from "@/lib/integrations/sanity/fetchers/redirects";
|
|
5
|
+
|
|
6
|
+
const normalize = (path: string) =>
|
|
7
|
+
path.replace(/^\/+/, "").replace(/\/+$/, "");
|
|
8
|
+
|
|
9
|
+
/** Redirect (308 permanent / 307 temporary) if `path` matches a redirect source. */
|
|
10
|
+
export const checkRedirect = async (path: string | null): Promise<void> => {
|
|
11
|
+
const redirects = await getRedirects();
|
|
12
|
+
if (redirects.length === 0) return;
|
|
13
|
+
|
|
14
|
+
const source = normalize(path ?? "");
|
|
15
|
+
const match = redirects.find(
|
|
16
|
+
(entry) =>
|
|
17
|
+
entry.source && normalize(stegaClean(entry.source) ?? "") === source,
|
|
18
|
+
);
|
|
19
|
+
if (!match?.destination) return;
|
|
20
|
+
|
|
21
|
+
const destination = stegaClean(match.destination) ?? "";
|
|
22
|
+
const href = (
|
|
23
|
+
/^https?:\/\//.test(destination)
|
|
24
|
+
? destination
|
|
25
|
+
: `/${normalize(destination)}`
|
|
26
|
+
) as Route;
|
|
27
|
+
|
|
28
|
+
if (match.permanent === false) redirect(href);
|
|
29
|
+
permanentRedirect(href);
|
|
30
|
+
};
|