@minecraft-docker/mcctl 1.12.1 → 1.14.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.
Files changed (45) hide show
  1. package/CHANGELOG.md +49 -6
  2. package/README.md +15 -11
  3. package/dist/commands/console/init.d.ts.map +1 -1
  4. package/dist/commands/console/init.js +63 -53
  5. package/dist/commands/console/init.js.map +1 -1
  6. package/dist/commands/console/service.d.ts +1 -0
  7. package/dist/commands/console/service.d.ts.map +1 -1
  8. package/dist/commands/console/service.js +144 -26
  9. package/dist/commands/console/service.js.map +1 -1
  10. package/dist/commands/console/user.d.ts.map +1 -1
  11. package/dist/commands/console/user.js +344 -304
  12. package/dist/commands/console/user.js.map +1 -1
  13. package/dist/commands/create.d.ts +3 -0
  14. package/dist/commands/create.d.ts.map +1 -1
  15. package/dist/commands/create.js +16 -1
  16. package/dist/commands/create.js.map +1 -1
  17. package/dist/commands/init.d.ts.map +1 -1
  18. package/dist/commands/init.js +4 -24
  19. package/dist/commands/init.js.map +1 -1
  20. package/dist/index.js +10 -1
  21. package/dist/index.js.map +1 -1
  22. package/dist/infrastructure/adapters/ClackPromptAdapter.d.ts +4 -1
  23. package/dist/infrastructure/adapters/ClackPromptAdapter.d.ts.map +1 -1
  24. package/dist/infrastructure/adapters/ClackPromptAdapter.js +92 -9
  25. package/dist/infrastructure/adapters/ClackPromptAdapter.js.map +1 -1
  26. package/dist/infrastructure/adapters/Pm2ServiceManagerAdapter.d.ts +6 -0
  27. package/dist/infrastructure/adapters/Pm2ServiceManagerAdapter.d.ts.map +1 -1
  28. package/dist/infrastructure/adapters/Pm2ServiceManagerAdapter.js +26 -0
  29. package/dist/infrastructure/adapters/Pm2ServiceManagerAdapter.js.map +1 -1
  30. package/dist/infrastructure/di/container.d.ts +3 -1
  31. package/dist/infrastructure/di/container.d.ts.map +1 -1
  32. package/dist/infrastructure/di/container.js +9 -1
  33. package/dist/infrastructure/di/container.js.map +1 -1
  34. package/dist/lib/admin-config.js +1 -1
  35. package/dist/lib/console-db.d.ts +64 -0
  36. package/dist/lib/console-db.d.ts.map +1 -0
  37. package/dist/lib/console-db.js +240 -0
  38. package/dist/lib/console-db.js.map +1 -0
  39. package/dist/lib/prerequisite-display.d.ts +7 -0
  40. package/dist/lib/prerequisite-display.d.ts.map +1 -0
  41. package/dist/lib/prerequisite-display.js +42 -0
  42. package/dist/lib/prerequisite-display.js.map +1 -0
  43. package/package.json +5 -3
  44. package/scripts/create-server.sh +63 -3
  45. package/templates/.env.example +1 -1
