Commit 65bb157
committed
Build for 5dea726 fix(add-repo): insert new package in workspaces at correct build position
Previously the script always prepended the new package to the workspaces
array. That works only when the new package has no monorepo deps; otherwise
'npm run --workspaces build' tries to build the new package before its
deps have been built, and webpack/babel fail to resolve their main/browser
entries.
Now the script inspects the new package's package.json for deps on any
already-imported workspace (in either bare or @scratch/-prefixed form) and
inserts the new entry right after the latest such dep in the workspaces
array. New packages with no monorepo deps still go to position 0.
This is a "last dep wins" heuristic, not a full topological sort; it relies
on the existing workspaces array already being in valid build order, which
it is for hand-curated arrays. A real topo sort can be added later (e.g.
by extending update-gha-workflows.ts) if it ever becomes necessary.1 parent c9b9909 commit 65bb157
2 files changed
Lines changed: 68 additions & 68 deletions
File tree
- feat_canonical-add-repo-script/scratch-render/docs
- classes
- types
0 commit comments