@woodsportal/hubspot-kit 1.0.39-dev.1 → 1.0.40-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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@woodsportal/hubspot-kit",
3
- "version": "1.0.39-dev.1",
3
+ "version": "1.0.40-dev.0",
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",
@@ -1,24 +1,27 @@
1
1
  /**
2
- * Portal Vite modes — align with `.env.dev` | `.env.stg` | `.env.prod`.
2
+ * Portal Vite modes — align with `.env.local` | `.env.dev` | `.env.stg` | `.env.prod`.
3
3
  */
4
4
 
5
- /** @typedef {'dev' | 'stg' | 'prod'} PortalViteMode */
5
+ /** @typedef {'local' | 'dev' | 'stg' | 'prod'} PortalViteMode */
6
6
 
7
7
  /** @param {string[]} [argv] */
8
8
  export function resolvePortalViteMode(argv = process.argv) {
9
+ if (argv.includes('--local')) return /** @type {PortalViteMode} */ ('local')
9
10
  if (argv.includes('--stg') || argv.includes('--staging')) return /** @type {PortalViteMode} */ ('stg')
10
- if (argv.includes('--dev') || argv.includes('--development')) return /** @type {PortalViteMode} */ ('dev')
11
+ if (argv.includes('--dev')) return /** @type {PortalViteMode} */ ('dev')
12
+ if (argv.includes('--development')) return /** @type {PortalViteMode} */ ('local')
13
+ if (argv.includes('--prod') || argv.includes('--production')) return /** @type {PortalViteMode} */ ('prod')
11
14
  return /** @type {PortalViteMode} */ ('prod')
12
15
  }
13
16
 
14
17
  /** React / bundler NODE_ENV (not the same as portal tier). */
15
18
  /** @param {PortalViteMode | string} mode */
16
19
  export function nodeEnvForPortalMode(mode) {
17
- return mode === 'dev' ? 'development' : 'production'
20
+ return mode === 'local' ? 'development' : 'production'
18
21
  }
19
22
 
20
23
  /** Tailwind class prefix applies on CDN / HubSpot builds, not local dev. */
21
24
  /** @param {PortalViteMode | string} mode */
22
25
  export function isPrefixBuildMode(mode) {
23
- return mode === 'stg' || mode === 'prod' || mode === 'staging' || mode === 'production'
26
+ return mode === 'dev' || mode === 'stg' || mode === 'prod' || mode === 'staging' || mode === 'production'
24
27
  }
@@ -6,7 +6,7 @@ import { envWithPortalBuildId } from './resolve-portal-build-id.mjs'
6
6
  import { envWithPortalCdnConfig } from './load-portal-cdn-config.mjs'
7
7
 
8
8
  /**
9
- * @param {'stg' | 'prod' | 'dev'} mode
9
+ * @param {'local' | 'dev' | 'stg' | 'prod'} mode
10
10
  * @param {string} root
11
11
  * @param {NodeJS.ProcessEnv} [extra]
12
12
  */
@@ -29,7 +29,7 @@ export function envForPortalBuild(mode, root, extra = {}) {
29
29
  }
30
30
 
31
31
  /**
32
- * @param {'stg' | 'prod' | 'dev'} mode
32
+ * @param {'local' | 'dev' | 'stg' | 'prod'} mode
33
33
  */