@@ -0,0 +1,42 @@
1
+ import { colors, log } from '@minecraft-docker/shared';
2
+ /**
3
+ * Display a PrerequisiteReport as a formatted table.
4
+ * Returns true if all mandatory prerequisites are satisfied.
5
+ */
6
+ export function displayPrerequisiteReport(report) {
7
+ for (const r of report.results) {
8
+ const versionStr = r.version ?? 'not found';
9
+ // Only add 'v' prefix if version looks like a semver number
10
+ const displayVersion = r.version && /^\d/.test(r.version) ? `v${versionStr}` : versionStr;
11
+ const requiredStr = `(${r.required})`;
12
+ if (r.satisfied) {
13
+ console.log(` ✓ ${r.name.padEnd(18)} ${colors.green(displayVersion)} ${colors.dim(requiredStr)}`);
14
+ }
15
+ else if (r.optional) {
16
+ console.log(` ⚠ ${r.name.padEnd(18)} ${colors.yellow(displayVersion)} ${colors.dim(requiredStr)}`);
17
+ if (r.hint) {
18
+ console.log(` ${colors.dim(r.hint)}`);
19
+ }
20
+ }
21
+ else {
22
+ console.log(` ✗ ${r.name.padEnd(18)} ${colors.red(versionStr)} ${colors.dim(requiredStr)}`);
23
+ if (r.hint) {
24
+ console.log(` ${colors.dim(r.hint)}`);
25
+ }
26
+ }
27
+ }
28
+ if (!report.allSatisfied) {
29
+ console.log('');
30
+ const failed = report.results.filter(r => !r.optional && !r.satisfied);
31
+ for (const f of failed) {
32
+ if (!f.installed) {
33
+ log.error(`${f.name} is not installed`);
34
+ }
35
+ else {
36
+ log.error(`${f.name} version ${f.version} does not meet minimum requirement ${f.required}`);
37
+ }
38
+ }
39
+ }
40
+ return report.allSatisfied;
41
+ }
42
+ //# sourceMappingURL=prerequisite-display.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prerequisite-display.js","sourceRoot":"","sources":["../../src/lib/prerequisite-display.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,0BAA0B,CAAC;AAEvD;;;GAGG;AACH,MAAM,UAAU,yBAAyB,CAAC,MAA0B;IAClE,KAAK,MAAM,CAAC,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;QAC/B,MAAM,UAAU,GAAG,CAAC,CAAC,OAAO,IAAI,WAAW,CAAC;QAC5C,4DAA4D;QAC5D,MAAM,cAAc,GAAG,CAAC,CAAC,OAAO,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,UAAU,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC;QAC1F,MAAM,WAAW,GAAG,IAAI,CAAC,CAAC,QAAQ,GAAG,CAAC;QAEtC,IAAI,CAAC,CAAC,SAAS,EAAE,CAAC;YAChB,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC,cAAc,CAAC,KAAK,MAAM,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;QACtG,CAAC;aAAM,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAC;YACtB,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,KAAK,MAAM,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;YACrG,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC;gBACX,OAAO,CAAC,GAAG,CAAC,OAAO,MAAM,CAAC,GAAG,CA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minecraft servers with mc-router",
5
5
  "type": "module",
6
6
  "bin": {
@@ -55,8 +55,9 @@
55
55
  ],
56
56
  "dependencies": {
57
57
  "@clack/prompts": "^0.8.0",
58
- "@minecraft-docker/mod-source-modrinth": "^1.12.1",
59
- "@minecraft-docker/shared": "^1.12.1",
58
+ "@minecraft-docker/mod-source-modrinth": "^1.14.0",
59
+ "@minecraft-docker/shared": "^1.14.0",
60
+ "better-sqlite3": "^12.6.2",
60
61
  "commander": "^12.0.0",
61
62
  "js-yaml": "^4.1.0",
62
63
  "picocolors": "^1.1.0",
@@ -65,6 +66,7 @@
65
66
  "tar": "^7.5.4"
66
67
  },
