@biffo/cli 0.136.1 → 0.136.2

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 +26 -3
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -297,10 +297,18 @@ function listTemplateOwnedFiles(root, manifest) {
297
297
  function sameFile(a, b) {
298
298
  return readFileSync2(a).equals(readFileSync2(b));
299
299
  }
300
- function computeCoreDiff(templateRoot, instanceRoot, manifest) {
300
+ function computeCoreDiff(templateRoot, instanceRoot, manifest, baseRoot) {
301
301
  const templateFiles = new Set(listTemplateOwnedFiles(templateRoot, manifest));
302
302
  const instanceFiles = new Set(listTemplateOwnedFiles(instanceRoot, manifest));
303
- const diff = { added: [], removed: [], modified: [], unchanged: 0, entries: [] };
303
+ const baseFiles = baseRoot ? new Set(listTemplateOwnedFiles(baseRoot, manifest)) : void 0;
304
+ const diff = {
305
+ added: [],
306
+ removed: [],
307
+ instanceOnly: [],
308
+ modified: [],
309
+ unchanged: 0,
310
+ entries: []
311
+ };
304
312
  for (const rel of [...templateFiles].sort()) {
305
313
  if (!instanceFiles.has(rel)) {
306
314
  diff.added.push(rel);
@@ -313,9 +321,13 @@ function computeCoreDiff(templateRoot, instanceRoot, manifest) {
313
321
  }
314
322
  }
315
323
  for (const rel of [...instanceFiles].sort()) {
316
- if (!templateFiles.has(rel)) {
324
+ if (templateFiles.has(rel)) continue;
325
+ if (baseFiles?.has(rel)) {
317
326
  diff.removed.push(rel);
318
327
  diff.entries.push({ path: rel, kind: "removed" });
328
+ } else {
329
+ diff.instanceOnly.push(rel);
330
+ diff.entries.push({ path: rel, kind: "instance-only" });
319
331
  }
320
332
  }
321
333
  return diff;
@@ -367,6 +379,17 @@ async function runCoreDiff(options) {
367
379
  printGroup("modified", diff.modified, chalk2.yellow);
368
380
  printGroup("added", diff.added, chalk2.green);
369
381
  printGroup("removed", diff.removed, chalk2.red);
382
+ printGroup("instance-only", diff.instanceOnly, chalk2.cyan);
383
+ if (diff.instanceOnly.length > 0) {
384
+ console.log(
385
+ chalk2.dim(
386
+ ` ${diff.instanceOnly.length} instance-only file(s): present here, never in the template.
387
+ An upgrade leaves these alone \u2014 it deletes a path only when the template
388
+ shipped it and later dropped it. They are not pending changes.
389
+ `
390
+ )
391
+ );
392
+ }
370
393
  console.log(
371
394
  `
372
395
  ${chalk2.bold(String(total))} template-owned file(s) would change (${diff.modified.length} modified, ${diff.added.length} added, ${diff.removed.length} removed); ${chalk2.dim(String(diff.unchanged) + " unchanged")}.`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@biffo/cli",
3
- "version": "0.136.1",
3
+ "version": "0.136.2",
4
4
  "description": "Biffo project scaffolding CLI",
5
5
  "license": "MIT",
6
6
  "type": "module",