@brainwav/diagram 1.0.6 → 1.0.8
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 +1 -1
- package/src/diagram.js +18 -4
package/package.json
CHANGED
package/src/diagram.js
CHANGED
|
@@ -11,6 +11,9 @@ const crypto = require('crypto');
|
|
|
11
11
|
const zlib = require('zlib');
|
|
12
12
|
const { getOpenCommand, getNpxCommandCandidates } = require('./utils/commands');
|
|
13
13
|
|
|
14
|
+
// Read version from package.json
|
|
15
|
+
const packageJson = require('../package.json');
|
|
16
|
+
|
|
14
17
|
// Video generation (lazy loaded)
|
|
15
18
|
let videoModule;
|
|
16
19
|
function getVideoModule() {
|
|
@@ -1294,7 +1297,7 @@ function validateExistingPathInRoot(targetPath, rootPath, label = 'path') {
|
|
|
1294
1297
|
program
|
|
1295
1298
|
.name('diagram')
|
|
1296
1299
|
.description('Generate architecture diagrams from code')
|
|
1297
|
-
.version(
|
|
1300
|
+
.version(packageJson.version);
|
|
1298
1301
|
|
|
1299
1302
|
program
|
|
1300
1303
|
.command('analyze [path]')
|
|
@@ -1469,7 +1472,10 @@ program
|
|
|
1469
1472
|
.option('-d, --manifest-dir <dir>', 'Directory containing manifest.json', '.diagram')
|
|
1470
1473
|
.option('-o, --output <file>', 'Write summary JSON to a file')
|
|
1471
1474
|
.option('--require-types <list>', 'Require all listed diagram types, comma-separated')
|
|
1472
|
-
.option(
|
|
1475
|
+
.option(
|
|
1476
|
+
'--fail-on-placeholder',
|
|
1477
|
+
'Fail if any required diagram was a placeholder (or any placeholder if no required types are set)'
|
|
1478
|
+
)
|
|
1473
1479
|
.action(async (targetPath, options) => {
|
|
1474
1480
|
const root = resolveRootPathOrExit(targetPath);
|
|
1475
1481
|
const manifestDir = path.join(root, options.manifestDir || '.diagram');
|
|
@@ -1517,8 +1523,16 @@ program
|
|
|
1517
1523
|
process.exit(2);
|
|
1518
1524
|
}
|
|
1519
1525
|
|
|
1520
|
-
|
|
1521
|
-
|
|
1526
|
+
const placeholderTypesToCheck = required.length > 0
|
|
1527
|
+
? summary.placeholderTypes.filter((type) => required.includes(type))
|
|
1528
|
+
: summary.placeholderTypes;
|
|
1529
|
+
|
|
1530
|
+
if (options.failOnPlaceholder && placeholderTypesToCheck.length > 0) {
|
|
1531
|
+
console.error(
|
|
1532
|
+
chalk.yellow(
|
|
1533
|
+
`⚠️ Manifest includes ${placeholderTypesToCheck.length} required placeholder diagram(s): ${placeholderTypesToCheck.join(', ')}`
|
|
1534
|
+
)
|
|
1535
|
+
);
|
|
1522
1536
|
process.exit(2);
|
|
1523
1537
|
}
|
|
1524
1538
|
|