@powernukkitx/cli 1.0.0 → 1.0.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.
Files changed (98) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +186 -203
  3. package/dist/cli.js +34 -46
  4. package/dist/commands/backup.d.ts +2 -2
  5. package/dist/commands/backup.js +23 -24
  6. package/dist/commands/config.d.ts +1 -1
  7. package/dist/commands/config.js +60 -61
  8. package/dist/commands/console.d.ts +2 -2
  9. package/dist/commands/console.js +98 -99
  10. package/dist/commands/doctor.d.ts +2 -2
  11. package/dist/commands/doctor.js +97 -98
  12. package/dist/commands/info.d.ts +2 -2
  13. package/dist/commands/info.js +41 -42
  14. package/dist/commands/init.d.ts +2 -2
  15. package/dist/commands/init.js +87 -66
  16. package/dist/commands/install.js +45 -0
  17. package/dist/commands/logs.d.ts +2 -2
  18. package/dist/commands/logs.js +60 -61
  19. package/dist/commands/menu.js +94 -86
  20. package/dist/commands/plugin/index.d.ts +2 -2
  21. package/dist/commands/plugin/index.js +13 -13
  22. package/dist/commands/plugin/info.d.ts +2 -2
  23. package/dist/commands/plugin/info.js +39 -40
  24. package/dist/commands/plugin/install.d.ts +2 -2
  25. package/dist/commands/plugin/install.js +56 -57
  26. package/dist/commands/plugin/installed.d.ts +2 -2
  27. package/dist/commands/plugin/installed.js +41 -42
  28. package/dist/commands/plugin/list.d.ts +2 -2
  29. package/dist/commands/plugin/list.js +47 -49
  30. package/dist/commands/plugin/remove.d.ts +2 -2
  31. package/dist/commands/plugin/remove.js +44 -45
  32. package/dist/commands/plugin/search.d.ts +2 -2
  33. package/dist/commands/plugin/search.js +11 -12
  34. package/dist/commands/plugin/update.d.ts +2 -2
  35. package/dist/commands/plugin/update.js +52 -53
  36. package/dist/commands/start.d.ts +2 -2
  37. package/dist/commands/start.js +74 -75
  38. package/dist/commands/stop.d.ts +2 -2
  39. package/dist/commands/stop.js +26 -27
  40. package/dist/commands/update.d.ts +2 -2
  41. package/dist/commands/update.js +34 -35
  42. package/dist/commands/use.d.ts +2 -2
  43. package/dist/commands/use.js +39 -40
  44. package/dist/infra/http.js +119 -121
  45. package/dist/infra/paths.js +15 -20
  46. package/dist/infra/store.js +24 -27
  47. package/dist/services/backup.js +34 -40
  48. package/dist/services/plugins.js +139 -111
  49. package/dist/services/process.js +41 -43
  50. package/dist/services/release.js +51 -38
  51. package/dist/services/server.js +81 -89
  52. package/dist/ui/output.js +67 -71
  53. package/dist/ui/prompts.js +26 -30
  54. package/dist/ui/theme.js +16 -18
  55. package/package.json +44 -46
  56. package/dist/bundle.js +0 -18
  57. package/dist/commands/cfg.d.ts +0 -2
  58. package/dist/commands/cfg.js +0 -61
  59. package/dist/commands/lang.d.ts +0 -2
  60. package/dist/commands/lang.js +0 -28
  61. package/dist/commands/plugin.d.ts +0 -1
  62. package/dist/commands/plugin.js +0 -1
  63. package/dist/core/config.d.ts +0 -13
  64. package/dist/core/config.js +0 -31
  65. package/dist/core/network.d.ts +0 -13
  66. package/dist/core/network.js +0 -139
  67. package/dist/core/output.d.ts +0 -33
  68. package/dist/core/output.js +0 -75
  69. package/dist/core/process.d.ts +0 -10
  70. package/dist/core/process.js +0 -53
  71. package/dist/i18n/en.json +0 -174
  72. package/dist/i18n/fr.json +0 -174
  73. package/dist/i18n/index.js +0 -58
  74. package/dist/index.d.ts +0 -1
  75. package/dist/index.js +0 -1
  76. package/dist/lang/en.json +0 -146
  77. package/dist/lang/fr.json +0 -146
  78. package/dist/lang/index.d.ts +0 -7
  79. package/dist/lang/index.js +0 -83
  80. package/dist/main.d.ts +0 -2
  81. package/dist/main.js +0 -28
  82. package/dist/plugins.json +0 -66
  83. package/dist/types.d.ts +0 -61
  84. package/dist/types.js +0 -1
  85. package/dist/utils/api.d.ts +0 -9
  86. package/dist/utils/api.js +0 -24
  87. package/dist/utils/github.d.ts +0 -20
  88. package/dist/utils/github.js +0 -60
  89. package/dist/utils/logger.d.ts +0 -15
  90. package/dist/utils/logger.js +0 -72
  91. package/dist/utils/pause.d.ts +0 -1
  92. package/dist/utils/pause.js +0 -6
  93. package/dist/utils/plugins.d.ts +0 -4
  94. package/dist/utils/plugins.js +0 -34
  95. package/dist/utils/server.d.ts +0 -3
  96. package/dist/utils/server.js +0 -32
  97. package/dist/utils/updater.d.ts +0 -1
  98. package/dist/utils/updater.js +0 -86
