@cruxgarden/cli 0.0.7 → 0.0.9
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/lib/commands.js +28 -3
- package/package.json +1 -1
package/lib/commands.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { execSync, spawn } from "child_process";
|
|
2
2
|
import { fileURLToPath } from "url";
|
|
3
3
|
import { dirname, join } from "path";
|
|
4
|
+
import { readFileSync } from "fs";
|
|
4
5
|
import readline from "readline";
|
|
5
6
|
import chalk from "chalk";
|
|
6
7
|
import ora from "ora";
|
|
@@ -9,6 +10,12 @@ const __filename = fileURLToPath(import.meta.url);
|
|
|
9
10
|
const __dirname = dirname(__filename);
|
|
10
11
|
const dockerDir = join(__dirname, "..", "docker");
|
|
11
12
|
|
|
13
|
+
// Read version from package.json
|
|
14
|
+
const packageJson = JSON.parse(
|
|
15
|
+
readFileSync(join(__dirname, "..", "package.json"), "utf-8")
|
|
16
|
+
);
|
|
17
|
+
const VERSION = packageJson.version;
|
|
18
|
+
|
|
12
19
|
// Colors
|
|
13
20
|
const SUCCESS_GREEN = "#9BD39B";
|
|
14
21
|
|
|
@@ -50,7 +57,7 @@ export function showBanner() {
|
|
|
50
57
|
console.log(randomColor(line));
|
|
51
58
|
});
|
|
52
59
|
|
|
53
|
-
console.log(chalk.gray(
|
|
60
|
+
console.log(chalk.gray(` Nursery Environment - Demo & Trial (v${VERSION})\n`));
|
|
54
61
|
|
|
55
62
|
// Set environment variable so it persists for this shell session
|
|
56
63
|
process.env.CRUX_BANNER_SHOWN = "1";
|
|
@@ -187,9 +194,18 @@ export async function startNursery(options) {
|
|
|
187
194
|
spinner.text =
|
|
188
195
|
"Starting nursery services (api, postgres, redis)...";
|
|
189
196
|
await runCommandAsync(
|
|
190
|
-
"docker-compose -f docker-compose.nursery.yml up -d --remove-orphans
|
|
197
|
+
"docker-compose -f docker-compose.nursery.yml up -d --remove-orphans",
|
|
198
|
+
{
|
|
199
|
+
silent: true,
|
|
200
|
+
},
|
|
201
|
+
);
|
|
202
|
+
|
|
203
|
+
// Clean up the migrations container if it exists (cross-platform)
|
|
204
|
+
await runCommandAsync(
|
|
205
|
+
"docker rm cruxgarden-nursery-migrations",
|
|
191
206
|
{
|
|
192
207
|
silent: true,
|
|
208
|
+
ignoreError: true,
|
|
193
209
|
},
|
|
194
210
|
);
|
|
195
211
|
|
|
@@ -456,12 +472,21 @@ export async function resetNursery() {
|
|
|
456
472
|
// Start fresh
|
|
457
473
|
spinner.text = "Starting fresh nursery environment...";
|
|
458
474
|
await runCommandAsync(
|
|
459
|
-
"docker-compose -f docker-compose.nursery.yml up -d --remove-orphans
|
|
475
|
+
"docker-compose -f docker-compose.nursery.yml up -d --remove-orphans",
|
|
460
476
|
{
|
|
461
477
|
silent: true,
|
|
462
478
|
},
|
|
463
479
|
);
|
|
464
480
|
|
|
481
|
+
// Clean up the migrations container if it exists (cross-platform)
|
|
482
|
+
await runCommandAsync(
|
|
483
|
+
"docker rm cruxgarden-nursery-migrations",
|
|
484
|
+
{
|
|
485
|
+
silent: true,
|
|
486
|
+
ignoreError: true,
|
|
487
|
+
},
|
|
488
|
+
);
|
|
489
|
+
|
|
465
490
|
spinner.succeed("Nursery environment reset complete!");
|
|
466
491
|
console.log(
|
|
467
492
|
chalk.hex(SUCCESS_GREEN)("\n✓ API running on:"),
|