@hubspot/cms-dev-server 0.15.1-alpha.0 → 0.15.2

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.
Files changed (2) hide show
  1. package/dist/run.js +14 -11
  2. 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.1-alpha.0",
1047
+ version: "0.15.2",
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
- return getHSProjectConfig(hsProjectConfigPath).name;
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
@@ -3152,15 +3157,14 @@ function findHSProjectJson(startPath) {
3152
3157
  );
3153
3158
  return null;
3154
3159
  }
3155
- async function validateHSPlatform(webroot, portalId) {
3156
- const foundHSProjectJsonPath = findHSProjectJson(webroot);
3157
- if (foundHSProjectJsonPath === null) {
3160
+ async function validateHSPlatform(projectConfigPath, portalId) {
3161
+ if (projectConfigPath === null) {
3158
3162
  console.log(
3159
3163
  `Unable to find local ${HSPROJECT_JSON}, skipping platform version validation.`
3160
3164
  );
3161
3165
  return false;
3162
3166
  }
3163
- const hsProjectJSONContents = fs3.readFileSync(foundHSProjectJsonPath, "utf8");
3167
+ const hsProjectJSONContents = fs3.readFileSync(projectConfigPath, "utf8");
3164
3168
  const hsProjectJSONData = JSON.parse(hsProjectJSONContents);
3165
3169
  const { platformVersion } = hsProjectJSONData;
3166
3170
  let platformVersionResult;
@@ -3189,7 +3193,7 @@ async function validateHSPlatform(webroot, portalId) {
3189
3193
  hsProjectJSONData.platformVersion = answer;
3190
3194
  try {
3191
3195
  fs3.writeFileSync(
3192
- foundHSProjectJsonPath,
3196
+ projectConfigPath,
3193
3197
  JSON.stringify(hsProjectJSONData, void 0, 2),
3194
3198
  "utf8"
3195
3199
  );
@@ -3319,8 +3323,9 @@ Local proxy functionality and module preview routes will not work without settin
3319
3323
  }
3320
3324
  const absoluteWebRoot = normalizePath6(path8.resolve(process.cwd(), webRoot2));
3321
3325
  const [__webRootProjectFolder, webRootProjectComponentFolder] = absoluteWebRoot.replace(/\/$/, "").split("/").slice(-2);
3326
+ const projectConfigPath = findHSProjectJson(absoluteWebRoot);
3322
3327
  if (authedPortalId) {
3323
- await validateHSPlatform(absoluteWebRoot, authedPortalId);
3328
+ await validateHSPlatform(projectConfigPath, authedPortalId);
3324
3329
  }
3325
3330
  const viteServer = await createViteDevServer_default(
3326
3331
  absoluteWebRoot,
@@ -3333,9 +3338,7 @@ Local proxy functionality and module preview routes will not work without settin
3333
3338
  const viteHTTPSConfig = viteServer.config.server.https;
3334
3339
  const httpsKey = viteHTTPSConfig ? viteHTTPSConfig.key : null;
3335
3340
  const httpsCert = viteHTTPSConfig ? viteHTTPSConfig.cert : null;
3336
- const projectName = getProjectNameFromHSConfig(
3337
- path8.join(webRoot2, "../hsproject.json")
3338
- );
3341
+ const projectName = getProjectNameFromHSConfig(projectConfigPath);
3339
3342
  const httpServers = [];
3340
3343
  const expressServer = express2();
3341
3344
  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.1-alpha.0",
3
+ "version": "0.15.2",
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.1-alpha.0",
29
+ "@hubspot/cms-components": "^0.15.2",
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": "381183081aa0450bb0f1327df88809ac144dcccf"
111
+ "gitHead": "d2bf117492d5e76eba9a6dd1addf726b77c7d7ec"
112
112
  }