ya-git-jira 2.1.0 → 2.1.1
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/bin/git-api.ts +2 -4
- package/bin/git-bump.ts +2 -4
- package/bin/git-confluence-page-search.ts +4 -6
- package/bin/git-confluence-page-show.ts +3 -5
- package/bin/git-confluence-page-update.ts +3 -5
- package/bin/git-confluence-page.ts +2 -4
- package/bin/git-confluence-space-list.ts +3 -5
- package/bin/git-confluence-space.ts +2 -4
- package/bin/git-confluence-whoami.ts +3 -5
- package/bin/git-confluence.ts +11 -4
- package/bin/git-jira-issue-list.ts +2 -4
- package/bin/git-jira-issue-show.ts +3 -5
- package/bin/git-jira-issue.ts +2 -4
- package/bin/git-jira-start.ts +2 -4
- package/bin/git-jira-whoami.ts +3 -5
- package/bin/git-jira.ts +11 -4
- package/bin/git-lab-group-list.ts +4 -6
- package/bin/git-lab-group.ts +2 -4
- package/bin/git-lab-merge-active.ts +4 -6
- package/bin/git-lab-merge-todo.ts +4 -6
- package/bin/git-lab-merge-train-list.ts +3 -5
- package/bin/git-lab-merge-train.ts +2 -4
- package/bin/git-lab-merge.ts +2 -4
- package/bin/git-lab-namespace-list.ts +3 -5
- package/bin/git-lab-namespace.ts +2 -4
- package/bin/git-lab-project-list.ts +4 -6
- package/bin/git-lab-project-mr-list.ts +4 -6
- package/bin/git-lab-project-mr.ts +2 -4
- package/bin/git-lab-project-pipeline-jobs.ts +2 -4
- package/bin/git-lab-project-pipeline-latest.ts +2 -4
- package/bin/git-lab-project-pipeline-list.ts +4 -6
- package/bin/git-lab-project-pipeline-log.ts +2 -4
- package/bin/git-lab-project-pipeline.ts +2 -4
- package/bin/git-lab-project-whereami.ts +3 -5
- package/bin/git-lab-project.ts +2 -4
- package/bin/git-lab-whoami.ts +3 -5
- package/bin/git-lab.ts +11 -4
- package/bin/gitj-install-skills.ts +2 -4
- package/bin/gitj.ts +6 -1
- package/dist/bin/git-api.js +33 -5
- package/dist/bin/git-bump.js +32 -24
- package/dist/bin/git-confluence-page-search.js +46 -26
- package/dist/bin/git-confluence-page-show.js +24 -4
- package/dist/bin/git-confluence-page-update.js +24 -4
- package/dist/bin/git-confluence-page.js +30 -16
- package/dist/bin/git-confluence-space-list.js +45 -25
- package/dist/bin/git-confluence-space.js +46 -28
- package/dist/bin/git-confluence-whoami.js +45 -25
- package/dist/bin/git-confluence.js +45 -31
- package/dist/bin/git-jira-issue-list.js +36 -24
- package/dist/bin/git-jira-issue-show.js +16 -4
- package/dist/bin/git-jira-issue.js +18 -10
- package/dist/bin/git-jira-start.js +16 -4
- package/dist/bin/git-jira-whoami.js +37 -25
- package/dist/bin/git-jira.js +32 -22
- package/dist/bin/git-lab-group-list.js +18 -6
- package/dist/bin/git-lab-group.js +19 -9
- package/dist/bin/git-lab-merge-active.js +18 -6
- package/dist/bin/git-lab-merge-todo.js +18 -6
- package/dist/bin/git-lab-merge-train-list.js +17 -5
- package/dist/bin/git-lab-merge-train.js +18 -8
- package/dist/bin/git-lab-merge.js +25 -21
- package/dist/bin/git-lab-namespace-list.js +38 -26
- package/dist/bin/git-lab-namespace.js +39 -29
- package/dist/bin/git-lab-project-list.js +18 -6
- package/dist/bin/git-lab-project-mr-list.js +18 -6
- package/dist/bin/git-lab-project-mr.js +19 -9
- package/dist/bin/git-lab-project-pipeline-jobs.js +16 -4
- package/dist/bin/git-lab-project-pipeline-latest.js +16 -4
- package/dist/bin/git-lab-project-pipeline-list.js +18 -6
- package/dist/bin/git-lab-project-pipeline-log.js +16 -4
- package/dist/bin/git-lab-project-pipeline.js +22 -18
- package/dist/bin/git-lab-project-whereami.js +17 -5
- package/dist/bin/git-lab-project.js +32 -38
- package/dist/bin/git-lab-whoami.js +17 -5
- package/dist/bin/git-lab.js +61 -81
- package/dist/bin/gitj-install-skills.js +21 -11
- package/dist/bin/gitj.js +154 -153
- package/dist/index.js +32 -1
- package/lib/api.ts +19 -1
- package/lib/confluence/api.ts +12 -0
- package/lib/confluence/config.ts +3 -3
- package/lib/gitlab/api.ts +4 -0
- package/lib/gitlab/config.ts +2 -2
- package/lib/is_main.ts +11 -0
- package/lib/jira.ts +7 -3
- package/package.json +1 -1
|
@@ -5,7 +5,7 @@ import { getPackageVersion } from '../lib/package'
|
|
|
5
5
|
import { getMergeRequestsByBranch, type MergeRequest } from "../lib/gitlab"
|
|
6
6
|
import { findProject } from '../lib/gitlab/project'
|
|
7
7
|
import { getRemote, getCurrentBranch } from '../lib/git'
|
|
8
|
-
import {
|
|
8
|
+
import { runMain } from '../lib/is_main'
|
|
9
9
|
const version = await getPackageVersion()
|
|
10
10
|
|
|
11
11
|
export function create(): Command {
|
|
@@ -37,14 +37,14 @@ export function create(): Command {
|
|
|
37
37
|
process.exit(0)
|
|
38
38
|
}
|
|
39
39
|
if (options.verbose) {
|
|
40
|
-
console.log(mrs)
|
|
40
|
+
console.log(JSON.stringify(mrs, null, 2))
|
|
41
41
|
}
|
|
42
42
|
else {
|
|
43
43
|
const filtered = mrs.map(m => {
|
|
44
44
|
const { iid, title, web_url, source_branch, target_branch, state, draft } = m
|
|
45
45
|
return { iid, title, web_url, source_branch, target_branch, state, draft }
|
|
46
46
|
})
|
|
47
|
-
console.log(filtered)
|
|
47
|
+
console.log(JSON.stringify(filtered, null, 2))
|
|
48
48
|
}
|
|
49
49
|
})
|
|
50
50
|
return program
|
|
@@ -52,6 +52,4 @@ export function create(): Command {
|
|
|
52
52
|
|
|
53
53
|
export default create
|
|
54
54
|
|
|
55
|
-
|
|
56
|
-
await create().parseAsync(Bun.argv)
|
|
57
|
-
}
|
|
55
|
+
await runMain('git-lab-project-mr-list', create)
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { Command } from 'commander'
|
|
4
4
|
import { getPackageVersion } from '../lib/package'
|
|
5
|
-
import {
|
|
5
|
+
import { runMain } from '../lib/is_main'
|
|
6
6
|
import list from './git-lab-project-mr-list'
|
|
7
7
|
const version = await getPackageVersion()
|
|
8
8
|
|
|
@@ -19,6 +19,4 @@ export function create(): Command {
|
|
|
19
19
|
|
|
20
20
|
export default create
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
await create().parseAsync(Bun.argv)
|
|
24
|
-
}
|
|
22
|
+
await runMain('git-lab-project-mr', create)
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { Command } from 'commander'
|
|
4
4
|
import { getPackageVersion } from '../lib/package'
|
|
5
5
|
import { getPipelineJobs, type Job } from '../lib/gitlab'
|
|
6
|
-
import {
|
|
6
|
+
import { runMain } from '../lib/is_main'
|
|
7
7
|
|
|
8
8
|
const version = await getPackageVersion()
|
|
9
9
|
|
|
@@ -41,6 +41,4 @@ export function create(): Command {
|
|
|
41
41
|
|
|
42
42
|
export default create
|
|
43
43
|
|
|
44
|
-
|
|
45
|
-
await create().parseAsync(Bun.argv)
|
|
46
|
-
}
|
|
44
|
+
await runMain('git-lab-project-pipeline-jobs', create)
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { Command } from 'commander'
|
|
4
4
|
import { getPackageVersion } from '../lib/package'
|
|
5
5
|
import { getLatestPipeline, type Pipeline, getPipelineJobs, type Job } from '../lib/gitlab'
|
|
6
|
-
import {
|
|
6
|
+
import { runMain } from '../lib/is_main'
|
|
7
7
|
|
|
8
8
|
const version = await getPackageVersion()
|
|
9
9
|
|
|
@@ -42,6 +42,4 @@ export function create(): Command {
|
|
|
42
42
|
|
|
43
43
|
export default create
|
|
44
44
|
|
|
45
|
-
|
|
46
|
-
await create().parseAsync(Bun.argv)
|
|
47
|
-
}
|
|
45
|
+
await runMain('git-lab-project-pipeline-latest', create)
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { Command } from 'commander'
|
|
4
4
|
import { getPackageVersion } from '../lib/package'
|
|
5
5
|
import { getProjectPipelines, type Pipeline } from "../lib/gitlab"
|
|
6
|
-
import {
|
|
6
|
+
import { runMain } from '../lib/is_main'
|
|
7
7
|
import debug from 'debug'
|
|
8
8
|
|
|
9
9
|
const version = await getPackageVersion()
|
|
@@ -26,14 +26,14 @@ export function create(): Command {
|
|
|
26
26
|
process.exit(1)
|
|
27
27
|
}
|
|
28
28
|
if (options.verbose) {
|
|
29
|
-
console.log(pipelines)
|
|
29
|
+
console.log(JSON.stringify(pipelines, null, 2))
|
|
30
30
|
}
|
|
31
31
|
else {
|
|
32
32
|
let filtered = pipelines.map((p: Pipeline) => {
|
|
33
33
|
const { id, web_url, updated_at, ref, sha } = p
|
|
34
34
|
return { id, web_url, updated_at, ref, sha }
|
|
35
35
|
})
|
|
36
|
-
console.log(filtered)
|
|
36
|
+
console.log(JSON.stringify(filtered, null, 2))
|
|
37
37
|
}
|
|
38
38
|
})
|
|
39
39
|
return program
|
|
@@ -41,6 +41,4 @@ export function create(): Command {
|
|
|
41
41
|
|
|
42
42
|
export default create
|
|
43
43
|
|
|
44
|
-
|
|
45
|
-
await create().parseAsync(Bun.argv)
|
|
46
|
-
}
|
|
44
|
+
await runMain('git-lab-project-pipeline-list', create)
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { Command } from 'commander'
|
|
4
4
|
import { getPackageVersion } from '../lib/package'
|
|
5
5
|
import { getJobLog } from '../lib/gitlab'
|
|
6
|
-
import {
|
|
6
|
+
import { runMain } from '../lib/is_main'
|
|
7
7
|
|
|
8
8
|
const version = await getPackageVersion()
|
|
9
9
|
|
|
@@ -44,6 +44,4 @@ export function create(): Command {
|
|
|
44
44
|
|
|
45
45
|
export default create
|
|
46
46
|
|
|
47
|
-
|
|
48
|
-
await create().parseAsync(Bun.argv)
|
|
49
|
-
}
|
|
47
|
+
await runMain('git-lab-project-pipeline-log', create)
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { Command } from 'commander'
|
|
4
4
|
import { getPackageVersion } from '../lib/package'
|
|
5
|
-
import {
|
|
5
|
+
import { runMain } from '../lib/is_main'
|
|
6
6
|
import jobs from './git-lab-project-pipeline-jobs'
|
|
7
7
|
import latest from './git-lab-project-pipeline-latest'
|
|
8
8
|
import list from './git-lab-project-pipeline-list'
|
|
@@ -25,6 +25,4 @@ export function create(): Command {
|
|
|
25
25
|
|
|
26
26
|
export default create
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
await create().parseAsync(Bun.argv)
|
|
30
|
-
}
|
|
28
|
+
await runMain('git-lab-project-pipeline', create)
|
|
@@ -4,7 +4,7 @@ import { Command } from 'commander'
|
|
|
4
4
|
import { getPackageVersion } from '../lib/package'
|
|
5
5
|
import { findProject } from "../lib/gitlab/project"
|
|
6
6
|
import { getRemote } from '../lib/git'
|
|
7
|
-
import {
|
|
7
|
+
import { runMain } from '../lib/is_main'
|
|
8
8
|
const version = await getPackageVersion()
|
|
9
9
|
|
|
10
10
|
export function create(): Command {
|
|
@@ -27,7 +27,7 @@ export function create(): Command {
|
|
|
27
27
|
process.exit(1)
|
|
28
28
|
}
|
|
29
29
|
if (options.verbose) {
|
|
30
|
-
console.log(project)
|
|
30
|
+
console.log(JSON.stringify(project, null, 2))
|
|
31
31
|
} else {
|
|
32
32
|
const { id, name, path_with_namespace, ssh_url_to_repo } = project
|
|
33
33
|
console.log({id, name, path_with_namespace, ssh_url_to_repo })
|
|
@@ -38,6 +38,4 @@ export function create(): Command {
|
|
|
38
38
|
|
|
39
39
|
export default create
|
|
40
40
|
|
|
41
|
-
|
|
42
|
-
await create().parseAsync(Bun.argv)
|
|
43
|
-
}
|
|
41
|
+
await runMain('git-lab-project-whereami', create)
|
package/bin/git-lab-project.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { Command } from 'commander'
|
|
4
4
|
import { getPackageVersion } from '../lib/package'
|
|
5
|
-
import {
|
|
5
|
+
import { runMain } from '../lib/is_main'
|
|
6
6
|
import list from './git-lab-project-list'
|
|
7
7
|
import mr from './git-lab-project-mr'
|
|
8
8
|
import pipeline from './git-lab-project-pipeline'
|
|
@@ -27,6 +27,4 @@ export function create(): Command {
|
|
|
27
27
|
|
|
28
28
|
export default create
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
await create().parseAsync(Bun.argv)
|
|
32
|
-
}
|
|
30
|
+
await runMain('git-lab-project', create)
|
package/bin/git-lab-whoami.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { Command } from 'commander'
|
|
4
4
|
import { getPackageVersion } from '../lib/package'
|
|
5
5
|
import { whoami, type User } from "../lib/gitlab/user"
|
|
6
|
-
import {
|
|
6
|
+
import { runMain } from '../lib/is_main'
|
|
7
7
|
const version = await getPackageVersion()
|
|
8
8
|
|
|
9
9
|
export function create(): Command {
|
|
@@ -20,7 +20,7 @@ export function create(): Command {
|
|
|
20
20
|
process.exit(1)
|
|
21
21
|
}
|
|
22
22
|
if (options.verbose) {
|
|
23
|
-
console.log(user)
|
|
23
|
+
console.log(JSON.stringify(user, null, 2))
|
|
24
24
|
process.exit(0)
|
|
25
25
|
}
|
|
26
26
|
else {
|
|
@@ -32,6 +32,4 @@ export function create(): Command {
|
|
|
32
32
|
|
|
33
33
|
export default create
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
await create().parseAsync(Bun.argv)
|
|
37
|
-
}
|
|
35
|
+
await runMain('git-lab-whoami', create)
|
package/bin/git-lab.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { Command } from 'commander'
|
|
4
4
|
import { getPackageVersion } from '../lib/package'
|
|
5
|
-
import {
|
|
5
|
+
import { runMain } from '../lib/is_main'
|
|
6
6
|
import groups from './git-lab-group'
|
|
7
7
|
import merges from './git-lab-merge'
|
|
8
8
|
import namespaces from './git-lab-namespace'
|
|
@@ -22,11 +22,18 @@ export function create(): Command {
|
|
|
22
22
|
.addCommand(projects())
|
|
23
23
|
.addCommand(whoami())
|
|
24
24
|
.action(() => program.help())
|
|
25
|
+
.addHelpText('after', `
|
|
26
|
+
Required git config:
|
|
27
|
+
gitlab.token your GitLab personal access token
|
|
28
|
+
|
|
29
|
+
Optional git config:
|
|
30
|
+
gitlab.host your GitLab hostname (defaults to gitlab.com)
|
|
31
|
+
gitlab.user your GitLab email (falls back to user.email)
|
|
32
|
+
|
|
33
|
+
Set with: git config --global gitlab.token <value>`)
|
|
25
34
|
return program
|
|
26
35
|
}
|
|
27
36
|
|
|
28
37
|
export default create
|
|
29
38
|
|
|
30
|
-
|
|
31
|
-
await create().parseAsync(Bun.argv)
|
|
32
|
-
}
|
|
39
|
+
await runMain('git-lab', create)
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { Command } from 'commander'
|
|
4
4
|
import { getPackageVersion } from '../lib/package'
|
|
5
5
|
import { findPackageJson } from '../lib/package'
|
|
6
|
-
import {
|
|
6
|
+
import { runMain } from '../lib/is_main'
|
|
7
7
|
import fs from 'node:fs'
|
|
8
8
|
import path from 'node:path'
|
|
9
9
|
|
|
@@ -126,6 +126,4 @@ export function create(): Command {
|
|
|
126
126
|
|
|
127
127
|
export default create
|
|
128
128
|
|
|
129
|
-
|
|
130
|
-
await create().parseAsync(Bun.argv)
|
|
131
|
-
}
|
|
129
|
+
await runMain('gitj-install-skills', create)
|
package/bin/gitj.ts
CHANGED
|
@@ -38,4 +38,9 @@ export function create(): Command {
|
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
const command = create()
|
|
41
|
-
|
|
41
|
+
try {
|
|
42
|
+
await command.parseAsync(Bun.argv)
|
|
43
|
+
} catch (err) {
|
|
44
|
+
console.error(`error: ${err instanceof Error ? err.message : String(err)}`)
|
|
45
|
+
process.exit(1)
|
|
46
|
+
}
|
package/dist/bin/git-api.js
CHANGED
|
@@ -1853,6 +1853,16 @@ function isMain(self) {
|
|
|
1853
1853
|
const result = argv1Base === selfBase;
|
|
1854
1854
|
return result;
|
|
1855
1855
|
}
|
|
1856
|
+
async function runMain(self, create) {
|
|
1857
|
+
if (!isMain(self))
|
|
1858
|
+
return;
|
|
1859
|
+
try {
|
|
1860
|
+
await create().parseAsync(Bun.argv);
|
|
1861
|
+
} catch (err) {
|
|
1862
|
+
console.error(`error: ${err instanceof Error ? err.message : String(err)}`);
|
|
1863
|
+
process.exit(1);
|
|
1864
|
+
}
|
|
1865
|
+
}
|
|
1856
1866
|
|
|
1857
1867
|
// lib/spawn.ts
|
|
1858
1868
|
var defaultOptions = {
|
|
@@ -1902,7 +1912,7 @@ async function getGitlabConfig() {
|
|
|
1902
1912
|
const host = await hostP || "gitlab.com";
|
|
1903
1913
|
const user = await gitEmailP || await gitlabEmailP;
|
|
1904
1914
|
if (!user)
|
|
1905
|
-
throw new Error("Neither user.email nor gitlab.
|
|
1915
|
+
throw new Error("Neither user.email nor gitlab.user in git config");
|
|
1906
1916
|
const token = await tokenP;
|
|
1907
1917
|
if (!token)
|
|
1908
1918
|
throw new Error("gitlab.token not in git config");
|
|
@@ -1945,6 +1955,10 @@ async function jiraApi(endpoint) {
|
|
|
1945
1955
|
};
|
|
1946
1956
|
const request = new Request(uri, options);
|
|
1947
1957
|
const response = await fetch(request);
|
|
1958
|
+
if (!response.ok) {
|
|
1959
|
+
const text = await response.text();
|
|
1960
|
+
throw new Error(`Jira API ${endpoint} failed (${response.status}): ${text}`);
|
|
1961
|
+
}
|
|
1948
1962
|
const result = await response.json();
|
|
1949
1963
|
return result;
|
|
1950
1964
|
}
|
|
@@ -2035,6 +2049,16 @@ async function apiRequest(serviceName, method, endpoint, options) {
|
|
|
2035
2049
|
}
|
|
2036
2050
|
const request = new Request(url, fetchOptions);
|
|
2037
2051
|
const response = await fetch(request);
|
|
2052
|
+
if (!response.ok) {
|
|
2053
|
+
const text = await response.text();
|
|
2054
|
+
let body2;
|
|
2055
|
+
try {
|
|
2056
|
+
body2 = JSON.parse(text);
|
|
2057
|
+
} catch {
|
|
2058
|
+
throw new Error(`${serviceName} API ${method} ${endpoint} failed (${response.status}): ${text}`);
|
|
2059
|
+
}
|
|
2060
|
+
return { status: response.status, headers: response.headers, body: body2 };
|
|
2061
|
+
}
|
|
2038
2062
|
const body = await response.json();
|
|
2039
2063
|
return {
|
|
2040
2064
|
status: response.status,
|
|
@@ -2078,7 +2102,13 @@ async function apiPaginate(serviceName, endpoint, options) {
|
|
|
2078
2102
|
lastStatus = response.status;
|
|
2079
2103
|
lastHeaders = response.headers;
|
|
2080
2104
|
if (!response.ok) {
|
|
2081
|
-
const
|
|
2105
|
+
const text = await response.text();
|
|
2106
|
+
let body2;
|
|
2107
|
+
try {
|
|
2108
|
+
body2 = JSON.parse(text);
|
|
2109
|
+
} catch {
|
|
2110
|
+
throw new Error(`${serviceName} API paginate ${endpoint} failed (${response.status}): ${text}`);
|
|
2111
|
+
}
|
|
2082
2112
|
return { status: response.status, headers: response.headers, body: body2 };
|
|
2083
2113
|
}
|
|
2084
2114
|
const body = await response.json();
|
|
@@ -2147,9 +2177,7 @@ function create() {
|
|
|
2147
2177
|
return program2;
|
|
2148
2178
|
}
|
|
2149
2179
|
var git_api_default = create;
|
|
2150
|
-
|
|
2151
|
-
await create().parseAsync(Bun.argv);
|
|
2152
|
-
}
|
|
2180
|
+
await runMain("git-api", create);
|
|
2153
2181
|
export {
|
|
2154
2182
|
git_api_default as default,
|
|
2155
2183
|
create
|
package/dist/bin/git-bump.js
CHANGED
|
@@ -600,7 +600,7 @@ var require_command = __commonJS((exports) => {
|
|
|
600
600
|
var childProcess = __require("child_process");
|
|
601
601
|
var path = __require("path");
|
|
602
602
|
var fs = __require("fs");
|
|
603
|
-
var
|
|
603
|
+
var process2 = __require("process");
|
|
604
604
|
var { Argument, humanReadableArgName } = require_argument();
|
|
605
605
|
var { CommanderError } = require_error();
|
|
606
606
|
var { Help } = require_help();
|
|
@@ -641,10 +641,10 @@ var require_command = __commonJS((exports) => {
|
|
|
641
641
|
this._showHelpAfterError = false;
|
|
642
642
|
this._showSuggestionAfterError = true;
|
|
643
643
|
this._outputConfiguration = {
|
|
644
|
-
writeOut: (str) =>
|
|
645
|
-
writeErr: (str) =>
|
|
646
|
-
getOutHelpWidth: () =>
|
|
647
|
-
getErrHelpWidth: () =>
|
|
644
|
+
writeOut: (str) => process2.stdout.write(str),
|
|
645
|
+
writeErr: (str) => process2.stderr.write(str),
|
|
646
|
+
getOutHelpWidth: () => process2.stdout.isTTY ? process2.stdout.columns : undefined,
|
|
647
|
+
getErrHelpWidth: () => process2.stderr.isTTY ? process2.stderr.columns : undefined,
|
|
648
648
|
outputError: (str, write) => write(str)
|
|
649
649
|
};
|
|
650
650
|
this._hidden = false;
|
|
@@ -826,7 +826,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
826
826
|
if (this._exitCallback) {
|
|
827
827
|
this._exitCallback(new CommanderError(exitCode, code, message));
|
|
828
828
|
}
|
|
829
|
-
|
|
829
|
+
process2.exit(exitCode);
|
|
830
830
|
}
|
|
831
831
|
action(fn) {
|
|
832
832
|
const listener = (args) => {
|
|
@@ -991,8 +991,8 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
991
991
|
}
|
|
992
992
|
parseOptions = parseOptions || {};
|
|
993
993
|
if (argv === undefined) {
|
|
994
|
-
argv =
|
|
995
|
-
if (
|
|
994
|
+
argv = process2.argv;
|
|
995
|
+
if (process2.versions && process2.versions.electron) {
|
|
996
996
|
parseOptions.from = "electron";
|
|
997
997
|
}
|
|
998
998
|
}
|
|
@@ -1005,7 +1005,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1005
1005
|
userArgs = argv.slice(2);
|
|
1006
1006
|
break;
|
|
1007
1007
|
case "electron":
|
|
1008
|
-
if (
|
|
1008
|
+
if (process2.defaultApp) {
|
|
1009
1009
|
this._scriptPath = argv[1];
|
|
1010
1010
|
userArgs = argv.slice(2);
|
|
1011
1011
|
} else {
|
|
@@ -1073,23 +1073,23 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1073
1073
|
}
|
|
1074
1074
|
launchWithNode = sourceExt.includes(path.extname(executableFile));
|
|
1075
1075
|
let proc;
|
|
1076
|
-
if (
|
|
1076
|
+
if (process2.platform !== "win32") {
|
|
1077
1077
|
if (launchWithNode) {
|
|
1078
1078
|
args.unshift(executableFile);
|
|
1079
|
-
args = incrementNodeInspectorPort(
|
|
1080
|
-
proc = childProcess.spawn(
|
|
1079
|
+
args = incrementNodeInspectorPort(process2.execArgv).concat(args);
|
|
1080
|
+
proc = childProcess.spawn(process2.argv[0], args, { stdio: "inherit" });
|
|
1081
1081
|
} else {
|
|
1082
1082
|
proc = childProcess.spawn(executableFile, args, { stdio: "inherit" });
|
|
1083
1083
|
}
|
|
1084
1084
|
} else {
|
|
1085
1085
|
args.unshift(executableFile);
|
|
1086
|
-
args = incrementNodeInspectorPort(
|
|
1087
|
-
proc = childProcess.spawn(
|
|
1086
|
+
args = incrementNodeInspectorPort(process2.execArgv).concat(args);
|
|
1087
|
+
proc = childProcess.spawn(process2.execPath, args, { stdio: "inherit" });
|
|
1088
1088
|
}
|
|
1089
1089
|
if (!proc.killed) {
|
|
1090
1090
|
const signals = ["SIGUSR1", "SIGUSR2", "SIGTERM", "SIGINT", "SIGHUP"];
|
|
1091
1091
|
signals.forEach((signal) => {
|
|
1092
|
-
|
|
1092
|
+
process2.on(signal, () => {
|
|
1093
1093
|
if (proc.killed === false && proc.exitCode === null) {
|
|
1094
1094
|
proc.kill(signal);
|
|
1095
1095
|
}
|
|
@@ -1098,10 +1098,10 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1098
1098
|
}
|
|
1099
1099
|
const exitCallback = this._exitCallback;
|
|
1100
1100
|
if (!exitCallback) {
|
|
1101
|
-
proc.on("close",
|
|
1101
|
+
proc.on("close", process2.exit.bind(process2));
|
|
1102
1102
|
} else {
|
|
1103
1103
|
proc.on("close", () => {
|
|
1104
|
-
exitCallback(new CommanderError(
|
|
1104
|
+
exitCallback(new CommanderError(process2.exitCode || 0, "commander.executeSubCommandAsync", "(close)"));
|
|
1105
1105
|
});
|
|
1106
1106
|
}
|
|
1107
1107
|
proc.on("error", (err) => {
|
|
@@ -1116,7 +1116,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1116
1116
|
throw new Error(`'${executableFile}' not executable`);
|
|
1117
1117
|
}
|
|
1118
1118
|
if (!exitCallback) {
|
|
1119
|
-
|
|
1119
|
+
process2.exit(1);
|
|
1120
1120
|
} else {
|
|
1121
1121
|
const wrappedError = new CommanderError(1, "commander.executeSubCommandAsync", "(error)");
|
|
1122
1122
|
wrappedError.nestedError = err;
|
|
@@ -1471,11 +1471,11 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1471
1471
|
}
|
|
1472
1472
|
_parseOptionsEnv() {
|
|
1473
1473
|
this.options.forEach((option) => {
|
|
1474
|
-
if (option.envVar && option.envVar in
|
|
1474
|
+
if (option.envVar && option.envVar in process2.env) {
|
|
1475
1475
|
const optionKey = option.attributeName();
|
|
1476
1476
|
if (this.getOptionValue(optionKey) === undefined || ["default", "config", "env"].includes(this.getOptionValueSource(optionKey))) {
|
|
1477
1477
|
if (option.required || option.optional) {
|
|
1478
|
-
this.emit(`optionEnv:${option.name()}`,
|
|
1478
|
+
this.emit(`optionEnv:${option.name()}`, process2.env[option.envVar]);
|
|
1479
1479
|
} else {
|
|
1480
1480
|
this.emit(`optionEnv:${option.name()}`);
|
|
1481
1481
|
}
|
|
@@ -1702,7 +1702,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1702
1702
|
}
|
|
1703
1703
|
help(contextOptions) {
|
|
1704
1704
|
this.outputHelp(contextOptions);
|
|
1705
|
-
let exitCode =
|
|
1705
|
+
let exitCode = process2.exitCode || 0;
|
|
1706
1706
|
if (exitCode === 0 && contextOptions && typeof contextOptions !== "function" && contextOptions.error) {
|
|
1707
1707
|
exitCode = 1;
|
|
1708
1708
|
}
|
|
@@ -1892,6 +1892,16 @@ function isMain(self) {
|
|
|
1892
1892
|
const result = argv1Base === selfBase;
|
|
1893
1893
|
return result;
|
|
1894
1894
|
}
|
|
1895
|
+
async function runMain(self, create) {
|
|
1896
|
+
if (!isMain(self))
|
|
1897
|
+
return;
|
|
1898
|
+
try {
|
|
1899
|
+
await create().parseAsync(Bun.argv);
|
|
1900
|
+
} catch (err) {
|
|
1901
|
+
console.error(`error: ${err instanceof Error ? err.message : String(err)}`);
|
|
1902
|
+
process.exit(1);
|
|
1903
|
+
}
|
|
1904
|
+
}
|
|
1895
1905
|
|
|
1896
1906
|
// bin/git-bump.ts
|
|
1897
1907
|
var version = await getPackageVersion();
|
|
@@ -1912,9 +1922,7 @@ function create() {
|
|
|
1912
1922
|
return program2;
|
|
1913
1923
|
}
|
|
1914
1924
|
var git_bump_default = create;
|
|
1915
|
-
|
|
1916
|
-
await create().parseAsync(Bun.argv);
|
|
1917
|
-
}
|
|
1925
|
+
await runMain("git-bump", create);
|
|
1918
1926
|
export {
|
|
1919
1927
|
git_bump_default as default,
|
|
1920
1928
|
create
|