@living-architecture/riviere-extract-conventions 0.1.0 → 0.2.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.
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type ExtractionConfig } from '@living-architecture/riviere-extract-config';
|
|
2
|
+
export declare function loadDefaultConfig(): unknown;
|
|
3
|
+
export declare function getFirstModule(config: unknown): ExtractionConfig['modules'][number];
|
|
4
|
+
//# sourceMappingURL=default-config-fixtures.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"default-config-fixtures.d.ts","sourceRoot":"","sources":["../src/default-config-fixtures.ts"],"names":[],"mappings":"AAKA,OAAO,EAEL,KAAK,gBAAgB,EACtB,MAAM,6CAA6C,CAAA;AAIpD,wBAAgB,iBAAiB,IAAI,OAAO,CAI3C;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,OAAO,GAAG,gBAAgB,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,CAanF"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs';
|
|
2
|
+
import { join, dirname } from 'node:path';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
import { isValidExtractionConfig, } from '@living-architecture/riviere-extract-config';
|
|
5
|
+
const CURRENT_DIR = dirname(fileURLToPath(import.meta.url));
|
|
6
|
+
export function loadDefaultConfig() {
|
|
7
|
+
const configPath = join(CURRENT_DIR, 'default-extraction.config.json');
|
|
8
|
+
const configContent = readFileSync(configPath, 'utf-8');
|
|
9
|
+
return JSON.parse(configContent);
|
|
10
|
+
}
|
|
11
|
+
export function getFirstModule(config) {
|
|
12
|
+
if (!isValidExtractionConfig(config)) {
|
|
13
|
+
throw new Error(`Expected valid ExtractionConfig. Got invalid config. Validation needed.`);
|
|
14
|
+
}
|
|
15
|
+
const [module] = config.modules;
|
|
16
|
+
if (!module) {
|
|
17
|
+
throw new Error(`Expected modules[0] after schema validation. Got undefined. Schema enforces minItems: 1.`);
|
|
18
|
+
}
|
|
19
|
+
return module;
|
|
20
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@living-architecture/riviere-extract-conventions",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -15,10 +15,15 @@
|
|
|
15
15
|
"types": "./dist/index.d.ts",
|
|
16
16
|
"import": "./dist/index.js",
|
|
17
17
|
"default": "./dist/index.js"
|
|
18
|
-
}
|
|
18
|
+
},
|
|
19
|
+
"./default-config": "./src/default-extraction.config.json"
|
|
19
20
|
},
|
|
20
21
|
"files": [
|
|
21
22
|
"dist",
|
|
23
|
+
"src/default-extraction.config.json",
|
|
22
24
|
"!**/*.tsbuildinfo"
|
|
23
|
-
]
|
|
25
|
+
],
|
|
26
|
+
"dependencies": {
|
|
27
|
+
"@living-architecture/riviere-extract-config": "0.1.3"
|
|
28
|
+
}
|
|
24
29
|
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://living-architecture.dev/schemas/extraction-config.schema.json",
|
|
3
|
+
"modules": [
|
|
4
|
+
{
|
|
5
|
+
"path": "**/*.ts",
|
|
6
|
+
"api": {
|
|
7
|
+
"find": "methods",
|
|
8
|
+
"where": {
|
|
9
|
+
"inClassWith": {
|
|
10
|
+
"hasDecorator": {
|
|
11
|
+
"name": "APIContainer",
|
|
12
|
+
"from": "@living-architecture/riviere-extract-conventions"
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"useCase": {
|
|
18
|
+
"find": "classes",
|
|
19
|
+
"where": {
|
|
20
|
+
"hasDecorator": {
|
|
21
|
+
"name": "UseCase",
|
|
22
|
+
"from": "@living-architecture/riviere-extract-conventions"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"domainOp": {
|
|
27
|
+
"find": "methods",
|
|
28
|
+
"where": {
|
|
29
|
+
"inClassWith": {
|
|
30
|
+
"hasDecorator": {
|
|
31
|
+
"name": "DomainOpContainer",
|
|
32
|
+
"from": "@living-architecture/riviere-extract-conventions"
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"event": {
|
|
38
|
+
"find": "classes",
|
|
39
|
+
"where": {
|
|
40
|
+
"hasDecorator": {
|
|
41
|
+
"name": "Event",
|
|
42
|
+
"from": "@living-architecture/riviere-extract-conventions"
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"eventHandler": {
|
|
47
|
+
"find": "methods",
|
|
48
|
+
"where": {
|
|
49
|
+
"inClassWith": {
|
|
50
|
+
"hasDecorator": {
|
|
51
|
+
"name": "EventHandlerContainer",
|
|
52
|
+
"from": "@living-architecture/riviere-extract-conventions"
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
"ui": {
|
|
58
|
+
"find": "classes",
|
|
59
|
+
"where": {
|
|
60
|
+
"hasDecorator": {
|
|
61
|
+
"name": "UI",
|
|
62
|
+
"from": "@living-architecture/riviere-extract-conventions"
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
]
|
|
68
|
+
}
|