git-command-helper
Version:
github command helper for nodejs
55 lines (51 loc) • 1.34 kB
JavaScript
// git-command-helper 2.1.0 by Dimas Lanjaka <dimaslanjaka@gmail.com> (https://www.webmanajemen.com)
;
require('cross-spawn');
require('lodash');
require('bluebird');
require('../dependencies/@expo/spawn-async/build/spawnAsync.js');
require('stream');
require('sbg-utility');
require('upath');
require('fs-extra');
require('glob');
require('ignore');
require('child_process');
var git = require('../git.js');
require('ini');
/** git config */
class gitConfig {
cwd;
git;
constructor(opt) {
this.cwd = opt.cwd;
this.git = opt instanceof git.git ? opt : new git.git(opt.cwd);
}
/**
* custom spawn
* @param args cli argument without `git config`
*/
custom(...args) {
return this.git.spawn("git", [...args]);
}
ignoreCase(toBe) {
return this.custom("core.ignorecase", String(toBe));
}
/**
* set end of line all files
* @param type
* @returns
*/
eol(type) {
return this.custom("core.eol", type);
}
/**
* The `git config core.autocrlf` command is used to change how Git handles line endings. It takes a single argument.
* @param toBe true - Configure Git to ensure line endings in files you checkout are correct for Windows.
* @returns
*/
autocrlf(toBe) {
return this.custom("core.autocrlf", String(toBe));
}
}
exports.gitConfig = gitConfig;