67
68
  "devDependencies": {
69
+ "@types/better-sqlite3": "^7.6.13",
68
70
  "@types/js-yaml": "^4.0.9",
69
71
  "@types/node": "^20.10.0",
70
72
  "@types/tar": "^6.1.13",
@@ -13,11 +13,14 @@
13
13
  # - Hostname: <server-name>.local
14
14
  #
15
15
  # Options:
16
- # -t, --type TYPE Server type: PAPER (default), VANILLA, FORGE, FABRIC
16
+ # -t, --type TYPE Server type: PAPER (default), VANILLA, FORGE, FABRIC, MODRINTH, AUTO_CURSEFORGE
17
17
  # -v, --version VER Minecraft version (e.g., 1.21.1, 1.20.4)
18
18
  # -s, --seed NUMBER World seed for new world generation
19
19
  # -u, --world-url URL Download world from ZIP URL
20
20
  # -w, --world NAME Use existing world from worlds/ directory (creates symlink)
21
+ # --modpack SLUG Modpack slug (required for MODRINTH/AUTO_CURSEFORGE)
22
+ # --modpack-version VER Modpack version (optional)
23
+ # --mod-loader LOADER Mod loader: fabric, forge, neoforge, quilt (optional)
21
24
  # --no-start Don't start the server after creation
22
25
  # --start Start the server after creation (default)
23
26
  #
@@ -222,6 +225,9 @@ MC_VERSION=""
222
225
  WORLD_SEED=""
223
226
  WORLD_URL=""
224
227
  WORLD_NAME=""
228
+ MODPACK_SLUG=""
229
+ MODPACK_VERSION=""
230
+ MOD_LOADER=""
225
231
  START_SERVER="true"
226
232
 
227
233
  # Show usage
@@ -232,11 +238,14 @@ show_usage() {
232
238
  echo " server-name : Name for the new server (lowercase, no spaces)"
233
239
  echo ""
234
240
  echo "Options:"
235
- echo " -t, --type TYPE Server type: PAPER (default), VANILLA, FORGE, FABRIC"
241
+ echo " -t, --type TYPE Server type: PAPER (default), VANILLA, FORGE, FABRIC, MODRINTH, AUTO_CURSEFORGE"
236
242
  echo " -v, --version VER Minecraft version (e.g., 1.21.1, 1.20.4)"
237
243
  echo " -s, --seed NUMBER World seed for new world generation"
238
244
  echo " -u, --world-url URL Download world from ZIP URL"
239
245
  echo " -w, --world NAME Use existing world from worlds/ directory (creates symlink)"
246
+ echo " --modpack SLUG Modpack slug (required for MODRINTH/AUTO_CURSEFORGE)"
247
+ echo " --modpack-version VER Modpack version (optional)"
248
+ echo " --mod-loader LOADER Mod loader: fabric, forge, neoforge, quilt (optional)"
240
249
  echo " --no-start Don't start the server after creation"
241
250
  echo " --start Start the server after creation (default)"
242
251
  echo ""
@@ -249,6 +258,7 @@ show_usage() {
249
258
  echo " $0 myserver --seed 12345"
250
259
  echo " $0 myserver --world-url https://example.com/world.zip"
251
260
  echo " $0 myserver --world existing-world -v 1.21.1 --no-start"
261
+ echo " $0 myserver -t MODRINTH --modpack fabric-example --modpack-version 1.0.0"
252
262
  }
253
263
 
254
264
  # Check if first argument exists
@@ -286,6 +296,18 @@ while [[ $# -gt 0 ]]; do
286
296
  WORLD_NAME="$2"
287
297
  shift 2
288
298
  ;;
299
+ --modpack)
300
+ MODPACK_SLUG="$2"
301
+ shift 2
302
+ ;;
303
+ --modpack-version)
304
+ MODPACK_VERSION="$2"
305
+ shift 2
306
+ ;;
307
+ --mod-loader)
308
+ MOD_LOADER="$2"
309
+ shift 2
310
+ ;;
289
311
  --no-start)
290
312
  START_SERVER="false"
291
313
  shift
