@axeth/create-cli 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/index.ts ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env bun
2
+
3
+ import { AxethCLI } from "./src/class/AxethCLI";
4
+ import { TemplateGenerators } from "./src/class/TemplateGenerators";
5
+
6
+ const templateGenerator = new TemplateGenerators();
7
+ new AxethCLI(templateGenerator);
package/package.json ADDED
@@ -0,0 +1,16 @@
1
+ {
2
+ "name": "@axeth/create-cli",
3
+ "version": "1.0.0",
4
+ "bin": {
5
+ "axeth-cli": "index.ts"
6
+ },
7
+ "publishConfig": {
8
+ "access": "public"
9
+ },
10
+ "dependencies": {
11
+ "@clack/prompts": "^0.11.0",
12
+ "@types/fs-extra": "^11.0.4",
13
+ "colors": "^1.4.0",
14
+ "fs-extra": "^11.3.3"
15
+ }
16
+ }
@@ -0,0 +1,206 @@
1
+ import * as prompt from "@clack/prompts";
2
+ import color from "colors";
3
+ import type { TemplateGenerators } from "./TemplateGenerators.js";
4
+
5
+ class AxethCLI {
6
+ private promptGroups: Record<string, Record<string, (opts?: any) => any>> = {};
7
+ private promptDefaults: Record<string, Record<string, any>> = {};
8
+ private template: TemplateGenerators;
9
+
10
+ private readonly axethAPI = `@axeth/api`;
11
+ private readonly axethCore = `@axeth/core`;
12
+
13
+ constructor(template: TemplateGenerators) {
14
+ console.clear();
15
+ this.template = template;
16
+ this.init();
17
+ }
18
+
19
+ // Get current module version from package.json
20
+ private async version() {
21
+ // __dirname is not available in ESM, so use import.meta.url
22
+ const url = new URL("../../package.json", import.meta.url);
23
+ const pkgData = await Bun.file(url).json();
24
+ return pkgData.version;
25
+ }
26
+
27
+ private async init() {
28
+ const version = await this.version();
29
+ const addonInfo = await this.addonInfoPrompt(version, () => {
30
+ process.exit(0);
31
+ });
32
+ const config = await this.configPrompt();
33
+ const spinner = prompt.spinner({ indicator: "dots" });
34
+ spinner.start("Generating template files...");
35
+ await this.template.generate({
36
+ "project_name": (addonInfo.addonName as string).replace(/\s+/g, "-").toLowerCase(),
37
+ "axethApiVersion": config.axethApiVersion,
38
+ "pack_name": addonInfo.addonName,
39
+ "pack_description": addonInfo.description,
40
+ "author_name": `[${(addonInfo.authors as string).split(",").map((name: string) => `"${name.trim()}"`)}]`,
41
+ "version": `[${addonInfo.version.split(".").map((num: string) => `${parseInt(num, 10)}`)}]`,
42
+ "seed": `${Math.floor(Math.random() * 1000000)}`,
43
+ "axethApiName": this.axethAPI,
44
+ "axethCoreName": this.axethCore,
45
+ "axethCoreVersion": config.axethCoreVersion,
46
+ }, spinner);
47
+ spinner.stop("Template files generated.");
48
+ const projectDir = (addonInfo.addonName as string).replace(/\s+/g, "-").toLowerCase();
49
+ const cwd = require('path').resolve(process.cwd(), projectDir);
50
+ const { spawn } = require('child_process');
51
+ spinner.start("Installing dependencies...");
52
+ try {
53
+ await new Promise<void>((resolve, reject) => {
54
+ const child = spawn('bun', ['install'], { cwd, shell: true });
55
+ let errorOutput = '';
56
+ child.stderr && child.stderr.on('data', (data: Buffer) => {
57
+ errorOutput += data.toString();
58
+ });
59
+ child.on('close', async (code: number) => {
60
+ if (code === 0) {
61
+ spinner.stop("Dependencies installed.");
62
+ resolve();
63
+ // Prompt to open VS Code
64
+ const openVSCode = await prompt.confirm({
65
+ message: "Open project in VS Code now?"
66
+ });
67
+ if (openVSCode) {
68
+ const childCode = spawn('code', ['.'], { cwd, shell: true, stdio: 'ignore', detached: true });
69
+ childCode.unref();
70
+ }
71
+ } else {
72
+ spinner.stop("Dependency installation failed.");
73
+ prompt.log.error(`bun install failed with code ${code}`);
74
+ if (errorOutput) {
75
+ prompt.log.error(errorOutput.trim());
76
+ }
77
+ reject(new Error(`bun install failed with code ${code}`));
78
+ }
79
+ });
80
+ child.on('error', (err: Error) => {
81
+ spinner.stop("Dependency installation failed.");
82
+ prompt.log.error(`bun install process error: ${err.message}`);
83
+ reject(err);
84
+ });
85
+ });
86
+ } catch (err) {
87
+ // spinner already stopped in error handler above
88
+ prompt.log.error(`Failed to install dependencies: ${err}`);
89
+ }
90
+ }
91
+
92
+ private async addonInfoPrompt(version: string, onCancel?: () => void) {
93
+ return await new Promise<{ [x: string]: any }>((resolve) => {
94
+ this.registerIntro(
95
+ "\n _ _ \n /_\\ __ _____| |_ \n / _ \\ \\ \\ / -_) _|\n /_/ \\_\\/\\_\\_\\___|\\__|\n ",
96
+ "Axeth CLI",
97
+ version,
98
+ );
99
+ this.registerPrompt("addonInfo", "addonName", "Add-on Name", "text", { placeholder: "My-Addon" });
100
+ this.registerPrompt("addonInfo", "description", "Description", "text", { placeholder: "This addon create for Minecraft Bedrock (Axeth)" });
101
+ this.registerPrompt("addonInfo", "version", "Version", "text", { placeholder: "1.0.0" });
102
+ this.registerPrompt("addonInfo", "authors", "Authors", "text", { placeholder: "YourName,Axeth" });
103
+ this.runPrompts("addonInfo", onCancel).then((responses) => {
104
+ resolve(responses);
105
+ })
106
+ })
107
+ }
108
+
109
+ private async configPrompt() {
110
+ return new Promise<{ [x: string]: any }>(async (resolve) => {
111
+ const spinner = prompt.spinner({ indicator: "dots" });
112
+ spinner.start("Fetching latest Axeth API version...");
113
+ const versions = await this.getAxethApiVersion();
114
+ console.log(versions);
115
+ spinner.stop(`Fetched @axeth/api ${versions.length} versions.`);
116
+ this.registerPrompt("config", "axethApiVersion", "Select Axeth API version", "select", {
117
+ options: versions.slice(0, 10).map((ver) => ({ label: ver, value: ver })),
118
+ initial: versions[0],
119
+ });
120
+ const axethCoreVersion = await this.getAxethCoreVersion();
121
+ await this.runPrompts("config", () => { process.exit(0); }).then((response) => {
122
+ resolve({
123
+ axethApiVersion: response.axethApiVersion,
124
+ axethCoreVersion: axethCoreVersion,
125
+ });
126
+ });
127
+ })
128
+ }
129
+
130
+ private registerPrompt(groupId: string, key: string, message: string, type: "text" | "password" | "confirm" | "select" | "multiselect" = "text", options: any = {}) {
131
+ if (!this.promptGroups[groupId]) this.promptGroups[groupId] = {};
132
+ this.promptDefaults[groupId] = this.promptDefaults[groupId] || {};
133
+ switch (type) {
134
+ case "text":
135
+ this.promptGroups[groupId][key] = () => prompt.text({ message, ...options });
136
+ this.promptDefaults[groupId][key] = options.placeholder || undefined;
137
+ break;
138
+ case "password":
139
+ this.promptGroups[groupId][key] = () => prompt.password({ message, ...options });
140
+ this.promptDefaults[groupId][key] = options.placeholder || undefined;
141
+ break;
142
+ case "confirm":
143
+ this.promptGroups[groupId][key] = () => prompt.confirm({ message, ...options });
144
+ this.promptDefaults[groupId][key] = options.initial || undefined;
145
+ break;
146
+ case "select":
147
+ this.promptGroups[groupId][key] = () => prompt.select({ message, ...options });
148
+ this.promptDefaults[groupId][key] = options.initial || undefined;
149
+ break;
150
+ case "multiselect":
151
+ this.promptGroups[groupId][key] = () => prompt.multiselect({ message, ...options });
152
+ this.promptDefaults[groupId][key] = options.initial || undefined;
153
+ break;
154
+ default:
155
+ throw new Error(`Unknown prompt type: ${type}`);
156
+ }
157
+ }
158
+
159
+ private async getAxethCoreVersion() {
160
+ const moduleData: any = await fetch(`https://registry.npmjs.org/${this.axethCore}`)
161
+ .then(res => res.json());
162
+
163
+ const versions = Object.keys(moduleData.versions);
164
+ return versions.reverse()[0];
165
+ }
166
+
167
+ private async getAxethApiVersion() {
168
+ const moduleData: any = await fetch(`https://registry.npmjs.org/${this.axethAPI}`)
169
+ .then(res => res.json());
170
+
171
+ const versions = Object.keys(moduleData.versions);
172
+ return versions.reverse();
173
+ }
174
+
175
+ async runPrompts(groupId: string, onCancel?: () => void) {
176
+ if (!this.promptGroups[groupId] || Object.keys(this.promptGroups[groupId]).length === 0) {
177
+ throw new Error(`No prompts to run for group: ${groupId}`);
178
+ }
179
+
180
+ const responses: { [x: string]: any } = {};
181
+ for (const key of Object.keys(this.promptGroups[groupId])) {
182
+ const response = await this.promptGroups[groupId][key]!();
183
+ if (String(response).includes("clack:cancel")) {
184
+ prompt.cancel("Operation cancelled.");
185
+ if (onCancel) onCancel();
186
+ return {};
187
+ }
188
+ if (response === undefined) {
189
+ if (this.promptDefaults[groupId] && this.promptDefaults[groupId][key] !== undefined) {
190
+ responses[key] = this.promptDefaults[groupId][key];
191
+ } else {
192
+ responses[key] = undefined;
193
+ }
194
+ } else {
195
+ responses[key] = response;
196
+ }
197
+ }
198
+ return responses;
199
+ }
200
+
201
+ private registerIntro(logo: string, title: string, version: string) {
202
+ prompt.intro(color.cyan(logo) + `\n ${title} - v${version}\n`);
203
+ }
204
+ }
205
+
206
+ export { AxethCLI };
@@ -0,0 +1,65 @@
1
+ import path from "path"
2
+ import fs from 'fs-extra';
3
+
4
+ class TemplateGenerators {
5
+ private fileList = new Map<string, string>();
6
+
7
+ constructor() {
8
+ }
9
+
10
+ public registerFile(path: string, content: string) {
11
+ this.fileList.set(path, content);
12
+ }
13
+
14
+ public getFiles() {
15
+ return this.fileList;
16
+ }
17
+
18
+ public async generate(config:{ [key: string]: any }, spinner: any): Promise<void> {
19
+ const templateDir = path.resolve(__dirname, "../templates");
20
+ const targetDir = config["pack_name"] ? path.resolve(process.cwd(), config["pack_name"]) : process.cwd();
21
+
22
+ const readTemplateFiles = async (dir: string) => {
23
+ const entries = await fs.readdir(dir, { withFileTypes: true });
24
+ for (const entry of entries) {
25
+ const fullPath = path.join(dir, entry.name);
26
+ if (entry.isDirectory()) {
27
+ await readTemplateFiles(fullPath);
28
+ } else if (entry.isFile()) {
29
+ if (!this.fileList.has(fullPath)) {
30
+ const content = await fs.readFile(fullPath, "utf8");
31
+ //if folder is .git ignore it
32
+ if (fullPath.includes(`${path.sep}.git${path.sep}`)) {
33
+ continue;
34
+ }
35
+ this.registerFile(fullPath, content);
36
+ }
37
+ }
38
+ }
39
+ };
40
+
41
+ await readTemplateFiles(templateDir);
42
+
43
+ for (const [filePath, fileContent] of this.fileList) {
44
+ let updatedContent = fileContent;
45
+ for (const [key, value] of Object.entries({ ...config })) {
46
+ const placeholder = `{{${key}}}`;
47
+ updatedContent = updatedContent.split(placeholder).join(value);
48
+ }
49
+ const absFilePath = path.isAbsolute(filePath) ? filePath : path.resolve(templateDir, filePath);
50
+ const relativePath = path.relative(templateDir, absFilePath);
51
+ const targetPath = path.join(targetDir, relativePath);
52
+ try {
53
+ await fs.ensureDir(path.dirname(targetPath));
54
+ spinner.message(`Creating file: ${targetPath}`);
55
+ await fs.writeFile(targetPath, updatedContent, "utf8");
56
+ await fs.utimes(targetPath, new Date(), new Date());
57
+ await new Promise((res) => setTimeout(res, 50));
58
+ } catch (err) {
59
+ throw err;
60
+ }
61
+ }
62
+ }
63
+ }
64
+
65
+ export { TemplateGenerators };
@@ -0,0 +1,14 @@
1
+ {
2
+ "version": "0.3.0",
3
+ "configurations": [
4
+ {
5
+ "type": "minecraft-js",
6
+ "request": "attach",
7
+ "name": "Debug with Minecraft",
8
+ "mode": "listen",
9
+ "localRoot": "${workspaceFolder}/packs/scripts",
10
+ "sourceMapRoot": "${workspaceFolder}/data/dist/BP/scripts",
11
+ "port": 19144
12
+ }
13
+ ]
14
+ }
@@ -0,0 +1,114 @@
1
+ import { ConfigManagers, Filters } from "@axeth/core";
2
+ import type { Manifest } from "./types/Manifest.ts";
3
+ import chalk from "chalk";
4
+ import * as fs from "fs";
5
+
6
+ class ManifestBuilds extends Filters {
7
+ private bpManifest = `${this.basePath}/BP/manifest.json`;
8
+ private rpManifest = `${this.basePath}/RP/manifest.json`;
9
+ private bpDirectory = `${this.basePath}/BP`;
10
+ private rpDirectory = `${this.basePath}/RP`;
11
+ private config = new ConfigManagers().getConfig();
12
+
13
+ override async apply(): Promise<void> {
14
+ await null;
15
+ this.msg(`Looking for manifests...`);
16
+ const BPManifest = this.readManifest(this.bpManifest);
17
+ const RPManifest = this.readManifest(this.rpManifest);
18
+
19
+ if (!BPManifest || !RPManifest) {
20
+ this.msg(chalk.red(`No manifest.json found in BP or RP directories.`));
21
+ return;
22
+ } else {
23
+ const config = await this.config;
24
+ const BPUUIDs = this.uuidGen(config.meta.seed, 2);
25
+ const RPUUIDs = this.uuidGen(config.meta.seed + 1000, 2);
26
+
27
+ BPManifest.header.name = config.meta.name + `@${config.meta.version.join(".")} BP`;
28
+ RPManifest.header.name = config.meta.name + `@${config.meta.version.join(".")} RP`;
29
+ BPManifest.header.description = config.meta.description || BPManifest.header.description;
30
+ RPManifest.header.description = config.meta.description || RPManifest.header.description;
31
+ BPManifest.format_version = config.format_version;
32
+ RPManifest.format_version = config.format_version;
33
+ //UUID
34
+ BPManifest.header.uuid = BPUUIDs[0] || "";
35
+ //Script Module
36
+ BPManifest.modules.find((x) => x.language === "javascript")!.uuid = BPUUIDs[1] || "";
37
+ //UUID
38
+ RPManifest.header.uuid = RPUUIDs[0] || "";
39
+ //Resource Module
40
+ RPManifest.modules.find((x) => x.type === "resources")!.uuid = RPUUIDs[1] || "";
41
+
42
+ //Dependencies
43
+ const bpDep = BPManifest.dependencies?.find((dep) => dep.uuid);
44
+ if (bpDep) {
45
+ bpDep.uuid = RPManifest.header.uuid;
46
+ }
47
+ const rpDep = RPManifest.dependencies?.find((dep) => dep.uuid);
48
+ if (rpDep) {
49
+ rpDep.uuid = BPManifest.header.uuid;
50
+ }
51
+
52
+
53
+ this.fileManagers.writeFile(
54
+ this.bpManifest,
55
+ JSON.stringify(BPManifest, null, 2),
56
+ );
57
+ this.fileManagers.writeFile(
58
+ this.rpManifest,
59
+ JSON.stringify(RPManifest, null, 2),
60
+ );
61
+
62
+ this.msg(`Updated manifest ${chalk.green("successfully")}.`);
63
+
64
+ //Copy pack icons if exist
65
+ this.fileManagers.removeFile(this.bpDirectory + "/pack_icon.png");
66
+ this.fileManagers.removeFile(this.rpDirectory + "/pack_icon.png");
67
+
68
+ this.fileManagers.copyFile(
69
+ config.meta.icon,
70
+ this.bpDirectory + "/pack_icon.png",
71
+ );
72
+ this.fileManagers.copyFile(
73
+ config.meta.icon,
74
+ this.rpDirectory + "/pack_icon.png",
75
+ )
76
+ }
77
+ }
78
+
79
+ private uuidGen(seed: number, count: number): string[] {
80
+ const uuids: string[] = [];
81
+
82
+ // simple deterministic seeded PRNG (mulberry32-like)
83
+ const rnd = (function (a: number) {
84
+ return function () {
85
+ a |= 0;
86
+ a = (a + 0x6D2B79F5) | 0;
87
+ let t = Math.imul(a ^ (a >>> 15), 1 | a);
88
+ t = (t + Math.imul(t ^ (t >>> 7), 61 | t)) ^ t;
89
+ return ((t ^ (t >>> 14)) >>> 0) / 4294967296;
90
+ };
91
+ })(seed);
92
+
93
+ for (let i = 0; i < count; i++) {
94
+ const uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
95
+ const r = Math.floor(rnd() * 16);
96
+ return (c === 'x' ? r : (r & 0x3 | 0x8)).toString(16);
97
+ });
98
+ uuids.push(uuid);
99
+ }
100
+ return uuids;
101
+ }
102
+
103
+ public readManifest(path: string): Manifest | null {
104
+ try {
105
+ return JSON.parse(
106
+ fs.readFileSync(path, "utf-8"),
107
+ ) as Manifest;
108
+ } catch {
109
+ return null;
110
+ }
111
+ }
112
+ }
113
+
114
+ export { ManifestBuilds };
@@ -0,0 +1,49 @@
1
+ export interface Manifest {
2
+ format_version: number;
3
+ header: ManifestHeader;
4
+ modules: ManifestModule[];
5
+ dependencies?: ManifestDependency[];
6
+ subpacks?: Subpack[];
7
+ capabilities?: string[];
8
+ }
9
+
10
+ export type Version = [number, number, number];
11
+ export type UUID = string;
12
+
13
+ export interface ManifestHeader {
14
+ name: string;
15
+ description: string;
16
+ uuid: UUID;
17
+ version: Version;
18
+ min_engine_version: Version;
19
+ lock_template?: boolean;
20
+ }
21
+
22
+ export interface ManifestModule {
23
+ uuid: UUID;
24
+ version: Version;
25
+ type: ModuleType;
26
+ description?: string;
27
+ language?: string;
28
+ }
29
+
30
+ export type ModuleType =
31
+ | 'resources' // Resource Pack content
32
+ | 'data' // Behavior Pack content (Scripts, Loot Tables, etc.)
33
+ | 'skin_pack' // Skin Pack content
34
+ | 'interface' // UI content
35
+ | 'world_template'
36
+ | 'script' // Client-side scripting
37
+ | 'resource' // Legacy name for 'resources'
38
+ | 'client_data' // Client-side behavior (e.g., animations, render controllers)
39
+ | 'world_dependencies';
40
+
41
+ export interface ManifestDependency {
42
+ uuid: UUID;
43
+ version: Version;
44
+ }
45
+
46
+ export interface Subpack {
47
+ folder_name: string;
48
+ name: string;
49
+ }
@@ -0,0 +1,102 @@
1
+ import { Filters } from "@axeth/core";
2
+ import type { Manifest } from "./types/Manifest.ts";
3
+ import * as esbuild from "esbuild";
4
+ import { parseArgs } from "./utils/parseArgs.ts";
5
+ import chalk from "chalk";
6
+ import { spawn } from "bun";
7
+ import * as fs from "fs";
8
+
9
+ const [settings] = parseArgs(Bun.argv.slice(2));
10
+
11
+
12
+ class TSBuilds extends Filters {
13
+ private typescript = "ts";
14
+ private bpPath = `${this.basePath}/BP`;
15
+
16
+ override async apply(): Promise<void> {
17
+ const manifest = this.readManifest(this.bpPath);
18
+ if (!manifest) return;
19
+ const entryPath = manifest.modules.find((x) => x.entry)?.entry;
20
+ if (!entryPath) return;
21
+
22
+ const scriptPath = "./packs" + "/" + entryPath.replace(".js", `.${this.typescript}`);
23
+
24
+ // Run linter before building (surface output to console)
25
+ this.msg(`Running linter: ${chalk.yellow("bunx eslint ./packs")}`);
26
+ const lintProcess = spawn(["bunx", "eslint", "./packs"], {
27
+ stdout: "inherit",
28
+ stderr: "inherit",
29
+ });
30
+
31
+ const exitCode = await lintProcess.exited;
32
+
33
+ if (exitCode !== 0) {
34
+ this.msg(`${chalk.red("✗")} Linting failed. Fix errors before building.`);
35
+ return;
36
+ }
37
+
38
+ this.msg(`${chalk.green("✓")} Linting passed`);
39
+
40
+ // Build KisuLib.js first (contains @axeth/api)
41
+ this.msg(`Building library: ${chalk.blue("KisuLib.js")}`);
42
+ await esbuild.build({
43
+ bundle: true,
44
+ entryPoints: ["@axeth/api"],
45
+ external: [
46
+ "@minecraft/server",
47
+ "@minecraft/server-ui",
48
+ ],
49
+ format: "esm",
50
+ outfile: this.bpPath + "/scripts/KisuLib.js",
51
+ minify: true,
52
+ keepNames: false,
53
+ sourcemap: true,
54
+ ...settings,
55
+ }).then(() => {
56
+ this.msg(`Successfully built library: ${chalk.green("BP/scripts/KisuLib.js")}`);
57
+ });
58
+
59
+ // Build main script (excludes @axeth/api)
60
+ this.msg(`Building script: ${chalk.green(scriptPath)}`);
61
+ await esbuild.build({
62
+ plugins: [
63
+ {
64
+ name: "alias-kisu-api",
65
+ setup(build) {
66
+ build.onResolve({ filter: /^@kisu\/api$/ }, () => {
67
+ return { path: "./KisuLib.js", external: true };
68
+ });
69
+ },
70
+ },
71
+ ],
72
+ bundle: true,
73
+ entryPoints: [
74
+ scriptPath,
75
+ ],
76
+ external: [
77
+ "@minecraft/server",
78
+ "@minecraft/server-ui",
79
+ ],
80
+ format: "esm",
81
+ outfile: this.bpPath + "/" + entryPath,
82
+ sourcemap: true,
83
+ ...settings,
84
+ }).then(() => {
85
+ this.msg(`Successfully built script: ${chalk.green("BP/" + entryPath)}`);
86
+ });
87
+
88
+ // this.fileManagers.removeDirectory(this.basePath + "/" + "scripts");
89
+ }
90
+
91
+ public readManifest(bpPath: string): Manifest | null {
92
+ try {
93
+ return JSON.parse(
94
+ fs.readFileSync(`${bpPath}/manifest.json`, "utf-8"),
95
+ ) as Manifest;
96
+ } catch {
97
+ return null;
98
+ }
99
+ }
100
+ }
101
+
102
+ export { TSBuilds };
@@ -0,0 +1,13 @@
1
+ export interface Manifest {
2
+ format_version: number;
3
+ modules: [
4
+ {
5
+ description: string;
6
+ language: string;
7
+ type: string;
8
+ uuid: string;
9
+ version: [number, number, number];
10
+ entry: string;
11
+ },
12
+ ];
13
+ }
@@ -0,0 +1,8 @@
1
+ export function parseArgs(args: string[]): [Record<string, unknown>, ...string[]] {
2
+ try {
3
+ const settings = JSON.parse(args[0] || "{}");
4
+ return [settings, ...args.slice(1)];
5
+ } catch {
6
+ return [{}, ...args];
7
+ }
8
+ }
@@ -0,0 +1,16 @@
1
+ import eslint from '@eslint/js';
2
+ import { defineConfig } from 'eslint/config';
3
+ import tseslint from 'typescript-eslint';
4
+
5
+ export default defineConfig(
6
+ eslint.configs.recommended,
7
+ tseslint.configs.recommended,
8
+ {
9
+ rules: {
10
+ "no-unused-vars": "off",
11
+ "@typescript-eslint/no-unused-vars": ["error", {
12
+ argsIgnorePattern: "^_"
13
+ }]
14
+ }
15
+ }
16
+ );
@@ -0,0 +1,3 @@
1
+ import { AxethCore } from "@axeth/core";
2
+
3
+ new AxethCore();
@@ -0,0 +1,30 @@
1
+ {
2
+ "name": "{{project_name}}",
3
+ "module": "index.ts",
4
+ "type": "module",
5
+ "private": true,
6
+ "devDependencies": {
7
+ "@types/bun": "latest",
8
+ "chokidar-cli": "^3.0.0",
9
+ "jiti": "^2.6.1"
10
+ },
11
+ "peerDependencies": {
12
+ "typescript": "^5"
13
+ },
14
+ "scripts": {
15
+ "lint": "bunx eslint",
16
+ "dev": "bun run index.ts --dev",
17
+ "build": "bun run ./index.ts --build",
18
+ "packs": "bun run ./index.ts --packs",
19
+ "clean": "bun run ./index.ts --clean"
20
+ },
21
+ "dependencies": {
22
+ "{{axethApiName}}": "^{{axethApiVersion}}",
23
+ "{{axethCoreName}}": "^{{axethCoreVersion}}",
24
+ "chalk": "^5.6.2",
25
+ "esbuild": "^0.27.2",
26
+ "eslint": "^9.39.2",
27
+ "jszip": "^3.10.1",
28
+ "typescript-eslint": "^8.50.1"
29
+ }
30
+ }
@@ -0,0 +1,56 @@
1
+ {
2
+ "format_version": 2,
3
+ "header": {
4
+ "name": "{{pack_name}}",
5
+ "description": "{{pack_description}}",
6
+ "uuid": "<uuid>",
7
+ "version": [
8
+ 1,
9
+ 0,
10
+ 0
11
+ ],
12
+ "min_engine_version": [
13
+ 1,
14
+ 21,
15
+ 60
16
+ ]
17
+ },
18
+ "modules": [
19
+ {
20
+ "description": "Behavior Pack",
21
+ "language": "javascript",
22
+ "type": "script",
23
+ "uuid": "<uuid>",
24
+ "version": [
25
+ 1,
26
+ 0,
27
+ 0
28
+ ],
29
+ "entry": "scripts/index.js"
30
+ }
31
+ ],
32
+ "dependencies": [
33
+ {
34
+ "module_name": "@minecraft/server",
35
+ "version": "{{minecraftServerVersion}}"
36
+ },
37
+ {
38
+ "module_name": "@minecraft/server-ui",
39
+ "version": "{{minecraftServerUIVersion}}"
40
+ },
41
+ {
42
+ "uuid": "<uuid>",
43
+ "version": [
44
+ 1,
45
+ 0,
46
+ 0
47
+ ]
48
+ }
49
+ ],
50
+ "metadata": {
51
+ "product_type": "addon",
52
+ "authors": [
53
+ "KisuX3"
54
+ ]
55
+ }
56
+ }
@@ -0,0 +1,40 @@
1
+ {
2
+ "format_version": 2,
3
+ "header": {
4
+ "name": "{{pack_name}}",
5
+ "description": "{{pack_description}}",
6
+ "uuid": "<uuid>",
7
+ "version": [
8
+ 1,
9
+ 0,
10
+ 0
11
+ ],
12
+ "min_engine_version": [
13
+ 1,
14
+ 21,
15
+ 60
16
+ ]
17
+ },
18
+ "modules": [
19
+ {
20
+ "description": "Resource Pack",
21
+ "type": "resources",
22
+ "uuid": "<uuid>",
23
+ "version": [
24
+ 1,
25
+ 0,
26
+ 0
27
+ ]
28
+ }
29
+ ],
30
+ "dependencies": [
31
+ {
32
+ "uuid": "<uuid>",
33
+ "version": [
34
+ 1,
35
+ 0,
36
+ 0
37
+ ]
38
+ }
39
+ ]
40
+ }
@@ -0,0 +1,23 @@
1
+ {
2
+ "format_version": 2,
3
+ "meta": {
4
+ "name": "{{pack_name}}",
5
+ "icon": "./packs/pack_icon.png",
6
+ "version": {{version}},
7
+ "description": "{{pack_description}}",
8
+ "seed": {{seed}},
9
+ "authors": {{author_name}}
10
+ },
11
+ "filters": [
12
+ {
13
+ "name": "TSBuilds",
14
+ "config": {}
15
+ },
16
+ {
17
+ "name": "ManifestBuilds",
18
+ "config": {}
19
+ }
20
+ ],
21
+ "env": {
22
+ }
23
+ }
@@ -0,0 +1,10 @@
1
+ import { SystemBase } from "@axeth/api";
2
+ import { SamplePlugin } from "./plugins/SamplePlugin/index.ts";
3
+
4
+ class KisuAPI extends SystemBase {
5
+ public override onLoad(): void {
6
+ this.pluginManagers.registerPlugin(SamplePlugin)
7
+ }
8
+ };
9
+
10
+ new KisuAPI();
@@ -0,0 +1,9 @@
1
+ import { PluginBase } from "@axeth/api";
2
+
3
+ class SamplePlugin extends PluginBase {
4
+ public override onLoad(): void {
5
+ this.logger.info("SamplePlugin has been loaded!");
6
+ }
7
+ }
8
+
9
+ export { SamplePlugin };
@@ -0,0 +1,37 @@
1
+ {
2
+ "compilerOptions": {
3
+ // Environment setup & latest features
4
+ "lib": ["ESNext"],
5
+ "target": "ESNext",
6
+ "module": "Preserve",
7
+ "moduleDetection": "force",
8
+ "jsx": "react-jsx",
9
+ "allowJs": true,
10
+
11
+ // Bundler mode
12
+ "moduleResolution": "bundler",
13
+ "allowImportingTsExtensions": true,
14
+ "verbatimModuleSyntax": true,
15
+ "noEmit": true,
16
+
17
+ // Best practices
18
+ "strict": true,
19
+ "skipLibCheck": true,
20
+ "noFallthroughCasesInSwitch": true,
21
+ "noUncheckedIndexedAccess": true,
22
+ "noImplicitOverride": true,
23
+
24
+ // Some stricter flags (disabled by default)
25
+ "noUnusedLocals": true,
26
+ "noUnusedParameters": true,
27
+ "noImplicitAny": true,
28
+ "noPropertyAccessFromIndexSignature": false,
29
+
30
+ "paths": {
31
+ "@axeth/api": ["./lib/@axeth/api/index.ts"],
32
+ "@minecraft/server": ["./node_modules/@minecraft/server"],
33
+ "@minecraft/server-ui": ["./node_modules/@minecraft/server-ui"],
34
+ "@minecraft/math": ["./node_modules/@minecraft/math"]
35
+ }
36
+ }
37
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,29 @@
1
+ {
2
+ "compilerOptions": {
3
+ // Environment setup & latest features
4
+ "lib": ["ESNext"],
5
+ "target": "ESNext",
6
+ "module": "Preserve",
7
+ "moduleDetection": "force",
8
+ "jsx": "react-jsx",
9
+ "allowJs": true,
10
+
11
+ // Bundler mode
12
+ "moduleResolution": "bundler",
13
+ "allowImportingTsExtensions": true,
14
+ "verbatimModuleSyntax": true,
15
+ "noEmit": true,
16
+
17
+ // Best practices
18
+ "strict": true,
19
+ "skipLibCheck": true,
20
+ "noFallthroughCasesInSwitch": true,
21
+ "noUncheckedIndexedAccess": true,
22
+ "noImplicitOverride": true,
23
+
24
+ // Some stricter flags (disabled by default)
25
+ "noUnusedLocals": false,
26
+ "noUnusedParameters": false,
27
+ "noPropertyAccessFromIndexSignature": false
28
+ }
29
+ }