feat(n): support standalone repos via bin/repos.local.sh#154
feat(n): support standalone repos via bin/repos.local.sh#154jason10lee wants to merge 21 commits into
Conversation
|
Heads-up: #177 just merged to I test-merged the new Auto-merges cleanly: One manual fix in The decision is to keep auto-link-everything (it matches the pre-monorepo The actual blocker — Net: with the basic mount+link now in |
|
Thanks for the write-up! That made resolving this a lot easier than otherwise. With On Other than that, we verified the parsing/resolution behavior across both tiers (typed host, metadata + live-branch recovery, the false-match guard): all green. |
All Submissions:
Changes proposed in this Pull Request:
This PR adds a method to better support custom plugins that live within their own standalone repos within the workspace environment.
Add your standalone repos as subdirectories of
repos/(just like before the monorepo) and then register them inbin/repos.local.sh. Examples are available atbin/repos.local.sh.sample.How to test the changes in this Pull Request:
bin/repos.local.shfile, runn env list,n build, or anyn <command>— behaviour should matchmain.bin/repos.local.sh.sampletobin/repos.local.sh, uncomment a tier-1 example line (e.g.newspack_plugins+=("acme-internal-plugin")), createplugins/acme-internal-plugin/. From inside that dir, runn— it should target the right project (no "must be inside one of the repos" error). Confirmbin/repos.local.shis gitignored:git statusshouldn't show it.repos/<name>/(e.g.git clone … repos/newspack-community/). Addnewspack_standalone_repos+=("newspack-community")tobin/repos.local.sh. Runbash -c 'source bin/repos.sh; get_repo_host_path newspack-community'— should printrepos/newspack-community. From insiderepos/newspack-community/, runn— should target the right project.n env create demo --worktree newspack-community:test-branch— should succeed and create a worktree atworktrees/standalone/newspack-community/test-branch/. Inspect the generateddocker-compose.env-demo.yml— it should contain both the worktree mount and a# newspack-wt: repo=… branch=… host=…comment with the original (unsanitized) branch name.n env up demo; visithttps://demo.test/wp-admin/plugins.php. The standalone repo should be symlinked intowp-content/plugins/and listed as an available plugin.n env destroy demo --yes. Both the compose file and the tier-2 worktree atworktrees/standalone/newspack-community/test-branch/should be removed. Rungit -C repos/newspack-community branch— thetest-branchshould be gone too (i.e., the original branch name round-tripped; not the sanitized form).feat/foo. After destroy, the originalfeat/foobranch should be deleted from the standalone repo (notfeat-foo).n env create bogus --worktree unknown-repo:any-branch. It should error with "unknown project 'unknown-repo'" and leave no worktree behind at the workspace root (this was the leak that motivated the work).bin/repos.local.sh, e.g.newspack_standalone_repos+=("newspack-ads").bash -c 'source bin/repos.sh'should emit a stderr warning about the duplicate.repos/aren't auto-detected. Createrepos/random-thing/(NOT innewspack_standalone_repos). Runn build random-thing— it should error cleanly ("Project random-thing not found").n env listshould show standalone-repo worktrees with their original branch names (not the safe-branch directory form), and should not emit the "lacks newspack-wt metadata" note for envs created on this branch (only for ones from before the metadata was introduced).newspack_devcontainer,n build newspack-communityshould runcomposer installthen the standalone repo's ownpnpm installandpnpm run buildfrom insiderepos/newspack-community/(not viapnpm --filter).Other information:
Known follow-ups (deferred to a follow-up PR):
bin/test-js.shneeds the same tier-2 dispatch asbin/build-repos.sh.clone-repos.shstill clones canonical plugins intorepos/.# newspack-wt:metadata existed) fall back to safe_branch on destroy; for slashed branches this orphans the branch ref. Affects only legacy envs.cleanup_partial_env_statetrap coverage stops atworktree.sh addfailures; failures later inenv createmay leave partial state.