Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hubspot CMS Dev Server doesn't generate types #77

Open
webcodavic opened this issue Jul 17, 2024 · 0 comments
Open

Hubspot CMS Dev Server doesn't generate types #77

webcodavic opened this issue Jul 17, 2024 · 0 comments

Comments

@webcodavic
Copy link

There's a bug on hubspot-cms-dev server that cause hs-cms-dev-server --generateFieldTypes to not generate field types automatically.
the slashes are different on projectRoot and id in getEntryPathFromId function

image

Currently to (temporarily) fix it I have to change the isInModulesFolder function on

var isInModulesFolder = (filePath, _projectRoot) => {
    const projectRoot = path8.normalize(_projectRoot);
  const getEntryPathFromId = (id) => {
    return id.startsWith(projectRoot) ? id.replace(path8.normalize(`${projectRoot}/`), "") : "";
  };
  const currentModuleId = path8.normalize(filePath);
  const moduleEntryPath = getEntryPathFromId(currentModuleId);
  const subFolderTokens = moduleEntryPath.split(path8.sep);
  return {
    inModuleFolder: subFolderTokens[0] === "components" && subFolderTokens[1] === "modules",
    isRootModuleFile: subFolderTokens.length === 3
  };
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant