@domain-first/project-structure 8.2.0 → 8.4.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/init.cjs CHANGED
@@ -1194,6 +1194,61 @@ const currentBranch = (): EnvBranch => {
1194
1194
 
1195
1195
  export const envBranchedWire = branchedWire(currentBranch)`;
1196
1196
  };
1197
+ new Set([
1198
+ 'node_modules',
1199
+ '.git',
1200
+ '.next',
1201
+ 'dist',
1202
+ 'build',
1203
+ 'out',
1204
+ 'coverage',
1205
+ 'storybook-static'
1206
+ ]);
1207
+ const serviceLayout = (layer)=>({
1208
+ title: `${layer[0].toUpperCase()}${layer.slice(1)} services`,
1209
+ core: (ClassName)=>`${ClassName}${layer[0].toUpperCase()}${layer.slice(1)}Service`,
1210
+ files: ({ name })=>[
1211
+ `${layer}/services/${name}-${layer}-service.ts`,
1212
+ `${layer}/services/${name}-${layer}-service.spec.ts`,
1213
+ `wiring/${layer}-services/wire-${name}-${layer}-service.ts`
1214
+ ],
1215
+ wired: true,
1216
+ sharedKernel: true
1217
+ });
1218
+ const handlerLayout = (kind)=>{
1219
+ const folder = 'command' === kind ? 'commands' : 'queries';
1220
+ const Suffix = 'command' === kind ? 'Command' : 'Query';
1221
+ return {
1222
+ title: 'command' === kind ? 'Commands' : 'Queries',
1223
+ core: (ClassName)=>`${ClassName}${Suffix}`,
1224
+ files: ({ name }, labels)=>[
1225
+ `application/${folder}/${name}-${kind}.ts`,
1226
+ `application/${folder}/${name}-${kind}.spec.ts`,
1227
+ ...labels.map((label)=>`infrastructure/${folder}/${label}/${label}-${name}-${kind}.ts`),
1228
+ `wiring/${folder}/wire-${name}-${kind}.ts`
1229
+ ],
1230
+ implementations: `infrastructure/${folder}`,
1231
+ wired: true,
1232
+ sharedKernel: false
1233
+ };
1234
+ };
1235
+ const domainModelLayout = (kind)=>{
1236
+ const folder = 'entity' === kind ? 'entities' : 'value-objects';
1237
+ return {
1238
+ title: 'entity' === kind ? 'Entities' : 'Value objects',
1239
+ core: (ClassName)=>ClassName,
1240
+ files: ({ name, aggregate })=>{
1241
+ const base = aggregate ? `domain/aggregates/${aggregate}/${folder}` : `domain/${folder}`;
1242
+ return [
1243
+ `${base}/${name}.${kind}.ts`,
1244
+ `${base}/${name}.${kind}.spec.ts`
1245
+ ];
1246
+ },
1247
+ wired: false,
1248
+ sharedKernel: true
1249
+ };
1250
+ };
1251
+ domainModelLayout('entity'), domainModelLayout('value-object'), serviceLayout('domain'), serviceLayout('application'), serviceLayout('infrastructure'), serviceLayout('presentation'), handlerLayout('command'), handlerLayout('query');
1197
1252
  const configurationSections = [
1198
1253
  'project',
1199
1254
  'backend',
@@ -1472,61 +1527,6 @@ const initializeUseCase = async (section)=>{
1472
1527
  }
1473
1528
  return nextSteps;
1474
1529
  };
1475
- new Set([
1476
- 'node_modules',
1477
- '.git',
1478
- '.next',
1479
- 'dist',
1480
- 'build',
1481
- 'out',
1482
- 'coverage',
1483
- 'storybook-static'
1484
- ]);
1485
- const serviceLayout = (layer)=>({
1486
- title: `${layer[0].toUpperCase()}${layer.slice(1)} services`,
1487
- core: (ClassName)=>`${ClassName}${layer[0].toUpperCase()}${layer.slice(1)}Service`,
1488
- files: ({ name })=>[
1489
- `${layer}/services/${name}-${layer}-service.ts`,
1490
- `${layer}/services/${name}-${layer}-service.spec.ts`,
1491
- `wiring/${layer}-services/wire-${name}-${layer}-service.ts`
1492
- ],
1493
- wired: true,
1494
- sharedKernel: true
1495
- });
1496
- const handlerLayout = (kind)=>{
1497
- const folder = 'command' === kind ? 'commands' : 'queries';
1498
- const Suffix = 'command' === kind ? 'Command' : 'Query';
1499
- return {
1500
- title: 'command' === kind ? 'Commands' : 'Queries',
1501
- core: (ClassName)=>`${ClassName}${Suffix}`,
1502
- files: ({ name }, labels)=>[
1503
- `application/${folder}/${name}-${kind}.ts`,
1504
- `application/${folder}/${name}-${kind}.spec.ts`,
1505
- ...labels.map((label)=>`infrastructure/${folder}/${label}/${label}-${name}-${kind}.ts`),
1506
- `wiring/${folder}/wire-${name}-${kind}.ts`
1507
- ],
1508
- implementations: `infrastructure/${folder}`,
1509
- wired: true,
1510
- sharedKernel: false
1511
- };
1512
- };
1513
- const domainModelLayout = (kind)=>{
1514
- const folder = 'entity' === kind ? 'entities' : 'value-objects';
1515
- return {
1516
- title: 'entity' === kind ? 'Entities' : 'Value objects',
1517
- core: (ClassName)=>ClassName,
1518
- files: ({ name, aggregate })=>{
1519
- const base = aggregate ? `domain/aggregates/${aggregate}/${folder}` : `domain/${folder}`;
1520
- return [
1521
- `${base}/${name}.${kind}.ts`,
1522
- `${base}/${name}.${kind}.spec.ts`
1523
- ];
1524
- },
1525
- wired: false,
1526
- sharedKernel: true
1527
- };
1528
- };
1529
- domainModelLayout('entity'), domainModelLayout('value-object'), serviceLayout('domain'), serviceLayout('application'), serviceLayout('infrastructure'), serviceLayout('presentation'), handlerLayout('command'), handlerLayout('query');
1530
1530
  Symbol('enter-implementation-type-once');
1531
1531
  const help = `Usage: df-init [--section project|backend|frontend]
1532
1532