-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: use
sharedRoot
for monorepo projects (#37)
* fix: add `serverRoot` as primary attribute to Atlas files * fix: use `serverRoot` with fallback to `projectRoot` when making paths relative * fix: add `serverRoot` to `MetroGraphSource` * chore(webui): update fixture with `serverRoot` * refactor: change `serverRoot` to `sharedRoot` instead * fix(webui): use proper breadcrumb links for new `sharedRoot` * fix(webui): use proper shader for bundle graph * chore(webui): drop console log * chore(webui): tweak layout a bit * chore(webui): tweak property summary loading state
- Loading branch information
Showing
16 changed files
with
160 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/** | ||
* Find the shared root of all paths. | ||
* This will split all paths by segments and find the longest common prefix. | ||
*/ | ||
export function findSharedRoot(paths: string[]) { | ||
if (!paths.length) { | ||
return null; | ||
} | ||
|
||
let sharedRoot: string[] = []; | ||
|
||
for (const item of paths) { | ||
const segments = item.split('/'); | ||
|
||
if (!sharedRoot.length) { | ||
sharedRoot = segments; | ||
continue; | ||
} | ||
|
||
for (let i = 0; i < sharedRoot.length; i++) { | ||
if (sharedRoot[i] !== segments[i]) { | ||
sharedRoot = sharedRoot.slice(0, i); | ||
break; | ||
} | ||
} | ||
} | ||
|
||
return sharedRoot.join('/'); | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.