@hubspot/cms-dev-server 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/createDevServer.js +1 -1
- package/dist/index.js +20 -5
- package/dist/run.js +1955 -5
- package/dist/storybook/index.js +7 -3
- package/package.json +12 -9
- package/types/createViteDevServer.d.ts +1 -1
package/dist/createDevServer.js
CHANGED
|
@@ -125,7 +125,7 @@ HubSpot CMS dev server hosting: ${expressServer.locals.projectName}/${expressSer
|
|
|
125
125
|
if (storybook) {
|
|
126
126
|
const packageRoot = path.dirname(url.fileURLToPath(import.meta.url));
|
|
127
127
|
const configPath = path.resolve(packageRoot, './storybook');
|
|
128
|
-
const storybookProcess = spawn('
|
|
128
|
+
const storybookProcess = spawn('npx', [
|
|
129
129
|
'sb',
|
|
130
130
|
'dev',
|
|
131
131
|
'-p',
|
package/dist/index.js
CHANGED
|
@@ -52,13 +52,24 @@ function resolveIslandPlugin() {
|
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
// src/createViteDevServer.ts
|
|
55
|
-
|
|
56
|
-
async function createViteDevServer(webRoot) {
|
|
55
|
+
import mkcert from "vite-plugin-mkcert";
|
|
56
|
+
async function createViteDevServer(webRoot, port, sslEnabled, domainsToProxy = []) {
|
|
57
|
+
const additionalMkcertHosts = domainsToProxy.map((proxyDomain) => [
|
|
58
|
+
`${proxyDomain}.localhost`,
|
|
59
|
+
`${proxyDomain}.hslocal.net`
|
|
60
|
+
]).flat();
|
|
61
|
+
additionalMkcertHosts.push("*.hslocal.net", "hslocal.net");
|
|
62
|
+
const origin = sslEnabled ? `https://hslocal.net:${port}` : `http://hslocal.net:${port}`;
|
|
57
63
|
const viteConfig = {
|
|
58
64
|
appType: "custom",
|
|
59
65
|
server: {
|
|
60
66
|
middlewareMode: true,
|
|
61
|
-
|
|
67
|
+
host: "hslocal.net",
|
|
68
|
+
origin,
|
|
69
|
+
https: sslEnabled,
|
|
70
|
+
hmr: {
|
|
71
|
+
protocol: sslEnabled ? "wss" : void 0
|
|
72
|
+
}
|
|
62
73
|
},
|
|
63
74
|
ssr: {
|
|
64
75
|
// TODO: might need more entries here to get things to resolve through
|
|
@@ -71,10 +82,14 @@ async function createViteDevServer(webRoot) {
|
|
|
71
82
|
optimizeDeps: {
|
|
72
83
|
include: ["react", "react-dom", "react-dom/client"]
|
|
73
84
|
},
|
|
85
|
+
plugins: [
|
|
86
|
+
sslEnabled ? mkcert({ hosts: additionalMkcertHosts }) : null,
|
|
87
|
+
react(),
|
|
88
|
+
resolveIslandPlugin()
|
|
89
|
+
],
|
|
74
90
|
css: {
|
|
75
91
|
postcss: webRoot
|
|
76
|
-
}
|
|
77
|
-
plugins: [react(), resolveIslandPlugin()]
|
|
92
|
+
}
|
|
78
93
|
};
|
|
79
94
|
return createViteServer(viteConfig);
|
|
80
95
|
}
|