spawnpack 0.1.0 → 0.1.2
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 +21 -8
- package/dist/spawnpack.js +34 -25
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -30,11 +30,17 @@ Install Bun first:
|
|
|
30
30
|
|
|
31
31
|
## Install
|
|
32
32
|
|
|
33
|
-
### Global install with Bun
|
|
34
|
-
|
|
35
|
-
```bash
|
|
36
|
-
bun add -g spawnpack
|
|
37
|
-
```
|
|
33
|
+
### Global install with Bun
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
bun add -g spawnpack
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Global install with npm
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
npm i -g spawnpack
|
|
43
|
+
```
|
|
38
44
|
|
|
39
45
|
### One-off run with Bun
|
|
40
46
|
|
|
@@ -51,9 +57,16 @@ bun run src/index.ts
|
|
|
51
57
|
|
|
52
58
|
## Usage
|
|
53
59
|
|
|
54
|
-
```bash
|
|
55
|
-
spawnpack
|
|
56
|
-
```
|
|
60
|
+
```bash
|
|
61
|
+
spawnpack
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Show the installed version:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
spawnpack -v
|
|
68
|
+
spawnpack --version
|
|
69
|
+
```
|
|
57
70
|
|
|
58
71
|
The wizard walks through:
|
|
59
72
|
|
package/dist/spawnpack.js
CHANGED
|
@@ -2013,6 +2013,9 @@ function getScopedContentDirectory(basePath, folder, config) {
|
|
|
2013
2013
|
function getScopedNestedContentDirectory(basePath, segments, config) {
|
|
2014
2014
|
return join(basePath, ...segments, ...getMarketplaceScopeSegments(config));
|
|
2015
2015
|
}
|
|
2016
|
+
function shouldCreateDirectory(directory) {
|
|
2017
|
+
return directory !== "." && directory !== "./" && directory !== ".\\";
|
|
2018
|
+
}
|
|
2016
2019
|
async function generateProject(config) {
|
|
2017
2020
|
const destination = config.destination;
|
|
2018
2021
|
const bpPath = join(destination, "packs", "BP");
|
|
@@ -2064,7 +2067,7 @@ async function generateProject(config) {
|
|
|
2064
2067
|
directories.push(join(bpPath, "scripts"), join(bpPath, "scripts", config.namespace), bpScriptPath);
|
|
2065
2068
|
}
|
|
2066
2069
|
}
|
|
2067
|
-
await Promise.all(directories.map((directory) => mkdir(directory, { recursive: true })));
|
|
2070
|
+
await Promise.all(directories.filter(shouldCreateDirectory).map((directory) => mkdir(directory, { recursive: true })));
|
|
2068
2071
|
const bpUuid = crypto.randomUUID();
|
|
2069
2072
|
const rpUuid = crypto.randomUUID();
|
|
2070
2073
|
const versions = await getMinecraftDependencyVersions();
|
|
@@ -2347,44 +2350,44 @@ function getTreeRoot(config) {
|
|
|
2347
2350
|
}
|
|
2348
2351
|
return destination.replace(/[\\/]+$/, "");
|
|
2349
2352
|
}
|
|
2350
|
-
function pushScopedFolder(lines,
|
|
2351
|
-
lines.push(import_picocolors.default.dim(`${
|
|
2353
|
+
function pushScopedFolder(lines, folderPrefix, scopePrefix, folder, config) {
|
|
2354
|
+
lines.push(import_picocolors.default.dim(`${folderPrefix}${folder}/`));
|
|
2352
2355
|
if (config.useMarketplaceStructure) {
|
|
2353
|
-
lines.push(import_picocolors.default.dim(`${
|
|
2356
|
+
lines.push(import_picocolors.default.dim(`${scopePrefix}${getMarketplaceScopeLabel(config)}/`));
|
|
2354
2357
|
}
|
|
2355
2358
|
}
|
|
2356
2359
|
function showFolderTree(config) {
|
|
2357
2360
|
const lines = [import_picocolors.default.bold(import_picocolors.default.white(getTreeRoot(config)))];
|
|
2358
2361
|
lines.push(import_picocolors.default.dim("├─ packs/"));
|
|
2359
2362
|
lines.push(import_picocolors.default.dim("│ ├─ BP/"));
|
|
2360
|
-
pushScopedFolder(lines, "│ │ ├─ ", "animation_controllers", config);
|
|
2361
|
-
pushScopedFolder(lines, "│ │ ├─ ", "animations", config);
|
|
2362
|
-
pushScopedFolder(lines, "│ │ ├─ ", "blocks", config);
|
|
2363
|
-
pushScopedFolder(lines, "│ │ ├─ ", "entities", config);
|
|
2364
|
-
pushScopedFolder(lines, "│ │ ├─ ", "items", config);
|
|
2365
|
-
pushScopedFolder(lines, "│ │ ├─ ", "loot_tables", config);
|
|
2366
|
-
pushScopedFolder(lines, "│ │ ├─ ", "recipes", config);
|
|
2367
|
-
pushScopedFolder(lines, "│ │ ├─ ", "spawn_rules", config);
|
|
2368
|
-
pushScopedFolder(lines, "│ │ ├─ ", "structures", config);
|
|
2363
|
+
pushScopedFolder(lines, "│ │ ├─ ", "│ │ │ └─ ", "animation_controllers", config);
|
|
2364
|
+
pushScopedFolder(lines, "│ │ ├─ ", "│ │ │ └─ ", "animations", config);
|
|
2365
|
+
pushScopedFolder(lines, "│ │ ├─ ", "│ │ │ └─ ", "blocks", config);
|
|
2366
|
+
pushScopedFolder(lines, "│ │ ├─ ", "│ │ │ └─ ", "entities", config);
|
|
2367
|
+
pushScopedFolder(lines, "│ │ ├─ ", "│ │ │ └─ ", "items", config);
|
|
2368
|
+
pushScopedFolder(lines, "│ │ ├─ ", "│ │ │ └─ ", "loot_tables", config);
|
|
2369
|
+
pushScopedFolder(lines, "│ │ ├─ ", "│ │ │ └─ ", "recipes", config);
|
|
2370
|
+
pushScopedFolder(lines, "│ │ ├─ ", "│ │ │ └─ ", "spawn_rules", config);
|
|
2371
|
+
pushScopedFolder(lines, "│ │ ├─ ", "│ │ │ └─ ", "structures", config);
|
|
2369
2372
|
lines.push(import_picocolors.default.dim("│ │ ├─ texts/"));
|
|
2370
|
-
pushScopedFolder(lines, "│ │ ├─ ", "trading", config);
|
|
2373
|
+
pushScopedFolder(lines, "│ │ ├─ ", "│ │ │ └─ ", "trading", config);
|
|
2371
2374
|
if (config.scripting === "javascript" || config.scripting === "typescript" && !config.useRgl) {
|
|
2372
|
-
lines.push(import_picocolors.default.dim(`│ │ ├─ scripts/${config.
|
|
2375
|
+
lines.push(import_picocolors.default.dim(`│ │ ├─ scripts/${config.identifier}/${config.projectId}/`));
|
|
2373
2376
|
}
|
|
2374
2377
|
lines.push(import_picocolors.default.dim("│ │ └─ manifest.json"));
|
|
2375
2378
|
lines.push(import_picocolors.default.dim("│ └─ RP/"));
|
|
2376
|
-
pushScopedFolder(lines, "│ ├─ ", "animation_controllers", config);
|
|
2377
|
-
pushScopedFolder(lines, "│ ├─ ", "animations", config);
|
|
2378
|
-
pushScopedFolder(lines, "│ ├─ ", "attachables", config);
|
|
2379
|
-
pushScopedFolder(lines, "│ ├─ ", "entity", config);
|
|
2380
|
-
pushScopedFolder(lines, "│ ├─ ", "fogs", config);
|
|
2379
|
+
pushScopedFolder(lines, "│ ├─ ", "│ │ └─ ", "animation_controllers", config);
|
|
2380
|
+
pushScopedFolder(lines, "│ ├─ ", "│ │ └─ ", "animations", config);
|
|
2381
|
+
pushScopedFolder(lines, "│ ├─ ", "│ │ └─ ", "attachables", config);
|
|
2382
|
+
pushScopedFolder(lines, "│ ├─ ", "│ │ └─ ", "entity", config);
|
|
2383
|
+
pushScopedFolder(lines, "│ ├─ ", "│ │ └─ ", "fogs", config);
|
|
2381
2384
|
lines.push(import_picocolors.default.dim("│ ├─ models/entity/"));
|
|
2382
2385
|
if (config.useMarketplaceStructure) {
|
|
2383
2386
|
lines.push(import_picocolors.default.dim(`│ │ └─ ${getMarketplaceScopeLabel(config)}/`));
|
|
2384
2387
|
}
|
|
2385
|
-
pushScopedFolder(lines, "│ ├─ ", "particles", config);
|
|
2386
|
-
pushScopedFolder(lines, "│ ├─ ", "render_controllers", config);
|
|
2387
|
-
pushScopedFolder(lines, "│ ├─ ", "sounds", config);
|
|
2388
|
+
pushScopedFolder(lines, "│ ├─ ", "│ │ └─ ", "particles", config);
|
|
2389
|
+
pushScopedFolder(lines, "│ ├─ ", "│ │ └─ ", "render_controllers", config);
|
|
2390
|
+
pushScopedFolder(lines, "│ ├─ ", "│ │ └─ ", "sounds", config);
|
|
2388
2391
|
lines.push(import_picocolors.default.dim("│ ├─ texts/"));
|
|
2389
2392
|
lines.push(import_picocolors.default.dim("│ ├─ textures/blocks/"));
|
|
2390
2393
|
if (config.useMarketplaceStructure) {
|
|
@@ -2398,7 +2401,7 @@ function showFolderTree(config) {
|
|
|
2398
2401
|
if (config.useMarketplaceStructure) {
|
|
2399
2402
|
lines.push(import_picocolors.default.dim(`│ │ └─ ${getMarketplaceScopeLabel(config)}/`));
|
|
2400
2403
|
}
|
|
2401
|
-
pushScopedFolder(lines, "│ ├─ ", "ui", config);
|
|
2404
|
+
pushScopedFolder(lines, "│ ├─ ", "│ │ └─ ", "ui", config);
|
|
2402
2405
|
lines.push(import_picocolors.default.dim("│ ├─ blocks.json"));
|
|
2403
2406
|
lines.push(import_picocolors.default.dim("│ ├─ sounds.json"));
|
|
2404
2407
|
lines.push(import_picocolors.default.dim("│ ├─ sound_definitions.json"));
|
|
@@ -2413,7 +2416,7 @@ function showFolderTree(config) {
|
|
|
2413
2416
|
lines.push(import_picocolors.default.dim("├─ dprint.json"));
|
|
2414
2417
|
}
|
|
2415
2418
|
if (config.scripting === "javascript") {
|
|
2416
|
-
lines.push(import_picocolors.default.dim(`├─ packs/BP/scripts/${config.
|
|
2419
|
+
lines.push(import_picocolors.default.dim(`├─ packs/BP/scripts/${config.identifier}/${config.projectId}/main.js`));
|
|
2417
2420
|
}
|
|
2418
2421
|
if (config.scripting !== "none") {
|
|
2419
2422
|
lines.push(import_picocolors.default.dim("├─ package.json"));
|
|
@@ -2708,6 +2711,12 @@ async function runWizard() {
|
|
|
2708
2711
|
|
|
2709
2712
|
// src/index.ts
|
|
2710
2713
|
var teal3 = (value) => `\x1B[38;2;47;208;181m${value}\x1B[39m`;
|
|
2714
|
+
var args = new Set(process.argv.slice(2));
|
|
2715
|
+
if (args.has("-v") || args.has("--version")) {
|
|
2716
|
+
const packageJson = await Bun.file(new URL("../package.json", import.meta.url)).json();
|
|
2717
|
+
console.log(packageJson.version);
|
|
2718
|
+
process.exit(0);
|
|
2719
|
+
}
|
|
2711
2720
|
var config = await runWizard();
|
|
2712
2721
|
if (config === null) {
|
|
2713
2722
|
process.exit(0);
|
package/package.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "spawnpack",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Minecraft Bedrock addon project generator — scaffold your BP+RP in seconds",
|
|
5
5
|
"author": "veedy-dev",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"type": "module",
|
|
8
|
-
"bin": {
|
|
9
|
-
"spawnpack": "bin/spawnpack.js"
|
|
10
|
-
},
|
|
8
|
+
"bin": {
|
|
9
|
+
"spawnpack": "bin/spawnpack.js"
|
|
10
|
+
},
|
|
11
11
|
"files": [
|
|
12
|
-
"bin/spawnpack.js",
|
|
13
|
-
"dist/spawnpack.js",
|
|
12
|
+
"bin/spawnpack.js",
|
|
13
|
+
"dist/spawnpack.js",
|
|
14
14
|
"templates/CLAUDE.md",
|
|
15
15
|
"README.md",
|
|
16
16
|
"LICENSE",
|