Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gal

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gal - npm Package Compare versions

Comparing version 0.0.31 to 0.0.41

1

dist/index.d.ts
#!/usr/bin/env node
export {};

127

dist/index.js
#!/usr/bin/env node
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
const assert_1 = __importDefault(require("assert"));
const simple_git_1 = __importDefault(require("simple-git"));
const main = async () => {
;
(async ({ version }) => {
try {
const [, , k, v] = process.argv;
const git = (0, simple_git_1.default)({
const { default: assert } = await Promise.resolve().then(() => __importStar(require('assert')));
const { Command } = await Promise.resolve().then(() => __importStar(require('commander')));
const { default: simpleGit } = await Promise.resolve().then(() => __importStar(require('simple-git')));
const prog = new Command('gal');
prog
.version(`${version}`, '-v, --version')
.option('-d, --dry', 'run in dry mode');
const git = simpleGit({
baseDir: process.cwd(),
binary: 'git',
maxConcurrentProcesses: 3
binary: 'git'
}).outputHandler((bin, stdout, stderr, args) => {
assert_1.default.equal(bin, 'git');
assert.equal(bin, 'git');
if (args.length > 1 && !args.includes('status')) {

@@ -23,19 +42,72 @@ stdout.pipe(process.stdout);

});
const [{ name = 'origin' }] = await git.getRemotes();
const [{ name: remote = 'origin' }] = await git.getRemotes();
const { current } = await git.status();
if (k && ['push', 'pull'].includes(k)) {
await git[k](name, current);
if (!(remote && current)) {
throw new Error('Are you in a git repo?');
}
else if (k === 'prune') {
await git.remote(['prune', name]);
}
else {
await Promise.all([
git.add(['.', '-A']),
git.commit((k === '-m' ? v : k) ?? '', {
'--allow-empty-message': null
}),
git.push(`${name}`, `${current}`)
]);
}
prog
.command('pull')
.description('git pull <origin> <branch>')
.action(async () => void git.pull(remote, current));
prog
.command('fetch')
.description('git fetch <remote> <branch>')
.action(async () => void git.fetch(remote, current));
prog
.command('push')
.description('git pull <remote> <branch>')
.action(async () => void git.push(remote, current));
prog
.command('prune')
.description('git remote prune <remote>, cleaning up local branches')
.action(async () => void git.remote(['prune', remote]));
prog
.command('rm ')
.arguments('<branch>')
.description('delete branch')
.option('-r', 'delete remote branch as well')
.action(async (branch, { r = false }) => {
try {
await git.branch(['-D', branch]);
}
catch (_) { }
try {
if (r) {
await git.push([remote, `:${branch}`]);
}
}
catch (_) { }
});
prog
.command('squash')
.description('automatically squash commits on a branch into 1')
.action(async () => {
await git.env({
...process.env,
GIT_SEQUENCE_EDITOR: `sed -i -se '2,$s/^pick/s/'`
});
await git.rebase(['-i', '--autosquash', 'master']);
await git.add(['-A']);
await git.commit('');
await git.push(remote, current);
});
prog
.option('-m [msg...]')
.argument('[msg...]')
.description('git commit -m [msg]')
.action(async (k, { dry, m }) => {
const msg = m ?? k ?? [];
if (!msg.length) {
msg.push('uptick');
}
if (!/^(feat|release|fix|style|docs|chore|test|refactor):$/.test(msg[0])) {
msg.unshift('chore:');
}
await git.add(['.', '-A']);
await git.commit(msg.join(' '));
if (!dry) {
await git.push(remote, current);
}
});
await prog.parseAsync(process.argv);
process.exit(0);

@@ -47,3 +119,2 @@ }

}
};
main();
})(require('../package.json'));
{
"name": "gal",
"version": "0.0.31",
"version": "0.0.41",
"description": "Git add, commit, and push in one line.",

@@ -9,3 +9,5 @@ "main": "./dist/index.js",

},
"files": ["dist"],
"files": [
"dist"
],
"keywords": [

@@ -28,5 +30,7 @@ "git",

"dev": "tsc -w",
"prepare": "yarn build"
"prepare": "yarn build",
"gal": "node dist/index.js"
},
"devDependencies": {
"@types/commander": "^2.12.2",
"@types/node": "^16.7.6",

@@ -44,4 +48,5 @@ "@typescript-eslint/eslint-plugin": "^4.17.0",

"dependencies": {
"commander": "^8.2.0",
"simple-git": "^2.45.1"
}
}

@@ -9,6 +9,8 @@ # gal

|-|-|
|\<empty>|`git add . -A`<br />`git commit --allow-empty-message`<br />`git push <origin> <branch>`|
|"my message"|`git add . -A`<br />`git commit -m "my message"`<br />`git push <origin> <branch>`|
|pull|`git pull <origin> <branch>`|
|push|`git push <origin> <branch>`|
|prune|`git remote prune origin`|
|-d, --dry|run in dry mode|
|[msg...], -m [msg...]|`git add . -A`<br />`git commit -m "my message"`<br />`git push <origin> <branch>`|
|pull|`git pull <remote> <branch>`|
|push|`git push <remote> <branch>`|
|prune|`git remote prune <remote>, cleaning up local branches`|
|fetch|`git fetch <remote> <branch>`|
|rm \<branch>|delete branches, pass `-r` to delete remote|
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc