Skip to content

Commit a8e1af5

Browse files
authored
squash!
1 parent 488a2a3 commit a8e1af5

3 files changed

Lines changed: 8 additions & 1 deletion

File tree

‎src/generators/legacy-json-all/index.mjs‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
import { writeFile } from 'node:fs/promises';
44
import { join } from 'node:path';
55

6+
import { legacyToJSON } from '../../utils/generators.mjs';
7+
68
/**
79
* This generator consolidates data from the `legacy-json` generator into a single
810
* JSON file (`all.json`).

‎src/generators/legacy-json/index.mjs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { writeFile } from 'node:fs/promises';
44
import { join } from 'node:path';
55

66
import { createSectionBuilder } from './utils/buildSection.mjs';
7-
import { groupNodesByModule } from '../../utils/generators.mjs';
7+
import { groupNodesByModule, legacyToJSON } from '../../utils/generators.mjs';
88

99
const buildSection = createSectionBuilder();
1010

‎src/utils/generators.mjs‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,11 @@ export const sortChanges = (changes, key = 'version') => {
110110
export const leftHandAssign = (target, source) =>
111111
Object.keys(source).forEach((k) => k in target || (target[k] = source[k]));
112112

113+
/**
114+
* Transforms an object to JSON output consistent with the JSON version.
115+
* @param {Object} section - The source object
116+
* @returns {string} - The JSON output
117+
*/
113118
export const legacyToJSON = (section) =>
114119
JSON.stringify(
115120
section,

0 commit comments

Comments
 (0)