jamdesk 1.0.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/LICENSE +21 -0
- package/README.md +323 -0
- package/bin/jamdesk.js +76 -0
- package/dist/__tests__/integration/deprecated-components.integration.test.d.ts +8 -0
- package/dist/__tests__/integration/deprecated-components.integration.test.d.ts.map +1 -0
- package/dist/__tests__/integration/deprecated-components.integration.test.js +165 -0
- package/dist/__tests__/integration/deprecated-components.integration.test.js.map +1 -0
- package/dist/__tests__/integration/migrate.integration.test.d.ts +2 -0
- package/dist/__tests__/integration/migrate.integration.test.d.ts.map +1 -0
- package/dist/__tests__/integration/migrate.integration.test.js +64 -0
- package/dist/__tests__/integration/migrate.integration.test.js.map +1 -0
- package/dist/__tests__/integration/prepublish.integration.test.d.ts +2 -0
- package/dist/__tests__/integration/prepublish.integration.test.d.ts.map +1 -0
- package/dist/__tests__/integration/prepublish.integration.test.js +27 -0
- package/dist/__tests__/integration/prepublish.integration.test.js.map +1 -0
- package/dist/__tests__/integration/validate.integration.test.d.ts +2 -0
- package/dist/__tests__/integration/validate.integration.test.d.ts.map +1 -0
- package/dist/__tests__/integration/validate.integration.test.js +56 -0
- package/dist/__tests__/integration/validate.integration.test.js.map +1 -0
- package/dist/__tests__/unit/deploy-templates.test.d.ts +2 -0
- package/dist/__tests__/unit/deploy-templates.test.d.ts.map +1 -0
- package/dist/__tests__/unit/deploy-templates.test.js +124 -0
- package/dist/__tests__/unit/deploy-templates.test.js.map +1 -0
- package/dist/__tests__/unit/deprecated-components-sync.test.d.ts +2 -0
- package/dist/__tests__/unit/deprecated-components-sync.test.d.ts.map +1 -0
- package/dist/__tests__/unit/deprecated-components-sync.test.js +69 -0
- package/dist/__tests__/unit/deprecated-components-sync.test.js.map +1 -0
- package/dist/__tests__/unit/deps-sync.test.d.ts +14 -0
- package/dist/__tests__/unit/deps-sync.test.d.ts.map +1 -0
- package/dist/__tests__/unit/deps-sync.test.js +166 -0
- package/dist/__tests__/unit/deps-sync.test.js.map +1 -0
- package/dist/__tests__/unit/docs-config.test.d.ts +2 -0
- package/dist/__tests__/unit/docs-config.test.d.ts.map +1 -0
- package/dist/__tests__/unit/docs-config.test.js +288 -0
- package/dist/__tests__/unit/docs-config.test.js.map +1 -0
- package/dist/__tests__/unit/errors.test.d.ts +2 -0
- package/dist/__tests__/unit/errors.test.d.ts.map +1 -0
- package/dist/__tests__/unit/errors.test.js +27 -0
- package/dist/__tests__/unit/errors.test.js.map +1 -0
- package/dist/__tests__/unit/extract-hooks.test.d.ts +5 -0
- package/dist/__tests__/unit/extract-hooks.test.d.ts.map +1 -0
- package/dist/__tests__/unit/extract-hooks.test.js +205 -0
- package/dist/__tests__/unit/extract-hooks.test.js.map +1 -0
- package/dist/__tests__/unit/frontmatter-sync.test.d.ts +8 -0
- package/dist/__tests__/unit/frontmatter-sync.test.d.ts.map +1 -0
- package/dist/__tests__/unit/frontmatter-sync.test.js +26 -0
- package/dist/__tests__/unit/frontmatter-sync.test.js.map +1 -0
- package/dist/__tests__/unit/mdx-validator.test.d.ts +2 -0
- package/dist/__tests__/unit/mdx-validator.test.d.ts.map +1 -0
- package/dist/__tests__/unit/mdx-validator.test.js +264 -0
- package/dist/__tests__/unit/mdx-validator.test.js.map +1 -0
- package/dist/__tests__/unit/migrate-convert.test.d.ts +2 -0
- package/dist/__tests__/unit/migrate-convert.test.d.ts.map +1 -0
- package/dist/__tests__/unit/migrate-convert.test.js +297 -0
- package/dist/__tests__/unit/migrate-convert.test.js.map +1 -0
- package/dist/__tests__/unit/migrate-detect.test.d.ts +2 -0
- package/dist/__tests__/unit/migrate-detect.test.d.ts.map +1 -0
- package/dist/__tests__/unit/migrate-detect.test.js +35 -0
- package/dist/__tests__/unit/migrate-detect.test.js.map +1 -0
- package/dist/__tests__/unit/migrate-mdx.test.d.ts +2 -0
- package/dist/__tests__/unit/migrate-mdx.test.d.ts.map +1 -0
- package/dist/__tests__/unit/migrate-mdx.test.js +158 -0
- package/dist/__tests__/unit/migrate-mdx.test.js.map +1 -0
- package/dist/__tests__/unit/openapi.test.d.ts +2 -0
- package/dist/__tests__/unit/openapi.test.d.ts.map +1 -0
- package/dist/__tests__/unit/openapi.test.js +52 -0
- package/dist/__tests__/unit/openapi.test.js.map +1 -0
- package/dist/__tests__/unit/package-config.test.d.ts +2 -0
- package/dist/__tests__/unit/package-config.test.d.ts.map +1 -0
- package/dist/__tests__/unit/package-config.test.js +63 -0
- package/dist/__tests__/unit/package-config.test.js.map +1 -0
- package/dist/__tests__/unit/port.test.d.ts +2 -0
- package/dist/__tests__/unit/port.test.d.ts.map +1 -0
- package/dist/__tests__/unit/port.test.js +20 -0
- package/dist/__tests__/unit/port.test.js.map +1 -0
- package/dist/__tests__/unit/vendored-sync.test.d.ts +14 -0
- package/dist/__tests__/unit/vendored-sync.test.d.ts.map +1 -0
- package/dist/__tests__/unit/vendored-sync.test.js +90 -0
- package/dist/__tests__/unit/vendored-sync.test.js.map +1 -0
- package/dist/commands/broken-links.d.ts +11 -0
- package/dist/commands/broken-links.d.ts.map +1 -0
- package/dist/commands/broken-links.js +95 -0
- package/dist/commands/broken-links.js.map +1 -0
- package/dist/commands/clean.d.ts +7 -0
- package/dist/commands/clean.d.ts.map +1 -0
- package/dist/commands/clean.js +59 -0
- package/dist/commands/clean.js.map +1 -0
- package/dist/commands/deploy/cloudflare.d.ts +12 -0
- package/dist/commands/deploy/cloudflare.d.ts.map +1 -0
- package/dist/commands/deploy/cloudflare.js +409 -0
- package/dist/commands/deploy/cloudflare.js.map +1 -0
- package/dist/commands/deploy/templates.d.ts +23 -0
- package/dist/commands/deploy/templates.d.ts.map +1 -0
- package/dist/commands/deploy/templates.js +179 -0
- package/dist/commands/deploy/templates.js.map +1 -0
- package/dist/commands/deploy/types.d.ts +19 -0
- package/dist/commands/deploy/types.d.ts.map +1 -0
- package/dist/commands/deploy/types.js +5 -0
- package/dist/commands/deploy/types.js.map +1 -0
- package/dist/commands/dev.d.ts +14 -0
- package/dist/commands/dev.d.ts.map +1 -0
- package/dist/commands/dev.js +817 -0
- package/dist/commands/dev.js.map +1 -0
- package/dist/commands/doctor.d.ts +7 -0
- package/dist/commands/doctor.d.ts.map +1 -0
- package/dist/commands/doctor.js +159 -0
- package/dist/commands/doctor.js.map +1 -0
- package/dist/commands/init.d.ts +7 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +96 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/migrate/convert-mdx.d.ts +50 -0
- package/dist/commands/migrate/convert-mdx.d.ts.map +1 -0
- package/dist/commands/migrate/convert-mdx.js +108 -0
- package/dist/commands/migrate/convert-mdx.js.map +1 -0
- package/dist/commands/migrate/convert.d.ts +80 -0
- package/dist/commands/migrate/convert.d.ts.map +1 -0
- package/dist/commands/migrate/convert.js +158 -0
- package/dist/commands/migrate/convert.js.map +1 -0
- package/dist/commands/migrate/detect.d.ts +31 -0
- package/dist/commands/migrate/detect.d.ts.map +1 -0
- package/dist/commands/migrate/detect.js +62 -0
- package/dist/commands/migrate/detect.js.map +1 -0
- package/dist/commands/migrate/extract-hooks.d.ts +71 -0
- package/dist/commands/migrate/extract-hooks.d.ts.map +1 -0
- package/dist/commands/migrate/extract-hooks.js +473 -0
- package/dist/commands/migrate/extract-hooks.js.map +1 -0
- package/dist/commands/migrate/index.d.ts +17 -0
- package/dist/commands/migrate/index.d.ts.map +1 -0
- package/dist/commands/migrate/index.js +282 -0
- package/dist/commands/migrate/index.js.map +1 -0
- package/dist/commands/migrate/prompts.d.ts +22 -0
- package/dist/commands/migrate/prompts.d.ts.map +1 -0
- package/dist/commands/migrate/prompts.js +67 -0
- package/dist/commands/migrate/prompts.js.map +1 -0
- package/dist/commands/migrate/types.d.ts +22 -0
- package/dist/commands/migrate/types.d.ts.map +1 -0
- package/dist/commands/migrate/types.js +26 -0
- package/dist/commands/migrate/types.js.map +1 -0
- package/dist/commands/openapi-check.d.ts +11 -0
- package/dist/commands/openapi-check.d.ts.map +1 -0
- package/dist/commands/openapi-check.js +88 -0
- package/dist/commands/openapi-check.js.map +1 -0
- package/dist/commands/rename.d.ts +10 -0
- package/dist/commands/rename.d.ts.map +1 -0
- package/dist/commands/rename.js +125 -0
- package/dist/commands/rename.js.map +1 -0
- package/dist/commands/update.d.ts +10 -0
- package/dist/commands/update.d.ts.map +1 -0
- package/dist/commands/update.js +57 -0
- package/dist/commands/update.js.map +1 -0
- package/dist/commands/validate.d.ts +12 -0
- package/dist/commands/validate.d.ts.map +1 -0
- package/dist/commands/validate.js +163 -0
- package/dist/commands/validate.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +334 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/config.d.ts +7 -0
- package/dist/lib/config.d.ts.map +1 -0
- package/dist/lib/config.js +18 -0
- package/dist/lib/config.js.map +1 -0
- package/dist/lib/deprecated-components.d.ts +72 -0
- package/dist/lib/deprecated-components.d.ts.map +1 -0
- package/dist/lib/deprecated-components.js +138 -0
- package/dist/lib/deprecated-components.js.map +1 -0
- package/dist/lib/deps.d.ts +17 -0
- package/dist/lib/deps.d.ts.map +1 -0
- package/dist/lib/deps.js +186 -0
- package/dist/lib/deps.js.map +1 -0
- package/dist/lib/docs-config.d.ts +67 -0
- package/dist/lib/docs-config.d.ts.map +1 -0
- package/dist/lib/docs-config.js +294 -0
- package/dist/lib/docs-config.js.map +1 -0
- package/dist/lib/errors.d.ts +23 -0
- package/dist/lib/errors.d.ts.map +1 -0
- package/dist/lib/errors.js +32 -0
- package/dist/lib/errors.js.map +1 -0
- package/dist/lib/frontmatter-utils.d.ts +25 -0
- package/dist/lib/frontmatter-utils.d.ts.map +1 -0
- package/dist/lib/frontmatter-utils.js +64 -0
- package/dist/lib/frontmatter-utils.js.map +1 -0
- package/dist/lib/mdx-validator.d.ts +27 -0
- package/dist/lib/mdx-validator.d.ts.map +1 -0
- package/dist/lib/mdx-validator.js +148 -0
- package/dist/lib/mdx-validator.js.map +1 -0
- package/dist/lib/navigation-validator.d.ts +31 -0
- package/dist/lib/navigation-validator.d.ts.map +1 -0
- package/dist/lib/navigation-validator.js +75 -0
- package/dist/lib/navigation-validator.js.map +1 -0
- package/dist/lib/normalize-config.d.ts +57 -0
- package/dist/lib/normalize-config.d.ts.map +1 -0
- package/dist/lib/normalize-config.js +63 -0
- package/dist/lib/normalize-config.js.map +1 -0
- package/dist/lib/openapi/cache.d.ts +40 -0
- package/dist/lib/openapi/cache.d.ts.map +1 -0
- package/dist/lib/openapi/cache.js +76 -0
- package/dist/lib/openapi/cache.js.map +1 -0
- package/dist/lib/openapi/errors.d.ts +36 -0
- package/dist/lib/openapi/errors.d.ts.map +1 -0
- package/dist/lib/openapi/errors.js +162 -0
- package/dist/lib/openapi/errors.js.map +1 -0
- package/dist/lib/openapi/index.d.ts +10 -0
- package/dist/lib/openapi/index.d.ts.map +1 -0
- package/dist/lib/openapi/index.js +12 -0
- package/dist/lib/openapi/index.js.map +1 -0
- package/dist/lib/openapi/types.d.ts +198 -0
- package/dist/lib/openapi/types.d.ts.map +1 -0
- package/dist/lib/openapi/types.js +8 -0
- package/dist/lib/openapi/types.js.map +1 -0
- package/dist/lib/openapi/validator.d.ts +45 -0
- package/dist/lib/openapi/validator.d.ts.map +1 -0
- package/dist/lib/openapi/validator.js +128 -0
- package/dist/lib/openapi/validator.js.map +1 -0
- package/dist/lib/openapi.d.ts +7 -0
- package/dist/lib/openapi.d.ts.map +1 -0
- package/dist/lib/openapi.js +7 -0
- package/dist/lib/openapi.js.map +1 -0
- package/dist/lib/output.d.ts +14 -0
- package/dist/lib/output.d.ts.map +1 -0
- package/dist/lib/output.js +19 -0
- package/dist/lib/output.js.map +1 -0
- package/dist/lib/path-security.d.ts +23 -0
- package/dist/lib/path-security.d.ts.map +1 -0
- package/dist/lib/path-security.js +35 -0
- package/dist/lib/path-security.js.map +1 -0
- package/dist/lib/port.d.ts +18 -0
- package/dist/lib/port.d.ts.map +1 -0
- package/dist/lib/port.js +65 -0
- package/dist/lib/port.js.map +1 -0
- package/dist/lib/spinner.d.ts +4 -0
- package/dist/lib/spinner.d.ts.map +1 -0
- package/dist/lib/spinner.js +16 -0
- package/dist/lib/spinner.js.map +1 -0
- package/dist/lib/version.d.ts +2 -0
- package/dist/lib/version.d.ts.map +1 -0
- package/dist/lib/version.js +49 -0
- package/dist/lib/version.js.map +1 -0
- package/dist/utils/update-checker.d.ts +34 -0
- package/dist/utils/update-checker.d.ts.map +1 -0
- package/dist/utils/update-checker.js +142 -0
- package/dist/utils/update-checker.js.map +1 -0
- package/package.json +125 -0
- package/templates/docs.json +11 -0
- package/templates/introduction.mdx +19 -0
- package/templates/quickstart.mdx +20 -0
- package/vendored/app/[[...slug]]/error.tsx +103 -0
- package/vendored/app/[[...slug]]/page.tsx +690 -0
- package/vendored/app/api/assets/[...path]/route.ts +78 -0
- package/vendored/app/api/ev/route.ts +61 -0
- package/vendored/app/api/isr-health/route.ts +66 -0
- package/vendored/app/api/mcp/[project]/route.ts +435 -0
- package/vendored/app/api/og/route.tsx +167 -0
- package/vendored/app/api/r2/[project]/[...path]/route.ts +214 -0
- package/vendored/app/api/revalidate/route.ts +76 -0
- package/vendored/app/globals.css +37 -0
- package/vendored/app/layout.tsx +571 -0
- package/vendored/app/not-found.tsx +47 -0
- package/vendored/components/CodeBlockCopyButton.tsx +146 -0
- package/vendored/components/HeaderLinkCopy.tsx +135 -0
- package/vendored/components/errors/NotFoundContent.tsx +147 -0
- package/vendored/components/layout/LayoutWrapper.tsx +128 -0
- package/vendored/components/mdx/Accordion.tsx +91 -0
- package/vendored/components/mdx/ApiCodePanel.tsx +51 -0
- package/vendored/components/mdx/ApiEndpoint.tsx +104 -0
- package/vendored/components/mdx/ApiPage.tsx +379 -0
- package/vendored/components/mdx/Badge.tsx +169 -0
- package/vendored/components/mdx/Callouts.tsx +140 -0
- package/vendored/components/mdx/Card.tsx +214 -0
- package/vendored/components/mdx/CodeGroup.tsx +136 -0
- package/vendored/components/mdx/Color.tsx +244 -0
- package/vendored/components/mdx/Columns.tsx +37 -0
- package/vendored/components/mdx/Expandable.tsx +37 -0
- package/vendored/components/mdx/Frame.tsx +51 -0
- package/vendored/components/mdx/Icon.tsx +132 -0
- package/vendored/components/mdx/Latex.tsx +75 -0
- package/vendored/components/mdx/MDXComponents.tsx +414 -0
- package/vendored/components/mdx/Mermaid.tsx +35 -0
- package/vendored/components/mdx/MermaidInner.tsx +342 -0
- package/vendored/components/mdx/OpenApiEndpoint.tsx +971 -0
- package/vendored/components/mdx/Panel.tsx +26 -0
- package/vendored/components/mdx/PanelWrapper.tsx +100 -0
- package/vendored/components/mdx/ParamField.tsx +75 -0
- package/vendored/components/mdx/RequestExample.tsx +91 -0
- package/vendored/components/mdx/ResponseExample.tsx +145 -0
- package/vendored/components/mdx/ResponseField.tsx +109 -0
- package/vendored/components/mdx/Steps.tsx +173 -0
- package/vendored/components/mdx/Table.tsx +352 -0
- package/vendored/components/mdx/Tabs.tsx +147 -0
- package/vendored/components/mdx/Tile.tsx +127 -0
- package/vendored/components/mdx/Tooltip.tsx +111 -0
- package/vendored/components/mdx/Tree.tsx +484 -0
- package/vendored/components/mdx/Update.tsx +90 -0
- package/vendored/components/mdx/View.tsx +354 -0
- package/vendored/components/mdx/YouTube.tsx +35 -0
- package/vendored/components/mdx/ZoomableImage.tsx +83 -0
- package/vendored/components/navigation/Breadcrumb.tsx +241 -0
- package/vendored/components/navigation/DefaultLogo.tsx +81 -0
- package/vendored/components/navigation/Header.tsx +512 -0
- package/vendored/components/navigation/LanguageSelector.tsx +249 -0
- package/vendored/components/navigation/PageNavigation.tsx +174 -0
- package/vendored/components/navigation/Sidebar.tsx +713 -0
- package/vendored/components/navigation/SocialFooter.tsx +186 -0
- package/vendored/components/navigation/TableOfContents.tsx +435 -0
- package/vendored/components/navigation/TabsNav.tsx +182 -0
- package/vendored/components/search/LazySearchModal.tsx +19 -0
- package/vendored/components/search/SearchModal.tsx +573 -0
- package/vendored/components/snippets/ProjectSnippets.tsx +4 -0
- package/vendored/components/theme/ThemeProvider.tsx +31 -0
- package/vendored/components/theme/ThemeToggle.tsx +134 -0
- package/vendored/components/ui/CodePanel.tsx +517 -0
- package/vendored/components/ui/CodePanelModal.tsx +342 -0
- package/vendored/contexts/TabSyncContext.tsx +30 -0
- package/vendored/hooks/useFocusTrap.ts +42 -0
- package/vendored/hooks/useHashNavigation.ts +39 -0
- package/vendored/hooks/useShikiHighlight.ts +101 -0
- package/vendored/lib/analytics-client.ts +77 -0
- package/vendored/lib/build/cache.ts +138 -0
- package/vendored/lib/build/error-parser.ts +690 -0
- package/vendored/lib/build/estimation.ts +113 -0
- package/vendored/lib/build/index.ts +17 -0
- package/vendored/lib/build/page-file-map.ts +48 -0
- package/vendored/lib/build/r2-upload.ts +179 -0
- package/vendored/lib/cache-keys.ts +117 -0
- package/vendored/lib/code-utils.ts +42 -0
- package/vendored/lib/content-loader.ts +176 -0
- package/vendored/lib/deprecated-components.ts +185 -0
- package/vendored/lib/docs-isr.ts +180 -0
- package/vendored/lib/docs-types.ts +874 -0
- package/vendored/lib/docs.ts +203 -0
- package/vendored/lib/domain-helpers.ts +107 -0
- package/vendored/lib/email-notifier.ts +102 -0
- package/vendored/lib/email-templates/build-failure.tsx +193 -0
- package/vendored/lib/email-templates/components/base-layout.tsx +150 -0
- package/vendored/lib/email-templates/components/error-box.tsx +88 -0
- package/vendored/lib/email-templates/components/info-row.tsx +63 -0
- package/vendored/lib/email-templates/index.ts +13 -0
- package/vendored/lib/empty-polyfill.js +3 -0
- package/vendored/lib/extract-highlights.ts +124 -0
- package/vendored/lib/fonts.ts +227 -0
- package/vendored/lib/frontmatter-utils.ts +77 -0
- package/vendored/lib/fs-utils.ts +20 -0
- package/vendored/lib/git-utils.ts +87 -0
- package/vendored/lib/health-checks.ts +224 -0
- package/vendored/lib/icon-utils.ts +492 -0
- package/vendored/lib/infer-page-type.ts +14 -0
- package/vendored/lib/isr-build-executor.ts +185 -0
- package/vendored/lib/language-icons.ts +152 -0
- package/vendored/lib/language-utils.ts +338 -0
- package/vendored/lib/latex-config.ts +64 -0
- package/vendored/lib/link-prefix-context.tsx +32 -0
- package/vendored/lib/logger.ts +63 -0
- package/vendored/lib/mcp-search.ts +255 -0
- package/vendored/lib/mdx-inline-components.ts +155 -0
- package/vendored/lib/mdx.ts +100 -0
- package/vendored/lib/middleware-helpers.ts +519 -0
- package/vendored/lib/navigation-resolver.ts +621 -0
- package/vendored/lib/navigation-utils.ts +103 -0
- package/vendored/lib/normalize-config.ts +94 -0
- package/vendored/lib/openapi/cache.ts +92 -0
- package/vendored/lib/openapi/code-examples.ts +389 -0
- package/vendored/lib/openapi/errors.ts +253 -0
- package/vendored/lib/openapi/generator.ts +230 -0
- package/vendored/lib/openapi/index.ts +84 -0
- package/vendored/lib/openapi/parser.ts +474 -0
- package/vendored/lib/openapi/types.ts +232 -0
- package/vendored/lib/openapi/validator.ts +156 -0
- package/vendored/lib/openapi-isr.ts +121 -0
- package/vendored/lib/page-isr-helpers.ts +137 -0
- package/vendored/lib/path-safety.ts +130 -0
- package/vendored/lib/paths.ts +35 -0
- package/vendored/lib/preprocess-mdx.ts +951 -0
- package/vendored/lib/process-mdx-with-exports.ts +75 -0
- package/vendored/lib/project-resolver.ts +165 -0
- package/vendored/lib/r2-content.ts +60 -0
- package/vendored/lib/r2-manifest.ts +84 -0
- package/vendored/lib/recent-searches.ts +41 -0
- package/vendored/lib/recma-compound-components.ts +84 -0
- package/vendored/lib/redirect-compiler.ts +160 -0
- package/vendored/lib/redirect-matcher.ts +296 -0
- package/vendored/lib/redis.ts +23 -0
- package/vendored/lib/rehype-class-to-classname.ts +31 -0
- package/vendored/lib/rehype-code-meta.ts +275 -0
- package/vendored/lib/rehype-nozoom-to-data.ts +45 -0
- package/vendored/lib/remark-extract-exports.ts +104 -0
- package/vendored/lib/resilience.ts +260 -0
- package/vendored/lib/revalidation-helpers.ts +200 -0
- package/vendored/lib/revalidation-trigger.ts +150 -0
- package/vendored/lib/screenshot-capture.ts +229 -0
- package/vendored/lib/search-client.ts +91 -0
- package/vendored/lib/search-suggestions.ts +38 -0
- package/vendored/lib/search.ts +158 -0
- package/vendored/lib/seo.ts +264 -0
- package/vendored/lib/shiki-client.ts +131 -0
- package/vendored/lib/shiki-config.ts +289 -0
- package/vendored/lib/shiki-css-theme.ts +46 -0
- package/vendored/lib/shiki-highlighter.ts +62 -0
- package/vendored/lib/shiki-transformers.ts +337 -0
- package/vendored/lib/slack-notifier.ts +248 -0
- package/vendored/lib/snippet-compiler-isr.ts +114 -0
- package/vendored/lib/snippet-loader-isr.ts +276 -0
- package/vendored/lib/static-artifacts.ts +375 -0
- package/vendored/lib/static-file-route.ts +72 -0
- package/vendored/lib/tracking-script.ts +19 -0
- package/vendored/lib/typography-config.ts +42 -0
- package/vendored/lib/validate-config.ts +268 -0
- package/vendored/next.config.js +45 -0
- package/vendored/postcss.config.js +6 -0
- package/vendored/schema/README.md +28 -0
- package/vendored/schema/docs-schema.json +4631 -0
- package/vendored/scripts/build-project.cjs +174 -0
- package/vendored/scripts/build-search-index.cjs +347 -0
- package/vendored/scripts/compile-snippets.cjs +488 -0
- package/vendored/scripts/copy-files.cjs +295 -0
- package/vendored/scripts/dev-project.cjs +534 -0
- package/vendored/scripts/enhance-navigation.cjs +354 -0
- package/vendored/scripts/validate-links.cjs +423 -0
- package/vendored/shared/constants.ts +6 -0
- package/vendored/shared/index.ts +19 -0
- package/vendored/shared/logger.ts +62 -0
- package/vendored/shared/memory-monitor.ts +190 -0
- package/vendored/shared/navigation-validator.ts +101 -0
- package/vendored/shared/path-security.ts +39 -0
- package/vendored/shared/status-reporter.ts +199 -0
- package/vendored/shared/timer.ts +51 -0
- package/vendored/shared/types.ts +102 -0
- package/vendored/tailwind.config.ts +39 -0
- package/vendored/themes/base.css +1311 -0
- package/vendored/themes/index.ts +119 -0
- package/vendored/themes/jam/variables.css +835 -0
- package/vendored/themes/nebula/variables.css +282 -0
- package/vendored/themes/pulsar/variables.css +1009 -0
- package/vendored/themes/types.ts +89 -0
- package/vendored/tsconfig.json +48 -0
|
@@ -0,0 +1,534 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Dev Project Script
|
|
4
|
+
*
|
|
5
|
+
* Runs the development server for a specific project.
|
|
6
|
+
* This script sets up the environment and runs Next.js dev with the project's content.
|
|
7
|
+
*
|
|
8
|
+
* Usage:
|
|
9
|
+
* npm run dev-project acme # Run dev server with acme project's content
|
|
10
|
+
* npm run dev-project demo # Run dev server with demo project's content
|
|
11
|
+
*
|
|
12
|
+
* Access at:
|
|
13
|
+
* - Default ā http://localhost:3000/introduction
|
|
14
|
+
* - With --host-at-docs flag ā http://localhost:3000/docs/introduction
|
|
15
|
+
*
|
|
16
|
+
* The hostAtDocs setting is controlled via CLI flag (mirrors dashboard setting).
|
|
17
|
+
*
|
|
18
|
+
* What it does:
|
|
19
|
+
* 1. Sets PROJECT_NAME environment variable
|
|
20
|
+
* 2. Copies project's docs.json to public/docs.json
|
|
21
|
+
* 3. Copies project's images to public/images
|
|
22
|
+
* 4. Builds search index from project's content
|
|
23
|
+
* 5. Runs Next.js dev server
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
const { execSync, spawn } = require('child_process');
|
|
27
|
+
const fs = require('fs-extra');
|
|
28
|
+
const path = require('path');
|
|
29
|
+
|
|
30
|
+
// Colors for console output
|
|
31
|
+
const colors = {
|
|
32
|
+
cyan: '\x1b[36m',
|
|
33
|
+
yellow: '\x1b[33m',
|
|
34
|
+
green: '\x1b[32m',
|
|
35
|
+
red: '\x1b[31m',
|
|
36
|
+
reset: '\x1b[0m',
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Get the first page path from navigation config.
|
|
41
|
+
* Supports:
|
|
42
|
+
* - Jamdesk format: navigation.languages[].tabs[].groups[].pages[]
|
|
43
|
+
* - Mintlify tabs format: navigation.tabs[].groups[].pages[]
|
|
44
|
+
* - Mintlify flat format: navigation.pages[] with groups
|
|
45
|
+
*/
|
|
46
|
+
function getFirstPage(config) {
|
|
47
|
+
try {
|
|
48
|
+
const nav = config.navigation;
|
|
49
|
+
if (!nav) return 'introduction';
|
|
50
|
+
|
|
51
|
+
// Jamdesk format: navigation.languages[].tabs[].groups[].pages[]
|
|
52
|
+
if (nav.languages && nav.languages.length) {
|
|
53
|
+
const tabs = nav.languages[0]?.tabs;
|
|
54
|
+
if (!tabs?.length) return 'introduction';
|
|
55
|
+
|
|
56
|
+
const groups = tabs[0]?.groups;
|
|
57
|
+
if (!groups?.length) return 'introduction';
|
|
58
|
+
|
|
59
|
+
const pages = groups[0]?.pages;
|
|
60
|
+
if (!pages?.length) return 'introduction';
|
|
61
|
+
|
|
62
|
+
const firstPage = pages[0];
|
|
63
|
+
if (typeof firstPage === 'string') return firstPage;
|
|
64
|
+
return firstPage.page || 'introduction';
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// Mintlify tabs format: navigation.tabs[].groups[].pages[]
|
|
68
|
+
if (nav.tabs && nav.tabs.length) {
|
|
69
|
+
const groups = nav.tabs[0]?.groups;
|
|
70
|
+
if (groups?.length) {
|
|
71
|
+
const pages = groups[0]?.pages;
|
|
72
|
+
if (pages?.length) {
|
|
73
|
+
const firstPage = pages[0];
|
|
74
|
+
if (typeof firstPage === 'string') return firstPage;
|
|
75
|
+
return firstPage.page || 'introduction';
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// Mintlify flat format: navigation.pages[] where each item has group + pages
|
|
81
|
+
if (nav.pages && nav.pages.length) {
|
|
82
|
+
const firstGroup = nav.pages[0];
|
|
83
|
+
// Could be a group object with pages array, or a direct page reference
|
|
84
|
+
if (typeof firstGroup === 'object' && firstGroup.pages?.length) {
|
|
85
|
+
const firstPage = firstGroup.pages[0];
|
|
86
|
+
if (typeof firstPage === 'string') return firstPage;
|
|
87
|
+
return firstPage.page || 'introduction';
|
|
88
|
+
}
|
|
89
|
+
// Direct page reference
|
|
90
|
+
if (typeof firstGroup === 'string') return firstGroup;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
return 'introduction';
|
|
94
|
+
} catch {
|
|
95
|
+
return 'introduction';
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Clean up dev environment before starting
|
|
101
|
+
* - Kills processes on the specified port
|
|
102
|
+
* - Removes Next.js lock file
|
|
103
|
+
*
|
|
104
|
+
* Note: This uses execSync with fixed commands and validated port numbers.
|
|
105
|
+
* The port comes from CLI args and is validated as a number before use.
|
|
106
|
+
*/
|
|
107
|
+
function cleanupDevEnvironment(port, nextDir) {
|
|
108
|
+
console.log(`${colors.cyan}[CLEANUP]${colors.reset} Checking for existing dev processes...`);
|
|
109
|
+
let killedAny = false;
|
|
110
|
+
|
|
111
|
+
// Validate port is a number to prevent injection
|
|
112
|
+
const portNum = parseInt(port, 10);
|
|
113
|
+
if (isNaN(portNum) || portNum < 1 || portNum > 65535) {
|
|
114
|
+
console.warn(`${colors.yellow}[CLEANUP]${colors.reset} Invalid port number, skipping cleanup`);
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
try {
|
|
119
|
+
// Find processes on the port using lsof
|
|
120
|
+
// Using string template with validated number is safe
|
|
121
|
+
const lsofOutput = execSync(`lsof -ti :${portNum} 2>/dev/null || true`, { encoding: 'utf8' }).trim();
|
|
122
|
+
|
|
123
|
+
if (lsofOutput) {
|
|
124
|
+
const pids = lsofOutput.split('\n').filter(Boolean);
|
|
125
|
+
console.log(`\n${colors.yellow}[CLEANUP]${colors.reset} Found process(es) on port ${portNum}:`);
|
|
126
|
+
|
|
127
|
+
for (const pid of pids) {
|
|
128
|
+
// Validate PID is a number
|
|
129
|
+
const pidNum = parseInt(pid, 10);
|
|
130
|
+
if (isNaN(pidNum)) continue;
|
|
131
|
+
|
|
132
|
+
try {
|
|
133
|
+
// Get process details using validated PID
|
|
134
|
+
const processInfo = execSync(`ps -p ${pidNum} -o comm=,args= 2>/dev/null || echo "unknown"`, { encoding: 'utf8' }).trim();
|
|
135
|
+
const [cmd, ...argsArr] = processInfo.split(/\s+/);
|
|
136
|
+
const fullCmd = argsArr.join(' ').substring(0, 60);
|
|
137
|
+
|
|
138
|
+
console.log(` PID ${pidNum}: ${colors.cyan}${cmd}${colors.reset}`);
|
|
139
|
+
if (fullCmd) {
|
|
140
|
+
console.log(` Command: ${fullCmd}`);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// Kill the process using Node's process.kill (no shell)
|
|
144
|
+
console.log(`${colors.yellow}[CLEANUP]${colors.reset} Killing PID ${pidNum}...`);
|
|
145
|
+
try {
|
|
146
|
+
process.kill(pidNum, 'SIGTERM');
|
|
147
|
+
killedAny = true;
|
|
148
|
+
} catch (killErr) {
|
|
149
|
+
// Process may have already exited
|
|
150
|
+
}
|
|
151
|
+
} catch (psErr) {
|
|
152
|
+
// Process may have already exited
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
// Wait a moment and force kill if needed
|
|
157
|
+
if (killedAny) {
|
|
158
|
+
// Give processes time to terminate gracefully
|
|
159
|
+
execSync('sleep 1');
|
|
160
|
+
|
|
161
|
+
// Check for remaining processes
|
|
162
|
+
const remaining = execSync(`lsof -ti :${portNum} 2>/dev/null || true`, { encoding: 'utf8' }).trim();
|
|
163
|
+
if (remaining) {
|
|
164
|
+
for (const pid of remaining.split('\n').filter(Boolean)) {
|
|
165
|
+
const pidNum = parseInt(pid, 10);
|
|
166
|
+
if (isNaN(pidNum)) continue;
|
|
167
|
+
|
|
168
|
+
console.log(`${colors.yellow}[CLEANUP]${colors.reset} Force killing PID ${pidNum}...`);
|
|
169
|
+
try {
|
|
170
|
+
process.kill(pidNum, 'SIGKILL');
|
|
171
|
+
} catch (killErr) {
|
|
172
|
+
// Process may have already exited
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
execSync('sleep 1');
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
} catch (err) {
|
|
180
|
+
// lsof may fail if no process found, that's OK
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
// Handle Next.js lock file
|
|
184
|
+
if (nextDir) {
|
|
185
|
+
const lockFile = path.join(nextDir, 'dev', 'lock');
|
|
186
|
+
if (fs.existsSync(lockFile)) {
|
|
187
|
+
console.log(`${colors.yellow}[CLEANUP]${colors.reset} Removing Next.js lock file: ${lockFile}`);
|
|
188
|
+
try {
|
|
189
|
+
fs.unlinkSync(lockFile);
|
|
190
|
+
killedAny = true;
|
|
191
|
+
} catch (err) {
|
|
192
|
+
console.warn(` Could not remove lock file: ${err.message}`);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
// Summary
|
|
198
|
+
if (killedAny) {
|
|
199
|
+
console.log(`${colors.green}[CLEANUP]${colors.reset} Cleanup complete - ready to start fresh`);
|
|
200
|
+
} else {
|
|
201
|
+
console.log(`${colors.green}[CLEANUP]${colors.reset} No conflicts found - port ${portNum} is available`);
|
|
202
|
+
}
|
|
203
|
+
console.log('');
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
// Project directories - check monorepo first, then local
|
|
207
|
+
const BUILD_SERVICE_PROJECTS_DIR = path.join(__dirname, '../projects');
|
|
208
|
+
const MONOREPO_PROJECTS_DIR = path.join(__dirname, '../../..', 'projects'); // jamdesk/projects/ (submodules)
|
|
209
|
+
|
|
210
|
+
function getProjectsDir() {
|
|
211
|
+
// Use explicit env var if set AND path exists with content
|
|
212
|
+
if (process.env.JAMDESK_PROJECTS_DIR && fs.existsSync(process.env.JAMDESK_PROJECTS_DIR)) {
|
|
213
|
+
const entries = fs.readdirSync(process.env.JAMDESK_PROJECTS_DIR);
|
|
214
|
+
if (entries.length > 0) {
|
|
215
|
+
return process.env.JAMDESK_PROJECTS_DIR;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
// Check monorepo projects/ directory (submodules)
|
|
219
|
+
if (fs.existsSync(MONOREPO_PROJECTS_DIR)) {
|
|
220
|
+
return MONOREPO_PROJECTS_DIR;
|
|
221
|
+
}
|
|
222
|
+
return BUILD_SERVICE_PROJECTS_DIR;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
// Parse arguments
|
|
226
|
+
const args = process.argv.slice(2);
|
|
227
|
+
const projectName = args.find(arg => !arg.startsWith('--'));
|
|
228
|
+
const port = args.includes('--port') ? args[args.indexOf('--port') + 1] : '3000';
|
|
229
|
+
// Monorepo subpath (e.g., --path jamdesk for endgame/jamdesk/)
|
|
230
|
+
const subPath = args.includes('--path') ? args[args.indexOf('--path') + 1] : null;
|
|
231
|
+
// hostAtDocs flag - mirrors the dashboard toggle setting
|
|
232
|
+
const hostAtDocs = args.includes('--host-at-docs');
|
|
233
|
+
|
|
234
|
+
if (!projectName) {
|
|
235
|
+
console.log(`
|
|
236
|
+
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
|
|
237
|
+
ā Dev Server for Project ā
|
|
238
|
+
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
|
|
239
|
+
|
|
240
|
+
Usage:
|
|
241
|
+
npm run dev-project <project-name> [options]
|
|
242
|
+
|
|
243
|
+
Options:
|
|
244
|
+
--port <port> Port to run dev server on (default: 3000)
|
|
245
|
+
--path <subdir> Subdirectory within project (for monorepos)
|
|
246
|
+
--host-at-docs Serve docs at /docs/* instead of root (mirrors dashboard toggle)
|
|
247
|
+
|
|
248
|
+
Examples:
|
|
249
|
+
npm run dev-project acme # Serve at root (localhost:3000/introduction)
|
|
250
|
+
npm run dev-project acme --host-at-docs # Serve at /docs (localhost:3000/docs/introduction)
|
|
251
|
+
npm run dev-project demo --port 3001 # Run on port 3001
|
|
252
|
+
npm run dev-project endgame --path jamdesk # Monorepo: endgame/jamdesk/
|
|
253
|
+
|
|
254
|
+
Available projects:`);
|
|
255
|
+
|
|
256
|
+
const projectsDir = getProjectsDir();
|
|
257
|
+
if (fs.existsSync(projectsDir)) {
|
|
258
|
+
const projects = fs.readdirSync(projectsDir)
|
|
259
|
+
.filter(f => fs.statSync(path.join(projectsDir, f)).isDirectory());
|
|
260
|
+
if (projects.length > 0) {
|
|
261
|
+
projects.forEach(t => console.log(` - ${t}`));
|
|
262
|
+
} else {
|
|
263
|
+
console.log(' (no projects found - create directories in /projects/)');
|
|
264
|
+
}
|
|
265
|
+
} else {
|
|
266
|
+
console.log(' (projects directory not found)');
|
|
267
|
+
}
|
|
268
|
+
console.log('');
|
|
269
|
+
process.exit(1);
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
// Verify project exists
|
|
273
|
+
const projectsDir = getProjectsDir();
|
|
274
|
+
const projectBaseDir = path.join(projectsDir, projectName);
|
|
275
|
+
// If subPath specified, use it; otherwise auto-detect common monorepo patterns
|
|
276
|
+
let projectDir = projectBaseDir;
|
|
277
|
+
let effectiveSubPath = subPath;
|
|
278
|
+
|
|
279
|
+
if (!fs.existsSync(projectBaseDir)) {
|
|
280
|
+
console.error(`\nā Error: Project directory not found: ${projectBaseDir}`);
|
|
281
|
+
console.error('\nAvailable projects:');
|
|
282
|
+
if (fs.existsSync(projectsDir)) {
|
|
283
|
+
const projects = fs.readdirSync(projectsDir)
|
|
284
|
+
.filter(f => fs.statSync(path.join(projectsDir, f)).isDirectory());
|
|
285
|
+
projects.forEach(t => console.error(` - ${t}`));
|
|
286
|
+
}
|
|
287
|
+
process.exit(1);
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
// Handle monorepo subpath
|
|
291
|
+
if (subPath) {
|
|
292
|
+
projectDir = path.join(projectBaseDir, subPath);
|
|
293
|
+
if (!fs.existsSync(projectDir)) {
|
|
294
|
+
console.error(`\nā Error: Subpath not found: ${projectDir}`);
|
|
295
|
+
process.exit(1);
|
|
296
|
+
}
|
|
297
|
+
} else {
|
|
298
|
+
// Auto-detect monorepo: if no docs.json at root, check for common subdirs
|
|
299
|
+
const rootDocsJson = path.join(projectBaseDir, 'docs.json');
|
|
300
|
+
if (!fs.existsSync(rootDocsJson)) {
|
|
301
|
+
// Check common monorepo patterns
|
|
302
|
+
const patterns = ['jamdesk', 'docs', 'documentation'];
|
|
303
|
+
for (const pattern of patterns) {
|
|
304
|
+
const subDocsJson = path.join(projectBaseDir, pattern, 'docs.json');
|
|
305
|
+
if (fs.existsSync(subDocsJson)) {
|
|
306
|
+
effectiveSubPath = pattern;
|
|
307
|
+
projectDir = path.join(projectBaseDir, pattern);
|
|
308
|
+
console.log(`š¦ Auto-detected monorepo path: ${projectName}/${pattern}/`);
|
|
309
|
+
break;
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
/**
|
|
316
|
+
* Check if npm dependencies are installed and up-to-date.
|
|
317
|
+
* Auto-installs if package-lock.json is newer than node_modules.
|
|
318
|
+
*/
|
|
319
|
+
function checkDependencies() {
|
|
320
|
+
const buildServiceDir = path.join(__dirname, '..');
|
|
321
|
+
const nodeModulesDir = path.join(buildServiceDir, 'node_modules');
|
|
322
|
+
const packageLockPath = path.join(buildServiceDir, 'package-lock.json');
|
|
323
|
+
|
|
324
|
+
// Check if node_modules exists
|
|
325
|
+
if (!fs.existsSync(nodeModulesDir)) {
|
|
326
|
+
console.log(`${colors.yellow}[DEPS]${colors.reset} node_modules not found, installing dependencies...`);
|
|
327
|
+
const { execFileSync } = require('child_process');
|
|
328
|
+
execFileSync('npm', ['install'], { stdio: 'inherit', cwd: buildServiceDir });
|
|
329
|
+
return;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
// Check if package-lock.json is newer than node_modules
|
|
333
|
+
// This catches cases where dependencies were added but not installed
|
|
334
|
+
if (fs.existsSync(packageLockPath)) {
|
|
335
|
+
const lockMtime = fs.statSync(packageLockPath).mtimeMs;
|
|
336
|
+
const nodeModulesMtime = fs.statSync(nodeModulesDir).mtimeMs;
|
|
337
|
+
|
|
338
|
+
if (lockMtime > nodeModulesMtime) {
|
|
339
|
+
console.log(`${colors.yellow}[DEPS]${colors.reset} package-lock.json changed, updating dependencies...`);
|
|
340
|
+
const { execFileSync } = require('child_process');
|
|
341
|
+
execFileSync('npm', ['install'], { stdio: 'inherit', cwd: buildServiceDir });
|
|
342
|
+
return;
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
console.log(`${colors.green}[DEPS]${colors.reset} Dependencies up to date`);
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
async function runDev() {
|
|
350
|
+
// For monorepo projects, PROJECT_NAME includes the subpath (e.g., "endgame/jamdesk")
|
|
351
|
+
const effectiveProjectName = effectiveSubPath ? `${projectName}/${effectiveSubPath}` : projectName;
|
|
352
|
+
const displayName = effectiveProjectName.padEnd(30);
|
|
353
|
+
|
|
354
|
+
// Check dependencies before anything else
|
|
355
|
+
checkDependencies();
|
|
356
|
+
|
|
357
|
+
// Clean up any existing dev processes before starting
|
|
358
|
+
// This handles port conflicts and Next.js lock file issues
|
|
359
|
+
const nextDir = path.join(__dirname, '../.next');
|
|
360
|
+
cleanupDevEnvironment(port, nextDir);
|
|
361
|
+
|
|
362
|
+
console.log(`
|
|
363
|
+
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
|
|
364
|
+
ā Dev Server for: ${displayName} ā
|
|
365
|
+
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
|
|
366
|
+
`);
|
|
367
|
+
|
|
368
|
+
// hostAtDocs is controlled via CLI flag (mirrors dashboard toggle)
|
|
369
|
+
// This determines if docs are served at /docs/* (true) or root /* (false)
|
|
370
|
+
if (hostAtDocs) {
|
|
371
|
+
console.log('š --host-at-docs: serving docs at /docs/*');
|
|
372
|
+
} else {
|
|
373
|
+
console.log('š Serving docs at root /*');
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
const env = {
|
|
377
|
+
...process.env,
|
|
378
|
+
PROJECT_NAME: effectiveProjectName,
|
|
379
|
+
JAMDESK_PROJECTS_DIR: projectsDir, // Pass the resolved projects directory to child scripts
|
|
380
|
+
HOST_AT_DOCS: hostAtDocs ? 'true' : 'false', // Pass to Next.js config
|
|
381
|
+
NEXT_PUBLIC_BASE_PATH: hostAtDocs ? '/docs' : '', // Pass to client components for asset URLs
|
|
382
|
+
};
|
|
383
|
+
|
|
384
|
+
try {
|
|
385
|
+
// Step 0: Validate docs.json configuration
|
|
386
|
+
const projectDocsJson = path.join(projectDir, 'docs.json');
|
|
387
|
+
if (fs.existsSync(projectDocsJson)) {
|
|
388
|
+
console.log('š Validating docs.json...');
|
|
389
|
+
try {
|
|
390
|
+
// Use execFileSync to avoid shell injection (path is local filesystem only)
|
|
391
|
+
// Use npx tsx to run the TypeScript validation module directly
|
|
392
|
+
const { execFileSync } = require('child_process');
|
|
393
|
+
execFileSync('npx', ['tsx', 'scripts/validate-config.mjs', projectDocsJson], {
|
|
394
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
395
|
+
cwd: path.join(__dirname, '..'),
|
|
396
|
+
env,
|
|
397
|
+
});
|
|
398
|
+
console.log(`ā docs.json is valid`);
|
|
399
|
+
} catch (validationError) {
|
|
400
|
+
const errorOutput = validationError.stderr?.toString() || validationError.message;
|
|
401
|
+
console.error(`\n${colors.red}ā Configuration Error${colors.reset}`);
|
|
402
|
+
console.error(`${colors.red}${errorOutput}${colors.reset}\n`);
|
|
403
|
+
process.exit(1);
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
// Step 1: Copy project's docs.json to public/docs.json
|
|
408
|
+
console.log('š Copying project docs.json...');
|
|
409
|
+
const publicDocsJson = path.join(__dirname, '../public/docs.json');
|
|
410
|
+
if (fs.existsSync(projectDocsJson)) {
|
|
411
|
+
await fs.copy(projectDocsJson, publicDocsJson, { overwrite: true });
|
|
412
|
+
console.log(`ā Copied docs.json`);
|
|
413
|
+
} else {
|
|
414
|
+
console.warn(`Warning: Project docs.json not found: ${projectDocsJson}`);
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
// Step 2: Copy project's images to public/images
|
|
418
|
+
console.log('š Copying assets...');
|
|
419
|
+
execSync(`node scripts/copy-files.cjs --project ${effectiveProjectName}`, {
|
|
420
|
+
stdio: 'inherit',
|
|
421
|
+
cwd: path.join(__dirname, '..'),
|
|
422
|
+
env,
|
|
423
|
+
});
|
|
424
|
+
|
|
425
|
+
// Step 2.5: Enhance navigation with MDX frontmatter (titles, API methods)
|
|
426
|
+
console.log('š§ Enhancing navigation with frontmatter...');
|
|
427
|
+
execSync(`node scripts/enhance-navigation.cjs --project ${effectiveProjectName}`, {
|
|
428
|
+
stdio: 'inherit',
|
|
429
|
+
cwd: path.join(__dirname, '..'),
|
|
430
|
+
env,
|
|
431
|
+
});
|
|
432
|
+
|
|
433
|
+
// Step 2.6: Compile snippets (if project has snippets folder)
|
|
434
|
+
const snippetsDir = path.join(projectDir, 'snippets');
|
|
435
|
+
if (fs.existsSync(snippetsDir)) {
|
|
436
|
+
console.log('š§© Compiling snippets...');
|
|
437
|
+
} else {
|
|
438
|
+
console.log('š§© Creating empty snippets module...');
|
|
439
|
+
}
|
|
440
|
+
execSync(`node scripts/compile-snippets.cjs --project ${effectiveProjectName}`, {
|
|
441
|
+
stdio: 'inherit',
|
|
442
|
+
cwd: path.join(__dirname, '..'),
|
|
443
|
+
env,
|
|
444
|
+
});
|
|
445
|
+
|
|
446
|
+
// Step 3: Build search index
|
|
447
|
+
console.log('š Building search index...');
|
|
448
|
+
execSync(`node scripts/build-search-index.cjs --project ${effectiveProjectName}`, {
|
|
449
|
+
stdio: 'inherit',
|
|
450
|
+
cwd: path.join(__dirname, '..'),
|
|
451
|
+
env,
|
|
452
|
+
});
|
|
453
|
+
|
|
454
|
+
// Step 4: Run Next.js dev server
|
|
455
|
+
console.log(`\nš Starting dev server on port ${port}...`);
|
|
456
|
+
// Get first page and OpenAPI config from docs.json (reuse projectDocsJson from step 1)
|
|
457
|
+
let firstPage = 'introduction';
|
|
458
|
+
let hasOpenApi = false;
|
|
459
|
+
try {
|
|
460
|
+
const docsConfig = JSON.parse(fs.readFileSync(projectDocsJson, 'utf-8'));
|
|
461
|
+
firstPage = getFirstPage(docsConfig);
|
|
462
|
+
hasOpenApi = Boolean(docsConfig.api?.openapi);
|
|
463
|
+
} catch {
|
|
464
|
+
// Fall back to defaults if docs.json can't be read
|
|
465
|
+
}
|
|
466
|
+
// Show correct URL based on --host-at-docs flag
|
|
467
|
+
const basePath = hostAtDocs ? '/docs' : '';
|
|
468
|
+
console.log(`\n Access at: http://localhost:${port}${basePath}/${firstPage}\n`);
|
|
469
|
+
|
|
470
|
+
// Use Turbopack by default (~5x faster than webpack)
|
|
471
|
+
// Fall back to webpack with --webpack flag if needed
|
|
472
|
+
const forceWebpack = process.argv.includes('--webpack');
|
|
473
|
+
const nextArgs = forceWebpack
|
|
474
|
+
? ['next', 'dev', '--webpack', '-p', port]
|
|
475
|
+
: ['next', 'dev', '-p', port];
|
|
476
|
+
|
|
477
|
+
console.log(` ${forceWebpack ? 'š¦ Using Webpack' : 'ā” Using Turbopack'}\n`);
|
|
478
|
+
const nextDev = spawn('npx', nextArgs, {
|
|
479
|
+
stdio: ['inherit', 'pipe', 'pipe'],
|
|
480
|
+
cwd: path.join(__dirname, '..'),
|
|
481
|
+
env,
|
|
482
|
+
});
|
|
483
|
+
|
|
484
|
+
// Filter Next.js output to suppress noisy/confusing messages
|
|
485
|
+
const filterNextOutput = (data) => {
|
|
486
|
+
const lines = data.toString().split('\n');
|
|
487
|
+
// Regex to strip ANSI escape codes (colors, formatting)
|
|
488
|
+
const stripAnsi = (str) => str.replace(/\x1b\[[0-9;]*m/g, '');
|
|
489
|
+
|
|
490
|
+
return lines
|
|
491
|
+
.filter(line => {
|
|
492
|
+
const stripped = stripAnsi(line).trim();
|
|
493
|
+
|
|
494
|
+
// Filter out experimental feature status indicators (· enabled, ⨯ disabled)
|
|
495
|
+
// These appear at startup: " · optimizePackageImports" and " ⨯ serverSourceMaps"
|
|
496
|
+
if (stripped.startsWith('·') || stripped.startsWith('⨯')) return false;
|
|
497
|
+
|
|
498
|
+
// Filter out page access logs (e.g., " GET /introduction 200 in 72s")
|
|
499
|
+
// Keep compilation logs (e.g., "ā Compiling /introduction...")
|
|
500
|
+
if (/^(GET|POST|PUT|DELETE|PATCH|HEAD|OPTIONS)\s+\/\S+\s+\d+\s+in\s+/.test(stripped)) return false;
|
|
501
|
+
|
|
502
|
+
return true;
|
|
503
|
+
})
|
|
504
|
+
.join('\n');
|
|
505
|
+
};
|
|
506
|
+
|
|
507
|
+
nextDev.stdout.on('data', (data) => {
|
|
508
|
+
const filtered = filterNextOutput(data);
|
|
509
|
+
if (filtered.trim()) process.stdout.write(filtered);
|
|
510
|
+
});
|
|
511
|
+
|
|
512
|
+
nextDev.stderr.on('data', (data) => {
|
|
513
|
+
const filtered = filterNextOutput(data);
|
|
514
|
+
if (filtered.trim()) process.stderr.write(filtered);
|
|
515
|
+
});
|
|
516
|
+
|
|
517
|
+
nextDev.on('close', (code) => {
|
|
518
|
+
process.exit(code);
|
|
519
|
+
});
|
|
520
|
+
|
|
521
|
+
// Handle Ctrl+C
|
|
522
|
+
process.on('SIGINT', () => {
|
|
523
|
+
nextDev.kill('SIGINT');
|
|
524
|
+
process.exit(0);
|
|
525
|
+
});
|
|
526
|
+
|
|
527
|
+
} catch (error) {
|
|
528
|
+
console.error('\nā Failed to start dev server:', error.message);
|
|
529
|
+
process.exit(1);
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
runDev();
|
|
534
|
+
|