bulltrackers-module 1.0.160 → 1.0.161
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.
|
@@ -21,12 +21,12 @@ const { Module, render } = require('viz.js/full.render.js');
|
|
|
21
21
|
* Pretty Console Helpers
|
|
22
22
|
* -------------------------------------------------- */
|
|
23
23
|
const log = {
|
|
24
|
-
info:
|
|
25
|
-
step:
|
|
26
|
-
warn:
|
|
27
|
-
success: (msg)
|
|
28
|
-
error:
|
|
29
|
-
fatal:
|
|
24
|
+
info: (msg) => console.log('ℹ︎ ' + msg),
|
|
25
|
+
step: (msg) => console.log('› ' + msg),
|
|
26
|
+
warn: (msg) => console.warn('⚠︎ ' + msg),
|
|
27
|
+
success: (msg) => console.log('✔︎ ' + msg),
|
|
28
|
+
error: (msg) => console.error('✖ ' + msg),
|
|
29
|
+
fatal: (msg) => { console.error('✖ FATAL ✖ ' + msg); console.error('✖ FATAL ✖ Manifest build FAILED.'); },
|
|
30
30
|
divider: (label) => { const line = ''.padEnd(60, '─'); console.log(`\n${line}\n${label}\n${line}\n`); },
|
|
31
31
|
};
|
|
32
32
|
|
|
@@ -237,7 +237,11 @@ async function generateSvgGraph(manifest, filename = 'dependency-tree.svg') {
|
|
|
237
237
|
dot += '}\n';
|
|
238
238
|
try {
|
|
239
239
|
const svg = await viz.renderString(dot, { format: 'svg' });
|
|
240
|
-
|
|
240
|
+
|
|
241
|
+
// --- MODIFIED PATH ---
|
|
242
|
+
// Writes to the root of the 'bulltrackers-module' package directory,
|
|
243
|
+
// which is a safer, more predictable location.
|
|
244
|
+
const out = path.join(__dirname, '..', '..', '..', filename);
|
|
241
245
|
fs.writeFileSync(out, svg);
|
|
242
246
|
log.success(`Dependency tree generated at ${out}`);
|
|
243
247
|
} catch (e) { log.error(`SVG generation failed: ${e.message}`); }
|
|
@@ -248,17 +252,43 @@ async function generateSvgGraph(manifest, filename = 'dependency-tree.svg') {
|
|
|
248
252
|
* Main entry point for building and exporting the manifest.
|
|
249
253
|
* @param {string[]} productLinesToRun - Array of product line categories (folder names) to build for.
|
|
250
254
|
*/
|
|
251
|
-
|
|
255
|
+
function build(productLinesToRun) {
|
|
252
256
|
try {
|
|
257
|
+
// This function MUST NOT fail or generate SVGs.
|
|
258
|
+
// It has one job: build and return the manifest array.
|
|
253
259
|
const manifest = buildManifest(productLinesToRun);
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
return
|
|
259
|
-
|
|
260
|
+
return manifest; // Returns the array
|
|
261
|
+
} catch (error) {
|
|
262
|
+
log.error(error.message);
|
|
263
|
+
// If buildManifest fails, it will throw.
|
|
264
|
+
// We return null so the caller can handle the failure.
|
|
265
|
+
return null;
|
|
266
|
+
}
|
|
260
267
|
}
|
|
261
268
|
|
|
262
269
|
module.exports = { build };
|
|
263
270
|
|
|
264
|
-
|
|
271
|
+
// --- MODIFIED ---
|
|
272
|
+
// This block is ONLY executed when you run `node computation_manifest_builder.js`
|
|
273
|
+
// This is now the ONLY place SVG generation happens.
|
|
274
|
+
if (require.main === module) {
|
|
275
|
+
(async () => { // This part remains async for the SVG generation
|
|
276
|
+
log.info('Running manifest builder in local debug mode...');
|
|
277
|
+
const allProductLines = Object.keys(calculations).filter(c => c !== 'legacy');
|
|
278
|
+
|
|
279
|
+
try {
|
|
280
|
+
// 1. Build the full manifest
|
|
281
|
+
const fullManifest = buildManifest(allProductLines); // Sync call
|
|
282
|
+
|
|
283
|
+
if (fullManifest) {
|
|
284
|
+
// 2. Generate the full SVG graph
|
|
285
|
+
await generateSvgGraph(fullManifest, 'dependency-tree-full.svg');
|
|
286
|
+
log.info('Local debug build and graph generation complete.');
|
|
287
|
+
} else {
|
|
288
|
+
log.fatal('Local debug build FAILED.');
|
|
289
|
+
}
|
|
290
|
+
} catch (error) {
|
|
291
|
+
log.error(error.message);
|
|
292
|
+
}
|
|
293
|
+
})();
|
|
294
|
+
}
|