Manage projects with nested git dependencies easily.
Create an instance of Gitfuse to work on your project.
The number of concurrent operations Gitfuse will perform.
Type: Integer
Default: # of CPUs
Gitfuse will make symlinks to dependencies inside each repository under this directory.
Type: String
Default: node_modules
Gitfuse will look for this configuration file when tracing the dependency graph. Must be JSON.
Type: String
Default: package.json
Gitfuse will look at this key in your configuration file to find its dependencies.
Type: String
Default: gitfuseDependencies
Gitfuse will run this command in the folder of each dependency it clones.
Type: String
Default: npm install
A registry of repositories Gitfuse should manage, or a function which returns a promise that resolves to the same.
Type: Array|Function
Default: []
Using async registry retreival:
const Gitfuse = require('./');
const fuse = new Gitfuse({
concurrency: 4,
moduleDir: 'node_modules',
configurationFile: 'package.json',
dependencyKey: 'gitfuseDependencies',
installCommand: 'npm install',
registry: function () {
return this.requestFileFromGithub({
name: 'gitfuse',
user: 'gitfuse',
host: 'github.com',
sshUser: 'git',
isPrivate: true
}, 'test/fixtures/registry.json').then(JSON.parse);
},
});
Using sync registry definition:
const Gitfuse = require('./');
const fuse = new Gitfuse({
concurrency: 4,
moduleDir: 'node_modules',
configurationFile: 'package.json',
dependencyKey: 'gitfuseDependencies',
installCommand: 'npm install',
registry: [
{
name: 'test-foo',
user: 'gitfuse',
host: 'github.com',
sshUser: 'git',
isPrivate: false
},
{
name: 'test-bar',
user: 'gitfuse',
host: 'github.com',
sshUser: 'git',
isPrivate: false
},
{
name: 'test-baz',
user: 'gitfuse',
host: 'github.com',
sshUser: 'git',
isPrivate: false
},
{
name: 'test-qux',
user: 'gitfuse',
host: 'github.com',
sshUser: 'git',
isPrivate: false
}
]
});
Gitfuse subclasses EventEmitter. The following is available on each instance:
Verbose logging typically meant to be ignored unless explicitly requested.
Standard logging for status messages during execution.
Standard logging for success messages during execution.
Standard logging for failure messages during execution.
Use this to initialize a directory with all repositories your instance of Gitfuse is managing.
Does the following:
- Loads registry, or uses one explicitly provided.
- Checks specified directory for existing repositories.
- Clones any repositories that are missing.
- Symlinks all repositories together.
- Runs
npm install
inside each new repository.
The repositories initialize. If none provided, the entire registry will be used.
Type: Array
Default: this.loadRegistry()
Example entry format:
{
name: 'test-foo',
user: 'gitfuse',
host: 'github.com',
sshUser: 'git',
isPrivate: false
}
Usage:
const Gitfuse = require('./');
const chalk = require('chalk');
const DEBUG = true;
const fuse = new Gitfuse({
registry: function () {
return this.requestFileFromGithub({
name: 'gitfuse',
user: 'gitfuse',
host: 'github.com',
sshUser: 'git',
isPrivate: true
}, 'test/fixtures/registry.json').then(JSON.parse);
}
});
fuse.on('debug', function(msg) {
if (DEBUG) {
console.log(msg);
}
});
fuse.on('write', function(msg) {
console.log(msg);
});
fuse.on('ok', function(msg) {
console.log(chalk.green(msg));
});
fuse.on('error', function(msg) {
console.log(chalk.red(msg));
});
fuse.repos('./test');
Returns a promise which resolves to a dependency graph of the provided directory.
Emits write events which display a hierarchical representation of the current dependency graph.
Write me!
Write me!
Write me!