-
Notifications
You must be signed in to change notification settings - Fork 1
Decouple workspace install lifecycle from root npm install #63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Copilot
wants to merge
9
commits into
develop
Choose a base branch
from
copilot/manage-dependencies-installation
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
635d2c3
Initial plan
Copilot 0c73d74
chore(common-utils): add npm install lifecycle handling for workspaces
Copilot 655514c
fix(common-utils): fallback to writable bin path during install
Copilot 37b4361
fix(common-utils): simplify bin path selection and restore PATH scripts
Copilot 82b1036
refactor(common-utils): externalize bin directory selector
Copilot 78df9ff
docs(common-utils): document bin selection helper
Copilot 78e5a23
feat(common-utils): handle dependencies from devcontainer files in in…
Copilot 481827c
feat(common-utils): resolve transitive deps from devcontainer-feature…
Copilot f72aac6
refactor(common-utils): extract dep resolution to _install-deps.sh an…
Copilot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,78 @@ | ||
| #!/bin/sh | ||
|
|
||
| # Resolves transitive tomgrv/devcontainer-features dependencies from devcontainer-feature.json files. | ||
| # Usage: install-deps <source_dir> <feature> [<feature>...] | ||
| # Outputs the complete dependency list in topological order (deps before dependents), one per line. | ||
|
|
||
| _source="$1" | ||
| shift | ||
|
|
||
| if [ -z "$_source" ]; then | ||
| echo "Usage: install-deps <source_dir> <feature>..." >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| features="$*" | ||
| [ -z "$features" ] && exit 0 | ||
|
|
||
| # Extract direct tomgrv/devcontainer-features dependencies of a single feature | ||
| _feature_deps() { | ||
| _manifest="$_source/src/$1/devcontainer-feature.json" | ||
| [ -f "$_manifest" ] || return 0 | ||
| jq -r '.dependsOn // {} | to_entries[] | | ||
| select(.key | contains("tomgrv/devcontainer-features")) | | ||
| .key | split("/")[-1] | split(":")[0]' "$_manifest" 2>/dev/null | ||
| } | ||
|
|
||
| # BFS: collect the full set of reachable features (input + all transitive deps) | ||
| _all="" | ||
| _queue="$features" | ||
| while [ -n "$_queue" ]; do | ||
| _next="" | ||
| for _f in $_queue; do | ||
| case " $_all " in | ||
| *" $_f "*) continue ;; | ||
| esac | ||
| _all="$_all $_f" | ||
| for _dep in $(_feature_deps "$_f"); do | ||
| case " $_all $_next " in | ||
| *" $_dep "*) ;; | ||
| *) _next="$_next $_dep" ;; | ||
| esac | ||
| done | ||
| done | ||
| _queue="$_next" | ||
| done | ||
|
|
||
| # Topological sort: emit features whose tomgrv deps are all already emitted | ||
| _emitted="" | ||
| _pending="$_all" | ||
| _changed=1 | ||
| while [ "$_changed" = "1" ] && [ -n "$_pending" ]; do | ||
| _changed=0 | ||
| _still_pending="" | ||
| for _f in $_pending; do | ||
| _deps_ok=1 | ||
| for _dep in $(_feature_deps "$_f"); do | ||
| case " $_emitted " in | ||
| *" $_dep "*) ;; | ||
| *) | ||
| _deps_ok=0 | ||
| break | ||
| ;; | ||
| esac | ||
| done | ||
| if [ "$_deps_ok" = "1" ]; then | ||
| _emitted="$_emitted $_f" | ||
| _changed=1 | ||
| else | ||
| _still_pending="$_still_pending $_f" | ||
| fi | ||
| done | ||
| _pending="$_still_pending" | ||
| done | ||
|
|
||
| # Append any remaining features (handles cycles or missing manifests) | ||
| _emitted="$_emitted $_pending" | ||
|
|
||
| echo "$_emitted" | tr ' ' '\n' | grep -v '^$' |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.