ddd-ts-kit 0.4.1 → 0.5.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/README.md +19 -9
- package/dist/check/catalogue/architecture-rules.d.ts.map +1 -1
- package/dist/check/catalogue/architecture-rules.js +2 -0
- package/dist/check/catalogue/architecture-rules.js.map +1 -1
- package/dist/check/configuration/config-inspection.d.ts +4 -0
- package/dist/check/configuration/config-inspection.d.ts.map +1 -1
- package/dist/check/configuration/config-inspection.js +10 -1
- package/dist/check/configuration/config-inspection.js.map +1 -1
- package/dist/check/explain/persistence-docs.d.ts +3 -0
- package/dist/check/explain/persistence-docs.d.ts.map +1 -0
- package/dist/check/explain/persistence-docs.js +14 -0
- package/dist/check/explain/persistence-docs.js.map +1 -0
- package/dist/check/explain/rule-docs.d.ts.map +1 -1
- package/dist/check/explain/rule-docs.js +2 -0
- package/dist/check/explain/rule-docs.js.map +1 -1
- package/dist/check/fixtures/fixtures.d.ts.map +1 -1
- package/dist/check/fixtures/fixtures.js +2 -0
- package/dist/check/fixtures/fixtures.js.map +1 -1
- package/dist/check/fixtures/persistence-fixtures.d.ts +3 -0
- package/dist/check/fixtures/persistence-fixtures.d.ts.map +1 -0
- package/dist/check/fixtures/persistence-fixtures.js +72 -0
- package/dist/check/fixtures/persistence-fixtures.js.map +1 -0
- package/dist/check/migrations/drizzle-history-findings.d.ts +9 -0
- package/dist/check/migrations/drizzle-history-findings.d.ts.map +1 -0
- package/dist/check/migrations/drizzle-history-findings.js +70 -0
- package/dist/check/migrations/drizzle-history-findings.js.map +1 -0
- package/dist/check/migrations/drizzle-migrations.d.ts +23 -0
- package/dist/check/migrations/drizzle-migrations.d.ts.map +1 -0
- package/dist/check/migrations/drizzle-migrations.js +2 -0
- package/dist/check/migrations/drizzle-migrations.js.map +1 -0
- package/dist/check/migrations/drizzle-out-folder.d.ts +3 -0
- package/dist/check/migrations/drizzle-out-folder.d.ts.map +1 -0
- package/dist/check/migrations/drizzle-out-folder.js +18 -0
- package/dist/check/migrations/drizzle-out-folder.js.map +1 -0
- package/dist/check/migrations/migration-folder.d.ts +13 -0
- package/dist/check/migrations/migration-folder.d.ts.map +1 -0
- package/dist/check/migrations/migration-folder.js +2 -0
- package/dist/check/migrations/migration-folder.js.map +1 -0
- package/dist/check/migrations/migration-name-findings.d.ts +9 -0
- package/dist/check/migrations/migration-name-findings.d.ts.map +1 -0
- package/dist/check/migrations/migration-name-findings.js +32 -0
- package/dist/check/migrations/migration-name-findings.js.map +1 -0
- package/dist/check/migrations/read-drizzle-migrations.d.ts +4 -0
- package/dist/check/migrations/read-drizzle-migrations.d.ts.map +1 -0
- package/dist/check/migrations/read-drizzle-migrations.js +67 -0
- package/dist/check/migrations/read-drizzle-migrations.js.map +1 -0
- package/dist/check/migrations/read-migration-folder.d.ts +5 -0
- package/dist/check/migrations/read-migration-folder.d.ts.map +1 -0
- package/dist/check/migrations/read-migration-folder.js +38 -0
- package/dist/check/migrations/read-migration-folder.js.map +1 -0
- package/dist/check/rules/config-valid.d.ts.map +1 -1
- package/dist/check/rules/config-valid.js +3 -1
- package/dist/check/rules/config-valid.js.map +1 -1
- package/dist/check/rules/persistence-migration-history.d.ts +3 -0
- package/dist/check/rules/persistence-migration-history.d.ts.map +1 -0
- package/dist/check/rules/persistence-migration-history.js +24 -0
- package/dist/check/rules/persistence-migration-history.js.map +1 -0
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +10 -1
- package/dist/commands/init.js.map +1 -1
- package/dist/commit/is-derived.d.ts.map +1 -1
- package/dist/commit/is-derived.js +5 -7
- package/dist/commit/is-derived.js.map +1 -1
- package/dist/config/ci-extra-problems.d.ts +4 -0
- package/dist/config/ci-extra-problems.d.ts.map +1 -0
- package/dist/config/ci-extra-problems.js +27 -0
- package/dist/config/ci-extra-problems.js.map +1 -0
- package/dist/config/ci-extras.d.ts +13 -0
- package/dist/config/ci-extras.d.ts.map +1 -0
- package/dist/config/ci-extras.js +13 -0
- package/dist/config/ci-extras.js.map +1 -0
- package/dist/config/config.d.ts +23 -0
- package/dist/config/config.d.ts.map +1 -1
- package/dist/config/index.d.ts +4 -1
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +3 -0
- package/dist/config/index.js.map +1 -1
- package/dist/config/open-api-problems.d.ts +4 -0
- package/dist/config/open-api-problems.d.ts.map +1 -0
- package/dist/config/open-api-problems.js +87 -0
- package/dist/config/open-api-problems.js.map +1 -0
- package/dist/config/openapi-formats.d.ts +3 -0
- package/dist/config/openapi-formats.d.ts.map +1 -0
- package/dist/config/openapi-formats.js +3 -0
- package/dist/config/openapi-formats.js.map +1 -0
- package/dist/config/parse-ci.d.ts +4 -0
- package/dist/config/parse-ci.d.ts.map +1 -0
- package/dist/config/parse-ci.js +7 -0
- package/dist/config/parse-ci.js.map +1 -0
- package/dist/config/parse-config.d.ts.map +1 -1
- package/dist/config/parse-config.js +4 -0
- package/dist/config/parse-config.js.map +1 -1
- package/dist/config/parse-open-api.d.ts +4 -0
- package/dist/config/parse-open-api.d.ts.map +1 -0
- package/dist/config/parse-open-api.js +20 -0
- package/dist/config/parse-open-api.js.map +1 -0
- package/dist/config/restack-config-text.d.ts +1 -1
- package/dist/config/restack-config-text.d.ts.map +1 -1
- package/dist/config/restack-config-text.js +9 -2
- package/dist/config/restack-config-text.js.map +1 -1
- package/dist/config/serialize-config.js +8 -0
- package/dist/config/serialize-config.js.map +1 -1
- package/dist/contracts/contract-format.d.ts +3 -0
- package/dist/contracts/contract-format.d.ts.map +1 -0
- package/dist/contracts/contract-format.js +11 -0
- package/dist/contracts/contract-format.js.map +1 -0
- package/dist/contracts/stringify-contract.d.ts +3 -0
- package/dist/contracts/stringify-contract.d.ts.map +1 -0
- package/dist/contracts/stringify-contract.js +6 -0
- package/dist/contracts/stringify-contract.js.map +1 -0
- package/dist/contracts.d.ts +9 -0
- package/dist/contracts.d.ts.map +1 -0
- package/dist/contracts.js +9 -0
- package/dist/contracts.js.map +1 -0
- package/dist/describe/describe-context.d.ts.map +1 -1
- package/dist/describe/describe-context.js +14 -3
- package/dist/describe/describe-context.js.map +1 -1
- package/dist/docs/open-api-documents-file.d.ts +4 -0
- package/dist/docs/open-api-documents-file.d.ts.map +1 -0
- package/dist/docs/open-api-documents-file.js +5 -0
- package/dist/docs/open-api-documents-file.js.map +1 -0
- package/dist/docs/render-open-api-documents.d.ts +13 -0
- package/dist/docs/render-open-api-documents.d.ts.map +1 -0
- package/dist/docs/render-open-api-documents.js +42 -0
- package/dist/docs/render-open-api-documents.js.map +1 -0
- package/dist/docs/write-docs.d.ts.map +1 -1
- package/dist/docs/write-docs.js +2 -0
- package/dist/docs/write-docs.js.map +1 -1
- package/dist/docs/write-open-api-documents.d.ts +9 -0
- package/dist/docs/write-open-api-documents.d.ts.map +1 -0
- package/dist/docs/write-open-api-documents.js +33 -0
- package/dist/docs/write-open-api-documents.js.map +1 -0
- package/dist/help/commands-guide-region.d.ts +3 -0
- package/dist/help/commands-guide-region.d.ts.map +1 -0
- package/dist/help/commands-guide-region.js +12 -0
- package/dist/help/commands-guide-region.js.map +1 -0
- package/dist/help/notes.d.ts +3 -0
- package/dist/help/notes.d.ts.map +1 -0
- package/dist/help/notes.js +24 -0
- package/dist/help/notes.js.map +1 -0
- package/dist/help/reference-text.d.ts +3 -0
- package/dist/help/reference-text.d.ts.map +1 -0
- package/dist/help/reference-text.js +14 -0
- package/dist/help/reference-text.js.map +1 -0
- package/dist/help/usage.d.ts +3 -0
- package/dist/help/usage.d.ts.map +1 -0
- package/dist/help/usage.js +37 -0
- package/dist/help/usage.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/init/files/persistence-files.js +1 -1
- package/dist/init/files/persistence-files.js.map +1 -1
- package/dist/init/files/pipeline-files.d.ts.map +1 -1
- package/dist/init/files/pipeline-files.js +4 -2
- package/dist/init/files/pipeline-files.js.map +1 -1
- package/dist/init/manifest/database-scripts.d.ts.map +1 -1
- package/dist/init/manifest/database-scripts.js +5 -4
- package/dist/init/manifest/database-scripts.js.map +1 -1
- package/dist/init/manifest/versions.js +23 -23
- package/dist/init/run-init.d.ts.map +1 -1
- package/dist/init/run-init.js +3 -0
- package/dist/init/run-init.js.map +1 -1
- package/dist/init/stack/resolve-ci-extras.d.ts +8 -0
- package/dist/init/stack/resolve-ci-extras.d.ts.map +1 -0
- package/dist/init/stack/resolve-ci-extras.js +31 -0
- package/dist/init/stack/resolve-ci-extras.js.map +1 -0
- package/dist/init/stack/resolve-stack.d.ts.map +1 -1
- package/dist/init/stack/resolve-stack.js +3 -1
- package/dist/init/stack/resolve-stack.js.map +1 -1
- package/dist/init/stack/stack-options.d.ts +2 -0
- package/dist/init/stack/stack-options.d.ts.map +1 -1
- package/dist/init/template-vars.d.ts.map +1 -1
- package/dist/init/template-vars.js +14 -0
- package/dist/init/template-vars.js.map +1 -1
- package/dist/init/write-agent-settings.js +2 -2
- package/dist/init/write-agent-settings.js.map +1 -1
- package/dist/init/write-contracts.d.ts.map +1 -1
- package/dist/init/write-contracts.js +7 -3
- package/dist/init/write-contracts.js.map +1 -1
- package/dist/progress/format-progress.d.ts.map +1 -1
- package/dist/progress/format-progress.js +3 -1
- package/dist/progress/format-progress.js.map +1 -1
- package/dist/run.d.ts.map +1 -1
- package/dist/run.js +2 -63
- package/dist/run.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/yaml/to-yaml.d.ts +8 -0
- package/dist/yaml/to-yaml.d.ts.map +1 -0
- package/dist/yaml/to-yaml.js +132 -0
- package/dist/yaml/to-yaml.js.map +1 -0
- package/package.json +2 -2
- package/templates/docs/integration-readme.md.tpl +2 -2
- package/templates/init/CLAUDE.md.tpl +2 -1
- package/templates/init/README.md.tpl +37 -11
- package/templates/init/platform/database/data-source.typeorm.ts.tpl +1 -1
- package/templates/init/platform/database/drizzle.config.ts.tpl +2 -0
- package/templates/init/platform/database/knexfile.js.tpl +9 -3
- package/templates/init/platform/database/schema.drizzle.ts.tpl +1 -1
- package/templates/init/platform/database/schema.knex.ts.tpl +2 -2
- package/templates/init/platform/http/with-documentation.ts.tpl +13 -9
- package/templates/init/rules/presentation.md.tpl +1 -1
- package/templates/init/scripts/events.ts.tpl +16 -5
- package/templates/init/scripts/openapi.ts.tpl +49 -20
- package/templates/pipeline/github/branch-protection.md +8 -7
- package/templates/pipeline/github/workflows/{ci.yml → ci.yml.tpl} +3 -0
- package/templates/pipeline/gitlab/gitlab-ci.yml.tpl +11 -0
- package/templates/pipeline/gitlab/merge-request-settings.md +7 -6
- package/templates/pipeline/package-scripts.json +1 -1
- package/templates/repository/drizzle/table.tpl +2 -2
- package/templates/repository/prisma/model.tpl +1 -1
- package/templates/repository/typeorm/table.tpl +1 -1
|
@@ -14,6 +14,7 @@ export function templateVars(config, projectName) {
|
|
|
14
14
|
docs: { any: docsUi !== 'none', ui: docsUi },
|
|
15
15
|
knip: knipVars(config),
|
|
16
16
|
ci: { github: ci === 'github' || ci === 'both', gitlab: ci === 'gitlab' || ci === 'both', any: ci !== 'none' },
|
|
17
|
+
extras: extrasVars(config.ci.extras),
|
|
17
18
|
needs: { url: readsUrl(config), text: readsText(config) },
|
|
18
19
|
keycloak: { version: KEYCLOAK_VERSION },
|
|
19
20
|
compose: {
|
|
@@ -31,6 +32,19 @@ export function templateVars(config, projectName) {
|
|
|
31
32
|
},
|
|
32
33
|
};
|
|
33
34
|
}
|
|
35
|
+
/** The extra jobs of the pipeline, by the name a template asks for. */
|
|
36
|
+
function extrasVars(extras) {
|
|
37
|
+
const gitlab = ['gitlab-sast', 'gitlab-secret-detection', 'gitlab-dependency-scanning'];
|
|
38
|
+
return {
|
|
39
|
+
codeql: extras.includes('codeql'),
|
|
40
|
+
dependencyReview: extras.includes('dependency-review'),
|
|
41
|
+
gitlabSast: extras.includes('gitlab-sast'),
|
|
42
|
+
gitlabSecretDetection: extras.includes('gitlab-secret-detection'),
|
|
43
|
+
gitlabDependencyScanning: extras.includes('gitlab-dependency-scanning'),
|
|
44
|
+
gitlabSecurity: extras.some((extra) => gitlab.includes(extra)),
|
|
45
|
+
none: extras.length === 0,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
34
48
|
/** Whether the validated configuration holds at least one URL: the reader of URLs is written only then. */
|
|
35
49
|
function readsUrl(config) {
|
|
36
50
|
const { orm, broker, cache } = config.stack;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"template-vars.js","sourceRoot":"","sources":["../../src/init/template-vars.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,4CAA4C,CAAC;AAChF,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAE1D,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,qGAAqG;AACrG,MAAM,gBAAgB,GAAG,QAAQ,CAAC;AAElC,6GAA6G;AAC7G,MAAM,UAAU,YAAY,CAAC,MAAc,EAAE,WAAmB;IAC9D,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC,KAAK,CAAC;IAErE,OAAO;QACL,GAAG,SAAS,CAAC,MAAM,CAAC;QACpB,OAAO,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE;QAC9B,EAAE,EAAE,kBAAkB,CAAC,MAAM,CAAC;QAC9B,IAAI,EAAE,EAAE,GAAG,EAAE,MAAM,KAAK,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE;QAC5C,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC;QACtB,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,KAAK,QAAQ,IAAI,EAAE,KAAK,MAAM,EAAE,MAAM,EAAE,EAAE,KAAK,QAAQ,IAAI,EAAE,KAAK,MAAM,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AAE,GAAG,MAAM,CAAC,KAAK,CAAC;IAE5C,OAAO,CACL,aAAa,CAAC,QAAQ,CAAC,GAAG,CAAC;QAC3B,cAAc,CAAC,MAAM,CAAC;QACtB,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC;QAC9C,KAAK,KAAK,OAAO,CAClB,CAAC;AACJ,CAAC;AAED,4IAA4I;AAC5I,SAAS,SAAS,CAAC,MAAc;IAC/B,OAAO,cAAc,CAAC,MAAM,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC,MAAM,KAAK,OAAO,CAAC;AACnE,CAAC;AAED,SAAS,cAAc,CAAC,MAAc;IACpC,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,MAAM,CAAC,KAAK,CAAC;IAErC,OAAO,CAAC,KAAK,KAAK,KAAK,IAAI,KAAK,KAAK,UAAU,CAAC,IAAI,IAAI,KAAK,MAAM,CAAC;AACtE,CAAC"}
|
|
@@ -32,8 +32,8 @@ const PERMISSIONS = {
|
|
|
32
32
|
'Read(./.env)',
|
|
33
33
|
'Read(./.env.*)',
|
|
34
34
|
'Read(!./.env.example)',
|
|
35
|
-
'Edit(./openapi
|
|
36
|
-
'Edit(./docs/integration/asyncapi
|
|
35
|
+
'Edit(./openapi/**)',
|
|
36
|
+
'Edit(./docs/integration/asyncapi.*)',
|
|
37
37
|
'Edit(./docs/integration/event-catalog.md)',
|
|
38
38
|
],
|
|
39
39
|
// Then the files that hold the rules and the pipeline: changing one is a decision of the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"write-agent-settings.js","sourceRoot":"","sources":["../../src/init/write-agent-settings.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEpD,MAAM,cAAc,GAAG,uBAAuB,CAAC;AAI/C;;;GAGG;AACH,MAAM,WAAW,GAAgB;IAC/B,KAAK,EAAE;QACL,8BAA8B;QAC9B,6BAA6B;QAC7B,iCAAiC;QACjC,6BAA6B;QAC7B,gCAAgC;QAChC,4BAA4B;QAC5B,sBAAsB;QACtB,yBAAyB;QACzB,sBAAsB;QACtB,kBAAkB;QAClB,0BAA0B;QAC1B,6BAA6B;QAC7B,0BAA0B;QAC1B,gCAAgC;QAChC,6BAA6B;QAC7B,+BAA+B;QAC/B,4BAA4B;KAC7B;IACD,wFAAwF;IACxF,kFAAkF;IAClF,6EAA6E;IAC7E,IAAI,EAAE;QACJ,cAAc;QACd,gBAAgB;QAChB,uBAAuB;QACvB,
|
|
1
|
+
{"version":3,"file":"write-agent-settings.js","sourceRoot":"","sources":["../../src/init/write-agent-settings.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEpD,MAAM,cAAc,GAAG,uBAAuB,CAAC;AAI/C;;;GAGG;AACH,MAAM,WAAW,GAAgB;IAC/B,KAAK,EAAE;QACL,8BAA8B;QAC9B,6BAA6B;QAC7B,iCAAiC;QACjC,6BAA6B;QAC7B,gCAAgC;QAChC,4BAA4B;QAC5B,sBAAsB;QACtB,yBAAyB;QACzB,sBAAsB;QACtB,kBAAkB;QAClB,0BAA0B;QAC1B,6BAA6B;QAC7B,0BAA0B;QAC1B,gCAAgC;QAChC,6BAA6B;QAC7B,+BAA+B;QAC/B,4BAA4B;KAC7B;IACD,wFAAwF;IACxF,kFAAkF;IAClF,6EAA6E;IAC7E,IAAI,EAAE;QACJ,cAAc;QACd,gBAAgB;QAChB,uBAAuB;QACvB,oBAAoB;QACpB,qCAAqC;QACrC,2CAA2C;KAC5C;IACD,yFAAyF;IACzF,4EAA4E;IAC5E,GAAG,EAAE;QACH,kBAAkB;QAClB,qBAAqB;QACrB,gCAAgC;QAChC,2BAA2B;QAC3B,oBAAoB;QACpB,iCAA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AC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"write-contracts.d.ts","sourceRoot":"","sources":["../../src/init/write-contracts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"write-contracts.d.ts","sourceRoot":"","sources":["../../src/init/write-contracts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAIjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAKvD;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,IAAI,CAsBvF"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { stringifyContract } from '../contracts/stringify-contract.js';
|
|
1
2
|
import { stackVars } from '../stack/stack-vars.js';
|
|
2
3
|
import { readTemplate, renderTemplate } from '../templating/index.js';
|
|
3
4
|
import { isRecord } from './is-record.js';
|
|
@@ -10,12 +11,15 @@ const INTEGRATION = 'docs/integration';
|
|
|
10
11
|
*/
|
|
11
12
|
export function writeContracts(ws, config, projectName) {
|
|
12
13
|
const context = { ...stackVars(config), document: documentVars(ws, projectName) };
|
|
14
|
+
const format = config.openapi.format === 'json' ? 'json' : 'yaml';
|
|
15
|
+
const written = (template) => stringifyContract(JSON.parse(renderTemplate(template, context)), format);
|
|
13
16
|
const contracts = [
|
|
14
|
-
[`${INTEGRATION}/asyncapi
|
|
17
|
+
[`${INTEGRATION}/asyncapi.${format}`, written('docs/asyncapi.json.tpl')],
|
|
15
18
|
[`${INTEGRATION}/event-catalog.md`, readTemplate('docs/event-catalog.md')],
|
|
16
19
|
];
|
|
17
|
-
|
|
18
|
-
|
|
20
|
+
// A contract split into documents is written by its script, which knows the route groups.
|
|
21
|
+
if (config.stack.http !== 'none' && config.openapi.documents.length === 0) {
|
|
22
|
+
contracts.push([`openapi/openapi.${format}`, written('docs/openapi.json.tpl')]);
|
|
19
23
|
}
|
|
20
24
|
for (const [file, content] of contracts) {
|
|
21
25
|
if (!ws.exists(file)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"write-contracts.js","sourceRoot":"","sources":["../../src/init/write-contracts.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,cAAc,EAAsB,MAAM,wBAAwB,CAAC;AAE1F,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,MAAM,WAAW,GAAG,kBAAkB,CAAC;AAEvC;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAAC,EAAa,EAAE,MAAc,EAAE,WAAmB;IAC/E,MAAM,OAAO,GAAG,EAAE,GAAG,SAAS,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,YAAY,CAAC,EAAE,EAAE,WAAW,CAAC,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"write-contracts.js","sourceRoot":"","sources":["../../src/init/write-contracts.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AACvE,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,cAAc,EAAsB,MAAM,wBAAwB,CAAC;AAE1F,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,MAAM,WAAW,GAAG,kBAAkB,CAAC;AAEvC;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAAC,EAAa,EAAE,MAAc,EAAE,WAAmB;IAC/E,MAAM,OAAO,GAAG,EAAE,GAAG,SAAS,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,YAAY,CAAC,EAAE,EAAE,WAAW,CAAC,EAAE,CAAC;IAClF,MAAM,MAAM,GAAG,MAAM,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AC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IAE3F,MAAM,IAAI,GAAG,CAAC,KAAc,EAAE,QAAgB,EAAU,EAAE,CACxD,IAAI,CAAC,SAAS,CAAC,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;IAE/D,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC,EAAE,CAAC;AAC/F,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format-progress.d.ts","sourceRoot":"","sources":["../../src/progress/format-progress.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAkC,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"format-progress.d.ts","sourceRoot":"","sources":["../../src/progress/format-progress.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAkC,MAAM,eAAe,CAAC;AAS9E,8HAA8H;AAC9H,wBAAgB,cAAc,CAAC,QAAQ,EAAE,QAAQ,GAAG,MAAM,CAWzD"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
const STATUS_ORDER = ['in progress', 'todo', 'done'];
|
|
2
|
+
/** Said when the project keeps no plan: where the recommended path starts. */
|
|
3
|
+
const NO_PLAN = 'no docs/architecture/plan.md with a `Next:` line. The recommended path starts with step 1, discover the domain, before any code: `/ddd-ts-kit:start` conducts the steps and writes the plan (docs/guides/methodology.md of ddd-ts-kit)';
|
|
2
4
|
/** `status` for a reader: the next step, the slices that are not done by status, the count by owner, what is left to fill. */
|
|
3
5
|
export function formatProgress(progress) {
|
|
4
6
|
return [
|
|
5
|
-
`Next: ${progress.next ??
|
|
7
|
+
`Next: ${progress.next ?? NO_PLAN}`,
|
|
6
8
|
'',
|
|
7
9
|
...(progress.slices === null
|
|
8
10
|
? ['Slices: no docs/architecture/slices.md with a slices table (the skill ddd-ts-kit:plan-slices writes it)']
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format-progress.js","sourceRoot":"","sources":["../../src/progress/format-progress.ts"],"names":[],"mappings":"AAGA,MAAM,YAAY,GAAG,CAAC,aAAa,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAErD,8HAA8H;AAC9H,MAAM,UAAU,cAAc,CAAC,QAAkB;IAC/C,OAAO;QACL,SAAS,QAAQ,CAAC,IAAI,IAAI,
|
|
1
|
+
{"version":3,"file":"format-progress.js","sourceRoot":"","sources":["../../src/progress/format-progress.ts"],"names":[],"mappings":"AAGA,MAAM,YAAY,GAAG,CAAC,aAAa,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAErD,8EAA8E;AAC9E,MAAM,OAAO,GACX,wOAAwO,CAAC;AAE3O,8HAA8H;AAC9H,MAAM,UAAU,cAAc,CAAC,QAAkB;IAC/C,OAAO;QACL,SAAS,QAAQ,CAAC,IAAI,IAAI,OAAO,EAAE;QACnC,EAAE;QACF,GAAG,CAAC,QAAQ,CAAC,MAAM,KAAK,IAAI;YAC1B,CAAC,CAAC,CAAC,yGAAyG,CAAC;YAC7G,CAAC,CAAC,UAAU,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QAChC,EAAE;QACF,WAAW;QACX,GAAG,QAAQ,CAAC,SAAS,CAAC,GAAG,CAAC,aAAa,CAAC;KACzC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC;AAED,SAAS,UAAU,CAAC,MAAsB;IACxC,MAAM,QAAQ,GAAG;QACf,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,SAAS,CAAC;QACzE,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,C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GAAU;IACzB,MAAM,KAAK,GAAG,GAAG,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,gBAAgB,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAEzF,OAAO,QAAQ,GAAG,CAAC,EAAE,IAAI,GAAG,CAAC,OAAO,IAAI,GAAG,CAAC,IAAI,KAAK,GAAG,CAAC,KAAK,YAAY,GAAG,CAAC,KAAK,GAAG,KAAK,GAAG,CAAC;AACjG,CAAC;AAED,SAAS,aAAa,CAAC,KAAqB;IAC1C,OAAO,KAAK,KAAK,CAAC,OAAO,KAAK,EAAE,CAAC,CAAC,CAAC,sBAAsB,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,KAAK,KAAK,CAAC,MAAM,kBAAkB,KAAK,CAAC,QAAQ,oBAAoB,KAAK,CAAC,IAAI,UAAU,CAAC;AACrK,CAAC"}
|
package/dist/run.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../src/run.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../src/run.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAgD3C,wBAAgB,GAAG,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,EAAE,EAAE,GAAE,EAAc,GAAG,MAAM,CAkCvE"}
|
package/dist/run.js
CHANGED
|
@@ -16,6 +16,7 @@ import { workerScopeCommand } from './commands/worker-scope.js';
|
|
|
16
16
|
import { CliError } from './cli-error.js';
|
|
17
17
|
import { KINDS } from './generate/kinds.js';
|
|
18
18
|
import { kindsHelp } from './generate/kinds-help.js';
|
|
19
|
+
import { referenceText } from './help/reference-text.js';
|
|
19
20
|
import { VERSION } from './version.js';
|
|
20
21
|
const COMMANDS = {
|
|
21
22
|
affected: affectedCommand,
|
|
@@ -37,62 +38,6 @@ const COMMANDS = {
|
|
|
37
38
|
rules: rulesCommand,
|
|
38
39
|
explain: explainCommand,
|
|
39
40
|
};
|
|
40
|
-
const USAGE = `Usage
|
|
41
|
-
ddd-ts-kit init [--http express|fastify|nest|none] [--validation zod|class-validator|standard-schema|none]
|
|
42
|
-
[--di tsyringe|nest|manual] [--tests vitest|jest]
|
|
43
|
-
[--orm drizzle|knex|prisma|typeorm|custom|none] [--database postgres|mysql|sqlite|none]
|
|
44
|
-
[--events in-memory|outbox] [--docs-ui swagger|scalar|redoc|none]
|
|
45
|
-
[--ci github|gitlab|both|none] [--authn jwt|keycloak|none] [--authz rbac|abac|rebac|custom]
|
|
46
|
-
[--broker none|rabbitmq|kafka|nats|redis|custom] [--cache none|redis] [--audit on|off]
|
|
47
|
-
[--errors none|sentry] [--logger stdout|pino|winston] [--style declared|explicit] [--assembly barrel|discovery]
|
|
48
|
-
[--dependencies signature|listed] [--refusals factories|classes]
|
|
49
|
-
[--routes controllers|functions]
|
|
50
|
-
[--package-manager npm|pnpm] [--allow-no-outbox "<reason>"] [--import-alias '$<name>/']
|
|
51
|
-
[--import-extension none|js]
|
|
52
|
-
[--context <name>:<core|supporting|generic>]... [--dry-run] [--force]
|
|
53
|
-
ddd-ts-kit generate <kind> ... [--term "<Term>=<meaning>"]... [--allow-name] [--local-only] [--dry-run] [--force] (alias: g)
|
|
54
|
-
ddd-ts-kit generate --help --json
|
|
55
|
-
ddd-ts-kit list [--context <name>]
|
|
56
|
-
ddd-ts-kit describe <context>
|
|
57
|
-
ddd-ts-kit status
|
|
58
|
-
ddd-ts-kit todo [<context>]
|
|
59
|
-
ddd-ts-kit worker-scope <context> [--worktree <path>] [--branch <name>] [--dry-run]
|
|
60
|
-
ddd-ts-kit docs [--check]
|
|
61
|
-
ddd-ts-kit depcruise-config [--check|--write]
|
|
62
|
-
ddd-ts-kit build-aliases [--project <tsconfig>]
|
|
63
|
-
ddd-ts-kit error-factories --plan | --apply [--dry-run]
|
|
64
|
-
ddd-ts-kit controllers [<context>] [--dry-run]
|
|
65
|
-
ddd-ts-kit affected [--base <git-ref>] [--head <git-ref>] [--format text|json|github|env]
|
|
66
|
-
ddd-ts-kit check [paths...] [--rule <id>]... [--format text|json|github|gitlab] [--changed-since <git-ref>] [--self]
|
|
67
|
-
ddd-ts-kit check --clean-only <dir>... [--rule <id>]... [--format text|json|github]
|
|
68
|
-
ddd-ts-kit check --commit-size [--staged] [--strict]
|
|
69
|
-
ddd-ts-kit check-file <path>
|
|
70
|
-
ddd-ts-kit rules
|
|
71
|
-
ddd-ts-kit explain <rule-id>
|
|
72
|
-
|
|
73
|
-
Every command accepts --json (machine-readable output) and --cwd <dir> (project root).`;
|
|
74
|
-
const NOTES = ` affected what a pull request has to run: the contexts a change set reaches through the context
|
|
75
|
-
map (a changed context and the contexts downstream of it), as filters for the test
|
|
76
|
-
runner and the linter; everything when a shared path changed or without --base
|
|
77
|
-
build-aliases after the compiler: rewrites the import aliases left in the emitted .js and .d.ts files
|
|
78
|
-
into relative paths, so that plain node runs the output (tsconfig.build.json by default)
|
|
79
|
-
error-factories moves a project from one class per error to static factories on one error class per
|
|
80
|
-
concept: --plan writes error-factories.plan.json, where each class is given its concept;
|
|
81
|
-
--apply follows it (classes, specs, every usage, "stack.refusals" in the config)
|
|
82
|
-
controllers moves the function routes of a project, or of one context, to controller classes: each
|
|
83
|
-
<name>.route.ts becomes <resource>/<name>/<name>.controller.ts behind the route group of
|
|
84
|
-
its resource, its schema files and its spec follow; a context is turned whole or not at all
|
|
85
|
-
describe one context as facts: use cases, routes, events, ports, policies, gateways, dependencies
|
|
86
|
-
status the next step of docs/architecture/plan.md, the slices of docs/architecture/slices.md by
|
|
87
|
-
status and by owner, and the TODO(domain), TODO(platform) and it.todo left in each context
|
|
88
|
-
todo those markers as file:line, in the project or in one context
|
|
89
|
-
worker-scope a git worktree on the branch build/<context> (by default ../<project>-<context>), its
|
|
90
|
-
.ddd-ts-kit/worker.json, and the briefing of the worker of that context
|
|
91
|
-
--commit-size the files and lines about to be committed against "commit" in the config (20 files and
|
|
92
|
-
600 lines by default, generated files not counted); --staged reads the index only;
|
|
93
|
-
advisory, --strict exits 1 when over
|
|
94
|
-
--local-only generate refuses, and writes nothing, when the kind would write outside its context;
|
|
95
|
-
"generate --help --json" says which kinds do`;
|
|
96
41
|
const processIo = {
|
|
97
42
|
out: (text) => void process.stdout.write(`${text}\n`),
|
|
98
43
|
err: (text) => void process.stderr.write(`${text}\n`),
|
|
@@ -138,14 +83,8 @@ function helpFor(argv) {
|
|
|
138
83
|
return kinds ? JSON.stringify({ kinds: kindsHelp(KINDS) }, null, 2) : help();
|
|
139
84
|
}
|
|
140
85
|
function help() {
|
|
141
|
-
const kinds = KINDS.map((kind) => ` ${kind.usage}${kind.aliases.length > 0 ? ` (alias: ${kind.aliases.join(', ')})` : ''}`);
|
|
142
86
|
return `ddd-ts-kit ${VERSION}: bootstrap, scaffold and verify DDD and Clean Architecture TypeScript projects.
|
|
143
87
|
|
|
144
|
-
${
|
|
145
|
-
|
|
146
|
-
${NOTES}
|
|
147
|
-
|
|
148
|
-
Kinds
|
|
149
|
-
${kinds.join('\n')}`;
|
|
88
|
+
${referenceText()}`;
|
|
150
89
|
}
|
|
151
90
|
//# sourceMappingURL=run.js.map
|
package/dist/run.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run.js","sourceRoot":"","sources":["../src/run.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACrF,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAA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AC,QAAQ,CAAC,CAAC;IAErF,OAAO,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,SAAS,CAAC,KAAK,CAAC,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;AAC/E,CAAC;AAED,SAAS,IAAI;IACX,OAAO,cAAc,OAAO;;EAE5B,aAAa,EAAE,EAAE,CAAC;AACpB,CAAC"}
|
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.
|
|
1
|
+
export declare const VERSION = "0.5.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/dist/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = '0.
|
|
1
|
+
export const VERSION = '0.5.0';
|
|
2
2
|
//# sourceMappingURL=version.js.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The YAML of a JSON value, deterministic and in block style: keys in the order of the value,
|
|
3
|
+
* two spaces per level, a string plain when no YAML reader can take it for something else,
|
|
4
|
+
* single-quoted otherwise, double-quoted when it holds a character only an escape can write, a
|
|
5
|
+
* text of several lines as a literal block. Empty maps and lists are written `{}` and `[]`.
|
|
6
|
+
*/
|
|
7
|
+
export declare function toYaml(value: unknown): string;
|
|
8
|
+
//# sourceMappingURL=to-yaml.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"to-yaml.d.ts","sourceRoot":"","sources":["../../src/yaml/to-yaml.ts"],"names":[],"mappings":"AASA;;;;;GAKG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAE7C"}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
const INDENT = ' ';
|
|
2
|
+
/** What YAML 1.1 or 1.2 reads as something else than a string when written plain: null, booleans, numbers, dates. */
|
|
3
|
+
const NOT_A_STRING = /^(?:~|null|Null|NULL|true|True|TRUE|false|False|FALSE|y|Y|yes|Yes|YES|n|N|no|No|NO|on|On|ON|off|Off|OFF|<<|=)$|^[-+]?(?:\.?\d|\.(?:inf|Inf|INF|nan|NaN|NAN)$)|^\d{4}-\d\d?-\d\d?/;
|
|
4
|
+
/** A first character that starts something else than a plain scalar. */
|
|
5
|
+
const INDICATOR = /^[-?:,[\]{}#&*!|>'"%@`\s]/;
|
|
6
|
+
/**
|
|
7
|
+
* The YAML of a JSON value, deterministic and in block style: keys in the order of the value,
|
|
8
|
+
* two spaces per level, a string plain when no YAML reader can take it for something else,
|
|
9
|
+
* single-quoted otherwise, double-quoted when it holds a character only an escape can write, a
|
|
10
|
+
* text of several lines as a literal block. Empty maps and lists are written `{}` and `[]`.
|
|
11
|
+
*/
|
|
12
|
+
export function toYaml(value) {
|
|
13
|
+
return `${new YamlWriter().lines(value, 0).join('\n')}\n`;
|
|
14
|
+
}
|
|
15
|
+
class YamlWriter {
|
|
16
|
+
/** The lines of a value that starts on its own line, at a depth. */
|
|
17
|
+
lines(value, depth) {
|
|
18
|
+
if (isMap(value)) {
|
|
19
|
+
return Object.keys(value).length === 0 ? ['{}'] : this.mapLines(value, depth);
|
|
20
|
+
}
|
|
21
|
+
if (Array.isArray(value)) {
|
|
22
|
+
return value.length === 0 ? ['[]'] : this.listLines(value, depth);
|
|
23
|
+
}
|
|
24
|
+
return [this.inline(value, depth)];
|
|
25
|
+
}
|
|
26
|
+
mapLines(map, depth) {
|
|
27
|
+
const indent = INDENT.repeat(depth);
|
|
28
|
+
return Object.entries(map).flatMap(([key, entry]) => {
|
|
29
|
+
const name = `${indent}${scalar(key)}:`;
|
|
30
|
+
if (isNested(entry)) {
|
|
31
|
+
return [name, ...this.lines(entry, depth + 1)];
|
|
32
|
+
}
|
|
33
|
+
return [`${name} ${this.inline(entry, depth + 1)}`];
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
listLines(list, depth) {
|
|
37
|
+
const indent = INDENT.repeat(depth);
|
|
38
|
+
return list.flatMap((entry) => {
|
|
39
|
+
if (!isNested(entry)) {
|
|
40
|
+
return [`${indent}- ${this.inline(entry, depth + 1)}`];
|
|
41
|
+
}
|
|
42
|
+
// The first line of a nested map or list goes after the dash; the others keep their depth.
|
|
43
|
+
const [first = '', ...rest] = this.lines(entry, depth + 1);
|
|
44
|
+
return [`${indent}- ${first.trimStart()}`, ...rest];
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
/** A value written after `key:` or `-`, a block scalar included: its lines are indented one level deeper. */
|
|
48
|
+
inline(value, depth) {
|
|
49
|
+
if (isMap(value) || Array.isArray(value)) {
|
|
50
|
+
return isMap(value) ? '{}' : '[]';
|
|
51
|
+
}
|
|
52
|
+
if (typeof value === 'string' && isBlockText(value)) {
|
|
53
|
+
return literalBlock(value, INDENT.repeat(depth));
|
|
54
|
+
}
|
|
55
|
+
return scalar(value);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
function isMap(value) {
|
|
59
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
60
|
+
}
|
|
61
|
+
/** A map or a list with something in it: written on the lines below its key. */
|
|
62
|
+
function isNested(value) {
|
|
63
|
+
return (isMap(value) && Object.keys(value).length > 0) || (Array.isArray(value) && value.length > 0);
|
|
64
|
+
}
|
|
65
|
+
/** A key, or a value that fits one line. */
|
|
66
|
+
function scalar(value) {
|
|
67
|
+
if (typeof value === 'string') {
|
|
68
|
+
return quoted(value);
|
|
69
|
+
}
|
|
70
|
+
if (typeof value === 'number') {
|
|
71
|
+
return Number.isFinite(value) ? String(value) : 'null';
|
|
72
|
+
}
|
|
73
|
+
return typeof value === 'boolean' ? String(value) : 'null';
|
|
74
|
+
}
|
|
75
|
+
function quoted(text) {
|
|
76
|
+
if (hasUnprintable(text) || text.includes('\n') || text.includes('\r')) {
|
|
77
|
+
return doubleQuoted(text);
|
|
78
|
+
}
|
|
79
|
+
return isPlain(text) ? text : `'${text.replaceAll("'", "''")}'`;
|
|
80
|
+
}
|
|
81
|
+
function isPlain(text) {
|
|
82
|
+
return (text !== '' &&
|
|
83
|
+
!INDICATOR.test(text) &&
|
|
84
|
+
!/\s$/.test(text) &&
|
|
85
|
+
!text.endsWith(':') &&
|
|
86
|
+
!text.includes(': ') &&
|
|
87
|
+
!text.includes(' #') &&
|
|
88
|
+
!text.includes('\t') &&
|
|
89
|
+
!NOT_A_STRING.test(text));
|
|
90
|
+
}
|
|
91
|
+
/** A character a plain or single-quoted scalar cannot hold as it is: a control character but the tab and the line feed, a C1 control, a line or paragraph separator, a byte order mark. */
|
|
92
|
+
function hasUnprintable(text) {
|
|
93
|
+
for (let index = 0; index < text.length; index += 1) {
|
|
94
|
+
const code = text.charCodeAt(index);
|
|
95
|
+
if ((code < 0x20 && code !== 0x09 && code !== 0x0a) || (code >= 0x7f && code <= 0x9f)) {
|
|
96
|
+
return true;
|
|
97
|
+
}
|
|
98
|
+
if (code === 0x2028 || code === 0x2029 || code === 0xfeff) {
|
|
99
|
+
return true;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
return false;
|
|
103
|
+
}
|
|
104
|
+
/** JSON's escapes are YAML's, plus the line and paragraph separators and the C1 controls, which JSON leaves raw. */
|
|
105
|
+
function doubleQuoted(text) {
|
|
106
|
+
return JSON.stringify(text).replace(/[\u007f-\u009f\u2028\u2029\ufeff]/g, (character) => `\\u${character.charCodeAt(0).toString(16).padStart(4, '0')}`);
|
|
107
|
+
}
|
|
108
|
+
/** Several lines of printable text, which a literal block keeps byte for byte. */
|
|
109
|
+
function isBlockText(text) {
|
|
110
|
+
return text.includes('\n') && !text.includes('\r') && !hasUnprintable(text) && text.trim() !== '';
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* `|` keeps one final line break, `|-` none, `|+` every one. The indentation is stated when the
|
|
114
|
+
* first line that holds something starts with a space, which a reader would take for indentation.
|
|
115
|
+
*/
|
|
116
|
+
function literalBlock(text, indent) {
|
|
117
|
+
const trailing = trailingLineBreaks(text);
|
|
118
|
+
const chomping = trailing === 0 ? '-' : trailing === 1 ? '' : '+';
|
|
119
|
+
const body = trailing === 0 ? text : text.slice(0, -1);
|
|
120
|
+
const firstFilled = body.split('\n').find((line) => line !== '') ?? '';
|
|
121
|
+
const stated = firstFilled.startsWith(' ') ? String(INDENT.length) : '';
|
|
122
|
+
const lines = body.split('\n').map((line) => (line === '' ? '' : `${indent}${line}`));
|
|
123
|
+
return [`|${stated}${chomping}`, ...lines].join('\n');
|
|
124
|
+
}
|
|
125
|
+
function trailingLineBreaks(text) {
|
|
126
|
+
let count = 0;
|
|
127
|
+
while (count < text.length && text[text.length - 1 - count] === '\n') {
|
|
128
|
+
count += 1;
|
|
129
|
+
}
|
|
130
|
+
return count;
|
|
131
|
+
}
|
|
132
|
+
//# sourceMappingURL=to-yaml.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"to-yaml.js","sourceRoot":"","sources":["../../src/yaml/to-yaml.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,GAAG,IAAI,CAAC;AAEpB,qHAAqH;AACrH,MAAM,YAAY,GAChB,kLAAkL,CAAC;AAErL,wEAAwE;AACxE,MAAM,SAAS,GAAG,2BAA2B,CAAC;AAE9C;;;;;GAKG;AACH,MAAM,UAAU,MAAM,CAAC,KAAc;IACnC,OAAO,GAAG,IAAI,UAAU,EAAE,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;AAC5D,CAAC;AAED,MAAM,UAAU;IACd,oEAAoE;IACpE,KAAK,CAAC,KAAc,EAAE,KAAa;QACjC,IAAI,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC;YACjB,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ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AAK,IAAI,CAAC,CAAC;IACb,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ddd-ts-kit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Bootstrap, scaffold and verify DDD and Clean Architecture TypeScript projects.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -29,6 +29,6 @@
|
|
|
29
29
|
"clean:packages": "node dist/bin.js check --clean-only ../kernel/src ../validation/src ../http/src ../tracing/src ../di/src ../events/src ../testing/src ../drizzle/src ../knex/src ../prisma/src ../typeorm/src ../aspects/src ../rabbitmq/src ../auth/src ../audit/src ../redis/src ../scheduling/src ../pino/src ../winston/src ../sentry/src ../kafka/src ../nats/src ../eslint-plugin/src"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@ddd-ts-kit/kernel": "^0.
|
|
32
|
+
"@ddd-ts-kit/kernel": "^0.5.0"
|
|
33
33
|
}
|
|
34
34
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Integration
|
|
2
2
|
|
|
3
|
-
`event-catalog.md` and `asyncapi.
|
|
4
|
-
from the event declarations; `openapi
|
|
3
|
+
`event-catalog.md` and `asyncapi.yaml` in this folder are generated by `npm run docs:generate`
|
|
4
|
+
from the event declarations; the contract under `openapi/` from the route definitions. This file is
|
|
5
5
|
written by the team and answers what the generated files cannot.
|
|
6
6
|
|
|
7
7
|
## Delivery guarantees
|
|
@@ -29,7 +29,7 @@ Never edit `<context>.declarations.ts`: `generate`, `docs` and `npm run dev` rew
|
|
|
29
29
|
{{#if assembly.discovery}}
|
|
30
30
|
Never edit `<context>.dependencies.ts`: `generate`, `docs` and `npm run dev` rewrite it from the constructor signatures (it registers what each constructor is injected). After changing a constructor by hand, `npx ddd-ts-kit docs`.
|
|
31
31
|
{{/if}}
|
|
32
|
-
Never edit `openapi/openapi.
|
|
32
|
+
Never edit the contracts under `openapi/` (`openapi/openapi.yaml`, one file per document when `openapi.documents` splits it), `docs/integration/asyncapi.yaml`, `docs/integration/event-catalog.md`, `{{config.platformDir}}/http/openapi-documents.ts`, `.dependency-cruiser.cjs` or the generated sections of a `CONTEXT.md`: change the code or the config, then `npm run docs:generate`, `npx ddd-ts-kit docs` and `npx ddd-ts-kit depcruise-config --write`.
|
|
33
33
|
Imports: a file of the project is imported by its alias from the project root, never by a relative path, the same directory included: `{{alias.source}}/...` for `{{config.sourceRoot}}/`, `{{alias.test}}/...` for `test/`, `{{alias.scripts}}/...` for `scripts/`, {{#if alias.extensionless}}never ending in `.js` or `.ts`, and naming a file, never a directory{{/if}}{{#unless alias.extensionless}}always ending in `.js`{{/unless}} (`imports/alias-only`, `imports/extension`; `npm run lint:fix` rewrites a relative import and a wrong ending). The alias is declared once, under `paths` in `tsconfig.json`, from `importAlias` of `ddd-ts-kit.config.json`, and the ending follows `importExtension`: never add a second entry or mapping, never change `module` or `moduleResolution` in `tsconfig.json`, and never compile without `npm run build`, which rewrites the aliases of `dist/` into relative paths ending in `.js` for Node (`imports/alias-declared`).
|
|
34
34
|
Everywhere: one exported class, interface or function per file, named after it in kebab-case; at most 350 lines a file, 30 lines and 3 parameters a function; `private` members, never `#name`; a blank line before a `return` and around `if`, `for`, `try` (`npm run lint:fix`); braces around the body of every `if`, `else`, `for`, `while` and `do`, on its own lines: a branch is visible at a glance, and a statement added to it later cannot silently fall outside it. `npm run format` (Biome, line width 120) lays out every file: do not spend tokens on line breaks.
|
|
35
35
|
|
|
@@ -39,4 +39,5 @@ The compiler is the native TypeScript 7, installed as `@typescript/native`; `typ
|
|
|
39
39
|
|
|
40
40
|
## Workflow
|
|
41
41
|
|
|
42
|
+
Follow the recommended steps in order, the supported path (`README.md`, "Recommended steps"): discover the domain, bounded contexts, glossaries, context map, bootstrap, plan the slices, build slice by slice, quality gate, document. `npx ddd-ts-kit status` says where the project stands. When asked to skip a step, say which one and what it costs, and record it in `docs/architecture/plan.md`.
|
|
42
43
|
With the ddd-ts-kit plugin: `/ddd-ts-kit:start` for a new project or to resume one, `/ddd-ts-kit:glossary` before a new name, `/ddd-ts-kit:use-case` for a feature, `/ddd-ts-kit:document` for the contracts, `/ddd-ts-kit:quality-gate` before a pull or merge request.
|
|
@@ -13,7 +13,7 @@ cp .env.example .env
|
|
|
13
13
|
npm run infra:up # the database, in Docker; add --profile observability for Jaeger
|
|
14
14
|
{{/if}}
|
|
15
15
|
{{#if orm.drizzle}}
|
|
16
|
-
npm run db:generate
|
|
16
|
+
npm run db:generate initial # migrations/<timestamp>_initial.sql, from the Drizzle schema
|
|
17
17
|
npm run db:migrate
|
|
18
18
|
{{/if}}
|
|
19
19
|
{{#if orm.knex}}
|
|
@@ -21,16 +21,22 @@ npm run db:migrate # builds, then applies migrations/ (the first one create
|
|
|
21
21
|
{{/if}}
|
|
22
22
|
{{#if orm.prisma}}
|
|
23
23
|
npm run db:client # the Prisma client and the schema of the tests, from prisma/schema.prisma
|
|
24
|
-
npm run db:generate
|
|
24
|
+
npm run db:generate initial # prisma/migrations/<timestamp>_initial/, from the schema
|
|
25
25
|
npm run db:migrate
|
|
26
26
|
{{/if}}
|
|
27
27
|
{{#if orm.typeorm}}
|
|
28
|
-
npm run build && npm run db:generate #
|
|
28
|
+
npm run build && npm run db:generate migrations/initial # migrations/<timestamp>-initial.ts, from the entity schemas
|
|
29
29
|
npm run db:migrate
|
|
30
30
|
{{/if}}
|
|
31
31
|
npm run dev
|
|
32
32
|
```
|
|
33
33
|
|
|
34
|
+
{{#if persistence.hasDatabase}}
|
|
35
|
+
Every migration is named `<timestamp>_<what-it-does>`: `npm run db:generate` refuses to run
|
|
36
|
+
without a name, so two branches never write the same file, and `npm run check:arch` reports
|
|
37
|
+
migrations that a merge left out of order (`npx ddd-ts-kit explain persistence/migration-history`).
|
|
38
|
+
|
|
39
|
+
{{/if}}
|
|
34
40
|
`npm run dev` restarts the application when a source file changes. It runs `tsx watch`, which
|
|
35
41
|
executes TypeScript directly and resolves an import alias from the `paths` of `tsconfig.json`;
|
|
36
42
|
`--env-file-if-exists=.env` gives Node the variables of `.env`
|
|
@@ -41,7 +47,9 @@ one is wrong.
|
|
|
41
47
|
{{#if docs.any}}
|
|
42
48
|
|
|
43
49
|
The API documentation is served at `/docs` and the contract at `/openapi.json`, outside
|
|
44
|
-
production unless `API_DOCS=true
|
|
50
|
+
production unless `API_DOCS=true`; a contract split into documents (`openapi.documents` of
|
|
51
|
+
`ddd-ts-kit.config.json`) is served at `/openapi/<name>.json`, and the page offers each one.
|
|
52
|
+
`npm run docs:generate` commits it as `openapi/openapi.yaml` (or one file per document).
|
|
45
53
|
{{/if}}
|
|
46
54
|
|
|
47
55
|
## How it is put together
|
|
@@ -250,13 +258,31 @@ The pipeline calls the same `ci:*` scripts; what makes it binding is described i
|
|
|
250
258
|
how the editor hook of the ddd-ts-kit plugin reacts when a file just written breaks a rule
|
|
251
259
|
(refuse it, only say so, or stay silent).
|
|
252
260
|
|
|
253
|
-
##
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
261
|
+
## Recommended steps
|
|
262
|
+
|
|
263
|
+
Follow them in order: it is the path the kit supports, and each step leaves what the next one
|
|
264
|
+
reads. With the ddd-ts-kit plugin of Claude Code, `/ddd-ts-kit:start` conducts steps 1 to 7 and
|
|
265
|
+
records them in `docs/architecture/plan.md`; `npx ddd-ts-kit status` says which step is next.
|
|
266
|
+
|
|
267
|
+
1. **Discover the domain** (`/ddd-ts-kit:discover-domain`): actors, commands, events and
|
|
268
|
+
policies in `docs/architecture/discovery.md`.
|
|
269
|
+
2. **Find the bounded contexts** (`/ddd-ts-kit:bounded-contexts`): `docs/architecture/contexts.md`.
|
|
270
|
+
3. **Write the glossaries** (`/ddd-ts-kit:glossary`) before any code: the generators refuse a
|
|
271
|
+
name the glossary of its context does not hold.
|
|
272
|
+
4. **Draw the context map** (`/ddd-ts-kit:context-map`): who is upstream, by which pattern.
|
|
273
|
+
5. **Bootstrap**: done by `init`. Declare each context with its language and its upstreams,
|
|
274
|
+
upstreams first: `npx ddd-ts-kit generate context <name> --classification <core|supporting|generic> --term "<Term>=<meaning>" --upstream <context>:<pattern>`.
|
|
275
|
+
6. **Plan the slices** (`/ddd-ts-kit:plan-slices`): one use case per slice, in
|
|
276
|
+
`docs/architecture/slices.md`.
|
|
277
|
+
7. **Build slice by slice** (`/ddd-ts-kit:use-case`): `npx ddd-ts-kit generate ...`, then the
|
|
278
|
+
`TODO(domain)` places it lists (`npx ddd-ts-kit todo <context>`); builders and fakes, no mocks.
|
|
279
|
+
8. **Pass the gate** (`/ddd-ts-kit:quality-gate`): `npm run verify` before each merge.
|
|
280
|
+
9. **Document** (`/ddd-ts-kit:document`): `npm run docs:generate`, committed with the code.
|
|
281
|
+
|
|
282
|
+
A step skipped costs later: boundaries drawn from the tables, a glossary written after the
|
|
283
|
+
code, a first integration made by a direct import the checker then refuses. The method, step by
|
|
284
|
+
step: https://github.com/gbourgeat/ddd-ts-kit/blob/main/docs/guides/methodology.md; the command
|
|
285
|
+
for each moment of the project: https://github.com/gbourgeat/ddd-ts-kit/blob/main/docs/guides/commands.md.
|
|
260
286
|
|
|
261
287
|
| Script | Does |
|
|
262
288
|
|---|---|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DataSource } from 'typeorm';
|
|
2
2
|
import { entities } from '{{alias.platform}}/database/schema{{alias.ext}}';
|
|
3
3
|
|
|
4
|
-
// Read by the TypeORM CLI only (`npm run db:generate
|
|
4
|
+
// Read by the TypeORM CLI only (`npm run db:generate migrations/<what-it-does>`, `npm run db:migrate`), once compiled.
|
|
5
5
|
export default new DataSource({
|
|
6
6
|
type: 'postgres',
|
|
7
7
|
url: process.env['DATABASE_URL'] ?? '',
|
|
@@ -4,5 +4,7 @@ export default {
|
|
|
4
4
|
dialect: 'postgresql',
|
|
5
5
|
schema: './{{config.platformDir}}/database/schema.ts',
|
|
6
6
|
out: './migrations',
|
|
7
|
+
// `<timestamp>_<what-it-does>.sql` (`npm run db:generate add-invoices`): two branches never write the same file.
|
|
8
|
+
migrations: { prefix: 'timestamp' },
|
|
7
9
|
dbCredentials: { url: process.env['DATABASE_URL'] ?? '' },
|
|
8
10
|
} satisfies Config;
|
|
@@ -1,9 +1,15 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';
|
|
1
2
|
import process from 'node:process';
|
|
2
3
|
|
|
3
|
-
// Read by the knex CLI (`npm run db:migrate`, `npm run db:generate <
|
|
4
|
-
// call the compiled schema of the application: run `npm run build` first.
|
|
4
|
+
// Read by the knex CLI (`npm run db:migrate`, `npm run db:generate <what-it-does>`). The migrations
|
|
5
|
+
// call the compiled schema of the application: run `npm run build` first. A new migration is
|
|
6
|
+
// `<timestamp>_<what-it-does>.js`, written from the ES module stub of knex: the project is ESM.
|
|
5
7
|
export default {
|
|
6
8
|
client: 'pg',
|
|
7
9
|
connection: process.env.DATABASE_URL,
|
|
8
|
-
migrations: {
|
|
10
|
+
migrations: {
|
|
11
|
+
directory: './migrations',
|
|
12
|
+
loadExtensions: ['.js'],
|
|
13
|
+
stub: createRequire(import.meta.url).resolve('knex/lib/migrations/migrate/stub/mjs.stub'),
|
|
14
|
+
},
|
|
9
15
|
};
|
|
@@ -10,7 +10,7 @@ export const processedEvents = processedEventsTable('messaging');
|
|
|
10
10
|
/** The schema of the audit trail. */
|
|
11
11
|
export const AUDIT_SCHEMA = 'audit';
|
|
12
12
|
|
|
13
|
-
// TODO(platform): drizzle-kit writes no trigger. After `npm run db:generate
|
|
13
|
+
// TODO(platform): drizzle-kit writes no trigger. After the first `npm run db:generate <name>`, add a custom migration (`npm run db:generate -- audit-guard --custom`) holding the statements `npm run db:audit-guard` prints: they make the entries refuse UPDATE, DELETE and TRUNCATE.
|
|
14
14
|
export const auditEntries = auditEntriesTable(AUDIT_SCHEMA);
|
|
15
15
|
export const auditChains = auditChainsTable(AUDIT_SCHEMA);
|
|
16
16
|
{{/if}}
|