@hubspot/cms-dev-server 0.15.1 → 0.15.3
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/run.js +16 -12
- package/package.json +3 -3
package/dist/run.js
CHANGED
|
@@ -1044,7 +1044,7 @@ function trackUsage(action) {
|
|
|
1044
1044
|
eventName: EVENT_NAME,
|
|
1045
1045
|
action,
|
|
1046
1046
|
nodeVersion: getNodeVersionData(),
|
|
1047
|
-
version: "0.15.
|
|
1047
|
+
version: "0.15.3",
|
|
1048
1048
|
os: getPlatform()
|
|
1049
1049
|
};
|
|
1050
1050
|
const uri = isAuthedWithPersonalAccessKey ? DEV_SERVER_USAGE_ENDPOINT_AUTHENTICATED : DEV_SERVER_USAGE_ENDPOINT;
|
|
@@ -1746,10 +1746,15 @@ var getHSProjectConfig = (hsProjectConfigPath) => {
|
|
|
1746
1746
|
`Missing hsproject.json file (${resolve2(hsProjectConfigPath)}): `,
|
|
1747
1747
|
e.message
|
|
1748
1748
|
);
|
|
1749
|
+
return null;
|
|
1749
1750
|
}
|
|
1750
1751
|
};
|
|
1751
1752
|
var getProjectNameFromHSConfig = (hsProjectConfigPath) => {
|
|
1752
|
-
|
|
1753
|
+
const hsProjectConfig = getHSProjectConfig(hsProjectConfigPath);
|
|
1754
|
+
if (hsProjectConfig) {
|
|
1755
|
+
return hsProjectConfig.name;
|
|
1756
|
+
}
|
|
1757
|
+
throw new Error("hsproject.json file not found");
|
|
1753
1758
|
};
|
|
1754
1759
|
|
|
1755
1760
|
// src/proxyPage/utils.ts
|
|
@@ -2521,7 +2526,7 @@ function proxyPathPageResourceRedirect2(req, res, next) {
|
|
|
2521
2526
|
if (localDomains.includes(referrerDomain)) {
|
|
2522
2527
|
domainToProxy = req.app.locals.domainsToProxy[0];
|
|
2523
2528
|
} else {
|
|
2524
|
-
domainToProxy = referrerDomain;
|
|
2529
|
+
domainToProxy = referrerDomain.replace(/\.localhost|\.hslocal\.net/, "");
|
|
2525
2530
|
}
|
|
2526
2531
|
} catch (e) {
|
|
2527
2532
|
console.log("Error parsing referer URL:", e);
|
|
@@ -2551,6 +2556,7 @@ function proxyPathPageResourceRedirect2(req, res, next) {
|
|
|
2551
2556
|
if (body) {
|
|
2552
2557
|
proxyLogArgs.push("with body:", body);
|
|
2553
2558
|
}
|
|
2559
|
+
console.log(...proxyLogArgs);
|
|
2554
2560
|
switch (method) {
|
|
2555
2561
|
case "POST":
|
|
2556
2562
|
case "DELETE":
|
|
@@ -3152,15 +3158,14 @@ function findHSProjectJson(startPath) {
|
|
|
3152
3158
|
);
|
|
3153
3159
|
return null;
|
|
3154
3160
|
}
|
|
3155
|
-
async function validateHSPlatform(
|
|
3156
|
-
|
|
3157
|
-
if (foundHSProjectJsonPath === null) {
|
|
3161
|
+
async function validateHSPlatform(projectConfigPath, portalId) {
|
|
3162
|
+
if (projectConfigPath === null) {
|
|
3158
3163
|
console.log(
|
|
3159
3164
|
`Unable to find local ${HSPROJECT_JSON}, skipping platform version validation.`
|
|
3160
3165
|
);
|
|
3161
3166
|
return false;
|
|
3162
3167
|
}
|
|
3163
|
-
const hsProjectJSONContents = fs3.readFileSync(
|
|
3168
|
+
const hsProjectJSONContents = fs3.readFileSync(projectConfigPath, "utf8");
|
|
3164
3169
|
const hsProjectJSONData = JSON.parse(hsProjectJSONContents);
|
|
3165
3170
|
const { platformVersion } = hsProjectJSONData;
|
|
3166
3171
|
let platformVersionResult;
|
|
@@ -3189,7 +3194,7 @@ async function validateHSPlatform(webroot, portalId) {
|
|
|
3189
3194
|
hsProjectJSONData.platformVersion = answer;
|
|
3190
3195
|
try {
|
|
3191
3196
|
fs3.writeFileSync(
|
|
3192
|
-
|
|
3197
|
+
projectConfigPath,
|
|
3193
3198
|
JSON.stringify(hsProjectJSONData, void 0, 2),
|
|
3194
3199
|
"utf8"
|
|
3195
3200
|
);
|
|
@@ -3319,8 +3324,9 @@ Local proxy functionality and module preview routes will not work without settin
|
|
|
3319
3324
|
}
|
|
3320
3325
|
const absoluteWebRoot = normalizePath6(path8.resolve(process.cwd(), webRoot2));
|
|
3321
3326
|
const [__webRootProjectFolder, webRootProjectComponentFolder] = absoluteWebRoot.replace(/\/$/, "").split("/").slice(-2);
|
|
3327
|
+
const projectConfigPath = findHSProjectJson(absoluteWebRoot);
|
|
3322
3328
|
if (authedPortalId) {
|
|
3323
|
-
await validateHSPlatform(
|
|
3329
|
+
await validateHSPlatform(projectConfigPath, authedPortalId);
|
|
3324
3330
|
}
|
|
3325
3331
|
const viteServer = await createViteDevServer_default(
|
|
3326
3332
|
absoluteWebRoot,
|
|
@@ -3333,9 +3339,7 @@ Local proxy functionality and module preview routes will not work without settin
|
|
|
3333
3339
|
const viteHTTPSConfig = viteServer.config.server.https;
|
|
3334
3340
|
const httpsKey = viteHTTPSConfig ? viteHTTPSConfig.key : null;
|
|
3335
3341
|
const httpsCert = viteHTTPSConfig ? viteHTTPSConfig.cert : null;
|
|
3336
|
-
const projectName = getProjectNameFromHSConfig(
|
|
3337
|
-
path8.join(webRoot2, "../hsproject.json")
|
|
3338
|
-
);
|
|
3342
|
+
const projectName = getProjectNameFromHSConfig(projectConfigPath);
|
|
3339
3343
|
const httpServers = [];
|
|
3340
3344
|
const expressServer = express2();
|
|
3341
3345
|
expressServer.locals.devServerHost = "hslocal.net";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hubspot/cms-dev-server",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.3",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@hubspot/cli-lib": "^3.0.12",
|
|
29
|
-
"@hubspot/cms-components": "^0.15.
|
|
29
|
+
"@hubspot/cms-components": "^0.15.3",
|
|
30
30
|
"@inquirer/select": "^2.0.0",
|
|
31
31
|
"@originjs/vite-plugin-commonjs": "^1.0.3",
|
|
32
32
|
"@storybook/addon-actions": "7.0.7",
|
|
@@ -108,5 +108,5 @@
|
|
|
108
108
|
"publishConfig": {
|
|
109
109
|
"access": "public"
|
|
110
110
|
},
|
|
111
|
-
"gitHead": "
|
|
111
|
+
"gitHead": "52a855725f867d208232c2a7c420078748277a77"
|
|
112
112
|
}
|