@andpipes/cli 0.1.1 → 0.1.2
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/bin.cjs +49 -5
- package/dist/bin.js +1 -1
- package/dist/{chunk-QPRR3KCS.js → chunk-ELZTOEAZ.js} +46 -2
- package/dist/index.cjs +49 -5
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/bin.cjs
CHANGED
|
@@ -3672,6 +3672,41 @@ async function loginAdminCli(input = {}) {
|
|
|
3672
3672
|
}
|
|
3673
3673
|
}
|
|
3674
3674
|
|
|
3675
|
+
// src/lib/open-browser.ts
|
|
3676
|
+
var import_node_child_process = require("child_process");
|
|
3677
|
+
function browserCommandForPlatform(verificationUri, platform = process.platform) {
|
|
3678
|
+
if (platform === "darwin") {
|
|
3679
|
+
return { command: "open", args: [verificationUri] };
|
|
3680
|
+
}
|
|
3681
|
+
if (platform === "win32") {
|
|
3682
|
+
return {
|
|
3683
|
+
command: "rundll32",
|
|
3684
|
+
args: ["url.dll,FileProtocolHandler", verificationUri]
|
|
3685
|
+
};
|
|
3686
|
+
}
|
|
3687
|
+
if (platform === "linux") {
|
|
3688
|
+
return { command: "xdg-open", args: [verificationUri] };
|
|
3689
|
+
}
|
|
3690
|
+
return null;
|
|
3691
|
+
}
|
|
3692
|
+
function openBrowser(verificationUri) {
|
|
3693
|
+
const browserCommand = browserCommandForPlatform(verificationUri);
|
|
3694
|
+
if (!browserCommand) return false;
|
|
3695
|
+
try {
|
|
3696
|
+
const child = (0, import_node_child_process.spawn)(browserCommand.command, [...browserCommand.args], {
|
|
3697
|
+
detached: true,
|
|
3698
|
+
shell: false,
|
|
3699
|
+
stdio: "ignore",
|
|
3700
|
+
windowsHide: true
|
|
3701
|
+
});
|
|
3702
|
+
child.once("error", () => void 0);
|
|
3703
|
+
child.unref();
|
|
3704
|
+
return true;
|
|
3705
|
+
} catch {
|
|
3706
|
+
return false;
|
|
3707
|
+
}
|
|
3708
|
+
}
|
|
3709
|
+
|
|
3675
3710
|
// src/commands/auth.ts
|
|
3676
3711
|
function explicitScopes(value) {
|
|
3677
3712
|
if (value === void 0) return void 0;
|
|
@@ -3684,12 +3719,15 @@ function explicitScopes(value) {
|
|
|
3684
3719
|
}
|
|
3685
3720
|
return scopes;
|
|
3686
3721
|
}
|
|
3687
|
-
function registerAuth(program, writer, locale = import_localization2.DEFAULT_LOCALE) {
|
|
3722
|
+
function registerAuth(program, writer, locale = import_localization2.DEFAULT_LOCALE, dependencies = {}) {
|
|
3688
3723
|
const text = import_localization2.LOCALIZED_TEXT[locale].cli;
|
|
3689
3724
|
const messages = import_localization2.CLI_MESSAGES[locale];
|
|
3690
3725
|
program.command("login").description(
|
|
3691
3726
|
locale === "ja" ? "Web Admin\u627F\u8A8D\u3067Admin CLI\u3078\u30ED\u30B0\u30A4\u30F3" : "Sign in to the Admin CLI through Web Admin approval"
|
|
3692
|
-
).option("--scope <scopes>", "\u8981\u6C42\u3059\u308BAdmin CLI scope\uFF08\u76E3\u67FB\u30A8\u30AF\u30B9\u30DD\u30FC\u30C8\u6A29\u9650\u306F\u3053\u3053\u3067\u660E\u793A\u6307\u5B9A\uFF09").option("--profile <name>", messages.common.profileDestinationOption, DEFAULT_PROFILE_NAME).
|
|
3727
|
+
).option("--scope <scopes>", "\u8981\u6C42\u3059\u308BAdmin CLI scope\uFF08\u76E3\u67FB\u30A8\u30AF\u30B9\u30DD\u30FC\u30C8\u6A29\u9650\u306F\u3053\u3053\u3067\u660E\u793A\u6307\u5B9A\uFF09").option("--profile <name>", messages.common.profileDestinationOption, DEFAULT_PROFILE_NAME).option(
|
|
3728
|
+
"--no-browser",
|
|
3729
|
+
locale === "ja" ? "\u65E2\u5B9A\u30D6\u30E9\u30A6\u30B6\u3092\u81EA\u52D5\u8D77\u52D5\u305B\u305A\u3001\u627F\u8A8DURL\u3060\u3051\u3092\u8868\u793A" : "Print the approval URL without opening the default browser"
|
|
3730
|
+
).action(async (opts) => {
|
|
3693
3731
|
const record = await loginAdminCli({
|
|
3694
3732
|
profile: opts.profile,
|
|
3695
3733
|
requestedScopes: explicitScopes(opts.scope),
|
|
@@ -3698,6 +3736,12 @@ function registerAuth(program, writer, locale = import_localization2.DEFAULT_LOC
|
|
|
3698
3736
|
writer,
|
|
3699
3737
|
locale === "ja" ? `Web Admin\u3067\u627F\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044: ${verificationUri}` : `Approve this request in Web Admin: ${verificationUri}`
|
|
3700
3738
|
);
|
|
3739
|
+
if (opts.browser) {
|
|
3740
|
+
try {
|
|
3741
|
+
(dependencies.openBrowser ?? openBrowser)(verificationUri);
|
|
3742
|
+
} catch {
|
|
3743
|
+
}
|
|
3744
|
+
}
|
|
3701
3745
|
},
|
|
3702
3746
|
onUserCode: (userCode) => {
|
|
3703
3747
|
interactive(
|
|
@@ -5408,7 +5452,7 @@ function loadDevProject(cwd, runtime = {}) {
|
|
|
5408
5452
|
}
|
|
5409
5453
|
|
|
5410
5454
|
// src/lib/dev-tunnel.ts
|
|
5411
|
-
var
|
|
5455
|
+
var import_node_child_process2 = require("child_process");
|
|
5412
5456
|
var import_node_fs7 = require("fs");
|
|
5413
5457
|
var import_node_path7 = require("path");
|
|
5414
5458
|
var QUICK_TUNNEL_PROVIDER = "cloudflare-quick";
|
|
@@ -5475,7 +5519,7 @@ async function terminateKnownProcessGroup(pgid, runtime = defaultProcessGroupRun
|
|
|
5475
5519
|
var defaultParentTunnelRuntime = {
|
|
5476
5520
|
...defaultProcessGroupRuntime,
|
|
5477
5521
|
forkSupervisor(modulePath, args, options) {
|
|
5478
|
-
return (0,
|
|
5522
|
+
return (0, import_node_child_process2.fork)(modulePath, [...args], {
|
|
5479
5523
|
detached: options.detached,
|
|
5480
5524
|
execArgv: [...options.execArgv],
|
|
5481
5525
|
stdio: [...options.stdio]
|
|
@@ -5569,7 +5613,7 @@ async function startCloudflareQuickTunnel(input, runtime = defaultParentTunnelRu
|
|
|
5569
5613
|
}
|
|
5570
5614
|
var defaultSupervisorRuntime = {
|
|
5571
5615
|
spawn(file, args, options) {
|
|
5572
|
-
return (0,
|
|
5616
|
+
return (0, import_node_child_process2.spawn)(file, [...args], {
|
|
5573
5617
|
shell: options.shell,
|
|
5574
5618
|
detached: options.detached,
|
|
5575
5619
|
stdio: [...options.stdio]
|
package/dist/bin.js
CHANGED
|
@@ -3757,6 +3757,41 @@ async function loginAdminCli(input = {}) {
|
|
|
3757
3757
|
}
|
|
3758
3758
|
}
|
|
3759
3759
|
|
|
3760
|
+
// src/lib/open-browser.ts
|
|
3761
|
+
import { spawn } from "child_process";
|
|
3762
|
+
function browserCommandForPlatform(verificationUri, platform = process.platform) {
|
|
3763
|
+
if (platform === "darwin") {
|
|
3764
|
+
return { command: "open", args: [verificationUri] };
|
|
3765
|
+
}
|
|
3766
|
+
if (platform === "win32") {
|
|
3767
|
+
return {
|
|
3768
|
+
command: "rundll32",
|
|
3769
|
+
args: ["url.dll,FileProtocolHandler", verificationUri]
|
|
3770
|
+
};
|
|
3771
|
+
}
|
|
3772
|
+
if (platform === "linux") {
|
|
3773
|
+
return { command: "xdg-open", args: [verificationUri] };
|
|
3774
|
+
}
|
|
3775
|
+
return null;
|
|
3776
|
+
}
|
|
3777
|
+
function openBrowser(verificationUri) {
|
|
3778
|
+
const browserCommand = browserCommandForPlatform(verificationUri);
|
|
3779
|
+
if (!browserCommand) return false;
|
|
3780
|
+
try {
|
|
3781
|
+
const child = spawn(browserCommand.command, [...browserCommand.args], {
|
|
3782
|
+
detached: true,
|
|
3783
|
+
shell: false,
|
|
3784
|
+
stdio: "ignore",
|
|
3785
|
+
windowsHide: true
|
|
3786
|
+
});
|
|
3787
|
+
child.once("error", () => void 0);
|
|
3788
|
+
child.unref();
|
|
3789
|
+
return true;
|
|
3790
|
+
} catch {
|
|
3791
|
+
return false;
|
|
3792
|
+
}
|
|
3793
|
+
}
|
|
3794
|
+
|
|
3760
3795
|
// src/commands/auth.ts
|
|
3761
3796
|
function explicitScopes(value) {
|
|
3762
3797
|
if (value === void 0) return void 0;
|
|
@@ -3769,12 +3804,15 @@ function explicitScopes(value) {
|
|
|
3769
3804
|
}
|
|
3770
3805
|
return scopes;
|
|
3771
3806
|
}
|
|
3772
|
-
function registerAuth(program, writer, locale = DEFAULT_LOCALE2) {
|
|
3807
|
+
function registerAuth(program, writer, locale = DEFAULT_LOCALE2, dependencies = {}) {
|
|
3773
3808
|
const text = LOCALIZED_TEXT[locale].cli;
|
|
3774
3809
|
const messages = CLI_MESSAGES[locale];
|
|
3775
3810
|
program.command("login").description(
|
|
3776
3811
|
locale === "ja" ? "Web Admin\u627F\u8A8D\u3067Admin CLI\u3078\u30ED\u30B0\u30A4\u30F3" : "Sign in to the Admin CLI through Web Admin approval"
|
|
3777
|
-
).option("--scope <scopes>", "\u8981\u6C42\u3059\u308BAdmin CLI scope\uFF08\u76E3\u67FB\u30A8\u30AF\u30B9\u30DD\u30FC\u30C8\u6A29\u9650\u306F\u3053\u3053\u3067\u660E\u793A\u6307\u5B9A\uFF09").option("--profile <name>", messages.common.profileDestinationOption, DEFAULT_PROFILE_NAME).
|
|
3812
|
+
).option("--scope <scopes>", "\u8981\u6C42\u3059\u308BAdmin CLI scope\uFF08\u76E3\u67FB\u30A8\u30AF\u30B9\u30DD\u30FC\u30C8\u6A29\u9650\u306F\u3053\u3053\u3067\u660E\u793A\u6307\u5B9A\uFF09").option("--profile <name>", messages.common.profileDestinationOption, DEFAULT_PROFILE_NAME).option(
|
|
3813
|
+
"--no-browser",
|
|
3814
|
+
locale === "ja" ? "\u65E2\u5B9A\u30D6\u30E9\u30A6\u30B6\u3092\u81EA\u52D5\u8D77\u52D5\u305B\u305A\u3001\u627F\u8A8DURL\u3060\u3051\u3092\u8868\u793A" : "Print the approval URL without opening the default browser"
|
|
3815
|
+
).action(async (opts) => {
|
|
3778
3816
|
const record = await loginAdminCli({
|
|
3779
3817
|
profile: opts.profile,
|
|
3780
3818
|
requestedScopes: explicitScopes(opts.scope),
|
|
@@ -3783,6 +3821,12 @@ function registerAuth(program, writer, locale = DEFAULT_LOCALE2) {
|
|
|
3783
3821
|
writer,
|
|
3784
3822
|
locale === "ja" ? `Web Admin\u3067\u627F\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044: ${verificationUri}` : `Approve this request in Web Admin: ${verificationUri}`
|
|
3785
3823
|
);
|
|
3824
|
+
if (opts.browser) {
|
|
3825
|
+
try {
|
|
3826
|
+
(dependencies.openBrowser ?? openBrowser)(verificationUri);
|
|
3827
|
+
} catch {
|
|
3828
|
+
}
|
|
3829
|
+
}
|
|
3786
3830
|
},
|
|
3787
3831
|
onUserCode: (userCode) => {
|
|
3788
3832
|
interactive(
|
package/dist/index.cjs
CHANGED
|
@@ -3818,6 +3818,41 @@ async function loginAdminCli(input = {}) {
|
|
|
3818
3818
|
}
|
|
3819
3819
|
}
|
|
3820
3820
|
|
|
3821
|
+
// src/lib/open-browser.ts
|
|
3822
|
+
var import_node_child_process = require("child_process");
|
|
3823
|
+
function browserCommandForPlatform(verificationUri, platform = process.platform) {
|
|
3824
|
+
if (platform === "darwin") {
|
|
3825
|
+
return { command: "open", args: [verificationUri] };
|
|
3826
|
+
}
|
|
3827
|
+
if (platform === "win32") {
|
|
3828
|
+
return {
|
|
3829
|
+
command: "rundll32",
|
|
3830
|
+
args: ["url.dll,FileProtocolHandler", verificationUri]
|
|
3831
|
+
};
|
|
3832
|
+
}
|
|
3833
|
+
if (platform === "linux") {
|
|
3834
|
+
return { command: "xdg-open", args: [verificationUri] };
|
|
3835
|
+
}
|
|
3836
|
+
return null;
|
|
3837
|
+
}
|
|
3838
|
+
function openBrowser(verificationUri) {
|
|
3839
|
+
const browserCommand = browserCommandForPlatform(verificationUri);
|
|
3840
|
+
if (!browserCommand) return false;
|
|
3841
|
+
try {
|
|
3842
|
+
const child = (0, import_node_child_process.spawn)(browserCommand.command, [...browserCommand.args], {
|
|
3843
|
+
detached: true,
|
|
3844
|
+
shell: false,
|
|
3845
|
+
stdio: "ignore",
|
|
3846
|
+
windowsHide: true
|
|
3847
|
+
});
|
|
3848
|
+
child.once("error", () => void 0);
|
|
3849
|
+
child.unref();
|
|
3850
|
+
return true;
|
|
3851
|
+
} catch {
|
|
3852
|
+
return false;
|
|
3853
|
+
}
|
|
3854
|
+
}
|
|
3855
|
+
|
|
3821
3856
|
// src/commands/auth.ts
|
|
3822
3857
|
function explicitScopes(value) {
|
|
3823
3858
|
if (value === void 0) return void 0;
|
|
@@ -3830,12 +3865,15 @@ function explicitScopes(value) {
|
|
|
3830
3865
|
}
|
|
3831
3866
|
return scopes;
|
|
3832
3867
|
}
|
|
3833
|
-
function registerAuth(program, writer, locale = import_localization2.DEFAULT_LOCALE) {
|
|
3868
|
+
function registerAuth(program, writer, locale = import_localization2.DEFAULT_LOCALE, dependencies = {}) {
|
|
3834
3869
|
const text = import_localization2.LOCALIZED_TEXT[locale].cli;
|
|
3835
3870
|
const messages = import_localization2.CLI_MESSAGES[locale];
|
|
3836
3871
|
program.command("login").description(
|
|
3837
3872
|
locale === "ja" ? "Web Admin\u627F\u8A8D\u3067Admin CLI\u3078\u30ED\u30B0\u30A4\u30F3" : "Sign in to the Admin CLI through Web Admin approval"
|
|
3838
|
-
).option("--scope <scopes>", "\u8981\u6C42\u3059\u308BAdmin CLI scope\uFF08\u76E3\u67FB\u30A8\u30AF\u30B9\u30DD\u30FC\u30C8\u6A29\u9650\u306F\u3053\u3053\u3067\u660E\u793A\u6307\u5B9A\uFF09").option("--profile <name>", messages.common.profileDestinationOption, DEFAULT_PROFILE_NAME).
|
|
3873
|
+
).option("--scope <scopes>", "\u8981\u6C42\u3059\u308BAdmin CLI scope\uFF08\u76E3\u67FB\u30A8\u30AF\u30B9\u30DD\u30FC\u30C8\u6A29\u9650\u306F\u3053\u3053\u3067\u660E\u793A\u6307\u5B9A\uFF09").option("--profile <name>", messages.common.profileDestinationOption, DEFAULT_PROFILE_NAME).option(
|
|
3874
|
+
"--no-browser",
|
|
3875
|
+
locale === "ja" ? "\u65E2\u5B9A\u30D6\u30E9\u30A6\u30B6\u3092\u81EA\u52D5\u8D77\u52D5\u305B\u305A\u3001\u627F\u8A8DURL\u3060\u3051\u3092\u8868\u793A" : "Print the approval URL without opening the default browser"
|
|
3876
|
+
).action(async (opts) => {
|
|
3839
3877
|
const record = await loginAdminCli({
|
|
3840
3878
|
profile: opts.profile,
|
|
3841
3879
|
requestedScopes: explicitScopes(opts.scope),
|
|
@@ -3844,6 +3882,12 @@ function registerAuth(program, writer, locale = import_localization2.DEFAULT_LOC
|
|
|
3844
3882
|
writer,
|
|
3845
3883
|
locale === "ja" ? `Web Admin\u3067\u627F\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044: ${verificationUri}` : `Approve this request in Web Admin: ${verificationUri}`
|
|
3846
3884
|
);
|
|
3885
|
+
if (opts.browser) {
|
|
3886
|
+
try {
|
|
3887
|
+
(dependencies.openBrowser ?? openBrowser)(verificationUri);
|
|
3888
|
+
} catch {
|
|
3889
|
+
}
|
|
3890
|
+
}
|
|
3847
3891
|
},
|
|
3848
3892
|
onUserCode: (userCode) => {
|
|
3849
3893
|
interactive(
|
|
@@ -5554,7 +5598,7 @@ function loadDevProject(cwd, runtime = {}) {
|
|
|
5554
5598
|
}
|
|
5555
5599
|
|
|
5556
5600
|
// src/lib/dev-tunnel.ts
|
|
5557
|
-
var
|
|
5601
|
+
var import_node_child_process2 = require("child_process");
|
|
5558
5602
|
var import_node_fs7 = require("fs");
|
|
5559
5603
|
var import_node_path7 = require("path");
|
|
5560
5604
|
var QUICK_TUNNEL_PROVIDER = "cloudflare-quick";
|
|
@@ -5621,7 +5665,7 @@ async function terminateKnownProcessGroup(pgid, runtime = defaultProcessGroupRun
|
|
|
5621
5665
|
var defaultParentTunnelRuntime = {
|
|
5622
5666
|
...defaultProcessGroupRuntime,
|
|
5623
5667
|
forkSupervisor(modulePath, args, options) {
|
|
5624
|
-
return (0,
|
|
5668
|
+
return (0, import_node_child_process2.fork)(modulePath, [...args], {
|
|
5625
5669
|
detached: options.detached,
|
|
5626
5670
|
execArgv: [...options.execArgv],
|
|
5627
5671
|
stdio: [...options.stdio]
|
|
@@ -5715,7 +5759,7 @@ async function startCloudflareQuickTunnel(input, runtime = defaultParentTunnelRu
|
|
|
5715
5759
|
}
|
|
5716
5760
|
var defaultSupervisorRuntime = {
|
|
5717
5761
|
spawn(file, args, options) {
|
|
5718
|
-
return (0,
|
|
5762
|
+
return (0, import_node_child_process2.spawn)(file, [...args], {
|
|
5719
5763
|
shell: options.shell,
|
|
5720
5764
|
detached: options.detached,
|
|
5721
5765
|
stdio: [...options.stdio]
|
package/dist/index.js
CHANGED
package/package.json
CHANGED