@atlashub/smartstack-cli 4.66.0 → 4.68.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/index.js
CHANGED
|
@@ -112183,12 +112183,14 @@ var logger = {
|
|
|
112183
112183
|
error: source_default.red
|
|
112184
112184
|
};
|
|
112185
112185
|
const color = colors12[type];
|
|
112186
|
-
const
|
|
112186
|
+
const stripAnsi3 = (s) => s.replace(/\x1B\[[0-9;]*m/g, "");
|
|
112187
|
+
const maxLen = Math.max(...content.map((l) => stripAnsi3(l).length));
|
|
112187
112188
|
const border = color("\u2500".repeat(maxLen + 4));
|
|
112188
112189
|
console.log();
|
|
112189
112190
|
console.log(border);
|
|
112190
112191
|
content.forEach((line) => {
|
|
112191
|
-
|
|
112192
|
+
const pad = maxLen - stripAnsi3(line).length;
|
|
112193
|
+
console.log(color("\u2502"), line + " ".repeat(pad), color("\u2502"));
|
|
112192
112194
|
});
|
|
112193
112195
|
console.log(border);
|
|
112194
112196
|
console.log();
|
|
@@ -130247,15 +130249,64 @@ function requireComposeFile() {
|
|
|
130247
130249
|
}
|
|
130248
130250
|
return composePath;
|
|
130249
130251
|
}
|
|
130252
|
+
function getPodmanEnv(engine) {
|
|
130253
|
+
if (engine.name !== "podman") return {};
|
|
130254
|
+
const dockerConfigPath = (0, import_path18.join)(process.env.USERPROFILE || process.env.HOME || "", ".docker", "config.json");
|
|
130255
|
+
try {
|
|
130256
|
+
if (import_fs_extra16.default.existsSync(dockerConfigPath)) {
|
|
130257
|
+
const config = JSON.parse(import_fs_extra16.default.readFileSync(dockerConfigPath, "utf-8"));
|
|
130258
|
+
if (config.credsStore === "desktop" || config.credsStore === "wincred") {
|
|
130259
|
+
const cleanAuthPath = (0, import_path18.join)(process.env.TEMP || "/tmp", "podman-auth.json");
|
|
130260
|
+
if (!import_fs_extra16.default.existsSync(cleanAuthPath)) {
|
|
130261
|
+
import_fs_extra16.default.writeFileSync(cleanAuthPath, "{}", "utf-8");
|
|
130262
|
+
}
|
|
130263
|
+
return { REGISTRY_AUTH_FILE: cleanAuthPath };
|
|
130264
|
+
}
|
|
130265
|
+
}
|
|
130266
|
+
} catch {
|
|
130267
|
+
}
|
|
130268
|
+
return {};
|
|
130269
|
+
}
|
|
130250
130270
|
function runCompose(engine, composePath, args) {
|
|
130271
|
+
const extraEnv = getPodmanEnv(engine);
|
|
130272
|
+
if (Object.keys(extraEnv).length > 0) {
|
|
130273
|
+
logger.info("Bypassing Docker Desktop credential store for Podman");
|
|
130274
|
+
}
|
|
130251
130275
|
const result = (0, import_child_process12.spawnSync)(engine.cmd, ["compose", "-f", composePath, ...args], {
|
|
130252
130276
|
encoding: "utf-8",
|
|
130253
130277
|
shell: true,
|
|
130254
|
-
stdio: "
|
|
130255
|
-
cwd: process.cwd()
|
|
130278
|
+
stdio: "pipe",
|
|
130279
|
+
cwd: process.cwd(),
|
|
130280
|
+
env: { ...process.env, ...extraEnv }
|
|
130256
130281
|
});
|
|
130282
|
+
if (result.stdout) process.stdout.write(result.stdout);
|
|
130283
|
+
if (result.stderr) process.stderr.write(result.stderr);
|
|
130284
|
+
if (result.status !== 0) {
|
|
130285
|
+
const output = (result.stdout || "") + (result.stderr || "");
|
|
130286
|
+
diagnoseError(engine, output);
|
|
130287
|
+
}
|
|
130257
130288
|
return result.status ?? 1;
|
|
130258
130289
|
}
|
|
130290
|
+
function diagnoseError(engine, output) {
|
|
130291
|
+
if (/no space left|disk full/i.test(output)) {
|
|
130292
|
+
console.log();
|
|
130293
|
+
logger.warning("Disk space error detected.");
|
|
130294
|
+
console.log(` Free up space with: ${source_default.cyan(`${engine.name} system prune -a`)}`);
|
|
130295
|
+
console.log();
|
|
130296
|
+
}
|
|
130297
|
+
if (/could not resolve|network.*unreachable|timeout.*connect/i.test(output)) {
|
|
130298
|
+
console.log();
|
|
130299
|
+
logger.warning("Network error detected. Check your internet connection.");
|
|
130300
|
+
console.log();
|
|
130301
|
+
}
|
|
130302
|
+
if (/unable to connect to Podman socket|podman machine init/i.test(output)) {
|
|
130303
|
+
console.log();
|
|
130304
|
+
logger.warning("Podman machine is not running.");
|
|
130305
|
+
console.log(` ${source_default.cyan("podman machine init")} (first time only)`);
|
|
130306
|
+
console.log(` ${source_default.cyan("podman machine start")}`);
|
|
130307
|
+
console.log();
|
|
130308
|
+
}
|
|
130309
|
+
}
|
|
130259
130310
|
var dockerCommand = new Command("docker").description("Build and run SmartStack Docker images (Docker or Podman)").addCommand(
|
|
130260
130311
|
new Command("up").description("Build images and start containers").option("-d, --detach", "Run containers in the background").option("--no-build", "Skip image build, use existing images").action(async (options) => {
|
|
130261
130312
|
const engine = requireEngine();
|