@domain-first/project-structure 8.1.1 → 8.3.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.
@@ -0,0 +1,19 @@
1
+ # Delete
2
+
3
+ When: a module is no longer needed. Never delete module files by hand: the CLI removes every file of the module and what the generators added for it elsewhere, and refuses while anything still uses it.
4
+
5
+ ## Generate (context and Shared Kernel)
6
+
7
+ Prompts: `Module to delete:` (select, grouped by kind as in Move or rename) → `Delete?` (default No).
8
+
9
+ `… "pick:Delete" pick:orders yes`
10
+
11
+ JSON: `{ "operation": "delete", "context": "sales", "module": "query:orders" }`.
12
+
13
+ Deleted: the files of the unit, as Move or rename moves them (an aggregate with its whole folder, entities and value objects inside included). Cleaned up: an entity's or value object's `export *` in its aggregate's `index.ts`, and an aggregate's in-memory DB section with its import.
14
+
15
+ Refused while other files import the module: other modules, their wires and specs, or importers of the aggregate barrel that name an entity or value object. The CLI prints `Nothing was deleted: these files still use it.` with each `file → import` (JSON: `DELETE_NOT_ALLOWED` with `details.usedBy`) and changes nothing. Remove the uses first: delete the dependent module first, or remove the dependency from its wire and constructor together, which needs the approved plan (rule 3 exception).
16
+
17
+ ## In the plan
18
+
19
+ A delete is a row of its owner: Type `delete`, Name the module, Why the reason it goes. List the uses that have to go first under Writing by hand.
@@ -222,6 +222,7 @@ const created = [...after.keys()].filter((p) => !before.has(p)).map(rel);
222
222
  const changed = [...after.keys()]
223
223
  .filter((p) => before.has(p) && before.get(p) !== after.get(p))
224
224
  .map(rel);
225
+ const deleted = [...before.keys()].filter((p) => !after.has(p)).map(rel);
225
226
 
226
227
  const plain = stripAnsi(output);
227
228
  const answered = [...plain.matchAll(/✔\s*([^\n]*)/g)].map((m) => m[1].trim());
@@ -240,6 +241,10 @@ console.log('\ncreated:');
240
241
  for (const file of created) console.log(` + ${file}`);
241
242
  console.log('\nchanged:');
242
243
  for (const file of changed) console.log(` ~ ${file}`);
244
+ if (deleted.length) {
245
+ console.log('\ndeleted:');
246
+ for (const file of deleted) console.log(` - ${file}`);
247
+ }
243
248
  if (code !== 0 || unansweredPrompt || aborted) {
244
249
  console.log('\nraw output (tail):');
245
250
  console.log(plain.split('\n').slice(-15).join('\n'));