@evanpurkhiser/tooling-personal 1.30.0 → 1.31.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 +7 -1
- package/dist/config.js +22 -0
- package/dist/utils.js +8 -7
- package/package.json +3 -1
package/dist/assignees.js
CHANGED
|
@@ -7,6 +7,7 @@ exports.selectAssignee = exports.AssigneeType = void 0;
|
|
|
7
7
|
const chalk_1 = __importDefault(require("chalk"));
|
|
8
8
|
const fast_merge_async_iterators_1 = __importDefault(require("fast-merge-async-iterators"));
|
|
9
9
|
const graphql_request_1 = require("graphql-request");
|
|
10
|
+
const config_1 = require("./config");
|
|
10
11
|
const fzf_1 = require("./fzf");
|
|
11
12
|
const graphql_1 = require("./graphql");
|
|
12
13
|
var AssigneeType;
|
|
@@ -76,6 +77,9 @@ async function* getAssignees(repo) {
|
|
|
76
77
|
const items = !isOrganization
|
|
77
78
|
? userAssignees
|
|
78
79
|
: fast_merge_async_iterators_1.default(userAssignees, teamAssignees);
|
|
80
|
+
const assigneeesToIgnore = config_1.config
|
|
81
|
+
.get('ignoreAssignees')
|
|
82
|
+
.map(value => new RegExp(value));
|
|
79
83
|
for await (const result of items) {
|
|
80
84
|
const assignees = isUser(result)
|
|
81
85
|
? result.repository.assignableUsers.nodes.map(user => ({
|
|
@@ -90,7 +94,9 @@ async function* getAssignees(repo) {
|
|
|
90
94
|
slug: team.combinedSlug,
|
|
91
95
|
name: team.name,
|
|
92
96
|
}));
|
|
93
|
-
|
|
97
|
+
// Remove assignees that are ignored
|
|
98
|
+
const filteredAssignees = assignees.filter(assignee => !assigneeesToIgnore.some(r => r.test(assignee.slug)));
|
|
99
|
+
yield* filteredAssignees;
|
|
94
100
|
}
|
|
95
101
|
}
|
|
96
102
|
/**
|
package/dist/config.js
ADDED
|
@@ -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
|
+
exports.config = void 0;
|
|
7
|
+
const convict_1 = __importDefault(require("convict"));
|
|
8
|
+
const js_yaml_1 = __importDefault(require("js-yaml"));
|
|
9
|
+
const path_1 = require("path");
|
|
10
|
+
convict_1.default.addParser({ extension: ['yml', 'yaml'], parse: js_yaml_1.default.load });
|
|
11
|
+
const config = convict_1.default({
|
|
12
|
+
ignoreAssignees: {
|
|
13
|
+
doc: 'Assignee names / teams to ignore. Should be a regex expression.',
|
|
14
|
+
format: Array,
|
|
15
|
+
default: [],
|
|
16
|
+
},
|
|
17
|
+
});
|
|
18
|
+
exports.config = config;
|
|
19
|
+
const home = process.env.HOME;
|
|
20
|
+
const configDir = process.env.XDG_CONFIG_HOME || path_1.join(home, '.config');
|
|
21
|
+
config.loadFile(path_1.join(configDir, 'pt', 'config.yml'));
|
|
22
|
+
config.validate();
|
package/dist/utils.js
CHANGED
|
@@ -5,10 +5,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.branchFromMessage = exports.getAccessToken = exports.getBranchNames = exports.getRepoPath = exports.getEmailUsername = exports.getRepoKey = void 0;
|
|
7
7
|
const git_url_parse_1 = __importDefault(require("git-url-parse"));
|
|
8
|
-
const js_yaml_1 = __importDefault(require("js-yaml"));
|
|
9
8
|
const simple_git_1 = __importDefault(require("simple-git"));
|
|
10
|
-
const
|
|
11
|
-
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const child_process_1 = require("child_process");
|
|
12
10
|
/**
|
|
13
11
|
* Get's the current repo information
|
|
14
12
|
*/
|
|
@@ -61,12 +59,15 @@ async function getBranchNames() {
|
|
|
61
59
|
}
|
|
62
60
|
exports.getBranchNames = getBranchNames;
|
|
63
61
|
/**
|
|
64
|
-
* Get's the GitHub Oauth token from the
|
|
62
|
+
* Get's the GitHub Oauth token from the gh auth token command
|
|
65
63
|
*/
|
|
66
64
|
function getAccessToken() {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
65
|
+
try {
|
|
66
|
+
return child_process_1.execSync('gh auth token').toString().trim();
|
|
67
|
+
}
|
|
68
|
+
catch {
|
|
69
|
+
throw new Error('Cannot get token from `gh auth token`');
|
|
70
|
+
}
|
|
70
71
|
}
|
|
71
72
|
exports.getAccessToken = getAccessToken;
|
|
72
73
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@evanpurkhiser/tooling-personal",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.31.0",
|
|
4
4
|
"description": "Evan Purkhiser's personal tooling",
|
|
5
5
|
"repository": "https://github.com/evanpurkhiser/tooling-personal",
|
|
6
6
|
"author": "Evan Purkhiser",
|
|
@@ -11,11 +11,13 @@
|
|
|
11
11
|
],
|
|
12
12
|
"dependencies": {
|
|
13
13
|
"@octokit/graphql-schema": "^10.54.0",
|
|
14
|
+
"@types/convict": "^6.1.3",
|
|
14
15
|
"@types/git-url-parse": "^9.0.1",
|
|
15
16
|
"@types/js-yaml": "^4.0.2",
|
|
16
17
|
"@types/node": "^16.3.3",
|
|
17
18
|
"@types/yargs": "^17.0.2",
|
|
18
19
|
"chalk": "^4.1.1",
|
|
20
|
+
"convict": "^6.2.4",
|
|
19
21
|
"fast-merge-async-iterators": "^1.0.5",
|
|
20
22
|
"git-url-parse": "^11.5.0",
|
|
21
23
|
"graphql": "^15.5.1",
|