You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This aspect provides the ability to write configuration files in the workspace.
7
-
It provides an API to write configuration files in the workspace, and also provides cli commands to write configuration files.
7
+
The main goal for these config file writers is to ensure that the LSP/IDE produces the same results as running the relevant commands (such as bit lint, bit format, or bit check types/TypeScript during build). It provides an API to write configuration files in the workspace, and also provides CLI commands to do so.
8
8
9
9
### Commands
10
10
@@ -14,3 +14,101 @@ Main command is `bit ws-config` which has the following sub commands:
14
14
-`bit ws-config clean` - remove all configuration files from the workspace
15
15
-`bit ws-config list` - list all registered configuration writers.
16
16
this is useful for filtering used configuration writers when using the `--writers` flag in the write/clean commands.
17
+
18
+
### How it works
19
+
20
+
**Background:**
21
+
22
+
Bit structures its workspaces in a manner that, while reminiscent of monorepos, introduces additional complexities:
23
+
24
+
1.**Component Isolation:** Each component behaves as an isolated package with its own `package.json` and configuration files (like `tsconfig`, `eslint`, `prettier`, `jest`, etc.). Some components might share configurations.
25
+
26
+
2.**Directory Structure Example:**
27
+
28
+
```
29
+
- Root
30
+
- node_modules
31
+
- React-env
32
+
- config1
33
+
- Node-env
34
+
- config2
35
+
- Lit-env
36
+
- config3
37
+
- Users-domain
38
+
- React-comp1
39
+
- React-comp2
40
+
- Node-comp1
41
+
- Ecommerce-domain
42
+
- React-comp3
43
+
- React-comp4
44
+
- Node-comp1
45
+
- Node-comp2
46
+
- Lit-comp1
47
+
- Lit-comp2
48
+
- Lit-comp3
49
+
```
50
+
51
+
-**Observations:**
52
+
- Sibling directories may require different configs at any hierarchy level.
53
+
- Components across different domains might share the same config.
54
+
- Actual config files reside within `node_modules` packages, not directly in the source folders.
55
+
56
+
**Flow:**
57
+
58
+
1.**Determining Config Associations:**
59
+
60
+
-**Step 1:** Identify the relevant config files for each component (e.g., for ESLint).
61
+
-**Step 2:** Group components sharing the same config.
62
+
-**Step 3:** Map the relevant paths for each config.
63
+
64
+
_Example Outcome:_
65
+
66
+
```json
67
+
{
68
+
"Config1": [
69
+
"users-domain/react-comp1",
70
+
"users-domain/react-comp2",
71
+
"ecommerce-domain/react-comp3",
72
+
"ecommerce-domain/react-comp4"
73
+
],
74
+
"Config2": ["..."],
75
+
"Config3": ["..."]
76
+
}
77
+
```
78
+
79
+
2.**Optimizing Config File Placement:**
80
+
81
+
- Develop an algorithm to determine optimal locations for generated config files, minimizing workspace pollution.
0 commit comments