All files / scripts/lib/output writeProjects.js

100% Statements 3/3
100% Branches 0/0
100% Functions 1/1
100% Lines 3/3

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17  1x                     3x     1x  
#!/usr/bin/env node
const fs = require('fs');
 
/**
 * Serializes the projects array to disk as pretty-printed JSON.
 * Overwrites the existing file so the React app always reads the latest pipeline output.
 *
 * @param {string} outPath - Absolute path to write (typically public/projects.json)
 * @param {object[]} nodes - Enriched repository nodes
 * @returns {void}
 */
function writeProjectsJson(outPath, nodes) {
  fs.writeFileSync(outPath, JSON.stringify(nodes, null, 2), 'utf8');
}
 
module.exports = { writeProjectsJson };