@evanpurkhiser/tooling-personal 1.48.0 → 1.50.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/assignees.js +2 -2
- package/dist/blame.js +1 -1
- package/dist/cherry-pick.js +1 -1
- package/dist/cmd/pr.js +1 -1
- package/dist/config.js +5 -5
- package/dist/editor.js +5 -5
- package/dist/fzf.js +2 -2
- package/dist/identity.js +7 -7
- package/dist/utils.js +2 -2
- package/package.json +21 -15
package/dist/assignees.js
CHANGED
|
@@ -13,8 +13,8 @@ const fzf_1 = require("./fzf");
|
|
|
13
13
|
const graphql_1 = require("./graphql");
|
|
14
14
|
var AssigneeType;
|
|
15
15
|
(function (AssigneeType) {
|
|
16
|
-
AssigneeType[
|
|
17
|
-
AssigneeType[
|
|
16
|
+
AssigneeType["User"] = "user";
|
|
17
|
+
AssigneeType["Team"] = "team";
|
|
18
18
|
})(AssigneeType || (exports.AssigneeType = AssigneeType = {}));
|
|
19
19
|
function isUser(obj) {
|
|
20
20
|
return obj.repository !== undefined;
|
package/dist/blame.js
CHANGED
|
@@ -111,7 +111,7 @@ async function blameFile(file, hunks, rev) {
|
|
|
111
111
|
continue;
|
|
112
112
|
}
|
|
113
113
|
if (line.startsWith('author-mail ')) {
|
|
114
|
-
const email = line.slice('author-mail '.length).
|
|
114
|
+
const email = line.slice('author-mail '.length).replaceAll(/^<|>$/g, '');
|
|
115
115
|
if (!shaToEmail.has(last.sha)) {
|
|
116
116
|
shaToEmail.set(last.sha, email);
|
|
117
117
|
}
|
package/dist/cherry-pick.js
CHANGED
|
@@ -33,7 +33,7 @@ async function cherryPickOnto(sha, base) {
|
|
|
33
33
|
])).trim();
|
|
34
34
|
}
|
|
35
35
|
catch (error) {
|
|
36
|
-
throw new Error(`Conflicts applying ${sha.slice(0, 8)} onto ${base}. Rebase locally and retry.\n${error}
|
|
36
|
+
throw new Error(`Conflicts applying ${sha.slice(0, 8)} onto ${base}. Rebase locally and retry.\n${error}`, { cause: error });
|
|
37
37
|
}
|
|
38
38
|
const info = await git.raw(['show', '-s', '--format=%an%n%ae%n%aI%n%B', sha]);
|
|
39
39
|
const lines = info.split('\n');
|
package/dist/cmd/pr.js
CHANGED
package/dist/config.js
CHANGED
|
@@ -5,9 +5,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.config = void 0;
|
|
7
7
|
const convict_1 = __importDefault(require("convict"));
|
|
8
|
-
const js_yaml_1 =
|
|
9
|
-
const
|
|
10
|
-
convict_1.default.addParser({ extension: ['yml', 'yaml'], parse: js_yaml_1.
|
|
8
|
+
const js_yaml_1 = require("js-yaml");
|
|
9
|
+
const node_path_1 = require("node:path");
|
|
10
|
+
convict_1.default.addParser({ extension: ['yml', 'yaml'], parse: js_yaml_1.load });
|
|
11
11
|
const config = (0, convict_1.default)({
|
|
12
12
|
ignoreAssignees: {
|
|
13
13
|
doc: 'Assignee names / teams to ignore. Should be a regex expression.',
|
|
@@ -17,6 +17,6 @@ const config = (0, convict_1.default)({
|
|
|
17
17
|
});
|
|
18
18
|
exports.config = config;
|
|
19
19
|
const home = process.env.HOME;
|
|
20
|
-
const configDir = process.env.XDG_CONFIG_HOME || (0,
|
|
21
|
-
config.loadFile((0,
|
|
20
|
+
const configDir = process.env.XDG_CONFIG_HOME || (0, node_path_1.join)(home, '.config');
|
|
21
|
+
config.loadFile((0, node_path_1.join)(configDir, 'pt', 'config.yml'));
|
|
22
22
|
config.validate();
|
package/dist/editor.js
CHANGED
|
@@ -4,17 +4,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.editPullRequest = editPullRequest;
|
|
7
|
-
const
|
|
8
|
-
const promises_1 = __importDefault(require("fs/promises"));
|
|
9
|
-
const
|
|
7
|
+
const node_child_process_1 = require("node:child_process");
|
|
8
|
+
const promises_1 = __importDefault(require("node:fs/promises"));
|
|
9
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
10
10
|
const utils_1 = require("./utils");
|
|
11
11
|
async function editPullRequest(commit) {
|
|
12
12
|
const messageBody = commit.body;
|
|
13
13
|
const split = messageBody.length > 0 ? '\n\n' : '';
|
|
14
14
|
const prTemplate = `${commit.message}${split}${messageBody}`;
|
|
15
|
-
const pullEditFile =
|
|
15
|
+
const pullEditFile = node_path_1.default.join(await (0, utils_1.getRepoPath)(), '.git', 'PULLREQ_EDITMSG');
|
|
16
16
|
await promises_1.default.writeFile(pullEditFile, prTemplate);
|
|
17
|
-
const editor = (0,
|
|
17
|
+
const editor = (0, node_child_process_1.spawn)(process.env.EDITOR ?? 'vim', [pullEditFile], {
|
|
18
18
|
shell: true,
|
|
19
19
|
stdio: 'inherit',
|
|
20
20
|
});
|
package/dist/fzf.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.fzfSelect = fzfSelect;
|
|
4
|
-
const
|
|
4
|
+
const node_child_process_1 = require("node:child_process");
|
|
5
5
|
async function fzfSelect({ prompt, multi = true, genValues, }) {
|
|
6
6
|
const fzfArgs = [
|
|
7
7
|
'--ansi',
|
|
@@ -13,7 +13,7 @@ async function fzfSelect({ prompt, multi = true, genValues, }) {
|
|
|
13
13
|
if (multi) {
|
|
14
14
|
fzfArgs.push('-m');
|
|
15
15
|
}
|
|
16
|
-
const fzf = (0,
|
|
16
|
+
const fzf = (0, node_child_process_1.spawn)('fzf', fzfArgs, { shell: true, stdio: ['pipe', 'pipe', 'inherit'] });
|
|
17
17
|
fzf.stdin.setDefaultEncoding('utf-8');
|
|
18
18
|
const options = {};
|
|
19
19
|
const valuesDone = genValues(option => {
|
package/dist/identity.js
CHANGED
|
@@ -6,12 +6,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.loadAssignableUsers = loadAssignableUsers;
|
|
7
7
|
exports.buildResolver = buildResolver;
|
|
8
8
|
const graphql_request_1 = require("graphql-request");
|
|
9
|
-
const promises_1 = __importDefault(require("fs/promises"));
|
|
10
|
-
const
|
|
9
|
+
const promises_1 = __importDefault(require("node:fs/promises"));
|
|
10
|
+
const node_path_1 = require("node:path");
|
|
11
11
|
const graphql_1 = require("./graphql");
|
|
12
12
|
function cachePath(repo) {
|
|
13
|
-
const base = process.env.XDG_CACHE_HOME || (0,
|
|
14
|
-
return (0,
|
|
13
|
+
const base = process.env.XDG_CACHE_HOME || (0, node_path_1.join)(process.env.HOME ?? '', '.cache');
|
|
14
|
+
return (0, node_path_1.join)(base, 'pt', `assignees-${repo.owner}-${repo.repo}.json`);
|
|
15
15
|
}
|
|
16
16
|
async function readCache(repo) {
|
|
17
17
|
try {
|
|
@@ -24,7 +24,7 @@ async function readCache(repo) {
|
|
|
24
24
|
}
|
|
25
25
|
async function writeCache(repo, users) {
|
|
26
26
|
const path = cachePath(repo);
|
|
27
|
-
await promises_1.default.mkdir((0,
|
|
27
|
+
await promises_1.default.mkdir((0, node_path_1.join)(path, '..'), { recursive: true });
|
|
28
28
|
await promises_1.default.writeFile(path, JSON.stringify(users));
|
|
29
29
|
}
|
|
30
30
|
/**
|
|
@@ -85,8 +85,8 @@ function parseNoreplyLogin(email) {
|
|
|
85
85
|
*/
|
|
86
86
|
function normalizeName(name) {
|
|
87
87
|
return name
|
|
88
|
-
.
|
|
89
|
-
.
|
|
88
|
+
.replaceAll(/[^\p{L}\p{N}\s-]/gu, ' ')
|
|
89
|
+
.replaceAll(/\s+/g, ' ')
|
|
90
90
|
.trim()
|
|
91
91
|
.toLowerCase();
|
|
92
92
|
}
|
package/dist/utils.js
CHANGED
|
@@ -11,7 +11,7 @@ exports.getAccessToken = getAccessToken;
|
|
|
11
11
|
exports.branchFromMessage = branchFromMessage;
|
|
12
12
|
const git_url_parse_1 = __importDefault(require("git-url-parse"));
|
|
13
13
|
const simple_git_1 = __importDefault(require("simple-git"));
|
|
14
|
-
const
|
|
14
|
+
const node_child_process_1 = require("node:child_process");
|
|
15
15
|
/**
|
|
16
16
|
* Get's the current repo information
|
|
17
17
|
*/
|
|
@@ -64,7 +64,7 @@ async function getBranchNames() {
|
|
|
64
64
|
*/
|
|
65
65
|
function getAccessToken() {
|
|
66
66
|
try {
|
|
67
|
-
return (0,
|
|
67
|
+
return (0, node_child_process_1.execSync)('gh auth token').toString().trim();
|
|
68
68
|
}
|
|
69
69
|
catch {
|
|
70
70
|
throw new Error('Cannot get token from `gh auth token`');
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package.json",
|
|
3
3
|
"name": "@evanpurkhiser/tooling-personal",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.50.0",
|
|
5
5
|
"description": "Evan Purkhiser's personal tooling",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"author": "Evan Purkhiser",
|
|
@@ -13,12 +13,15 @@
|
|
|
13
13
|
"dist/**",
|
|
14
14
|
"README.md"
|
|
15
15
|
],
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
"
|
|
16
|
+
"devEngines": {
|
|
17
|
+
"runtime": {
|
|
18
|
+
"name": "node",
|
|
19
|
+
"version": "^24.15.0"
|
|
20
|
+
},
|
|
21
|
+
"packageManager": {
|
|
22
|
+
"name": "pnpm",
|
|
23
|
+
"version": "11.0.0"
|
|
24
|
+
}
|
|
22
25
|
},
|
|
23
26
|
"dependencies": {
|
|
24
27
|
"@octokit/graphql-schema": "^10.54.0",
|
|
@@ -40,15 +43,18 @@
|
|
|
40
43
|
"yargs": "^17.0.1"
|
|
41
44
|
},
|
|
42
45
|
"devDependencies": {
|
|
43
|
-
"@evanpurkhiser/oxc-config": "^0.
|
|
46
|
+
"@evanpurkhiser/oxc-config": "^0.8.0",
|
|
44
47
|
"@tsconfig/node16": "^1.0.1",
|
|
45
|
-
"oxfmt": "^0.
|
|
46
|
-
"oxlint": "^1.
|
|
48
|
+
"oxfmt": "^0.47.0",
|
|
49
|
+
"oxlint": "^1.62.0",
|
|
47
50
|
"ts-node": "^10.9.2",
|
|
48
51
|
"typescript": "^5.8.3"
|
|
49
52
|
},
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
"scripts": {
|
|
54
|
+
"build": "tsc && chmod +x ./dist/index.js",
|
|
55
|
+
"start": "ts-node ./src/index.ts",
|
|
56
|
+
"lint": "oxlint src/",
|
|
57
|
+
"format": "oxfmt .",
|
|
58
|
+
"format:check": "oxfmt --check ."
|
|
59
|
+
}
|
|
60
|
+
}
|