@hubspot/cms-dev-server 0.18.23 → 0.18.25
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/app/assets/LexendDeca-Bold-B8uERmr8.woff2 +0 -0
- package/dist/app/assets/LexendDeca-Light-BtcvwT5C.woff2 +0 -0
- package/dist/app/assets/LexendDeca-Medium-CxVPR2j6.woff2 +0 -0
- package/dist/app/assets/LexendDeca-SemiBold-BhzS3XUP.woff2 +0 -0
- package/dist/app/assets/index-BAtasOic.css +1 -0
- package/dist/app/assets/index-BC6R47Vo.js +154 -0
- package/dist/app/index.html +15 -0
- package/dist/app/server/assets/RenderTreeSeparately-T6CL43QJ-D50VfKo0.js +111 -0
- package/dist/app/server/serverEntry.js +3417 -0
- package/dist/index.js +78 -57
- package/dist/run.js +78 -57
- package/package.json +3 -3
- package/types/lib/renderModuleJson.d.ts +4 -0
- package/types/routes/meta.d.ts +0 -2
package/dist/index.js
CHANGED
|
@@ -596,8 +596,8 @@ function convertEntryPointIslandPathsToRelative(config, entryPointsCmsModuleMap)
|
|
|
596
596
|
);
|
|
597
597
|
return Object.fromEntries(relativeEntries);
|
|
598
598
|
}
|
|
599
|
-
function toRelativePath(config,
|
|
600
|
-
return
|
|
599
|
+
function toRelativePath(config, path16) {
|
|
600
|
+
return path16.replace(`${config.root}/`, "");
|
|
601
601
|
}
|
|
602
602
|
function shouldAnalyzeModule(config, moduleInfo, code) {
|
|
603
603
|
const [fileId, __] = moduleInfo.id.split("?");
|
|
@@ -640,11 +640,11 @@ function analyzeSourceCodeUsages(ctx, moduleInfo, config, code) {
|
|
|
640
640
|
let moduleComponentLocalImportName = CMS_MODULE_COMPONENT_NAME;
|
|
641
641
|
let dndAreaComponentLocalImportName = DND_AREA_COMPONENT_NAME;
|
|
642
642
|
traverse(sourceAst, {
|
|
643
|
-
ImportDeclaration(
|
|
644
|
-
if (t.isStringLiteral(
|
|
643
|
+
ImportDeclaration(path16) {
|
|
644
|
+
if (t.isStringLiteral(path16.node.source, {
|
|
645
645
|
value: "@hubspot/cms-components"
|
|
646
646
|
})) {
|
|
647
|
-
for (const specifier of
|
|
647
|
+
for (const specifier of path16.node.specifiers) {
|
|
648
648
|
if (t.isImportSpecifier(specifier) && t.isIdentifier(specifier.imported, {
|
|
649
649
|
name: CMS_MODULE_COMPONENT_NAME
|
|
650
650
|
})) {
|
|
@@ -658,14 +658,14 @@ function analyzeSourceCodeUsages(ctx, moduleInfo, config, code) {
|
|
|
658
658
|
}
|
|
659
659
|
}
|
|
660
660
|
},
|
|
661
|
-
JSXOpeningElement(
|
|
662
|
-
if (t.isJSXIdentifier(
|
|
661
|
+
JSXOpeningElement(path16) {
|
|
662
|
+
if (t.isJSXIdentifier(path16.node.name, {
|
|
663
663
|
name: moduleComponentLocalImportName
|
|
664
664
|
})) {
|
|
665
665
|
let cmsModuleName;
|
|
666
666
|
let cmsModulePath;
|
|
667
667
|
let cmsModuleLabel;
|
|
668
|
-
for (const prop of
|
|
668
|
+
for (const prop of path16.node.attributes) {
|
|
669
669
|
if (t.isJSXAttribute(prop) && t.isJSXIdentifier(prop.name, { name: "name" }) && t.isStringLiteral(prop.value)) {
|
|
670
670
|
cmsModuleName = prop.value.value;
|
|
671
671
|
continue;
|
|
@@ -700,11 +700,11 @@ function analyzeSourceCodeUsages(ctx, moduleInfo, config, code) {
|
|
|
700
700
|
}
|
|
701
701
|
contentDescriptors.modules[cmsModuleProps.name] = cmsModuleProps;
|
|
702
702
|
}
|
|
703
|
-
if (t.isJSXIdentifier(
|
|
703
|
+
if (t.isJSXIdentifier(path16.node.name, {
|
|
704
704
|
name: dndAreaComponentLocalImportName
|
|
705
705
|
})) {
|
|
706
706
|
let dndAreaName;
|
|
707
|
-
for (const prop of
|
|
707
|
+
for (const prop of path16.node.attributes) {
|
|
708
708
|
if (t.isJSXAttribute(prop) && t.isJSXIdentifier(prop.name, { name: "name" }) && t.isStringLiteral(prop.value)) {
|
|
709
709
|
dndAreaName = prop.value.value;
|
|
710
710
|
continue;
|
|
@@ -1035,7 +1035,7 @@ Custom origin: ${process.env.VITE_ORIGIN}
|
|
|
1035
1035
|
var createViteDevServer_default = createViteDevServer;
|
|
1036
1036
|
|
|
1037
1037
|
// src/createDevServer.ts
|
|
1038
|
-
import
|
|
1038
|
+
import path15 from "path";
|
|
1039
1039
|
import url2 from "url";
|
|
1040
1040
|
import express2 from "express";
|
|
1041
1041
|
import http3 from "http";
|
|
@@ -1045,7 +1045,11 @@ import { normalizePath as normalizePath9 } from "vite";
|
|
|
1045
1045
|
import { Transform } from "stream";
|
|
1046
1046
|
|
|
1047
1047
|
// src/routes/createDevServerRoutes.ts
|
|
1048
|
-
import {
|
|
1048
|
+
import {
|
|
1049
|
+
Router as Router2,
|
|
1050
|
+
urlencoded,
|
|
1051
|
+
static as expressStatic
|
|
1052
|
+
} from "express";
|
|
1049
1053
|
import { createProxyMiddleware } from "http-proxy-middleware";
|
|
1050
1054
|
|
|
1051
1055
|
// src/routes/partial.ts
|
|
@@ -1461,7 +1465,7 @@ function trackUsage(action) {
|
|
|
1461
1465
|
eventName: EVENT_NAME,
|
|
1462
1466
|
action,
|
|
1463
1467
|
nodeVersion: getNodeVersionData(),
|
|
1464
|
-
version: "0.18.
|
|
1468
|
+
version: "0.18.25",
|
|
1465
1469
|
os: getPlatform()
|
|
1466
1470
|
};
|
|
1467
1471
|
const url3 = isAuthedWithPersonalAccessKey ? DEV_SERVER_USAGE_ENDPOINT_AUTHENTICATED : DEV_SERVER_USAGE_ENDPOINT;
|
|
@@ -1534,12 +1538,12 @@ var findLocalRenderPlaceholders = (body) => {
|
|
|
1534
1538
|
);
|
|
1535
1539
|
offsetSoFar = nearestNewlineOrQuoteAfterBlockOpen;
|
|
1536
1540
|
if (pathEndOffset >= 0 && pathEndOffset < nextNewlineOffset) {
|
|
1537
|
-
const
|
|
1541
|
+
const path16 = body.substring(
|
|
1538
1542
|
startOffset + localJsRenderStartString.length,
|
|
1539
1543
|
pathEndOffset
|
|
1540
1544
|
);
|
|
1541
1545
|
offsetSoFar = pathEndOffset + 1;
|
|
1542
|
-
if (startOffset >= 0 &&
|
|
1546
|
+
if (startOffset >= 0 && path16) {
|
|
1543
1547
|
const nextCommentEndOffset = body.indexOf("-->", pathEndOffset);
|
|
1544
1548
|
const endOffset = body.indexOf(localJsRenderEndString, pathEndOffset);
|
|
1545
1549
|
offsetSoFar = Math.min(nextCommentEndOffset, endOffset);
|
|
@@ -1564,7 +1568,7 @@ var findLocalRenderPlaceholders = (body) => {
|
|
|
1564
1568
|
result.push({
|
|
1565
1569
|
startOffset,
|
|
1566
1570
|
endOffset: endOffset + localJsRenderEndString.length,
|
|
1567
|
-
path:
|
|
1571
|
+
path: path16,
|
|
1568
1572
|
json
|
|
1569
1573
|
});
|
|
1570
1574
|
}
|
|
@@ -1943,9 +1947,9 @@ var customColors = [
|
|
|
1943
1947
|
];
|
|
1944
1948
|
var Converter = new AnsiToHtmlConverter({ colors: customColors });
|
|
1945
1949
|
var darkErrorStyles = `background-color: #222; color: #ccc; padding: 0.5em; font-family: ui-monospace, Menlo, Monaco, 'Cascadia Mono', 'Segoe UI Mono', 'Roboto Mono', 'Oxygen Mono', 'Ubuntu Monospace', 'Source Code Pro', 'Fira Mono', 'Droid Sans Mono', 'Courier New', monospace;`;
|
|
1946
|
-
var renderLocalError_default = (
|
|
1950
|
+
var renderLocalError_default = (path16, error) => {
|
|
1947
1951
|
const stackWithColorClasses = Converter.toHtml(error.stack);
|
|
1948
|
-
return `<div data-js-rendered="error" style="${darkErrorStyles}">Error rendering ${
|
|
1952
|
+
return `<div data-js-rendered="error" style="${darkErrorStyles}">Error rendering ${path16}<br/><br/><code><pre>${stackWithColorClasses}</pre></code></div>`;
|
|
1949
1953
|
};
|
|
1950
1954
|
|
|
1951
1955
|
// src/proxyPage/fetchPreviewInfo.ts
|
|
@@ -3505,18 +3509,18 @@ async function fetchPreviewTemplates(accountId, previewToken) {
|
|
|
3505
3509
|
url: `${DESIGN_MANAGER_API_PATH}/templates/local-preview?previewToken=${previewToken}`
|
|
3506
3510
|
})).data;
|
|
3507
3511
|
}
|
|
3508
|
-
async function fetchModuleByPath(accountId,
|
|
3512
|
+
async function fetchModuleByPath(accountId, path16) {
|
|
3509
3513
|
return (await hsCliHttp8.get(accountId, {
|
|
3510
|
-
url: `${DESIGN_MANAGER_API_PATH}/modules/by-path/${
|
|
3514
|
+
url: `${DESIGN_MANAGER_API_PATH}/modules/by-path/${path16}?portalId=${accountId}`
|
|
3511
3515
|
})).data;
|
|
3512
3516
|
}
|
|
3513
|
-
async function fetchTemplateByPath(accountId,
|
|
3517
|
+
async function fetchTemplateByPath(accountId, path16) {
|
|
3514
3518
|
return (await hsCliHttp8.get(accountId, {
|
|
3515
|
-
url: `${DESIGN_MANAGER_API_PATH}/templates/by-path/${
|
|
3519
|
+
url: `${DESIGN_MANAGER_API_PATH}/templates/by-path/${path16}?portalId=${accountId}`
|
|
3516
3520
|
})).data;
|
|
3517
3521
|
}
|
|
3518
|
-
async function fetchModulePageDependencies(accountId,
|
|
3519
|
-
const url3 = `${DESIGN_MANAGER_API_PATH}/modules/list-pages?modulePath=${
|
|
3522
|
+
async function fetchModulePageDependencies(accountId, path16) {
|
|
3523
|
+
const url3 = `${DESIGN_MANAGER_API_PATH}/modules/list-pages?modulePath=${path16}`;
|
|
3520
3524
|
return (await hsCliHttp8.get(accountId, { url: url3 })).data;
|
|
3521
3525
|
}
|
|
3522
3526
|
|
|
@@ -4107,14 +4111,14 @@ function getOpenCommand() {
|
|
|
4107
4111
|
}
|
|
4108
4112
|
}
|
|
4109
4113
|
async function handleGetModulePages(req, res, next) {
|
|
4110
|
-
const { path:
|
|
4111
|
-
if (!
|
|
4114
|
+
const { path: path16, portalId } = req.query;
|
|
4115
|
+
if (!path16 || !portalId) {
|
|
4112
4116
|
return res.status(400).json({ error: "Missing required parameters" });
|
|
4113
4117
|
}
|
|
4114
4118
|
try {
|
|
4115
4119
|
const data = await fetchModulePageDependencies(
|
|
4116
4120
|
Number(portalId),
|
|
4117
|
-
|
|
4121
|
+
path16
|
|
4118
4122
|
);
|
|
4119
4123
|
res.json(data);
|
|
4120
4124
|
} catch (err) {
|
|
@@ -4122,13 +4126,13 @@ async function handleGetModulePages(req, res, next) {
|
|
|
4122
4126
|
}
|
|
4123
4127
|
}
|
|
4124
4128
|
function handleOpenFile(req, res, next) {
|
|
4125
|
-
const { path:
|
|
4126
|
-
if (!
|
|
4129
|
+
const { path: path16 } = req.query;
|
|
4130
|
+
if (!path16) {
|
|
4127
4131
|
return res.status(400).json({ error: "Missing required parameters" });
|
|
4128
4132
|
}
|
|
4129
4133
|
try {
|
|
4130
4134
|
const command = getOpenCommand();
|
|
4131
|
-
spawn(command, [
|
|
4135
|
+
spawn(command, [path16], { detached: true }).unref();
|
|
4132
4136
|
res.sendStatus(200);
|
|
4133
4137
|
} catch (err) {
|
|
4134
4138
|
next(err);
|
|
@@ -4143,12 +4147,17 @@ function createAppServerRoutes() {
|
|
|
4143
4147
|
var createAppServerRoutes_default = createAppServerRoutes;
|
|
4144
4148
|
|
|
4145
4149
|
// src/routes/createDevServerRoutes.ts
|
|
4150
|
+
import path12 from "path";
|
|
4151
|
+
import { fileURLToPath } from "url";
|
|
4152
|
+
var __filename = fileURLToPath(import.meta.url);
|
|
4153
|
+
var __dirname = path12.dirname(__filename);
|
|
4154
|
+
var isProd = true;
|
|
4146
4155
|
var STORYBOOK_DOMAINS = VALID_PROXY_DOMAIN_SUFFIXES.map(
|
|
4147
4156
|
(domain) => `storybook.${domain}`
|
|
4148
4157
|
);
|
|
4149
4158
|
var createDevServerRoutes = async (viteServer, storybookPort, appServerConfig) => {
|
|
4150
4159
|
const devServerApp = Router2();
|
|
4151
|
-
const { appServer, reqLocals
|
|
4160
|
+
const { appServer, reqLocals } = appServerConfig || {};
|
|
4152
4161
|
devServerApp.use((request2, response, next) => {
|
|
4153
4162
|
const { method, url: url3, hostname } = request2;
|
|
4154
4163
|
debug(`${method}:${hostname}${url3}`);
|
|
@@ -4167,24 +4176,36 @@ var createDevServerRoutes = async (viteServer, storybookPort, appServerConfig) =
|
|
|
4167
4176
|
}
|
|
4168
4177
|
devServerApp.use(urlencoded());
|
|
4169
4178
|
if (appServer) {
|
|
4170
|
-
|
|
4179
|
+
const appWebRoot = isProd ? path12.join(__dirname, "app") : appServerConfig == null ? void 0 : appServerConfig.appWebRoot;
|
|
4180
|
+
if (isProd) {
|
|
4181
|
+
const distAssetsPath = path12.join(appWebRoot, "assets");
|
|
4182
|
+
devServerApp.use("/assets", expressStatic(distAssetsPath));
|
|
4183
|
+
} else {
|
|
4184
|
+
devServerApp.use(appServer.middlewares);
|
|
4185
|
+
}
|
|
4171
4186
|
devServerApp.use(viteServer.middlewares);
|
|
4172
4187
|
devServerApp.use("/api", createAppServerRoutes_default());
|
|
4173
4188
|
devServerApp.get("/", async (req, res) => {
|
|
4174
4189
|
try {
|
|
4175
4190
|
const initialProps = await getDevServerUIData_default(reqLocals, viteServer);
|
|
4176
4191
|
const url3 = req.originalUrl.replace("/", "");
|
|
4177
|
-
|
|
4178
|
-
|
|
4179
|
-
|
|
4180
|
-
|
|
4181
|
-
)
|
|
4192
|
+
const templatePath = path12.join(appWebRoot, "index.html");
|
|
4193
|
+
const serverEntryPath = isProd ? path12.join(appWebRoot, "server/serverEntry.js") : path12.join(appWebRoot, "serverEntry.tsx");
|
|
4194
|
+
let render;
|
|
4195
|
+
let template = await fs3.readFile(path12.join(templatePath), "utf-8");
|
|
4196
|
+
if (isProd) {
|
|
4197
|
+
const { render: ssrRender } = await import(serverEntryPath);
|
|
4198
|
+
render = ssrRender;
|
|
4199
|
+
} else {
|
|
4200
|
+
template = await appServer.transformIndexHtml(url3, template);
|
|
4201
|
+
render = (await appServer.ssrLoadModule(serverEntryPath)).render;
|
|
4202
|
+
}
|
|
4182
4203
|
const rendered = await render(initialProps);
|
|
4183
4204
|
const html = template.replace(`<!--app-head-->`, rendered.head ?? "").replace(`<!--app-html-->`, rendered.html ?? "").replace(
|
|
4184
4205
|
`<!--app-script-->`,
|
|
4185
4206
|
`<script>window.__hsInitialProps = ${JSON.stringify(
|
|
4186
4207
|
initialProps
|
|
4187
|
-
)}
|
|
4208
|
+
)};</script>` ?? ""
|
|
4188
4209
|
);
|
|
4189
4210
|
res.status(200).set({ "Content-Type": "text/html" }).send(html);
|
|
4190
4211
|
} catch (e) {
|
|
@@ -4547,7 +4568,7 @@ async function fetchWebsiteDomainNames(portalId) {
|
|
|
4547
4568
|
}
|
|
4548
4569
|
|
|
4549
4570
|
// src/lib/validateHSPlatform.ts
|
|
4550
|
-
import
|
|
4571
|
+
import path13 from "path";
|
|
4551
4572
|
import fs4 from "fs";
|
|
4552
4573
|
import select from "@inquirer/select";
|
|
4553
4574
|
import { http as hsCliHttp12 } from "@hubspot/local-dev-lib/http";
|
|
@@ -4559,12 +4580,12 @@ function findHSProjectJson(startPath) {
|
|
|
4559
4580
|
let currentDir = startPath;
|
|
4560
4581
|
let dirLevel = 0;
|
|
4561
4582
|
const maxDirLevel = 4;
|
|
4562
|
-
while (
|
|
4563
|
-
const filePath =
|
|
4583
|
+
while (path13.dirname(currentDir) !== currentDir && dirLevel < maxDirLevel) {
|
|
4584
|
+
const filePath = path13.join(currentDir, HSPROJECT_JSON);
|
|
4564
4585
|
if (checkFileExists(filePath)) {
|
|
4565
4586
|
return filePath;
|
|
4566
4587
|
}
|
|
4567
|
-
currentDir =
|
|
4588
|
+
currentDir = path13.dirname(currentDir);
|
|
4568
4589
|
dirLevel++;
|
|
4569
4590
|
}
|
|
4570
4591
|
console.log(
|
|
@@ -4870,7 +4891,7 @@ function writeFieldsType(fields, fileName, typeName) {
|
|
|
4870
4891
|
|
|
4871
4892
|
// src/lib/watchFieldsUpdates.ts
|
|
4872
4893
|
import fs5 from "fs";
|
|
4873
|
-
import
|
|
4894
|
+
import path14 from "path";
|
|
4874
4895
|
import readline from "readline";
|
|
4875
4896
|
var lastSerializedFieldsCache = {};
|
|
4876
4897
|
var formatAsTypeName = (str) => {
|
|
@@ -4882,9 +4903,9 @@ var isInModulesFolder = (filePath, projectRoot) => {
|
|
|
4882
4903
|
const getEntryPathFromId = (id) => {
|
|
4883
4904
|
return id.startsWith(projectRoot) ? id.replace(`${projectRoot}/`, "") : "";
|
|
4884
4905
|
};
|
|
4885
|
-
const currentModuleId =
|
|
4906
|
+
const currentModuleId = path14.normalize(filePath);
|
|
4886
4907
|
const moduleEntryPath = getEntryPathFromId(currentModuleId);
|
|
4887
|
-
const subFolderTokens = moduleEntryPath.split(
|
|
4908
|
+
const subFolderTokens = moduleEntryPath.split(path14.sep);
|
|
4888
4909
|
return {
|
|
4889
4910
|
inModuleFolder: subFolderTokens[0] === "components" && subFolderTokens[1] === "modules",
|
|
4890
4911
|
isRootModuleFile: subFolderTokens.length === 3
|
|
@@ -4911,10 +4932,10 @@ var getIndexFile = (filePath, projectRoot) => {
|
|
|
4911
4932
|
return void 0;
|
|
4912
4933
|
if (isRootModuleFile)
|
|
4913
4934
|
return { indexFilePath: filePath, isRootModuleFile };
|
|
4914
|
-
const dir =
|
|
4935
|
+
const dir = path14.dirname(filePath);
|
|
4915
4936
|
const files = fs5.readdirSync(dir);
|
|
4916
4937
|
const indexFileName = files.find((file) => file.startsWith("index."));
|
|
4917
|
-
return indexFileName ? { indexFilePath:
|
|
4938
|
+
return indexFileName ? { indexFilePath: path14.join(dir, indexFileName), isRootModuleFile } : void 0;
|
|
4918
4939
|
};
|
|
4919
4940
|
var getIndexFileFields = async (indexFilePath, indexFileName, viteServer) => {
|
|
4920
4941
|
let indexFile;
|
|
@@ -4938,7 +4959,7 @@ var maybeUpdateFields = async (filePath, viteServer, projectRoot) => {
|
|
|
4938
4959
|
if (!indexInfo)
|
|
4939
4960
|
return;
|
|
4940
4961
|
const { indexFilePath, isRootModuleFile } = indexInfo;
|
|
4941
|
-
const indexFileName =
|
|
4962
|
+
const indexFileName = path14.parse(indexFilePath).name;
|
|
4942
4963
|
const isTypeFile = filePath.endsWith(".types.ts");
|
|
4943
4964
|
if (isTypeFile)
|
|
4944
4965
|
return;
|
|
@@ -4949,7 +4970,7 @@ var maybeUpdateFields = async (filePath, viteServer, projectRoot) => {
|
|
|
4949
4970
|
);
|
|
4950
4971
|
if (fields) {
|
|
4951
4972
|
const typeFileName = isRootModuleFile ? `${indexFileName}.fields.types.ts` : "fields.type.ts";
|
|
4952
|
-
const typeFilePath =
|
|
4973
|
+
const typeFilePath = path14.join(path14.dirname(filePath), typeFileName);
|
|
4953
4974
|
const lastSerializedFields = lastSerializedFieldsCache[typeFilePath];
|
|
4954
4975
|
const serializedFields = JSON.stringify(fields);
|
|
4955
4976
|
if (lastSerializedFields === serializedFields)
|
|
@@ -4957,7 +4978,7 @@ var maybeUpdateFields = async (filePath, viteServer, projectRoot) => {
|
|
|
4957
4978
|
const hasAutoGenComment = await fileContainsAutoGenComment(typeFilePath);
|
|
4958
4979
|
if (!hasAutoGenComment)
|
|
4959
4980
|
return;
|
|
4960
|
-
const moduleFolderName =
|
|
4981
|
+
const moduleFolderName = path14.basename(path14.dirname(filePath));
|
|
4961
4982
|
const outputTypeName = formatAsTypeName(moduleFolderName);
|
|
4962
4983
|
const didSucceed = writeFieldsType(fields, typeFilePath, outputTypeName);
|
|
4963
4984
|
if (didSucceed) {
|
|
@@ -4973,7 +4994,7 @@ var maybeUpdateFields = async (filePath, viteServer, projectRoot) => {
|
|
|
4973
4994
|
var startFieldsTypeGenWatcher = (viteServer, projectRoot) => {
|
|
4974
4995
|
const { moduleSubpaths } = findAllModulesInRoot(projectRoot);
|
|
4975
4996
|
moduleSubpaths.forEach((modulePath) => {
|
|
4976
|
-
const resolvedPath =
|
|
4997
|
+
const resolvedPath = path14.resolve(projectRoot, modulePath);
|
|
4977
4998
|
maybeUpdateFields(resolvedPath, viteServer, projectRoot);
|
|
4978
4999
|
});
|
|
4979
5000
|
const watchCallback = (filePath) => maybeUpdateFields(filePath, viteServer, projectRoot);
|
|
@@ -5111,7 +5132,7 @@ Local proxy functionality and module preview routes will not work without settin
|
|
|
5111
5132
|
} catch (e) {
|
|
5112
5133
|
authedHublet = "na1";
|
|
5113
5134
|
}
|
|
5114
|
-
const absoluteWebRoot = normalizePath9(
|
|
5135
|
+
const absoluteWebRoot = normalizePath9(path15.resolve(process.cwd(), webRoot));
|
|
5115
5136
|
const [__webRootProjectFolder, webRootProjectComponentFolder] = absoluteWebRoot.replace(/\/$/, "").split("/").slice(-2);
|
|
5116
5137
|
const projectConfigPath = findHSProjectJson(absoluteWebRoot);
|
|
5117
5138
|
if (authedPortalId) {
|
|
@@ -5165,8 +5186,8 @@ Local proxy functionality and module preview routes will not work without settin
|
|
|
5165
5186
|
expressServer.use(bodyParser.json());
|
|
5166
5187
|
let appServerConfig = null;
|
|
5167
5188
|
if (showUI) {
|
|
5168
|
-
const appWebRoot =
|
|
5169
|
-
|
|
5189
|
+
const appWebRoot = path15.join(
|
|
5190
|
+
path15.dirname(url2.fileURLToPath(import.meta.url)),
|
|
5170
5191
|
"../app"
|
|
5171
5192
|
);
|
|
5172
5193
|
const reqLocals = {
|
|
@@ -5237,8 +5258,8 @@ HubSpot CMS dev server hosting: ${projectName}/${expressServer.locals.projectCom
|
|
|
5237
5258
|
`
|
|
5238
5259
|
);
|
|
5239
5260
|
if (storybook) {
|
|
5240
|
-
const packageRoot =
|
|
5241
|
-
const configPath =
|
|
5261
|
+
const packageRoot = path15.dirname(url2.fileURLToPath(import.meta.url));
|
|
5262
|
+
const configPath = path15.resolve(packageRoot, "./storybook-main");
|
|
5242
5263
|
sendTrackingRequest("start-storybook");
|
|
5243
5264
|
const storybookProcess = spawn2(
|
|
5244
5265
|
"sb",
|
|
@@ -5258,7 +5279,7 @@ HubSpot CMS dev server hosting: ${projectName}/${expressServer.locals.projectCom
|
|
|
5258
5279
|
portalId: authedPortalId.toString(),
|
|
5259
5280
|
hsEnv: authedEnv,
|
|
5260
5281
|
hublet: authedHublet,
|
|
5261
|
-
WEB_ROOT:
|
|
5282
|
+
WEB_ROOT: path15.join(webRoot, "components")
|
|
5262
5283
|
}
|
|
5263
5284
|
}
|
|
5264
5285
|
);
|