Workspaces
Keep several packages in one repository with one lock and one vendor/.
A workspace holds several packages in one repository. They share one composer.lock and one vendor/ at the repository root.
Create a workspace
-
In the root
pun.toml, list the member directories, or globs that match them:[workspace] members = ["packages/*", "apps/*"] -
Give each member a
composer.jsonwith aname:{ "name": "acme/billing", "require": { "acme/core": "*" } } -
Run
pun install.
Pun requires every member at the root and symlinks each one into vendor/ as a path package. A member requires another member like any package, at * or any constraint. Put the root’s own requirements and repositories in the root composer.json. The root needs neither a composer.json nor requirements of its own.
*and?in a glob match within one directory name.- Pun skips directories without a
composer.json. A glob that matches nothing, such asapps/*beforeapps/exists, adds no member. - A member without
nameis an error. - Two members can’t have the same name.
Work in a member
pun install, pun update, pun require, and pun remove find the workspace from the current directory, so they work in any member. They read and write the root’s composer.lock and vendor/.
pun require and pun remove edit the composer.json of the member you run them in, or the root’s at the root. To edit another member, name it with -p:
pun require -p acme/billing guzzlehttp/guzzle
pun remove -p acme/billing guzzlehttp/guzzle
If a request doesn’t resolve, the composer.json and the lock stay unchanged.
Limits
pun installdoesn’t notice when a member’s requirements change outsidepun requireandpun remove. Runpun update <member>after you edit a member’scomposer.jsonby hand.