@biffo/cli 0.148.2 → 0.149.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.
Files changed (2) hide show
  1. package/dist/index.js +16 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -350,10 +350,11 @@ var coreDiffCommand = new Command("diff").description(
350
350
  ).option("--cwd <path>", "Instance repo root to inspect (defaults to the current directory)").option(
351
351
  "--template <path>",
352
352
  "Path to a biffo-template checkout to compare against (defaults to the template this CLI ships with)"
353
- ).action(async (options) => {
353
+ ).option("--json", "Emit the classification as JSON on stdout instead of the human report").action(async (options) => {
354
354
  const cwd = options.cwd ? resolve(options.cwd) : process.cwd();
355
355
  const runOptions = { cwd };
356
356
  if (options.template) runOptions.templateRoot = resolve(options.template);
357
+ if (options.json) runOptions.json = true;
357
358
  try {
358
359
  await runCoreDiff(runOptions);
359
360
  } catch (err) {
@@ -368,6 +369,20 @@ async function runCoreDiff(options) {
368
369
  const instanceVersion = readInstanceCoreVersion(options.cwd);
369
370
  const diff = computeCoreDiff(templateRoot, options.cwd, manifest);
370
371
  const total = diff.added.length + diff.removed.length + diff.modified.length;
372
+ if (options.json) {
373
+ const payload = {
374
+ schemaVersion: 1,
375
+ instanceCore: instanceVersion ?? null,
376
+ templateCore: templateVersion,
377
+ modified: diff.modified,
378
+ added: diff.added,
379
+ removed: diff.removed,
380
+ instanceOnly: diff.instanceOnly,
381
+ unchanged: diff.unchanged
382
+ };
383
+ console.log(JSON.stringify(payload, null, 2));
384
+ return;
385
+ }
371
386
  console.log(chalk2.bold("\n Biffo core diff\n"));
372
387
  console.log(` instance core: ${instanceVersion ?? chalk2.dim("(unrecorded)")}`);
373
388
  console.log(` template core: ${templateVersion}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@biffo/cli",
3
- "version": "0.148.2",
3
+ "version": "0.149.0",
4
4
  "description": "Biffo project scaffolding CLI",
5
5
  "license": "MIT",
6
6
  "type": "module",