@@ -1,33 +0,0 @@
1
- import * as clack from '@clack/prompts';
2
- import chalk from 'chalk';
3
- declare const c: {
4
- primary: import("chalk").ChalkInstance;
5
- accent: import("chalk").ChalkInstance;
6
- green: import("chalk").ChalkInstance;
7
- red: import("chalk").ChalkInstance;
8
- yellow: import("chalk").ChalkInstance;
9
- blue: import("chalk").ChalkInstance;
10
- cyan: import("chalk").ChalkInstance;
11
- };
12
- export declare function isJson(): boolean;
13
- export declare function json(data: unknown): never;
14
- export declare function intro(title: string): void;
15
- export declare function outro(msg: string): void;
16
- export declare function section(title: string): void;
17
- export declare function cancel(msg?: string): never;
18
- export declare function spin(msg: string): {
19
- update: (m: string) => void;
20
- stop: (m: string) => void;
21
- fail: (m: string) => void;
22
- };
23
- export declare const log: {
24
- success: (msg: string) => void;
25
- error: (msg: string) => void;
26
- warn: (msg: string) => void;
27
- info: (msg: string) => void;
28
- step: (msg: string) => void;
29
- dim: (msg: string) => void;
30
- raw: (msg: string) => void;
31
- };
32
- export declare function progress(pct: number, label?: string): void;
33
- export { clack, chalk, c };
@@ -1,75 +0,0 @@
1
- import * as clack from '@clack/prompts';
2
- import chalk from 'chalk';
3
- const c = {
4
- primary: chalk.hex('#FF6B35'),
5
- accent: chalk.hex('#FFB347'),
6
- green: chalk.hex('#4CAF50'),
7
- red: chalk.hex('#E53935'),
8
- yellow: chalk.hex('#FFC107'),
9
- blue: chalk.hex('#6C8EBF'),
10
- cyan: chalk.hex('#4ECDC4'),
11
- };
12
- const _isJson = process.argv.includes('--json');
13
- export function isJson() { return _isJson; }
14
- export function json(data) {
15
- process.stdout.write(JSON.stringify(data, null, 2) + '\n');
16
- process.exit(0);
17
- }
18
- export function intro(title) {
19
- if (_isJson)
20
- return;
21
- clack.intro(c.primary.bold(` ${title} `));
22
- }
23
- export function outro(msg) {
24
- if (_isJson)
25
- return;
26
- clack.outro(c.accent(msg));
27
- }
28
- export function section(title) {
29
- if (_isJson)
30
- return;
31
- clack.log.step(c.accent.bold(title));
32
- }
33
- export function cancel(msg = 'Annulé') {
34
- clack.cancel(c.yellow(msg));
35
- process.exit(0);
36
- }
37
- export function spin(msg) {
38
- if (_isJson)
39
- return { update: () => { }, stop: () => { }, fail: () => { } };
40
- const s = clack.spinner();
41
- s.start(msg);
42
- return {
43
- update: (m) => s.message(m),
44
- stop: (m) => s.stop(m),
45
- fail: (m) => s.stop(m, 1),
46
- };
47
- }
48
- export const log = {
49
- success: (msg) => { if (!_isJson)
50
- clack.log.success(c.green(msg)); },
51
- error: (msg) => { if (!_isJson)
52
- clack.log.error(c.red(msg)); },
53
- warn: (msg) => { if (!_isJson)
54
- clack.log.warn(c.yellow(msg)); },
55
- info: (msg) => { if (!_isJson)
56
- clack.log.info(c.blue(msg)); },
57
- step: (msg) => { if (!_isJson)
58
- clack.log.step(chalk.dim(msg)); },
59
- dim: (msg) => { if (!_isJson)
60
- clack.log.message(chalk.dim(msg)); },
61
- raw: (msg) => { if (!_isJson)
62
- process.stdout.write(msg + '\n'); },
63
- };
64
- export function progress(pct, label) {
65
- if (_isJson)
66
- return;
67
- const clamped = Math.max(0, Math.min(100, pct));
68
- const filled = Math.floor(clamped / 5);
69
- const bar = c.cyan('━'.repeat(filled)) + chalk.dim('─'.repeat(20 - filled));
70
- const suffix = label ? ` ${chalk.dim(label)}` : '';
71
- process.stdout.write(`\r ${bar} ${chalk.bold(String(clamped))}%${suffix}`);
72
- if (clamped >= 100)
73
- process.stdout.write('\n');
74
- }
75
- export { clack, chalk, c };
@@ -1,10 +0,0 @@
1
- export interface PidInfo {
2
- pid: number;
3
- serverPath: string;
4
- startedAt: string;
5
- }
6
- export declare function savePid(pid: number, serverPath: string): Promise<void>;
7
- export declare function loadPid(): Promise<PidInfo | null>;
8
- export declare function clearPid(): Promise<void>;
9
- export declare function isProcessAlive(pid: number): boolean;
10
- export declare function killProcess(pid: number): Promise<boolean>;
@@ -1,53 +0,0 @@
1
- import { existsSync } from 'node:fs';
2
- import { readFile, writeFile, mkdir, rm } from 'node:fs/promises';
3
- import { homedir, platform } from 'node:os';
4
- import { join } from 'node:path';
5
- import { spawnSync } from 'node:child_process';
6
- const DIR = join(homedir(), '.pnx-cli');
7
- const PID_FILE = join(DIR, 'pid.json');
8
- export async function savePid(pid, serverPath) {
9
- await mkdir(DIR, { recursive: true });
10
- await writeFile(PID_FILE, JSON.stringify({ pid, serverPath, startedAt: new Date().toISOString() }), 'utf-8');
11
- }
12
- export async function loadPid() {
13
- try {
14
- if (existsSync(PID_FILE))
15
- return JSON.parse(await readFile(PID_FILE, 'utf-8'));
16
- }
17
- catch { }
18
- return null;
19
- }
20
- export async function clearPid() {
21
- try {
22
- await rm(PID_FILE);
23
- }
24
- catch { }
25
- }
26
- export function isProcessAlive(pid) {
27
- try {
28
- process.kill(pid, 0);
29
- return true;
30
- }
31
- catch {
32
- return false;
33
- }
34
- }
35
- export async function killProcess(pid) {
36
- if (!isProcessAlive(pid))
37
- return false;
38
- try {
39
- if (platform() === 'win32') {
40
- spawnSync('taskkill', ['/PID', String(pid), '/F']);
41
- }
42
- else {
43
- process.kill(pid, 'SIGTERM');
44
- await new Promise(r => setTimeout(r, 5000));
45
- if (isProcessAlive(pid))
46
- process.kill(pid, 'SIGKILL');
47
- }
48
- return true;
49
- }
50
- catch {
51
- return false;
52
- }
53
- }
package/dist/i18n/en.json DELETED
@@ -1,174 +0,0 @@
1
- {
2
- "cli": { "description": "PowerNukkitX CLI — Manage your Minecraft Bedrock servers" },
3
- "menu": {
4
- "title": "PowerNukkitX Menu",
5
- "prompt": "What do you want to do?",
6
- "create": "Create a server",
7
- "start": "Start the server",
8
- "stop": "Stop the server",
9
- "plugins": "Manage plugins",
10
- "update": "Update the core",
11
- "doctor": "Diagnostics",
12
- "backup": "Backup",
13
- "info": "Information",
14
- "lang": "Change language",
15
- "quit": "Quit",
16
- "statusRunning": "Server running (PID {0})",
17
- "statusStopped": "Server stopped",
18
- "statusNoServer": "No server detected",
19
- "bye": "See you soon!"
20
- },
21
- "init": {
22
- "title": "Create a PowerNukkitX server",
23
- "promptDir": "Server directory?",
24
- "alreadyExists": "A server already exists here",
25
- "fetchingInfo": "Fetching latest version...",
26
- "latestVersion": "Latest version",
27
- "downloading": "Downloading",
28
- "downloaded": "Downloaded ({0} MB)",
29
- "downloadingScripts": "Downloading start scripts...",
30
- "scriptsDownloaded": "Start scripts downloaded",
31
- "success": "Server ready!",
32
- "launchPrompt": "Start the server now?"
33
- },
34
- "start": {
35
- "title": "Start server",
36
- "notFound": "No server found here",
37
- "createPrompt": "Create a server now?",
38
- "checkingJava": "Checking Java...",
39
- "javaOk": "Java {0} detected",
40
- "javaNotFound": "Java 21+ required — https://adoptium.net/",
41
- "starting": "Starting...",
42
- "running": "Server running (PID {0})",
43
- "stopped": "Server stopped (code {0})",
44
- "restarting": "Restarting...",
45
- "generated": "Command generated"
46
- },
47
- "stop": {
48
- "title": "Stop server",
49
- "notRunning": "No server running",
50
- "killing": "Stopping server (PID {0})...",
51
- "done": "Server stopped",
52
- "failed": "Failed to stop"
53
- },
54
- "update": {
55
- "title": "Update PowerNukkitX",
56
- "checking": "Checking for updates...",
57
- "notFound": "No server found",
58
- "available": "New version available: {0}",
59
- "upToDate": "Already up to date ({0})",
60
- "saving": "Backing up old version...",
61
- "downloading": "Downloading...",
62
- "done": "Update complete!",
63
- "restart": "Restart the server to apply changes"
64
- },
65
- "doctor": {
66
- "title": "Server diagnostics",
67
- "checking": "Running diagnostics...",
68
- "java": "Java",
69
- "server": "Server",
70
- "system": "System",
71
- "plugins": "Plugins & Worlds",
72
- "network": "Network",
73
- "done": "Diagnostics complete",
74
- "javaMissing": "Java 21+ required",
75
- "jarMissing": "powernukkitx.jar missing",
76
- "noServer": "No server — run 'pnx init'",
77
- "portFree": "Port {0} available",
78
- "portBusy": "Port {0} busy"
79
- },
80
- "info": {
81
- "title": "Server info",
82
- "server": "Server",
83
- "system": "System",
84
- "status": "Status",
85
- "installed": "Installed",
86
- "notInstalled": "Not installed",
87
- "path": "Path",
88
- "plugins": "Plugins",
89
- "worlds": "Worlds",
90
- "ram": "Free RAM",
91
- "ready": "Ready to start with 'pnx start'",
92
- "notReady": "Run 'pnx init' to create a server"
93
- },
94
- "backup": {
95
- "title": "Backup",
96
- "noServer": "No server detected",
97
- "collecting": "Collecting files...",
98
- "size": "Estimated size: {0}",
99
- "copying": "Copying files...",
100
- "done": "Backup created: {0} ({1})"
101
- },
102
- "config": {
103
- "title": "Configuration",
104
- "noServer": "No server detected",
105
- "notFound": "No config file found",
106
- "editHint": "Edit {0} to change these values"
107
- },
108
- "use": {
109
- "title": "Default server",
110
- "prompt": "Select a server:",
111
- "pathPrompt": "Server path:",
112
- "set": "Default server set: {0}",
113
- "cleared": "Default server cleared",
114
- "notFound": "powernukkitx.jar not found in: {0}"
115
- },
116
- "lang": {
117
- "title": "Language",
118
- "prompt": "Choose your language",
119
- "set": "Language set to {0}"
120
- },
121
- "logs": {
122
- "title": "Server logs",
123
- "noServer": "No server detected",
124
- "noLogs": "No log files found",
125
- "watching": "Reading {0}",
126
- "liveMode": "Live mode (Ctrl+C to quit)"
127
- },
128
- "console": {
129
- "title": "Server console",
130
- "noServer": "No server detected",
131
- "rconDisabled": "RCON disabled in server.properties",
132
- "rconEnable": "Enable enable-rcon=true in server.properties",
133
- "connecting": "Connecting via RCON...",
134
- "connected": "Connected — type commands (exit to quit)",
135
- "prompt": "> ",
136
- "disconnected": "Disconnected"
137
- },
138
- "plugin": {
139
- "titleList": "Plugin catalog",
140
- "titleInstall": "Install plugins",
141
- "titleInstalled": "Installed plugins",
142
- "titleRemove": "Remove plugins",
143
- "titleInfo": "Plugin info",
144
- "titleSearch": "Search plugins",
145
- "titleUpdate": "Update plugins",
146
- "fetching": "Fetching from marketplace...",
147
- "fetchError": "Error: {0}",
148
- "notFound": "Plugin not found: {0}",
149
- "noPlugins": "No plugins installed",
150
- "noPluginsDir": "No plugins/ directory",
151
- "noneSelected": "No plugin selected",
152
- "selectInstall": "Select plugins to install:",
153
- "selectRemove": "Select plugins to remove:",
154
- "selectUpdate": "Select plugins to update:",
155
- "searchPrompt": "Search plugins:",
156
- "slugPrompt": "Plugin slug:",
157
- "installSuccess": "{0} installed",
158
- "installError": "Error installing {0}",
159
- "removeConfirm": "Remove {0}?",
160
- "removed": "{0} removed",
161
- "alreadyLatest": "{0} is already up to date (v{1})",
162
- "updated": "{0} updated to v{1}",
163
- "noRelease": "No release available for {0}",
164
- "noFile": "No file for {0}",
165
- "urlInvalid": "URL must point to a .jar file",
166
- "restartHint": "Restart the server to load plugins",
167
- "count": "{0} plugin(s)",
168
- "versionsAvailable": "Available versions:"
169
- },
170
- "errors": {
171
- "timeout": "Request timed out",
172
- "network": "Network error: {0}"
173
- }
174
- }
package/dist/i18n/fr.json DELETED
@@ -1,174 +0,0 @@
1
- {
2
- "cli": { "description": "PowerNukkitX CLI — Gérez vos serveurs Minecraft Bedrock" },
3
- "menu": {
4
- "title": "Menu PowerNukkitX",
5
- "prompt": "Que voulez-vous faire ?",
6
- "create": "Créer un serveur",
7
- "start": "Démarrer le serveur",
8
- "stop": "Arrêter le serveur",
9
- "plugins": "Gérer les plugins",
10
- "update": "Mettre à jour le core",
11
- "doctor": "Diagnostic",
12
- "backup": "Sauvegarde",
13
- "info": "Informations",
14
- "lang": "Changer la langue",
15
- "quit": "Quitter",
16
- "statusRunning": "Serveur en cours (PID {0})",
17
- "statusStopped": "Serveur arrêté",
18
- "statusNoServer": "Aucun serveur détecté",
19
- "bye": "À bientôt !"
20
- },
21
- "init": {
22
- "title": "Créer un serveur PowerNukkitX",
23
- "promptDir": "Répertoire du serveur ?",
24
- "alreadyExists": "Un serveur existe déjà ici",
25
- "fetchingInfo": "Récupération de la dernière version...",
26
- "latestVersion": "Dernière version",
27
- "downloading": "Téléchargement",
28
- "downloaded": "Téléchargé ({0} Mo)",
29
- "downloadingScripts": "Téléchargement des scripts...",
30
- "scriptsDownloaded": "Scripts téléchargés",
31
- "success": "Serveur prêt !",
32
- "launchPrompt": "Démarrer le serveur maintenant ?"
33
- },
34
- "start": {
35
- "title": "Démarrage du serveur",
36
- "notFound": "Aucun serveur trouvé ici",
37
- "createPrompt": "Créer un serveur maintenant ?",
38
- "checkingJava": "Vérification de Java...",
39
- "javaOk": "Java {0} détecté",
40
- "javaNotFound": "Java 21+ requis — https://adoptium.net/",
41
- "starting": "Démarrage...",
42
- "running": "Serveur en cours d'exécution (PID {0})",
43
- "stopped": "Serveur arrêté (code {0})",
44
- "restarting": "Redémarrage...",
45
- "generated": "Commande générée"
46
- },
47
- "stop": {
48
- "title": "Arrêt du serveur",
49
- "notRunning": "Aucun serveur en cours d'exécution",
50
- "killing": "Arrêt du serveur (PID {0})...",
51
- "done": "Serveur arrêté",
52
- "failed": "Échec de l'arrêt"
53
- },
54
- "update": {
55
- "title": "Mise à jour PowerNukkitX",
56
- "checking": "Vérification des mises à jour...",
57
- "notFound": "Aucun serveur trouvé",
58
- "available": "Nouvelle version disponible : {0}",
59
- "upToDate": "Déjà à jour ({0})",
60
- "saving": "Sauvegarde de l'ancienne version...",
61
- "downloading": "Téléchargement...",
62
- "done": "Mise à jour terminée !",
63
- "restart": "Redémarrez le serveur pour appliquer les changements"
64
- },
65
- "doctor": {
66
- "title": "Diagnostic du serveur",
67
- "checking": "Analyse en cours...",
68
- "java": "Java",
69
- "server": "Serveur",
70
- "system": "Système",
71
- "plugins": "Plugins & Mondes",
72
- "network": "Réseau",
73
- "done": "Diagnostic terminé",
74
- "javaMissing": "Java 21+ requis",
75
- "jarMissing": "powernukkitx.jar manquant",
76
- "noServer": "Aucun serveur — exécutez 'pnx init'",
77
- "portFree": "Port {0} disponible",
78
- "portBusy": "Port {0} occupé"
79
- },
80
- "info": {
81
- "title": "Informations du serveur",
82
- "server": "Serveur",
83
- "system": "Système",
84
- "status": "Statut",
85
- "installed": "Installé",
86
- "notInstalled": "Non installé",
87
- "path": "Chemin",
88
- "plugins": "Plugins",
89
- "worlds": "Mondes",
90
- "ram": "RAM libre",
91
- "ready": "Prêt à démarrer avec 'pnx start'",
92
- "notReady": "Exécutez 'pnx init' pour créer un serveur"
93
- },
94
- "backup": {
95
- "title": "Sauvegarde",
96
- "noServer": "Aucun serveur détecté",
97
- "collecting": "Collecte des fichiers...",
98
- "size": "Taille estimée : {0}",
99
- "copying": "Copie en cours...",
100
- "done": "Sauvegarde créée : {0} ({1})"
101
- },
102
- "config": {
103
- "title": "Configuration",
104
- "noServer": "Aucun serveur détecté",
105
- "notFound": "Aucun fichier de config trouvé",
106
- "editHint": "Modifiez {0} pour changer ces valeurs"
107
- },
108
- "use": {
109
- "title": "Serveur par défaut",
110
- "prompt": "Sélectionnez un serveur :",
111
- "pathPrompt": "Chemin du serveur :",
112
- "set": "Serveur par défaut défini : {0}",
113
- "cleared": "Serveur par défaut supprimé",
114
- "notFound": "powernukkitx.jar introuvable dans : {0}"
115
- },
116
- "lang": {
117
- "title": "Langue",
118
- "prompt": "Choisissez votre langue",
119
- "set": "Langue définie sur {0}"
120
- },
121
- "logs": {
122
- "title": "Logs du serveur",
123
- "noServer": "Aucun serveur détecté",
124
- "noLogs": "Aucun fichier de logs trouvé",
125
- "watching": "Lecture de {0}",
126
- "liveMode": "Mode live (Ctrl+C pour quitter)"
127
- },
128
- "console": {
129
- "title": "Console du serveur",
130
- "noServer": "Aucun serveur détecté",
131
- "rconDisabled": "RCON désactivé dans server.properties",
132
- "rconEnable": "Activez enable-rcon=true dans server.properties",
133
- "connecting": "Connexion RCON...",
134
- "connected": "Connecté — tapez des commandes (exit pour quitter)",
135
- "prompt": "> ",
136
- "disconnected": "Déconnecté"
137
- },
138
- "plugin": {
139
- "titleList": "Catalogue de plugins",
140
- "titleInstall": "Installation de plugins",
141
- "titleInstalled": "Plugins installés",
142
- "titleRemove": "Suppression de plugins",
143
- "titleInfo": "Informations du plugin",
144
- "titleSearch": "Recherche de plugins",
145
- "titleUpdate": "Mise à jour des plugins",
146
- "fetching": "Récupération depuis la marketplace...",
147
- "fetchError": "Erreur : {0}",
148
- "notFound": "Plugin introuvable : {0}",
149
- "noPlugins": "Aucun plugin installé",
150
- "noPluginsDir": "Aucun répertoire plugins/",
151
- "noneSelected": "Aucun plugin sélectionné",
152
- "selectInstall": "Sélectionnez les plugins à installer :",
153
- "selectRemove": "Sélectionnez les plugins à supprimer :",
154
- "selectUpdate": "Sélectionnez les plugins à mettre à jour :",
155
- "searchPrompt": "Rechercher des plugins :",
156
- "slugPrompt": "Slug du plugin :",
157
- "installSuccess": "{0} installé",
158
- "installError": "Erreur lors de l'installation de {0}",
159
- "removeConfirm": "Supprimer {0} ?",
160
- "removed": "{0} supprimé",
161
- "alreadyLatest": "{0} est déjà à jour (v{1})",
162
- "updated": "{0} mis à jour vers v{1}",
163
- "noRelease": "Aucune version disponible pour {0}",
164
- "noFile": "Aucun fichier pour {0}",
165
- "urlInvalid": "L'URL doit pointer vers un .jar",
166
- "restartHint": "Redémarrez le serveur pour charger les plugins",
167
- "count": "{0} plugin(s)",
168
- "versionsAvailable": "Versions disponibles :"
169
- },
170
- "errors": {
171
- "timeout": "Délai dépassé",
172
- "network": "Erreur réseau : {0}"
173
- }
174
- }
@@ -1,58 +0,0 @@
1
- import { readFileSync, existsSync } from 'node:fs';
2
- import { storePath } from '../infra/paths.js';
3
- import en from './en.json' with { type: 'json' };
4
- import fr from './fr.json' with { type: 'json' };
5
- const tables = { en, fr };
6
- let _code = 'fr';
7
- let _strings = fr;
8
- /** Langue sauvegardée dans le store (config.json), sinon null. */
9
- function savedLang() {
10
- try {
11
- const file = storePath('config.json');
12
- if (existsSync(file)) {
13
- const cfg = JSON.parse(readFileSync(file, 'utf-8'));
14
- if (cfg.lang === 'en' || cfg.lang === 'fr')
15
- return cfg.lang;
16
- }
17
- }
18
- catch { /* ignore */ }
19
- return null;
20
- }
21
- function envLang() {
22
- const l = process.env.PNX_LANG || process.env.LANG || '';
23
- if (l.startsWith('fr'))
24
- return 'fr';
25
- if (l.startsWith('en'))
26
- return 'en';
27
- return null;
28
- }
29
- /** Applique une langue en mémoire. */
30
- export function setLang(code) {
31
- _code = tables[code] ? code : 'fr';
32
- _strings = tables[_code];
33
- }
34
- /** Résout la langue: flag explicite > store > env > défaut fr. */
35
- export function initLang(explicit) {
36
- const code = (explicit === 'en' || explicit === 'fr' ? explicit : null) ?? savedLang() ?? envLang() ?? 'fr';
37
- setLang(code);
38
- return _code;
39
- }
40
- export function currentLang() { return _code; }
41
- /** Traduit une clé pointée, interpole {0} {1}…, fallback anglais puis clé. */
42
- export function t(key, ...args) {
43
- const resolve = (table) => {
44
- let v = table;
45
- for (const k of key.split('.')) {
46
- if (v && typeof v === 'object' && k in v) {
47
- v = v[k];
48
- }
49
- else
50
- return undefined;
51
- }
52
- return typeof v === 'string' ? v : undefined;
53
- };
54
- const str = resolve(_strings) ?? resolve(tables.en);
55
- if (str === undefined)
56
- return key;
57
- return str.replace(/{(\d+)}/g, (_, i) => String(args[parseInt(i)] ?? `{${i}}`));
58
- }
package/dist/index.d.ts DELETED
@@ -1 +0,0 @@
1
- export {};
package/dist/index.js DELETED
@@ -1 +0,0 @@
1
- export {};