@axeth/create-cli 1.0.4 → 2.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/tsconfig.json CHANGED
@@ -1,29 +1,18 @@
1
1
  {
2
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
3
+ "target": "ES2022",
4
+ "module": "NodeNext",
5
+ "moduleResolution": "NodeNext",
6
+ "outDir": "./dist",
7
+ "rootDir": "./src",
8
+ "declaration": true,
9
+ "declarationMap": true,
10
+ "sourceMap": true,
18
11
  "strict": true,
12
+ "esModuleInterop": true,
19
13
  "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
- }
14
+ "forceConsistentCasingInFileNames": true
15
+ },
16
+ "include": ["src/**/*"],
17
+ "exclude": ["node_modules", "dist", "**/*.test.ts"]
18
+ }
@@ -1,14 +0,0 @@
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
- }
@@ -1,114 +0,0 @@
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 };
@@ -1,49 +0,0 @@
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
- }
@@ -1,102 +0,0 @@
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 };
@@ -1,13 +0,0 @@
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
- }
@@ -1,8 +0,0 @@
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
- }
@@ -1,16 +0,0 @@
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
- );
@@ -1,3 +0,0 @@
1
- import { AxethCore } from "@axeth/core";
2
-
3
- new AxethCore();
@@ -1,30 +0,0 @@
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
- }
@@ -1,56 +0,0 @@
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
- }
@@ -1,40 +0,0 @@
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
- }
@@ -1,23 +0,0 @@
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
- }
Binary file
@@ -1,10 +0,0 @@
1
- import { SystemBase } from "@axeth/api";
2
- import { SamplePlugin } from "./plugins/SamplePlugin/index.ts";
3
-
4
- class AxethAPI extends SystemBase {
5
- public override onLoad(): void {
6
- this.pluginManagers.registerPlugin(SamplePlugin)
7
- }
8
- };
9
-
10
- new AxethAPI();
@@ -1,9 +0,0 @@
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 };
@@ -1,37 +0,0 @@
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
- }