@modcafe/milkbucket 1.0.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.
@@ -0,0 +1,26 @@
1
+ name: Publish to npm
2
+
3
+ on:
4
+ workflow_dispatch:
5
+
6
+ permissions:
7
+ contents: read
8
+
9
+ jobs:
10
+ publish:
11
+ runs-on: ubuntu-latest
12
+
13
+ steps:
14
+ - name: Checkout
15
+ uses: actions/checkout@v4
16
+
17
+ - name: Setup Node.js
18
+ uses: actions/setup-node@v4
19
+ with:
20
+ node-version: 22
21
+ registry-url: https://registry.npmjs.org
22
+
23
+ - name: Publish package
24
+ run: npm publish --access public
25
+ env:
26
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
package/README.md ADDED
@@ -0,0 +1,309 @@
1
+ # 🥛 milkbucket
2
+
3
+ **Milkbucket** is an internal CLI tool by **Modcafe** for tooling, debugging, and managing Minecraft mods and datapacks.
4
+
5
+ It is built with **Node.js** and **JavaScript**.
6
+
7
+ ---
8
+
9
+ # Installation
10
+
11
+ ## 1. Install Node.js and npm
12
+
13
+ Milkbucket requires **Node.js** and **npm**.
14
+
15
+ ### macOS
16
+
17
+ Using Homebrew:
18
+
19
+ ```bash
20
+ brew install node
21
+ ```
22
+
23
+ Verify the installation:
24
+
25
+ ```bash
26
+ node --version
27
+ npm --version
28
+ ```
29
+
30
+ ### Windows
31
+
32
+ Using `winget`:
33
+
34
+ ```powershell
35
+ winget install OpenJS.NodeJS
36
+ ```
37
+
38
+ Verify the installation:
39
+
40
+ ```powershell
41
+ node --version
42
+ npm --version
43
+ ```
44
+
45
+ ### Linux
46
+
47
+ On Debian/Ubuntu-based distributions:
48
+
49
+ ```bash
50
+ sudo apt update
51
+ sudo apt install nodejs npm
52
+ ```
53
+
54
+ Verify the installation:
55
+
56
+ ```bash
57
+ node --version
58
+ npm --version
59
+ ```
60
+
61
+ ---
62
+
63
+ ## 2. Clone Milkbucket
64
+
65
+ Clone the repository and enter its directory:
66
+
67
+ ```bash
68
+ git clone https://github.com/Modcafe/milkbucket.git
69
+ cd milkbucket
70
+ ```
71
+
72
+ Then link Milkbucket as a global CLI:
73
+
74
+ ```bash
75
+ npm link
76
+ ```
77
+
78
+ ### If `npm link` fails
79
+
80
+ If npm does not have permission to create the global link, configure a user-local npm directory:
81
+
82
+ ```bash
83
+ mkdir -p ~/.npm-global
84
+ npm config set prefix ~/.npm-global
85
+ echo 'export PATH="$HOME/.npm-global/bin:$PATH"' >> ~/.zshrc
86
+ source ~/.zshrc
87
+ ```
88
+
89
+ Then run:
90
+
91
+ ```bash
92
+ npm link
93
+ ```
94
+
95
+ ---
96
+
97
+ ## 3. Verify the installation
98
+
99
+ Check whether Milkbucket is available:
100
+
101
+ ```bash
102
+ milkbucket --version
103
+ ```
104
+
105
+ You can also display the available commands:
106
+
107
+ ```bash
108
+ milkbucket --help
109
+ ```
110
+
111
+ ---
112
+
113
+ # Commands
114
+
115
+ > This section documents all available Milkbucket commands.
116
+
117
+ ## `help`
118
+
119
+ Displays a list of available commands and their descriptions.
120
+
121
+ ```bash
122
+ milkbucket help
123
+ ```
124
+
125
+ Aliases:
126
+
127
+ ```bash
128
+ milkbucket -h
129
+ milkbucket --help
130
+ ```
131
+
132
+ ---
133
+
134
+ ## `version`
135
+
136
+ Displays the installed Milkbucket version.
137
+
138
+ ```bash
139
+ milkbucket version
140
+ ```
141
+
142
+ Aliases:
143
+
144
+ ```bash
145
+ milkbucket -v
146
+ milkbucket --version
147
+ ```
148
+
149
+ ---
150
+
151
+ ## `info` (comming soon)
152
+
153
+ Displays information about the current project and environment.
154
+
155
+ ```bash
156
+ milkbucket info
157
+ ```
158
+
159
+ ---
160
+
161
+ ## `project` (comming soon)
162
+
163
+ Tools for inspecting and working with the current Minecraft project.
164
+
165
+ ```bash
166
+ milkbucket project
167
+ ```
168
+
169
+ ### `project detect` (comming soon)
170
+
171
+ Detects the type and configuration of the current project.
172
+
173
+ ```bash
174
+ milkbucket project detect
175
+ ```
176
+
177
+ ### `project validate` (comming soon)
178
+
179
+ Checks the current project for common configuration problems.
180
+
181
+ ```bash
182
+ milkbucket project validate
183
+ ```
184
+
185
+ ---
186
+
187
+ ## `build` (comming soon)
188
+
189
+ Builds the current Minecraft project.
190
+
191
+ ```bash
192
+ milkbucket build
193
+ ```
194
+
195
+ ---
196
+
197
+ ## `deps` (comming soon)
198
+
199
+ Tools for inspecting project dependencies.
200
+
201
+ ```bash
202
+ milkbucket deps
203
+ ```
204
+
205
+ ### `deps list` (comming soon)
206
+
207
+ Lists the dependencies of the current project.
208
+
209
+ ```bash
210
+ milkbucket deps list
211
+ ```
212
+
213
+ ### `deps check` (comming soon)
214
+
215
+ Checks whether the project's dependencies are valid.
216
+
217
+ ```bash
218
+ milkbucket deps check
219
+ ```
220
+
221
+ ---
222
+
223
+ ## `logs` (comming soon)
224
+
225
+ Tools for working with Minecraft logs.
226
+
227
+ ```bash
228
+ milkbucket logs
229
+ ```
230
+
231
+ ### `logs latest` (comming soon)
232
+
233
+ Displays or analyzes the latest log.
234
+
235
+ ```bash
236
+ milkbucket logs latest
237
+ ```
238
+
239
+ ---
240
+
241
+ ## `crash` (comming soon)
242
+
243
+ Analyzes the latest Minecraft crash report.
244
+
245
+ ```bash
246
+ milkbucket crash
247
+ ```
248
+
249
+ ---
250
+
251
+ ## `team` (comming soon)
252
+
253
+ Tools for Modcafe development teams.
254
+
255
+ ```bash
256
+ milkbucket team
257
+ ```
258
+
259
+ ### `team doctor` (comming soon)
260
+
261
+ Checks the local development environment.
262
+
263
+ ```bash
264
+ milkbucket team doctor
265
+ ```
266
+
267
+ ---
268
+
269
+ # Updating
270
+
271
+ To update your local Milkbucket installation, pull the latest changes from GitHub:
272
+
273
+ ```bash
274
+ cd milkbucket
275
+ git pull
276
+ npm link
277
+ ```
278
+
279
+ > [!TIP]
280
+ > You only need to configure the npm prefix once. After that, updating Milkbucket only requires `git pull` and `npm link`.
281
+
282
+ ---
283
+
284
+ # Development
285
+
286
+ Milkbucket is developed using Node.js and JavaScript.
287
+
288
+ The repository is structured roughly as follows:
289
+
290
+ ```text
291
+ milkbucket/
292
+ ├── cli.js
293
+ ├── package.json
294
+ ├── commands/
295
+ │ ├── help.js
296
+ │ ├── version.js
297
+ │ └── ...
298
+ └── lib/
299
+ ├── commandInfo.json
300
+ └── ...
301
+ ```
302
+
303
+ New commands should be added to the `commands/` directory and registered in the command metadata.
304
+
305
+ ---
306
+
307
+ # License
308
+
309
+ Internal Modcafe tooling.
package/cli.js ADDED
@@ -0,0 +1,34 @@
1
+ #!/usr/bin/env node
2
+ import packageJson from "./package.json" with { type: "json" };
3
+ import metadata from "./metadata.json" with { type: "json" };
4
+
5
+ import help from "./commands/help.js";
6
+ import getVersion from "./commands/version.js";
7
+
8
+ const args = process.argv.slice(2);
9
+ const command = args.shift();
10
+
11
+ switch (command) {
12
+ case "help":
13
+ case "--help":
14
+ case "-h":
15
+ help(args);
16
+ break;
17
+
18
+ case "version":
19
+ case "--version":
20
+ case "-v":
21
+ getVersion(args);
22
+ break;
23
+
24
+
25
+ /**********************************/
26
+ case undefined:
27
+ console.log(`Welcome to ${metadata.displayName} v${packageJson.version}.
28
+ Type "${metadata.name} ${metadata.commands.help}" for more information.`);
29
+ break;
30
+
31
+ default:
32
+ console.error(`Unknown command: ${command}\nUse ${metadata.name} ${metadata.commands.help} for a list of useable commands.`);
33
+ process.exit(1);
34
+ }
@@ -0,0 +1,27 @@
1
+ {
2
+ "_TEMPLATE_FOR_COMMANDS": {
3
+ "lastUpdated": "1.0.0",
4
+ "firstAdded": "1.0.0",
5
+ "contributors": ["ContributorA", "ContributorB"],
6
+ "description": "This is a Command Description.",
7
+ "aliases": ["--template", "-t"],
8
+ "args": "[arg1|arg2] <arg3|arg4|arg5>"
9
+ },
10
+
11
+
12
+
13
+ "help": {
14
+ "lastUpdated": "1.0.0",
15
+ "firstAdded": "1.0.0",
16
+ "contributors": ["Intensed"],
17
+ "description": "Shows a list of all Commands and Options.",
18
+ "aliases": ["--help", "-h"]
19
+ },
20
+ "version": {
21
+ "lastUpdated": "1.0.0",
22
+ "firstAdded": "1.0.0",
23
+ "contributors": ["Intensed"],
24
+ "description": "Show which version of milkbucket you have installed",
25
+ "aliases": ["--version", "-v"]
26
+ }
27
+ }
@@ -0,0 +1,46 @@
1
+ import { getCommandVersionText, getCommandHelpText } from "../lib/commandInfo.js";
2
+ //import packageJson from "../package.json" with { type: "json" };
3
+ import metadata from "../metadata.json" with { type: "json" };
4
+ import commandMetadata from "../commandMetadata.json" with { type: "json" };
5
+ import optionMetadata from "../optionMetadata.json" with { type: "json" };
6
+
7
+ export default function help(args) {
8
+ switch (args[0]) {
9
+ case "-v":
10
+ case "--version":
11
+ console.log(getCommandVersionText("help"));
12
+ break;
13
+
14
+ case "-h":
15
+ case "--help":
16
+ console.log(getCommandHelpText("help"));
17
+ break;
18
+
19
+ default:
20
+ let commandsText = "";
21
+
22
+ for (const [commandName, info] of Object.entries(commandMetadata)) {
23
+ if (commandName.startsWith("_")) continue;
24
+
25
+ commandsText += ` ${commandName.padEnd(24)}${info.description}\n`
26
+ }
27
+
28
+ let optionsText = "";
29
+
30
+ for (const [optionName, info] of Object.entries(optionMetadata)) {
31
+ if (optionName.startsWith("_")) continue;
32
+ const optionNameWithAlias = `${optionName}, ${info.aliases[0]}`;
33
+ optionsText += ` ${optionNameWithAlias.padEnd(24)}${info.description}\n`
34
+ }
35
+
36
+ console.log(`
37
+ Usage: ${metadata.name} [command] <args> <options>
38
+
39
+ Commands:
40
+ ${commandsText}
41
+
42
+ Options:
43
+ ${optionsText}
44
+ `);
45
+ }
46
+ };
@@ -0,0 +1,20 @@
1
+ import { getCommandVersionText, getCommandHelpText } from "../lib/commandInfo.js";
2
+ import packageJson from "../package.json" with { type: "json" };
3
+ import metadata from "../metadata.json" with { type: "json" };
4
+
5
+ export default function help(args) {
6
+ switch (args[0]) {
7
+ case "-v":
8
+ case "--version":
9
+ console.log(getCommandVersionText("version"));
10
+ break;
11
+
12
+ case "-h":
13
+ case "--help":
14
+ console.log(getCommandHelpText("version"));
15
+ break;
16
+
17
+ default:
18
+ console.log(`v${packageJson.version}`);
19
+ }
20
+ };
@@ -0,0 +1,33 @@
1
+ import commandMetadata from "../commandMetadata.json" with { type: "json" };
2
+ import packageJson from "../package.json" with { type: "json" };
3
+ import metadata from "../metadata.json" with { type: "json" };
4
+
5
+ export function getCommandVersionText(commandName) {
6
+ const lastUpdated = commandMetadata[commandName].lastUpdated;
7
+ const firstAdded = commandMetadata[commandName].firstAdded;
8
+ const contributors = commandMetadata[commandName].contributors;
9
+
10
+ return `${metadata.name} ${commandName}
11
+
12
+ last Updated: ${lastUpdated}
13
+ first Added: ${firstAdded}
14
+ Contributors: ${contributors.join(", ")}
15
+
16
+ For more Information, use ${metadata.name} ${commandName} -h`;
17
+ }
18
+
19
+ export function getCommandHelpText(commandName) {
20
+ const description = commandMetadata[commandName].description;
21
+ const rawCommandArgs = commandMetadata[commandName].args;
22
+
23
+ let commandArgs = commandName;
24
+ if (rawCommandArgs) {
25
+ commandArgs = `${commandName} ${rawCommandArgs}`;
26
+ }
27
+
28
+ return `${metadata.name} ${commandArgs}
29
+
30
+ ${description}
31
+
32
+ For more Information, use ${metadata.name} ${commandName} -v`;
33
+ }
package/metadata.json ADDED
@@ -0,0 +1,13 @@
1
+ {
2
+ "displayName": "Milkbucket",
3
+ "name": "milkbucket",
4
+ "description": "Milkbucket is a internal CLI-Tool developed from and for Modcafe and their Members, to test, debug and tool code.",
5
+ "commands": {
6
+ "help": "--help",
7
+ "version": "--version"
8
+ },
9
+ "options": {
10
+ "help": "-h",
11
+ "version": "-v"
12
+ }
13
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "_TEMPLATE_FOR_OPTIONS": {
3
+ "description": "This is a Option Description.",
4
+ "aliases": ["--template", "-t"]
5
+ },
6
+
7
+
8
+
9
+ "-h": {
10
+ "description": "Show a list of Arguments and syntax aswell as a description.",
11
+ "aliases": ["--help"]
12
+ },
13
+ "-v": {
14
+ "description": "Show the latest and first version of a Command.",
15
+ "aliases": ["--version"]
16
+ }
17
+ }
package/package.json ADDED
@@ -0,0 +1,24 @@
1
+ {
2
+ "name": "@modcafe/milkbucket",
3
+ "version": "1.0.0",
4
+ "description": "Internal CLI tool by Modcafe for developing, testing and debugging Minecraft mods and datapacks.",
5
+ "type": "module",
6
+ "bin": {
7
+ "milkbucket": "./cli.js"
8
+ },
9
+ "publishConfig": {
10
+ "access": "public"
11
+ },
12
+ "engines": {
13
+ "node": ">=20"
14
+ },
15
+ "license": "MIT",
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "https://github.com/Modcafe/milkbucket.git"
19
+ },
20
+ "bugs": {
21
+ "url": "https://github.com/Modcafe/milkbucket/issues"
22
+ },
23
+ "homepage": "https://github.com/Modcafe/milkbucket"
24
+ }
package/template.txt ADDED
@@ -0,0 +1,24 @@
1
+ // Command Template
2
+ // Make sure to go to ../commandMetadata.json in order to let "-v/--version" and "-h/--help" work.
3
+ // You need also to add commandMetadata to the json so the command shows up in milkbucket help.
4
+
5
+ import { getCommandVersionText, getCommandHelpText } from "../lib/commandInfo.js";
6
+ import packageJson from "../package.json" with { type: "json" };
7
+ import metadata from "../metadata.json" with { type: "json" };
8
+
9
+ export default function help(args) {
10
+ switch (args[0]) {
11
+ case "-v":
12
+ case "--version":
13
+ console.log(getCommandVersionText("COMMAND_NAME_HERE"));
14
+ break;
15
+
16
+ case "-h":
17
+ case "--help":
18
+ console.log(getCommandHelpText("COMMAND_NAME_HERE"));
19
+ break;
20
+
21
+ default:
22
+ // ACTIONS HERE
23
+ }
24
+ };