The dist.repo
setting is deprecated since v9.8.0, and
removed in v10. However, the idea can still be achieved. There are many solutions to this, here are some basic examples
for inspiration.
This technique is largely depending on npm-version.
In .release-it.json
of the source repo:
{
"increment": "minor",
"preRelease": "alpha",
"git": { "tagName": "v${version}" },
"hooks": {
"before:init": "git clone https://github.com/example/dist-repo .stage",
"after:release": "cd .stage && npm version ${version} && cd -"
}
}
In package.json
of dist repo:
{
"name": "my-dist-package",
"version": "1.0.0",
"scripts": {
"version": "echo release-line >> dist-file && git add . --all",
"postversion": "git push --follow-tags"
}
}
- Clones the dist repo to
./.stage
. - Runs
npm version
, which automatically runs theversion
andpostversion
scripts.
A single repository, with e.g. a dist
or gh-pages
branch. In package.json
:
{
"name": "my-package",
"version": "1.0.0",
"release-it": {
"increment": "minor",
"git": { "tagName": "v${version}" },
"npm": { "publish": false },
"hooks": {
"before:init": "git clone https://github.com/my/my-package -b dist .stage",
"before:release": "npm run build",
"after:release": "cd .stage && git add . --all && git commit -m 'Updated!' && git push && cd -"
}
}
}
- Clone itself to
./.stage
while checking out thedist
branch. - Execute
npm run build
to generate distribution files (into./.stage
) - Stage all files, commit and push back to origin.