@@ -300,7 +322,7 @@ while [[ $# -gt 0 ]]; do
300
322
  ;;
301
323
  *)
302
324
  # For backward compatibility: if it looks like a server type, use it
303
- if [[ "$1" =~ ^(PAPER|VANILLA|FORGE|FABRIC|NEOFORGE|QUILT|SPIGOT)$ ]]; then
325
+ if [[ "$1" =~ ^(PAPER|VANILLA|FORGE|FABRIC|NEOFORGE|QUILT|SPIGOT|MODRINTH|AUTO_CURSEFORGE)$ ]]; then
304
326
  SERVER_TYPE="$1"
305
327
  shift
306
328
  else
@@ -325,6 +347,15 @@ if [ "$WORLD_OPTIONS_COUNT" -gt 1 ]; then
325
347
  exit 1
326
348
  fi
327
349
 
350
+ # Validate modpack options for MODRINTH and AUTO_CURSEFORGE types
351
+ if [[ "$SERVER_TYPE" =~ ^(MODRINTH|AUTO_CURSEFORGE)$ ]]; then
352
+ if [ -z "$MODPACK_SLUG" ]; then
353
+ echo -e "${RED}Error: --modpack SLUG is required for $SERVER_TYPE server type${NC}"
354
+ echo "Example: $0 $SERVER_NAME -t $SERVER_TYPE --modpack fabric-example"
355
+ exit 1
356
+ fi
357
+ fi
358
+
328
359
  # Validate server name (lowercase, alphanumeric, hyphens only)
329
360
  if [[ ! "$SERVER_NAME" =~ ^[a-z][a-z0-9-]*$ ]]; then
330
361
  echo -e "${RED}Error: Server name must start with a letter and contain only lowercase letters, numbers, and hyphens${NC}"
@@ -440,6 +471,35 @@ if [ -f "$CONFIG_FILE" ]; then
440
471
  sed -i "s/^LEVEL=.*/LEVEL=$WORLD_NAME/" "$CONFIG_FILE"
441
472
  fi
442
473
  fi
474
+
475
+ # Apply modpack options
476
+ if [ -n "$MODPACK_SLUG" ]; then
477
+ echo "" >> "$CONFIG_FILE"
478
+ echo "# Modpack Configuration" >> "$CONFIG_FILE"
479
+ if [[ "$SERVER_TYPE" == "MODRINTH" ]]; then
480
+ echo "MODRINTH_MODPACK=$MODPACK_SLUG" >> "$CONFIG_FILE"
481
+ echo " Modpack: $MODPACK_SLUG (Modrinth)"
482
+ if [ -n "$MODPACK_VERSION" ]; then
483
+ echo "MODRINTH_VERSION=$MODPACK_VERSION" >> "$CONFIG_FILE"
484
+ echo " Modpack version: $MODPACK_VERSION"
485
+ fi
486
+ if [ -n "$MOD_LOADER" ]; then
487
+ echo "MODRINTH_LOADER=$MOD_LOADER" >> "$CONFIG_FILE"
488
+ echo " Mod loader: $MOD_LOADER"
489
+ fi
490
+ elif [[ "$SERVER_TYPE" == "AUTO_CURSEFORGE" ]]; then
491
+ echo "CF_SLUG=$MODPACK_SLUG" >> "$CONFIG_FILE"
492
+ echo " Modpack: $MODPACK_SLUG (CurseForge)"
493
+ if [ -n "$MODPACK_VERSION" ]; then
494
+ echo "CF_VERSION=$MODPACK_VERSION" >> "$CONFIG_FILE"
495
+ echo " Modpack version: $MODPACK_VERSION"
496
+ fi
497
+ if [ -n "$MOD_LOADER" ]; then
498
+ echo "CF_LOADER=$MOD_LOADER" >> "$CONFIG_FILE"
499
+ echo " Mod loader: $MOD_LOADER"
500
+ fi
501
+ fi
502
+ fi
443
503
  fi
444
504
 
445
505
  # Create data and logs directories
@@ -52,7 +52,7 @@ COMPOSE_PROJECT_NAME=minecraft
52
52
  # BACKUP_AUTO_ON_STOP=true
53
53
 
54
54
  # =============================================================================
55
- # Admin Service Configuration (Optional)
55
+ # Management Console Configuration (Optional)
56
56
  # =============================================================================
57
57
  # Web-based management UI for Minecraft servers.
58
58
  # Start with: mcctl admin service start