Manage repository easily.
How do you manage git repository?
Maybe you create a directory and clone to it. However if you want to clone repository that has same name? Or Do something in every directory like clean?
Projj provide a structure making it easy.
$BASE
|- github.com
| `- popomore
| `- projj
`- gitlab.com
`- popomore
`- projj
And you can DO everything in repository by Hook.
- ✔︎ Add repository using
projj add - ✔︎ Command Hook
- ✘ Buildin Hook
- ✔︎ Custom Hook
- ✔︎ Run Hook in All Repositories
- ✔︎ Git Support
Install projj globally.
$ npm i projj -g$ projj initSet base directory which repositories will be cloned to, default is ~/projj.
You can change base directory in ~/.projj/config.json.
$ projj add [email protected]:popomore/projj.gitit's just like git clone, but the repository will be cached by projj. You can find all repositories in ~/.projj/cache.json
If you have some repositories in ~/code, projj can import by projj import ~/code.
Hook is flexible when manage repositories.
When run command like projj add, hook will be run. preadd that run before projj add, and postadd that run after projj add.
Config hook in ~/.projj/config.json
{
"hooks": {
"postadd": "cat package.json"
}
}Then will show the content of the package of repository.
Only support add now
You can define own hook.
{
"hooks": {
"hook_name": "command"
}
}For Example, define a hook to show package.
{
"hooks": {
"show_package": "cat package.json"
}
}Then you can use projj run show_package to run the hook in current directory.
Command can be used in $PATH, so you can use global node_modules like npm.
{
"hooks": {
"npm_install": "npm install"
}
}Write a command
// clean
#!/usr/bin/env node
'use strict';
const cp = require('child_process');
const cwd = process.cwd();
const config = JSON.parse(process.env.PROJJ_HOOK_CONFIG);
if (config.node_modules === true) {
cp.spawn('rm', [ '-rf', 'node_modules' ]);
}You can get PROJJ_HOOK_CONFIG from projj if you have defined in ~/.projj/config.json.
{
"hooks": {
"clean": "clean"
},
"clean": {
"node_modules": true
}
}projj run clean in current directory.
projj runall clean in every repositories from cache.json