scriptmc 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.
- package/LICENSE +21 -0
- package/README.md +22 -0
- package/dist/cli-list.js +29 -0
- package/dist/commands/build-addon.js +38 -0
- package/dist/commands/delete-addon.js +35 -0
- package/dist/commands/help.js +15 -0
- package/dist/commands/new-addon.js +110 -0
- package/dist/commands/path-config.js +17 -0
- package/dist/main.js +74 -0
- package/dist/message-error.js +66 -0
- package/dist/validArgs.js +26 -0
- package/package.json +34 -0
package/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2025 Athumjs
|
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
|
13
|
+
all 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
|
21
|
+
THE SOFTWARE.
|
package/README.md
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
# SCRIPTMC
|
2
|
+
|
3
|
+
A CLI tool that simplifies the creation and build process of Minecraft Bedrock addons — made for addon creators who want speed, structure, and simplicity.
|
4
|
+
|
5
|
+

|
6
|
+
|
7
|
+
---
|
8
|
+
|
9
|
+
## 🚀 Features
|
10
|
+
|
11
|
+
- 📁 Quickly scaffold a structured addon project
|
12
|
+
- 🛠 Auto-generate `manifest.json` and folders
|
13
|
+
- 📦 Build and bundle your addon for Bedrock Edition
|
14
|
+
- 🎮 Compatible with Minecraft Preview & official releases
|
15
|
+
|
16
|
+
---
|
17
|
+
|
18
|
+
## 📦 Installation
|
19
|
+
|
20
|
+
```bash
|
21
|
+
npm install -g scriptmc
|
22
|
+
```
|
package/dist/cli-list.js
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.list = void 0;
|
4
|
+
exports.list = [
|
5
|
+
{
|
6
|
+
name: "--help",
|
7
|
+
flag: "-h",
|
8
|
+
},
|
9
|
+
{
|
10
|
+
name: "--version",
|
11
|
+
flag: "-v",
|
12
|
+
},
|
13
|
+
{
|
14
|
+
name: "--new",
|
15
|
+
flag: "-n",
|
16
|
+
},
|
17
|
+
{
|
18
|
+
name: "--build",
|
19
|
+
flag: "-b",
|
20
|
+
},
|
21
|
+
{
|
22
|
+
name: "--delete",
|
23
|
+
flag: "-d",
|
24
|
+
},
|
25
|
+
{
|
26
|
+
name: "--path",
|
27
|
+
flag: "-p",
|
28
|
+
},
|
29
|
+
];
|
@@ -0,0 +1,38 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
+
exports.build_addon = build_addon;
|
7
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
8
|
+
const archiver_1 = __importDefault(require("archiver"));
|
9
|
+
const node_path_1 = __importDefault(require("node:path"));
|
10
|
+
const node_os_1 = __importDefault(require("node:os"));
|
11
|
+
function build_addon(name) {
|
12
|
+
const pathMine = getFolder(name);
|
13
|
+
if (pathMine.length <= 0)
|
14
|
+
return;
|
15
|
+
const output = node_fs_1.default.createWriteStream(`${name}.mcaddon`);
|
16
|
+
const archive = (0, archiver_1.default)("zip", {
|
17
|
+
zlib: { level: 9 },
|
18
|
+
});
|
19
|
+
output.on("close", () => {
|
20
|
+
console.log("\x1b[1;32mAddon construction completed.\x1b[0m");
|
21
|
+
});
|
22
|
+
archive.pipe(output);
|
23
|
+
archive.directory(`${pathMine[0]}/`, `${name} B`);
|
24
|
+
archive.directory(`${pathMine[1]}/`, `${name} R`);
|
25
|
+
archive.finalize();
|
26
|
+
}
|
27
|
+
function getFolder(name) {
|
28
|
+
const pathMine = node_fs_1.default.readFileSync(node_path_1.default.join(__dirname, "../../path.config"), "utf-8");
|
29
|
+
if (!node_fs_1.default.existsSync(node_path_1.default.join(node_os_1.default.homedir(), pathMine, "development_behavior_packs", name)) &&
|
30
|
+
!node_fs_1.default.existsSync(node_path_1.default.join(node_os_1.default.homedir(), pathMine, "development_resource_packs", name))) {
|
31
|
+
console.log(`\x1b[1;31mAddon not found: ${name}\x1b[0m`);
|
32
|
+
return [];
|
33
|
+
}
|
34
|
+
return [
|
35
|
+
node_path_1.default.join(node_os_1.default.homedir(), pathMine, "development_behavior_packs", name),
|
36
|
+
node_path_1.default.join(node_os_1.default.homedir(), pathMine, "development_resource_packs", name),
|
37
|
+
];
|
38
|
+
}
|
@@ -0,0 +1,35 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
+
exports.delete_addon = delete_addon;
|
7
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
8
|
+
const node_path_1 = __importDefault(require("node:path"));
|
9
|
+
const node_os_1 = __importDefault(require("node:os"));
|
10
|
+
function delete_addon(name) {
|
11
|
+
const pathMine = getFolder(name);
|
12
|
+
if (pathMine.length <= 0)
|
13
|
+
return;
|
14
|
+
node_fs_1.default.rmSync(pathMine[0], {
|
15
|
+
recursive: true,
|
16
|
+
force: true,
|
17
|
+
});
|
18
|
+
node_fs_1.default.rmSync(pathMine[1], {
|
19
|
+
recursive: true,
|
20
|
+
force: true,
|
21
|
+
});
|
22
|
+
console.log(`\x1b[1;32mAddon deleted sucessfully: ${name}\x1b[0m`);
|
23
|
+
}
|
24
|
+
function getFolder(name) {
|
25
|
+
const pathMine = node_fs_1.default.readFileSync(node_path_1.default.join(__dirname, "../../path.config"), "utf-8");
|
26
|
+
if (!node_fs_1.default.existsSync(node_path_1.default.join(node_os_1.default.homedir(), pathMine, "development_behavior_packs", name)) &&
|
27
|
+
!node_fs_1.default.existsSync(node_path_1.default.join(node_os_1.default.homedir(), pathMine, "development_resource_packs", name))) {
|
28
|
+
console.log(`\x1b[1;31mAddon not found: ${name}\x1b[0m`);
|
29
|
+
return [];
|
30
|
+
}
|
31
|
+
return [
|
32
|
+
node_path_1.default.join(node_os_1.default.homedir(), pathMine, "development_behavior_packs", name),
|
33
|
+
node_path_1.default.join(node_os_1.default.homedir(), pathMine, "development_resource_packs", name),
|
34
|
+
];
|
35
|
+
}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.message_help = message_help;
|
4
|
+
function message_help() {
|
5
|
+
console.log("\x1b[1;33m");
|
6
|
+
console.log(" " + " ".repeat(10) + "┌ Commands list ┐");
|
7
|
+
console.log("\x1b[1;34m");
|
8
|
+
console.log(" →" + " help (-h) - show commands list.");
|
9
|
+
console.log(" →" + " version (-v) - show scriptmc version.");
|
10
|
+
console.log(" →" + " new (-n) - create new addon.");
|
11
|
+
console.log(" →" + " build (-b) - build addon.");
|
12
|
+
console.log(" →" + " delete (-d) - delete a addon.");
|
13
|
+
console.log(" →" + " path (-p) - change minecraft folder path.");
|
14
|
+
console.log("\x1b[0m");
|
15
|
+
}
|
@@ -0,0 +1,110 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
+
exports.new_addon = new_addon;
|
7
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
8
|
+
const node_path_1 = __importDefault(require("node:path"));
|
9
|
+
const node_os_1 = __importDefault(require("node:os"));
|
10
|
+
const uuid_1 = require("uuid");
|
11
|
+
function new_addon(name, description, res) {
|
12
|
+
const pathMine = getFolder(name);
|
13
|
+
if (pathMine.length <= 0)
|
14
|
+
return;
|
15
|
+
const behavior_uuid = (0, uuid_1.v4)();
|
16
|
+
const resource_uuid = (0, uuid_1.v4)();
|
17
|
+
const behavior_manifest = `{
|
18
|
+
"format_version": 2,
|
19
|
+
"header": {
|
20
|
+
"name": "${name}",
|
21
|
+
"description": "${description}",
|
22
|
+
"uuid": "${behavior_uuid}",
|
23
|
+
"version": [1, 0, 0],
|
24
|
+
"min_engine_version": [1, 21, 20]
|
25
|
+
},
|
26
|
+
"modules": [
|
27
|
+
{
|
28
|
+
"type": "data",
|
29
|
+
"uuid": "${(0, uuid_1.v4)()}",
|
30
|
+
"version": [1, 0, 0]
|
31
|
+
},
|
32
|
+
${res === "y"
|
33
|
+
? `{
|
34
|
+
"type": "script",
|
35
|
+
"language": "javascript",
|
36
|
+
"entry": "scripts/main.js",
|
37
|
+
"uuid": "${(0, uuid_1.v4)()}",
|
38
|
+
"version": [1, 0, 0]
|
39
|
+
}`
|
40
|
+
: ""}
|
41
|
+
],
|
42
|
+
"dependencies": [
|
43
|
+
{
|
44
|
+
"uuid": "${resource_uuid}",
|
45
|
+
"version": [1, 0, 0]
|
46
|
+
},
|
47
|
+
{
|
48
|
+
"module_name": "@minecraft/server",
|
49
|
+
"version": "1.19.0"
|
50
|
+
},
|
51
|
+
{
|
52
|
+
"module_name": "@minecraft/server-ui",
|
53
|
+
"version": "1.3.0"
|
54
|
+
}
|
55
|
+
]
|
56
|
+
}
|
57
|
+
`;
|
58
|
+
const resource_manifest = `{
|
59
|
+
"format_version": 2,
|
60
|
+
"header": {
|
61
|
+
"name": "${name}",
|
62
|
+
"description": "${description}",
|
63
|
+
"uuid": "${resource_uuid}",
|
64
|
+
"version": [1, 0, 0],
|
65
|
+
"min_engine_version": [1, 21, 20]
|
66
|
+
},
|
67
|
+
"modules": [
|
68
|
+
{
|
69
|
+
"type": "resources",
|
70
|
+
"uuid": "${(0, uuid_1.v4)()}",
|
71
|
+
"version": [1, 0, 0]
|
72
|
+
}
|
73
|
+
],
|
74
|
+
"dependencies": [
|
75
|
+
{
|
76
|
+
"uuid": "${behavior_uuid}",
|
77
|
+
"version": [1, 0, 0]
|
78
|
+
}
|
79
|
+
]
|
80
|
+
}
|
81
|
+
`;
|
82
|
+
node_fs_1.default.writeFileSync(`${pathMine[0]}/manifest.json`, behavior_manifest);
|
83
|
+
node_fs_1.default.writeFileSync(`${pathMine[1]}/manifest.json`, resource_manifest);
|
84
|
+
if (res === "y") {
|
85
|
+
node_fs_1.default.mkdirSync(`${pathMine[0]}/scripts`);
|
86
|
+
node_fs_1.default.writeFileSync(`${pathMine[0]}/scripts/main.js`, `import { world } from "@minecraft/server"\n\nworld.afterEvents.itemUse.subscribe((data) => {
|
87
|
+
const { source, itemStack } = data;
|
88
|
+
world.sendMessage(\`\${source.name} used item \${itemStack?.typeId}\`);
|
89
|
+
})`);
|
90
|
+
}
|
91
|
+
console.log(`\x1b[1;32mAddon created successfully: ${name}\x1b[0m`);
|
92
|
+
}
|
93
|
+
function getFolder(name) {
|
94
|
+
const pathMine = node_fs_1.default.readFileSync(node_path_1.default.join(__dirname, "../../path.config"), "utf-8");
|
95
|
+
if (node_fs_1.default.existsSync(node_path_1.default.join(node_os_1.default.homedir(), pathMine, "development_behavior_packs", name)) &&
|
96
|
+
node_fs_1.default.existsSync(node_path_1.default.join(node_os_1.default.homedir(), pathMine, "development_resource_packs", name))) {
|
97
|
+
console.log(`\x1b[1;31mAddon already exists: ${name}\x1b[0m`);
|
98
|
+
return [];
|
99
|
+
}
|
100
|
+
if (!node_fs_1.default.existsSync(node_path_1.default.join(node_os_1.default.homedir(), pathMine, "development_behavior_packs")))
|
101
|
+
node_fs_1.default.mkdirSync(node_path_1.default.join(node_os_1.default.homedir(), pathMine, "development_behavior_packs"));
|
102
|
+
if (!node_fs_1.default.existsSync(node_path_1.default.join(node_os_1.default.homedir(), pathMine, "development_resource_packs")))
|
103
|
+
node_fs_1.default.mkdirSync(node_path_1.default.join(node_os_1.default.homedir(), pathMine, "development_resource_packs"));
|
104
|
+
node_fs_1.default.mkdirSync(node_path_1.default.join(node_os_1.default.homedir(), pathMine, "development_behavior_packs", name));
|
105
|
+
node_fs_1.default.mkdirSync(node_path_1.default.join(node_os_1.default.homedir(), pathMine, "development_resource_packs", name));
|
106
|
+
return [
|
107
|
+
node_path_1.default.join(node_os_1.default.homedir(), pathMine, "development_behavior_packs", name),
|
108
|
+
node_path_1.default.join(node_os_1.default.homedir(), pathMine, "development_resource_packs", name),
|
109
|
+
];
|
110
|
+
}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
+
exports.path_config = path_config;
|
7
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
8
|
+
const node_path_1 = __importDefault(require("node:path"));
|
9
|
+
const node_os_1 = __importDefault(require("node:os"));
|
10
|
+
function path_config(path_config) {
|
11
|
+
if (path_config.includes(node_os_1.default.homedir())) {
|
12
|
+
node_fs_1.default.writeFileSync(node_path_1.default.join(__dirname, "../../path.config"), path_config.slice(node_os_1.default.homedir().length).replace(/"/g, ""));
|
13
|
+
}
|
14
|
+
else {
|
15
|
+
node_fs_1.default.writeFileSync(node_path_1.default.join(__dirname, "../../path.config"), path_config.replace(/"/g, ""));
|
16
|
+
}
|
17
|
+
}
|
package/dist/main.js
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
#!/usr/bin/env node
|
2
|
+
"use strict";
|
3
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
4
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
5
|
+
};
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
7
|
+
const node_readline_1 = __importDefault(require("node:readline"));
|
8
|
+
const message_error_js_1 = require("./message-error.js");
|
9
|
+
const help_js_1 = require("./commands/help.js");
|
10
|
+
const validArgs_js_1 = require("./validArgs.js");
|
11
|
+
const new_addon_js_1 = require("./commands/new-addon.js");
|
12
|
+
const delete_addon_js_1 = require("./commands/delete-addon.js");
|
13
|
+
const build_addon_js_1 = require("./commands/build-addon.js");
|
14
|
+
const path_config_js_1 = require("./commands/path-config.js");
|
15
|
+
let readline;
|
16
|
+
if ((0, validArgs_js_1.validArgs)().event === "sucess") {
|
17
|
+
const args = (0, validArgs_js_1.validArgs)().value;
|
18
|
+
const arg = args.filter((value) => value !== "").join("");
|
19
|
+
if (arg.startsWith("-v") || arg.startsWith("--version")) {
|
20
|
+
console.log("\x1b[34mVersion: \x1b[0m0.0.1");
|
21
|
+
}
|
22
|
+
else if (arg.startsWith("-h") || arg.startsWith("--help")) {
|
23
|
+
(0, help_js_1.message_help)();
|
24
|
+
}
|
25
|
+
else if (arg.startsWith("-n") || arg.startsWith("--new")) {
|
26
|
+
readline = node_readline_1.default.createInterface({
|
27
|
+
input: process.stdin,
|
28
|
+
output: process.stdout,
|
29
|
+
});
|
30
|
+
readline.question("Addon name: ", (name) => {
|
31
|
+
readline.question("Addon description: ", (description) => {
|
32
|
+
readline.question("Script? (Y, n) ", (res) => {
|
33
|
+
if (res.toLowerCase() !== "y" && res.toLowerCase() !== "n")
|
34
|
+
res = "y";
|
35
|
+
(0, new_addon_js_1.new_addon)(name, description, res);
|
36
|
+
readline.close();
|
37
|
+
});
|
38
|
+
});
|
39
|
+
});
|
40
|
+
}
|
41
|
+
else if (arg.startsWith("-b") || arg.startsWith("--build")) {
|
42
|
+
readline = node_readline_1.default.createInterface({
|
43
|
+
input: process.stdin,
|
44
|
+
output: process.stdout,
|
45
|
+
});
|
46
|
+
readline.question("Addon name: ", (name) => {
|
47
|
+
(0, build_addon_js_1.build_addon)(name);
|
48
|
+
readline.close();
|
49
|
+
});
|
50
|
+
}
|
51
|
+
else if (arg.startsWith("-d") || arg.startsWith("--delete")) {
|
52
|
+
readline = node_readline_1.default.createInterface({
|
53
|
+
input: process.stdin,
|
54
|
+
output: process.stdout,
|
55
|
+
});
|
56
|
+
readline.question("Addon name: ", (name) => {
|
57
|
+
(0, delete_addon_js_1.delete_addon)(name);
|
58
|
+
readline.close();
|
59
|
+
});
|
60
|
+
}
|
61
|
+
else if (arg.startsWith("-p") || arg.startsWith("--path")) {
|
62
|
+
readline = node_readline_1.default.createInterface({
|
63
|
+
input: process.stdin,
|
64
|
+
output: process.stdout,
|
65
|
+
});
|
66
|
+
readline.question("Path: ", (path) => {
|
67
|
+
(0, path_config_js_1.path_config)(path);
|
68
|
+
readline.close();
|
69
|
+
});
|
70
|
+
}
|
71
|
+
}
|
72
|
+
else {
|
73
|
+
(0, message_error_js_1.message_error)();
|
74
|
+
}
|
@@ -0,0 +1,66 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.message_error = message_error;
|
4
|
+
const validArgs_js_1 = require("./validArgs.js");
|
5
|
+
function message_error() {
|
6
|
+
if ((0, validArgs_js_1.validArgs)().value.length <= 56) {
|
7
|
+
console.log("\x1b[1;31m");
|
8
|
+
console.log("┌" +
|
9
|
+
"─".repeat((process.stdout.columns / 2 - " Warning ".length) / 2 - 1) +
|
10
|
+
" \x1b[33mWarning\x1b[31m " +
|
11
|
+
"─".repeat((process.stdout.columns / 2 - " Warning ".length) / 2 - 1) +
|
12
|
+
"┐");
|
13
|
+
console.log("│" +
|
14
|
+
" ".repeat((process.stdout.columns / 2 -
|
15
|
+
` Error: ${(0, validArgs_js_1.validArgs)().value} `.length) /
|
16
|
+
2 -
|
17
|
+
1) +
|
18
|
+
` Error: ${(0, validArgs_js_1.validArgs)().value} ` +
|
19
|
+
" ".repeat((process.stdout.columns / 2 -
|
20
|
+
` Error: ${(0, validArgs_js_1.validArgs)().value} `.length) /
|
21
|
+
2 -
|
22
|
+
1) +
|
23
|
+
"│");
|
24
|
+
console.log("│" + " ".repeat(process.stdout.columns / 2 - 3) + "│");
|
25
|
+
console.log("│" +
|
26
|
+
" \x1b[32mShow commands: \x1b[0msmc --help\x1b[1;31m" +
|
27
|
+
" ".repeat(process.stdout.columns / 2 -
|
28
|
+
" Show commands: smc --help".length -
|
29
|
+
"Scriptmc version: 0.0.1 ".length -
|
30
|
+
3) +
|
31
|
+
"\x1b[34mScriptmc version: \x1b[0m0.0.1\x1b[1;31m " +
|
32
|
+
"│");
|
33
|
+
console.log("└" + "─".repeat(process.stdout.columns / 2 - 3) + "┘");
|
34
|
+
console.log("\x1b[0m");
|
35
|
+
}
|
36
|
+
else {
|
37
|
+
console.log("\x1b[1;31m");
|
38
|
+
console.log("┌" +
|
39
|
+
"─".repeat((process.stdout.columns / 2 - " Warning ".length) / 2 - 1) +
|
40
|
+
" \x1b[33mWarning\x1b[31m " +
|
41
|
+
"─".repeat((process.stdout.columns / 2 - " Warning ".length) / 2 - 1) +
|
42
|
+
"┐");
|
43
|
+
console.log("│" +
|
44
|
+
" ".repeat((process.stdout.columns / 2 -
|
45
|
+
` Error: Argument length exceeded limit. `.length) /
|
46
|
+
2 -
|
47
|
+
2) +
|
48
|
+
` Error: Argument length exceeded limit. ` +
|
49
|
+
" ".repeat((process.stdout.columns / 2 -
|
50
|
+
` Error: Argument length exceeded limit. `.length) /
|
51
|
+
2 -
|
52
|
+
1) +
|
53
|
+
"│");
|
54
|
+
console.log("│" + " ".repeat(process.stdout.columns / 2 - 3) + "│");
|
55
|
+
console.log("│" +
|
56
|
+
" \x1b[32mShow commands: \x1b[0msmc --help\x1b[1;31m" +
|
57
|
+
" ".repeat(process.stdout.columns / 2 -
|
58
|
+
" Show commands: smc --help".length -
|
59
|
+
"Scriptmc version: 0.0.1 ".length -
|
60
|
+
3) +
|
61
|
+
"\x1b[34mScriptmc version: \x1b[0m0.0.1\x1b[1;31m " +
|
62
|
+
"│");
|
63
|
+
console.log("└" + "─".repeat(process.stdout.columns / 2 - 3) + "┘");
|
64
|
+
console.log("\x1b[0m");
|
65
|
+
}
|
66
|
+
}
|
@@ -0,0 +1,26 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.validArgs = validArgs;
|
4
|
+
const cli_list_js_1 = require("./cli-list.js");
|
5
|
+
function validArgs() {
|
6
|
+
const args_cli = process.argv.slice(2);
|
7
|
+
const args_valid = [];
|
8
|
+
let arg_error = "";
|
9
|
+
for (let i = 0; i < cli_list_js_1.list.length; i++) {
|
10
|
+
args_valid.push(args_cli
|
11
|
+
.filter((value) => cli_list_js_1.list[i].name === value || cli_list_js_1.list[i].flag === value)
|
12
|
+
.join(""));
|
13
|
+
args_cli.forEach((arg) => {
|
14
|
+
if (args_valid.includes(arg))
|
15
|
+
return;
|
16
|
+
arg_error = arg;
|
17
|
+
});
|
18
|
+
}
|
19
|
+
if (args_cli.length !== args_valid.filter((value) => value !== "").length) {
|
20
|
+
return {
|
21
|
+
event: "error",
|
22
|
+
value: `Invalid argument not expected: ${arg_error}`,
|
23
|
+
};
|
24
|
+
}
|
25
|
+
return { event: "sucess", value: args_valid };
|
26
|
+
}
|
package/package.json
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
{
|
2
|
+
"name": "scriptmc",
|
3
|
+
"version": "1.0.0",
|
4
|
+
"description": "scriptmc is a cli for minecraft bedrock addons creators",
|
5
|
+
"bin": {
|
6
|
+
"smc": "dist/main.js"
|
7
|
+
},
|
8
|
+
"files": [
|
9
|
+
"dist",
|
10
|
+
"README.md",
|
11
|
+
"LICENSE"
|
12
|
+
],
|
13
|
+
"keywords": [
|
14
|
+
"scriptmc",
|
15
|
+
"minecraft",
|
16
|
+
"bedrock",
|
17
|
+
"minecraft bedrock",
|
18
|
+
"addon creator",
|
19
|
+
"addon maker",
|
20
|
+
"cli"
|
21
|
+
],
|
22
|
+
"author": "athumjs",
|
23
|
+
"license": "MIT",
|
24
|
+
"type": "commonjs",
|
25
|
+
"devDependencies": {
|
26
|
+
"@types/archiver": "^6.0.3",
|
27
|
+
"@types/node": "^24.0.1",
|
28
|
+
"typescript": "^5.8.3"
|
29
|
+
},
|
30
|
+
"dependencies": {
|
31
|
+
"archiver": "^7.0.1",
|
32
|
+
"uuid": "^11.1.0"
|
33
|
+
}
|
34
|
+
}
|