@woodsportal/hubspot-kit 1.0.40-dev.0 → 1.0.41-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.
|
|
3
|
+
"version": "1.0.41-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",
|
|
@@ -14,6 +14,13 @@ export function resolvePortalViteMode(argv = process.argv) {
|
|
|
14
14
|
return /** @type {PortalViteMode} */ ('prod')
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
+
/**
|
|
18
|
+
* Vite dev-server mode for `wp local` / `yarn local`.
|
|
19
|
+
* Must not be `local` — Vite rejects that name (conflicts with the `.env.local` postfix).
|
|
20
|
+
* Portal tier stays `local` via `VITE_NODE_ENV` in `.env.local`.
|
|
21
|
+
*/
|
|
22
|
+
export const LOCAL_DEV_VITE_MODE = 'development'
|
|
23
|
+
|
|
17
24
|
/** React / bundler NODE_ENV (not the same as portal tier). */
|
|
18
25
|
/** @param {PortalViteMode | string} mode */
|
|
19
26
|
export function nodeEnvForPortalMode(mode) {
|
package/scripts/run-dev.mjs
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* vite.config.* loading on some Node versions and keeps one config source.
|
|
5
5
|
*/
|
|
6
6
|
import { findProjectRoot, getKitRoot } from './project-root.mjs'
|
|
7
|
+
import { LOCAL_DEV_VITE_MODE } from './portal-env-mode.mjs'
|
|
7
8
|
import { importConsumerDep } from './resolve-consumer-dep.mjs'
|
|
8
9
|
import { createDevServerViteConfig } from './vite/create-dev-server-config.mjs'
|
|
9
10
|
|
|
@@ -16,14 +17,14 @@ process.env.WP_HS_PROJECT_ROOT = projectRoot
|
|
|
16
17
|
const userConfig = await createDevServerViteConfig({ projectRoot, kitRoot, port })
|
|
17
18
|
const resolved =
|
|
18
19
|
typeof userConfig === 'function'
|
|
19
|
-
? await userConfig({ mode:
|
|
20
|
+
? await userConfig({ mode: LOCAL_DEV_VITE_MODE, command: 'serve' })
|
|
20
21
|
: await userConfig
|
|
21
22
|
|
|
22
23
|
const { createServer } = await importConsumerDep('vite')
|
|
23
24
|
const server = await createServer({
|
|
24
25
|
...resolved,
|
|
25
26
|
configFile: false,
|
|
26
|
-
mode:
|
|
27
|
+
mode: LOCAL_DEV_VITE_MODE,
|
|
27
28
|
})
|
|
28
29
|
|
|
29
30
|
await server.listen()
|
|
@@ -60,9 +60,7 @@ export async function createDevServerViteConfig(options = {}) {
|
|
|
60
60
|
plugins: [
|
|
61
61
|
bootstrapShimResolver({ bootstrapShim, bootstrapGreenfieldShim, kitRoot }),
|
|
62
62
|
resolveFromProjectRoot(projectRoot, kitRoot),
|
|
63
|
-
...(command === 'serve'
|
|
64
|
-
? [sdkLogBridge(), moduleConfigStore(projectRoot)]
|
|
65
|
-
: []),
|
|
63
|
+
...(command === 'serve' ? [sdkLogBridge(), moduleConfigStore(projectRoot)] : []),
|
|
66
64
|
...(hasTanStackRoutes ? [TanStackRouterVite({ autoCodeSplitting: false })] : []),
|
|
67
65
|
viteReact(createDevReactPluginOptions()),
|
|
68
66
|
tailwindcss(),
|
|
@@ -100,7 +98,7 @@ export async function createDevServerViteConfig(options = {}) {
|
|
|
100
98
|
'import.meta.env.VITE_WPHS_MODULE_NAME': JSON.stringify(
|
|
101
99
|
config?.module?.name ?? config?.theme?.name ?? 'module',
|
|
102
100
|
),
|
|
103
|
-
'process.env.NODE_ENV': JSON.stringify(
|
|
101
|
+
'process.env.NODE_ENV': JSON.stringify(command === 'serve' ? 'development' : 'production'),
|
|
104
102
|
'process.env': {},
|
|
105
103
|
process: JSON.stringify({ env: {} }),
|
|
106
104
|
},
|
|
@@ -55,10 +55,33 @@ function prodDevModuleConfigRouteStub(mode) {
|
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
+
/** Ship CDN builds must not bundle localhost fixture menus from src/fixtures/demo-menu.ts */
|
|
59
|
+
function prodDefaultDataStub(mode) {
|
|
60
|
+
if (!isPrefix(mode)) {
|
|
61
|
+
return null
|
|
62
|
+
}
|
|
63
|
+
const stub = resolve(root, 'src/fixtures/ship-default-data-stub.ts')
|
|
64
|
+
return {
|
|
65
|
+
name: 'woodsportal-ship-default-data-stub',
|
|
66
|
+
enforce: 'pre',
|
|
67
|
+
resolveId(source) {
|
|
68
|
+
if (
|
|
69
|
+
source === '@/defaultData' ||
|
|
70
|
+
source.endsWith('/defaultData') ||
|
|
71
|
+
source.endsWith('/defaultData.ts')
|
|
72
|
+
) {
|
|
73
|
+
return stub
|
|
74
|
+
}
|
|
75
|
+
return null
|
|
76
|
+
},
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
58
80
|
export function portalPlugins(mode, { codeSplitting = false, routeFileIgnorePattern } = {}) {
|
|
59
81
|
const routeIgnore = routeFileIgnorePattern ?? (isPrefix(mode) ? 'dev\\.' : undefined)
|
|
60
82
|
return [
|
|
61
83
|
prodDevModuleConfigRouteStub(mode),
|
|
84
|
+
prodDefaultDataStub(mode),
|
|
62
85
|
TanStackRouterVite({
|
|
63
86
|
autoCodeSplitting: codeSplitting,
|
|
64
87
|
...(routeIgnore ? { routeFileIgnorePattern: routeIgnore } : {}),
|