Skip to content

Commit

Permalink
Compute workspace ancestor / descendant / ordered dependency graph (#…
Browse files Browse the repository at this point in the history
…1983)

* Stub dependency flattener

* Stub loop detection

* cache already discovered deps

* Remove comments

* Add cycle detection and DFS

* Add utility to trasform dependency graph into ancestor graph

* Add tests for non-cycle-breaking mode

* Compute ancestor set

* Remove dependencies

* Better signature

* Update snapshots

* Update snapshots and tests for the descendants APIs

* Better comments / names

* Add tests for cycles, fix cycle detection algo

* Add test for parallel tasks

* Add wlk test

* Start documentation

* Add docs about traverseWorkspaceRelations

* Fix typo

* Add docs for invertDependencyDirection

* Add docs for ancestor & descendant set

* Fix descendants

* Move into workspace-resolver package

* Update workspaceInfo snapshot

* Export library and use common types

* Correct types in docs

* Correct test name

* Fix the no immediate deps case

* Better cycle resolver

* Implement ancestors & descendants on their own

* Add comment

* Create smart-shirts-admire.md

* Add number of workspaces guard

* Support multiple vertices

* Typo
  • Loading branch information
cristiano-belloni authored Aug 8, 2022
1 parent b2c9f74 commit 051ecf7
Show file tree
Hide file tree
Showing 6 changed files with 948 additions and 2 deletions.
7 changes: 7 additions & 0 deletions .changeset/smart-shirts-admire.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@modular-scripts/modular-types": minor
"@modular-scripts/workspace-resolver": minor
---

- Add dependency resolver API
- Add lightweight dependency type for users using the API separately
7 changes: 5 additions & 2 deletions packages/modular-types/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,12 @@ export type ModularWorkspacePackage = {
dependencies: Record<string, string> | undefined;
};

export interface WorkspaceObj {
location: string;
export interface WorkspaceDependencyObject {
workspaceDependencies: string[];
}

export interface WorkspaceObj extends WorkspaceDependencyObject {
location: string;
mismatchedWorkspaceDependencies: string[];
}

Expand Down
Loading

0 comments on commit 051ecf7

Please sign in to comment.