create-mcbepack 1.0.3 → 1.0.6

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/README.md CHANGED
@@ -1,197 +1,81 @@
1
1
  # create-mcbepack
2
2
 
3
- Interactive CLI tool for scaffolding MCBEPACK projects
3
+ Interactive scaffolder for Minecraft Bedrock Edition add-on projects.
4
4
 
5
- [![npm version](https://badge.fury.io/js/create-mcbepack.svg)](https://www.npmjs.com/package/create-mcbepack)
6
- [![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)
7
-
8
- ## Overview
9
-
10
- `create-mcbepack` is an interactive command-line tool that facilitates rapid scaffolding of Minecraft Bedrock Edition addon projects with best practices and modern development tooling.
11
-
12
- ## Features
13
-
14
- - **Interactive Project Setup** - Guided prompts for project configuration
15
- - **Multiple Pack Types** - Support for Behavior Packs and Resource Packs
16
- - **Script API Integration** - Optional Script API setup with package selection
17
- - **Language Choice** - TypeScript or JavaScript support
18
- - **Release Channel Selection** - Choose between stable, beta, or preview releases
19
- - **Auto-generated Configuration** - Automatic manifest, package.json, and tsconfig generation
20
- - **Project Templates** - Pre-configured templates with best practices
5
+ It creates the pack folders, manifests, optional Script API entry point, package scripts, and Minecraft development-path configuration expected by `@mcbepack/cli`.
21
6
 
22
7
  ## Usage
23
8
 
24
- ### Quick Start
25
-
26
9
  ```bash
27
10
  bunx create-mcbepack
28
11
  ```
29
12
 
30
- ### Interactive Prompts
31
-
32
- The CLI will guide you through the following steps:
33
-
34
- 1. **Pack Type Selection**
35
- - Choose between Behavior Pack and/or Resource Pack
36
-
37
- 2. **Project Information**
38
- - Project name
39
- - Description
40
- - Author name(s)
41
- - Minimum engine version
42
-
43
- 3. **Script API Configuration** (if Behavior Pack is selected)
44
- - Enable/disable Script API
45
- - Select programming language (TypeScript/JavaScript)
46
- - Choose game release channel (stable/beta/preview)
47
- - Select Script API packages to include:
48
- - `@minecraft/server`
49
- - `@minecraft/server-ui`
50
- - `@minecraft/server-net`
51
- - `@minecraft/server-admin`
52
- - `@minecraft/server-gametest`
53
- - `@minecraft/vanilla-data`
54
- - `@minecraft/math`
55
-
56
- 4. **Project Preview**
57
- - Review generated file structure
58
- - Confirm project creation
59
-
60
- ### Example
61
-
62
- ```bash
63
- $ bunx create-mcbepack
64
-
65
- Create MCBEPack
66
-
67
- ? Select a extension type?
68
- ◉ Behavior Pack
69
- ◉ Resource Pack
70
-
71
- ? What is the name of the project? my-awesome-addon
72
- ? What is the description of the project? An amazing Minecraft addon
73
- ? What is the author's name? YourName
74
- ? What is the minimum engine version required? 1.21.0
75
-
76
- ? Do you want to add a script api to behavior? Yes
77
- ? Which language do you want to use? typescript
78
- ? What game type would you like to use? stable
79
- ? Which packages would you like to add?
80
- ◉ @minecraft/server
81
- ◉ @minecraft/server-ui
82
-
83
- Success! Created project my-awesome-addon
84
- at: /path/to/my-awesome-addon
85
-
86
- Next steps:
87
-
88
- 1. cd my-awesome-addon
89
- 2. bun install
90
- 3. bun run dev
91
-
92
- Available commands:
93
- • bun run dev - Start development server
94
- • bun run build:zip - Build project
95
- • bun run build:mcpack - Build project
96
- • bun run build:addon - Build project
13
+ The prompts ask for:
14
+
15
+ - behavior pack and/or resource pack
16
+ - project name, description, author, and minimum engine version
17
+ - optional Script API support
18
+ - TypeScript or JavaScript
19
+ - stable, beta, or preview Script API release channel
20
+ - Minecraft package modules to include
21
+
22
+ ## Generated Scripts
23
+
24
+ Script API projects include:
25
+
26
+ ```json
27
+ {
28
+ "scripts": {
29
+ "dev": "mcbepack dev",
30
+ "build:zip": "mcbepack build -o zip",
31
+ "build:mcpack": "mcbepack build -o mcpack",
32
+ "build:mcaddon": "mcbepack build -o mcaddon",
33
+ "update:stable": "mcbepack update -t stable",
34
+ "update:beta": "mcbepack update -t beta",
35
+ "update:preview": "mcbepack update -t preview"
36
+ }
37
+ }
97
38
  ```
98
39
 
99
- ## Generated Project Structure
100
-
101
- ```
102
- my-awesome-addon/
103
- ├── scripts/ # TypeScript/JavaScript source files (if Script API enabled)
104
- │ └── index.ts
105
- ├── .env.local # Minecraft path configuration
106
- ├── .gitignore
107
- ├── package.json
108
- ├── tsconfig.json # TypeScript configuration (if TypeScript selected)
109
- ├── pack_icon.png
110
- └── README.md
40
+ Non-script projects include the three build commands.
41
+
42
+ ## Generated Layout
43
+
44
+ ```text
45
+ my-addon/
46
+ |-- scripts/
47
+ | `-- index.ts
48
+ |-- src/
49
+ | |-- behavior_pack/
50
+ | | |-- manifest.json
51
+ | | `-- pack_icon.png
52
+ | `-- resource_pack/
53
+ | |-- manifest.json
54
+ | `-- pack_icon.png
55
+ |-- .env.local
56
+ |-- .gitignore
57
+ |-- package.json
58
+ |-- README.md
59
+ `-- tsconfig.json
111
60
  ```
112
61
 
113
- ## Configuration Files
114
-
115
- ### package.json
116
-
117
- Automatically generated with:
118
-
119
- - Project metadata
120
- - Script API dependencies (if enabled)
121
- - Development scripts
122
- - Peer dependencies (`@mcbepack/cli`, `@mcbepack/api`)
123
-
124
- ### tsconfig.json
62
+ Some files are only created when the selected options need them.
125
63
 
126
- Pre-configured TypeScript settings optimized for Minecraft addon development:
127
-
128
- - ESNext target
129
- - Bundler module resolution
130
- - Source maps disabled for production
131
-
132
- ### .env.local
133
-
134
- Minecraft installation paths configuration:
135
-
136
- ```env
137
- BASE_PATH="C:\Users\YourName\AppData\Roaming\Minecraft Bedrock\Users\Shared\games\com.mojang"
138
- RESOURCE_PATH="development_resource_packs"
139
- BEHAVIOR_PATH="development_behavior_packs"
140
- ```
64
+ ## Local Development
141
65
 
142
- ## Development
143
-
144
- ### Building from Source
66
+ From the repository root:
145
67
 
146
68
  ```bash
147
- # Clone the repository
148
- git clone https://github.com/bugphxne/create-mcbepack.git
149
- cd mcbepack/packages/create-mcbepack
150
-
151
- # Install dependencies
152
69
  bun install
153
-
154
- # Build
155
- bun run build
156
-
157
- # Test locally
158
- bun run test
159
- ```
160
-
161
- ### Project Structure
162
-
163
- ```
164
- create-mcbepack/
165
- ├── src/
166
- │ ├── index.ts # Main CLI entry point
167
- │ ├── prompt.ts # Interactive prompts
168
- │ ├── types.ts # TypeScript type definitions
169
- │ └── utils/
170
- │ ├── collect-info.ts # Project information collection
171
- │ ├── create-files.ts # File generation
172
- │ └── generate-files.ts # File list generation
173
- ├── templates/ # Project templates
174
- │ ├── README.md
175
- │ ├── tsconfig.json
176
- │ ├── .env.local
177
- │ ├── .gitignore
178
- │ └── pack_icon.png
179
- └── bin/ # Compiled output
70
+ bun --cwd packages/create-mcbepack run build
180
71
  ```
181
72
 
182
73
  ## Related Packages
183
74
 
184
- - [`@mcbepack/cli`](../cli) - Development and build tooling
185
- - [`@mcbepack/api`](../api) - Utility APIs for Script API
186
- - [`@mcbepack/common`](../common) - Shared utilities
75
+ - [`@mcbepack/cli`](../@mcbepack/cli)
76
+ - [`@mcbepack/api`](../@mcbepack/api)
77
+ - [`@mcbepack/common`](../@mcbepack/common)
187
78
 
188
79
  ## License
189
80
 
190
- GPL-3.0 - see [LICENSE](./LICENSE) for details
191
-
192
- ## Resources
193
-
194
- - [GitHub Repository](https://github.com/bugphxne/create-mcbepack)
195
- - [npm Package](https://www.npmjs.com/package/create-mcbepack)
196
- - [Documentation](https://docs.mbext.online/mcbepack)
197
- - [Issue Tracker](https://github.com/bugphxne/create-mcbepack/issues)
81
+ GPL-3.0. See [LICENSE](./LICENSE).
@@ -36,21 +36,17 @@ async function main() {
36
36
  console.log(` ${pc.cyan("3.")} bun run dev\n`);
37
37
  }
38
38
  else {
39
- console.log(` ${pc.cyan("2.")} Start developing your project\n`);
39
+ console.log(` ${pc.cyan("2.")} bun install`);
40
+ console.log(` ${pc.cyan("3.")} Start developing your project\n`);
40
41
  }
42
+ console.log(pc.dim("Available commands:"));
41
43
  if (config.script?.enabled) {
42
- console.log(pc.dim("Available commands:"));
43
- console.log(pc.dim(" bun run dev - Start development server"));
44
- console.log(pc.dim(" • bun run build:zip - Build project"));
45
- console.log(pc.dim(" • bun run build:mcpack - Build project"));
46
- console.log(pc.dim(" • bun run build:addon - Build project"));
47
- }
48
- else {
49
- console.log(pc.dim("Available commands:"));
50
- console.log(pc.dim(" • bun run build:zip - Build project"));
51
- console.log(pc.dim(" • bun run build:mcpack - Build project"));
52
- console.log(pc.dim(" • bun run build:addon - Build project"));
44
+ console.log(pc.dim(" - bun run dev - Start development server"));
45
+ console.log(pc.dim(" - bun run update:stable - Update Script API packages"));
53
46
  }
47
+ console.log(pc.dim(" - bun run build:zip - Build a .zip archive"));
48
+ console.log(pc.dim(" - bun run build:mcpack - Build .mcpack archive(s)"));
49
+ console.log(pc.dim(" - bun run build:mcaddon - Build a .mcaddon archive"));
54
50
  }
55
51
  catch (error) {
56
52
  console.error(pc.red("\nError occurred:"), error);
@@ -1,4 +1,4 @@
1
- import { v4 as uuidv4 } from "uuid";
1
+ import { randomUUID } from "node:crypto";
2
2
  import pc from "picocolors";
3
3
  import { getDependency } from "@mcbepack/common";
4
4
  import prompt from "../prompt";
@@ -7,9 +7,9 @@ export async function collectProjectInfo() {
7
7
  const { extensions } = await prompt.extension();
8
8
  const { name, description, author, minimumEngineVersion } = await prompt.info();
9
9
  const uuids = {
10
- behavior: uuidv4(),
11
- resource: uuidv4(),
12
- scriptModule: uuidv4(),
10
+ behavior: randomUUID(),
11
+ resource: randomUUID(),
12
+ scriptModule: randomUUID(),
13
13
  };
14
14
  const config = {
15
15
  name,
@@ -15,10 +15,10 @@ export function createFiles(files) {
15
15
  else {
16
16
  fs.writeFileSync(file.path, file.content);
17
17
  }
18
- console.log(` ${pc.green("")} ${path.relative(process.cwd(), file.path)}`);
18
+ console.log(` ${pc.green("[OK]")} ${path.relative(process.cwd(), file.path)}`);
19
19
  }
20
20
  catch (error) {
21
- console.error(` ${pc.red("")} ${path.relative(process.cwd(), file.path)}`);
21
+ console.error(` ${pc.red("[ERR]")} ${path.relative(process.cwd(), file.path)}`);
22
22
  throw error;
23
23
  }
24
24
  }
@@ -58,7 +58,7 @@ function buildFileTree(files, projectRoot) {
58
58
  return root;
59
59
  }
60
60
  function printTree(node, prefix = "", isLast = true) {
61
- const connector = isLast ? "└── " : "├── ";
61
+ const connector = isLast ? "`-- " : "|-- ";
62
62
  if (prefix === "") {
63
63
  console.log(` ${pc.cyan(node.name)}/`);
64
64
  }
@@ -70,7 +70,7 @@ function printTree(node, prefix = "", isLast = true) {
70
70
  const children = Array.from(node.children.values());
71
71
  children.forEach((child, index) => {
72
72
  const isLastChild = index === children.length - 1;
73
- const newPrefix = prefix + (isLast ? " " : " ");
73
+ const newPrefix = prefix + (isLast ? " " : "| ");
74
74
  printTree(child, newPrefix, isLastChild);
75
75
  });
76
76
  }
@@ -89,16 +89,16 @@ export function generateFileList(config) {
89
89
  dev: "mcbepack dev",
90
90
  "build:zip": "mcbepack build -o zip",
91
91
  "build:mcpack": "mcbepack build -o mcpack",
92
- "build:addon": "mcbepack build -o addon",
92
+ "build:mcaddon": "mcbepack build -o mcaddon",
93
93
  "update:stable": "mcbepack update -t stable",
94
94
  "update:beta": "mcbepack update -t beta",
95
95
  "update:preview": "mcbepack update -t preview",
96
96
  },
97
- devDependencies: Object.fromEntries(config.script.dependencies.map(dep => [dep.packageName, dep.fullVersion])),
98
- peerDependencies: {
97
+ devDependencies: {
99
98
  "@mcbepack/cli": "latest",
100
99
  "@mcbepack/api": "latest",
101
- ...(config.script.language === "typescript" ? { "typescript": "latest" } : {})
100
+ ...(config.script.language === "typescript" ? { "typescript": "latest" } : {}),
101
+ ...Object.fromEntries(config.script.dependencies.map(dep => [dep.packageName, dep.fullVersion]))
102
102
  }
103
103
  };
104
104
  files.push({
@@ -151,7 +151,7 @@ export function generateFileList(config) {
151
151
  modules: [
152
152
  {
153
153
  type: "resources",
154
- uuid: config.uuids.resource,
154
+ uuid: crypto.randomUUID(),
155
155
  version: [1, 0, 0],
156
156
  },
157
157
  ],
@@ -178,9 +178,9 @@ export function generateFileList(config) {
178
178
  scripts: {
179
179
  "build:zip": "mcbepack build -o zip",
180
180
  "build:mcpack": "mcbepack build -o mcpack",
181
- "build:addon": "mcbepack build -o addon",
181
+ "build:mcaddon": "mcbepack build -o mcaddon",
182
182
  },
183
- peerDependencies: {
183
+ devDependencies: {
184
184
  "@mcbepack/cli": "latest"
185
185
  }
186
186
  }, null, 2),
package/package.json CHANGED
@@ -1,27 +1,23 @@
1
1
  {
2
2
  "name": "create-mcbepack",
3
- "version": "1.0.3",
4
- "main": "out/index.js",
5
- "type": "module",
6
- "scripts": {
7
- "dev": "tsc --watch",
8
- "build": "tsc"
9
- },
10
- "bin": {
11
- "create-mcbepack": "./out/index.js"
12
- },
13
- "devDependencies": {
14
- "@types/bun": "latest"
15
- },
16
- "peerDependencies": {
17
- "typescript": "^5"
18
- },
3
+ "version": "1.0.6",
4
+ "main": "dist/index.js",
19
5
  "dependencies": {
20
- "@mcbepack/common": "^1.0.0",
6
+ "@mcbepack/common": "^1.0.1",
21
7
  "enquirer": "^2.4.1",
22
8
  "node-fetch": "^3.3.2",
23
9
  "nodemon": "^3.1.11",
24
- "picocolors": "^1.1.1",
25
- "uuid": "^13.0.0"
26
- }
10
+ "picocolors": "^1.1.1"
11
+ },
12
+ "peerDependencies": {
13
+ "typescript": "^5"
14
+ },
15
+ "bin": {
16
+ "create-mcbepack": "./dist/index.js"
17
+ },
18
+ "scripts": {
19
+ "dev": "tsc --watch",
20
+ "build": "tsc"
21
+ },
22
+ "type": "module"
27
23
  }
@@ -1,47 +1,36 @@
1
- This is a **MCBEPACK** project bootstrapped with [`create-mcbepack`](https://npmjs.com/package/create-mcbepack)
1
+ # MCBEPACK Project
2
2
 
3
- ## Getting Started
3
+ This add-on was created with `create-mcbepack`.
4
4
 
5
- First, install dependencies:
5
+ ## Start
6
+
7
+ Install dependencies:
6
8
 
7
9
  ```bash
8
10
  bun install
9
11
  ```
10
12
 
11
- Then, run the development server:
13
+ Run the development watcher:
12
14
 
13
15
  ```bash
14
16
  bun run dev
15
17
  ```
16
18
 
17
- You can start editing your addon by modifying files in the `src` directory. The development server will automatically watch for changes and sync them to your Minecraft development folder.
18
-
19
- ## Available Commands
20
-
21
- ### For general development
22
-
23
- - **`bun run build:zip`** - Build the addon as a .zip file
24
- - **`bun run build:mcpack`** - Build the addon as a .mcpack file
25
- - **`bun run build:addon`** - Build the addon as a .mcaddon file
26
-
27
- ### For script development
19
+ The dev command compiles Script API code from `scripts/` when present and syncs files from `src/behavior_pack` and `src/resource_pack` into Minecraft's development folders.
28
20
 
29
- - **`bun run dev`** - Start development server with file watching
30
- - **`bun run update:stable`** - Update the addon to the latest stable version
31
- - **`bun run update:beta`** - Update the addon to the latest beta version
32
- - **`bun run update:preview`** - Update the addon to the latest preview version
21
+ ## Build
33
22
 
34
- ## Development
35
-
36
- Edit your addon code in the `scripts` directory. The development server will automatically:
23
+ ```bash
24
+ bun run build:zip
25
+ bun run build:mcpack
26
+ bun run build:mcaddon
27
+ ```
37
28
 
38
- - Compile TypeScript/JavaScript code
39
- - Sync changes to the Minecraft development folder
40
- - Watch for file changes and rebuild automatically
29
+ Build outputs are written to `dist/`.
41
30
 
42
- ### Configuration
31
+ ## Configure Minecraft Paths
43
32
 
44
- Update `.env.local` to configure your Minecraft installation paths:
33
+ Edit `.env.local` if your Minecraft Bedrock installation uses a different location:
45
34
 
46
35
  ```env
47
36
  BASE_PATH="C:\Users\YourName\AppData\Roaming\Minecraft Bedrock\Users\Shared\games\com.mojang"
@@ -49,9 +38,17 @@ RESOURCE_PATH="development_resource_packs"
49
38
  BEHAVIOR_PATH="development_behavior_packs"
50
39
  ```
51
40
 
52
- ## Learn More
53
-
54
- To learn more about MCBEPACK, take a look at the following resources:
41
+ ## Project Structure
42
+
43
+ ```text
44
+ .
45
+ |-- scripts/
46
+ |-- src/
47
+ | |-- behavior_pack/
48
+ | `-- resource_pack/
49
+ |-- .env.local
50
+ |-- package.json
51
+ `-- tsconfig.json
52
+ ```
55
53
 
56
- - [MCBEPACK Documentation](https://docs.mbext.online/mcbepack) - learn about MCBEPACK features and API
57
- - [MCBEPACK GitHub Repository](https://github.com/bugphxne/create-mcbepack) - your feedback and contributions are welcome!
54
+ Some folders only exist when they were selected during project creation.
File without changes
File without changes