create-hackhub-mod 0.2.0 → 0.3.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/dist/index.js +56 -20
- package/package.json +1 -1
- package/templates/basic/src/index.ts +1 -1
- package/templates/full/src/apps/{ExampleApp.ts → ExampleApp/index.ts} +2 -2
- package/templates/full/src/commands/HelloCommand.ts +1 -1
- package/templates/full/src/index.ts +3 -3
- package/templates/full/src/quests/ExampleQuest.ts +1 -1
- package/templates/full/src/websites/{ExampleWebsite.ts → ExampleWebsite/index.ts} +2 -2
- package/templates/quest/src/index.ts +1 -1
- package/templates/quest/src/quests/ExampleQuest.ts +1 -1
- package/templates/website/src/index.ts +2 -2
- package/templates/website/src/{pages → websites/ExampleWebsite}/home.html +0 -5
- package/templates/website/src/websites/{ExampleWebsite.ts → ExampleWebsite/index.ts} +2 -2
- package/templates/website/src/types.d.ts +0 -4
- /package/templates/{full → base}/src/types.d.ts +0 -0
- /package/templates/full/src/{html → apps/ExampleApp}/app.html +0 -0
- /package/templates/full/src/{pages → websites/ExampleWebsite}/home.html +0 -0
package/dist/index.js
CHANGED
|
@@ -9,17 +9,46 @@ import { execSync } from "child_process";
|
|
|
9
9
|
import { fileURLToPath } from "url";
|
|
10
10
|
var __filename = fileURLToPath(import.meta.url);
|
|
11
11
|
var __dirname = path.dirname(__filename);
|
|
12
|
-
|
|
12
|
+
function hackerArt() {
|
|
13
|
+
const d = pc.dim;
|
|
14
|
+
const w = pc.white;
|
|
15
|
+
const c = pc.cyan;
|
|
16
|
+
const g = pc.green;
|
|
17
|
+
const lines = [
|
|
18
|
+
"",
|
|
19
|
+
d(" ") + w(".::::::::::."),
|
|
20
|
+
d(" ") + w(".::`") + d(" ") + w("``:::::::::."),
|
|
21
|
+
d(" ") + w(".::") + d(" ") + w("``::::::::."),
|
|
22
|
+
d(" ") + w(".::") + d(" ") + w("`:::::::::"),
|
|
23
|
+
d(" ") + w(".::") + d(" ") + w("::::::::"),
|
|
24
|
+
d(" ") + w("::") + d(" ") + g("@@") + d(" ") + g("@@") + d(" ") + w(":::::::"),
|
|
25
|
+
d(" ") + w("::") + d(" ") + g("@@") + d(" ") + g("@@") + d(" ") + w(":::::::"),
|
|
26
|
+
d(" ") + w("::") + d(" ") + w(":::::::"),
|
|
27
|
+
d(" ") + w("::") + d(" ") + g("\\__/") + d(" ") + w(":::::::"),
|
|
28
|
+
d(" ") + w("`::.") + d(" ") + w(".::::::"),
|
|
29
|
+
d(" ") + w("`::.") + d(" ") + w(".::::::'"),
|
|
30
|
+
d(" ") + w("_,,,,,,__") + w("`::::::::::::::'"),
|
|
31
|
+
d(" ") + w(",:''") + d(" ") + w("'':::::::::::'"),
|
|
32
|
+
d(" ") + w("/") + d(" ") + c(".--------.") + d(" ") + w("\\"),
|
|
33
|
+
d(" ") + w("|") + d(" ") + c("|") + d(" ") + c("|") + d(" ") + w("|"),
|
|
34
|
+
d(" ") + w("|") + d(" ") + c("|") + d(" ") + g(">_") + d(" ") + c("|") + d(" ") + w("|"),
|
|
35
|
+
d(" ") + w("|") + d(" ") + c("|") + d(" ") + c("|") + d(" ") + w("|"),
|
|
36
|
+
d(" ") + w("|") + d(" ") + c("'--------'") + d(" ") + w("|"),
|
|
37
|
+
d(" ") + w("\\") + d(" ") + c("/__________\\") + d(" ") + w("/"),
|
|
38
|
+
d(" ") + w("\\") + d(" ") + w("/"),
|
|
39
|
+
d(" ") + w("'---..___________..---'"),
|
|
40
|
+
""
|
|
41
|
+
];
|
|
42
|
+
return lines.join("\n");
|
|
43
|
+
}
|
|
44
|
+
var HACKER_ART = hackerArt();
|
|
45
|
+
var LOGO = `
|
|
13
46
|
${pc.cyan(" \u2588\u2588\u2557 \u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2557 \u2588\u2588\u2557\u2588\u2588\u2557 \u2588\u2588\u2557\u2588\u2588\u2557 \u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2557 ")}
|
|
14
47
|
${pc.cyan(" \u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D\u2588\u2588\u2551 \u2588\u2588\u2554\u255D\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557")}
|
|
15
48
|
${pc.cyan(" \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2588\u2588\u2588\u2554\u255D \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D")}
|
|
16
49
|
${pc.cyan(" \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2554\u2550\u2588\u2588\u2557 \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557")}
|
|
17
50
|
${pc.cyan(" \u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551\u255A\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2551 \u2588\u2588\u2557\u2588\u2588\u2551 \u2588\u2588\u2551\u255A\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D")}
|
|
18
51
|
${pc.cyan(" \u255A\u2550\u255D \u255A\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u255D ")}
|
|
19
|
-
${pc.dim(" \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510")}
|
|
20
|
-
${pc.dim(" \u2502")} ${pc.green(" >")} ${pc.white("Create HackHub Mod")}${pc.dim(" \u2502")}
|
|
21
|
-
${pc.dim(" \u2502")} ${pc.dim(" Mod scaffolding tool for HackHub")}${pc.dim(" \u2502")}
|
|
22
|
-
${pc.dim(" \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518")}
|
|
23
52
|
`;
|
|
24
53
|
function toKebabCase(str) {
|
|
25
54
|
return str.trim().toLowerCase().replace(/\s+/g, "-").replace(/[^a-z0-9-]/g, "").replace(/-+/g, "-").replace(/^-|-$/g, "");
|
|
@@ -68,8 +97,14 @@ function detectPackageManager() {
|
|
|
68
97
|
function installCommand(pm) {
|
|
69
98
|
return pm === "yarn" ? "yarn" : `${pm} install`;
|
|
70
99
|
}
|
|
100
|
+
function pad(str, len) {
|
|
101
|
+
const visible = str.replace(/\x1b\[[0-9;]*m/g, "");
|
|
102
|
+
const padding = Math.max(0, len - visible.length);
|
|
103
|
+
return str + " ".repeat(padding);
|
|
104
|
+
}
|
|
71
105
|
async function main() {
|
|
72
|
-
console.log(
|
|
106
|
+
console.log(HACKER_ART);
|
|
107
|
+
console.log(LOGO);
|
|
73
108
|
p.intro(pc.bgCyan(pc.black(" create-hackhub-mod ")));
|
|
74
109
|
const project = await p.group(
|
|
75
110
|
{
|
|
@@ -136,21 +171,22 @@ async function main() {
|
|
|
136
171
|
} catch {
|
|
137
172
|
s.stop(pc.yellow("Could not install dependencies. Run it manually."));
|
|
138
173
|
}
|
|
174
|
+
const W = 54;
|
|
139
175
|
console.log();
|
|
140
|
-
console.log(pc.dim(" \u250C\u2500\
|
|
141
|
-
console.log(pc.dim(" \u2502
|
|
142
|
-
console.log(pc.dim(" \u2502") + pc.green("
|
|
143
|
-
console.log(pc.dim(" \u2502
|
|
144
|
-
console.log(pc.dim(" \u2502") +
|
|
145
|
-
console.log(pc.dim(" \u2502") +
|
|
146
|
-
console.log(pc.dim(" \u2502") +
|
|
147
|
-
console.log(pc.dim(" \u2502
|
|
148
|
-
console.log(pc.dim(" \u2502") + pc.dim("
|
|
149
|
-
console.log(pc.dim(" \u2502") + pc.cyan(`
|
|
150
|
-
console.log(pc.dim(" \u2502") + pc.cyan(`
|
|
151
|
-
console.log(pc.dim(" \u2502
|
|
152
|
-
console.log(pc.dim(" \u2514\u2500\
|
|
176
|
+
console.log(pc.dim(" \u250C" + "\u2500".repeat(W) + "\u2510"));
|
|
177
|
+
console.log(pc.dim(" \u2502") + " ".repeat(W) + pc.dim("\u2502"));
|
|
178
|
+
console.log(pc.dim(" \u2502") + pad(pc.green(" \u2714 Your mod is ready!"), W) + pc.dim("\u2502"));
|
|
179
|
+
console.log(pc.dim(" \u2502") + " ".repeat(W) + pc.dim("\u2502"));
|
|
180
|
+
console.log(pc.dim(" \u2502") + pad(` Project: ${pc.bold(modName)}`, W) + pc.dim("\u2502"));
|
|
181
|
+
console.log(pc.dim(" \u2502") + pad(` Template: ${pc.bold(template)}`, W) + pc.dim("\u2502"));
|
|
182
|
+
console.log(pc.dim(" \u2502") + pad(` Author: ${pc.bold(author)}`, W) + pc.dim("\u2502"));
|
|
183
|
+
console.log(pc.dim(" \u2502") + " ".repeat(W) + pc.dim("\u2502"));
|
|
184
|
+
console.log(pc.dim(" \u2502") + pad(pc.dim(" Next steps:"), W) + pc.dim("\u2502"));
|
|
185
|
+
console.log(pc.dim(" \u2502") + pad(pc.cyan(` cd ${modId}`), W) + pc.dim("\u2502"));
|
|
186
|
+
console.log(pc.dim(" \u2502") + pad(pc.cyan(` ${pm} run build`), W) + pc.dim("\u2502"));
|
|
187
|
+
console.log(pc.dim(" \u2502") + " ".repeat(W) + pc.dim("\u2502"));
|
|
188
|
+
console.log(pc.dim(" \u2514" + "\u2500".repeat(W) + "\u2518"));
|
|
153
189
|
console.log();
|
|
154
|
-
p.outro(pc.green("Happy hacking!
|
|
190
|
+
p.outro(pc.green("Happy hacking!"));
|
|
155
191
|
}
|
|
156
192
|
main().catch(console.error);
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Bootstrap, RegisterModPackage } from "@hotbunny/hackhub-content-sdk";
|
|
2
2
|
import "./quests/ExampleQuest";
|
|
3
|
-
import "./websites/ExampleWebsite";
|
|
3
|
+
import "./websites/ExampleWebsite/index";
|
|
4
4
|
import "./commands/HelloCommand";
|
|
5
|
-
import "./apps/ExampleApp";
|
|
5
|
+
import "./apps/ExampleApp/index";
|
|
6
6
|
|
|
7
|
-
@RegisterModPackage
|
|
7
|
+
@RegisterModPackage
|
|
8
8
|
export default class {{className}} extends Bootstrap {
|
|
9
9
|
OnModPackageLoaded() {
|
|
10
10
|
console.log("{{modName}} loaded!");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Website, RegisterWebsite, WebsitePageDefinition } from "@hotbunny/hackhub-content-sdk";
|
|
2
|
-
import homePage from "
|
|
2
|
+
import homePage from "./home.html";
|
|
3
3
|
|
|
4
|
-
@RegisterWebsite
|
|
4
|
+
@RegisterWebsite
|
|
5
5
|
export class ExampleWebsite extends Website {
|
|
6
6
|
|
|
7
7
|
SiteName: string = "{{modName}}";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Bootstrap, RegisterModPackage } from "@hotbunny/hackhub-content-sdk";
|
|
2
2
|
import "./quests/ExampleQuest";
|
|
3
3
|
|
|
4
|
-
@RegisterModPackage
|
|
4
|
+
@RegisterModPackage
|
|
5
5
|
export default class {{className}} extends Bootstrap {
|
|
6
6
|
OnModPackageLoaded() {
|
|
7
7
|
console.log("{{modName}} loaded!");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Bootstrap, RegisterModPackage } from "@hotbunny/hackhub-content-sdk";
|
|
2
|
-
import "./websites/ExampleWebsite";
|
|
2
|
+
import "./websites/ExampleWebsite/index";
|
|
3
3
|
|
|
4
|
-
@RegisterModPackage
|
|
4
|
+
@RegisterModPackage
|
|
5
5
|
export default class {{className}} extends Bootstrap {
|
|
6
6
|
OnModPackageLoaded() {
|
|
7
7
|
console.log("{{modName}} loaded!");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Website, RegisterWebsite, WebsitePageDefinition } from "@hotbunny/hackhub-content-sdk";
|
|
2
|
-
import homePage from "
|
|
2
|
+
import homePage from "./home.html";
|
|
3
3
|
|
|
4
|
-
@RegisterWebsite
|
|
4
|
+
@RegisterWebsite
|
|
5
5
|
export class ExampleWebsite extends Website {
|
|
6
6
|
|
|
7
7
|
SiteName: string = "{{modName}}";
|
|
File without changes
|
|
File without changes
|
|
File without changes
|