Skip to content

Commit 210213f

Browse files
committedMar 1, 2023
refactor: deps-cruiser
1 parent 760e605 commit 210213f

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed
 

‎.dependency-cruiser.js

+15-7
Original file line numberDiff line numberDiff line change
@@ -19,36 +19,44 @@ const infrastructureLayerPaths = [
1919
'repository',
2020
];
2121

22+
const domainLayerPaths = [
23+
'domain',
24+
'entity\\.ts$',
25+
'aggregate\\.ts$',
26+
'domain-event\\.ts$',
27+
'value-object\\.ts$',
28+
];
29+
2230
module.exports = {
2331
forbidden: [
2432
/* user defined rules */
2533
{
2634
name: 'no-domain-to-app-deps',
2735
comment: 'Domain layer cannot depend on application layer',
2836
severity: 'error',
29-
from: { path: 'domain' },
37+
from: { path: domainLayerPaths },
3038
to: {
31-
path: [...applicationLayerPaths],
39+
path: applicationLayerPaths,
3240
pathNot: ['AppRequestContext\\.ts$'],
3341
},
3442
},
3543
{
3644
name: 'no-domain-to-infra-deps',
3745
comment: 'Domain layer cannot depend on infrastructure layer',
3846
severity: 'error',
39-
from: { path: 'domain' },
47+
from: { path: domainLayerPaths },
4048
to: {
41-
path: [...infrastructureLayerPaths],
49+
path: infrastructureLayerPaths,
4250
pathNot: ['port\\.ts$'],
4351
},
4452
},
4553
{
4654
name: 'no-infra-to-app-deps',
4755
comment: 'Infrastructure layer cannot depend on application layer',
4856
severity: 'error',
49-
from: { path: [...infrastructureLayerPaths] },
57+
from: { path: infrastructureLayerPaths },
5058
to: {
51-
path: [...applicationLayerPaths],
59+
path: applicationLayerPaths,
5260
pathNot: ['AppRequestContext\\.ts$'],
5361
},
5462
},
@@ -65,7 +73,7 @@ module.exports = {
6573
],
6674
},
6775
to: {
68-
path: [...applicationLayerPaths],
76+
path: applicationLayerPaths,
6977
pathNot: ['AppRequestContext\\.ts$'],
7078
},
7179
},

0 commit comments

Comments
 (0)
Failed to load comments.