@powernukkitx/cli 1.0.0 → 1.0.1
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/LICENSE +21 -0
- package/README.md +186 -203
- package/dist/cli.js +34 -46
- package/dist/commands/backup.d.ts +2 -2
- package/dist/commands/backup.js +23 -24
- package/dist/commands/config.d.ts +1 -1
- package/dist/commands/config.js +60 -61
- package/dist/commands/console.d.ts +2 -2
- package/dist/commands/console.js +98 -99
- package/dist/commands/doctor.d.ts +2 -2
- package/dist/commands/doctor.js +97 -98
- package/dist/commands/info.d.ts +2 -2
- package/dist/commands/info.js +41 -42
- package/dist/commands/init.d.ts +2 -2
- package/dist/commands/init.js +87 -66
- package/dist/commands/install.js +45 -0
- package/dist/commands/logs.d.ts +2 -2
- package/dist/commands/logs.js +60 -61
- package/dist/commands/menu.js +94 -86
- package/dist/commands/plugin/index.d.ts +2 -2
- package/dist/commands/plugin/index.js +13 -13
- package/dist/commands/plugin/info.d.ts +2 -2
- package/dist/commands/plugin/info.js +39 -40
- package/dist/commands/plugin/install.d.ts +2 -2
- package/dist/commands/plugin/install.js +56 -57
- package/dist/commands/plugin/installed.d.ts +2 -2
- package/dist/commands/plugin/installed.js +41 -42
- package/dist/commands/plugin/list.d.ts +2 -2
- package/dist/commands/plugin/list.js +47 -49
- package/dist/commands/plugin/remove.d.ts +2 -2
- package/dist/commands/plugin/remove.js +44 -45
- package/dist/commands/plugin/search.d.ts +2 -2
- package/dist/commands/plugin/search.js +11 -12
- package/dist/commands/plugin/update.d.ts +2 -2
- package/dist/commands/plugin/update.js +52 -53
- package/dist/commands/start.d.ts +2 -2
- package/dist/commands/start.js +74 -75
- package/dist/commands/stop.d.ts +2 -2
- package/dist/commands/stop.js +26 -27
- package/dist/commands/update.d.ts +2 -2
- package/dist/commands/update.js +34 -35
- package/dist/commands/use.d.ts +2 -2
- package/dist/commands/use.js +39 -40
- package/dist/infra/http.js +119 -121
- package/dist/infra/paths.js +15 -20
- package/dist/infra/store.js +24 -27
- package/dist/services/backup.js +34 -40
- package/dist/services/plugins.js +139 -111
- package/dist/services/process.js +41 -43
- package/dist/services/release.js +51 -38
- package/dist/services/server.js +81 -89
- package/dist/ui/output.js +67 -71
- package/dist/ui/prompts.js +26 -30
- package/dist/ui/theme.js +16 -18
- package/package.json +44 -46
- package/dist/bundle.js +0 -18
- package/dist/commands/cfg.d.ts +0 -2
- package/dist/commands/cfg.js +0 -61
- package/dist/commands/lang.d.ts +0 -2
- package/dist/commands/lang.js +0 -28
- package/dist/commands/plugin.d.ts +0 -1
- package/dist/commands/plugin.js +0 -1
- package/dist/core/config.d.ts +0 -13
- package/dist/core/config.js +0 -31
- package/dist/core/network.d.ts +0 -13
- package/dist/core/network.js +0 -139
- package/dist/core/output.d.ts +0 -33
- package/dist/core/output.js +0 -75
- package/dist/core/process.d.ts +0 -10
- package/dist/core/process.js +0 -53
- package/dist/i18n/en.json +0 -174
- package/dist/i18n/fr.json +0 -174
- package/dist/i18n/index.js +0 -58
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/lang/en.json +0 -146
- package/dist/lang/fr.json +0 -146
- package/dist/lang/index.d.ts +0 -7
- package/dist/lang/index.js +0 -83
- package/dist/main.d.ts +0 -2
- package/dist/main.js +0 -28
- package/dist/plugins.json +0 -66
- package/dist/types.d.ts +0 -61
- package/dist/types.js +0 -1
- package/dist/utils/api.d.ts +0 -9
- package/dist/utils/api.js +0 -24
- package/dist/utils/github.d.ts +0 -20
- package/dist/utils/github.js +0 -60
- package/dist/utils/logger.d.ts +0 -15
- package/dist/utils/logger.js +0 -72
- package/dist/utils/pause.d.ts +0 -1
- package/dist/utils/pause.js +0 -6
- package/dist/utils/plugins.d.ts +0 -4
- package/dist/utils/plugins.js +0 -34
- package/dist/utils/server.d.ts +0 -3
- package/dist/utils/server.js +0 -32
- package/dist/utils/updater.d.ts +0 -1
- package/dist/utils/updater.js +0 -86
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 AzaleeX
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,203 +1,186 @@
|
|
|
1
|
-
# pnx-cli
|
|
2
|
-
|
|
3
|
-
**PowerNukkitX CLI**
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
##
|
|
8
|
-
|
|
9
|
-
- [Installation](#installation)
|
|
10
|
-
- [
|
|
11
|
-
- [
|
|
12
|
-
- [
|
|
13
|
-
- [
|
|
14
|
-
- [
|
|
15
|
-
- [Architecture](#architecture)
|
|
16
|
-
- [
|
|
17
|
-
- [
|
|
18
|
-
- [
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
#
|
|
40
|
-
pnx
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
pnx
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
|
75
|
-
|
|
76
|
-
| `--
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
pnx plugin
|
|
108
|
-
pnx plugin
|
|
109
|
-
pnx plugin
|
|
110
|
-
pnx plugin
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
pnx
|
|
122
|
-
pnx
|
|
123
|
-
pnx
|
|
124
|
-
pnx
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
Le projet génère un binaire natif via **[Node Single Executable Applications](https://nodejs.org/api/single-executable-applications.html)** (bundling esbuild + injection `postject`) :
|
|
189
|
-
|
|
190
|
-
```bash
|
|
191
|
-
npm run build:sea
|
|
192
|
-
```
|
|
193
|
-
|
|
194
|
-
Produit `pnx` (ou `pnx.exe` sous Windows) pour **la plateforme hôte**. SEA ne cross-compile pas : lancez la commande sur chaque système cible (Windows / Linux / macOS) pour obtenir son binaire.
|
|
195
|
-
|
|
196
|
-
## Liens utiles
|
|
197
|
-
|
|
198
|
-
- Documentation PowerNukkitX : https://docs.powernukkitx.org
|
|
199
|
-
- Dépôt PowerNukkitX : https://github.com/PowerNukkitX/PowerNukkitX
|
|
200
|
-
|
|
201
|
-
## Licence
|
|
202
|
-
|
|
203
|
-
MIT
|
|
1
|
+
# pnx-cli
|
|
2
|
+
|
|
3
|
+
**PowerNukkitX CLI** - command line tool to manage a **Minecraft Bedrock** server powered by [PowerNukkitX](https://github.com/PowerNukkitX/PowerNukkitX).
|
|
4
|
+
|
|
5
|
+
Create, start, update and diagnose your server, manage plugins from the marketplace, all with a clean interface and an interactive menu.
|
|
6
|
+
|
|
7
|
+
## Contents
|
|
8
|
+
|
|
9
|
+
- [Installation](#installation)
|
|
10
|
+
- [Requirements](#requirements)
|
|
11
|
+
- [Quick start](#quick-start)
|
|
12
|
+
- [Commands](#commands)
|
|
13
|
+
- [Interactive mode](#interactive-mode)
|
|
14
|
+
- [Global options](#global-options)
|
|
15
|
+
- [Architecture](#architecture)
|
|
16
|
+
- [Development](#development)
|
|
17
|
+
- [Links](#links)
|
|
18
|
+
- [License](#license)
|
|
19
|
+
|
|
20
|
+
## Installation
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npm install -g @powernukkitx/cli
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
The `pnx` command becomes available.
|
|
27
|
+
|
|
28
|
+
## Requirements
|
|
29
|
+
|
|
30
|
+
- **Node.js 20.12+**
|
|
31
|
+
- **Java 21+** to run the server ([Adoptium Temurin](https://adoptium.net/) recommended)
|
|
32
|
+
|
|
33
|
+
## Quick start
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
# Contextual interactive menu
|
|
37
|
+
pnx
|
|
38
|
+
|
|
39
|
+
# Create a server then start it
|
|
40
|
+
pnx init --dir ./pnx-server
|
|
41
|
+
pnx start --memory 4G
|
|
42
|
+
|
|
43
|
+
# Help
|
|
44
|
+
pnx --help
|
|
45
|
+
pnx <command> --help
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Commands
|
|
49
|
+
|
|
50
|
+
### `init` - create a server
|
|
51
|
+
|
|
52
|
+
Downloads the latest `powernukkitx.jar` and the start scripts.
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
pnx init --dir ./pnx-server
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
| Option | Description |
|
|
59
|
+
|---|---|
|
|
60
|
+
| `--dir <path>` | Target directory (prompted otherwise) |
|
|
61
|
+
| `--dev` | Development build |
|
|
62
|
+
|
|
63
|
+
### `start` - start the server
|
|
64
|
+
|
|
65
|
+
Checks Java, builds optimized JVM arguments (generational ZGC, UTF-8) and launches the server.
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
pnx start --memory 4G --restart
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
| Option | Description |
|
|
72
|
+
|---|---|
|
|
73
|
+
| `--dir <path>` | Server directory |
|
|
74
|
+
| `--memory <size>` | Allocated memory, e.g. `2G`, `4G` (default `2G`) |
|
|
75
|
+
| `--restart` | Auto restart on crash |
|
|
76
|
+
| `--dry-run` | Print the command without running it |
|
|
77
|
+
|
|
78
|
+
### `stop` - stop the server
|
|
79
|
+
|
|
80
|
+
Stops the server started through its stored PID.
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
pnx stop
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### `update` - update the core
|
|
87
|
+
|
|
88
|
+
Backs up the old jar as `.old` then downloads the latest version.
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
pnx update --force
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
| Option | Description |
|
|
95
|
+
|---|---|
|
|
96
|
+
| `--force` | Force re-download (ignore cache) |
|
|
97
|
+
| `--dev` | Development build |
|
|
98
|
+
|
|
99
|
+
### `plugin` - manage plugins
|
|
100
|
+
|
|
101
|
+
Official marketplace plus local tracking of installed versions.
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
pnx plugin list # catalog
|
|
105
|
+
pnx plugin search essentials # search
|
|
106
|
+
pnx plugin info <slug> # details
|
|
107
|
+
pnx plugin install <slug|url.jar> # install (marketplace or .jar URL)
|
|
108
|
+
pnx plugin installed # local plugins
|
|
109
|
+
pnx plugin update [slug] # update
|
|
110
|
+
pnx plugin remove [name] # remove
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Without an argument, `install`, `update` and `remove` offer an interactive selection.
|
|
114
|
+
|
|
115
|
+
### Diagnostics and utilities
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
pnx doctor # Java, RAM, disk, port 19132, plugins/worlds
|
|
119
|
+
pnx info # status, path, plugins, worlds, RAM
|
|
120
|
+
pnx backup # timestamped server backup
|
|
121
|
+
pnx config # print pnx.yml / server.properties (colored)
|
|
122
|
+
pnx use ./server # set the default server
|
|
123
|
+
pnx logs # latest logs (with live follow)
|
|
124
|
+
pnx console # RCON console attached to the server
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
`doctor` and `info` accept `--json` for machine output.
|
|
128
|
+
|
|
129
|
+
## Interactive mode
|
|
130
|
+
|
|
131
|
+
Launched without a subcommand, `pnx` opens a **contextual menu** that:
|
|
132
|
+
|
|
133
|
+
- detects state (server present, running, PID);
|
|
134
|
+
- only offers relevant actions (create if missing, start if stopped, stop if running...);
|
|
135
|
+
- routes to the existing commands.
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
pnx
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## Global options
|
|
142
|
+
|
|
143
|
+
| Option | Description |
|
|
144
|
+
|---|---|
|
|
145
|
+
| `--json` | Machine JSON output (disables decorative rendering) |
|
|
146
|
+
| `--no-color` | Disable colors |
|
|
147
|
+
|
|
148
|
+
CLI state is stored in `~/.pnx-cli/` (config, PID, installed plugins, version cache). Environment variables: `PNX_API_URL` (marketplace API base), `PNX_HOME` (state directory).
|
|
149
|
+
|
|
150
|
+
## Architecture
|
|
151
|
+
|
|
152
|
+
The code follows a layered architecture - thin commands, isolated business logic:
|
|
153
|
+
|
|
154
|
+
```
|
|
155
|
+
dist/
|
|
156
|
+
cli.js entry point (citty) + global options
|
|
157
|
+
commands/ parse arguments -> call service -> render
|
|
158
|
+
plugin/ plugin subcommands
|
|
159
|
+
services/ pure business logic (release, server, process, plugins, backup)
|
|
160
|
+
infra/ http, JSON store (~/.pnx-cli), constants/endpoints
|
|
161
|
+
ui/ single output system (clack + chalk), prompts
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
Rules: commands do no direct network/file access (everything goes through `services`/`infra`); services render nothing (they return data).
|
|
165
|
+
|
|
166
|
+
**Stack**: [citty](https://github.com/unjs/citty) (routing), [@clack/prompts](https://github.com/bombshell-dev/clack) (prompts), [chalk](https://github.com/chalk/chalk) (colors).
|
|
167
|
+
|
|
168
|
+
## Development
|
|
169
|
+
|
|
170
|
+
The shipped code lives in `dist/` (plain ES modules, no build step).
|
|
171
|
+
|
|
172
|
+
```bash
|
|
173
|
+
npm install # dependencies
|
|
174
|
+
npm start # run dist/cli.js
|
|
175
|
+
npm run check # syntax check every file
|
|
176
|
+
npm run smoke # run pnx --help
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
## Links
|
|
180
|
+
|
|
181
|
+
- PowerNukkitX documentation: https://docs.powernukkitx.org
|
|
182
|
+
- PowerNukkitX repository: https://github.com/PowerNukkitX/PowerNukkitX
|
|
183
|
+
|
|
184
|
+
## License
|
|
185
|
+
|
|
186
|
+
MIT
|
package/dist/cli.js
CHANGED
|
@@ -1,46 +1,34 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { defineCommand, runMain } from 'citty';
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
console: () => import('./commands/console.js').then(m => m.consoleCmd),
|
|
36
|
-
plugin: () => import('./commands/plugin/index.js').then(m => m.pluginCmd),
|
|
37
|
-
},
|
|
38
|
-
async run({ args }) {
|
|
39
|
-
// Aucune sous-commande → menu interactif.
|
|
40
|
-
if (args._.length === 0) {
|
|
41
|
-
const { runMenu } = await import('./commands/menu.js');
|
|
42
|
-
await runMenu();
|
|
43
|
-
}
|
|
44
|
-
},
|
|
45
|
-
});
|
|
46
|
-
runMain(main);
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { defineCommand, runMain } from 'citty';
|
|
3
|
+
import { setColorEnabled } from './ui/theme.js';
|
|
4
|
+
if (process.argv.slice(2).includes('--no-color'))
|
|
5
|
+
setColorEnabled(false);
|
|
6
|
+
const main = defineCommand({
|
|
7
|
+
meta: {
|
|
8
|
+
name: 'pnx',
|
|
9
|
+
version: '1.0.0',
|
|
10
|
+
description: 'PowerNukkitX CLI — Manage your Minecraft Bedrock servers',
|
|
11
|
+
},
|
|
12
|
+
subCommands: {
|
|
13
|
+
init: () => import('./commands/init.js').then(m => m.initCmd),
|
|
14
|
+
install: () => import('./commands/install.js').then(m => m.installCmd),
|
|
15
|
+
start: () => import('./commands/start.js').then(m => m.startCmd),
|
|
16
|
+
stop: () => import('./commands/stop.js').then(m => m.stopCmd),
|
|
17
|
+
update: () => import('./commands/update.js').then(m => m.updateCmd),
|
|
18
|
+
info: () => import('./commands/info.js').then(m => m.infoCmd),
|
|
19
|
+
doctor: () => import('./commands/doctor.js').then(m => m.doctorCmd),
|
|
20
|
+
backup: () => import('./commands/backup.js').then(m => m.backupCmd),
|
|
21
|
+
config: () => import('./commands/config.js').then(m => m.configCmd),
|
|
22
|
+
use: () => import('./commands/use.js').then(m => m.useCmd),
|
|
23
|
+
logs: () => import('./commands/logs.js').then(m => m.logsCmd),
|
|
24
|
+
console: () => import('./commands/console.js').then(m => m.consoleCmd),
|
|
25
|
+
plugin: () => import('./commands/plugin/index.js').then(m => m.pluginCmd),
|
|
26
|
+
},
|
|
27
|
+
async run({ args }) {
|
|
28
|
+
if (args._.length === 0) {
|
|
29
|
+
const { runMenu } = await import('./commands/menu.js');
|
|
30
|
+
await runMenu();
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
runMain(main);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { CommandDef } from 'citty';
|
|
2
|
-
export declare const backupCmd: CommandDef;
|
|
1
|
+
import type { CommandDef } from 'citty';
|
|
2
|
+
export declare const backupCmd: CommandDef;
|
package/dist/commands/backup.js
CHANGED
|
@@ -1,24 +1,23 @@
|
|
|
1
|
-
import { defineCommand } from 'citty';
|
|
2
|
-
import { intro, outro, log, spin } from '../ui/output.js';
|
|
3
|
-
import { resolveServerDir } from '../services/server.js';
|
|
4
|
-
import { createBackup, dirSize, fmtSize } from '../services/backup.js';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
});
|
|
1
|
+
import { defineCommand } from 'citty';
|
|
2
|
+
import { intro, outro, log, spin } from '../ui/output.js';
|
|
3
|
+
import { resolveServerDir } from '../services/server.js';
|
|
4
|
+
import { createBackup, dirSize, fmtSize } from '../services/backup.js';
|
|
5
|
+
export async function runBackup() {
|
|
6
|
+
intro(`💾 ${"Backup"}`);
|
|
7
|
+
const serverPath = await resolveServerDir();
|
|
8
|
+
if (!serverPath) {
|
|
9
|
+
log.error("No server detected");
|
|
10
|
+
process.exit(1);
|
|
11
|
+
}
|
|
12
|
+
const sp = spin("Collecting files...");
|
|
13
|
+
sp.stop(`Estimated size: ${fmtSize(dirSize(serverPath))}`);
|
|
14
|
+
const sp2 = spin("Copying files...");
|
|
15
|
+
const { path, size } = await createBackup(serverPath);
|
|
16
|
+
sp2.stop(`Backup created: ${path} (${fmtSize(size)})`);
|
|
17
|
+
outro(`Backup created: ${path} (${fmtSize(size)})`);
|
|
18
|
+
}
|
|
19
|
+
export const backupCmd = defineCommand({
|
|
20
|
+
meta: { description: 'Create a server backup' },
|
|
21
|
+
args: {},
|
|
22
|
+
run: () => runBackup(),
|
|
23
|
+
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function configCmd(): Promise<void>;
|
|
1
|
+
export declare function configCmd(): Promise<void>;
|