git-command-helper
Version:
github command helper for nodejs
53 lines (50 loc) • 1.28 kB
JavaScript
// git-command-helper 2.1.0 by Dimas Lanjaka <dimaslanjaka@gmail.com> (https://www.webmanajemen.com)
import 'cross-spawn';
import 'lodash';
import 'bluebird';
import '../dependencies/@expo/spawn-async/build/spawnAsync.mjs';
import 'stream';
import 'sbg-utility';
import 'upath';
import 'fs-extra';
import 'glob';
import 'ignore';
import 'child_process';
import { git } from '../git.mjs';
import 'ini';
/** git config */
class gitConfig {
cwd;
git;
constructor(opt) {
this.cwd = opt.cwd;
this.git = opt instanceof git ? opt : new 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));
}
}
export { gitConfig };