Skip to content

Commit 0960674

Browse files
committed
feat: group dependencies by package #33
1 parent 7a50ec3 commit 0960674

18 files changed

Lines changed: 293 additions & 69 deletions

File tree

README.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,12 @@
104104
dpdm --cwd ../other-project ./src/index.ts
105105
```
106106

107+
9. Show dependencies and circular dependencies grouped by package:
108+
109+
```bash
110+
dpdm --group-by-package './packages/*/src/index.ts'
111+
```
112+
107113
### Options
108114

109115
```bash
@@ -147,6 +153,8 @@ Options:
147153
[string] [choices: "tree", "circular"]
148154
--skip-imports Skip import edges from circular checks. Values are regexp
149155
ISSUER:DEPENDENCY pairs. [array]
156+
--group-by-package print dependencies and circulars grouped by nearest package.json
157+
[boolean]
150158
-h, --help Show help [boolean]
151159
```
152160
@@ -216,7 +224,16 @@ parseDependencyTree('./index', {
216224
export type DependencyTree = Record<string, Dependency[] | null>;
217225
```
218226
219-
2. `parseCircular(tree)`: parse circulars in dependency tree
227+
2. `groupDependencyTreeByPackage(tree, context)`: group dependencies by nearest package.json
228+
229+
```typescript jsx
230+
export declare function groupDependencyTreeByPackage(
231+
tree: DependencyTree,
232+
context: string,
233+
): DependencyTree;
234+
```
235+
236+
3. `parseCircular(tree)`: parse circulars in dependency tree
220237
221238
```typescript jsx
222239
export declare function parseCircular(tree: DependencyTree): string[][];
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"name": "@repo/alias-user"
3+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { value } from '~/dep';
2+
3+
console.log(value);
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"name": "@repo/app"
3+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import './local';
2+
import '../../ui/src';
3+
import '../../shared/src';
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"name": "@repo/cycle-a"
3+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import '../../cycle-b/src';
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"name": "@repo/cycle-b"
3+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import '../../cycle-a/src';
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"name": "@repo/shared"
3+
}

0 commit comments

Comments
 (0)