extract
Turns a directory that grew inside the distribution into its own repository and a submodule of it.
pnpm dist extract <path> --url <git-url> [--ssh] [--no-tag]
See Growing a module.
pnpm dist extract packages/charts --url https://github.com/acme/charts.git
packages/charts is now a repository and a submodule of this one
Shipping @acme/charts@0.3.0
Tagged v0.3.0, so sync can track it
origin is https://github.com/acme/charts.git
Push it before anyone else clones this:
git -C packages/charts push -u origin main --tags
Then commit the new submodule here.
What it does
git initin the directory, unless it is already a repository- Commits whatever is there, so the submodule has something to point at
- Sets
originto the url - Tags the version its
package.jsondeclares, when that parses as semver - Untracks the files in the distribution, then adds the path as a submodule
Step 5 clones nothing: git submodule add adopts a repository already at the
path. So this works before the remote exists, which is the point.
If the directory has packages inside it — a docs site, usually — it also gets a
pnpm-workspace.yaml, because those were members of the distribution's
workspace and nothing out here says so. See
Two workspaces, one module.
Afterwards
Push it. Until you do the submodule points at a remote nobody else can fetch. Then commit the new submodule pointer.
The tag it leaves
The initial commit is tagged v<version> from the manifest, so
sync has something to track. That tag is also the one the
module's first release would have created, so
release --check refuses that version — it will not
publish something it cannot then tag.
Release the next version rather than the one it was extracted at, or pass
--no-tag and let the first release make its own.
Options
| Option | Meaning |
|---|---|
--url <git-url> | required; where the repository will live |
--ssh | record the url as given rather than rewriting it |
--no-tag | do not tag, for a module not ready to claim a version |
It refuses a path that is already a submodule, is not a directory, or is outside the repository. An existing repository at the path keeps its history.
A note on signing
This is the only command that commits, so it is the only one that will ask your
GPG agent if you have commit.gpgsign set. That is correct: it is your module's
first commit.