@echojs-ecosystem/architect 0.1.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/README.md +89 -0
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/index.js +791 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/index.d.ts +170 -0
- package/dist/index.js +711 -0
- package/dist/index.js.map +1 -0
- package/package.json +67 -0
package/README.md
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
# @echojs-ecosystem/architect
|
|
4
|
+
|
|
5
|
+
**Architecture linter for EchoJS — enforce layers, public APIs, and import boundaries.**
|
|
6
|
+
|
|
7
|
+
[](https://www.npmjs.com/package/@echojs-ecosystem/architect)
|
|
8
|
+
[](https://echojs.dev/docs/packages/architect)
|
|
9
|
+
|
|
10
|
+
</div>
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
Lint **folder structure and dependency direction** from `architect.config.ts`. Used in CI on the EchoJS docs site and example apps. Inspired by [Evolution Design](https://github.com/evolution-design/evolution-design).
|
|
15
|
+
|
|
16
|
+
## Features
|
|
17
|
+
|
|
18
|
+
- **Layer rules** — e.g. `pages → widgets → entities → shared`
|
|
19
|
+
- **Public API enforcement** — no deep imports; use `index.ts` barrels
|
|
20
|
+
- **CLI** — `echo-architect lint`, `--watch`, `--fix`
|
|
21
|
+
- **Programmatic API** — `lint()`, `watchConfig()` for custom tooling
|
|
22
|
+
- **Presets** — Feature-Sliced Design rules out of the box
|
|
23
|
+
|
|
24
|
+
## Install
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
npm install -D @echojs-ecosystem/architect
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## CLI
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
npx echo-architect lint
|
|
34
|
+
npx echo-architect lint --watch
|
|
35
|
+
npx echo-architect lint --fix
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Add to `package.json`:
|
|
39
|
+
|
|
40
|
+
```json
|
|
41
|
+
{
|
|
42
|
+
"scripts": {
|
|
43
|
+
"architect": "echo-architect lint",
|
|
44
|
+
"architect:watch": "echo-architect lint --watch"
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Configuration
|
|
50
|
+
|
|
51
|
+
`architect.config.ts` in your project root:
|
|
52
|
+
|
|
53
|
+
```ts
|
|
54
|
+
import {
|
|
55
|
+
abstraction,
|
|
56
|
+
defineConfig,
|
|
57
|
+
dependenciesDirection,
|
|
58
|
+
publicAbstraction,
|
|
59
|
+
} from "@echojs-ecosystem/architect";
|
|
60
|
+
|
|
61
|
+
export default defineConfig({
|
|
62
|
+
root: abstraction({
|
|
63
|
+
name: "root",
|
|
64
|
+
children: {
|
|
65
|
+
src: abstraction({
|
|
66
|
+
name: "src",
|
|
67
|
+
children: { "pages/**": abstraction({ name: "pages" }) },
|
|
68
|
+
rules: [
|
|
69
|
+
dependenciesDirection(["app", "pages", "widgets", "entities", "shared"]),
|
|
70
|
+
publicAbstraction("pages"),
|
|
71
|
+
],
|
|
72
|
+
}),
|
|
73
|
+
},
|
|
74
|
+
}),
|
|
75
|
+
});
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Programmatic API
|
|
79
|
+
|
|
80
|
+
```ts
|
|
81
|
+
import { lint, defineConfig } from "@echojs-ecosystem/architect";
|
|
82
|
+
|
|
83
|
+
const result = await lint({ configPath: "./architect.config.ts" });
|
|
84
|
+
console.log(result.errors);
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Documentation
|
|
88
|
+
|
|
89
|
+
[echojs.dev/docs/packages/architect](https://echojs.dev/docs/packages/architect)
|