UNPKG

git-mob

Version:
25 lines (22 loc) 3.62 kB
import u from"minimist";import{gitRevParse as g,getPrimaryAuthor as p,solo as l}from"git-mob-core";import{stripIndent as a}from"common-tags";import m from"update-notifier";var t={name:"git-mob",version:"4.0.1",description:"CLI tool for adding co-authors to commits.",homepage:"https://github.com/rkotze/git-mob/blob/master/packages/git-mob/README.md",type:"module",scripts:{build:"rimraf dist && bob","test:w":"npm run build -- -w -t & env-cmd -f test-helpers/env.cjs ava --watch --serial --no-worker-threads",pretest:"npm run build -- -t",test:"npm run testbase",checks:"npm run test && npm run lint",lint:"xo --cwd=../../",testbase:"ava --serial --no-worker-threads",minifytest:"npm run build -- -m -t && npm run testbase",preversion:"npm run checks",prepack:"npm run build -- -m",postinstall:"node ./dist/install/create-author-file.js"},bin:{"git-mob":"bin/mob.js","git-mob-print":"bin/mob-print.js","git-solo":"bin/solo.js","git-add-coauthor":"bin/add-coauthor.js","git-suggest-coauthors":"bin/suggest-coauthors.js"},repository:{type:"git",url:"git@github.com:rkotze/git-mob.git",directory:"packages/git-mob"},engines:{node:">=16"},keywords:["cli","cli-app","git-pair","git-duet","git","github","co-author","pairing","pair programming","mob programming","extreme programming","xp","social coding"],author:"Richard Kotze",license:"MIT",contributors:[{name:"Richard Kotze",url:"https://github.com/rkotze"},{name:"Dennis Ideler",url:"https://github.com/dideler"}],dependencies:{"@inquirer/checkbox":"^4.1.4","common-tags":"^1.8.2","git-mob-core":"^0.10.1",minimist:"^1.2.8","update-notifier":"^7.3.1"},devDependencies:{"@ava/typescript":"^5.0.0","@types/common-tags":"^1.8.4","@types/minimist":"^1.2.5","@types/node":"^22.13.14","@types/sinon":"^17.0.4","@types/update-notifier":"^6.0.8",ava:"^6.2.0",bob:"file:../bob",coffee:"^5.5.1",eol:"^0.10.0",rimraf:"^6.0.1",sinon:"^20.0.0",tempy:"^3.1.0",typescript:"^5.8.2"},ava:{files:["dist/**/*.spec.js"],require:["./test-helpers/env.cjs"],"watchMode.ignoreChanges":["dist","test-env","test-helpers"],typescript:{rewritePaths:{"src/":"build/"},compile:!1},nodeArguments:["--experimental-vm-modules"]}};var c=1e3*60*60*24*7;function e(){let o=a` Usage $ git mob <co-author-initials> <GitHub username> $ git solo $ git mob-print $ git add-coauthor <co-author-initials> "Coauthor Name" <coauthor-email-address> $ git suggest-coauthors [author name | author email] Options -h Prints usage information -v Prints current version -l Prints list of available co-authors -o Overwrite the main author -p Print path to .git-coauthors file Examples $ git mob jd # Set John Doe as co-author $ git mob jd am # Set John & Amy as co-authors $ git mob rkotze # Set co-author from GitHub username $ git mob -l # Show a list of all co-authors $ git mob -o jd # Will change main author to jd $ git solo # Dissipate the mob $ git mob-print # Prints git-mob template to stdout. Used for prepare-commit-msg hook. `;console.log(o)}function i(){console.log(t.version)}function r(o=c){m({pkg:t,updateCheckInterval:o}).notify({isGlobal:!0})}r();var s=u(process.argv.slice(2),{alias:{h:"help",v:"version"}});s.help&&(e(),process.exit(0));s.version&&(i(),process.exit(0));var h=await g.insideWorkTree();h||(console.error("Error: not a git repository"),process.exit(1));await d();async function d(){try{await l(),await b()}catch(o){console.error(`Error: ${o.message}`),process.exit(1)}}async function b(){let o=await p();console.log(o==null?void 0:o.toString())}