Manage a group of repositories for local development
Add the module within your dev repo:
$ yarn add @uscreen.de/dev-repo
To combine mutliple repositories into one single development repository you just add a mapping to your existing package.json, ie.:
"repos": {
"client": "[email protected]:example/client.git",
"api": "[email protected]:example/api.git",
"website": "[email protected]:example/website.git"
}
Next run repo install
and you will end up with a directory structure like:
.
├── package.json
├── repos
│ ├── client
│ ├── api
│ └── site
└── yarn.lock
Each ./repos/*
now containing a git cloned checkout with ./repos/*/node_modules
already installed. Invoking $ repo
without any parameter prints general usage information:
$ repo
Usage: repo [options] [command]
Options:
-V, --version output the version number
-h, --help output usage information
Commands:
install [repository] install named repository (ie. "webapi"), or all if no name supplied
list [repository] [-f|--fetch] list named repository (ie. "webapi"), or all if no name supplied
pull [repository] pull named repository (ie. "webapi"), or all if no name supplied
run <command> [repository] run command within named repository (ie. "webapi"), or all if no name supplied
help [cmd] display help for [cmd]
Install given repository or all. This will create any missing subdirectory, git clone
missing repositories and run a yarn install
for each repository. Subsequent calls of repo install
will at least run a yarn install
each time. Those will run in parallel.
Pull one given repository from remote or all repositories. Those pulls will run in parallel.
Run given command within given repository or all available repositories. Example with three repoos:
$ repo run "git pull"
Already up to date.
Already up to date.
Already up to date.
Example with a given repository:
$ repo run "git status" webapi
On branch master
Your branch is up to date with 'origin/master'.
nothing to commit, working tree clean
By now commands will run in parallel, so don't expect a proper sequences output. run
inherits the current users shell from env to enable aliases etc. by default. For example this could open editors for all projects:
$ repo run "v"
(assuming an alias like alias v 'code .'
)
Lists local information about a given repository or all.
- name@version
- current branch of working copy
- current changes of working copy
- counts of commits behind/ahead HEAD
Example output:
$ repo list
[email protected] - [master] HEAD clean
[email protected] - [master] HEAD dirty [2⇡/⇣1] - Working Copy: 2 uncommitted local changes
[email protected] - [stable] HEAD clean
$ repo list
[email protected] - [master] HEAD clean
[email protected] - [master] HEAD dirty [2⇡/⇣1]
[email protected] - [stable] HEAD clean
$ repo list
[email protected] - [master] HEAD clean
[email protected] - [master] HEAD dirty [3⇡/⇣0]
[email protected] - [stable] HEAD clean
$ repo list
[email protected] - [master] HEAD clean
[email protected] - [master] HEAD clean - Working Copy: 1 uncommitted local changes
[email protected] - [stable] HEAD clean
$ repo list
[email protected] - [master] HEAD clean
[email protected] - [master] HEAD clean - Working Copy: 1 uncommitted local changes
[email protected] - [stable] HEAD clean
$ repo list -f
remote: Enumerating objects: 1, done.
remote: Counting objects: 100% (1/1), done.
remote: Total 2 (delta 1), reused 1 (delta 1)
Unpacking objects: 100% (2/2), done.
From github.com:example/api
b578056..d7b07cd master -> origin/master
[email protected] - [master] HEAD clean
[email protected] - [master] HEAD dirty [0⇡/⇣1]
[email protected] - [master] HEAD clean
- add unit tests for edge cases
- add tests for v0.2.0
- add switch to run commands in squence
- optionally skip package installation
- Support for Node.js < v16
- upgraded all deps
- refactored to ESM
- security fixes & upgrades
- dropped git packages (isomorphic-git, git-utils), replaced by shell commands
- travis ci integration
- snyk audit integration
repo pull
command to pull one or all repositories from remoterepo run
command to run sub-commands within repositories
repo install
command to install from git & npmrepo list
command to give some status info- integration tests covering most (not all) use cases
- added integration test for
repo list --fetch
to alsogit fetch
befores list
- initially bootstrapped
Licensed under MIT.
Published, Supported and Sponsored by u|screen