@brewnet/cli 0.0.2 → 0.0.4
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/index.js +21 -47
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -691,43 +691,14 @@ async function installDockerMacOS() {
|
|
|
691
691
|
if (dockerAppExists) {
|
|
692
692
|
console.log(chalk2.dim(" [2/3] Docker Desktop\uC774 \uC774\uBBF8 \uC124\uCE58\uB418\uC5B4 \uC788\uC2B5\uB2C8\uB2E4. \uAC74\uB108\uB701\uB2C8\uB2E4."));
|
|
693
693
|
} else {
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
}).start();
|
|
698
|
-
const brewErrLines = [];
|
|
694
|
+
console.log(chalk2.dim(" [2/3] Docker Desktop \uC124\uCE58 \uC911... (~600MB, \uC218 \uBD84 \uC18C\uC694)"));
|
|
695
|
+
console.log(chalk2.dim(" (\uBE44\uBC00\uBC88\uD638 \uC785\uB825\uC774 \uD544\uC694\uD560 \uC218 \uC788\uC2B5\uB2C8\uB2E4)"));
|
|
696
|
+
console.log();
|
|
699
697
|
try {
|
|
700
|
-
|
|
698
|
+
await execa2("brew", ["install", "--cask", "docker-desktop"], {
|
|
701
699
|
env: augmentedEnv(),
|
|
702
|
-
|
|
700
|
+
stdio: "inherit"
|
|
703
701
|
});
|
|
704
|
-
const onBrewLine = (line) => {
|
|
705
|
-
if (/==> Downloading/i.test(line)) {
|
|
706
|
-
s2.text = "[2/3] Docker Desktop \uB2E4\uC6B4\uB85C\uB4DC \uC911... (~600MB)";
|
|
707
|
-
} else if (/^\s*#{3,}/.test(line)) {
|
|
708
|
-
const pct = line.match(/(\d+(?:\.\d+)?)%/);
|
|
709
|
-
if (pct) s2.text = `[2/3] Docker Desktop \uB2E4\uC6B4\uB85C\uB4DC \uC911... ${Math.round(Number(pct[1]))}%`;
|
|
710
|
-
} else if (/==> Verifying/i.test(line)) {
|
|
711
|
-
s2.text = "[2/3] \uD30C\uC77C \uBB34\uACB0\uC131 \uAC80\uC99D \uC911...";
|
|
712
|
-
} else if (/==> Installing/i.test(line)) {
|
|
713
|
-
s2.text = "[2/3] Docker Desktop \uC124\uCE58 \uC911...";
|
|
714
|
-
} else if (/==> Moving/i.test(line)) {
|
|
715
|
-
s2.text = "[2/3] Applications \uD3F4\uB354\uB85C \uC774\uB3D9 \uC911...";
|
|
716
|
-
} else if (/already installed/i.test(line)) {
|
|
717
|
-
s2.text = "[2/3] Docker Desktop \uC774\uBBF8 \uC124\uCE58\uB428 (brew \uAE30\uB85D)";
|
|
718
|
-
}
|
|
719
|
-
};
|
|
720
|
-
child.stdout?.on("data", (chunk) => {
|
|
721
|
-
chunk.toString().split("\n").forEach(onBrewLine);
|
|
722
|
-
});
|
|
723
|
-
child.stderr?.on("data", (chunk) => {
|
|
724
|
-
const lines = chunk.toString().split("\n");
|
|
725
|
-
lines.forEach(onBrewLine);
|
|
726
|
-
lines.forEach((l) => {
|
|
727
|
-
if (l.trim()) brewErrLines.push(l.trim());
|
|
728
|
-
});
|
|
729
|
-
});
|
|
730
|
-
await child;
|
|
731
702
|
const appNowExists = await (async () => {
|
|
732
703
|
try {
|
|
733
704
|
await execa2("test", ["-d", "/Applications/Docker.app"]);
|
|
@@ -737,18 +708,16 @@ async function installDockerMacOS() {
|
|
|
737
708
|
}
|
|
738
709
|
})();
|
|
739
710
|
if (!appNowExists) {
|
|
740
|
-
|
|
741
|
-
s2.fail(`[2/3] Docker Desktop \uC124\uCE58 \uC2E4\uD328 \u2014 brew \uC644\uB8CC \uD6C4 \uC571 \uBC88\uB4E4 \uC5C6\uC74C`);
|
|
742
|
-
console.log(chalk2.dim(` brew \uCD9C\uB825: ${detail}`));
|
|
711
|
+
console.log(chalk2.red(" \u2717 [2/3] Docker Desktop \uC124\uCE58 \uC2E4\uD328 \u2014 brew \uC644\uB8CC \uD6C4 \uC571 \uBC88\uB4E4 \uC5C6\uC74C"));
|
|
743
712
|
return {
|
|
744
713
|
success: false,
|
|
745
714
|
message: "brew install --cask docker \uAC00 exit 0\uC744 \uBC18\uD658\uD588\uC9C0\uB9CC /Applications/Docker.app \uC774 \uC5C6\uC2B5\uB2C8\uB2E4.\n \uC544\uB798 \uBA85\uB839\uC73C\uB85C \uC9C1\uC811 \uC7AC\uC124\uCE58\uD574\uC8FC\uC138\uC694:\n brew reinstall --cask docker\n \uB610\uB294 \uC218\uB3D9 \uC124\uCE58: https://docs.docker.com/desktop/mac/"
|
|
746
715
|
};
|
|
747
716
|
}
|
|
748
|
-
|
|
717
|
+
console.log(chalk2.green(" \u2714 [2/3] Docker Desktop \uC124\uCE58 \uC644\uB8CC"));
|
|
749
718
|
} catch (err) {
|
|
750
|
-
const detail =
|
|
751
|
-
|
|
719
|
+
const detail = err instanceof Error ? err.message : String(err);
|
|
720
|
+
console.log(chalk2.red(` \u2717 [2/3] Docker Desktop \uC124\uCE58 \uC2E4\uD328: ${detail}`));
|
|
752
721
|
return {
|
|
753
722
|
success: false,
|
|
754
723
|
message: `brew install --cask docker-desktop \uC2E4\uD328: ${detail}
|
|
@@ -4143,13 +4112,18 @@ async function runGenerateStep(state) {
|
|
|
4143
4112
|
return "error";
|
|
4144
4113
|
}
|
|
4145
4114
|
console.log();
|
|
4146
|
-
|
|
4115
|
+
console.log(chalk9.bold(" Pulling Docker images..."));
|
|
4116
|
+
console.log(chalk9.dim(" (\uB124\uD2B8\uC6CC\uD06C \uC18D\uB3C4\uC5D0 \uB530\uB77C \uC218 \uBD84 \uC18C\uC694\uB420 \uC218 \uC788\uC2B5\uB2C8\uB2E4)"));
|
|
4117
|
+
console.log();
|
|
4147
4118
|
try {
|
|
4148
4119
|
const pullCmd = buildPullCommand(composePath);
|
|
4149
|
-
const
|
|
4120
|
+
const { execa: execaPull } = await import("execa");
|
|
4121
|
+
const pullResult = await execaPull(pullCmd.cmd, pullCmd.args, {
|
|
4122
|
+
stdio: "inherit",
|
|
4123
|
+
reject: false
|
|
4124
|
+
});
|
|
4150
4125
|
if (pullResult.exitCode !== 0) {
|
|
4151
|
-
|
|
4152
|
-
console.log(chalk9.dim(` ${pullResult.stderr}`));
|
|
4126
|
+
console.log(chalk9.red(" \u2717 Failed to pull Docker images"));
|
|
4153
4127
|
const shouldContinue = await confirm5({
|
|
4154
4128
|
message: "Continue without pulling images? (existing images will be used)",
|
|
4155
4129
|
default: false
|
|
@@ -4158,10 +4132,10 @@ async function runGenerateStep(state) {
|
|
|
4158
4132
|
return "error";
|
|
4159
4133
|
}
|
|
4160
4134
|
} else {
|
|
4161
|
-
|
|
4135
|
+
console.log(chalk9.green(" \u2714 Docker images pulled"));
|
|
4162
4136
|
}
|
|
4163
4137
|
} catch (err) {
|
|
4164
|
-
|
|
4138
|
+
console.log(chalk9.red(" \u2717 Failed to pull Docker images"));
|
|
4165
4139
|
if (err instanceof Error) {
|
|
4166
4140
|
console.log(chalk9.dim(` ${err.message}`));
|
|
4167
4141
|
}
|
|
@@ -7823,7 +7797,7 @@ function stripAnsi(str) {
|
|
|
7823
7797
|
// src/index.ts
|
|
7824
7798
|
function createProgram() {
|
|
7825
7799
|
const program = new Command();
|
|
7826
|
-
program.name("brewnet").description("Your Home Server, Brewed Fresh").version("0.0.
|
|
7800
|
+
program.name("brewnet").description("Your Home Server, Brewed Fresh").version("0.0.4").showHelpAfterError('(run "brewnet --help" for usage information)');
|
|
7827
7801
|
registerInitCommand(program);
|
|
7828
7802
|
registerStatusCommand(program);
|
|
7829
7803
|
registerAddCommand(program);
|