@evanpurkhiser/tooling-personal 1.12.0 → 1.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cmd/pr.js CHANGED
@@ -71,7 +71,10 @@ async function pr() {
71
71
  // the end of the list.
72
72
  const rebaseContents = [
73
73
  ...selectedShas,
74
- ...commits.all.filter(c => !selectedShas.includes(c.hash)).map(c => c.hash),
74
+ ...commits.all
75
+ .filter(c => !selectedShas.includes(c.hash))
76
+ .map(c => c.hash)
77
+ .reverse(),
75
78
  ]
76
79
  .map(sha => `pick ${sha}`)
77
80
  .join('\n');
@@ -81,7 +84,7 @@ async function pr() {
81
84
  // 03. Rebase and push the selected commits
82
85
  const doRebase = async () => {
83
86
  await simple_git_1.default()
84
- .env('GIT_SEQUENCE_EDITOR', `echo "${rebaseContents}" >`)
87
+ .env({ ...process.env, GIT_SEQUENCE_EDITOR: `echo "${rebaseContents}" >` })
85
88
  .rebase(['--interactive', '--autostash', 'origin/master']);
86
89
  };
87
90
  const doPush = async () => {
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const chalk_1 = __importDefault(require("chalk"));
7
+ const simple_git_1 = __importDefault(require("simple-git"));
8
+ const fzf_1 = require("../fzf");
9
+ async function selectCommit() {
10
+ const commits = await simple_git_1.default().log({ from: 'HEAD', to: 'origin/master' });
11
+ const selected = await fzf_1.fzfSelect({
12
+ prompt: 'Select commit(s) for PR:',
13
+ genValues: addOption => commits.all.forEach(commit => {
14
+ const shortHash = commit.hash.slice(0, 8);
15
+ const label = chalk_1.default `{red ${shortHash}} {blue [${commit.author_name}]} {white ${commit.message}}`;
16
+ addOption({ label, id: commit.hash, ...commit });
17
+ }),
18
+ });
19
+ const commitHashes = selected.map(commit => commit.hash);
20
+ console.log(commitHashes.join('\n'));
21
+ }
22
+ exports.default = selectCommit;
package/dist/index.js CHANGED
@@ -4,9 +4,21 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  return (mod && mod.__esModule) ? mod : { "default": mod };
5
5
  };
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
+ const chalk_1 = __importDefault(require("chalk"));
7
8
  const yargs_1 = __importDefault(require("yargs"));
8
9
  const pr_1 = __importDefault(require("./cmd/pr"));
10
+ const select_commit_1 = __importDefault(require("./cmd/select-commit"));
9
11
  yargs_1.default(process.argv.slice(2))
12
+ .option('color', {
13
+ boolean: true,
14
+ desc: 'Use colored output (default: auto-detect)',
15
+ })
16
+ .middleware(args => {
17
+ if (args.color !== undefined) {
18
+ chalk_1.default.level = args.color ? 3 : 0;
19
+ }
20
+ }, true)
10
21
  .command('pr', 'Create and update PRs', pr_1.default)
22
+ .command('select-commit', 'Select a commit hash', select_commit_1.default)
11
23
  .demandCommand(1, '')
12
24
  .parse();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@evanpurkhiser/tooling-personal",
3
- "version": "1.12.0",
3
+ "version": "1.16.0",
4
4
  "description": "Evan Purkhiser's personal tooling",
5
5
  "repository": "https://github.com/EvanPurkhiser/tooling-personal",
6
6
  "author": "Evan Purkhiser",