@evanpurkhiser/tooling-personal 1.58.0 → 1.59.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.
@@ -23,14 +23,15 @@ async function buildPickError(git, sha, base, baseSha, parentSha, conflictLines)
23
23
  // blaming the conflicting regions specifically), but in this workflow
24
24
  // history is linear so any narrower set would still need to be on the
25
25
  // remote alongside its ancestors.
26
- const candidateLog = (await git.raw([
26
+ const rawCandidateLog = await git.raw([
27
27
  'log',
28
28
  '--reverse',
29
29
  '--format=%h %s',
30
30
  `${baseSha}..${parentSha}`,
31
31
  '--',
32
32
  ...conflictFiles,
33
- ])).trim();
33
+ ]);
34
+ const candidateLog = rawCandidateLog.trim();
34
35
  const fileList = conflictFiles.map(file => `- ${file}`).join('\n');
35
36
  const header = `Cannot cherry-pick ${sha.slice(0, 8)} onto tip of ${base}, merge conflicts in:\n${fileList}`;
36
37
  if (!candidateLog) {
@@ -54,20 +55,23 @@ async function buildPickError(git, sha, base, baseSha, parentSha, conflictLines)
54
55
  */
55
56
  async function cherryPickOnto(sha, base) {
56
57
  const git = (0, simple_git_1.default)();
57
- const parentSha = (await git.revparse([`${sha}^`])).trim();
58
- const baseSha = (await git.revparse([base])).trim();
58
+ const parentRevision = await git.revparse([`${sha}^`]);
59
+ const parentSha = parentRevision.trim();
60
+ const baseRevision = await git.revparse([base]);
61
+ const baseSha = baseRevision.trim();
59
62
  // `git merge-tree --write-tree` exits non-zero on conflicts, but simple-git's
60
63
  // .raw does not surface that — it just returns stdout. On success stdout is
61
64
  // a single tree OID; on conflict it's the tree OID followed by lines of
62
65
  // `<mode> <oid> <stage>\t<path>`. Detect the conflict case explicitly.
63
- const mergeOutput = (await git.raw([
66
+ const rawMergeOutput = await git.raw([
64
67
  'merge-tree',
65
68
  '--write-tree',
66
69
  '--no-messages',
67
70
  `--merge-base=${parentSha}`,
68
71
  baseSha,
69
72
  sha,
70
- ])).trim();
73
+ ]);
74
+ const mergeOutput = rawMergeOutput.trim();
71
75
  const [treeOid, ...conflictLines] = mergeOutput.split('\n');
72
76
  if (conflictLines.length > 0) {
73
77
  throw await buildPickError(git, sha, base, baseSha, parentSha, conflictLines);
package/dist/cmd/pr.js CHANGED
@@ -76,9 +76,9 @@ async function pr(argv) {
76
76
  }),
77
77
  });
78
78
  // 01. Select which commit to turn into a PR
79
- const selectedCommit = commits.total === 1
80
- ? { id: commits.all[0].hash, ...commits.all[0] }
81
- : (await pickCommit())[0];
79
+ const [selectedCommit] = commits.total === 1
80
+ ? [{ id: commits.all[0].hash, ...commits.all[0] }]
81
+ : await pickCommit();
82
82
  if (!selectedCommit) {
83
83
  console.log(chalk_1.default.red `No commit selected, aborting`);
84
84
  process.exit(1);
@@ -13,7 +13,8 @@ async function getDiffSource(commit) {
13
13
  const git = (0, simple_git_1.default)();
14
14
  if (commit) {
15
15
  const diff = await git.raw(['show', '-U0', '--format=', commit]);
16
- const rev = (await git.revparse([`${commit}^`])).trim();
16
+ const revision = await git.revparse([`${commit}^`]);
17
+ const rev = revision.trim();
17
18
  return { diff, rev, label: `commit ${commit}` };
18
19
  }
19
20
  const staged = await git.diff(['-U0', '--cached']);
@@ -28,7 +29,8 @@ async function getDiffSource(commit) {
28
29
  }
29
30
  async function suggestAssignees(argv) {
30
31
  const repo = await (0, utils_1.getRepoKey)();
31
- const selfEmail = (await (0, simple_git_1.default)().raw('config', '--get', 'user.email')).trim();
32
+ const configuredEmail = await (0, simple_git_1.default)().raw('config', '--get', 'user.email');
33
+ const selfEmail = configuredEmail.trim();
32
34
  // 01. Figure out what we're scoring against (staged, unstaged, or a commit)
33
35
  const { diff, rev, label } = await getDiffSource(argv.commit);
34
36
  const fileHunks = (0, blame_1.parseDiff)(diff);
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.58.0",
4
+ "version": "1.59.0",
5
5
  "description": "Evan Purkhiser's personal tooling",
6
6
  "license": "MIT",
7
7
  "author": "Evan Purkhiser <tooling-personal.js@evanpurkhiser.com>",
@@ -36,7 +36,7 @@
36
36
  "yargs": "^17.0.1"
37
37
  },
38
38
  "devDependencies": {
39
- "@evanpurkhiser/oxc-config": "^0.8.0",
39
+ "@evanpurkhiser/oxc-config": "^0.16.0",
40
40
  "@tsconfig/node16": "^1.0.1",
41
41
  "oxfmt": "^0.47.0",
42
42
  "oxlint": "^1.62.0",