@woodsportal/hubspot-kit 1.0.41 → 1.0.42-dev.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -1
- package/README.md +191 -157
- package/dist/{chunk-S2YJDWZU.js → chunk-NWBK3XBZ.js} +1 -1
- package/dist/chunk-NWBK3XBZ.js.map +1 -0
- package/dist/chunk-WHYTQEZX.js +554 -0
- package/dist/chunk-WHYTQEZX.js.map +1 -0
- package/dist/cli.js +1778 -864
- package/dist/cli.js.map +1 -1
- package/dist/ensure-wphs-workspace-5S3GTO6K.js +234 -0
- package/dist/ensure-wphs-workspace-5S3GTO6K.js.map +1 -0
- 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-EHMPWPPE.js +194 -0
- package/dist/scaffold-page-lifecycle-EHMPWPPE.js.map +1 -0
- package/dist/vite/index.js +1 -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 +59 -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 +83 -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 +120 -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 +59 -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 +120 -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 +59 -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 +59 -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 +28 -12
- package/scripts/audit-tdz-split.mjs +11 -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/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/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/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/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/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/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 +76 -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 +83 -0
- package/templates/scaffold/auth/_sso/src/features/auth/sso-callback.ts +120 -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-S2YJDWZU.js.map +0 -1
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Write docs/audit/CDN-BUNDLE-BREAKDOWN.md from cdn-bundle-visualizer.json (rollup-plugin-visualizer v2).
|
|
4
|
+
*/
|
|
5
|
+
import { existsSync, readFileSync, writeFileSync } from 'node:fs'
|
|
6
|
+
import { resolve } from 'node:path'
|
|
7
|
+
import { findProjectRoot } from './project-root.mjs'
|
|
8
|
+
|
|
9
|
+
const root = findProjectRoot()
|
|
10
|
+
const jsonPath = resolve(root, 'docs/audit/cdn-bundle-visualizer.json')
|
|
11
|
+
const outPath = resolve(root, 'docs/audit/CDN-BUNDLE-BREAKDOWN.md')
|
|
12
|
+
|
|
13
|
+
if (!existsSync(jsonPath)) {
|
|
14
|
+
console.error(
|
|
15
|
+
`[cdn-breakdown] Missing ${jsonPath} — run: yarn audit:cdn-bundle`,
|
|
16
|
+
)
|
|
17
|
+
process.exit(1)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const data = JSON.parse(readFileSync(jsonPath, 'utf8'))
|
|
21
|
+
const { nodeParts = {}, nodeMetas = {} } = data
|
|
22
|
+
|
|
23
|
+
const leaves = Object.entries(nodeParts)
|
|
24
|
+
.map(([uid, part]) => {
|
|
25
|
+
const meta = nodeMetas[uid] ?? {}
|
|
26
|
+
return {
|
|
27
|
+
name: meta.id ?? uid,
|
|
28
|
+
gzipSize: part.gzipSize ?? 0,
|
|
29
|
+
renderedLength: part.renderedLength ?? 0,
|
|
30
|
+
}
|
|
31
|
+
})
|
|
32
|
+
.filter((n) => n.renderedLength > 0)
|
|
33
|
+
.sort((a, b) => b.gzipSize - a.gzipSize)
|
|
34
|
+
|
|
35
|
+
const top = leaves.slice(0, 15)
|
|
36
|
+
const generatedAt = new Date().toISOString()
|
|
37
|
+
|
|
38
|
+
const lines = [
|
|
39
|
+
'# CDN app bundle breakdown',
|
|
40
|
+
'',
|
|
41
|
+
`Generated: ${generatedAt}`,
|
|
42
|
+
'',
|
|
43
|
+
'Source: `yarn audit:cdn-bundle` → `docs/audit/cdn-bundle-visualizer.json`',
|
|
44
|
+
'',
|
|
45
|
+
'Top 15 modules by gzip size (CDN app graph):',
|
|
46
|
+
'',
|
|
47
|
+
'| Rank | Module | Gzip (KiB) | Raw (KiB) |',
|
|
48
|
+
'|------|--------|------------|-----------|',
|
|
49
|
+
]
|
|
50
|
+
|
|
51
|
+
top.forEach((node, i) => {
|
|
52
|
+
const gzip = node.gzipSize / 1024
|
|
53
|
+
const raw = node.renderedLength / 1024
|
|
54
|
+
const name = String(node.name).replace(/\|/g, '\\|')
|
|
55
|
+
lines.push(`| ${i + 1} | \`${name}\` | ${gzip.toFixed(1)} | ${raw.toFixed(1)} |`)
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
lines.push('', 'See also: [BUNDLE-STRATEGY.md](../BUNDLE-STRATEGY.md), [artifact-sizes.json](./artifact-sizes.json).')
|
|
59
|
+
|
|
60
|
+
writeFileSync(outPath, `${lines.join('\n')}\n`)
|
|
61
|
+
console.log(`[cdn-breakdown] wrote ${outPath}`)
|
|
@@ -15,7 +15,7 @@ const cdnDir = resolve(root, 'dist/cdn')
|
|
|
15
15
|
const buildId = portalBuildId()
|
|
16
16
|
|
|
17
17
|
function fileMetrics(file) {
|
|
18
|
-
const path = resolve(cdnDir, file)
|
|
18
|
+
const path = resolve(cdnDir, file.replace(/^\//, ''))
|
|
19
19
|
const raw = readFileSync(path)
|
|
20
20
|
return {
|
|
21
21
|
file,
|
|
@@ -24,17 +24,31 @@ function fileMetrics(file) {
|
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
function scriptEntry(file) {
|
|
28
|
+
if (file.startsWith('vendor.')) {
|
|
29
|
+
return { name: 'vendor', order: 1, preload: true }
|
|
30
|
+
}
|
|
31
|
+
if (file.startsWith('app.') && !file.includes('/')) {
|
|
32
|
+
return { name: 'app', order: 2, preload: true }
|
|
33
|
+
}
|
|
34
|
+
if (file.startsWith('chunks/')) {
|
|
35
|
+
return { name: file.replace(/^chunks\//, ''), order: 99, preload: false }
|
|
36
|
+
}
|
|
37
|
+
return { name: file, order: 99, preload: false }
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const jsFiles = readdirSync(cdnDir, { recursive: true })
|
|
41
|
+
.filter((f) => String(f).endsWith('.js'))
|
|
42
|
+
.map((rel) => {
|
|
43
|
+
const file = String(rel)
|
|
30
44
|
const metrics = fileMetrics(file)
|
|
45
|
+
const entry = scriptEntry(file)
|
|
31
46
|
return {
|
|
32
47
|
...metrics,
|
|
33
|
-
|
|
34
|
-
order: file.startsWith('vendor.') ? 1 : file.startsWith('app.') ? 2 : 99,
|
|
48
|
+
...entry,
|
|
35
49
|
}
|
|
36
50
|
})
|
|
37
|
-
.sort((a, b) => a.order - b.order)
|
|
51
|
+
.sort((a, b) => a.order - b.order || a.file.localeCompare(b.file))
|
|
38
52
|
|
|
39
53
|
const cssFiles = readdirSync(cdnDir)
|
|
40
54
|
.filter((f) => f.endsWith('.css'))
|
|
@@ -64,10 +78,11 @@ const manifest = {
|
|
|
64
78
|
buildId,
|
|
65
79
|
baseUrl: resolveCdnBaseUrl(),
|
|
66
80
|
publishMode: process.env.VITE_PORTAL_CDN_PUBLISH_MODE ?? 'jsdelivr',
|
|
67
|
-
scripts: jsFiles.map(({ name, file, order, rawBytes, gzipBytes }) => ({
|
|
81
|
+
scripts: jsFiles.map(({ name, file, order, preload, rawBytes, gzipBytes }) => ({
|
|
68
82
|
name,
|
|
69
83
|
file,
|
|
70
84
|
order,
|
|
85
|
+
preload,
|
|
71
86
|
rawBytes,
|
|
72
87
|
gzipBytes,
|
|
73
88
|
url: `${resolveCdnBaseUrl()}/${file}`,
|
|
@@ -1,17 +1,91 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Vite env for HubSpot/CDN builds — .env.[mode] wins over stale shell VITE_* vars.
|
|
2
|
+
* Vite env for HubSpot/CDN builds — .env.[mode] wins over stale shell / .env.local VITE_* vars.
|
|
3
3
|
*/
|
|
4
|
+
import { existsSync, readFileSync } from 'node:fs'
|
|
5
|
+
import { resolve } from 'node:path'
|
|
4
6
|
import { loadEnv } from 'vite'
|
|
5
7
|
import { envWithPortalBuildId } from './resolve-portal-build-id.mjs'
|
|
6
8
|
import { envWithPortalCdnConfig } from './load-portal-cdn-config.mjs'
|
|
7
9
|
|
|
10
|
+
/** @param {string} content */
|
|
11
|
+
export function parseEnvFile(content) {
|
|
12
|
+
const result = {}
|
|
13
|
+
for (const line of content.split('\n')) {
|
|
14
|
+
const trimmed = line.trim()
|
|
15
|
+
if (!trimmed || trimmed.startsWith('#')) continue
|
|
16
|
+
const eq = trimmed.indexOf('=')
|
|
17
|
+
if (eq <= 0) continue
|
|
18
|
+
const key = trimmed.slice(0, eq).trim()
|
|
19
|
+
let value = trimmed.slice(eq + 1).trim()
|
|
20
|
+
if (
|
|
21
|
+
(value.startsWith('"') && value.endsWith('"')) ||
|
|
22
|
+
(value.startsWith("'") && value.endsWith("'"))
|
|
23
|
+
) {
|
|
24
|
+
value = value.slice(1, -1)
|
|
25
|
+
}
|
|
26
|
+
result[key] = value
|
|
27
|
+
}
|
|
28
|
+
return result
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** @param {'local' | 'dev' | 'stg' | 'prod'} mode @param {string} root */
|
|
32
|
+
export function readPortalTierEnvFile(mode, root) {
|
|
33
|
+
const path = resolve(root, `.env.${mode}`)
|
|
34
|
+
if (!existsSync(path)) return {}
|
|
35
|
+
return parseEnvFile(readFileSync(path, 'utf8'))
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function stashViteProcessEnv() {
|
|
39
|
+
const stashed = {}
|
|
40
|
+
for (const key of Object.keys(process.env)) {
|
|
41
|
+
if (key.startsWith('VITE_')) {
|
|
42
|
+
stashed[key] = process.env[key]
|
|
43
|
+
delete process.env[key]
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return stashed
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** @param {Record<string, string | undefined>} stashed */
|
|
50
|
+
function restoreViteProcessEnv(stashed) {
|
|
51
|
+
for (const [key, value] of Object.entries(stashed)) {
|
|
52
|
+
if (value != null) process.env[key] = value
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/** loadEnv without shell / .env.local VITE_* polluting tier resolution */
|
|
57
|
+
/** @param {'local' | 'dev' | 'stg' | 'prod'} mode @param {string} root */
|
|
58
|
+
export function loadPortalFileEnv(mode, root) {
|
|
59
|
+
const stashed = stashViteProcessEnv()
|
|
60
|
+
try {
|
|
61
|
+
return loadEnv(mode, root, '')
|
|
62
|
+
} finally {
|
|
63
|
+
restoreViteProcessEnv(stashed)
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* API URL baked into CDN bundles for a deploy tier — reads `.env.[mode]` only.
|
|
69
|
+
* @param {'local' | 'dev' | 'stg' | 'prod'} mode
|
|
70
|
+
* @param {string} root
|
|
71
|
+
*/
|
|
72
|
+
export function resolveTierApiEndpoint(mode, root) {
|
|
73
|
+
const tier = readPortalTierEnvFile(mode, root)
|
|
74
|
+
const fromTier = tier.VITE_PUBLIC_REST_API_ENDPOINT
|
|
75
|
+
if (fromTier) return fromTier.replace(/\/$/, '')
|
|
76
|
+
const fromFile = loadPortalFileEnv(mode, root).VITE_PUBLIC_REST_API_ENDPOINT
|
|
77
|
+
const fromCi =
|
|
78
|
+
process.env.WOODPORTAL_API_BASE_URL || process.env.VITE_PUBLIC_REST_API_ENDPOINT
|
|
79
|
+
return (fromFile || fromCi)?.replace(/\/$/, '')
|
|
80
|
+
}
|
|
81
|
+
|
|
8
82
|
/**
|
|
9
83
|
* @param {'local' | 'dev' | 'stg' | 'prod'} mode
|
|
10
84
|
* @param {string} root
|
|
11
85
|
* @param {NodeJS.ProcessEnv} [extra]
|
|
12
86
|
*/
|
|
13
87
|
export function envForPortalBuild(mode, root, extra = {}) {
|
|
14
|
-
const fileEnv =
|
|
88
|
+
const fileEnv = loadPortalFileEnv(mode, root)
|
|
15
89
|
const base = { ...process.env }
|
|
16
90
|
|
|
17
91
|
for (const key of Object.keys(base)) {
|
|
@@ -98,6 +98,9 @@ function authRemote(remote, token) {
|
|
|
98
98
|
function copyCdnArtifacts(sourceDir, targetDir) {
|
|
99
99
|
mkdirSync(targetDir, { recursive: true })
|
|
100
100
|
for (const entry of readdirSync(sourceDir)) {
|
|
101
|
+
if (entry.endsWith('.map')) {
|
|
102
|
+
fail(`Refusing to publish source map: ${entry}`)
|
|
103
|
+
}
|
|
101
104
|
const src = join(sourceDir, entry)
|
|
102
105
|
const dest = join(targetDir, entry)
|
|
103
106
|
rmSync(dest, { recursive: true, force: true })
|
|
@@ -152,22 +155,81 @@ async function assertGithubRepoPublic(github) {
|
|
|
152
155
|
}
|
|
153
156
|
}
|
|
154
157
|
|
|
155
|
-
async function
|
|
156
|
-
const
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
158
|
+
async function headJsDelivrFile(base, file, { required = false } = {}) {
|
|
159
|
+
const url = `${base}/${file}`
|
|
160
|
+
log(`Checking jsDelivr (may take a minute on first publish): ${url}`)
|
|
161
|
+
try {
|
|
162
|
+
const res = await fetch(url, { method: 'HEAD' })
|
|
163
|
+
if (res.ok) {
|
|
164
|
+
log(` OK ${res.status} ${file}`)
|
|
165
|
+
return true
|
|
166
|
+
}
|
|
167
|
+
const msg = `${file} → HTTP ${res.status}${required ? '' : ' (jsDelivr may still be propagating — wait 5–15 min)'}`
|
|
168
|
+
if (required) {
|
|
169
|
+
fail(msg)
|
|
170
|
+
}
|
|
171
|
+
log(` ${msg}`)
|
|
172
|
+
return false
|
|
173
|
+
} catch (err) {
|
|
174
|
+
const msg = `Could not reach jsDelivr for ${file}: ${err.message}`
|
|
175
|
+
if (required) {
|
|
176
|
+
fail(msg)
|
|
177
|
+
}
|
|
178
|
+
log(` ${msg}`)
|
|
179
|
+
return false
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
async function headJsDelivrFiles(base, files, { required = false, concurrency = 5 } = {}) {
|
|
184
|
+
if (files.length === 0) {
|
|
185
|
+
return { ok: true, failed: [] }
|
|
186
|
+
}
|
|
187
|
+
log(`Checking ${files.length} lazy chunk(s) on jsDelivr`)
|
|
188
|
+
const failed = []
|
|
189
|
+
for (let i = 0; i < files.length; i += concurrency) {
|
|
190
|
+
const batch = files.slice(i, i + concurrency)
|
|
191
|
+
const results = await Promise.all(
|
|
192
|
+
batch.map(async (file) => {
|
|
193
|
+
const ok = await headJsDelivrFile(base, file, { required: false })
|
|
194
|
+
return { file, ok }
|
|
195
|
+
}),
|
|
196
|
+
)
|
|
197
|
+
for (const result of results) {
|
|
198
|
+
if (!result.ok) {
|
|
199
|
+
failed.push(result.file)
|
|
166
200
|
}
|
|
167
|
-
} catch (err) {
|
|
168
|
-
log(` Could not reach jsDelivr for ${file}: ${err.message}`)
|
|
169
201
|
}
|
|
170
202
|
}
|
|
203
|
+
if (failed.length > 0) {
|
|
204
|
+
const msg = `jsDelivr lazy chunk(s) not reachable: ${failed.join(', ')}`
|
|
205
|
+
if (required) {
|
|
206
|
+
fail(msg)
|
|
207
|
+
}
|
|
208
|
+
log(` ${msg}`)
|
|
209
|
+
}
|
|
210
|
+
return { ok: failed.length === 0, failed }
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
async function checkJsDelivr(config, vendorFile, appFile, appCssFile, lazyChunkFiles = []) {
|
|
214
|
+
const base = jsDelivrBaseUrl(config.github, config.cdnPathInRepo, config.defaultBranch)
|
|
215
|
+
for (const file of [appCssFile, vendorFile, appFile]) {
|
|
216
|
+
await headJsDelivrFile(base, file)
|
|
217
|
+
}
|
|
218
|
+
if (lazyChunkFiles.length > 0) {
|
|
219
|
+
await headJsDelivrFiles(base, lazyChunkFiles, { required: true })
|
|
220
|
+
} else {
|
|
221
|
+
log(' No lazy chunks/ in manifest — skipping lazy chunk HEAD check')
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
function readLazyChunkFilesFromManifest(manifestPath) {
|
|
226
|
+
if (!existsSync(manifestPath)) {
|
|
227
|
+
return []
|
|
228
|
+
}
|
|
229
|
+
const manifest = JSON.parse(readFileSync(manifestPath, 'utf8'))
|
|
230
|
+
return (manifest.scripts ?? [])
|
|
231
|
+
.map((entry) => entry?.file)
|
|
232
|
+
.filter((file) => typeof file === 'string' && file.startsWith('chunks/'))
|
|
171
233
|
}
|
|
172
234
|
|
|
173
235
|
const config = loadPortalCdnConfig()
|
|
@@ -331,6 +393,9 @@ log(' yarn build:hubspot:prod # prod API')
|
|
|
331
393
|
log(' 3. yarn upload:hubspot')
|
|
332
394
|
log(' Or: yarn deploy:dev | yarn deploy:prod')
|
|
333
395
|
|
|
396
|
+
const manifestPath = join(sourceCdn, 'manifest.json')
|
|
397
|
+
const lazyChunkFiles = readLazyChunkFilesFromManifest(manifestPath)
|
|
398
|
+
|
|
334
399
|
if (!skipJsDelivrCheck) {
|
|
335
|
-
await checkJsDelivr(config, vendorFile, appFile, appCssFile)
|
|
400
|
+
await checkJsDelivr(config, vendorFile, appFile, appCssFile, lazyChunkFiles)
|
|
336
401
|
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Refresh docs/audit/artifact-sizes.json from dist/cdn + HubSpot module output.
|
|
4
|
+
*/
|
|
5
|
+
import { existsSync, readFileSync, readdirSync, statSync, writeFileSync } from 'node:fs'
|
|
6
|
+
import { resolve, join } from 'node:path'
|
|
7
|
+
import { gzipSync } from 'node:zlib'
|
|
8
|
+
import { findProjectRoot } from './project-root.mjs'
|
|
9
|
+
import { moduleOutDir, readWoodsportalConfig } from './read-woodsportal-config.mjs'
|
|
10
|
+
|
|
11
|
+
const root = findProjectRoot()
|
|
12
|
+
const { config } = readWoodsportalConfig(root)
|
|
13
|
+
|
|
14
|
+
function metrics(path) {
|
|
15
|
+
const raw = readFileSync(path)
|
|
16
|
+
const gzip = gzipSync(raw)
|
|
17
|
+
return {
|
|
18
|
+
rawBytes: raw.length,
|
|
19
|
+
gzipBytes: gzip.length,
|
|
20
|
+
rawMiB: Number((raw.length / (1024 * 1024)).toFixed(3)),
|
|
21
|
+
gzipKiB: Number((gzip.length / 1024).toFixed(1)),
|
|
22
|
+
overValidationLimit: raw.length > 1.5 * 1024 * 1024,
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function walkJs(dir, prefix = '') {
|
|
27
|
+
const out = []
|
|
28
|
+
for (const entry of readdirSync(dir, { withFileTypes: true })) {
|
|
29
|
+
const rel = prefix ? `${prefix}/${entry.name}` : entry.name
|
|
30
|
+
const full = join(dir, entry.name)
|
|
31
|
+
if (entry.isDirectory()) {
|
|
32
|
+
out.push(...walkJs(full, rel))
|
|
33
|
+
} else if (entry.name.endsWith('.js')) {
|
|
34
|
+
out.push(rel)
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return out
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const moduleDir = moduleOutDir(root)
|
|
41
|
+
const cdnDir = resolve(root, 'dist/cdn')
|
|
42
|
+
const artifacts = {}
|
|
43
|
+
|
|
44
|
+
for (const name of ['module.js', 'module.css', 'module.html', 'fields.json']) {
|
|
45
|
+
const p = resolve(moduleDir, name)
|
|
46
|
+
if (existsSync(p)) {
|
|
47
|
+
artifacts[name] = metrics(p)
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const cdn = {}
|
|
52
|
+
if (existsSync(cdnDir)) {
|
|
53
|
+
let manifest = null
|
|
54
|
+
const manifestPath = resolve(cdnDir, 'manifest.json')
|
|
55
|
+
if (existsSync(manifestPath)) {
|
|
56
|
+
manifest = JSON.parse(readFileSync(manifestPath, 'utf8'))
|
|
57
|
+
cdn['manifest.json'] = { generatedAt: manifest.generatedAt, buildId: manifest.buildId }
|
|
58
|
+
}
|
|
59
|
+
for (const file of walkJs(cdnDir)) {
|
|
60
|
+
cdn[file] = metrics(resolve(cdnDir, file))
|
|
61
|
+
}
|
|
62
|
+
for (const file of readdirSync(cdnDir).filter((f) => f.endsWith('.css'))) {
|
|
63
|
+
cdn[file] = metrics(resolve(cdnDir, file))
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const doc = {
|
|
68
|
+
generatedAt: new Date().toISOString(),
|
|
69
|
+
embedMode: 'cdn',
|
|
70
|
+
hubspotLimits: { validationMiB: 1.5, bufferMiB: 2 },
|
|
71
|
+
artifacts,
|
|
72
|
+
cdn,
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const outPath = resolve(root, 'docs/audit/artifact-sizes.json')
|
|
76
|
+
writeFileSync(outPath, JSON.stringify(doc, null, 2))
|
|
77
|
+
console.log(`[artifact-sizes] wrote ${outPath}`)
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Regenerate src/routeTree.gen.ts using the consumer project's @tanstack/router-generator.
|
|
4
|
+
*/
|
|
5
|
+
import { fileURLToPath } from 'node:url'
|
|
6
|
+
import { existsSync } from 'node:fs'
|
|
7
|
+
import { resolve } from 'node:path'
|
|
8
|
+
|
|
9
|
+
import { findProjectRoot } from './project-root.mjs'
|
|
10
|
+
import { importConsumerDep } from './resolve-consumer-dep.mjs'
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @param {string} [projectRoot]
|
|
14
|
+
* @returns {Promise<{ ok: boolean; warning?: string }>}
|
|
15
|
+
*/
|
|
16
|
+
export async function regenerateRouteTree(projectRoot = findProjectRoot()) {
|
|
17
|
+
const routesDir = resolve(projectRoot, 'src/routes')
|
|
18
|
+
const generatedRouteTree = resolve(projectRoot, 'src/routeTree.gen.ts')
|
|
19
|
+
|
|
20
|
+
if (!existsSync(routesDir)) {
|
|
21
|
+
return { ok: false, warning: 'No src/routes directory — skipping route tree regeneration.' }
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
try {
|
|
25
|
+
const mod = await importConsumerDep('@tanstack/router-generator', projectRoot)
|
|
26
|
+
const Generator = mod.Generator ?? mod.default?.Generator
|
|
27
|
+
if (!Generator) {
|
|
28
|
+
throw new Error('@tanstack/router-generator does not export Generator')
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const generator = new Generator({
|
|
32
|
+
routesDirectory: routesDir,
|
|
33
|
+
generatedRouteTree,
|
|
34
|
+
target: 'react',
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
if (typeof generator.build === 'function') {
|
|
38
|
+
await generator.build()
|
|
39
|
+
} else if (typeof generator.run === 'function') {
|
|
40
|
+
await generator.run()
|
|
41
|
+
} else if (typeof generator.generate === 'function') {
|
|
42
|
+
await generator.generate()
|
|
43
|
+
} else {
|
|
44
|
+
throw new Error('Unsupported @tanstack/router-generator API')
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if (!existsSync(generatedRouteTree)) {
|
|
48
|
+
throw new Error('Generator finished but routeTree.gen.ts was not written')
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return { ok: true }
|
|
52
|
+
} catch (error) {
|
|
53
|
+
const message = error instanceof Error ? error.message : String(error)
|
|
54
|
+
return {
|
|
55
|
+
ok: false,
|
|
56
|
+
warning: `Could not regenerate routeTree.gen.ts (${message}). Restart wp dev to refresh the route tree.`,
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if (process.argv[1] && fileURLToPath(import.meta.url) === process.argv[1]) {
|
|
62
|
+
const root = process.argv[2] ?? findProjectRoot()
|
|
63
|
+
regenerateRouteTree(root).then((result) => {
|
|
64
|
+
if (result.ok) {
|
|
65
|
+
process.stdout.write('routeTree.gen.ts regenerated\n')
|
|
66
|
+
process.exit(0)
|
|
67
|
+
}
|
|
68
|
+
process.stderr.write(`${result.warning ?? 'Route tree regeneration failed'}\n`)
|
|
69
|
+
process.exit(1)
|
|
70
|
+
})
|
|
71
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Copy curated auth files from woodsportal-client-frontend into templates/scaffold/auth/.
|
|
4
|
+
* Usage: node scripts/sync-auth-scaffold-from-client.mjs [--dry-run]
|
|
5
|
+
*/
|
|
6
|
+
import { copyFileSync, existsSync, mkdirSync, readFileSync } from 'node:fs'
|
|
7
|
+
import { dirname, resolve } from 'node:path'
|
|
8
|
+
import { fileURLToPath } from 'node:url'
|
|
9
|
+
|
|
10
|
+
const __dirname = dirname(fileURLToPath(import.meta.url))
|
|
11
|
+
const kitRoot = resolve(__dirname, '..')
|
|
12
|
+
const manifestPath = resolve(kitRoot, 'templates/scaffold/auth/sync-manifest.json')
|
|
13
|
+
const dryRun = process.argv.includes('--dry-run')
|
|
14
|
+
|
|
15
|
+
const manifest = JSON.parse(readFileSync(manifestPath, 'utf8')) as {
|
|
16
|
+
clientFrontendRoot: string
|
|
17
|
+
mappings: Array<{ from: string; to: string }>
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const clientRoot = resolve(kitRoot, manifest.clientFrontendRoot)
|
|
21
|
+
|
|
22
|
+
let copied = 0
|
|
23
|
+
for (const { from, to } of manifest.mappings) {
|
|
24
|
+
const source = resolve(clientRoot, from)
|
|
25
|
+
const target = resolve(kitRoot, 'templates/scaffold/auth', to)
|
|
26
|
+
if (!existsSync(source)) {
|
|
27
|
+
console.warn(`skip missing source: ${from}`)
|
|
28
|
+
continue
|
|
29
|
+
}
|
|
30
|
+
if (dryRun) {
|
|
31
|
+
console.log(`[dry-run] ${from} -> templates/scaffold/auth/${to}`)
|
|
32
|
+
copied += 1
|
|
33
|
+
continue
|
|
34
|
+
}
|
|
35
|
+
mkdirSync(dirname(target), { recursive: true })
|
|
36
|
+
copyFileSync(source, target)
|
|
37
|
+
console.log(`copied ${to}`)
|
|
38
|
+
copied += 1
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
console.log(`${dryRun ? 'would copy' : 'copied'} ${copied} file(s)`)
|
|
@@ -13,6 +13,7 @@ import { resolve } from 'node:path'
|
|
|
13
13
|
import { findProjectRoot } from './project-root.mjs'
|
|
14
14
|
import { resolvePortalBuildId } from './resolve-portal-build-id.mjs'
|
|
15
15
|
import { resolvePortalViteMode } from './portal-env-mode.mjs'
|
|
16
|
+
import { resolveTierApiEndpoint } from './portal-vite-env.mjs'
|
|
16
17
|
|
|
17
18
|
const root = findProjectRoot()
|
|
18
19
|
|
|
@@ -29,15 +30,11 @@ if (tierFlags.length !== 1) {
|
|
|
29
30
|
}
|
|
30
31
|
|
|
31
32
|
const mode = resolvePortalViteMode()
|
|
32
|
-
const
|
|
33
|
-
const fromFile = loadEnv(mode, root, '').VITE_PUBLIC_REST_API_ENDPOINT
|
|
34
|
-
const fromEnv =
|
|
35
|
-
process.env.VITE_PUBLIC_REST_API_ENDPOINT || process.env.WOODPORTAL_API_BASE_URL
|
|
36
|
-
const expected = (fromFile || fromEnv)?.replace(/\/$/, '')
|
|
33
|
+
const expected = resolveTierApiEndpoint(mode, root)
|
|
37
34
|
|
|
38
35
|
if (!expected) {
|
|
39
36
|
console.error(
|
|
40
|
-
`[verify-cdn-api] Missing VITE_PUBLIC_REST_API_ENDPOINT in .env.${mode} (or
|
|
37
|
+
`[verify-cdn-api] Missing VITE_PUBLIC_REST_API_ENDPOINT in .env.${mode} (or WOODPORTAL_API_BASE_URL for CI)`,
|
|
41
38
|
)
|
|
42
39
|
process.exit(1)
|
|
43
40
|
}
|
|
@@ -59,13 +56,23 @@ if (!appFile) {
|
|
|
59
56
|
}
|
|
60
57
|
|
|
61
58
|
const source = readFileSync(resolve(cdnDir, appFile), 'utf8')
|
|
62
|
-
const
|
|
63
|
-
|
|
59
|
+
const bakedUrls = [
|
|
60
|
+
...source.matchAll(/https:\/\/api(?:\.dev)?\.woodsportal\.com/g),
|
|
61
|
+
...source.matchAll(/http:\/\/localhost:\d+/g),
|
|
62
|
+
].map((m) => m[0])
|
|
63
|
+
const unique = [...new Set(bakedUrls)]
|
|
64
64
|
|
|
65
|
-
if (!
|
|
65
|
+
if (!source.includes(expected)) {
|
|
66
66
|
console.error('[verify-cdn-api] API URL mismatch in dist/cdn — refusing to publish.')
|
|
67
|
-
console.error(` expected
|
|
67
|
+
console.error(` expected from .env.${mode}: ${expected}`)
|
|
68
68
|
console.error(` found in ${appFile}: ${unique.join(', ') || '(none)'}`)
|
|
69
|
+
const shellApi = process.env.VITE_PUBLIC_REST_API_ENDPOINT
|
|
70
|
+
if (shellApi && shellApi.replace(/\/$/, '') !== expected) {
|
|
71
|
+
console.error('')
|
|
72
|
+
console.error(
|
|
73
|
+
` Note: shell/.env.local has VITE_PUBLIC_REST_API_ENDPOINT=${shellApi} — ignored for deploy; CDN uses .env.${mode} only.`,
|
|
74
|
+
)
|
|
75
|
+
}
|
|
69
76
|
console.error('')
|
|
70
77
|
console.error(' Dev API on HubSpot: yarn deploy:dev')
|
|
71
78
|
console.error(' Prod API on HubSpot: yarn deploy:prod')
|
|
@@ -67,7 +67,13 @@ export async function createDevServerViteConfig(options = {}) {
|
|
|
67
67
|
...prefixPlugins,
|
|
68
68
|
],
|
|
69
69
|
resolve: {
|
|
70
|
-
dedupe: [
|
|
70
|
+
dedupe: [
|
|
71
|
+
'react',
|
|
72
|
+
'react-dom',
|
|
73
|
+
'woodsportal-client-sdk',
|
|
74
|
+
'woodsportal-client-sdk/auth',
|
|
75
|
+
'woodsportal-client-sdk/crm',
|
|
76
|
+
],
|
|
71
77
|
alias: {
|
|
72
78
|
...consumerReactAliases(projectRoot),
|
|
73
79
|
'@/dev/module-config': moduleConfigRoot,
|
|
@@ -38,7 +38,7 @@ function prodDevModuleConfigRouteStub(mode) {
|
|
|
38
38
|
if (!isPrefix(mode)) {
|
|
39
39
|
return null
|
|
40
40
|
}
|
|
41
|
-
const stub = resolve(root, 'src/
|
|
41
|
+
const stub = resolve(root, 'src/stubs/dev.module-config.cdn-route-stub.tsx')
|
|
42
42
|
return {
|
|
43
43
|
name: 'woodsportal-prod-dev-route-stub',
|
|
44
44
|
enforce: 'pre',
|
|
@@ -55,6 +55,62 @@ function prodDevModuleConfigRouteStub(mode) {
|
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
+
function prodResolveIdStub(mode, { name, matchers, stub }) {
|
|
59
|
+
if (!isPrefix(mode)) {
|
|
60
|
+
return null
|
|
61
|
+
}
|
|
62
|
+
return {
|
|
63
|
+
name,
|
|
64
|
+
enforce: 'pre',
|
|
65
|
+
resolveId(source) {
|
|
66
|
+
for (const match of matchers) {
|
|
67
|
+
if (typeof match === 'string' ? source === match || source.endsWith(match) : match.test(source)) {
|
|
68
|
+
return stub
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return null
|
|
72
|
+
},
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function prodDevHubSpotLiveStub(mode) {
|
|
77
|
+
if (!isPrefix(mode)) {
|
|
78
|
+
return null
|
|
79
|
+
}
|
|
80
|
+
const liveStub = resolve(root, 'src/integrations/dev-hubspot-live-provider.prod-stub.tsx')
|
|
81
|
+
const syncStub = resolve(root, 'src/data/dev-hubspot-sync.prod-stub.ts')
|
|
82
|
+
return {
|
|
83
|
+
name: 'woodsportal-prod-dev-hubspot-live-stub',
|
|
84
|
+
enforce: 'pre',
|
|
85
|
+
resolveId(source) {
|
|
86
|
+
if (
|
|
87
|
+
source === '@/integrations/dev-hubspot-live-provider' ||
|
|
88
|
+
/\/integrations\/dev-hubspot-live-provider(\.tsx)?$/.test(source)
|
|
89
|
+
) {
|
|
90
|
+
return liveStub
|
|
91
|
+
}
|
|
92
|
+
if (
|
|
93
|
+
source === '@/data/dev-hubspot-sync' ||
|
|
94
|
+
/\/data\/dev-hubspot-sync(\.ts)?$/.test(source)
|
|
95
|
+
) {
|
|
96
|
+
return syncStub
|
|
97
|
+
}
|
|
98
|
+
return null
|
|
99
|
+
},
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function prodSdkTerminalLogSinksStub(mode) {
|
|
104
|
+
return prodResolveIdStub(mode, {
|
|
105
|
+
name: 'woodsportal-prod-sdk-log-sinks-stub',
|
|
106
|
+
matchers: [
|
|
107
|
+
'@/integrations/sdk-terminal-log-sinks',
|
|
108
|
+
/\/integrations\/sdk-terminal-log-sinks(\.ts)?$/,
|
|
109
|
+
],
|
|
110
|
+
stub: resolve(root, 'src/integrations/sdk-terminal-log-sinks.prod-stub.ts'),
|
|
111
|
+
})
|
|
112
|
+
}
|
|
113
|
+
|
|
58
114
|
/** Ship CDN builds must not bundle localhost fixture menus from src/fixtures/demo-menu.ts */
|
|
59
115
|
function prodDefaultDataStub(mode) {
|
|
60
116
|
if (!isPrefix(mode)) {
|
|
@@ -81,6 +137,8 @@ export function portalPlugins(mode, { codeSplitting = false, routeFileIgnorePatt
|
|
|
81
137
|
const routeIgnore = routeFileIgnorePattern ?? (isPrefix(mode) ? 'dev\\.' : undefined)
|
|
82
138
|
return [
|
|
83
139
|
prodDevModuleConfigRouteStub(mode),
|
|
140
|
+
prodDevHubSpotLiveStub(mode),
|
|
141
|
+
prodSdkTerminalLogSinksStub(mode),
|
|
84
142
|
prodDefaultDataStub(mode),
|
|
85
143
|
TanStackRouterVite({
|
|
86
144
|
autoCodeSplitting: codeSplitting,
|
|
@@ -129,7 +187,9 @@ export function portalResolve(mode) {
|
|
|
129
187
|
})
|
|
130
188
|
}
|
|
131
189
|
|
|
132
|
-
|
|
190
|
+
const dedupe = ['axios', 'pako', 'js-cookie']
|
|
191
|
+
|
|
192
|
+
return { alias, dedupe }
|
|
133
193
|
}
|
|
134
194
|
|
|
135
195
|
export { root, __dirname }
|