@domain-first/project-structure 2.4.0 → 2.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/dist/index.cjs +25 -3
- package/dist/index.js +25 -3
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -512,7 +512,7 @@ describe('${naming.withSpaces} command', () => {
|
|
|
512
512
|
expect(${naming.variableName}Command).toBeDefined()
|
|
513
513
|
})
|
|
514
514
|
})
|
|
515
|
-
|
|
515
|
+
`.trim());
|
|
516
516
|
if (!isOrchestrator) {
|
|
517
517
|
const implementationType = await (0, prompts_namespaceObject.input)({
|
|
518
518
|
message: 'Command infrastructure implementation type:',
|
|
@@ -814,6 +814,10 @@ const scaffoldNewQuery = async (boundedContextFolder)=>{
|
|
|
814
814
|
message: 'Name: '
|
|
815
815
|
});
|
|
816
816
|
const naming = new UnknownFormatNaming(queryName);
|
|
817
|
+
let scaffoldUnitTests;
|
|
818
|
+
if (ConfigFile.Instance.data.testingLibrary) scaffoldUnitTests = await (0, prompts_namespaceObject.confirm)({
|
|
819
|
+
message: 'Scaffold unit-tests'
|
|
820
|
+
});
|
|
817
821
|
const queryType = await (0, prompts_namespaceObject.select)({
|
|
818
822
|
choices: [
|
|
819
823
|
'Execution (with infrastructure implementation)',
|
|
@@ -822,6 +826,25 @@ const scaffoldNewQuery = async (boundedContextFolder)=>{
|
|
|
822
826
|
message: 'Query type'
|
|
823
827
|
});
|
|
824
828
|
const isOrchestrator = 'Orchestrator (no infrastructure implementation)' === queryType;
|
|
829
|
+
if (scaffoldUnitTests) queriesFolder.subitem([
|
|
830
|
+
isOrchestrator ? 'orchestration' : 'execution'
|
|
831
|
+
]).createFile(`${naming.fileName}-query.spec.ts`, `
|
|
832
|
+
import { describe, test, expect, beforeEach } from '${ConfigFile.Instance.data.testingLibrary}'
|
|
833
|
+
import { type ${naming.ClassName}Query } from './${naming.fileName}-query'
|
|
834
|
+
import { wire${naming.ClassName}Query } from '../../../wiring/queries/wire-${naming.fileName}-query'
|
|
835
|
+
|
|
836
|
+
let ${naming.variableName}Query: ${naming.ClassName}Query
|
|
837
|
+
|
|
838
|
+
beforeEach(() => {
|
|
839
|
+
${naming.variableName}Query = wire${naming.ClassName}Query()
|
|
840
|
+
})
|
|
841
|
+
|
|
842
|
+
describe('${naming.withSpaces} query', () => {
|
|
843
|
+
test('can be wired', () => {
|
|
844
|
+
expect(${naming.variableName}Query).toBeDefined()
|
|
845
|
+
})
|
|
846
|
+
})
|
|
847
|
+
`.trim());
|
|
825
848
|
if (!isOrchestrator) {
|
|
826
849
|
const implementationType = await (0, prompts_namespaceObject.input)({
|
|
827
850
|
message: 'Query infrastructure implementation type:',
|
|
@@ -935,11 +958,10 @@ export class ${naming.ClassName}Query {
|
|
|
935
958
|
}`.trim());
|
|
936
959
|
if (ConfigFile.Instance.data.domainFirstPackages.includes('@domain-first/wire')) boundedContextFolder.subitem([
|
|
937
960
|
'wiring',
|
|
938
|
-
'application',
|
|
939
961
|
'queries'
|
|
940
962
|
]).createFile(`wire-${naming.fileName}-query.ts`, `
|
|
941
963
|
import { wireClass } from '@domain-first/wire'
|
|
942
|
-
import { ${naming.ClassName}Query } from '
|
|
964
|
+
import { ${naming.ClassName}Query } from '../../application/queries/orchestration/${naming.fileName}-query'
|
|
943
965
|
|
|
944
966
|
export const wire${naming.ClassName}Query = wireClass(${naming.ClassName}Query, [])
|
|
945
967
|
`.trim());
|
package/dist/index.js
CHANGED
|
@@ -482,7 +482,7 @@ describe('${naming.withSpaces} command', () => {
|
|
|
482
482
|
expect(${naming.variableName}Command).toBeDefined()
|
|
483
483
|
})
|
|
484
484
|
})
|
|
485
|
-
|
|
485
|
+
`.trim());
|
|
486
486
|
if (!isOrchestrator) {
|
|
487
487
|
const implementationType = await input({
|
|
488
488
|
message: 'Command infrastructure implementation type:',
|
|
@@ -784,6 +784,10 @@ const scaffoldNewQuery = async (boundedContextFolder)=>{
|
|
|
784
784
|
message: 'Name: '
|
|
785
785
|
});
|
|
786
786
|
const naming = new UnknownFormatNaming(queryName);
|
|
787
|
+
let scaffoldUnitTests;
|
|
788
|
+
if (ConfigFile.Instance.data.testingLibrary) scaffoldUnitTests = await prompts_confirm({
|
|
789
|
+
message: 'Scaffold unit-tests'
|
|
790
|
+
});
|
|
787
791
|
const queryType = await prompts_select({
|
|
788
792
|
choices: [
|
|
789
793
|
'Execution (with infrastructure implementation)',
|
|
@@ -792,6 +796,25 @@ const scaffoldNewQuery = async (boundedContextFolder)=>{
|
|
|
792
796
|
message: 'Query type'
|
|
793
797
|
});
|
|
794
798
|
const isOrchestrator = 'Orchestrator (no infrastructure implementation)' === queryType;
|
|
799
|
+
if (scaffoldUnitTests) queriesFolder.subitem([
|
|
800
|
+
isOrchestrator ? 'orchestration' : 'execution'
|
|
801
|
+
]).createFile(`${naming.fileName}-query.spec.ts`, `
|
|
802
|
+
import { describe, test, expect, beforeEach } from '${ConfigFile.Instance.data.testingLibrary}'
|
|
803
|
+
import { type ${naming.ClassName}Query } from './${naming.fileName}-query'
|
|
804
|
+
import { wire${naming.ClassName}Query } from '../../../wiring/queries/wire-${naming.fileName}-query'
|
|
805
|
+
|
|
806
|
+
let ${naming.variableName}Query: ${naming.ClassName}Query
|
|
807
|
+
|
|
808
|
+
beforeEach(() => {
|
|
809
|
+
${naming.variableName}Query = wire${naming.ClassName}Query()
|
|
810
|
+
})
|
|
811
|
+
|
|
812
|
+
describe('${naming.withSpaces} query', () => {
|
|
813
|
+
test('can be wired', () => {
|
|
814
|
+
expect(${naming.variableName}Query).toBeDefined()
|
|
815
|
+
})
|
|
816
|
+
})
|
|
817
|
+
`.trim());
|
|
795
818
|
if (!isOrchestrator) {
|
|
796
819
|
const implementationType = await input({
|
|
797
820
|
message: 'Query infrastructure implementation type:',
|
|
@@ -905,11 +928,10 @@ export class ${naming.ClassName}Query {
|
|
|
905
928
|
}`.trim());
|
|
906
929
|
if (ConfigFile.Instance.data.domainFirstPackages.includes('@domain-first/wire')) boundedContextFolder.subitem([
|
|
907
930
|
'wiring',
|
|
908
|
-
'application',
|
|
909
931
|
'queries'
|
|
910
932
|
]).createFile(`wire-${naming.fileName}-query.ts`, `
|
|
911
933
|
import { wireClass } from '@domain-first/wire'
|
|
912
|
-
import { ${naming.ClassName}Query } from '
|
|
934
|
+
import { ${naming.ClassName}Query } from '../../application/queries/orchestration/${naming.fileName}-query'
|
|
913
935
|
|
|
914
936
|
export const wire${naming.ClassName}Query = wireClass(${naming.ClassName}Query, [])
|
|
915
937
|
`.trim());
|