@woodsportal/hubspot-kit 1.0.41 → 1.0.42-dev.1
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/CHANGELOG.md +20 -1
- package/README.md +191 -157
- package/dist/chunk-4UFWXPQG.js +554 -0
- package/dist/chunk-4UFWXPQG.js.map +1 -0
- package/dist/{chunk-4GOJPOW3.js → chunk-GXYUGXF5.js} +82 -23
- package/dist/chunk-GXYUGXF5.js.map +1 -0
- package/dist/{chunk-S2YJDWZU.js → chunk-NWBK3XBZ.js} +1 -1
- package/dist/chunk-NWBK3XBZ.js.map +1 -0
- package/dist/cli.js +1826 -877
- package/dist/cli.js.map +1 -1
- package/dist/{exec-VY6BGWF3.js → exec-NS4GKXZS.js} +2 -2
- package/dist/index.d.ts +12 -0
- package/dist/index.js +6 -2
- package/dist/index.js.map +1 -1
- package/dist/scaffold-page-lifecycle-53AWWGFR.js +194 -0
- package/dist/scaffold-page-lifecycle-53AWWGFR.js.map +1 -0
- package/dist/vite/index.js +1 -1
- package/examples/greenfield/module-hybrid-cdn/README.md +2 -1
- package/examples/greenfield/module-hybrid-cdn/public/fields.json +73 -28
- package/examples/greenfield/module-hybrid-cdn/public/module.html +21 -5
- package/examples/greenfield/module-hybrid-cdn/src/assets/css/main.dev.css +15 -0
- package/examples/greenfield/module-hybrid-cdn/src/components/layout/starter-nav.tsx +12 -15
- package/examples/greenfield/module-hybrid-cdn/src/config/starter-nav.ts +9 -0
- package/examples/greenfield/module-hybrid-cdn/src/features/starter/components/starter-home.tsx +25 -29
- package/examples/greenfield/module-hybrid-cdn/src/features/starter/hooks/starter-preview-values.ts +60 -0
- package/examples/greenfield/module-hybrid-cdn/src/features/starter/hooks/use-starter-preview.dev.ts +18 -0
- package/examples/greenfield/module-hybrid-cdn/src/features/starter/hooks/use-starter-preview.ts +20 -37
- package/examples/greenfield/module-hybrid-cdn-auth-full/.env.dev.example +3 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/.env.local.example +6 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/.env.prod.example +5 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/.env.stg.example +3 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/.wphs/README.md +17 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/README.md +60 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/hubspot.config.yml.example +10 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/index.html +12 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/package.json +34 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/portal.cdn.json.example +8 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/public/fields.json +100 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/public/meta.json +9 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/public/module.html +38 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/app.tsx +172 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/assets/css/main.dev.css +23 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/assets/css/main.prod.css +12 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/assets/css/tailwind.css.config.css +7 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/cdn/app-entry.ts +48 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/cdn/vendor-entry.ts +28 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/components/Layouts/AppLayoutWrapper.tsx +38 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/components/Layouts/AuthLayout.tsx +7 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/components/Layouts/DefaultLayout.tsx +5 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/components/Layouts/MainLayout.tsx +42 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/components/Layouts/UnauthorizedLayout.tsx +5 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/components/Layouts/index.ts +13 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/components/layout/section-card.tsx +20 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/components/layout/starter-nav.tsx +28 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/components/layout/starter-shell.tsx +18 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/components/ui/Button.tsx +22 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/components/ui/Form.tsx +22 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/components/ui/Input.tsx +12 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/components/ui/Toaster.tsx +5 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/components/ui/auth/SsoLoginButton.tsx +34 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/components/ui/link.tsx +10 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/components/ui/loader/loader.tsx +18 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/config/auth-tier.ts +4 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/config/nav-scaffold.ts +4 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/config/portal-nav.ts +9 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/config/router.ts +1 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/config/routes.ts +10 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/data/hubSpotContext.ts +57 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/data/sync-sdk-hub-context.ts +44 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/defaultData.ts +2 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/env.ts +59 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/features/auth/app-bootstrap-guards.ts +14 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/features/auth/auth-navigation.ts +81 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/features/auth/auth-route-paths.ts +29 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/features/auth/auth-session-events.ts +2 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/features/auth/auth-session.ts +51 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/features/auth/clear-client-auth-session.ts +62 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/features/auth/components/starter-login.tsx +79 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/features/auth/login-email-storage.ts +64 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/features/auth/login-session-bridge.ts +74 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/features/auth/mfa-otp-utils.ts +24 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/features/auth/mfa-pending-storage.ts +108 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/features/auth/mfa-portal.ts +45 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/features/auth/post-login-path.ts +17 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/features/auth/resolve-auth-login-error-message.ts +52 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/features/auth/resolve-post-login-path.ts +21 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/features/auth/sso-callback.ts +126 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/features/auth/use-mfa-login-otp-flow.ts +78 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/features/auth/use-portal-session.ts +25 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/features/auth/use-signed-in-email.ts +55 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/features/auth/use-sso-callback-handler.ts +92 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/features/starter/components/starter-guide-page.tsx +210 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/features/starter/components/starter-home-page.tsx +21 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/features/starter/components/starter-home.tsx +48 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/features/starter/components/starter-page-frame.tsx +25 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/features/starter/components/starter-protected-page.tsx +54 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/features/starter/components/starter-single-page.tsx +17 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/features/starter/content/auth-guide-content.ts +85 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/features/starter/content/woodscli-guide-content.ts +86 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/features/starter/hooks/starter-preview-values.ts +60 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/features/starter/hooks/use-starter-preview.dev.ts +18 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/features/starter/hooks/use-starter-preview.ts +30 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/features/starter/index.ts +6 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/hubspot/bootstrap.ts +16 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/hubspot/default-data.ts +7 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/hubspot/is-cms-editor.ts +78 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/hubspot/module-entry.tsx +9 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/hubspot/types.ts +17 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/integrations/configure-woodsportal-sdk.ts +98 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/integrations/tanstack-query/root-provider.tsx +18 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/integrations/tanstack-router/router.tsx +39 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/integrations/woodsportal-sdk.ts +37 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/main.tsx +5 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/portal/api-endpoint.ts +11 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/portal/ensure-portal-cdn-stylesheet.ts +115 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/portal/mount-dev-preview.tsx +12 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/portal/mount-portal.tsx +57 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/routeTree.gen.ts +182 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/routes/__root.tsx +12 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/routes/_app/portal.tsx +10 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/routes/_auth/login/sso.tsx +27 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/routes/_auth/login.tsx +10 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/routes/_auth/two-fa.tsx +91 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/routes/guide.tsx +9 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/routes/index.tsx +8 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/routes/unauthorized.tsx +50 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/utils/ValidationSchema.ts +1 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/utils/cookie.ts +23 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/utils/normalize-router-path.ts +10 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/utils/private-route.tsx +100 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/utils/public-route.tsx +64 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/utils/resolve-api-base-url.ts +44 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/src/utils/safe-router-navigation.ts +82 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/tsconfig.json +20 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/vite.config.cdn-app.mjs +1 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/vite.config.cdn-esm.mjs +1 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/vite.config.cdn-vendor.mjs +1 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/vite.config.dev.mjs +1 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/vite.config.hubspot.mjs +1 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/vite.config.monolith.mjs +8 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/woodscli.json +38 -0
- package/examples/greenfield/module-hybrid-cdn-auth-full/wphs.adapter.ts +7 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/.env.dev.example +3 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/.env.local.example +6 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/.env.prod.example +5 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/.env.stg.example +3 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/.wphs/README.md +17 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/README.md +60 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/hubspot.config.yml.example +10 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/index.html +12 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/package.json +34 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/portal.cdn.json.example +8 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/public/fields.json +100 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/public/meta.json +9 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/public/module.html +38 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/app.tsx +180 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/assets/css/main.dev.css +23 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/assets/css/main.prod.css +12 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/assets/css/tailwind.css.config.css +7 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/cdn/app-entry.ts +48 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/cdn/vendor-entry.ts +28 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/components/Layouts/AppLayoutWrapper.tsx +38 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/components/Layouts/AuthLayout.tsx +7 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/components/Layouts/DefaultLayout.tsx +5 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/components/Layouts/MainLayout.tsx +42 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/components/Layouts/UnauthorizedLayout.tsx +5 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/components/Layouts/index.ts +13 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/components/layout/section-card.tsx +20 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/components/layout/starter-nav.tsx +28 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/components/layout/starter-shell.tsx +18 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/components/ui/Button.tsx +22 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/components/ui/Form.tsx +22 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/components/ui/Input.tsx +12 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/components/ui/Toaster.tsx +5 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/components/ui/auth/SsoLoginButton.tsx +34 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/components/ui/link.tsx +10 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/components/ui/loader/loader.tsx +18 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/config/auth-tier.ts +4 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/config/nav-scaffold.ts +4 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/config/portal-nav.ts +9 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/config/router.ts +1 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/config/routes.ts +10 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/data/hubSpotContext.ts +57 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/data/sync-sdk-hub-context.ts +44 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/defaultData.ts +2 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/env.ts +59 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/features/auth/app-bootstrap-guards.ts +14 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/features/auth/auth-navigation.ts +81 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/features/auth/auth-route-paths.ts +29 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/features/auth/auth-session-events.ts +2 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/features/auth/auth-session.ts +26 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/features/auth/clear-client-auth-session.ts +62 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/features/auth/components/starter-login.tsx +83 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/features/auth/login-email-storage.ts +64 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/features/auth/login-session-bridge.ts +72 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/features/auth/post-login-path.ts +17 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/features/auth/resolve-auth-login-error-message.ts +52 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/features/auth/resolve-post-login-path.ts +21 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/features/auth/sso-callback.ts +126 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/features/auth/use-portal-session.ts +25 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/features/auth/use-signed-in-email.ts +55 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/features/auth/use-sso-callback-handler.ts +92 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/features/starter/components/starter-guide-page.tsx +210 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/features/starter/components/starter-home-page.tsx +21 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/features/starter/components/starter-home.tsx +48 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/features/starter/components/starter-page-frame.tsx +25 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/features/starter/components/starter-protected-page.tsx +54 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/features/starter/components/starter-single-page.tsx +17 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/features/starter/content/auth-guide-content.ts +85 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/features/starter/content/woodscli-guide-content.ts +86 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/features/starter/hooks/starter-preview-values.ts +60 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/features/starter/hooks/use-starter-preview.dev.ts +18 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/features/starter/hooks/use-starter-preview.ts +30 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/features/starter/index.ts +6 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/hubspot/bootstrap.ts +16 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/hubspot/default-data.ts +7 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/hubspot/is-cms-editor.ts +78 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/hubspot/module-entry.tsx +9 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/hubspot/types.ts +17 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/integrations/configure-woodsportal-sdk.ts +94 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/integrations/tanstack-query/root-provider.tsx +18 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/integrations/tanstack-router/router.tsx +39 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/integrations/woodsportal-sdk.ts +37 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/main.tsx +5 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/portal/api-endpoint.ts +11 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/portal/ensure-portal-cdn-stylesheet.ts +115 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/portal/mount-dev-preview.tsx +12 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/portal/mount-portal.tsx +57 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/routeTree.gen.ts +155 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/routes/__root.tsx +12 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/routes/_app/portal.tsx +10 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/routes/_auth/login/sso.tsx +27 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/routes/_auth/login.tsx +10 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/routes/guide.tsx +9 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/routes/index.tsx +8 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/routes/unauthorized.tsx +50 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/utils/ValidationSchema.ts +1 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/utils/cookie.ts +23 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/utils/normalize-router-path.ts +10 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/utils/private-route.tsx +100 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/utils/public-route.tsx +64 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/utils/resolve-api-base-url.ts +44 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/src/utils/safe-router-navigation.ts +82 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/tsconfig.json +20 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/vite.config.cdn-app.mjs +1 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/vite.config.cdn-esm.mjs +1 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/vite.config.cdn-vendor.mjs +1 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/vite.config.dev.mjs +1 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/vite.config.hubspot.mjs +1 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/vite.config.monolith.mjs +8 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/woodscli.json +38 -0
- package/examples/greenfield/module-hybrid-cdn-auth-sso/wphs.adapter.ts +7 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/.env.dev.example +3 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/.env.local.example +6 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/.env.prod.example +5 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/.env.stg.example +3 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/.wphs/README.md +17 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/README.md +60 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/hubspot.config.yml.example +10 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/index.html +12 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/package.json +34 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/portal.cdn.json.example +8 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/public/fields.json +100 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/public/meta.json +9 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/public/module.html +38 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/app.tsx +173 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/assets/css/main.dev.css +23 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/assets/css/main.prod.css +12 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/assets/css/tailwind.css.config.css +7 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/cdn/app-entry.ts +48 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/cdn/vendor-entry.ts +28 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/components/Layouts/AppLayoutWrapper.tsx +38 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/components/Layouts/AuthLayout.tsx +7 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/components/Layouts/DefaultLayout.tsx +5 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/components/Layouts/MainLayout.tsx +42 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/components/Layouts/UnauthorizedLayout.tsx +5 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/components/Layouts/index.ts +13 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/components/layout/section-card.tsx +20 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/components/layout/starter-nav.tsx +28 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/components/layout/starter-shell.tsx +18 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/components/ui/Button.tsx +22 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/components/ui/Form.tsx +22 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/components/ui/Input.tsx +12 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/components/ui/Toaster.tsx +5 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/components/ui/link.tsx +10 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/components/ui/loader/loader.tsx +18 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/config/auth-tier.ts +4 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/config/nav-scaffold.ts +4 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/config/portal-nav.ts +9 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/config/router.ts +1 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/config/routes.ts +10 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/data/hubSpotContext.ts +57 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/data/sync-sdk-hub-context.ts +44 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/defaultData.ts +2 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/env.ts +59 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/features/auth/app-bootstrap-guards.ts +14 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/features/auth/auth-navigation.ts +81 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/features/auth/auth-route-paths.ts +29 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/features/auth/auth-session-events.ts +2 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/features/auth/auth-session.ts +26 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/features/auth/clear-client-auth-session.ts +62 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/features/auth/components/starter-login.tsx +76 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/features/auth/login-email-storage.ts +64 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/features/auth/login-session-bridge.ts +72 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/features/auth/post-login-path.ts +17 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/features/auth/resolve-auth-login-error-message.ts +52 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/features/auth/resolve-post-login-path.ts +21 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/features/auth/use-portal-session.ts +25 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/features/auth/use-signed-in-email.ts +55 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/features/starter/components/starter-guide-page.tsx +218 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/features/starter/components/starter-home-page.tsx +21 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/features/starter/components/starter-home.tsx +48 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/features/starter/components/starter-page-frame.tsx +25 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/features/starter/components/starter-protected-page.tsx +54 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/features/starter/components/starter-single-page.tsx +17 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/features/starter/content/auth-guide-content.ts +91 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/features/starter/content/woodscli-guide-content.ts +86 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/features/starter/hooks/starter-preview-values.ts +60 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/features/starter/hooks/use-starter-preview.dev.ts +18 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/features/starter/hooks/use-starter-preview.ts +30 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/features/starter/index.ts +6 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/hubspot/bootstrap.ts +16 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/hubspot/default-data.ts +7 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/hubspot/is-cms-editor.ts +78 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/hubspot/module-entry.tsx +9 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/hubspot/types.ts +17 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/integrations/configure-woodsportal-sdk.ts +94 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/integrations/tanstack-query/root-provider.tsx +18 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/integrations/tanstack-router/router.tsx +39 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/integrations/woodsportal-sdk.ts +37 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/main.tsx +5 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/portal/api-endpoint.ts +11 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/portal/ensure-portal-cdn-stylesheet.ts +115 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/portal/mount-dev-preview.tsx +12 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/portal/mount-portal.tsx +52 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/routeTree.gen.ts +134 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/routes/__root.tsx +12 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/routes/_app/portal.tsx +10 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/routes/_auth/login.tsx +10 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/routes/guide.tsx +9 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/routes/index.tsx +8 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/routes/unauthorized.tsx +50 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/utils/ValidationSchema.ts +1 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/utils/cookie.ts +23 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/utils/normalize-router-path.ts +10 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/utils/private-route.tsx +100 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/utils/public-route.tsx +64 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/utils/resolve-api-base-url.ts +44 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/src/utils/safe-router-navigation.ts +82 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/tsconfig.json +20 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/vite.config.cdn-app.mjs +1 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/vite.config.cdn-esm.mjs +1 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/vite.config.cdn-vendor.mjs +1 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/vite.config.dev.mjs +1 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/vite.config.hubspot.mjs +1 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/vite.config.monolith.mjs +8 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/woodscli.json +38 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter/wphs.adapter.ts +7 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/.env.dev.example +3 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/.env.local.example +6 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/.env.prod.example +5 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/.env.stg.example +3 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/.wphs/README.md +17 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/README.md +60 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/hubspot.config.yml.example +10 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/index.html +12 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/package.json +34 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/portal.cdn.json.example +8 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/public/fields.json +100 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/public/meta.json +9 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/public/module.html +38 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/app.tsx +173 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/assets/css/main.dev.css +23 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/assets/css/main.prod.css +12 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/assets/css/tailwind.css.config.css +7 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/cdn/app-entry.ts +48 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/cdn/vendor-entry.ts +28 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/components/Layouts/AppLayoutWrapper.tsx +38 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/components/Layouts/AuthLayout.tsx +7 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/components/Layouts/DefaultLayout.tsx +5 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/components/Layouts/MainLayout.tsx +7 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/components/Layouts/UnauthorizedLayout.tsx +5 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/components/Layouts/index.ts +13 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/components/layout/portal-sidebar-nav.tsx +33 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/components/layout/portal-sidebar.tsx +139 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/components/layout/section-card.tsx +20 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/components/layout/starter-nav.tsx +28 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/components/layout/starter-shell.tsx +18 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/components/ui/Button.tsx +22 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/components/ui/Form.tsx +22 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/components/ui/Input.tsx +12 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/components/ui/Toaster.tsx +5 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/components/ui/link.tsx +10 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/components/ui/loader/loader.tsx +18 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/config/auth-tier.ts +4 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/config/nav-scaffold.ts +4 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/config/portal-nav.ts +9 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/config/router.ts +1 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/config/routes.ts +10 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/data/hubSpotContext.ts +57 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/data/sync-sdk-hub-context.ts +44 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/defaultData.ts +2 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/env.ts +59 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/features/auth/app-bootstrap-guards.ts +14 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/features/auth/auth-navigation.ts +81 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/features/auth/auth-route-paths.ts +29 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/features/auth/auth-session-events.ts +2 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/features/auth/auth-session.ts +26 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/features/auth/clear-client-auth-session.ts +62 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/features/auth/components/starter-login.tsx +76 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/features/auth/login-email-storage.ts +64 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/features/auth/login-session-bridge.ts +72 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/features/auth/post-login-path.ts +17 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/features/auth/resolve-auth-login-error-message.ts +52 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/features/auth/resolve-post-login-path.ts +21 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/features/auth/use-portal-session.ts +25 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/features/auth/use-signed-in-email.ts +55 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/features/starter/components/starter-guide-page.tsx +210 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/features/starter/components/starter-home-page.tsx +21 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/features/starter/components/starter-home.tsx +48 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/features/starter/components/starter-page-frame.tsx +25 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/features/starter/components/starter-protected-page.tsx +54 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/features/starter/components/starter-single-page.tsx +17 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/features/starter/content/auth-guide-content.ts +85 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/features/starter/content/woodscli-guide-content.ts +86 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/features/starter/hooks/starter-preview-values.ts +60 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/features/starter/hooks/use-starter-preview.dev.ts +18 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/features/starter/hooks/use-starter-preview.ts +30 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/features/starter/index.ts +6 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/hubspot/bootstrap.ts +16 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/hubspot/default-data.ts +7 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/hubspot/is-cms-editor.ts +78 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/hubspot/module-entry.tsx +9 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/hubspot/types.ts +17 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/integrations/configure-woodsportal-sdk.ts +94 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/integrations/tanstack-query/root-provider.tsx +18 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/integrations/tanstack-router/router.tsx +39 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/integrations/woodsportal-sdk.ts +37 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/main.tsx +5 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/portal/api-endpoint.ts +11 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/portal/ensure-portal-cdn-stylesheet.ts +115 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/portal/mount-dev-preview.tsx +12 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/portal/mount-portal.tsx +52 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/routeTree.gen.ts +134 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/routes/__root.tsx +12 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/routes/_app/portal.tsx +10 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/routes/_auth/login.tsx +10 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/routes/guide.tsx +9 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/routes/index.tsx +8 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/routes/unauthorized.tsx +50 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/utils/ValidationSchema.ts +1 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/utils/cookie.ts +23 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/utils/normalize-router-path.ts +10 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/utils/private-route.tsx +100 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/utils/public-route.tsx +64 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/utils/resolve-api-base-url.ts +44 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/src/utils/safe-router-navigation.ts +82 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/tsconfig.json +20 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/vite.config.cdn-app.mjs +1 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/vite.config.cdn-esm.mjs +1 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/vite.config.cdn-vendor.mjs +1 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/vite.config.dev.mjs +1 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/vite.config.hubspot.mjs +1 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/vite.config.monolith.mjs +8 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/woodscli.json +38 -0
- package/examples/greenfield/module-hybrid-cdn-auth-starter-sidebar/wphs.adapter.ts +7 -0
- package/examples/greenfield/module-monolith/public/fields.json +66 -16
- package/examples/greenfield/module-monolith/src/assets/css/main.dev.css +7 -0
- package/examples/greenfield/module-monolith/src/components/layout/starter-nav.tsx +12 -15
- package/examples/greenfield/module-monolith/src/config/starter-nav.ts +9 -0
- package/examples/greenfield/module-monolith/src/features/starter/components/starter-home.tsx +25 -29
- package/examples/greenfield/module-monolith/src/features/starter/hooks/starter-preview-values.ts +60 -0
- package/examples/greenfield/module-monolith/src/features/starter/hooks/use-starter-preview.dev.ts +18 -0
- package/examples/greenfield/module-monolith/src/features/starter/hooks/use-starter-preview.ts +20 -37
- package/examples/manifest.json +5 -1
- package/examples/smoke/run-matrix.mjs +37 -0
- package/package.json +30 -13
- package/scripts/audit-tdz-split.mjs +11 -5
- package/scripts/build-cdn.mjs +6 -5
- package/scripts/check-cdn-size-regression.mjs +49 -0
- package/scripts/check-hubspot-bundle-size.mjs +18 -4
- package/scripts/cli-smoke-helpers.mjs +150 -0
- package/scripts/dist-cli-pack-smoke.test.mjs +79 -0
- package/scripts/ensure-wphs-workspace.mjs +7 -2
- package/scripts/generate-cdn-bundle-breakdown.mjs +61 -0
- package/scripts/generate-cdn-manifest.mjs +23 -8
- package/scripts/portal-vite-env.mjs +76 -2
- package/scripts/publish-cdn-github.mjs +79 -14
- package/scripts/refresh-artifact-sizes.mjs +77 -0
- package/scripts/regenerate-route-tree.mjs +71 -0
- package/scripts/resolve-hubspot-cli.mjs +51 -0
- package/scripts/resolve-vite-config.mjs +2 -3
- package/scripts/resolve-vite-spawn.mjs +48 -0
- package/scripts/run-vite-build.mjs +5 -6
- package/scripts/sync-auth-scaffold-from-client.mjs +41 -0
- package/scripts/verify-cdn-api-endpoint.mjs +17 -10
- package/scripts/vite/create-dev-server-config.mjs +7 -1
- package/scripts/vite/portal-build-shared.js +62 -2
- package/scripts/watch-hubspot.mjs +11 -13
- package/scripts/wp-cli-smoke.test.mjs +263 -0
- package/src/dev/bootstrap-greenfield.tsx +6 -0
- package/src/dev-module-config/ui/module-config-overlay-side.ts +13 -3
- package/src/dev-module-config/ui/module-config-toolbar-theme.ts +12 -3
- package/templates/module-hybrid-cdn/README.md +2 -1
- package/templates/module-hybrid-cdn/public/fields.json +47 -7
- package/templates/module-hybrid-cdn/public/module.html +7 -6
- package/templates/module-hybrid-cdn/src/assets/css/main.dev.css +7 -0
- package/templates/module-hybrid-cdn/src/components/layout/starter-nav.tsx +12 -15
- package/templates/module-hybrid-cdn/src/config/starter-nav.ts +9 -0
- package/templates/module-hybrid-cdn/src/features/starter/components/starter-home.tsx +25 -27
- package/templates/module-hybrid-cdn/src/features/starter/hooks/starter-preview-values.ts +5 -5
- package/templates/module-monolith/README.md +2 -1
- package/templates/module-monolith/public/fields.json +49 -6
- package/templates/module-monolith/src/assets/css/main.dev.css +7 -0
- package/templates/module-monolith/src/components/layout/starter-nav.tsx +12 -15
- package/templates/module-monolith/src/config/starter-nav.ts +9 -0
- package/templates/module-monolith/src/features/starter/components/starter-home.tsx +25 -27
- package/templates/module-monolith/src/features/starter/hooks/starter-preview-values.ts +5 -5
- package/templates/scaffold/auth/_full/src/app.tsx +172 -0
- package/templates/scaffold/auth/_full/src/config/auth-tier.ts +4 -0
- package/templates/scaffold/auth/_full/src/features/auth/auth-session.ts +51 -0
- package/templates/scaffold/auth/_full/src/features/auth/components/starter-login.tsx +79 -0
- package/templates/scaffold/auth/_full/src/features/auth/login-session-bridge.ts +74 -0
- package/templates/scaffold/auth/_full/src/features/auth/mfa-otp-utils.ts +24 -0
- package/templates/scaffold/auth/_full/src/features/auth/mfa-pending-storage.ts +108 -0
- package/templates/scaffold/auth/_full/src/features/auth/mfa-portal.ts +45 -0
- package/templates/scaffold/auth/_full/src/features/auth/use-mfa-login-otp-flow.ts +78 -0
- package/templates/scaffold/auth/_full/src/routeTree.gen.ts +182 -0
- package/templates/scaffold/auth/_full/src/routes/_auth/two-fa.tsx +91 -0
- package/templates/scaffold/auth/_nav-sidebar/src/components/Layouts/MainLayout.tsx +7 -0
- package/templates/scaffold/auth/_nav-sidebar/src/components/layout/portal-sidebar-nav.tsx +33 -0
- package/templates/scaffold/auth/_nav-sidebar/src/components/layout/portal-sidebar.tsx +139 -0
- package/templates/scaffold/auth/_nav-top/src/components/Layouts/MainLayout.tsx +42 -0
- package/templates/scaffold/auth/_shared/src/app.tsx +178 -0
- package/templates/scaffold/auth/_shared/src/components/Layouts/AppLayoutWrapper.tsx +38 -0
- package/templates/scaffold/auth/_shared/src/components/Layouts/AuthLayout.tsx +7 -0
- package/templates/scaffold/auth/_shared/src/components/Layouts/DefaultLayout.tsx +5 -0
- package/templates/scaffold/auth/_shared/src/components/Layouts/UnauthorizedLayout.tsx +5 -0
- package/templates/scaffold/auth/_shared/src/components/Layouts/index.ts +13 -0
- package/templates/scaffold/auth/_shared/src/components/ui/Button.tsx +22 -0
- package/templates/scaffold/auth/_shared/src/components/ui/Form.tsx +22 -0
- package/templates/scaffold/auth/_shared/src/components/ui/Input.tsx +12 -0
- package/templates/scaffold/auth/_shared/src/components/ui/Toaster.tsx +5 -0
- package/templates/scaffold/auth/_shared/src/components/ui/link.tsx +10 -0
- package/templates/scaffold/auth/_shared/src/components/ui/loader/loader.tsx +18 -0
- package/templates/scaffold/auth/_shared/src/config/auth-tier.ts +4 -0
- package/templates/scaffold/auth/_shared/src/config/nav-scaffold.ts +4 -0
- package/templates/scaffold/auth/_shared/src/config/portal-nav.ts +9 -0
- package/templates/scaffold/auth/_shared/src/config/router.ts +1 -0
- package/templates/scaffold/auth/_shared/src/config/routes.ts +10 -0
- package/templates/scaffold/auth/_shared/src/data/hubSpotContext.ts +57 -0
- package/templates/scaffold/auth/_shared/src/data/sync-sdk-hub-context.ts +44 -0
- package/templates/scaffold/auth/_shared/src/env.ts +59 -0
- package/templates/scaffold/auth/_shared/src/features/auth/app-bootstrap-guards.ts +14 -0
- package/templates/scaffold/auth/_shared/src/features/auth/auth-navigation.ts +81 -0
- package/templates/scaffold/auth/_shared/src/features/auth/auth-route-paths.ts +29 -0
- package/templates/scaffold/auth/_shared/src/features/auth/auth-session-events.ts +2 -0
- package/templates/scaffold/auth/_shared/src/features/auth/auth-session.ts +26 -0
- package/templates/scaffold/auth/_shared/src/features/auth/clear-client-auth-session.ts +62 -0
- package/templates/scaffold/auth/_shared/src/features/auth/components/starter-login.tsx +83 -0
- package/templates/scaffold/auth/_shared/src/features/auth/login-email-storage.ts +64 -0
- package/templates/scaffold/auth/_shared/src/features/auth/login-session-bridge.ts +72 -0
- package/templates/scaffold/auth/_shared/src/features/auth/post-login-path.ts +17 -0
- package/templates/scaffold/auth/_shared/src/features/auth/resolve-auth-login-error-message.ts +52 -0
- package/templates/scaffold/auth/_shared/src/features/auth/resolve-post-login-path.ts +21 -0
- package/templates/scaffold/auth/_shared/src/features/auth/use-portal-session.ts +25 -0
- package/templates/scaffold/auth/_shared/src/features/auth/use-signed-in-email.ts +55 -0
- package/templates/scaffold/auth/_shared/src/features/starter/components/starter-guide-page.tsx +218 -0
- package/templates/scaffold/auth/_shared/src/features/starter/components/starter-page-frame.tsx +25 -0
- package/templates/scaffold/auth/_shared/src/features/starter/components/starter-protected-page.tsx +54 -0
- package/templates/scaffold/auth/_shared/src/features/starter/content/auth-guide-content.ts +91 -0
- package/templates/scaffold/auth/_shared/src/hubspot/is-cms-editor.ts +78 -0
- package/templates/scaffold/auth/_shared/src/integrations/configure-woodsportal-sdk.ts +100 -0
- package/templates/scaffold/auth/_shared/src/integrations/tanstack-query/root-provider.tsx +18 -0
- package/templates/scaffold/auth/_shared/src/integrations/tanstack-router/router.tsx +39 -0
- package/templates/scaffold/auth/_shared/src/integrations/woodsportal-sdk.ts +37 -0
- package/templates/scaffold/auth/_shared/src/portal/mount-portal.tsx +59 -0
- package/templates/scaffold/auth/_shared/src/routeTree.gen.ts +134 -0
- package/templates/scaffold/auth/_shared/src/routes/__root.tsx +12 -0
- package/templates/scaffold/auth/_shared/src/routes/_app/portal.tsx +10 -0
- package/templates/scaffold/auth/_shared/src/routes/_auth/login.tsx +10 -0
- package/templates/scaffold/auth/_shared/src/routes/guide.tsx +9 -0
- package/templates/scaffold/auth/_shared/src/routes/index.tsx +8 -0
- package/templates/scaffold/auth/_shared/src/routes/unauthorized.tsx +50 -0
- package/templates/scaffold/auth/_shared/src/utils/ValidationSchema.ts +1 -0
- package/templates/scaffold/auth/_shared/src/utils/cookie.ts +23 -0
- package/templates/scaffold/auth/_shared/src/utils/normalize-router-path.ts +10 -0
- package/templates/scaffold/auth/_shared/src/utils/private-route.tsx +100 -0
- package/templates/scaffold/auth/_shared/src/utils/public-route.tsx +64 -0
- package/templates/scaffold/auth/_shared/src/utils/resolve-api-base-url.ts +44 -0
- package/templates/scaffold/auth/_shared/src/utils/safe-router-navigation.ts +82 -0
- package/templates/scaffold/auth/_sso/src/app.tsx +180 -0
- package/templates/scaffold/auth/_sso/src/components/ui/auth/SsoLoginButton.tsx +34 -0
- package/templates/scaffold/auth/_sso/src/config/auth-tier.ts +4 -0
- package/templates/scaffold/auth/_sso/src/features/auth/components/starter-login.tsx +90 -0
- package/templates/scaffold/auth/_sso/src/features/auth/sso-callback.ts +126 -0
- package/templates/scaffold/auth/_sso/src/features/auth/use-sso-callback-handler.ts +92 -0
- package/templates/scaffold/auth/_sso/src/routeTree.gen.ts +155 -0
- package/templates/scaffold/auth/_sso/src/routes/_auth/login/sso.tsx +27 -0
- package/templates/scaffold/auth/nav-manifest.json +8 -0
- package/templates/scaffold/auth/sync-manifest.json +16 -0
- package/templates/scaffold/auth/tier-manifest.json +18 -0
- package/templates/scaffold/page/page-component-auth.tsx.tpl +10 -0
- package/templates/scaffold/page/page-component-plain.tsx.tpl +11 -0
- package/templates/scaffold/page/route-protected-auth.tsx.tpl +10 -0
- package/templates/scaffold/page/route-public-auth.tsx.tpl +9 -0
- package/templates/scaffold/page/route-public-plain.tsx.tpl +6 -0
- package/vite/vite.config.cdn-app.mjs +43 -30
- package/vite/vite.config.cdn-audit.mjs +34 -0
- package/vite/vite.config.cdn-esm.mjs +1 -1
- package/dist/chunk-4GOJPOW3.js.map +0 -1
- package/dist/chunk-S2YJDWZU.js.map +0 -1
- /package/dist/{exec-VY6BGWF3.js.map → exec-NS4GKXZS.js.map} +0 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ROUTES } from '@/config/routes'
|
|
2
|
+
|
|
3
|
+
/** No-auth module navigation — edit once; StarterNav reads this file. */
|
|
4
|
+
export const starterNavItems = [
|
|
5
|
+
{ to: ROUTES.home, label: 'Home' },
|
|
6
|
+
{ to: ROUTES.guide, label: 'Developer guide' },
|
|
7
|
+
] as const
|
|
8
|
+
|
|
9
|
+
export type StarterNavItem = (typeof starterNavItems)[number]
|
package/examples/greenfield/module-monolith/src/features/starter/components/starter-home.tsx
CHANGED
|
@@ -1,38 +1,34 @@
|
|
|
1
1
|
import { useStarterPreview } from '../hooks/use-starter-preview'
|
|
2
2
|
import { STARTER_FEATURES, WOODSCLI_ABOUT } from '../content/woodscli-guide-content'
|
|
3
3
|
|
|
4
|
-
function heroClass(style: ReturnType<typeof useStarterPreview>['heroStyle']): string {
|
|
5
|
-
if (style === 'minimal') {
|
|
6
|
-
return 'bg-[var(--mc-bg-shell,#f5f8fa)] text-[var(--mc-text,#33475b)] border-b border-[var(--mc-border,#cbd6e2)]'
|
|
7
|
-
}
|
|
8
|
-
if (style === 'bold') {
|
|
9
|
-
return 'bg-[#1c1c1f] text-white'
|
|
10
|
-
}
|
|
11
|
-
return 'bg-gradient-to-br from-[var(--starter-accent,#0091ae)] to-[#ff7a59] text-white'
|
|
12
|
-
}
|
|
13
|
-
|
|
14
4
|
export function StarterHome() {
|
|
15
|
-
const { title, tagline, showFeatureCards,
|
|
5
|
+
const { title, tagline, showFeatureCards, heroStyle } = useStarterPreview()
|
|
16
6
|
|
|
17
7
|
return (
|
|
18
8
|
<>
|
|
19
|
-
<
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
</
|
|
34
|
-
|
|
35
|
-
|
|
9
|
+
<section
|
|
10
|
+
className={
|
|
11
|
+
heroStyle === 'minimal'
|
|
12
|
+
? 'px-6 py-14 sm:px-10 sm:py-16 bg-[var(--mc-bg-shell,#f5f8fa)] text-[var(--mc-text,#33475b)] border-b border-[var(--mc-border,#cbd6e2)]'
|
|
13
|
+
: heroStyle === 'bold'
|
|
14
|
+
? 'px-6 py-14 sm:px-10 sm:py-16 bg-[#1c1c1f] text-white'
|
|
15
|
+
: 'px-6 py-14 sm:px-10 sm:py-16 bg-gradient-to-br from-[var(--primary-color,#FF7A59)] to-[var(--secondary-color,#2797AF)] text-white'
|
|
16
|
+
}
|
|
17
|
+
>
|
|
18
|
+
<div className="mx-auto max-w-4xl">
|
|
19
|
+
<p className="mb-2 text-xs font-semibold uppercase tracking-widest opacity-80">
|
|
20
|
+
{WOODSCLI_ABOUT.package} · local dev
|
|
21
|
+
</p>
|
|
22
|
+
<h1 className="text-3xl font-semibold tracking-tight sm:text-4xl">{title}</h1>
|
|
23
|
+
<p className="mt-4 max-w-2xl text-base leading-relaxed opacity-90 sm:text-lg">{tagline}</p>
|
|
24
|
+
<p className="mt-6 text-sm opacity-75">
|
|
25
|
+
Module config overlay:{' '}
|
|
26
|
+
<kbd className="rounded bg-black/10 px-1.5 py-0.5 font-mono text-xs">Ctrl+Shift+Z</kbd>
|
|
27
|
+
{' · '}
|
|
28
|
+
Mac: <kbd className="rounded bg-black/10 px-1.5 py-0.5 font-mono text-xs">⌃⇧Z</kbd>
|
|
29
|
+
</p>
|
|
30
|
+
</div>
|
|
31
|
+
</section>
|
|
36
32
|
|
|
37
33
|
{showFeatureCards ? (
|
|
38
34
|
<div className="mx-auto grid max-w-4xl gap-4 px-6 py-10 sm:grid-cols-3 sm:px-10">
|
|
@@ -41,7 +37,7 @@ export function StarterHome() {
|
|
|
41
37
|
key={feature.title}
|
|
42
38
|
className="rounded-lg border border-[#cbd6e2] bg-white p-5 shadow-sm"
|
|
43
39
|
>
|
|
44
|
-
<h2 className="text-sm font-semibold text-[
|
|
40
|
+
<h2 className="text-sm font-semibold text-[var(--primary-color,#FF7A59)]">{feature.title}</h2>
|
|
45
41
|
<p className="mt-2 text-sm leading-relaxed text-[#516f90]">{feature.body}</p>
|
|
46
42
|
</article>
|
|
47
43
|
))}
|
package/examples/greenfield/module-monolith/src/features/starter/hooks/starter-preview-values.ts
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
export type StarterPreviewValues = {
|
|
2
|
+
title: string
|
|
3
|
+
tagline: string
|
|
4
|
+
showFeatureCards: boolean
|
|
5
|
+
heroStyle: 'gradient' | 'minimal' | 'bold'
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
function normalizeHeroStyle(raw: unknown): StarterPreviewValues['heroStyle'] {
|
|
9
|
+
const key = String(raw ?? 'gradient').toLowerCase()
|
|
10
|
+
if (key === 'minimal' || key === 'bold') return key
|
|
11
|
+
return 'gradient'
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/** CONTENT-tab fields may live under a `content` group (fields.json) or flat legacy keys. */
|
|
15
|
+
function readContentField(module: Record<string, unknown>, key: string): unknown {
|
|
16
|
+
const content = module.content
|
|
17
|
+
if (content && typeof content === 'object' && key in (content as Record<string, unknown>)) {
|
|
18
|
+
return (content as Record<string, unknown>)[key]
|
|
19
|
+
}
|
|
20
|
+
return module[key]
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** STYLE-tab fields may live under a `style` group (fields.json) or legacy `styles` / flat keys. */
|
|
24
|
+
function readStyleField(module: Record<string, unknown>, key: string): unknown {
|
|
25
|
+
const style = module.style
|
|
26
|
+
if (style && typeof style === 'object' && key in (style as Record<string, unknown>)) {
|
|
27
|
+
return (style as Record<string, unknown>)[key]
|
|
28
|
+
}
|
|
29
|
+
const styles = module.styles
|
|
30
|
+
if (styles && typeof styles === 'object' && key in (styles as Record<string, unknown>)) {
|
|
31
|
+
return (styles as Record<string, unknown>)[key]
|
|
32
|
+
}
|
|
33
|
+
return module[key]
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export function mapStarterPreviewValues(module: Record<string, unknown>): StarterPreviewValues {
|
|
37
|
+
return {
|
|
38
|
+
title: String(readContentField(module, 'title') ?? 'My HubSpot Portal'),
|
|
39
|
+
tagline: String(
|
|
40
|
+
readContentField(module, 'tagline') ??
|
|
41
|
+
'Customize this preview with Ctrl+Shift+Z, then replace this page with your portal app.',
|
|
42
|
+
),
|
|
43
|
+
showFeatureCards: readContentField(module, 'show_feature_cards') !== false,
|
|
44
|
+
heroStyle: normalizeHeroStyle(readStyleField(module, 'hero_style')),
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** HubSpot module field blob on window (dev adapter + CMS runtime). */
|
|
49
|
+
export function readStarterModuleFields(): Record<string, unknown> {
|
|
50
|
+
const win = window as Window & {
|
|
51
|
+
__WPHS_DATA__?: Record<string, unknown>
|
|
52
|
+
hubSpotData?: Record<string, unknown>
|
|
53
|
+
}
|
|
54
|
+
const blob = win.__WPHS_DATA__ ?? win.hubSpotData ?? {}
|
|
55
|
+
const nested = blob.module
|
|
56
|
+
if (nested && typeof nested === 'object') {
|
|
57
|
+
return nested as Record<string, unknown>
|
|
58
|
+
}
|
|
59
|
+
return blob
|
|
60
|
+
}
|
package/examples/greenfield/module-monolith/src/features/starter/hooks/use-starter-preview.dev.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { MODULE_CONFIG_CHANGED } from '@/dev/module-config/schema/types'
|
|
2
|
+
import { getModuleFieldValues } from '@/dev/module-config/runtime/module-config-runtime'
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
mapStarterPreviewValues,
|
|
6
|
+
type StarterPreviewValues,
|
|
7
|
+
} from './starter-preview-values'
|
|
8
|
+
|
|
9
|
+
/** Dev-only: refresh when module-config overlay applies changes. */
|
|
10
|
+
export function subscribeStarterPreview(
|
|
11
|
+
onChange: (values: StarterPreviewValues) => void,
|
|
12
|
+
): () => void {
|
|
13
|
+
const refresh = () => onChange(mapStarterPreviewValues(getModuleFieldValues()))
|
|
14
|
+
|
|
15
|
+
refresh()
|
|
16
|
+
window.addEventListener(MODULE_CONFIG_CHANGED, refresh)
|
|
17
|
+
return () => window.removeEventListener(MODULE_CONFIG_CHANGED, refresh)
|
|
18
|
+
}
|
package/examples/greenfield/module-monolith/src/features/starter/hooks/use-starter-preview.ts
CHANGED
|
@@ -1,47 +1,30 @@
|
|
|
1
1
|
import { useEffect, useState } from 'react'
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
tagline: string
|
|
9
|
-
showFeatureCards: boolean
|
|
10
|
-
accentColor: string
|
|
11
|
-
heroStyle: 'gradient' | 'minimal' | 'bold'
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
function normalizeHeroStyle(raw: unknown): StarterPreviewValues['heroStyle'] {
|
|
15
|
-
const key = String(raw ?? 'gradient').toLowerCase()
|
|
16
|
-
if (key === 'minimal' || key === 'bold') return key
|
|
17
|
-
return 'gradient'
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
function readPreviewValues(): StarterPreviewValues {
|
|
21
|
-
const module = getModuleFieldValues()
|
|
22
|
-
const accent = module.accent_color as { color?: string } | undefined
|
|
23
|
-
|
|
24
|
-
return {
|
|
25
|
-
title: String(module.title ?? 'My HubSpot Portal'),
|
|
26
|
-
tagline: String(
|
|
27
|
-
module.tagline ??
|
|
28
|
-
'Customize this preview with Ctrl+Shift+Z, then replace this page with your portal app.',
|
|
29
|
-
),
|
|
30
|
-
showFeatureCards: module.show_feature_cards !== false,
|
|
31
|
-
accentColor: accent?.color ?? '#0091ae',
|
|
32
|
-
heroStyle: normalizeHeroStyle(module.hero_style),
|
|
33
|
-
}
|
|
34
|
-
}
|
|
3
|
+
import {
|
|
4
|
+
mapStarterPreviewValues,
|
|
5
|
+
readStarterModuleFields,
|
|
6
|
+
type StarterPreviewValues,
|
|
7
|
+
} from './starter-preview-values'
|
|
35
8
|
|
|
36
|
-
/**
|
|
9
|
+
/** Module field values for the starter preview (dev overlay + production window data). */
|
|
37
10
|
export function useStarterPreview(): StarterPreviewValues {
|
|
38
|
-
const [values, setValues] = useState(
|
|
11
|
+
const [values, setValues] = useState(() => mapStarterPreviewValues(readStarterModuleFields()))
|
|
39
12
|
|
|
40
13
|
useEffect(() => {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
14
|
+
if (!import.meta.env.DEV) {
|
|
15
|
+
return
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
let unsubscribe = () => {}
|
|
19
|
+
|
|
20
|
+
void import('./use-starter-preview.dev').then(({ subscribeStarterPreview }) => {
|
|
21
|
+
unsubscribe = subscribeStarterPreview(setValues)
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
return () => unsubscribe()
|
|
44
25
|
}, [])
|
|
45
26
|
|
|
46
27
|
return values
|
|
47
28
|
}
|
|
29
|
+
|
|
30
|
+
export type { StarterPreviewValues } from './starter-preview-values'
|
package/examples/manifest.json
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 1,
|
|
3
3
|
"scenarios": [
|
|
4
|
-
{ "id": "greenfield-module-hybrid-cdn", "setup": "greenfield", "track": "module", "projectType": "module-hybrid-cdn", "smokeTier": "live", "fixture": "greenfield/module-hybrid-cdn", "checks": ["layout"] },
|
|
4
|
+
{ "id": "greenfield-module-hybrid-cdn", "setup": "greenfield", "track": "module", "projectType": "module-hybrid-cdn", "smokeTier": "live", "fixture": "greenfield/module-hybrid-cdn", "checks": ["layout", "scaffold.auth=none", "file=src/config/starter-nav.ts"] },
|
|
5
5
|
{ "id": "greenfield-module-monolith", "setup": "greenfield", "track": "module", "projectType": "module-monolith", "smokeTier": "live", "fixture": "greenfield/module-monolith", "checks": ["layout"] },
|
|
6
6
|
{ "id": "greenfield-theme-starter", "setup": "greenfield", "track": "theme", "projectType": "theme-starter", "smokeTier": "live", "fixture": "greenfield/theme-starter", "checks": ["layout"] },
|
|
7
|
+
{ "id": "greenfield-module-hybrid-cdn-auth-starter", "setup": "greenfield", "track": "module", "projectType": "module-hybrid-cdn", "smokeTier": "static", "fixture": "greenfield/module-hybrid-cdn-auth-starter", "checks": ["layout", "scaffold.auth=starter"] },
|
|
8
|
+
{ "id": "greenfield-module-hybrid-cdn-auth-sso", "setup": "greenfield", "track": "module", "projectType": "module-hybrid-cdn", "smokeTier": "static", "fixture": "greenfield/module-hybrid-cdn-auth-sso", "checks": ["layout", "scaffold.auth=sso"] },
|
|
9
|
+
{ "id": "greenfield-module-hybrid-cdn-auth-full", "setup": "greenfield", "track": "module", "projectType": "module-hybrid-cdn", "smokeTier": "static", "fixture": "greenfield/module-hybrid-cdn-auth-full", "checks": ["layout", "scaffold.auth=full"] },
|
|
10
|
+
{ "id": "greenfield-module-hybrid-cdn-auth-starter-sidebar", "setup": "greenfield", "track": "module", "projectType": "module-hybrid-cdn", "smokeTier": "static", "fixture": "greenfield/module-hybrid-cdn-auth-starter-sidebar", "checks": ["layout", "scaffold.auth=starter", "scaffold.nav=sidebar"] },
|
|
7
11
|
{ "id": "existing-module-hybrid", "setup": "existing", "track": "module", "smokeTier": "static", "fixture": "fixtures/existing-module-hybrid" },
|
|
8
12
|
{ "id": "existing-theme-minimal", "setup": "existing", "track": "theme", "smokeTier": "static", "fixture": "fixtures/existing-theme-minimal" },
|
|
9
13
|
{ "id": "adopt-module-hybrid", "setup": "adopted", "track": "module", "projectType": "module-hybrid-cdn", "smokeTier": "static", "fixture": "fixtures/adopted-module-hybrid" },
|
|
@@ -49,6 +49,43 @@ function runStaticScenario(scenario) {
|
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
+
for (const check of checks) {
|
|
53
|
+
if (check.startsWith('scaffold.auth=')) {
|
|
54
|
+
const expected = check.split('=')[1]
|
|
55
|
+
const root = scenario.fixture ? fixtureRoot(scenario.fixture) : kitRoot
|
|
56
|
+
const woodscliPath = join(root, 'woodscli.json')
|
|
57
|
+
if (!existsSync(woodscliPath)) {
|
|
58
|
+
throw new Error(`${scenario.id}: missing woodscli.json for ${check}`)
|
|
59
|
+
}
|
|
60
|
+
const config = JSON.parse(readFileSync(woodscliPath, 'utf8'))
|
|
61
|
+
const actual = config.scaffold?.auth ?? 'none'
|
|
62
|
+
if (actual !== expected) {
|
|
63
|
+
throw new Error(`${scenario.id}: expected scaffold.auth=${expected}, got ${actual}`)
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
if (check.startsWith('scaffold.nav=')) {
|
|
67
|
+
const expected = check.split('=')[1]
|
|
68
|
+
const root = scenario.fixture ? fixtureRoot(scenario.fixture) : kitRoot
|
|
69
|
+
const woodscliPath = join(root, 'woodscli.json')
|
|
70
|
+
if (!existsSync(woodscliPath)) {
|
|
71
|
+
throw new Error(`${scenario.id}: missing woodscli.json for ${check}`)
|
|
72
|
+
}
|
|
73
|
+
const config = JSON.parse(readFileSync(woodscliPath, 'utf8'))
|
|
74
|
+
const actual = config.scaffold?.nav ?? 'top'
|
|
75
|
+
if (actual !== expected) {
|
|
76
|
+
throw new Error(`${scenario.id}: expected scaffold.nav=${expected}, got ${actual}`)
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
if (check.startsWith('file=')) {
|
|
80
|
+
const relative = check.slice('file='.length)
|
|
81
|
+
const root = scenario.fixture ? fixtureRoot(scenario.fixture) : kitRoot
|
|
82
|
+
const filePath = join(root, relative)
|
|
83
|
+
if (!existsSync(filePath)) {
|
|
84
|
+
throw new Error(`${scenario.id}: expected file ${relative} at ${filePath}`)
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
52
89
|
if (checks.includes('wphs.tree') || checks.includes('wphs.config.dir')) {
|
|
53
90
|
const root = scenario.fixture ? fixtureRoot(scenario.fixture) : kitRoot
|
|
54
91
|
const layout = detectProjectLayout(root)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@woodsportal/hubspot-kit",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.42-dev.1",
|
|
4
4
|
"description": "WoodsCLI — HubSpot CMS dev kit by WoodsPortal. wp CLI, Vite presets, module-config overlay, and theme/module build pipelines.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -51,10 +51,11 @@
|
|
|
51
51
|
"build": "tsup",
|
|
52
52
|
"dev": "tsup --watch",
|
|
53
53
|
"typecheck": "tsc --noEmit",
|
|
54
|
-
"test": "node --import tsx --test 'src/lib/**/*.test.ts' 'src/schema/**/*.test.ts' 'src/vite/**/*.test.ts' 'scripts/portal-build-id.test.mjs' 'scripts/resolve-consumer-dep.test.mjs' 'scripts/vite/ensure-dev-kit-shims.test.mjs' 'scripts/vite/consumer-react-aliases.test.mjs' 'scripts/vite/resolve-from-project-root.test.mjs' && vitest run src/dev-module-config/__tests__/normalize-repeater-items.test.ts src/dev-module-config/__tests__/module-config-transform.test.ts src/dev-module-config/__tests__/flatten-visible-fields.test.ts",
|
|
54
|
+
"test": "node --import tsx --test 'src/lib/**/*.test.ts' 'src/cli/**/*.test.ts' 'src/schema/**/*.test.ts' 'src/vite/**/*.test.ts' 'scripts/portal-build-id.test.mjs' 'scripts/resolve-consumer-dep.test.mjs' 'scripts/wp-cli-smoke.test.mjs' 'scripts/vite/ensure-dev-kit-shims.test.mjs' 'scripts/vite/consumer-react-aliases.test.mjs' 'scripts/vite/resolve-from-project-root.test.mjs' && vitest run src/dev-module-config/__tests__/normalize-repeater-items.test.ts src/dev-module-config/__tests__/module-config-transform.test.ts src/dev-module-config/__tests__/flatten-visible-fields.test.ts",
|
|
55
55
|
"test:examples": "node examples/smoke/run-matrix.mjs --tier static",
|
|
56
|
+
"test:dist-pack": "node --test scripts/dist-cli-pack-smoke.test.mjs",
|
|
56
57
|
"lint": "eslint src",
|
|
57
|
-
"verify": "npm run typecheck && npm run test && npm run test:examples && npm run build",
|
|
58
|
+
"verify": "npm run typecheck && npm run test && npm run test:examples && npm run build && npm run test:dist-pack",
|
|
58
59
|
"prepublishOnly": "npm run verify"
|
|
59
60
|
},
|
|
60
61
|
"engines": {
|
|
@@ -68,14 +69,16 @@
|
|
|
68
69
|
"@clack/prompts": "^0.10.1",
|
|
69
70
|
"commander": "^13.1.0",
|
|
70
71
|
"picocolors": "^1.1.1",
|
|
72
|
+
"semver": "^7.8.4",
|
|
71
73
|
"zod": "^3.24.2"
|
|
72
74
|
},
|
|
73
75
|
"devDependencies": {
|
|
74
76
|
"@types/node": "^22.13.4",
|
|
75
|
-
"
|
|
76
|
-
"tsx": "^4.19.3",
|
|
77
|
+
"@types/semver": "^7.7.1",
|
|
77
78
|
"tsup": "^8.4.0",
|
|
78
|
-
"
|
|
79
|
+
"tsx": "^4.19.3",
|
|
80
|
+
"typescript": "^5.7.3",
|
|
81
|
+
"vitest": "^3.2.4"
|
|
79
82
|
},
|
|
80
83
|
"peerDependencies": {
|
|
81
84
|
"@tailwindcss/vite": "^4.0.0",
|
|
@@ -87,12 +90,26 @@
|
|
|
87
90
|
"vite": "^6.0.0"
|
|
88
91
|
},
|
|
89
92
|
"peerDependenciesMeta": {
|
|
90
|
-
"@tailwindcss/vite": {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
"
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
"
|
|
93
|
+
"@tailwindcss/vite": {
|
|
94
|
+
"optional": true
|
|
95
|
+
},
|
|
96
|
+
"@tanstack/router-plugin": {
|
|
97
|
+
"optional": true
|
|
98
|
+
},
|
|
99
|
+
"@vitejs/plugin-react": {
|
|
100
|
+
"optional": true
|
|
101
|
+
},
|
|
102
|
+
"babel-plugin-react-compiler": {
|
|
103
|
+
"optional": true
|
|
104
|
+
},
|
|
105
|
+
"react": {
|
|
106
|
+
"optional": true
|
|
107
|
+
},
|
|
108
|
+
"react-dom": {
|
|
109
|
+
"optional": true
|
|
110
|
+
},
|
|
111
|
+
"vite": {
|
|
112
|
+
"optional": true
|
|
113
|
+
}
|
|
97
114
|
}
|
|
98
115
|
}
|
|
@@ -3,19 +3,25 @@
|
|
|
3
3
|
* Usage: node scripts/audit-tdz-split.mjs
|
|
4
4
|
*/
|
|
5
5
|
import { defineConfig, build } from 'vite'
|
|
6
|
-
import viteReact from '@vitejs/plugin-react'
|
|
7
|
-
import { TanStackRouterVite } from '@tanstack/router-plugin/vite'
|
|
8
6
|
import { resolve, dirname } from 'node:path'
|
|
9
7
|
import { fileURLToPath } from 'node:url'
|
|
10
8
|
import { execSync } from 'node:child_process'
|
|
11
9
|
import { readFileSync, readdirSync, existsSync } from 'node:fs'
|
|
12
|
-
import tailwindcss from '@tailwindcss/vite'
|
|
13
10
|
import tailwindPrefixPlugin from './tailwind/prefix-plugin.js'
|
|
14
11
|
import TailwindContentPlugin from './tailwind/tailwind-content-plugin.js'
|
|
15
12
|
import isPrefix from './tailwind/prefix.env.js'
|
|
13
|
+
import { findProjectRoot } from './project-root.mjs'
|
|
14
|
+
import { importConsumerDep } from './resolve-consumer-dep.mjs'
|
|
15
|
+
|
|
16
|
+
const [{ default: viteReact }, { TanStackRouterVite }, { default: tailwindcss }] =
|
|
17
|
+
await Promise.all([
|
|
18
|
+
importConsumerDep('@vitejs/plugin-react'),
|
|
19
|
+
importConsumerDep('@tanstack/router-plugin/vite'),
|
|
20
|
+
importConsumerDep('@tailwindcss/vite'),
|
|
21
|
+
])
|
|
16
22
|
|
|
17
23
|
const __dirname = dirname(fileURLToPath(import.meta.url))
|
|
18
|
-
const root =
|
|
24
|
+
const root = findProjectRoot()
|
|
19
25
|
const outDir = resolve(root, 'dist/TdzAudit')
|
|
20
26
|
const mode = 'production'
|
|
21
27
|
|
|
@@ -42,7 +48,7 @@ const config = defineConfig({
|
|
|
42
48
|
copyPublicDir: false,
|
|
43
49
|
cssCodeSplit: true,
|
|
44
50
|
lib: {
|
|
45
|
-
entry: resolve(root, 'src/
|
|
51
|
+
entry: resolve(root, 'src/cdn/app-entry.ts'),
|
|
46
52
|
name: 'TdzAuditModule',
|
|
47
53
|
fileName: () => 'module.js',
|
|
48
54
|
formats: ['iife'],
|
package/scripts/build-cdn.mjs
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* Build CDN vendor + app IIFE chunks into dist/cdn/
|
|
4
4
|
*/
|
|
5
|
-
import {
|
|
6
|
-
import { resolve, dirname } from 'node:path'
|
|
5
|
+
import { resolve } from 'node:path'
|
|
7
6
|
import { fileURLToPath } from 'node:url'
|
|
7
|
+
|
|
8
8
|
import { findProjectRoot } from './project-root.mjs'
|
|
9
9
|
|
|
10
10
|
import { envWithPortalBuildId } from './resolve-portal-build-id.mjs'
|
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
portalSubprocessStdio,
|
|
18
18
|
portalViteLogArgs,
|
|
19
19
|
} from './portal-subprocess-stdio.mjs'
|
|
20
|
+
import { spawnViteSync } from './resolve-vite-spawn.mjs'
|
|
20
21
|
|
|
21
22
|
const root = findProjectRoot()
|
|
22
23
|
|
|
@@ -31,9 +32,9 @@ const env = envForPortalBuild(mode, root, {
|
|
|
31
32
|
})
|
|
32
33
|
|
|
33
34
|
function runWithEnv(config, buildMode) {
|
|
34
|
-
const result =
|
|
35
|
-
|
|
36
|
-
['
|
|
35
|
+
const result = spawnViteSync(
|
|
36
|
+
root,
|
|
37
|
+
['build', '--config', config, '--mode', buildMode, ...portalViteLogArgs()],
|
|
37
38
|
{ cwd: root, stdio: portalSubprocessStdio(), env, encoding: 'utf8' },
|
|
38
39
|
)
|
|
39
40
|
exitOnSpawnFailure(result)
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Fail when dist/cdn/app.*.js raw size grows more than PORTAL_CDN_APP_SIZE_REGRESSION_PCT vs baseline.
|
|
4
|
+
* Baseline: docs/audit/cdn-app-size-baseline.json (committed after intentional size changes).
|
|
5
|
+
*/
|
|
6
|
+
import { existsSync, readFileSync, readdirSync, writeFileSync } from 'node:fs'
|
|
7
|
+
import { resolve } from 'node:path'
|
|
8
|
+
import { findProjectRoot } from './project-root.mjs'
|
|
9
|
+
|
|
10
|
+
const root = findProjectRoot()
|
|
11
|
+
const cdnDir = resolve(root, 'dist/cdn')
|
|
12
|
+
const baselinePath = resolve(root, 'docs/audit/cdn-app-size-baseline.json')
|
|
13
|
+
const pctLimit = Number(process.env.PORTAL_CDN_APP_SIZE_REGRESSION_PCT ?? 5)
|
|
14
|
+
|
|
15
|
+
function findAppJs() {
|
|
16
|
+
if (!existsSync(cdnDir)) return null
|
|
17
|
+
return readdirSync(cdnDir).find((f) => /^app\..*\.js$/.test(f)) ?? null
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const appFile = findAppJs()
|
|
21
|
+
if (!appFile) {
|
|
22
|
+
console.error('[cdn-regression] dist/cdn/app.*.js missing — run yarn build:cdn first')
|
|
23
|
+
process.exit(1)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const rawBytes = readFileSync(resolve(cdnDir, appFile)).length
|
|
27
|
+
|
|
28
|
+
if (!existsSync(baselinePath)) {
|
|
29
|
+
const baseline = { file: appFile, rawBytes, updatedAt: new Date().toISOString() }
|
|
30
|
+
writeFileSync(baselinePath, JSON.stringify(baseline, null, 2))
|
|
31
|
+
console.log(`[cdn-regression] Wrote baseline ${(rawBytes / 1024).toFixed(1)} KiB → ${baselinePath}`)
|
|
32
|
+
process.exit(0)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const baseline = JSON.parse(readFileSync(baselinePath, 'utf8'))
|
|
36
|
+
const growthPct = ((rawBytes - baseline.rawBytes) / baseline.rawBytes) * 100
|
|
37
|
+
|
|
38
|
+
console.log(
|
|
39
|
+
`[cdn-regression] app shell ${(rawBytes / 1024).toFixed(1)} KiB raw (baseline ${(baseline.rawBytes / 1024).toFixed(1)} KiB, ${growthPct >= 0 ? '+' : ''}${growthPct.toFixed(1)}%)`,
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
if (growthPct > pctLimit) {
|
|
43
|
+
console.error(
|
|
44
|
+
`[cdn-regression] FAIL: grew ${growthPct.toFixed(1)}% > ${pctLimit}% limit. Update baseline intentionally or reduce bundle.`,
|
|
45
|
+
)
|
|
46
|
+
process.exit(1)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
console.log('[cdn-regression] OK')
|
|
@@ -17,9 +17,9 @@ const embedMode = isMonolith ? 'monolith' : (process.env.VITE_PORTAL_EMBED_MODE
|
|
|
17
17
|
const HUBSPOT_FILE_LIMIT = Number(process.env.HUBSPOT_MODULE_RAW_LIMIT_BYTES ?? 1.5 * 1024 * 1024)
|
|
18
18
|
const BOOTSTRAP_RAW_LIMIT = Number(process.env.HUBSPOT_BOOTSTRAP_RAW_LIMIT_BYTES ?? 200 * 1024)
|
|
19
19
|
const CDN_CHUNK_RAW_LIMIT = Number(process.env.PORTAL_CDN_CHUNK_RAW_LIMIT_BYTES ?? 1.5 * 1024 * 1024)
|
|
20
|
-
/**
|
|
20
|
+
/** App entry chunk — stepped down as multi-chunk splits land (target 1.5 MiB). */
|
|
21
21
|
const CDN_APP_RAW_LIMIT = Number(
|
|
22
|
-
process.env.PORTAL_CDN_APP_RAW_LIMIT_BYTES ?? 2.
|
|
22
|
+
process.env.PORTAL_CDN_APP_RAW_LIMIT_BYTES ?? 2.0 * 1024 * 1024,
|
|
23
23
|
)
|
|
24
24
|
|
|
25
25
|
function checkFile(label, path, rawLimit) {
|
|
@@ -52,8 +52,22 @@ if (embedMode === 'monolith') {
|
|
|
52
52
|
console.error('FAIL: dist/cdn missing — run yarn build:cdn')
|
|
53
53
|
process.exit(1)
|
|
54
54
|
}
|
|
55
|
-
|
|
56
|
-
const
|
|
55
|
+
function walkJsFiles(dir, prefix = '') {
|
|
56
|
+
const paths = []
|
|
57
|
+
for (const entry of readdirSync(dir, { withFileTypes: true })) {
|
|
58
|
+
const rel = prefix ? `${prefix}/${entry.name}` : entry.name
|
|
59
|
+
if (entry.isDirectory()) {
|
|
60
|
+
paths.push(...walkJsFiles(resolve(dir, entry.name), rel))
|
|
61
|
+
} else if (entry.name.endsWith('.js')) {
|
|
62
|
+
paths.push(rel)
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return paths
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
for (const file of walkJsFiles(cdnDir)) {
|
|
69
|
+
const base = file.split('/').pop() ?? file
|
|
70
|
+
const limit = base.startsWith('app.') ? CDN_APP_RAW_LIMIT : CDN_CHUNK_RAW_LIMIT
|
|
57
71
|
checkFile(`cdn/${file}`, resolve(cdnDir, file), limit)
|
|
58
72
|
}
|
|
59
73
|
}
|