@hubspot/project-parsing-lib 0.12.0 → 0.12.1-beta.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hubspot/project-parsing-lib",
3
- "version": "0.12.0",
3
+ "version": "0.12.1-beta.0",
4
4
  "description": "Parsing library for converting projects directory structures to their intermediate representation",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -47,8 +47,8 @@
47
47
  "@inquirer/prompts": "^7.1.0",
48
48
  "@types/node": "^24.9.0",
49
49
  "@types/semver": "^7.5.8",
50
- "@typescript-eslint/eslint-plugin": "^8.11.0",
51
- "@typescript-eslint/parser": "^8.11.0",
50
+ "@typescript-eslint/eslint-plugin": "8.46.3",
51
+ "@typescript-eslint/parser": "8.46.3",
52
52
  "eslint": "^9.38.0",
53
53
  "eslint-plugin-import": "^2.31.0",
54
54
  "husky": "^9.1.7",
@@ -61,7 +61,7 @@
61
61
  },
62
62
  "dependencies": {
63
63
  "@hubspot/local-dev-lib": "4.0.4",
64
- "ajv": "8.17.1",
64
+ "ajv": "8.18.0",
65
65
  "ajv-formats": "3.0.1"
66
66
  },
67
67
  "scripts": {
@@ -4,7 +4,8 @@ export declare const THEME_KEY = "theme";
4
4
  export declare const CMS_ASSETS_KEY = "cms-assets";
5
5
  export declare const APP_EVENTS_KEY = "app-event";
6
6
  export declare const APP_FUNCTIONS_KEY = "app-function";
7
- export declare const PAGES_KEY = "page";
7
+ export declare const PAGE_KEY = "page";
8
+ export declare const PAGES_KEY = "pages";
8
9
  export declare const APP_OBJECT_KEY = "app-object";
9
10
  export declare const APP_OBJECT_ASSOCIATION_KEY = "app-object-association";
10
11
  export declare const CALLING_KEY = "calling";
@@ -7,7 +7,8 @@ export const CMS_ASSETS_KEY = 'cms-assets';
7
7
  // Sub-Component types
8
8
  export const APP_EVENTS_KEY = 'app-event';
9
9
  export const APP_FUNCTIONS_KEY = 'app-function';
10
- export const PAGES_KEY = 'page';
10
+ export const PAGE_KEY = 'page';
11
+ export const PAGES_KEY = 'pages';
11
12
  export const APP_OBJECT_KEY = 'app-object';
12
13
  export const APP_OBJECT_ASSOCIATION_KEY = 'app-object-association';
13
14
  export const CALLING_KEY = 'calling';
@@ -35,6 +36,13 @@ const SUB_COMPONENT_FIELDS = {
35
36
  userFriendlyType: 'feature',
36
37
  userFriendlyTypePlural: 'features',
37
38
  };
39
+ const PAGE_COMPONENT = {
40
+ dir: 'pages',
41
+ parentComponent: APP_KEY,
42
+ ...SUB_COMPONENT_FIELDS,
43
+ userFriendlyName: 'Page',
44
+ singularComponent: true,
45
+ };
38
46
  export const Components = {
39
47
  [APP_KEY]: {
40
48
  dir: APP_KEY,
@@ -54,13 +62,8 @@ export const Components = {
54
62
  ...SUB_COMPONENT_FIELDS,
55
63
  userFriendlyName: 'App Object Association',
56
64
  },
57
- [PAGES_KEY]: {
58
- dir: 'pages',
59
- parentComponent: APP_KEY,
60
- ...SUB_COMPONENT_FIELDS,
61
- userFriendlyName: 'Page',
62
- singularComponent: true,
63
- },
65
+ [PAGE_KEY]: PAGE_COMPONENT,
66
+ [PAGES_KEY]: PAGE_COMPONENT,
64
67
  [THEME_KEY]: {
65
68
  dir: THEME_KEY,
66
69
  userFriendlyName: 'Theme',
@@ -168,6 +171,7 @@ export const USER_FACING_TO_INTERNAL_TYPE = {
168
171
  [SCIM_KEY]: 'SCIM_INTEGRATION',
169
172
  [TELEMETRY_KEY]: 'TELEMETRY_CONFIG',
170
173
  [CMS_ASSETS_KEY]: 'REACT_THEME',
174
+ [PAGES_KEY]: 'PAGE',
171
175
  };
172
176
  export const INTERNAL_TYPE_TO_USER_FACING = Object.fromEntries(Object.entries(USER_FACING_TO_INTERNAL_TYPE).map(([key, value]) => [
173
177
  value,
@@ -9,18 +9,25 @@ export async function getProjectMetadata(projectSrcDir) {
9
9
  if (fs.existsSync(projectSrcDir)) {
10
10
  metafiles = await locateHsMetaFiles(projectSrcDir, { silent: true });
11
11
  }
12
+ const seenComponentPaths = new Map();
12
13
  Object.keys(Components).forEach(componentType => {
13
14
  const { parentComponent, singularComponent, dir } = Components[componentType];
14
15
  const componentPath = path.join(projectSrcDir, parentComponent ? path.join(parentComponent, dir) : dir);
16
+ if (seenComponentPaths.has(componentPath)) {
17
+ components[componentType] = seenComponentPaths.get(componentPath);
18
+ return;
19
+ }
15
20
  const metaFilesByType = metafiles
16
21
  .filter(metafile => path.parse(metafile.file).dir === componentPath)
17
22
  .map(metaFile => metaFile.file);
18
- hsMetaFiles.push(...metaFilesByType);
19
- components[componentType] = {
23
+ const metadata = {
20
24
  hsMetaFiles: metaFilesByType,
21
25
  count: metaFilesByType.length,
22
26
  maxCount: singularComponent ? 1 : Infinity,
23
27
  };
28
+ hsMetaFiles.push(...metaFilesByType);
29
+ seenComponentPaths.set(componentPath, metadata);
30
+ components[componentType] = metadata;
24
31
  });
25
32
  return {
26
33
  hsMetaFiles,