@beignet/cli 0.0.1 → 0.0.3
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/CHANGELOG.md +26 -0
- package/README.md +144 -55
- package/dist/config.d.ts +31 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +18 -0
- package/dist/config.js.map +1 -1
- package/dist/create.d.ts +9 -0
- package/dist/create.d.ts.map +1 -1
- package/dist/create.js +5 -0
- package/dist/create.js.map +1 -1
- package/dist/db.d.ts +36 -0
- package/dist/db.d.ts.map +1 -0
- package/dist/db.js +111 -0
- package/dist/db.js.map +1 -0
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +243 -2
- package/dist/index.js.map +1 -1
- package/dist/inspect.d.ts +24 -0
- package/dist/inspect.d.ts.map +1 -1
- package/dist/inspect.js +288 -4
- package/dist/inspect.js.map +1 -1
- package/dist/lint.d.ts +12 -0
- package/dist/lint.d.ts.map +1 -1
- package/dist/lint.js +30 -5
- package/dist/lint.js.map +1 -1
- package/dist/make.d.ts +91 -0
- package/dist/make.d.ts.map +1 -1
- package/dist/make.js +602 -72
- package/dist/make.js.map +1 -1
- package/dist/templates.d.ts +33 -0
- package/dist/templates.d.ts.map +1 -1
- package/dist/templates.js +1396 -112
- package/dist/templates.js.map +1 -1
- package/package.json +1 -1
- package/src/config.ts +31 -0
- package/src/create.ts +11 -0
- package/src/db.ts +166 -0
- package/src/index.ts +320 -0
- package/src/inspect.ts +497 -3
- package/src/lint.ts +43 -9
- package/src/make.ts +917 -80
- package/src/templates.ts +1425 -111
package/src/lint.ts
CHANGED
|
@@ -30,6 +30,7 @@ type SourceLayer =
|
|
|
30
30
|
| "server"
|
|
31
31
|
| "test"
|
|
32
32
|
| "use-case"
|
|
33
|
+
| "workflow"
|
|
33
34
|
| "unknown";
|
|
34
35
|
|
|
35
36
|
type ImportReference = {
|
|
@@ -38,6 +39,9 @@ type ImportReference = {
|
|
|
38
39
|
packageName?: string;
|
|
39
40
|
};
|
|
40
41
|
|
|
42
|
+
/**
|
|
43
|
+
* Dependency-direction lint diagnostic.
|
|
44
|
+
*/
|
|
41
45
|
export type LintDiagnostic = {
|
|
42
46
|
severity: "error";
|
|
43
47
|
code: string;
|
|
@@ -46,12 +50,18 @@ export type LintDiagnostic = {
|
|
|
46
50
|
importPath: string;
|
|
47
51
|
};
|
|
48
52
|
|
|
53
|
+
/**
|
|
54
|
+
* Result returned by `beignet lint`.
|
|
55
|
+
*/
|
|
49
56
|
export type LintAppResult = {
|
|
50
57
|
targetDir: string;
|
|
51
58
|
config: ResolvedBeignetConfig;
|
|
52
59
|
diagnostics: LintDiagnostic[];
|
|
53
60
|
};
|
|
54
61
|
|
|
62
|
+
/**
|
|
63
|
+
* Inspect app imports and report dependency-direction violations.
|
|
64
|
+
*/
|
|
55
65
|
export async function lintApp(
|
|
56
66
|
options: LintAppOptions = {},
|
|
57
67
|
): Promise<LintAppResult> {
|
|
@@ -82,6 +92,9 @@ export async function lintApp(
|
|
|
82
92
|
};
|
|
83
93
|
}
|
|
84
94
|
|
|
95
|
+
/**
|
|
96
|
+
* Format dependency-direction lint diagnostics for CLI output.
|
|
97
|
+
*/
|
|
85
98
|
export function formatLint(result: LintAppResult): string {
|
|
86
99
|
if (result.diagnostics.length === 0) {
|
|
87
100
|
return `No Beignet lint issues found in ${result.targetDir}.`;
|
|
@@ -504,13 +517,14 @@ function appImportViolation(
|
|
|
504
517
|
"route",
|
|
505
518
|
"server",
|
|
506
519
|
"use-case",
|
|
520
|
+
"workflow",
|
|
507
521
|
].includes(targetLayer)
|
|
508
522
|
) {
|
|
509
523
|
return targetLayer;
|
|
510
524
|
}
|
|
511
525
|
|
|
512
526
|
if (
|
|
513
|
-
sourceLayer === "use-case" &&
|
|
527
|
+
(sourceLayer === "use-case" || sourceLayer === "workflow") &&
|
|
514
528
|
["app", "client", "component", "infra", "route", "server"].includes(
|
|
515
529
|
targetLayer,
|
|
516
530
|
)
|
|
@@ -520,23 +534,31 @@ function appImportViolation(
|
|
|
520
534
|
|
|
521
535
|
if (
|
|
522
536
|
["feature-port", "policy", "port"].includes(sourceLayer) &&
|
|
523
|
-
[
|
|
524
|
-
|
|
525
|
-
|
|
537
|
+
[
|
|
538
|
+
"app",
|
|
539
|
+
"client",
|
|
540
|
+
"component",
|
|
541
|
+
"infra",
|
|
542
|
+
"route",
|
|
543
|
+
"server",
|
|
544
|
+
"workflow",
|
|
545
|
+
].includes(targetLayer)
|
|
526
546
|
) {
|
|
527
547
|
return targetLayer;
|
|
528
548
|
}
|
|
529
549
|
|
|
530
550
|
if (
|
|
531
551
|
sourceLayer === "contract" &&
|
|
532
|
-
["app", "client", "component", "infra", "route"].includes(
|
|
552
|
+
["app", "client", "component", "infra", "route", "workflow"].includes(
|
|
553
|
+
targetLayer,
|
|
554
|
+
)
|
|
533
555
|
) {
|
|
534
556
|
return targetLayer;
|
|
535
557
|
}
|
|
536
558
|
|
|
537
559
|
if (
|
|
538
560
|
sourceLayer === "route" &&
|
|
539
|
-
["app", "client", "component", "infra"].includes(targetLayer)
|
|
561
|
+
["app", "client", "component", "infra", "workflow"].includes(targetLayer)
|
|
540
562
|
) {
|
|
541
563
|
return targetLayer;
|
|
542
564
|
}
|
|
@@ -556,9 +578,14 @@ function packageImportViolation(
|
|
|
556
578
|
}
|
|
557
579
|
|
|
558
580
|
if (
|
|
559
|
-
[
|
|
560
|
-
|
|
561
|
-
|
|
581
|
+
[
|
|
582
|
+
"contract",
|
|
583
|
+
"feature-port",
|
|
584
|
+
"policy",
|
|
585
|
+
"port",
|
|
586
|
+
"use-case",
|
|
587
|
+
"workflow",
|
|
588
|
+
].includes(sourceLayer)
|
|
562
589
|
) {
|
|
563
590
|
return (
|
|
564
591
|
coreBannedPackages.has(packageName) ||
|
|
@@ -716,6 +743,13 @@ function classifyPath(
|
|
|
716
743
|
if (layerSegment === "ports") return "feature-port";
|
|
717
744
|
if (layerSegment === "policy") return "policy";
|
|
718
745
|
if (layerSegment === "use-cases") return "use-case";
|
|
746
|
+
if (
|
|
747
|
+
["jobs", "listeners", "notifications", "schedules", "uploads"].includes(
|
|
748
|
+
layerSegment,
|
|
749
|
+
)
|
|
750
|
+
) {
|
|
751
|
+
return "workflow";
|
|
752
|
+
}
|
|
719
753
|
if (layerSegment === "components") return "component";
|
|
720
754
|
}
|
|
721
755
|
|