34
34
  export function defaultDatadogFlag(mode) {
35
35
  if (process.env.VITE_DATADOG_RUM_ENABLED != null) {
@@ -16,14 +16,14 @@ process.env.WP_HS_PROJECT_ROOT = projectRoot
16
16
  const userConfig = await createDevServerViteConfig({ projectRoot, kitRoot, port })
17
17
  const resolved =
18
18
  typeof userConfig === 'function'
19
- ? await userConfig({ mode: 'dev', command: 'serve' })
19
+ ? await userConfig({ mode: 'local', command: 'serve' })
20
20
  : await userConfig
21
21
 
22
22
  const { createServer } = await importConsumerDep('vite')
23
23
  const server = await createServer({
24
24
  ...resolved,
25
25
  configFile: false,
26
- mode: 'dev',
26
+ mode: 'local',
27
27
  })
28
28
 
29
29
  await server.listen()
@@ -2,7 +2,7 @@
2
2
  /**
3
3
  * Run `vite build` with portal env — `.env.stg` / `.env.prod` take precedence over shell.
4
4
  *
5
- * Usage: node scripts/run-vite-build.mjs <vite-config.mjs> [--stg]
5
+ * Usage: node scripts/run-vite-build.mjs <vite-config.mjs> [--local | --dev | --stg | --prod]
6
6
  */
7
7
  import { spawnSync } from 'node:child_process'
8
8
 
@@ -21,7 +21,7 @@ const configArg = process.argv[2]
21
21
  const mode = resolvePortalViteMode()
22
22
 
23
23
  if (!configArg) {
24
- console.error('Usage: node scripts/run-vite-build.mjs <vite-config.mjs> [--stg]')
24
+ console.error('Usage: node scripts/run-vite-build.mjs <vite-config.mjs> [--local | --dev | --stg | --prod]')
25
25
  process.exit(1)
26
26
  }
27
27
 
@@ -1,33 +1,35 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
- * Fail if dist/cdn/app.*.js does not bake the API URL from .env.stg / .env.prod.
3
+ * Fail if dist/cdn/app.*.js does not bake the API URL from .env.dev / .env.stg / .env.prod.
4
4
  *
5
5
  * Usage:
6
+ * node scripts/verify-cdn-api-endpoint.mjs --dev
6
7
  * node scripts/verify-cdn-api-endpoint.mjs --stg
7
8
  * node scripts/verify-cdn-api-endpoint.mjs --prod
8
9
  */
9
10
  import { existsSync, readFileSync, readdirSync } from 'node:fs'
10
- import { dirname, resolve } from 'node:path'
11
- import { fileURLToPath } from 'node:url'
12
- import { findProjectRoot } from './project-root.mjs'
13
- import { loadEnv } from 'vite'
11
+ import { resolve } from 'node:path'
14
12
 
13
+ import { findProjectRoot } from './project-root.mjs'
15
14
  import { resolvePortalBuildId } from './resolve-portal-build-id.mjs'
16
15
  import { resolvePortalViteMode } from './portal-env-mode.mjs'
17
16
 
18
17
  const root = findProjectRoot()
19
18
 
19
+ const dev = process.argv.includes('--dev')
20
20
  const stg = process.argv.includes('--stg') || process.argv.includes('--staging')
21
21
  const prod = process.argv.includes('--prod') || process.argv.includes('--production')
22
+ const tierFlags = [dev, stg, prod].filter(Boolean)
22
23
 
23
- if (stg === prod) {
24
+ if (tierFlags.length !== 1) {
24
25
  console.error(
25
- 'Usage: node scripts/verify-cdn-api-endpoint.mjs --stg | --prod',
26
+ 'Usage: node scripts/verify-cdn-api-endpoint.mjs --dev | --stg | --prod',
26
27
  )
27
28
  process.exit(1)
28
29
  }
29
30
 
30
31
  const mode = resolvePortalViteMode()
32
+ const { loadEnv } = await import('vite')
31
33
  const fromFile = loadEnv(mode, root, '').VITE_PUBLIC_REST_API_ENDPOINT
32
34
  const fromEnv =
33
35
  process.env.VITE_PUBLIC_REST_API_ENDPOINT || process.env.WOODPORTAL_API_BASE_URL
@@ -51,7 +53,7 @@ const appFile = readdirSync(cdnDir).find((f) => f === `app.${buildId}.js`)
51
53
 
52
54
  if (!appFile) {
53
55
  console.error(
54
- `[verify-cdn-api] app.${buildId}.js not found in dist/cdn — rebuild with matching .portal-build-id`,
56
+ `[verify-cdn-api] app.${buildId}.js not found in dist/cdn — rebuild with matching .module-build-id`,
55
57
  )
56
58
  process.exit(1)
57
59
  }
@@ -60,7 +60,7 @@ export async function createDevServerViteConfig(options = {}) {
60
60
  plugins: [
61
61
  bootstrapShimResolver({ bootstrapShim, bootstrapGreenfieldShim, kitRoot }),
62
62
  resolveFromProjectRoot(projectRoot, kitRoot),
63
- ...(command === 'serve' && mode === 'dev'
63
+ ...(command === 'serve' && mode === 'local'
64
64
  ? [sdkLogBridge(), moduleConfigStore(projectRoot)]
65
65
  : []),
66
66
  ...(hasTanStackRoutes ? [TanStackRouterVite({ autoCodeSplitting: false })] : []),
@@ -100,7 +100,7 @@ export async function createDevServerViteConfig(options = {}) {
100
100
  'import.meta.env.VITE_WPHS_MODULE_NAME': JSON.stringify(
101
101
  config?.module?.name ?? config?.theme?.name ?? 'module',
102
102
  ),
103
- 'process.env.NODE_ENV': JSON.stringify(mode === 'dev' ? 'development' : 'production'),
103
+ 'process.env.NODE_ENV': JSON.stringify(mode === 'local' ? 'development' : 'production'),
104
104
  'process.env': {},
105
105
  process: JSON.stringify({ env: {} }),
106
106
  },
@@ -44,6 +44,7 @@ function parseTier(args) {
44
44
  }
45
45
  if (args.includes('--prod')) return 'prod'
46
46
  if (args.includes('--stg')) return 'stg'
47
+ if (args.includes('--dev')) return 'dev'
47
48
  return 'dev'
48
49
  }
49
50
 
@@ -1,5 +1,3 @@
1
- # Local dev — copy to .env.dev (or run wp setup)
2
- VITE_DEV_MODE=live
1
+ # Deployed dev CDN build (deploy:dev, ci:release-module:dev) — copy to .env.dev
2
+ VITE_NODE_ENV=dev
3
3
  VITE_PUBLIC_REST_API_ENDPOINT=https://api.dev.woodsportal.com
4
- # VITE_DEV_PORTAL_ID=1
5
- # VITE_DEV_HUB_ID=12345678
@@ -0,0 +1,6 @@
1
+ # Localhost SPA (yarn local / wp local) — copy to .env.local
2
+ VITE_NODE_ENV=local
3
+ VITE_DEV_MODE=live
4
+ VITE_PUBLIC_REST_API_ENDPOINT=https://api.dev.woodsportal.com
5
+ # VITE_DEV_PORTAL_ID=1
6
+ # VITE_LOCAL_HUB_ID=12345678
@@ -1,3 +1,3 @@
1
- # Staging CDN build copy to .env.stg (or run wp setup)
1
+ # Reserved — future staging CDN (wp build --tier stg). Copy to .env.stg when a staging API exists.
2
2
  VITE_NODE_ENV=stg
3
- VITE_PUBLIC_REST_API_ENDPOINT=https://api.dev.woodsportal.com
3
+ # VITE_PUBLIC_REST_API_ENDPOINT=https://api.stg.woodsportal.com