polen 0.9.1-next.1 → 0.10.0-next.10
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 +49 -364
- package/build/api/api.d.ts +1 -0
- package/build/api/api.d.ts.map +1 -1
- package/build/api/api.js +1 -0
- package/build/api/api.js.map +1 -1
- package/build/api/config/configurator.d.ts +9 -1
- package/build/api/config/configurator.d.ts.map +1 -1
- package/build/api/config/configurator.js +18 -6
- package/build/api/config/configurator.js.map +1 -1
- package/build/api/config/load.js +5 -5
- package/build/api/config/load.js.map +1 -1
- package/build/api/config-resolver/resolve.js +2 -2
- package/build/api/config-resolver/resolve.js.map +1 -1
- package/build/api/content/$$.d.ts +7 -0
- package/build/api/content/$$.d.ts.map +1 -0
- package/build/api/content/$$.js +7 -0
- package/build/api/content/$$.js.map +1 -0
- package/build/api/content/$.d.ts +2 -0
- package/build/api/content/$.d.ts.map +1 -0
- package/build/api/content/$.js +2 -0
- package/build/api/content/$.js.map +1 -0
- package/build/api/content/metadata.d.ts +10 -0
- package/build/api/content/metadata.d.ts.map +1 -0
- package/build/api/content/metadata.js +9 -0
- package/build/api/content/metadata.js.map +1 -0
- package/build/api/content/navbar.d.ts +10 -0
- package/build/api/content/navbar.d.ts.map +1 -0
- package/build/api/content/navbar.js +45 -0
- package/build/api/content/navbar.js.map +1 -0
- package/build/api/content/page.d.ts +11 -0
- package/build/api/content/page.d.ts.map +1 -0
- package/build/api/content/page.js +2 -0
- package/build/api/content/page.js.map +1 -0
- package/build/api/content/scan.d.ts +19 -0
- package/build/api/content/scan.d.ts.map +1 -0
- package/build/api/content/scan.js +90 -0
- package/build/api/content/scan.js.map +1 -0
- package/build/api/content/sidebar.d.ts +104 -0
- package/build/api/content/sidebar.d.ts.map +1 -0
- package/build/api/content/sidebar.js +166 -0
- package/build/api/content/sidebar.js.map +1 -0
- package/build/api/content/utils.d.ts +5 -0
- package/build/api/content/utils.d.ts.map +1 -0
- package/build/api/content/utils.js +8 -0
- package/build/api/content/utils.js.map +1 -0
- package/build/api/schema/data-sources/schema-directory/schema-directory.d.ts.map +1 -1
- package/build/api/schema/data-sources/schema-directory/schema-directory.js +3 -2
- package/build/api/schema/data-sources/schema-directory/schema-directory.js.map +1 -1
- package/build/api/static/index.d.ts +2 -0
- package/build/api/static/index.d.ts.map +1 -0
- package/build/api/static/index.js +2 -0
- package/build/api/static/index.js.map +1 -0
- package/build/api/static/manifest.d.ts +18 -0
- package/build/api/static/manifest.d.ts.map +1 -0
- package/build/api/static/manifest.js +13 -0
- package/build/api/static/manifest.js.map +1 -0
- package/build/api/static/rebase.d.ts +14 -0
- package/build/api/static/rebase.d.ts.map +1 -0
- package/build/api/static/rebase.js +110 -0
- package/build/api/static/rebase.js.map +1 -0
- package/build/api/static/static.d.ts +3 -0
- package/build/api/static/static.d.ts.map +1 -0
- package/build/api/static/static.js +3 -0
- package/build/api/static/static.js.map +1 -0
- package/build/api/vite/plugins/branding/index.d.ts +4 -0
- package/build/api/vite/plugins/branding/index.d.ts.map +1 -0
- package/build/api/vite/plugins/branding/index.js +80 -0
- package/build/api/vite/plugins/branding/index.js.map +1 -0
- package/build/api/vite/plugins/build.d.ts.map +1 -1
- package/build/api/vite/plugins/build.js +22 -1
- package/build/api/vite/plugins/build.js.map +1 -1
- package/build/api/vite/plugins/core.d.ts +2 -2
- package/build/api/vite/plugins/core.d.ts.map +1 -1
- package/build/api/vite/plugins/core.js +4 -5
- package/build/api/vite/plugins/core.js.map +1 -1
- package/build/api/vite/plugins/main.d.ts.map +1 -1
- package/build/api/vite/plugins/main.js +2 -1
- package/build/api/vite/plugins/main.js.map +1 -1
- package/build/api/vite/plugins/pages.d.ts +8 -14
- package/build/api/vite/plugins/pages.d.ts.map +1 -1
- package/build/api/vite/plugins/pages.js +110 -183
- package/build/api/vite/plugins/pages.js.map +1 -1
- package/build/api/vite/plugins/serve.js +5 -5
- package/build/api/vite/plugins/serve.js.map +1 -1
- package/build/cli/_/self-contained-mode.js +5 -5
- package/build/cli/_/self-contained-mode.js.map +1 -1
- package/build/cli/commands/static/$default.d.ts +3 -0
- package/build/cli/commands/static/$default.d.ts.map +1 -0
- package/build/cli/commands/static/$default.js +38 -0
- package/build/cli/commands/static/$default.js.map +1 -0
- package/build/cli/commands/static/rebase.d.ts +2 -0
- package/build/cli/commands/static/rebase.d.ts.map +1 -0
- package/build/cli/commands/static/rebase.js +26 -0
- package/build/cli/commands/static/rebase.js.map +1 -0
- package/build/cli/commands/static.d.ts +3 -0
- package/build/cli/commands/static.d.ts.map +1 -0
- package/build/cli/commands/static.js +5 -0
- package/build/cli/commands/static.js.map +1 -0
- package/build/exports/components.d.ts +2 -0
- package/build/exports/components.d.ts.map +1 -0
- package/build/exports/components.js +2 -0
- package/build/exports/components.js.map +1 -0
- package/build/lib/demos/builder.d.ts +83 -0
- package/build/lib/demos/builder.d.ts.map +1 -0
- package/build/lib/demos/builder.js +237 -0
- package/build/lib/demos/builder.js.map +1 -0
- package/build/lib/demos/config-schema.d.ts +243 -0
- package/build/lib/demos/config-schema.d.ts.map +1 -0
- package/build/lib/demos/config-schema.js +52 -0
- package/build/lib/demos/config-schema.js.map +1 -0
- package/build/lib/demos/config.d.ts +40 -0
- package/build/lib/demos/config.d.ts.map +1 -0
- package/build/lib/demos/config.js +180 -0
- package/build/lib/demos/config.js.map +1 -0
- package/build/lib/demos/index.d.ts +9 -0
- package/build/lib/demos/index.d.ts.map +1 -0
- package/build/lib/demos/index.js +8 -0
- package/build/lib/demos/index.js.map +1 -0
- package/build/lib/demos/ui/components.d.ts +33 -0
- package/build/lib/demos/ui/components.d.ts.map +1 -0
- package/build/lib/demos/ui/components.js +699 -0
- package/build/lib/demos/ui/components.js.map +1 -0
- package/build/lib/demos/ui/data-collector.d.ts +88 -0
- package/build/lib/demos/ui/data-collector.d.ts.map +1 -0
- package/build/lib/demos/ui/data-collector.js +174 -0
- package/build/lib/demos/ui/data-collector.js.map +1 -0
- package/build/lib/demos/ui/landing-page-cli.d.ts +3 -0
- package/build/lib/demos/ui/landing-page-cli.d.ts.map +1 -0
- package/build/lib/demos/ui/landing-page-cli.js +21 -0
- package/build/lib/demos/ui/landing-page-cli.js.map +1 -0
- package/build/lib/demos/ui/landing-page.d.ts +32 -0
- package/build/lib/demos/ui/landing-page.d.ts.map +1 -0
- package/build/lib/demos/ui/landing-page.js +83 -0
- package/build/lib/demos/ui/landing-page.js.map +1 -0
- package/build/lib/demos/ui/page-renderer.d.ts +26 -0
- package/build/lib/demos/ui/page-renderer.d.ts.map +1 -0
- package/build/lib/demos/ui/page-renderer.js +104 -0
- package/build/lib/demos/ui/page-renderer.js.map +1 -0
- package/build/lib/demos/utils.d.ts +14 -0
- package/build/lib/demos/utils.d.ts.map +1 -0
- package/build/lib/demos/utils.js +37 -0
- package/build/lib/demos/utils.js.map +1 -0
- package/build/lib/deployment/$$.d.ts +3 -0
- package/build/lib/deployment/$$.d.ts.map +1 -0
- package/build/lib/deployment/$$.js +3 -0
- package/build/lib/deployment/$$.js.map +1 -0
- package/build/lib/deployment/$.d.ts +2 -0
- package/build/lib/deployment/$.d.ts.map +1 -0
- package/build/lib/deployment/$.js +2 -0
- package/build/lib/deployment/$.js.map +1 -0
- package/build/lib/deployment/metadata.d.ts +32 -0
- package/build/lib/deployment/metadata.d.ts.map +1 -0
- package/build/lib/deployment/metadata.js +37 -0
- package/build/lib/deployment/metadata.js.map +1 -0
- package/build/lib/deployment/path-manager.d.ts +41 -0
- package/build/lib/deployment/path-manager.d.ts.map +1 -0
- package/build/lib/deployment/path-manager.js +157 -0
- package/build/lib/deployment/path-manager.js.map +1 -0
- package/build/lib/file-router/file-router.d.ts +0 -2
- package/build/lib/file-router/file-router.d.ts.map +1 -1
- package/build/lib/file-router/file-router.js +0 -2
- package/build/lib/file-router/file-router.js.map +1 -1
- package/build/lib/file-router/route.d.ts +2 -0
- package/build/lib/file-router/route.d.ts.map +1 -1
- package/build/lib/file-router/route.js.map +1 -1
- package/build/lib/file-router/scan.d.ts.map +1 -1
- package/build/lib/file-router/scan.js +22 -13
- package/build/lib/file-router/scan.js.map +1 -1
- package/build/lib/github-actions/git-controller.d.ts +50 -0
- package/build/lib/github-actions/git-controller.d.ts.map +1 -0
- package/build/lib/github-actions/git-controller.js +90 -0
- package/build/lib/github-actions/git-controller.js.map +1 -0
- package/build/lib/github-actions/github-actions.d.ts +7 -0
- package/build/lib/github-actions/github-actions.d.ts.map +1 -0
- package/build/lib/github-actions/github-actions.js +7 -0
- package/build/lib/github-actions/github-actions.js.map +1 -0
- package/build/lib/github-actions/index.d.ts +2 -0
- package/build/lib/github-actions/index.d.ts.map +1 -0
- package/build/lib/github-actions/index.js +2 -0
- package/build/lib/github-actions/index.js.map +1 -0
- package/build/lib/github-actions/lib/get-pr-deployments.d.ts +12 -0
- package/build/lib/github-actions/lib/get-pr-deployments.d.ts.map +1 -0
- package/build/lib/github-actions/lib/get-pr-deployments.js +51 -0
- package/build/lib/github-actions/lib/get-pr-deployments.js.map +1 -0
- package/build/lib/github-actions/pr-controller.d.ts +39 -0
- package/build/lib/github-actions/pr-controller.d.ts.map +1 -0
- package/build/lib/github-actions/pr-controller.js +122 -0
- package/build/lib/github-actions/pr-controller.js.map +1 -0
- package/build/lib/github-actions/run-step-cli.d.ts +9 -0
- package/build/lib/github-actions/run-step-cli.d.ts.map +1 -0
- package/build/lib/github-actions/run-step-cli.js +71 -0
- package/build/lib/github-actions/run-step-cli.js.map +1 -0
- package/build/lib/github-actions/runner.d.ts +17 -0
- package/build/lib/github-actions/runner.d.ts.map +1 -0
- package/build/lib/github-actions/runner.js +195 -0
- package/build/lib/github-actions/runner.js.map +1 -0
- package/build/lib/github-actions/schemas/context.d.ts +933 -0
- package/build/lib/github-actions/schemas/context.d.ts.map +1 -0
- package/build/lib/github-actions/schemas/context.js +407 -0
- package/build/lib/github-actions/schemas/context.js.map +1 -0
- package/build/lib/github-actions/schemas/index.d.ts +5 -0
- package/build/lib/github-actions/schemas/index.d.ts.map +1 -0
- package/build/lib/github-actions/schemas/index.js +5 -0
- package/build/lib/github-actions/schemas/index.js.map +1 -0
- package/build/lib/github-actions/search-module.d.ts +38 -0
- package/build/lib/github-actions/search-module.d.ts.map +1 -0
- package/build/lib/github-actions/search-module.js +40 -0
- package/build/lib/github-actions/search-module.js.map +1 -0
- package/build/lib/github-actions/step.d.ts +163 -0
- package/build/lib/github-actions/step.d.ts.map +1 -0
- package/build/lib/github-actions/step.js +121 -0
- package/build/lib/github-actions/step.js.map +1 -0
- package/build/lib/helpers.d.ts.map +1 -1
- package/build/lib/helpers.js +5 -3
- package/build/lib/helpers.js.map +1 -1
- package/build/lib/kit-temp.d.ts +54 -0
- package/build/lib/kit-temp.d.ts.map +1 -1
- package/build/lib/kit-temp.js +82 -14
- package/build/lib/kit-temp.js.map +1 -1
- package/build/lib/kit-temp.test-d.d.ts +2 -0
- package/build/lib/kit-temp.test-d.d.ts.map +1 -0
- package/build/lib/kit-temp.test-d.js +75 -0
- package/build/lib/kit-temp.test-d.js.map +1 -0
- package/build/lib/mask/$$.d.ts +3 -0
- package/build/lib/mask/$$.d.ts.map +1 -0
- package/build/lib/mask/$$.js +3 -0
- package/build/lib/mask/$$.js.map +1 -0
- package/build/lib/mask/$.d.ts +2 -0
- package/build/lib/mask/$.d.ts.map +1 -0
- package/build/lib/mask/$.js +2 -0
- package/build/lib/mask/$.js.map +1 -0
- package/build/lib/mask/apply.d.ts +86 -0
- package/build/lib/mask/apply.d.ts.map +1 -0
- package/build/lib/mask/apply.js +86 -0
- package/build/lib/mask/apply.js.map +1 -0
- package/build/lib/mask/mask.d.ts +124 -0
- package/build/lib/mask/mask.d.ts.map +1 -0
- package/build/lib/mask/mask.js +137 -0
- package/build/lib/mask/mask.js.map +1 -0
- package/build/lib/mask/mask.test-d.d.ts +2 -0
- package/build/lib/mask/mask.test-d.d.ts.map +1 -0
- package/build/lib/mask/mask.test-d.js +102 -0
- package/build/lib/mask/mask.test-d.js.map +1 -0
- package/build/lib/mutation-type.d.ts +18 -0
- package/build/lib/mutation-type.d.ts.map +1 -0
- package/build/lib/mutation-type.js +16 -0
- package/build/lib/mutation-type.js.map +1 -0
- package/build/lib/task/$$.d.ts +3 -0
- package/build/lib/task/$$.d.ts.map +1 -0
- package/build/lib/task/$$.js +3 -0
- package/build/lib/task/$$.js.map +1 -0
- package/build/lib/task/$.d.ts +2 -0
- package/build/lib/task/$.d.ts.map +1 -0
- package/build/lib/task/$.js +2 -0
- package/build/lib/task/$.js.map +1 -0
- package/build/lib/task/report.d.ts +28 -0
- package/build/lib/task/report.d.ts.map +1 -0
- package/build/lib/task/report.js +33 -0
- package/build/lib/task/report.js.map +1 -0
- package/build/lib/task/task.d.ts +44 -0
- package/build/lib/task/task.d.ts.map +1 -0
- package/build/lib/task/task.js +63 -0
- package/build/lib/task/task.js.map +1 -0
- package/build/lib/version-history/index.d.ts +3 -0
- package/build/lib/version-history/index.d.ts.map +1 -0
- package/build/lib/version-history/index.js +2 -0
- package/build/lib/version-history/index.js.map +1 -0
- package/build/lib/version-history/types.d.ts +64 -0
- package/build/lib/version-history/types.d.ts.map +1 -0
- package/build/lib/version-history/types.js +5 -0
- package/build/lib/version-history/types.js.map +1 -0
- package/build/lib/version-history/version-history.d.ts +85 -0
- package/build/lib/version-history/version-history.d.ts.map +1 -0
- package/build/lib/version-history/version-history.js +248 -0
- package/build/lib/version-history/version-history.js.map +1 -0
- package/build/lib/vite-virtual/debug.d.ts +1 -1
- package/build/lib/vite-virtual/debug.d.ts.map +1 -1
- package/build/lib/vite-virtual/debug.js +1 -1
- package/build/lib/vite-virtual/debug.js.map +1 -1
- package/build/project-data.d.ts +0 -1
- package/build/project-data.d.ts.map +1 -1
- package/build/sandbox.d.ts +2 -0
- package/build/sandbox.d.ts.map +1 -0
- package/build/sandbox.js +18 -0
- package/build/sandbox.js.map +1 -0
- package/build/singletons/debug.d.ts +2 -2
- package/build/singletons/debug.d.ts.map +1 -1
- package/build/singletons/debug.js +2 -2
- package/build/singletons/debug.js.map +1 -1
- package/build/template/components/HamburgerMenu.d.ts +9 -0
- package/build/template/components/HamburgerMenu.d.ts.map +1 -0
- package/build/template/components/HamburgerMenu.jsx +53 -0
- package/build/template/components/HamburgerMenu.jsx.map +1 -0
- package/build/template/components/Link.jsx +1 -1
- package/build/template/components/Logo.d.ts +9 -0
- package/build/template/components/Logo.d.ts.map +1 -0
- package/build/template/components/Logo.jsx +29 -0
- package/build/template/components/Logo.jsx.map +1 -0
- package/build/template/components/NotFound.d.ts +2 -0
- package/build/template/components/NotFound.d.ts.map +1 -0
- package/build/template/components/NotFound.jsx +26 -0
- package/build/template/components/NotFound.jsx.map +1 -0
- package/build/template/components/ThemeToggle.d.ts +3 -0
- package/build/template/components/ThemeToggle.d.ts.map +1 -0
- package/build/template/components/ThemeToggle.jsx +10 -0
- package/build/template/components/ThemeToggle.jsx.map +1 -0
- package/build/template/components/content/$$.d.ts +2 -0
- package/build/template/components/content/$$.d.ts.map +1 -0
- package/build/template/components/content/$$.js +2 -0
- package/build/template/components/content/$$.js.map +1 -0
- package/build/template/components/sidebar/Sidebar.d.ts +2 -2
- package/build/template/components/sidebar/Sidebar.d.ts.map +1 -1
- package/build/template/components/sidebar/SidebarItem.d.ts +3 -3
- package/build/template/components/sidebar/SidebarItem.d.ts.map +1 -1
- package/build/template/components/sidebar/SidebarItem.jsx +1 -1
- package/build/template/components/sidebar/SidebarItem.jsx.map +1 -1
- package/build/template/contexts/ThemeContext.d.ts +12 -0
- package/build/template/contexts/ThemeContext.d.ts.map +1 -0
- package/build/template/contexts/ThemeContext.jsx +41 -0
- package/build/template/contexts/ThemeContext.jsx.map +1 -0
- package/build/template/routes/root.d.ts.map +1 -1
- package/build/template/routes/root.jsx +66 -53
- package/build/template/routes/root.jsx.map +1 -1
- package/build/template/server/app.d.ts.map +1 -1
- package/build/template/server/app.js +2 -21
- package/build/template/server/app.js.map +1 -1
- package/package.json +42 -28
- package/src/api/api.ts +1 -0
- package/src/api/config/configurator.ts +28 -6
- package/src/api/config/load.ts +5 -5
- package/src/api/config-resolver/resolve.ts +2 -2
- package/src/api/content/$$.ts +6 -0
- package/src/api/content/$.test.ts +72 -0
- package/src/api/content/$.ts +1 -0
- package/src/api/content/metadata.ts +11 -0
- package/src/api/content/navbar.test.ts +55 -0
- package/src/api/content/navbar.ts +61 -0
- package/src/api/content/page.ts +12 -0
- package/src/api/content/scan.ts +117 -0
- package/src/api/content/sidebar.test.ts +297 -0
- package/src/api/content/sidebar.ts +283 -0
- package/src/api/content/utils.ts +7 -0
- package/src/api/schema/data-sources/schema-directory/schema-directory.ts +3 -2
- package/src/api/singletons/markdown/markdown.test.ts +1 -1
- package/src/api/static/index.ts +1 -0
- package/src/api/static/manifest.test.ts +106 -0
- package/src/api/static/manifest.ts +16 -0
- package/src/api/static/rebase.test.ts +229 -0
- package/src/api/static/rebase.ts +140 -0
- package/src/api/static/static.ts +2 -0
- package/src/api/utils/asset-url/asset-url.test.ts +4 -4
- package/src/api/vite/plugins/branding/index.ts +108 -0
- package/src/api/vite/plugins/build.ts +25 -1
- package/src/api/vite/plugins/core.ts +6 -7
- package/src/api/vite/plugins/main.ts +2 -0
- package/src/api/vite/plugins/pages.ts +131 -207
- package/src/api/vite/plugins/serve.ts +5 -5
- package/src/cli/_/self-contained-mode.ts +5 -5
- package/src/cli/commands/static/$default.ts +43 -0
- package/src/cli/commands/static/rebase.ts +37 -0
- package/src/cli/commands/static.ts +6 -0
- package/src/exports/components.ts +1 -0
- package/src/lib/demos/builder.ts +298 -0
- package/src/lib/demos/config-schema.ts +56 -0
- package/src/lib/demos/config.test.ts +193 -0
- package/src/lib/demos/config.ts +205 -0
- package/src/lib/demos/index.ts +9 -0
- package/src/lib/demos/ui/components.ts +739 -0
- package/src/lib/demos/ui/data-collector.ts +246 -0
- package/src/lib/demos/ui/landing-page-cli.ts +23 -0
- package/src/lib/demos/ui/landing-page.ts +126 -0
- package/src/lib/demos/ui/page-renderer.ts +124 -0
- package/src/lib/demos/utils.ts +43 -0
- package/src/lib/deployment/$$.ts +2 -0
- package/src/lib/deployment/$.test.ts +53 -0
- package/src/lib/deployment/$.ts +1 -0
- package/src/lib/deployment/metadata.ts +40 -0
- package/src/lib/deployment/path-manager.ts +186 -0
- package/src/lib/file-router/file-router.ts +0 -2
- package/src/lib/file-router/linter.test.ts +2 -0
- package/src/lib/file-router/route.ts +2 -0
- package/src/lib/file-router/scan.ts +26 -14
- package/src/lib/github-actions/git-controller.ts +151 -0
- package/src/lib/github-actions/github-actions.ts +6 -0
- package/src/lib/github-actions/index.ts +1 -0
- package/src/lib/github-actions/lib/get-pr-deployments.ts +76 -0
- package/src/lib/github-actions/pr-controller.test.ts +172 -0
- package/src/lib/github-actions/pr-controller.ts +183 -0
- package/src/lib/github-actions/run-step-cli.ts +84 -0
- package/src/lib/github-actions/runner.test.ts +192 -0
- package/src/lib/github-actions/runner.ts +226 -0
- package/src/lib/github-actions/schemas/context.ts +424 -0
- package/src/lib/github-actions/schemas/index.ts +5 -0
- package/src/lib/github-actions/search-module.test.ts +110 -0
- package/src/lib/github-actions/search-module.ts +76 -0
- package/src/lib/github-actions/step.test.ts +149 -0
- package/src/lib/github-actions/step.ts +232 -0
- package/src/lib/helpers.ts +4 -3
- package/src/lib/kit-temp.test-d.ts +115 -0
- package/src/lib/kit-temp.test.ts +127 -0
- package/src/lib/kit-temp.ts +128 -14
- package/src/lib/mask/$$.ts +2 -0
- package/src/lib/mask/$.test.ts +248 -0
- package/src/lib/mask/$.ts +1 -0
- package/src/lib/mask/apply.ts +134 -0
- package/src/lib/mask/mask.test-d.ts +144 -0
- package/src/lib/mask/mask.ts +244 -0
- package/src/lib/mutation-type.ts +20 -0
- package/src/lib/shiki/shiki.test.ts +1 -1
- package/src/lib/task/$$.ts +2 -0
- package/src/lib/task/$.test.ts +209 -0
- package/src/lib/task/$.ts +1 -0
- package/src/lib/task/report.ts +72 -0
- package/src/lib/task/task.ts +112 -0
- package/src/lib/version-history/index.test.ts +196 -0
- package/src/lib/version-history/index.ts +4 -0
- package/src/lib/version-history/types.ts +68 -0
- package/src/lib/version-history/version-history.ts +293 -0
- package/src/lib/vite-virtual/debug.ts +1 -1
- package/src/project-data.ts +0 -1
- package/src/sandbox.ts +20 -0
- package/src/singletons/debug.ts +2 -2
- package/src/template/components/HamburgerMenu.tsx +96 -0
- package/src/template/components/Link.tsx +1 -1
- package/src/template/components/Logo.tsx +46 -0
- package/src/template/components/NotFound.tsx +28 -0
- package/src/template/components/ThemeToggle.tsx +21 -0
- package/src/template/components/content/$$.ts +1 -0
- package/src/template/components/sidebar/Sidebar.tsx +2 -2
- package/src/template/components/sidebar/SidebarItem.tsx +8 -8
- package/src/template/contexts/ThemeContext.tsx +60 -0
- package/src/template/routes/root.tsx +85 -74
- package/src/template/server/app.ts +2 -27
- package/build/lib/debug/debug.d.ts +0 -13
- package/build/lib/debug/debug.d.ts.map +0 -1
- package/build/lib/debug/debug.js +0 -86
- package/build/lib/debug/debug.js.map +0 -1
- package/build/lib/debug/environment-variable.d.ts +0 -6
- package/build/lib/debug/environment-variable.d.ts.map +0 -1
- package/build/lib/debug/environment-variable.js +0 -48
- package/build/lib/debug/environment-variable.js.map +0 -1
- package/build/lib/debug/index.d.ts +0 -2
- package/build/lib/debug/index.d.ts.map +0 -1
- package/build/lib/debug/index.js +0 -2
- package/build/lib/debug/index.js.map +0 -1
- package/build/lib/file-router/scan-tree.d.ts +0 -20
- package/build/lib/file-router/scan-tree.d.ts.map +0 -1
- package/build/lib/file-router/scan-tree.js +0 -158
- package/build/lib/file-router/scan-tree.js.map +0 -1
- package/build/lib/file-router/sidebar/index.d.ts +0 -3
- package/build/lib/file-router/sidebar/index.d.ts.map +0 -1
- package/build/lib/file-router/sidebar/index.js +0 -4
- package/build/lib/file-router/sidebar/index.js.map +0 -1
- package/build/lib/file-router/sidebar/sidebar-tree.d.ts +0 -9
- package/build/lib/file-router/sidebar/sidebar-tree.d.ts.map +0 -1
- package/build/lib/file-router/sidebar/sidebar-tree.js +0 -85
- package/build/lib/file-router/sidebar/sidebar-tree.js.map +0 -1
- package/build/lib/file-router/sidebar/types.d.ts +0 -17
- package/build/lib/file-router/sidebar/types.d.ts.map +0 -1
- package/build/lib/file-router/sidebar/types.js +0 -2
- package/build/lib/file-router/sidebar/types.js.map +0 -1
- package/build/lib/tree/index.d.ts +0 -3
- package/build/lib/tree/index.d.ts.map +0 -1
- package/build/lib/tree/index.js +0 -2
- package/build/lib/tree/index.js.map +0 -1
- package/build/lib/tree/tree.d.ts +0 -62
- package/build/lib/tree/tree.d.ts.map +0 -1
- package/build/lib/tree/tree.js +0 -134
- package/build/lib/tree/tree.js.map +0 -1
- package/src/lib/debug/debug.ts +0 -120
- package/src/lib/debug/environment-variable.ts +0 -56
- package/src/lib/debug/index.ts +0 -1
- package/src/lib/file-router/scan-tree.test.ts +0 -189
- package/src/lib/file-router/scan-tree.ts +0 -205
- package/src/lib/file-router/sidebar/index.ts +0 -3
- package/src/lib/file-router/sidebar/sidebar-tree.test.ts +0 -123
- package/src/lib/file-router/sidebar/sidebar-tree.ts +0 -110
- package/src/lib/file-router/sidebar/types.ts +0 -19
- package/src/lib/tree/index.ts +0 -2
- package/src/lib/tree/tree.test.ts +0 -117
- package/src/lib/tree/tree.ts +0 -183
@@ -0,0 +1,246 @@
|
|
1
|
+
/**
|
2
|
+
* Data collection for demo landing pages
|
3
|
+
*/
|
4
|
+
|
5
|
+
import { Str } from '@wollybeard/kit'
|
6
|
+
import { readFileSync } from 'node:fs'
|
7
|
+
import { join } from 'node:path'
|
8
|
+
import { getDemoConfig, getDemoExamples } from '../index.ts'
|
9
|
+
|
10
|
+
export interface DemoMetadata {
|
11
|
+
title: string
|
12
|
+
description: string
|
13
|
+
enabled: boolean
|
14
|
+
reason?: string
|
15
|
+
}
|
16
|
+
|
17
|
+
export interface TrunkDeployment {
|
18
|
+
sha: string
|
19
|
+
shortSha: string
|
20
|
+
tag: string | null
|
21
|
+
}
|
22
|
+
|
23
|
+
export interface TrunkDeploymentsData {
|
24
|
+
latest: TrunkDeployment | null
|
25
|
+
previous: TrunkDeployment[]
|
26
|
+
}
|
27
|
+
|
28
|
+
export interface PrDeployment {
|
29
|
+
number: number
|
30
|
+
sha?: string
|
31
|
+
ref?: string
|
32
|
+
previousDeployments?: string[]
|
33
|
+
}
|
34
|
+
|
35
|
+
export interface DistTagsData {
|
36
|
+
[key: string]: string
|
37
|
+
}
|
38
|
+
|
39
|
+
export interface LandingPageData {
|
40
|
+
demoMetadata: Record<string, DemoMetadata>
|
41
|
+
demoExamples: string[]
|
42
|
+
trunkDeployments?: TrunkDeploymentsData
|
43
|
+
prDeployments?: PrDeployment[]
|
44
|
+
distTags?: DistTagsData
|
45
|
+
config: {
|
46
|
+
basePath: string
|
47
|
+
mode: 'production' | 'development'
|
48
|
+
prNumber?: string
|
49
|
+
currentSha?: string
|
50
|
+
}
|
51
|
+
}
|
52
|
+
|
53
|
+
/**
|
54
|
+
* Collects all data needed for generating demo landing pages
|
55
|
+
*/
|
56
|
+
export class DemoDataCollector {
|
57
|
+
constructor(private workingDir: string = process.cwd()) {}
|
58
|
+
|
59
|
+
/**
|
60
|
+
* Collect all data for landing page generation
|
61
|
+
*/
|
62
|
+
async collectLandingPageData(options: {
|
63
|
+
mode?: 'production' | 'development'
|
64
|
+
basePath?: string
|
65
|
+
prNumber?: string
|
66
|
+
currentSha?: string
|
67
|
+
trunkDeployments?: string | TrunkDeploymentsData
|
68
|
+
prDeployments?: string | PrDeployment[]
|
69
|
+
distTags?: string | DistTagsData
|
70
|
+
}): Promise<LandingPageData> {
|
71
|
+
try {
|
72
|
+
const {
|
73
|
+
mode = 'production',
|
74
|
+
basePath = '/',
|
75
|
+
prNumber,
|
76
|
+
currentSha,
|
77
|
+
trunkDeployments,
|
78
|
+
prDeployments,
|
79
|
+
distTags,
|
80
|
+
} = options
|
81
|
+
|
82
|
+
// Get demo examples
|
83
|
+
const demoExamples = await this.getDemoExamples()
|
84
|
+
|
85
|
+
// Load demo metadata
|
86
|
+
const demoMetadata = await this.loadDemoMetadata(demoExamples)
|
87
|
+
|
88
|
+
// Parse deployment data based on mode
|
89
|
+
const parsedTrunkDeployments = mode === 'development'
|
90
|
+
? this.getMockTrunkDeployments()
|
91
|
+
: this.parseTrunkDeployments(trunkDeployments)
|
92
|
+
|
93
|
+
const parsedPrDeployments = this.parsePrDeployments(prDeployments)
|
94
|
+
|
95
|
+
const parsedDistTags = mode === 'development'
|
96
|
+
? this.getMockDistTags()
|
97
|
+
: this.parseDistTags(distTags)
|
98
|
+
|
99
|
+
return {
|
100
|
+
demoMetadata,
|
101
|
+
demoExamples,
|
102
|
+
trunkDeployments: parsedTrunkDeployments,
|
103
|
+
prDeployments: parsedPrDeployments,
|
104
|
+
distTags: parsedDistTags,
|
105
|
+
config: {
|
106
|
+
mode,
|
107
|
+
basePath,
|
108
|
+
prNumber,
|
109
|
+
currentSha,
|
110
|
+
},
|
111
|
+
}
|
112
|
+
} catch (error) {
|
113
|
+
throw new Error(`Failed to collect landing page data: ${error instanceof Error ? error.message : String(error)}`)
|
114
|
+
}
|
115
|
+
}
|
116
|
+
|
117
|
+
/**
|
118
|
+
* Get demo examples using existing utility
|
119
|
+
*/
|
120
|
+
private async getDemoExamples(): Promise<string[]> {
|
121
|
+
try {
|
122
|
+
return await getDemoExamples()
|
123
|
+
} catch (error) {
|
124
|
+
throw new Error(`Failed to get demo examples: ${error instanceof Error ? error.message : String(error)}`)
|
125
|
+
}
|
126
|
+
}
|
127
|
+
|
128
|
+
/**
|
129
|
+
* Load metadata for all demos (enabled and disabled)
|
130
|
+
*/
|
131
|
+
private async loadDemoMetadata(demoExamples: string[]): Promise<Record<string, DemoMetadata>> {
|
132
|
+
const metadata: Record<string, DemoMetadata> = {}
|
133
|
+
const config = getDemoConfig().fullConfig
|
134
|
+
|
135
|
+
// Load metadata from package.json files for enabled examples
|
136
|
+
for (const example of demoExamples) {
|
137
|
+
try {
|
138
|
+
const packageJsonPath = join(this.workingDir, 'examples', example, 'package.json')
|
139
|
+
const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf-8'))
|
140
|
+
|
141
|
+
metadata[example] = {
|
142
|
+
title: packageJson.displayName || Str.Case.title(packageJson.name || example),
|
143
|
+
description: packageJson.description
|
144
|
+
|| `Explore the ${example} GraphQL API with comprehensive documentation.`,
|
145
|
+
enabled: true,
|
146
|
+
}
|
147
|
+
} catch {
|
148
|
+
// Fallback if package.json is missing or invalid
|
149
|
+
metadata[example] = {
|
150
|
+
title: Str.Case.title(example),
|
151
|
+
description: `Explore the ${example} GraphQL API with comprehensive documentation.`,
|
152
|
+
enabled: true,
|
153
|
+
}
|
154
|
+
}
|
155
|
+
}
|
156
|
+
|
157
|
+
// Add disabled demos from configuration
|
158
|
+
const disabledDemos = getDemoConfig().getDisabledDemos()
|
159
|
+
for (const [name, disabledDemo] of Object.entries(disabledDemos)) {
|
160
|
+
metadata[name] = {
|
161
|
+
title: disabledDemo.title,
|
162
|
+
description: disabledDemo.description,
|
163
|
+
enabled: false,
|
164
|
+
reason: disabledDemo.reason,
|
165
|
+
}
|
166
|
+
}
|
167
|
+
|
168
|
+
return metadata
|
169
|
+
}
|
170
|
+
|
171
|
+
/**
|
172
|
+
* Parse trunk deployments from JSON string or object
|
173
|
+
*/
|
174
|
+
private parseTrunkDeployments(trunkDeployments?: string | TrunkDeploymentsData): TrunkDeploymentsData | undefined {
|
175
|
+
if (!trunkDeployments) return undefined
|
176
|
+
|
177
|
+
if (typeof trunkDeployments === 'string') {
|
178
|
+
try {
|
179
|
+
return JSON.parse(trunkDeployments) as TrunkDeploymentsData
|
180
|
+
} catch {
|
181
|
+
return undefined
|
182
|
+
}
|
183
|
+
}
|
184
|
+
|
185
|
+
return trunkDeployments
|
186
|
+
}
|
187
|
+
|
188
|
+
/**
|
189
|
+
* Parse PR deployments from JSON string or array
|
190
|
+
*/
|
191
|
+
private parsePrDeployments(prDeployments?: string | PrDeployment[]): PrDeployment[] | undefined {
|
192
|
+
if (!prDeployments) return undefined
|
193
|
+
|
194
|
+
if (typeof prDeployments === 'string') {
|
195
|
+
try {
|
196
|
+
return JSON.parse(prDeployments) as PrDeployment[]
|
197
|
+
} catch {
|
198
|
+
return undefined
|
199
|
+
}
|
200
|
+
}
|
201
|
+
|
202
|
+
return prDeployments
|
203
|
+
}
|
204
|
+
|
205
|
+
/**
|
206
|
+
* Parse dist-tags from JSON string or object
|
207
|
+
*/
|
208
|
+
private parseDistTags(distTags?: string | DistTagsData): DistTagsData | undefined {
|
209
|
+
if (!distTags) return undefined
|
210
|
+
|
211
|
+
if (typeof distTags === 'string') {
|
212
|
+
try {
|
213
|
+
return JSON.parse(distTags) as DistTagsData
|
214
|
+
} catch {
|
215
|
+
return undefined
|
216
|
+
}
|
217
|
+
}
|
218
|
+
|
219
|
+
return distTags
|
220
|
+
}
|
221
|
+
|
222
|
+
/**
|
223
|
+
* Get mock data for development mode
|
224
|
+
*/
|
225
|
+
private getMockTrunkDeployments(): TrunkDeploymentsData {
|
226
|
+
return {
|
227
|
+
latest: { sha: '1.2.0', shortSha: '1.2.0', tag: '1.2.0' },
|
228
|
+
previous: [
|
229
|
+
{ sha: '1.1.0', shortSha: '1.1.0', tag: '1.1.0' },
|
230
|
+
{ sha: '1.0.0', shortSha: '1.0.0', tag: '1.0.0' },
|
231
|
+
{ sha: '0.9.1', shortSha: '0.9.1', tag: '0.9.1' },
|
232
|
+
{ sha: '0.9.0', shortSha: '0.9.0', tag: '0.9.0' },
|
233
|
+
],
|
234
|
+
}
|
235
|
+
}
|
236
|
+
|
237
|
+
/**
|
238
|
+
* Get mock dist-tags for development mode
|
239
|
+
*/
|
240
|
+
private getMockDistTags(): DistTagsData {
|
241
|
+
return {
|
242
|
+
latest: '1.2.0',
|
243
|
+
next: '1.3.0-beta.2',
|
244
|
+
}
|
245
|
+
}
|
246
|
+
}
|
@@ -0,0 +1,23 @@
|
|
1
|
+
#!/usr/bin/env node
|
2
|
+
|
3
|
+
import { Command } from '@molt/command'
|
4
|
+
import { z } from 'zod'
|
5
|
+
import { buildDemosHome } from './landing-page.ts'
|
6
|
+
|
7
|
+
/**
|
8
|
+
* CLI entry point
|
9
|
+
*/
|
10
|
+
const command = Command.create()
|
11
|
+
.parameter('basePath', z.string().optional().describe('Base path for demo links'))
|
12
|
+
.parameter('prNumber', z.string().optional().describe('PR number for preview mode'))
|
13
|
+
.parameter('currentSha', z.string().optional().describe('Current commit SHA'))
|
14
|
+
.parameter('mode', z.enum(['production', 'development']).optional().describe('Page mode'))
|
15
|
+
.parameter('prDeployments', z.string().optional().describe('JSON string of PR deployments'))
|
16
|
+
.parameter('trunkDeployments', z.string().optional().describe('JSON string of trunk deployments'))
|
17
|
+
.parameter('distTags', z.string().optional().describe('JSON string of dist-tags'))
|
18
|
+
.parameter('serve', z.boolean().optional().describe('Start development server'))
|
19
|
+
.parameter('outputDir', z.string().optional().describe('Output directory'))
|
20
|
+
.parameter('outputPath', z.string().optional().describe('Output file path (overrides outputDir)'))
|
21
|
+
|
22
|
+
const args = await command.parse()
|
23
|
+
await buildDemosHome(args)
|
@@ -0,0 +1,126 @@
|
|
1
|
+
/**
|
2
|
+
* Main entry point for demo landing page generation
|
3
|
+
*/
|
4
|
+
import type { VersionCatalog } from '#lib/version-history/index'
|
5
|
+
import { promises as fs } from 'node:fs'
|
6
|
+
import { dirname, extname, join } from 'node:path'
|
7
|
+
import { DemoDataCollector } from './data-collector.ts'
|
8
|
+
import { DemoPageRenderer } from './page-renderer.ts'
|
9
|
+
|
10
|
+
// Define the interface for the build options
|
11
|
+
export interface Options {
|
12
|
+
basePath?: string
|
13
|
+
prNumber?: string
|
14
|
+
currentSha?: string
|
15
|
+
mode?: 'production' | 'development'
|
16
|
+
prDeployments?: string | any[]
|
17
|
+
trunkDeployments?: string | any
|
18
|
+
distTags?: string | Record<string, string>
|
19
|
+
outputDir?: string
|
20
|
+
outputPath?: string
|
21
|
+
}
|
22
|
+
|
23
|
+
// Options when using a version catalog
|
24
|
+
export interface CatalogOptions {
|
25
|
+
basePath?: string
|
26
|
+
prNumber?: string
|
27
|
+
currentSha?: string
|
28
|
+
mode?: 'production' | 'development'
|
29
|
+
prDeployments?: string | any[]
|
30
|
+
catalog: VersionCatalog
|
31
|
+
outputDir?: string
|
32
|
+
outputPath?: string
|
33
|
+
}
|
34
|
+
|
35
|
+
/**
|
36
|
+
* Build demos home page with a version catalog
|
37
|
+
*/
|
38
|
+
export async function buildDemosHomeWithCatalog(options: CatalogOptions): Promise<void> {
|
39
|
+
const { catalog, ...otherOptions } = options
|
40
|
+
|
41
|
+
// Transform catalog data inline
|
42
|
+
const latestStable = catalog.distTags.latest || catalog.stable[0] || null
|
43
|
+
const trunkDeployments = {
|
44
|
+
latest: latestStable
|
45
|
+
? {
|
46
|
+
sha: latestStable.git.sha,
|
47
|
+
shortSha: latestStable.git.sha.substring(0, 7),
|
48
|
+
tag: latestStable.git.tag,
|
49
|
+
}
|
50
|
+
: null,
|
51
|
+
previous: catalog.versions
|
52
|
+
.filter(v => v.git.tag !== latestStable?.git.tag)
|
53
|
+
.slice(0, 10)
|
54
|
+
.map(v => ({
|
55
|
+
sha: v.git.sha,
|
56
|
+
shortSha: v.git.sha.substring(0, 7),
|
57
|
+
tag: v.git.tag,
|
58
|
+
})),
|
59
|
+
}
|
60
|
+
|
61
|
+
const distTags: Record<string, string> = {}
|
62
|
+
for (const [name, version] of Object.entries(catalog.distTags)) {
|
63
|
+
if (version) {
|
64
|
+
distTags[name] = version.git.tag
|
65
|
+
}
|
66
|
+
}
|
67
|
+
|
68
|
+
// Use the existing function with transformed data
|
69
|
+
return buildDemosHome({
|
70
|
+
...otherOptions,
|
71
|
+
trunkDeployments,
|
72
|
+
distTags,
|
73
|
+
})
|
74
|
+
}
|
75
|
+
|
76
|
+
// Function overloads
|
77
|
+
export async function buildDemosHome(options: CatalogOptions): Promise<void>
|
78
|
+
export async function buildDemosHome(options?: Options): Promise<void>
|
79
|
+
|
80
|
+
/**
|
81
|
+
* Main function that builds the demos home page
|
82
|
+
*/
|
83
|
+
export async function buildDemosHome(options: CatalogOptions | Options = {}): Promise<void> {
|
84
|
+
// Check if catalog is provided
|
85
|
+
if ('catalog' in options && options.catalog) {
|
86
|
+
return buildDemosHomeWithCatalog(options as CatalogOptions)
|
87
|
+
}
|
88
|
+
const config = {
|
89
|
+
basePath: '/',
|
90
|
+
mode: 'production' as const,
|
91
|
+
outputDir: 'dist-demos',
|
92
|
+
...options,
|
93
|
+
}
|
94
|
+
|
95
|
+
// Collect all required data
|
96
|
+
const dataCollector = new DemoDataCollector()
|
97
|
+
const data = await dataCollector.collectLandingPageData(config)
|
98
|
+
|
99
|
+
// Render the page
|
100
|
+
const renderer = new DemoPageRenderer()
|
101
|
+
const html = renderer.renderPage(data)
|
102
|
+
|
103
|
+
// Determine output path
|
104
|
+
let outputPath: string
|
105
|
+
|
106
|
+
if (config.outputPath) {
|
107
|
+
// Use provided outputPath
|
108
|
+
outputPath = config.outputPath
|
109
|
+
|
110
|
+
// If it's a directory (no extension), append the filename
|
111
|
+
if (!extname(outputPath)) {
|
112
|
+
const fileName = 'index.html'
|
113
|
+
outputPath = join(outputPath, fileName)
|
114
|
+
}
|
115
|
+
|
116
|
+
// Ensure parent directory exists
|
117
|
+
await fs.mkdir(dirname(outputPath), { recursive: true })
|
118
|
+
} else {
|
119
|
+
// Use outputDir (legacy behavior)
|
120
|
+
await fs.mkdir(config.outputDir, { recursive: true })
|
121
|
+
const fileName = 'index.html'
|
122
|
+
outputPath = join(config.outputDir, fileName)
|
123
|
+
}
|
124
|
+
|
125
|
+
await fs.writeFile(outputPath, html)
|
126
|
+
}
|
@@ -0,0 +1,124 @@
|
|
1
|
+
/**
|
2
|
+
* HTML page renderer for demo landing pages
|
3
|
+
*/
|
4
|
+
|
5
|
+
import { getDemoConfig } from '../index.ts'
|
6
|
+
import {
|
7
|
+
generateDemosGrid,
|
8
|
+
generateFooter,
|
9
|
+
generateHeader,
|
10
|
+
generatePrBanner,
|
11
|
+
generateVersionInfo,
|
12
|
+
getDemoPageStyles,
|
13
|
+
} from './components.ts'
|
14
|
+
import type { LandingPageData } from './data-collector.ts'
|
15
|
+
|
16
|
+
/**
|
17
|
+
* Renders complete HTML pages for demo landing
|
18
|
+
*/
|
19
|
+
export class DemoPageRenderer {
|
20
|
+
/**
|
21
|
+
* Render main demo landing page
|
22
|
+
*/
|
23
|
+
renderMainLandingPage(data: LandingPageData): string {
|
24
|
+
const config = getDemoConfig().fullConfig
|
25
|
+
const { mode, prNumber } = data.config
|
26
|
+
|
27
|
+
let pageTitle = config.ui.branding.title
|
28
|
+
if (prNumber) {
|
29
|
+
pageTitle = `${pageTitle} - PR #${prNumber} Preview`
|
30
|
+
}
|
31
|
+
|
32
|
+
const prBannerHtml = prNumber ? generatePrBanner(prNumber) : ''
|
33
|
+
const headerHtml = generateHeader(data)
|
34
|
+
const demosGridHtml = generateDemosGrid(data)
|
35
|
+
const versionInfoHtml = generateVersionInfo(data)
|
36
|
+
const footerHtml = generateFooter()
|
37
|
+
|
38
|
+
return `<!DOCTYPE html>
|
39
|
+
<html lang="en">
|
40
|
+
<head>
|
41
|
+
<meta charset="UTF-8">
|
42
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
43
|
+
<title>${pageTitle}</title>
|
44
|
+
<meta name="description" content="${config.ui.branding.description}">
|
45
|
+
${config.ui.branding.logoUrl ? `<link rel="icon" href="${config.ui.branding.logoUrl}">` : ''}
|
46
|
+
<style>
|
47
|
+
${getDemoPageStyles()}
|
48
|
+
</style>
|
49
|
+
</head>
|
50
|
+
<body>
|
51
|
+
${prBannerHtml}
|
52
|
+
<div class="container">
|
53
|
+
${headerHtml}
|
54
|
+
${demosGridHtml}
|
55
|
+
${versionInfoHtml}
|
56
|
+
${footerHtml}
|
57
|
+
</div>
|
58
|
+
</body>
|
59
|
+
</html>`
|
60
|
+
}
|
61
|
+
|
62
|
+
/**
|
63
|
+
* Render development page with mock data
|
64
|
+
*/
|
65
|
+
renderDevPage(data: LandingPageData): string {
|
66
|
+
const headerHtml = generateHeader(data)
|
67
|
+
const demosGridHtml = generateDemosGrid(data)
|
68
|
+
const versionInfoHtml = generateVersionInfo(data)
|
69
|
+
const footerHtml = generateFooter()
|
70
|
+
|
71
|
+
const devNoticeHtml = `
|
72
|
+
<div style="background: #fff3cd; border: 1px solid #ffeaa7; padding: 1rem; margin-bottom: 2rem; border-radius: 4px;">
|
73
|
+
<strong>Development Mode:</strong> This page is using mock data for development purposes.
|
74
|
+
</div>
|
75
|
+
`
|
76
|
+
|
77
|
+
return `<!DOCTYPE html>
|
78
|
+
<html lang="en">
|
79
|
+
<head>
|
80
|
+
<meta charset="UTF-8">
|
81
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
82
|
+
<title>Polen Demos - Development</title>
|
83
|
+
<meta name="description" content="Development version of Polen demos">
|
84
|
+
<style>
|
85
|
+
${getDemoPageStyles()}
|
86
|
+
</style>
|
87
|
+
</head>
|
88
|
+
<body>
|
89
|
+
<div class="container">
|
90
|
+
${devNoticeHtml}
|
91
|
+
${headerHtml}
|
92
|
+
${demosGridHtml}
|
93
|
+
${versionInfoHtml}
|
94
|
+
${footerHtml}
|
95
|
+
</div>
|
96
|
+
</body>
|
97
|
+
</html>`
|
98
|
+
}
|
99
|
+
|
100
|
+
/**
|
101
|
+
* Render page based on mode
|
102
|
+
*/
|
103
|
+
renderPage(data: LandingPageData): string {
|
104
|
+
const { mode } = data.config
|
105
|
+
|
106
|
+
switch (mode) {
|
107
|
+
case 'development':
|
108
|
+
return this.renderDevPage(data)
|
109
|
+
case 'production':
|
110
|
+
default:
|
111
|
+
return this.renderMainLandingPage(data)
|
112
|
+
}
|
113
|
+
}
|
114
|
+
}
|
115
|
+
|
116
|
+
/**
|
117
|
+
* Utility function for quick page rendering
|
118
|
+
*/
|
119
|
+
export async function renderDemoLandingPage(
|
120
|
+
data: LandingPageData,
|
121
|
+
): Promise<string> {
|
122
|
+
const renderer = new DemoPageRenderer()
|
123
|
+
return renderer.renderPage(data)
|
124
|
+
}
|
@@ -0,0 +1,43 @@
|
|
1
|
+
/**
|
2
|
+
* Utility functions for demo management
|
3
|
+
*/
|
4
|
+
|
5
|
+
import type { Version } from '#lib/version-history/index'
|
6
|
+
import { promises as fs } from 'node:fs'
|
7
|
+
import { join } from 'node:path'
|
8
|
+
import { getDemoConfig } from './config.ts'
|
9
|
+
|
10
|
+
/**
|
11
|
+
* Get list of demo examples from the examples directory
|
12
|
+
*/
|
13
|
+
export async function getDemoExamples(): Promise<string[]> {
|
14
|
+
const examplesDir = join(process.cwd(), 'examples')
|
15
|
+
const examples: string[] = []
|
16
|
+
|
17
|
+
// Read all directories in examples/
|
18
|
+
try {
|
19
|
+
const dirs = await fs.readdir(examplesDir, { withFileTypes: true })
|
20
|
+
const dirNames = dirs
|
21
|
+
.filter(dirent => dirent.isDirectory())
|
22
|
+
.map(dirent => dirent.name)
|
23
|
+
|
24
|
+
examples.push(...dirNames)
|
25
|
+
} catch (e) {
|
26
|
+
console.error(`Error reading examples directory:`, (e as Error).message)
|
27
|
+
}
|
28
|
+
|
29
|
+
// Use DemoConfig to filter and order examples
|
30
|
+
const config = getDemoConfig()
|
31
|
+
return config.getOrderedDemos(examples)
|
32
|
+
}
|
33
|
+
|
34
|
+
/**
|
35
|
+
* Get deployment path for a version
|
36
|
+
*/
|
37
|
+
export const getDistTagPath = (version: Version): string => {
|
38
|
+
return version.isPrerelease ? `/next/` : '/latest/'
|
39
|
+
}
|
40
|
+
|
41
|
+
export const getSemverPath = (version: Version): string => {
|
42
|
+
return `/${version.semver}/`
|
43
|
+
}
|
@@ -0,0 +1,53 @@
|
|
1
|
+
import { Fs } from '@wollybeard/kit'
|
2
|
+
import { beforeEach, describe, expect, test } from 'vitest'
|
3
|
+
import { Deployment } from './$.ts'
|
4
|
+
|
5
|
+
describe('metadata', () => {
|
6
|
+
let testDir: string
|
7
|
+
|
8
|
+
beforeEach(async () => {
|
9
|
+
testDir = await Fs.makeTemporaryDirectory()
|
10
|
+
})
|
11
|
+
|
12
|
+
test('writes and reads deployment metadata', async () => {
|
13
|
+
const metadata: Deployment.DeploymentMetadata = {
|
14
|
+
timestamp: '2024-01-01T00:00:00.000Z',
|
15
|
+
pullRequest: {
|
16
|
+
number: 123,
|
17
|
+
branch: 'feat/awesome',
|
18
|
+
commit: 'abc123',
|
19
|
+
title: 'Add awesome feature',
|
20
|
+
author: 'octocat',
|
21
|
+
},
|
22
|
+
deployment: {
|
23
|
+
url: 'https://example.github.io/repo/pr-123/',
|
24
|
+
environment: 'pr-123',
|
25
|
+
},
|
26
|
+
}
|
27
|
+
|
28
|
+
await Deployment.metadata.write(metadata, testDir)
|
29
|
+
|
30
|
+
const result = await Deployment.metadata.read(testDir)
|
31
|
+
expect(result).toEqual(metadata)
|
32
|
+
})
|
33
|
+
|
34
|
+
test('creates .deployment.json file', async () => {
|
35
|
+
const metadata: Deployment.DeploymentMetadata = {
|
36
|
+
timestamp: new Date().toISOString(),
|
37
|
+
pullRequest: {
|
38
|
+
number: 456,
|
39
|
+
branch: 'main',
|
40
|
+
commit: 'def456',
|
41
|
+
},
|
42
|
+
deployment: {
|
43
|
+
url: 'https://example.com',
|
44
|
+
environment: 'pr-456',
|
45
|
+
},
|
46
|
+
}
|
47
|
+
|
48
|
+
await Deployment.metadata.write(metadata, testDir)
|
49
|
+
|
50
|
+
const fileExists = await Fs.exists(`${testDir}/.deployment.json`)
|
51
|
+
expect(fileExists).toBe(true)
|
52
|
+
})
|
53
|
+
})
|
@@ -0,0 +1 @@
|
|
1
|
+
export * as Deployment from './$$.ts'
|
@@ -0,0 +1,40 @@
|
|
1
|
+
import { Codec, Resource } from '@wollybeard/kit'
|
2
|
+
import { z } from 'zod/v4'
|
3
|
+
|
4
|
+
export const DeploymentMetadataSchema = z.object({
|
5
|
+
timestamp: z.iso.datetime(),
|
6
|
+
pullRequest: z.object({
|
7
|
+
number: z.number(),
|
8
|
+
branch: z.string(),
|
9
|
+
commit: z.string(),
|
10
|
+
title: z.string().optional(),
|
11
|
+
author: z.string().optional(),
|
12
|
+
}),
|
13
|
+
deployment: z.object({
|
14
|
+
url: z.url(),
|
15
|
+
environment: z.string(),
|
16
|
+
}),
|
17
|
+
})
|
18
|
+
|
19
|
+
export type DeploymentMetadata = z.infer<typeof DeploymentMetadataSchema>
|
20
|
+
|
21
|
+
export const metadata = Resource.create({
|
22
|
+
name: 'deployment-metadata',
|
23
|
+
path: '.deployment.json',
|
24
|
+
codec: Codec.fromZod(DeploymentMetadataSchema),
|
25
|
+
init: {
|
26
|
+
auto: true,
|
27
|
+
value: () => ({
|
28
|
+
timestamp: new Date().toISOString(),
|
29
|
+
pullRequest: {
|
30
|
+
number: 0,
|
31
|
+
branch: 'unknown',
|
32
|
+
commit: 'unknown',
|
33
|
+
},
|
34
|
+
deployment: {
|
35
|
+
url: '',
|
36
|
+
environment: 'unknown',
|
37
|
+
},
|
38
|
+
}),
|
39
|
+
},
|
40
|
+
})
|