ddd-ts-kit 0.84.0 → 0.85.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.
- package/CHANGELOG.md +50 -0
- package/README.fr.md +60 -27
- package/README.md +57 -28
- package/dist/check/canonical/stray-entry.js +3 -2
- package/dist/check/canonical/stray-entry.js.map +1 -1
- package/dist/check/explain/layout-docs.js +1 -1
- package/dist/check/explain/layout-docs.js.map +1 -1
- package/dist/check/explain/tree-docs.d.ts.map +1 -1
- package/dist/check/explain/tree-docs.js +3 -2
- package/dist/check/explain/tree-docs.js.map +1 -1
- package/dist/check/explain/wiring-docs.d.ts.map +1 -1
- package/dist/check/explain/wiring-docs.js +17 -6
- package/dist/check/explain/wiring-docs.js.map +1 -1
- package/dist/check/fixtures/authz-policy-fixtures.d.ts.map +1 -1
- package/dist/check/fixtures/authz-policy-fixtures.js +4 -4
- package/dist/check/fixtures/authz-policy-fixtures.js.map +1 -1
- package/dist/check/fixtures/constructor-injection-fixtures.d.ts.map +1 -1
- package/dist/check/fixtures/constructor-injection-fixtures.js +10 -8
- package/dist/check/fixtures/constructor-injection-fixtures.js.map +1 -1
- package/dist/check/fixtures/declarations-fixtures.d.ts.map +1 -1
- package/dist/check/fixtures/declarations-fixtures.js +54 -9
- package/dist/check/fixtures/declarations-fixtures.js.map +1 -1
- package/dist/check/fixtures/declared-declarations.d.ts +7 -0
- package/dist/check/fixtures/declared-declarations.d.ts.map +1 -0
- package/dist/check/fixtures/declared-declarations.js +21 -0
- package/dist/check/fixtures/declared-declarations.js.map +1 -0
- package/dist/check/fixtures/declared-project.d.ts +4 -1
- package/dist/check/fixtures/declared-project.d.ts.map +1 -1
- package/dist/check/fixtures/declared-project.js +17 -9
- package/dist/check/fixtures/declared-project.js.map +1 -1
- package/dist/check/fixtures/paths.d.ts +1 -0
- package/dist/check/fixtures/paths.d.ts.map +1 -1
- package/dist/check/fixtures/paths.js +1 -0
- package/dist/check/fixtures/paths.js.map +1 -1
- package/dist/check/fixtures/signature-project.d.ts +3 -3
- package/dist/check/fixtures/signature-project.js +3 -3
- package/dist/check/fixtures/signature.d.ts +2 -1
- package/dist/check/fixtures/signature.d.ts.map +1 -1
- package/dist/check/fixtures/signature.js +2 -1
- package/dist/check/fixtures/signature.js.map +1 -1
- package/dist/check/fixtures/single-file-declarations.d.ts +7 -0
- package/dist/check/fixtures/single-file-declarations.d.ts.map +1 -0
- package/dist/check/fixtures/single-file-declarations.js +21 -0
- package/dist/check/fixtures/single-file-declarations.js.map +1 -0
- package/dist/check/rules/clean-file-size.d.ts.map +1 -1
- package/dist/check/rules/clean-file-size.js +9 -1
- package/dist/check/rules/clean-file-size.js.map +1 -1
- package/dist/check/rules/declarations-barrel-current.d.ts.map +1 -1
- package/dist/check/rules/declarations-barrel-current.js +56 -23
- package/dist/check/rules/declarations-barrel-current.js.map +1 -1
- package/dist/check/rules/naming-suffix.d.ts.map +1 -1
- package/dist/check/rules/naming-suffix.js +7 -3
- package/dist/check/rules/naming-suffix.js.map +1 -1
- package/dist/check/support/is-generated-context-file.d.ts +5 -1
- package/dist/check/support/is-generated-context-file.d.ts.map +1 -1
- package/dist/check/support/is-generated-context-file.js +11 -5
- package/dist/check/support/is-generated-context-file.js.map +1 -1
- package/dist/commands/docs.d.ts.map +1 -1
- package/dist/commands/docs.js +23 -11
- package/dist/commands/docs.js.map +1 -1
- package/dist/commands/generate.d.ts.map +1 -1
- package/dist/commands/generate.js +7 -4
- package/dist/commands/generate.js.map +1 -1
- package/dist/commands/print-report.js +1 -0
- package/dist/commands/print-report.js.map +1 -1
- package/dist/commit/is-derived.js +4 -4
- package/dist/commit/is-derived.js.map +1 -1
- package/dist/declared/barrel-file.d.ts +4 -1
- package/dist/declared/barrel-file.d.ts.map +1 -1
- package/dist/declared/barrel-file.js +4 -1
- package/dist/declared/barrel-file.js.map +1 -1
- package/dist/declared/context-declarations.d.ts +24 -0
- package/dist/declared/context-declarations.d.ts.map +1 -0
- package/dist/declared/context-declarations.js +22 -0
- package/dist/declared/context-declarations.js.map +1 -0
- package/dist/declared/declarations-folder-of.d.ts +10 -0
- package/dist/declared/declarations-folder-of.d.ts.map +1 -0
- package/dist/declared/declarations-folder-of.js +13 -0
- package/dist/declared/declarations-folder-of.js.map +1 -0
- package/dist/declared/folder-declarations-file.d.ts +7 -0
- package/dist/declared/folder-declarations-file.d.ts.map +1 -0
- package/dist/declared/folder-declarations-file.js +10 -0
- package/dist/declared/folder-declarations-file.js.map +1 -0
- package/dist/declared/index.d.ts +8 -1
- package/dist/declared/index.d.ts.map +1 -1
- package/dist/declared/index.js +8 -1
- package/dist/declared/index.js.map +1 -1
- package/dist/declared/is-declarations-file.d.ts +7 -0
- package/dist/declared/is-declarations-file.d.ts.map +1 -0
- package/dist/declared/is-declarations-file.js +20 -0
- package/dist/declared/is-declarations-file.js.map +1 -0
- package/dist/declared/keeps-single-file.d.ts +11 -0
- package/dist/declared/keeps-single-file.d.ts.map +1 -0
- package/dist/declared/keeps-single-file.js +23 -0
- package/dist/declared/keeps-single-file.js.map +1 -0
- package/dist/declared/render-declarations.d.ts +18 -0
- package/dist/declared/render-declarations.d.ts.map +1 -0
- package/dist/declared/render-declarations.js +37 -0
- package/dist/declared/render-declarations.js.map +1 -0
- package/dist/declared/render-folder-declarations.d.ts +11 -0
- package/dist/declared/render-folder-declarations.d.ts.map +1 -0
- package/dist/declared/render-folder-declarations.js +23 -0
- package/dist/declared/render-folder-declarations.js.map +1 -0
- package/dist/declared/single-file-declarations.d.ts +9 -0
- package/dist/declared/single-file-declarations.d.ts.map +1 -0
- package/dist/declared/single-file-declarations.js +14 -0
- package/dist/declared/single-file-declarations.js.map +1 -0
- package/dist/declared/single-file-notice.d.ts +8 -0
- package/dist/declared/single-file-notice.d.ts.map +1 -0
- package/dist/declared/single-file-notice.js +9 -0
- package/dist/declared/single-file-notice.js.map +1 -0
- package/dist/derived/is-derived.d.ts +4 -3
- package/dist/derived/is-derived.d.ts.map +1 -1
- package/dist/derived/is-derived.js +8 -8
- package/dist/derived/is-derived.js.map +1 -1
- package/dist/describe/read-consumed-events.js +7 -2
- package/dist/describe/read-consumed-events.js.map +1 -1
- package/dist/dev/refresh-declarations.d.ts.map +1 -1
- package/dist/dev/refresh-declarations.js +3 -2
- package/dist/dev/refresh-declarations.js.map +1 -1
- package/dist/docs/write-docs.d.ts +3 -1
- package/dist/docs/write-docs.d.ts.map +1 -1
- package/dist/docs/write-docs.js +4 -2
- package/dist/docs/write-docs.js.map +1 -1
- package/dist/generate/context-imports.d.ts.map +1 -1
- package/dist/generate/context-imports.js +2 -1
- package/dist/generate/context-imports.js.map +1 -1
- package/dist/generate/kind.d.ts +2 -0
- package/dist/generate/kind.d.ts.map +1 -1
- package/dist/generate/kinds/e2e/reaction-of.d.ts +14 -0
- package/dist/generate/kinds/e2e/reaction-of.d.ts.map +1 -0
- package/dist/generate/kinds/e2e/reaction-of.js +93 -0
- package/dist/generate/kinds/e2e/reaction-of.js.map +1 -0
- package/dist/generate/kinds/e2e-kind.d.ts.map +1 -1
- package/dist/generate/kinds/e2e-kind.js +30 -18
- package/dist/generate/kinds/e2e-kind.js.map +1 -1
- package/dist/generate/refresh-barrels.d.ts +11 -4
- package/dist/generate/refresh-barrels.d.ts.map +1 -1
- package/dist/generate/refresh-barrels.js +41 -15
- package/dist/generate/refresh-barrels.js.map +1 -1
- package/dist/generate/refuse-shared-writes.js +1 -1
- package/dist/generate/refuse-shared-writes.js.map +1 -1
- package/dist/help/notes.d.ts +1 -1
- package/dist/help/notes.d.ts.map +1 -1
- package/dist/help/notes.js +19 -16
- package/dist/help/notes.js.map +1 -1
- package/dist/init/manifest/versions.js +24 -24
- package/dist/merge/classify-conflict.d.ts +2 -1
- package/dist/merge/classify-conflict.d.ts.map +1 -1
- package/dist/merge/classify-conflict.js +9 -0
- package/dist/merge/classify-conflict.js.map +1 -1
- package/dist/merge/higher-version.d.ts +7 -0
- package/dist/merge/higher-version.d.ts.map +1 -0
- package/dist/merge/higher-version.js +59 -0
- package/dist/merge/higher-version.js.map +1 -0
- package/dist/merge/merge-client-manifest.d.ts +16 -0
- package/dist/merge/merge-client-manifest.d.ts.map +1 -0
- package/dist/merge/merge-client-manifest.js +39 -0
- package/dist/merge/merge-client-manifest.js.map +1 -0
- package/dist/merge/merge-exclusions.d.ts +4 -3
- package/dist/merge/merge-exclusions.d.ts.map +1 -1
- package/dist/merge/merge-exclusions.js +6 -3
- package/dist/merge/merge-exclusions.js.map +1 -1
- package/dist/merge/resolve-conflict.d.ts +3 -2
- package/dist/merge/resolve-conflict.d.ts.map +1 -1
- package/dist/merge/resolve-conflict.js +29 -7
- package/dist/merge/resolve-conflict.js.map +1 -1
- package/dist/plan/batched-waves.d.ts +2 -0
- package/dist/plan/batched-waves.d.ts.map +1 -1
- package/dist/plan/batched-waves.js +20 -7
- package/dist/plan/batched-waves.js.map +1 -1
- package/dist/plan/format-plan.d.ts +1 -1
- package/dist/plan/format-plan.d.ts.map +1 -1
- package/dist/plan/format-plan.js +33 -8
- package/dist/plan/format-plan.js.map +1 -1
- package/dist/plan/other-stories.d.ts +9 -0
- package/dist/plan/other-stories.d.ts.map +1 -0
- package/dist/plan/other-stories.js +31 -0
- package/dist/plan/other-stories.js.map +1 -0
- package/dist/plan/plan-waves.d.ts +2 -1
- package/dist/plan/plan-waves.d.ts.map +1 -1
- package/dist/plan/plan-waves.js +13 -4
- package/dist/plan/plan-waves.js.map +1 -1
- package/dist/plan/wave-plan.d.ts +28 -0
- package/dist/plan/wave-plan.d.ts.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/worker/briefing-of.js +4 -2
- package/dist/worker/briefing-of.js.map +1 -1
- package/dist/workspace/workspace-report.d.ts +2 -0
- package/dist/workspace/workspace-report.d.ts.map +1 -1
- package/dist/workspace/workspace.d.ts +8 -0
- package/dist/workspace/workspace.d.ts.map +1 -1
- package/dist/workspace/workspace.js +24 -3
- package/dist/workspace/workspace.js.map +1 -1
- package/package.json +2 -2
- package/templates/e2e/e2e-reaction.spec.ts.tpl +68 -0
- package/templates/init/AGENTS.md.tpl +1 -1
- package/templates/init/README.md.tpl +2 -1
- package/templates/init/e2e/start-application.database.ts.tpl +22 -2
- package/templates/init/e2e/start-application.memory.ts.tpl +22 -2
- package/templates/init/platform/events/custom-event-bus.ts.tpl +1 -1
- package/templates/init/platform/events/in-process-events.ts.tpl +1 -1
- package/templates/init/rules/tests.md.tpl +1 -1
- package/templates/pipeline/biome.json.tpl +1 -0
- package/templates/pipeline/github/actions/setup/action.yml.tpl +3 -0
- package/templates/pipeline/github/workflows/ci.yml.tpl +12 -12
- package/templates/pipeline/github/workflows/codeql.yml +1 -1
- package/templates/pipeline/github/workflows/copilot-setup-steps.yml +1 -1
- package/templates/pipeline/github/workflows/pr-title.yml +1 -1
- package/templates/pipeline/package-scripts.json +1 -1
- package/templates/presets/identity/context/test/worlds/__context__.world.ts.tpl +1 -0
- package/templates/test-world/world.buses.ts.tpl +1 -1
- package/templates/test-world/world.tsyringe.ts.tpl +1 -0
- package/dist/check/fixtures/declared-barrel.d.ts +0 -3
- package/dist/check/fixtures/declared-barrel.d.ts.map +0 -1
- package/dist/check/fixtures/declared-barrel.js +0 -4
- package/dist/check/fixtures/declared-barrel.js.map +0 -1
- package/dist/declared/render-barrel.d.ts +0 -11
- package/dist/declared/render-barrel.d.ts.map +0 -1
- package/dist/declared/render-barrel.js +0 -29
- package/dist/declared/render-barrel.js.map +0 -1
|
@@ -10,6 +10,8 @@ const SPLIT_BY_RESPONSIBILITY = 'Split it by responsibility: move each concept (
|
|
|
10
10
|
* out is a decision, computed elsewhere and applied by the aggregate.
|
|
11
11
|
*/
|
|
12
12
|
const SPLIT_AN_AGGREGATE = 'Move a decision out of the aggregate: a domain service of domain/services/ that takes the state (or a value of it) and returns the new state and its events, which the aggregate applies in its intention method; a value object for fields that travel together, with their rules; an entity for a part with its own identity. Never a public method that sets the state from outside, and never a shortened comment, test or written rule.';
|
|
13
|
+
/** An end-to-end spec splits into parts named after it: a generator cannot write them, the guard lets that name through. */
|
|
14
|
+
const SPLIT_AN_E2E_SPEC = 'Split it by behaviour into parts named after it, beside it: test/e2e/<use-case>-<behaviour>.e2e.spec.ts next to test/e2e/<use-case>.e2e.spec.ts (the guard lets that name be written by hand), each part with its own describe. Move what the parts share (signing a person in, a world) to test/e2e/support/<context>/ instead of copying it.';
|
|
13
15
|
export const cleanFileSize = {
|
|
14
16
|
id: 'clean/file-size',
|
|
15
17
|
description: `A file is at most ${MAX_FILE_LINES} lines, sources and tests alike, under the source root, \`test/\` (end-to-end specs included) and \`scripts/\`: past that it holds more than one responsibility.`,
|
|
@@ -31,10 +33,16 @@ function tooLong(file) {
|
|
|
31
33
|
{
|
|
32
34
|
line: MAX_FILE_LINES + 1,
|
|
33
35
|
message: `The file is ${lines} lines long (limit ${MAX_FILE_LINES}).`,
|
|
34
|
-
fix: file.path
|
|
36
|
+
fix: fixFor(file.path),
|
|
35
37
|
},
|
|
36
38
|
];
|
|
37
39
|
}
|
|
40
|
+
function fixFor(path) {
|
|
41
|
+
if (path.endsWith('.aggregate.ts')) {
|
|
42
|
+
return SPLIT_AN_AGGREGATE;
|
|
43
|
+
}
|
|
44
|
+
return path.endsWith('.e2e.spec.ts') ? SPLIT_AN_E2E_SPEC : SPLIT_BY_RESPONSIBILITY;
|
|
45
|
+
}
|
|
38
46
|
/** A file written by a tool: under a directory named `generated`, or the barrel or dependency file of a context. */
|
|
39
47
|
function isGenerated(file) {
|
|
40
48
|
return file.path.split('/').includes('generated') || isGeneratedContextFile(file);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clean-file-size.js","sourceRoot":"","sources":["../../../src/check/rules/clean-file-size.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,sBAAsB,EAAE,MAAM,yCAAyC,CAAC;AACjF,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;A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I,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAEhF,IAAI,KAAK,IAAI,cAAc,IAAI,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC;QACjD,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,OAAO;QACL;YACE,IAAI,EAAE,cAAc,GAAG,CAAC;YACxB,OAAO,EAAE,eAAe,KAAK,sBAAsB,cAAc,IAAI;YACrE,GAAG,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC;SACvB;KACF,CAAC;AACJ,CAAC;AAED,SAAS,MAAM,CAAC,IAAY;IAC1B,IAAI,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC,EAAE,CAAC;QACnC,OAAO,kBAAkB,CAAC;IAC5B,CAAC;IAED,OAAO,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,uBAAuB,CAAC;AACrF,CAAC;AAED,oHAAoH;AACpH,SAAS,WAAW,CAAC,IAAgB;IACnC,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,IAAI,sBAAsB,CAAC,IAAI,CAAC,CAAC;AACpF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"declarations-barrel-current.d.ts","sourceRoot":"","sources":["../../../src/check/rules/declarations-barrel-current.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"declarations-barrel-current.d.ts","sourceRoot":"","sources":["../../../src/check/rules/declarations-barrel-current.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAe7C,eAAO,MAAM,yBAAyB,EAAE,IAyBvC,CAAC"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { specifierOf } from '../../alias/index.js';
|
|
2
|
-
import { barrelFile, contextInjections, dependenciesFile, generatedDrift,
|
|
2
|
+
import { barrelFile, contextDeclarations, contextInjections, dependenciesFile, generatedDrift, isDeclarationsFile, keepsSingleFile, renderDependenciesFile, renderInjections, singleFileNotice, } from '../../declared/index.js';
|
|
3
3
|
import { sourceAt } from '../project/source-at.js';
|
|
4
4
|
import { isDeclaredStyle } from '../support/is-declared-style.js';
|
|
5
5
|
import { reporter } from '../support/reporter.js';
|
|
6
6
|
const REGENERATE = 'Run `ddd-ts-kit docs`, or `ddd-ts-kit generate` again, which rewrite it: the file is derived from the role files of the context and from their constructor signatures, and never edited by hand.';
|
|
7
7
|
export const declarationsBarrelCurrent = {
|
|
8
8
|
id: 'declarations/barrel-current',
|
|
9
|
-
description: 'In the declared style, the generated
|
|
9
|
+
description: 'In the declared style, the generated files of a context are what its tree says: with a barrel, the <folder>.declarations.ts of each role folder lists exactly its role files and registers the dependency list read from each constructor, and <context>.declarations.ts re-exports those files; under discovery <context>.dependencies.ts registers the lists alone.',
|
|
10
10
|
scope: 'project',
|
|
11
11
|
run(project) {
|
|
12
12
|
if (!isDeclaredStyle(project)) {
|
|
@@ -16,48 +16,81 @@ export const declarationsBarrelCurrent = {
|
|
|
16
16
|
return project.contextsOnDisk
|
|
17
17
|
.filter((context) => project.config.contexts[context] !== undefined)
|
|
18
18
|
.flatMap((context) => judge(project, context))
|
|
19
|
-
.flatMap(({ file, flaw }) =>
|
|
19
|
+
.flatMap(({ file, flaw, severity }) => {
|
|
20
|
+
if (flaw === undefined) {
|
|
21
|
+
return [];
|
|
22
|
+
}
|
|
23
|
+
const violation = report({ file, line: 1 }, flaw.message, flaw.fix);
|
|
24
|
+
return [severity === undefined ? violation : { ...violation, severity }];
|
|
25
|
+
});
|
|
20
26
|
},
|
|
21
27
|
};
|
|
22
28
|
function judge(project, context) {
|
|
23
29
|
const directory = `${project.config.contextsDir}/${context}`;
|
|
24
|
-
const barrel = `${directory}/${barrelFile(context)}`;
|
|
25
30
|
const entries = entriesOf(project, context);
|
|
26
|
-
const
|
|
27
|
-
const
|
|
31
|
+
const specifierOfFile = (file) => specifierOf(project.config, file);
|
|
32
|
+
const sources = (file) => sourceAt(project, file);
|
|
28
33
|
if (project.config.stack.assembly === 'discovery') {
|
|
29
|
-
const
|
|
34
|
+
const injected = renderInjections(contextInjections(sources, directory, entries), specifierOfFile);
|
|
35
|
+
const lists = { name: `dependency lists of "${context}"`, expected: renderDependenciesFile(injected) };
|
|
36
|
+
const generated = entries.filter((entry) => isDeclarationsFile(context, entry));
|
|
30
37
|
return [
|
|
31
|
-
{ file:
|
|
32
|
-
{
|
|
38
|
+
...generated.map((entry) => ({ file: `${directory}/${entry}`, flaw: leftBehind(context, entry) })),
|
|
39
|
+
{
|
|
40
|
+
file: `${directory}/${dependenciesFile(context)}`,
|
|
41
|
+
flaw: stale(project, context, { ...lists, file: dependenciesFile(context), optional: true }),
|
|
42
|
+
},
|
|
33
43
|
];
|
|
34
44
|
}
|
|
35
|
-
|
|
36
|
-
|
|
45
|
+
return judgeDeclarations(project, { context, directory, entries, sources, specifierOf: specifierOfFile });
|
|
46
|
+
}
|
|
47
|
+
/** With a barrel: the declarations of each role folder and their summary, or the single file of 0.84 while it is current. */
|
|
48
|
+
function judgeDeclarations(project, declared) {
|
|
49
|
+
const { context, directory, entries } = declared;
|
|
50
|
+
const { files } = contextDeclarations(declared);
|
|
51
|
+
const judged = [
|
|
52
|
+
...[...files].map(([entry, expected]) => ({
|
|
53
|
+
file: `${directory}/${entry}`,
|
|
54
|
+
flaw: stale(project, context, { name: nameOf(context, entry), file: entry, expected, optional: false }),
|
|
55
|
+
})),
|
|
56
|
+
...entries
|
|
57
|
+
.filter((entry) => isDeclarationsFile(context, entry) && !files.has(entry))
|
|
58
|
+
.map((entry) => ({ file: `${directory}/${entry}`, flaw: emptied(context, entry) })),
|
|
59
|
+
];
|
|
60
|
+
const barrel = `${directory}/${barrelFile(context)}`;
|
|
61
|
+
if (judged.some(({ flaw }) => flaw !== undefined) && keepsSingleFile(declared, writtenIn(project, barrel))) {
|
|
62
|
+
return [{ file: barrel, flaw: singleFileNotice(context), severity: 'warn' }];
|
|
63
|
+
}
|
|
64
|
+
return judged;
|
|
65
|
+
}
|
|
66
|
+
function nameOf(context, entry) {
|
|
67
|
+
return entry === barrelFile(context)
|
|
68
|
+
? `declarations of "${context}"`
|
|
69
|
+
: `declarations of "${context}" in ${entry.slice(0, entry.lastIndexOf('/'))}/`;
|
|
37
70
|
}
|
|
38
|
-
function stale(project, context, { name, expected, optional }) {
|
|
39
|
-
const file = name === 'barrel' ? barrelFile(context) : dependenciesFile(context);
|
|
71
|
+
function stale(project, context, { name, file, expected, optional }) {
|
|
40
72
|
const written = writtenIn(project, `${project.config.contextsDir}/${context}/${file}`);
|
|
41
73
|
if (written === expected || (written === undefined && optional && expected === 'export {};\n')) {
|
|
42
74
|
return undefined;
|
|
43
75
|
}
|
|
44
76
|
if (written === undefined) {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
fix: REGENERATE,
|
|
48
|
-
};
|
|
77
|
+
const lacks = file === dependenciesFile(context) ? 'inject its constructors from' : 'assemble these classes from';
|
|
78
|
+
return { message: `The ${name} are missing: the composition root has nothing to ${lacks}.`, fix: REGENERATE };
|
|
49
79
|
}
|
|
50
|
-
return {
|
|
51
|
-
message: `The ${name} of "${context}" ${name === 'barrel' ? 'is' : 'are'} stale: ${generatedDrift(written, expected)}.`,
|
|
52
|
-
fix: REGENERATE,
|
|
53
|
-
};
|
|
80
|
+
return { message: `The ${name} are stale: ${generatedDrift(written, expected)}.`, fix: REGENERATE };
|
|
54
81
|
}
|
|
55
82
|
function writtenIn(project, file) {
|
|
56
83
|
return project.files.find((candidate) => candidate.path === file)?.text.replaceAll('\r\n', '\n');
|
|
57
84
|
}
|
|
58
|
-
function
|
|
85
|
+
function emptied(context, entry) {
|
|
86
|
+
return {
|
|
87
|
+
message: `${entry} of "${context}" is generated for a folder that holds no declared role file any more: nothing keeps it up to date.`,
|
|
88
|
+
fix: 'Run `ddd-ts-kit docs`, or `ddd-ts-kit generate` again, which delete it, and commit the deletion.',
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
function leftBehind(context, entry) {
|
|
59
92
|
return {
|
|
60
|
-
message:
|
|
93
|
+
message: `${entry} of "${context}" still exists although "stack.assembly" is "discovery": nothing keeps it up to date.`,
|
|
61
94
|
fix: `Delete it and assemble ${context} with discoverContext('${context}', <directory>), or set "stack.assembly" to "barrel" and run \`ddd-ts-kit generate\` again.`,
|
|
62
95
|
};
|
|
63
96
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"declarations-barrel-current.js","sourceRoot":"","sources":["../../../src/check/rules/declarations-barrel-current.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EACL,UAAU,EACV,iBAAiB,EACjB,gBAAgB,EAChB,cAAc,
|
|
1
|
+
{"version":3,"file":"declarations-barrel-current.js","sourceRoot":"","sources":["../../../src/check/rules/declarations-barrel-current.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EACL,UAAU,EACV,mBAAmB,EACnB,iBAAiB,EACjB,gBAAgB,EAChB,cAAc,EAEd,kBAAkB,EAClB,eAAe,EACf,sBAAsB,EACtB,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,yBAAyB,CAAC;AAIjC,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAElD,MAAM,UAAU,GACd,kMAAkM,CAAC;AASrM,MAAM,CAAC,MAAM,yBAAyB,GAAS;IAC7C,EAAE,EAAE,6B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AO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,IAAI,KAAK,IAAI,CAAC,EAAE,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;AACnG,CAAC;AAED,SAAS,OAAO,CAAC,OAAe,EAAE,KAAa;IAC7C,OAAO;QACL,OAAO,EAAE,GAAG,KAAK,QAAQ,OAAO,qGAAqG;QACrI,GAAG,EAAE,kGAAkG;KACxG,CAAC;AACJ,CAAC;AAED,SAAS,UAAU,CAAC,OAAe,EAAE,KAAa;IAChD,OAAO;QACL,OAAO,EAAE,GAAG,KAAK,QAAQ,OAAO,uFAAuF;QACvH,GAAG,EAAE,0BAA0B,OAAO,0BAA0B,OAAO,6FAA6F;KACrK,CAAC;AACJ,CAAC;AAED,8CAA8C;AAC9C,SAAS,SAAS,CAAC,OAAgB,EAAE,OAAe;IAClD,MAAM,MAAM,GAAG,GAAG,OAAO,CAAC,MAAM,CAAC,WAAW,IAAI,OAAO,GAAG,CAAC;IAE3D,OAAO,OAAO,CAAC,cAAc;SAC1B,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;SACnE,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;AAChD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"naming-suffix.d.ts","sourceRoot":"","sources":["../../../src/check/rules/naming-suffix.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"naming-suffix.d.ts","sourceRoot":"","sources":["../../../src/check/rules/naming-suffix.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAQ7C,eAAO,MAAM,YAAY,EAAE,IA8B1B,CAAC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
|
-
import { routesFile } from '../../declared/index.js';
|
|
2
|
+
import { isDeclarationsFile, routesFile } from '../../declared/index.js';
|
|
3
3
|
import { roleOf } from '../canonical/role-of.js';
|
|
4
4
|
import { inContext } from '../support/in-context.js';
|
|
5
|
+
import { isDeclaredStyle } from '../support/is-declared-style.js';
|
|
5
6
|
import { KEBAB_SEGMENT } from '../support/kebab-segment.js';
|
|
6
7
|
import { pathInContext } from '../support/path-in-context.js';
|
|
7
8
|
import { perFile } from '../support/per-file.js';
|
|
@@ -19,8 +20,11 @@ export const namingSuffix = {
|
|
|
19
20
|
if (name === 'index.ts') {
|
|
20
21
|
return [];
|
|
21
22
|
}
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
const relative = pathInContext(project, file) ?? '';
|
|
24
|
+
const generated = isDeclaredStyle(project) && isDeclarationsFile(file.location.context, relative);
|
|
25
|
+
// The routes of a context are one list named after it instead of a role, in either style;
|
|
26
|
+
// the generated declarations of a role folder are named after the folder.
|
|
27
|
+
if (relative === routesFile(file.location.context) || generated) {
|
|
24
28
|
return [];
|
|
25
29
|
}
|
|
26
30
|
const flaw = notKebab(name) ?? withoutSuffix(name, file.location);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"naming-suffix.js","sourceRoot":"","sources":["../../../src/check/rules/naming-suffix.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"naming-suffix.js","sourceRoot":"","sources":["../../../src/check/rules/naming-suffix.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAA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C,IAAI,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;QACzF,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,OAAO;QACL,OAAO,EAAE,IAAI,IAAI,aAAa,SAAS,oCAAoC;QAC3E,GAAG,EAAE,yBAAyB,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,oDAAoD;KAC7G,CAAC;AACJ,CAAC"}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import type { SourceFile } from '../model/source-file.js';
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* The generated files of a declared context: the declarations of each role folder and their
|
|
4
|
+
* summary at its root, or `<context>.dependencies.ts`; `declarations/barrel-current` holds every
|
|
5
|
+
* line of them.
|
|
6
|
+
*/
|
|
3
7
|
export declare function isGeneratedContextFile(file: SourceFile): boolean;
|
|
4
8
|
//# sourceMappingURL=is-generated-context-file.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"is-generated-context-file.d.ts","sourceRoot":"","sources":["../../../src/check/support/is-generated-context-file.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAE1D
|
|
1
|
+
{"version":3,"file":"is-generated-context-file.d.ts","sourceRoot":"","sources":["../../../src/check/support/is-generated-context-file.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAE1D;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAahE"}
|
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
|
-
import {
|
|
3
|
-
/**
|
|
2
|
+
import { dependenciesFile, isDeclarationsFile } from '../../declared/index.js';
|
|
3
|
+
/**
|
|
4
|
+
* The generated files of a declared context: the declarations of each role folder and their
|
|
5
|
+
* summary at its root, or `<context>.dependencies.ts`; `declarations/barrel-current` holds every
|
|
6
|
+
* line of them.
|
|
7
|
+
*/
|
|
4
8
|
export function isGeneratedContextFile(file) {
|
|
5
|
-
const name = path.posix.basename(file.path);
|
|
6
9
|
const { location } = file;
|
|
7
|
-
if (location.area !== 'context'
|
|
10
|
+
if (location.area !== 'context') {
|
|
8
11
|
return false;
|
|
9
12
|
}
|
|
10
|
-
|
|
13
|
+
const inContext = location.layer === 'root' && location.inside.length === 0
|
|
14
|
+
? path.posix.basename(file.path)
|
|
15
|
+
: [location.layer, ...location.inside].join('/');
|
|
16
|
+
return isDeclarationsFile(location.context, inContext) || inContext === dependenciesFile(location.context);
|
|
11
17
|
}
|
|
12
18
|
//# sourceMappingURL=is-generated-context-file.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"is-generated-context-file.js","sourceRoot":"","sources":["../../../src/check/support/is-generated-context-file.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"is-generated-context-file.js","sourceRoot":"","sources":["../../../src/check/support/is-generated-context-file.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAG/E;;;;GAIG;AACH,MAAM,UAAU,sBAAsB,CAAC,IAAgB;IACrD,MAAM,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC;IAE1B,IAAI,QAAQ,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;QAChC,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,SAAS,GACb,QAAQ,CAAC,KAAK,KAAK,MAAM,IAAI,QAAQ,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC;QACvD,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC;QAChC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,EAAE,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAErD,OAAO,kBAAkB,CAAC,QAAQ,CAAC,OAAO,EAAE,SAAS,CAAC,IAAI,SAAS,KAAK,gBAAgB,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;AAC7G,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docs.d.ts","sourceRoot":"","sources":["../../src/commands/docs.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAI5C,eAAO,MAAM,WAAW,EAAE,
|
|
1
|
+
{"version":3,"file":"docs.d.ts","sourceRoot":"","sources":["../../src/commands/docs.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAI5C,eAAO,MAAM,WAAW,EAAE,OA2BzB,CAAC"}
|
package/dist/commands/docs.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import fs from 'node:fs';
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import { readConfig } from '../config/index.js';
|
|
4
|
-
import { generatedDrift } from '../declared/index.js';
|
|
4
|
+
import { barrelFile, generatedDrift, singleFileNotice } from '../declared/index.js';
|
|
5
5
|
import { readContexts } from '../docs/read-contexts.js';
|
|
6
6
|
import { writeDocs } from '../docs/write-docs.js';
|
|
7
7
|
import { STORED_EVENTS_LOCK } from '../check/event-sourcing/stored-events-lock-file.js';
|
|
@@ -20,37 +20,46 @@ export const docsCommand = (argv, io) => {
|
|
|
20
20
|
});
|
|
21
21
|
const ws = new Workspace(args.projectRoot, false);
|
|
22
22
|
const { config } = readConfig(args.projectRoot);
|
|
23
|
-
|
|
23
|
+
const check = args.flag('check');
|
|
24
|
+
// A check writes nothing: a context still declared in the single file of 0.84 is only warned about.
|
|
25
|
+
const singleFile = writeDocs(ws, config, check ? 'keep' : 'move');
|
|
24
26
|
if (args.flag('stored-events')) {
|
|
25
27
|
recordStoredEvents(ws, config);
|
|
26
28
|
}
|
|
27
|
-
if (!
|
|
29
|
+
if (!check) {
|
|
28
30
|
stopIgnoringValidation(ws, config);
|
|
29
31
|
printReport(io, args, ws.commit(args.flag('dry-run')));
|
|
30
32
|
return 0;
|
|
31
33
|
}
|
|
32
|
-
return reportCheck(io, args, { ws, config });
|
|
34
|
+
return reportCheck(io, args, { ws, config, singleFile });
|
|
33
35
|
};
|
|
34
36
|
/** `docs --check`: the generated files that would change, and the stored-event versions not recorded yet or recorded by 0.82.0 or earlier; 0 when there is none. */
|
|
35
|
-
function reportCheck(io, args, { ws, config }) {
|
|
37
|
+
function reportCheck(io, args, { ws, config, singleFile }) {
|
|
36
38
|
const report = ws.commit(true);
|
|
37
|
-
const stale = [...report.created, ...report.updated];
|
|
39
|
+
const stale = [...report.created, ...report.updated, ...report.deleted];
|
|
38
40
|
const drift = Object.fromEntries(stale.flatMap((file) => driftOf(ws.root, ws, file)));
|
|
39
41
|
const recording = args.flag('stored-events');
|
|
40
42
|
const unrecorded = recording ? [] : unrecordedStoredEvents(ws, config, contextsOnDisk(ws, config));
|
|
41
43
|
const formerlyRecorded = recording ? [] : formerlyRecordedStoredEvents(ws, config, contextsOnDisk(ws, config));
|
|
42
44
|
const ok = stale.length === 0 && unrecorded.length === 0 && formerlyRecorded.length === 0;
|
|
45
|
+
const warnings = singleFile.map((context) => singleFileWarning(config, context));
|
|
43
46
|
if (args.json) {
|
|
44
|
-
io.out(JSON.stringify({ ok, stale, drift, unrecorded, formerlyRecorded }, null, 2));
|
|
47
|
+
io.out(JSON.stringify({ ok, stale, drift, unrecorded, formerlyRecorded, warnings }, null, 2));
|
|
45
48
|
}
|
|
46
49
|
else if (ok) {
|
|
47
|
-
io.out('The generated documentation is up to date.');
|
|
50
|
+
io.out(['The generated documentation is up to date.', ...warningLines(warnings)].join('\n'));
|
|
48
51
|
}
|
|
49
52
|
else {
|
|
50
|
-
io.out(staleLines(stale, drift, { unrecorded, formerlyRecorded }).join('\n'));
|
|
53
|
+
io.out([...staleLines(stale, drift, { unrecorded, formerlyRecorded }), ...warningLines(warnings)].join('\n'));
|
|
51
54
|
}
|
|
52
55
|
return ok ? 0 : 1;
|
|
53
56
|
}
|
|
57
|
+
function singleFileWarning(config, context) {
|
|
58
|
+
return { file: `${config.contextsDir}/${context}/${barrelFile(context)}`, ...singleFileNotice(context) };
|
|
59
|
+
}
|
|
60
|
+
function warningLines(warnings) {
|
|
61
|
+
return warnings.flatMap(({ file, message, fix }) => ['', `warning ${file}: ${message}`, ` ${fix}`]);
|
|
62
|
+
}
|
|
54
63
|
function staleLines(stale, drift, { unrecorded, formerlyRecorded }) {
|
|
55
64
|
const lines = stale.map((file) => `stale ${file}${drift[file] === undefined ? '' : `: ${drift[file]}`}`);
|
|
56
65
|
const versions = unrecorded.map((version) => `unrecorded ${version} in ${STORED_EVENTS_LOCK}`);
|
|
@@ -80,10 +89,13 @@ function recordStoredEvents(ws, config) {
|
|
|
80
89
|
const GENERATED_CONTEXT_FILE = /\.(?:declarations|dependencies)\.ts$/;
|
|
81
90
|
/** What makes a generated file of a context stale, in words: the role file it misses, or the class whose constructor changed. */
|
|
82
91
|
function driftOf(root, ws, file) {
|
|
83
|
-
|
|
84
|
-
if (expected === undefined) {
|
|
92
|
+
if (!GENERATED_CONTEXT_FILE.test(file)) {
|
|
85
93
|
return [];
|
|
86
94
|
}
|
|
95
|
+
const expected = ws.read(file);
|
|
96
|
+
if (expected === undefined) {
|
|
97
|
+
return [[file, 'it is no longer generated: its folder holds no declared class']];
|
|
98
|
+
}
|
|
87
99
|
const written = fs.existsSync(path.join(root, file)) ? fs.readFileSync(path.join(root, file), 'utf8') : '';
|
|
88
100
|
return [[file, written === '' ? 'it is missing' : generatedDrift(written, expected)]];
|
|
89
101
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docs.js","sourceRoot":"","sources":["../../src/commands/docs.ts"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C,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QACvC,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,MAAM,QAAQ,GAAG,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAE/B,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;QAC3B,OAAO,CAAC,CAAC,IAAI,EAAE,+DAA+D,CAAC,CAAC,CAAC;IACnF,CAAC;IAED,MAAM,OAAO,GAAG,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAE3G,OAAO,CAAC,CAAC,IAAI,EAAE,OAAO,KAAK,EAAE,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,cAAc,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC;AACxF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../src/commands/generate.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAI5C,eAAO,MAAM,eAAe,EAAE,
|
|
1
|
+
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../src/commands/generate.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAI5C,eAAO,MAAM,eAAe,EAAE,OAwB7B,CAAC"}
|
|
@@ -24,7 +24,8 @@ export const generateCommand = (argv, io) => {
|
|
|
24
24
|
const { config } = readConfig(root);
|
|
25
25
|
keepFlatPlatform(ws, config);
|
|
26
26
|
kind.run({ ws, config, args: rest, flags: flagsOf(args) });
|
|
27
|
-
|
|
27
|
+
// A worker confined to its context leaves another context in the single declarations file of 0.84: the trunk moves it.
|
|
28
|
+
refreshDocs(ws, args.flag('local-only') ? 'keep' : 'move');
|
|
28
29
|
if (args.flag('local-only')) {
|
|
29
30
|
refuseSharedWrites(ws, config, kind.positionals[0] === 'context' ? toName(rest[0] ?? '').kebab : undefined);
|
|
30
31
|
}
|
|
@@ -64,6 +65,7 @@ const OPTIONS = {
|
|
|
64
65
|
decorators: SWITCH,
|
|
65
66
|
deviation: TEXT,
|
|
66
67
|
phase: TEXT,
|
|
68
|
+
event: TEXT,
|
|
67
69
|
group: TEXT,
|
|
68
70
|
prefix: TEXT,
|
|
69
71
|
role: TEXT,
|
|
@@ -86,15 +88,15 @@ function optionsOf(kind) {
|
|
|
86
88
|
return { ...OPTIONS, ...Object.fromEntries((kind?.textFlags ?? []).map((flag) => [flag, TEXT])) };
|
|
87
89
|
}
|
|
88
90
|
/** Keeps what is derived from the config and the tree in step with what was just scaffolded, once the project has it. */
|
|
89
|
-
function refreshDocs(ws) {
|
|
91
|
+
function refreshDocs(ws, singleFile) {
|
|
90
92
|
const config = ws.read(CONFIG_FILE);
|
|
91
93
|
if (config === undefined) {
|
|
92
94
|
return;
|
|
93
95
|
}
|
|
94
96
|
const current = parseConfig(JSON.parse(config));
|
|
95
|
-
refreshBarrels(ws, current);
|
|
97
|
+
refreshBarrels(ws, current, singleFile);
|
|
96
98
|
if (ws.exists(CONTEXT_MAP)) {
|
|
97
|
-
writeDocs(ws, current);
|
|
99
|
+
writeDocs(ws, current, singleFile);
|
|
98
100
|
}
|
|
99
101
|
// The import graph rules are derived from the config: a new context or upstream changes them.
|
|
100
102
|
if (ws.exists(DEPCRUISE_FILE)) {
|
|
@@ -138,6 +140,7 @@ const TEXT_FLAGS = [
|
|
|
138
140
|
'every',
|
|
139
141
|
'cron',
|
|
140
142
|
'phase',
|
|
143
|
+
'event',
|
|
141
144
|
'group',
|
|
142
145
|
'prefix',
|
|
143
146
|
'role',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate.js","sourceRoot":"","sources":["../../src/commands/generate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC1E,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AACtE,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEpD,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC7C,OAAO,EAAE,cAAc,
|
|
1
|
+
{"version":3,"file":"generate.js","sourceRoot":"","sources":["../../src/commands/generate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC1E,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AACtE,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEpD,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAmB,MAAM,gCAAgC,CAAC;AACjF,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AACzE,OAAO,EAAE,sBAAsB,EAAE,MAAM,yCAAyC,CAAC;AACjF,OAAO,EAAE,MAAM,EAAE,MAAM,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I,CAAC,MAAM,CAAC;QACvB,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC;QACzB,UAAU,EAAE,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC;QACnC,GAAG,UAAU,CAAC,IAAI,CAAC;KACpB,CAAC;AACJ,CAAC;AAcD,SAAS,UAAU,CAAC,IAAe;IACjC,OAAO;QACL,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC;QAC7B,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC;QACzB,SAAS,EAAE,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC;QAClC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC;QAC3B,YAAY,EAAE,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC;QACxC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC;QAC3B,UAAU,EAAE,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC;QACnC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC;QAC3B,UAAU,EAAE,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC;QACnC,YAAY,EAAE,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC;KACzC,CAAC;AACJ,CAAC"}
|
|
@@ -22,6 +22,7 @@ function fileLines(report, dryRun) {
|
|
|
22
22
|
const lines = [
|
|
23
23
|
...report.created.map((file) => `${verb('created')}${file}`),
|
|
24
24
|
...report.updated.map((file) => `${verb('updated')}${file}`),
|
|
25
|
+
...report.deleted.map((file) => `${verb('deleted')}${file}`),
|
|
25
26
|
...report.skipped.map((file) => `${'skipped'.padEnd(13)}${file} (exists; pass --force to replace it)`),
|
|
26
27
|
];
|
|
27
28
|
return lines.length > 0 ? lines : ['Nothing to do.'];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"print-report.js","sourceRoot":"","sources":["../../src/commands/print-report.ts"],"names":[],"mappings":"AAIA,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QAC5D,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,GAAG,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC,GAAG,IAAI,uCAAuC,CAAC;KACvG,CAAC;IAEF,OAAO,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC;AACvD,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { dependenciesFile, isDeclarationsFile } from '../declared/index.js';
|
|
2
2
|
import { DEPCRUISE_FILE } from '../depcruise/depcruise-file.js';
|
|
3
3
|
import { CONTEXT_MAP } from '../docs/context-map-file.js';
|
|
4
4
|
import { openApiDocumentsFile } from '../docs/open-api-documents-file.js';
|
|
@@ -12,12 +12,12 @@ export function isDerived(config, file) {
|
|
|
12
12
|
if (DERIVED_FILES.includes(file) || GENERATED_DOCUMENT.test(file) || file === openApiDocumentsFile(config)) {
|
|
13
13
|
return true;
|
|
14
14
|
}
|
|
15
|
-
const [context,
|
|
15
|
+
const [context, ...inside] = file.startsWith(`${config.contextsDir}/`)
|
|
16
16
|
? file.slice(config.contextsDir.length + 1).split('/')
|
|
17
17
|
: [];
|
|
18
|
-
if (context === undefined
|
|
18
|
+
if (context === undefined) {
|
|
19
19
|
return false;
|
|
20
20
|
}
|
|
21
|
-
return
|
|
21
|
+
return isDeclarationsFile(context, inside.join('/')) || inside.join('/') === dependenciesFile(context);
|
|
22
22
|
}
|
|
23
23
|
//# sourceMappingURL=is-derived.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"is-derived.js","sourceRoot":"","sources":["../../src/commit/is-derived.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"is-derived.js","sourceRoot":"","sources":["../../src/commit/is-derived.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EA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K,gBAAgB,CAAC,OAAO,CAAC,CAAC;AACzG,CAAC"}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* The generated summary of a declared context, relative to the context: what the composition
|
|
3
|
+
* root imports. It re-exports the declarations file of each role folder (`folderDeclarationsFile`).
|
|
4
|
+
*/
|
|
2
5
|
export declare function barrelFile(context: string): string;
|
|
3
6
|
//# sourceMappingURL=barrel-file.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"barrel-file.d.ts","sourceRoot":"","sources":["../../src/declared/barrel-file.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"barrel-file.d.ts","sourceRoot":"","sources":["../../src/declared/barrel-file.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAElD"}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* The generated summary of a declared context, relative to the context: what the composition
|
|
3
|
+
* root imports. It re-exports the declarations file of each role folder (`folderDeclarationsFile`).
|
|
4
|
+
*/
|
|
2
5
|
export function barrelFile(context) {
|
|
3
6
|
return `${context}.declarations.ts`;
|
|
4
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"barrel-file.js","sourceRoot":"","sources":["../../src/declared/barrel-file.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"barrel-file.js","sourceRoot":"","sources":["../../src/declared/barrel-file.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,UAAU,UAAU,CAAC,OAAe;IACxC,OAAO,GAAG,OAAO,kBAAkB,CAAC;AACtC,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { ClassInjection } from './injection/class-injection.js';
|
|
2
|
+
import type { Sources } from './injection/sources.js';
|
|
3
|
+
/** A declared context, read where its files are. */
|
|
4
|
+
export interface DeclaredContext {
|
|
5
|
+
readonly context: string;
|
|
6
|
+
/** The directory of the context, from the project root. */
|
|
7
|
+
readonly directory: string;
|
|
8
|
+
/** Its files, relative to it. */
|
|
9
|
+
readonly entries: readonly string[];
|
|
10
|
+
readonly sources: Sources;
|
|
11
|
+
/** How a generated import names a file given from the project root. */
|
|
12
|
+
readonly specifierOf: (file: string) => string;
|
|
13
|
+
}
|
|
14
|
+
/** The generated declarations of a context, by path relative to it, and what each of its declared classes is given. */
|
|
15
|
+
export interface ContextDeclarations {
|
|
16
|
+
readonly files: ReadonlyMap<string, string>;
|
|
17
|
+
readonly injections: readonly ClassInjection[];
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* What the generator writes for a context assembled by barrel, and what `declarations/barrel-current`
|
|
21
|
+
* compares the tree with: one declarations file per role folder and the summary at the root.
|
|
22
|
+
*/
|
|
23
|
+
export declare function contextDeclarations({ context, directory, entries, sources, specifierOf, }: DeclaredContext): ContextDeclarations;
|
|
24
|
+
//# sourceMappingURL=context-declarations.d.ts.map
|