@evanpurkhiser/tooling-personal 1.26.0 → 1.28.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/README.md +5 -5
- package/dist/cmd/pr.js +7 -4
- package/dist/cmd/select-commit.js +2 -1
- package/dist/fzf.js +10 -2
- package/dist/index.js +4 -4
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -7,8 +7,8 @@ This is a set of tools I use in my day to day at work.
|
|
|
7
7
|
The `pr` command creates or updates a pull request associated to
|
|
8
8
|
one or more commits. The tool handles the following:
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
- Select which commits should be part of the PR
|
|
11
|
+
- Generates a branch from the commit message, and pushes the
|
|
12
|
+
commits up to the remote.
|
|
13
|
+
- Prompts for reviewers to assign to the pull request.
|
|
14
|
+
- Creates a pull request and assigns the selected reviewers.
|
package/dist/cmd/pr.js
CHANGED
|
@@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.pr = void 0;
|
|
6
7
|
const chalk_1 = __importDefault(require("chalk"));
|
|
7
8
|
const listr2_1 = require("listr2");
|
|
8
9
|
const open_1 = __importDefault(require("open"));
|
|
@@ -12,7 +13,9 @@ const editor_1 = require("../editor");
|
|
|
12
13
|
const fzf_1 = require("../fzf");
|
|
13
14
|
const pulls_1 = require("../pulls");
|
|
14
15
|
const utils_1 = require("../utils");
|
|
15
|
-
|
|
16
|
+
function getCommits(to) {
|
|
17
|
+
return simple_git_1.default().log({ from: 'HEAD', to });
|
|
18
|
+
}
|
|
16
19
|
async function pr() {
|
|
17
20
|
const username = await utils_1.getEmailUsername();
|
|
18
21
|
const repo = await utils_1.getRepoKey();
|
|
@@ -35,7 +38,7 @@ async function pr() {
|
|
|
35
38
|
collectInfoTask.add({
|
|
36
39
|
title: 'Getting unpublished commits',
|
|
37
40
|
task: async (ctx, task) => {
|
|
38
|
-
const commits = await getCommits();
|
|
41
|
+
const commits = await getCommits('origin/master');
|
|
39
42
|
if (commits.total === 0) {
|
|
40
43
|
throw new Error('No commits to push');
|
|
41
44
|
}
|
|
@@ -97,7 +100,7 @@ async function pr() {
|
|
|
97
100
|
}
|
|
98
101
|
};
|
|
99
102
|
const doPush = async () => {
|
|
100
|
-
const newCommits = await getCommits();
|
|
103
|
+
const newCommits = await getCommits('origin/master');
|
|
101
104
|
const commitIdx = newCommits.all.length - selectedCommits.length;
|
|
102
105
|
const rebaseTargetCommit = newCommits.all[commitIdx];
|
|
103
106
|
const refSpec = `${rebaseTargetCommit.hash}:refs/heads/${branchName}`;
|
|
@@ -157,4 +160,4 @@ async function pr() {
|
|
|
157
160
|
// 08. Open in browser
|
|
158
161
|
open_1.default(createPullRequest.pullRequest.url);
|
|
159
162
|
}
|
|
160
|
-
exports.
|
|
163
|
+
exports.pr = pr;
|
|
@@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.selectCommit = void 0;
|
|
6
7
|
const chalk_1 = __importDefault(require("chalk"));
|
|
7
8
|
const simple_git_1 = __importDefault(require("simple-git"));
|
|
8
9
|
const fzf_1 = require("../fzf");
|
|
@@ -19,4 +20,4 @@ async function selectCommit() {
|
|
|
19
20
|
const commitHashes = selected.map(commit => commit.hash);
|
|
20
21
|
console.log(commitHashes.join('\n'));
|
|
21
22
|
}
|
|
22
|
-
exports.
|
|
23
|
+
exports.selectCommit = selectCommit;
|
package/dist/fzf.js
CHANGED
|
@@ -13,11 +13,19 @@ async function fzfSelect({ prompt, genValues, }) {
|
|
|
13
13
|
], { shell: true, stdio: ['pipe', 'pipe', 'inherit'] });
|
|
14
14
|
fzf.stdin.setDefaultEncoding('utf-8');
|
|
15
15
|
const options = {};
|
|
16
|
-
|
|
16
|
+
const valuesDone = genValues(option => {
|
|
17
|
+
if (fzf.stdin.destroyed) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
17
20
|
options[option.id] = option;
|
|
18
21
|
fzf.stdin.write(`${option.id}\t${option.label.trim()}\n`);
|
|
19
22
|
});
|
|
20
|
-
|
|
23
|
+
if (valuesDone instanceof Promise) {
|
|
24
|
+
valuesDone.then(() => fzf.stdin.end());
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
fzf.stdin.end();
|
|
28
|
+
}
|
|
21
29
|
const output = await new Promise(resolve => fzf.stdout.once('data', d => resolve(d.toString())));
|
|
22
30
|
return output
|
|
23
31
|
.split('\n')
|
package/dist/index.js
CHANGED
|
@@ -6,8 +6,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
const chalk_1 = __importDefault(require("chalk"));
|
|
8
8
|
const yargs_1 = __importDefault(require("yargs"));
|
|
9
|
-
const pr_1 =
|
|
10
|
-
const select_commit_1 =
|
|
9
|
+
const pr_1 = require("./cmd/pr");
|
|
10
|
+
const select_commit_1 = require("./cmd/select-commit");
|
|
11
11
|
yargs_1.default(process.argv.slice(2))
|
|
12
12
|
.option('color', {
|
|
13
13
|
boolean: true,
|
|
@@ -18,7 +18,7 @@ yargs_1.default(process.argv.slice(2))
|
|
|
18
18
|
chalk_1.default.level = args.color ? 3 : 0;
|
|
19
19
|
}
|
|
20
20
|
}, true)
|
|
21
|
-
.command('pr', 'Create and update PRs', pr_1.
|
|
22
|
-
.command('select-commit', 'Select a commit hash', select_commit_1.
|
|
21
|
+
.command('pr', 'Create and update PRs', pr_1.pr)
|
|
22
|
+
.command('select-commit', 'Select a commit hash', select_commit_1.selectCommit)
|
|
23
23
|
.demandCommand(1, '')
|
|
24
24
|
.parse();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@evanpurkhiser/tooling-personal",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.28.0",
|
|
4
4
|
"description": "Evan Purkhiser's personal tooling",
|
|
5
5
|
"repository": "https://github.com/evanpurkhiser/tooling-personal",
|
|
6
6
|
"author": "Evan Purkhiser",
|
|
@@ -27,10 +27,10 @@
|
|
|
27
27
|
"yargs": "^17.0.1"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@evanpurkhiser/eslint-config": "^0.
|
|
30
|
+
"@evanpurkhiser/eslint-config": "^0.20.0",
|
|
31
31
|
"@tsconfig/node16": "^1.0.1",
|
|
32
|
-
"eslint": "^
|
|
33
|
-
"prettier": "^
|
|
32
|
+
"eslint": "^8.45.0",
|
|
33
|
+
"prettier": "^3.0.0",
|
|
34
34
|
"ts-node": "^10.1.0",
|
|
35
35
|
"typescript": "^4.3.5"
|
|
36
36
|
},
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"pt": "./dist/index.js"
|
|
43
43
|
},
|
|
44
44
|
"volta": {
|
|
45
|
-
"node": "18.
|
|
45
|
+
"node": "18.17.0",
|
|
46
46
|
"yarn": "1.22.19"
|
|
47
47
|
}
|
|
48
48
|
}
|