gt8: make the package installable

This commit is contained in:
Yanick Champoux 2021-11-25 11:33:09 -05:00
parent f3bfe0f905
commit 1f676d6b68
4 changed files with 16 additions and 7 deletions

1
.gitignore vendored
View File

@ -2,3 +2,4 @@ node_modules/
pnpm-debug.log pnpm-debug.log
pnpm-lock.yaml pnpm-lock.yaml
dist dist
git-mikado-*.tgz

3
bin/git-mikado.js Executable file
View File

@ -0,0 +1,3 @@
#!/usr/bin/env node
require('../src/git-mikado.js').run();

View File

@ -1,8 +1,11 @@
{ {
"name": "git-mikado", "name": "git-mikado",
"version": "1.0.0", "version": "0.1.0",
"description": "", "description": "Tool using the Mikado method for git branch management",
"main": "index.js", "main": "src/index.js",
"bin": {
"git-mikado": "./bin/git-mikado.js"
},
"scripts": { "scripts": {
"test": "echo \"Error: no test specified\" && exit 1" "test": "echo \"Error: no test specified\" && exit 1"
}, },

10
src/git-mikado.js Normal file → Executable file
View File

@ -5,10 +5,12 @@ const status = require("./commands/status");
const done = require("./commands/done"); const done = require("./commands/done");
const upstream = require("./commands/upstream"); const upstream = require("./commands/upstream");
const { currentBranch } = require("./utils"); const utils = require("./utils");
currentBranch().then((currentBranch) => { module.exports.run = async () => {
yargs const currentBranch = await utils.currentBranch();
return yargs
.scriptName("git-mikado") .scriptName("git-mikado")
.showHelpOnFail(true) .showHelpOnFail(true)
.command("status", "show status of all mikado branches", status) .command("status", "show status of all mikado branches", status)
@ -74,4 +76,4 @@ currentBranch().then((currentBranch) => {
.help() .help()
.demandCommand(1, "") .demandCommand(1, "")
.strict().argv; .strict().argv;
}); }