create-h3ravel 0.2.0 → 0.2.3

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/bin/run.cjs ADDED
@@ -0,0 +1,329 @@
1
+ #!/usr/bin/env node
2
+ //#region rolldown:runtime
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
11
+ key = keys[i];
12
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
13
+ get: ((k) => from[k]).bind(null, key),
14
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
15
+ });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
20
+ value: mod,
21
+ enumerable: true
22
+ }) : target, mod));
23
+
24
+ //#endregion
25
+ let commander = require("commander");
26
+ commander = __toESM(commander);
27
+ let inquirer = require("inquirer");
28
+ inquirer = __toESM(inquirer);
29
+ let ora = require("ora");
30
+ ora = __toESM(ora);
31
+ let node_path = require("node:path");
32
+ node_path = __toESM(node_path);
33
+ let node_fs_promises = require("node:fs/promises");
34
+ node_fs_promises = __toESM(node_fs_promises);
35
+ let __antfu_install_pkg = require("@antfu/install-pkg");
36
+ __antfu_install_pkg = __toESM(__antfu_install_pkg);
37
+ let __h3ravel_shared = require("@h3ravel/shared");
38
+ __h3ravel_shared = __toESM(__h3ravel_shared);
39
+ let giget = require("giget");
40
+ giget = __toESM(giget);
41
+ let node_fs = require("node:fs");
42
+ node_fs = __toESM(node_fs);
43
+ let __h3ravel_support = require("@h3ravel/support");
44
+ __h3ravel_support = __toESM(__h3ravel_support);
45
+ let __inquirer_core = require("@inquirer/core");
46
+ __inquirer_core = __toESM(__inquirer_core);
47
+
48
+ //#region src/templates.ts
49
+ /**
50
+ * List of first party templates
51
+ */
52
+ const templates = [
53
+ {
54
+ name: "Full Starter Kit",
55
+ alias: "full",
56
+ hint: "A full H3ravel application with everything possible",
57
+ source: "github:h3ravel/h3ravel"
58
+ },
59
+ {
60
+ name: "Lean Starter Kit",
61
+ alias: "lean",
62
+ hint: "A lean H3ravel application with just the framework core",
63
+ source: null
64
+ },
65
+ {
66
+ name: "API Starter Kit",
67
+ alias: "api",
68
+ hint: "Creates a H3ravel application for building JSON APIs",
69
+ source: null
70
+ },
71
+ {
72
+ name: "Web Starter Kit",
73
+ alias: "web",
74
+ hint: "Creates a H3ravel application for building a server rendered app",
75
+ source: null
76
+ },
77
+ {
78
+ name: "Inertia Starter Kit",
79
+ alias: "inertia",
80
+ hint: "Inertia application with a frontend framework of your choice",
81
+ source: null
82
+ }
83
+ ];
84
+
85
+ //#endregion
86
+ //#region src/tsconfig.ts
87
+ const mainTsconfig = {
88
+ extends: "@h3ravel/shared/tsconfig.json",
89
+ compilerOptions: {
90
+ baseUrl: ".",
91
+ outDir: "dist",
92
+ paths: {
93
+ "src/*": ["./../src/*"],
94
+ "App/*": ["./../src/app/*"],
95
+ "root/*": ["./../*"],
96
+ "routes/*": ["./../src/routes/*"],
97
+ "config/*": ["./../src/config/*"],
98
+ "resources/*": ["./../src/resources/*"]
99
+ },
100
+ target: "es2022",
101
+ module: "es2022",
102
+ moduleResolution: "Node",
103
+ esModuleInterop: true,
104
+ strict: true,
105
+ allowJs: true,
106
+ skipLibCheck: true,
107
+ resolveJsonModule: true,
108
+ noEmit: true,
109
+ experimentalDecorators: true,
110
+ emitDecoratorMetadata: true
111
+ },
112
+ include: ["./**/*.d.ts", "./../**/*"],
113
+ exclude: ["./dist", "./node_modules"]
114
+ };
115
+ const baseTsconfig = { extends: "./.h3ravel/tsconfig.json" };
116
+
117
+ //#endregion
118
+ //#region src/actions.ts
119
+ var actions_default = class {
120
+ skipInstallation;
121
+ constructor(location, appName, description) {
122
+ this.location = location;
123
+ this.appName = appName;
124
+ this.description = description;
125
+ if (!this.location) this.location = (0, node_path.join)(process.cwd(), ".temp");
126
+ }
127
+ async download(template, install = false, auth) {
128
+ if (this.location?.includes(".temp")) await (0, node_fs_promises.rm)(this.location, {
129
+ force: true,
130
+ recursive: true
131
+ });
132
+ this.skipInstallation = !install;
133
+ this.removeLockFile();
134
+ return await (0, giget.downloadTemplate)(template, {
135
+ dir: this.location,
136
+ auth,
137
+ install,
138
+ registry: await (0, __antfu_install_pkg.detectPackageManager)() ?? "npm",
139
+ forceClean: false
140
+ });
141
+ }
142
+ async installPackage(name) {
143
+ await (0, __antfu_install_pkg.installPackage)(name, {
144
+ cwd: this.location,
145
+ silent: true
146
+ });
147
+ }
148
+ async complete() {
149
+ const packageManager = await (0, __antfu_install_pkg.detectPackageManager)() ?? "npm";
150
+ console.log("");
151
+ __h3ravel_shared.Logger.success("Your h3ravel project has been created successfully");
152
+ __h3ravel_shared.Logger.parse([["cd " + (0, node_path.relative)(process.cwd(), this.location), "cyan"]]);
153
+ __h3ravel_shared.Logger.parse([[`${packageManager} run dev`, "cyan"]]);
154
+ __h3ravel_shared.Logger.parse([["Open http://localhost:4444", "cyan"]]);
155
+ console.log("");
156
+ __h3ravel_shared.Logger.parse([["Have any questions", "white"]]);
157
+ __h3ravel_shared.Logger.parse([["Join our Discord server -", "white"], ["https://discord.gg/hsG2A8PuGb", "yellow"]]);
158
+ __h3ravel_shared.Logger.parse([["Checkout the documentation -", "white"], ["https://h3ravel.toneflix.net", "yellow"]]);
159
+ }
160
+ async cleanup() {
161
+ const pkgPath = (0, node_path.join)(this.location, "package.json");
162
+ const pkg = await (0, node_fs_promises.readFile)(pkgPath, "utf-8").then(JSON.parse);
163
+ delete pkg.packageManager;
164
+ pkg.name = (0, __h3ravel_support.slugify)(this.appName ?? (0, node_path.basename)(this.location).replace(".", ""), "-");
165
+ if (this.description) pkg.description = this.description;
166
+ await Promise.allSettled([
167
+ (0, node_fs_promises.writeFile)(pkgPath, JSON.stringify(pkg, null, 2)),
168
+ this.removeLockFile(),
169
+ (0, node_fs_promises.rm)((0, node_path.join)(this.location, "pnpm-workspace.yaml"), { force: true }),
170
+ (0, node_fs_promises.rm)((0, node_path.join)(this.location, "README.md"), { force: true }),
171
+ (0, node_fs_promises.rm)((0, node_path.join)(this.location, ".github"), {
172
+ force: true,
173
+ recursive: true
174
+ })
175
+ ]);
176
+ }
177
+ async removeLockFile() {
178
+ if (!this.skipInstallation) return;
179
+ await Promise.allSettled([
180
+ (0, node_fs_promises.unlink)((0, node_path.join)(this.location, "package-lock.json")),
181
+ (0, node_fs_promises.unlink)((0, node_path.join)(this.location, "yarn.lock")),
182
+ (0, node_fs_promises.unlink)((0, node_path.join)(this.location, "pnpm-lock.yaml"))
183
+ ]);
184
+ }
185
+ async getBanner() {
186
+ return await (0, node_fs_promises.readFile)((0, node_path.join)(process.cwd(), "./logo.txt"), "utf-8");
187
+ }
188
+ async copyExampleEnv() {
189
+ const envPath = (0, node_path.join)(this.location, ".env");
190
+ const exampleEnvPath = (0, node_path.join)(this.location, ".env.example");
191
+ if ((0, node_fs.existsSync)(exampleEnvPath)) await (0, node_fs_promises.copyFile)(exampleEnvPath, envPath);
192
+ }
193
+ async createTsConfig() {
194
+ const tscPath = (0, node_path.join)(this.location, ".h3ravel");
195
+ await (0, node_fs_promises.mkdir)(tscPath, { recursive: true });
196
+ await (0, node_fs_promises.writeFile)((0, node_path.join)(tscPath, "tsconfig.json"), JSON.stringify(mainTsconfig, null, 2));
197
+ await (0, node_fs_promises.writeFile)((0, node_path.join)(this.location, "tsconfig.json"), JSON.stringify(baseTsconfig, null, 2));
198
+ }
199
+ };
200
+
201
+ //#endregion
202
+ //#region src/logo.ts
203
+ const logo = String.raw`
204
+ 111
205
+ 111111111
206
+ 1111111111 111111
207
+ 111111 111 111111
208
+ 111111 111 111111
209
+ 11111 111 11111
210
+ 1111111 111 1111111
211
+ 111 11111 111 111111 111 1111 1111 11111111 1111
212
+ 111 11111 1111 111111 111 1111 1111 1111 11111 1111
213
+ 111 11111 11111 111 1111 1111 111111111111 111111111111 1111 1111111 1111
214
+ 111 111111 1111 111 111111111111 111111 11111 1111 111 1111 11111111 1111 1111
215
+ 111 111 11111111 111 1101 1101 111111111 11111111 1111 1111111111111111101
216
+ 111 1111111111111111 1111 111 1111 1111 111 11111011 1111 111 1111111 1101 1111
217
+ 111 11111 1110111111111111 111 1111 1111 1111111101 1111 111111111 1111011 111111111 1111
218
+ 1111111 111110111110 111 1111 1111 111111 1111 11011101 10111 11111 1111
219
+ 11011 111111 11 11111
220
+ 111111 11101 111111
221
+ 111111 111 111111
222
+ 111111 111 111111
223
+ 111111111
224
+ 110
225
+ `;
226
+ const altLogo = String.raw`%c
227
+ _ _ _____ _
228
+ | | | |___ / _ __ __ ___ _____| |
229
+ | |_| | |_ \| '__/ _ \ \ / / _ \ |
230
+ | _ |___) | | | (_| |\ V / __/ |
231
+ |_| |_|____/|_| \__,_| \_/ \___|_|
232
+
233
+ `;
234
+
235
+ //#endregion
236
+ //#region src/run.ts
237
+ async function main() {
238
+ const program = new commander.Command();
239
+ program.name("create-h3ravel").description("CLI to create new h3ravel app").version("0.1.0");
240
+ program.option("-n, --name <string>", "The name of your project.").option("-i, --install", "Install node_modules right away.").option("-t, --token <string>", "Kit repo authentication token.").option("-d, --desc <string>", "Project Description.").option("-k, --kit <string>\", \"Starter template kit").addArgument(new commander.Argument("[location]", "The location where this project should be created relative to the current dir.")).action(async (pathName, options) => {
241
+ console.log(altLogo, `font-family: monospace`);
242
+ let { appName, description } = await inquirer.default.prompt([{
243
+ type: "input",
244
+ name: "appName",
245
+ message: "What is the name of your project:",
246
+ default: "h3ravel",
247
+ when: () => !options.name
248
+ }, {
249
+ type: "input",
250
+ name: "description",
251
+ message: "Project Description:",
252
+ default: "Modern TypeScript runtime-agnostic web framework built on top of H3.",
253
+ when: () => !options.desc
254
+ }]).catch((err) => {
255
+ if (err instanceof __inquirer_core.AbortPromptError || err instanceof __inquirer_core.ExitPromptError) {
256
+ __h3ravel_shared.Logger.info("Thanks for trying out H3ravel.");
257
+ process.exit(0);
258
+ }
259
+ return err;
260
+ });
261
+ let { template, install, location, token } = await inquirer.default.prompt([
262
+ {
263
+ type: "input",
264
+ name: "location",
265
+ message: "Installation location relative to the current dir:",
266
+ default: (0, __h3ravel_support.slugify)(options.name ?? appName ?? (0, node_path.basename)(process.cwd()), "-"),
267
+ when: () => !pathName
268
+ },
269
+ {
270
+ type: "list",
271
+ name: "template",
272
+ message: "Choose starter template kit:",
273
+ choices: templates.map((e) => ({
274
+ name: e.name,
275
+ value: e.alias,
276
+ disabled: !e.source ? "(Unavailable at this time)" : false
277
+ })),
278
+ default: "full",
279
+ when: () => !options.kit
280
+ },
281
+ {
282
+ type: "input",
283
+ name: "token",
284
+ message: "Authentication token:",
285
+ when: () => options.kit && !options.token
286
+ },
287
+ {
288
+ type: "confirm",
289
+ name: "install",
290
+ message: "Would you want to install node_modules right away:",
291
+ default: true,
292
+ when: () => !options.install
293
+ }
294
+ ]).catch((err) => {
295
+ if (err instanceof __inquirer_core.AbortPromptError || err instanceof __inquirer_core.ExitPromptError) {
296
+ __h3ravel_shared.Logger.info("Thanks for trying out H3ravel.");
297
+ process.exit(0);
298
+ }
299
+ return err;
300
+ });
301
+ token = options.token ?? token;
302
+ appName = options.name ?? appName;
303
+ install = options.install ?? install;
304
+ template = options.kit ?? template;
305
+ location = pathName ?? location;
306
+ description = options.description ?? description;
307
+ const kit = templates.find((e) => e.alias === template);
308
+ if (kit && !kit.source) {
309
+ __h3ravel_shared.Logger.error(`ERROR: The ${kit.name} kit is not currently available`);
310
+ process.exit(1);
311
+ }
312
+ const actions = new actions_default((0, node_path.join)(process.cwd(), location), appName, description);
313
+ const spinner = (0, ora.default)(`Loading Template...`).start();
314
+ await actions.download(kit?.source ?? template, install);
315
+ spinner.info(__h3ravel_shared.Logger.parse([["Cleaning Up...", "green"]], "", false)).start();
316
+ await actions.cleanup();
317
+ spinner.info(__h3ravel_shared.Logger.parse([["Initializing Project...", "green"]], "", false)).start();
318
+ await actions.copyExampleEnv();
319
+ await actions.createTsConfig();
320
+ spinner.succeed(__h3ravel_shared.Logger.parse([["Project initialization complete!", "green"]], "", false));
321
+ await actions.complete();
322
+ });
323
+ program.parse();
324
+ process.on("SIGINT", () => {});
325
+ }
326
+ main();
327
+
328
+ //#endregion
329
+ //# sourceMappingURL=run.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run.cjs","names":["location?: string","appName?: string","description?: string","Command","Argument","AbortPromptError","ExitPromptError","Actions","Logger"],"sources":["../src/templates.ts","../src/tsconfig.ts","../src/actions.ts","../src/logo.ts","../src/run.ts"],"sourcesContent":["/*\n * create-h3ravel\n *\n * (c) H3ravel Framework\n *\n * The H3ravel framework and all it's base packages are \n * open-sourced software licensed under the MIT license.\n */\n\n/**\n * List of first party templates\n */\nexport const templates = [\n {\n name: 'Full Starter Kit',\n alias: 'full',\n hint: 'A full H3ravel application with everything possible',\n source: 'github:h3ravel/h3ravel',\n },\n {\n name: 'Lean Starter Kit',\n alias: 'lean',\n hint: 'A lean H3ravel application with just the framework core',\n source: null,\n },\n {\n name: 'API Starter Kit',\n alias: 'api',\n hint: 'Creates a H3ravel application for building JSON APIs',\n source: null\n },\n {\n name: 'Web Starter Kit',\n alias: 'web',\n hint: 'Creates a H3ravel application for building a server rendered app',\n source: null\n },\n {\n name: 'Inertia Starter Kit',\n alias: 'inertia',\n hint: 'Inertia application with a frontend framework of your choice',\n source: null\n },\n]\n","export const mainTsconfig = {\n extends: \"@h3ravel/shared/tsconfig.json\",\n compilerOptions: {\n baseUrl: \".\",\n outDir: \"dist\",\n paths: {\n \"src/*\": [\"./../src/*\"],\n \"App/*\": [\"./../src/app/*\"],\n \"root/*\": [\"./../*\"],\n \"routes/*\": [\"./../src/routes/*\"],\n \"config/*\": [\"./../src/config/*\"],\n \"resources/*\": [\"./../src/resources/*\"]\n },\n target: \"es2022\",\n module: \"es2022\",\n moduleResolution: \"Node\",\n esModuleInterop: true,\n strict: true,\n allowJs: true,\n skipLibCheck: true,\n resolveJsonModule: true,\n noEmit: true,\n experimentalDecorators: true,\n emitDecoratorMetadata: true\n },\n include: [\"./**/*.d.ts\", \"./../**/*\"],\n exclude: [\"./dist\", \"./node_modules\"]\n}\n\nexport const baseTsconfig = {\n extends: \"./.h3ravel/tsconfig.json\"\n}\n","import { baseTsconfig, mainTsconfig } from \"./tsconfig\";\nimport { basename, join, relative } from \"node:path\";\nimport { copyFile, mkdir, readFile, rm, writeFile } from \"node:fs/promises\";\nimport { detectPackageManager, installPackage } from \"@antfu/install-pkg\";\n\nimport { Logger } from \"@h3ravel/shared\";\nimport { downloadTemplate } from \"giget\";\nimport { existsSync } from \"node:fs\";\nimport { slugify } from \"@h3ravel/support\";\nimport { unlink } from \"node:fs/promises\";\n\nexport default class {\n skipInstallation?: boolean\n\n constructor(private location?: string, private appName?: string, private description?: string) {\n if (!this.location) {\n this.location = join(process.cwd(), '.temp')\n }\n }\n\n async download (template: string, install = false, auth?: string) {\n if (this.location?.includes('.temp')) {\n await rm(this.location!, { force: true, recursive: true })\n }\n\n this.skipInstallation = !install\n this.removeLockFile()\n\n return await downloadTemplate(template, {\n dir: this.location,\n auth,\n install,\n registry: (await detectPackageManager()) ?? 'npm',\n forceClean: false\n });\n }\n\n async installPackage (name: string) {\n await installPackage(name, {\n cwd: this.location,\n silent: true,\n })\n }\n\n async complete () {\n const packageManager = (await detectPackageManager()) ?? 'npm'\n\n console.log('')\n\n Logger.success('Your h3ravel project has been created successfully')\n Logger.parse([['cd ' + relative(process.cwd(), this.location!), 'cyan']])\n Logger.parse([[`${packageManager} run dev`, 'cyan']])\n Logger.parse([['Open http://localhost:4444', 'cyan']])\n\n console.log('')\n\n Logger.parse([['Have any questions', 'white']])\n Logger.parse([['Join our Discord server -', 'white'], ['https://discord.gg/hsG2A8PuGb', 'yellow']])\n Logger.parse([['Checkout the documentation -', 'white'], ['https://h3ravel.toneflix.net', 'yellow']])\n }\n\n async cleanup () {\n const pkgPath = join(this.location!, 'package.json')\n const pkg = await readFile(pkgPath!, 'utf-8').then(JSON.parse)\n\n delete pkg.packageManager\n pkg.name = slugify(this.appName ?? basename(this.location!).replace('.', ''), '-')\n if (this.description) {\n pkg.description = this.description\n }\n\n await Promise.allSettled([\n writeFile(pkgPath, JSON.stringify(pkg, null, 2)),\n this.removeLockFile(),\n rm(join(this.location!, 'pnpm-workspace.yaml'), { force: true }),\n rm(join(this.location!, 'README.md'), { force: true }),\n rm(join(this.location!, '.github'), { force: true, recursive: true }),\n ])\n }\n\n async removeLockFile () {\n if (!this.skipInstallation) {\n return\n }\n\n await Promise.allSettled([\n unlink(join(this.location!, 'package-lock.json')),\n unlink(join(this.location!, 'yarn.lock')),\n unlink(join(this.location!, 'pnpm-lock.yaml')),\n ])\n }\n\n async getBanner () {\n return await readFile(join(process.cwd(), './logo.txt'), 'utf-8')\n }\n\n async copyExampleEnv () {\n const envPath = join(this.location!, '.env')\n const exampleEnvPath = join(this.location!, '.env.example')\n\n if (existsSync(exampleEnvPath)) {\n await copyFile(exampleEnvPath, envPath)\n }\n }\n\n async createTsConfig () {\n const tscPath = join(this.location!, '.h3ravel')\n\n await mkdir(tscPath, { recursive: true })\n await writeFile(join(tscPath, 'tsconfig.json'), JSON.stringify(mainTsconfig, null, 2))\n await writeFile(join(this.location!, 'tsconfig.json'), JSON.stringify(baseTsconfig, null, 2))\n }\n}\n","export const logo = String.raw`\n 111 \n 111111111 \n 1111111111 111111 \n 111111 111 111111 \n 111111 111 111111 \n11111 111 11111 \n1111111 111 1111111 \n111 11111 111 111111 111 1111 1111 11111111 1111\n111 11111 1111 111111 111 1111 1111 1111 11111 1111\n111 11111 11111 111 1111 1111 111111111111 111111111111 1111 1111111 1111\n111 111111 1111 111 111111111111 111111 11111 1111 111 1111 11111111 1111 1111\n111 111 11111111 111 1101 1101 111111111 11111111 1111 1111111111111111101\n111 1111111111111111 1111 111 1111 1111 111 11111011 1111 111 1111111 1101 1111\n111 11111 1110111111111111 111 1111 1111 1111111101 1111 111111111 1111011 111111111 1111\n1111111 111110111110 111 1111 1111 111111 1111 11011101 10111 11111 1111\n11011 111111 11 11111 \n 111111 11101 111111 \n 111111 111 111111 \n 111111 111 111111 \n 111111111 \n 110 \n`\n\nexport const altLogo = String.raw`%c\n _ _ _____ _ \n| | | |___ / _ __ __ ___ _____| |\n| |_| | |_ \\| '__/ _ \\ \\ / / _ \\ |\n| _ |___) | | | (_| |\\ V / __/ |\n|_| |_|____/|_| \\__,_| \\_/ \\___|_|\n\n`\n","#!/usr/bin/env node\n\nimport { Argument, Command } from 'commander';\nimport inquirer from \"inquirer\";\nimport { templates } from './templates';\nimport ora from 'ora';\nimport Actions from './actions';\nimport { basename, join } from 'node:path';\nimport { slugify } from '@h3ravel/support';\nimport { AbortPromptError, ExitPromptError } from '@inquirer/core';\nimport { Logger } from '@h3ravel/shared';\nimport { altLogo } from './logo';\n\nasync function main () {\n const program = new Command();\n\n program\n .name('create-h3ravel')\n .description('CLI to create new h3ravel app')\n .version('0.1.0');\n\n program\n .option(\"-n, --name <string>\", \"The name of your project.\")\n .option('-i, --install', 'Install node_modules right away.')\n .option('-t, --token <string>', 'Kit repo authentication token.')\n .option('-d, --desc <string>', 'Project Description.')\n .option('-k, --kit <string>\", \"Starter template kit')\n .addArgument(new Argument('[location]', 'The location where this project should be created relative to the current dir.'))\n .action(async (pathName, options) => {\n\n console.log(altLogo, `font-family: monospace`)\n\n let { appName, description } = await inquirer.prompt([\n {\n type: \"input\",\n name: \"appName\",\n message: \"What is the name of your project:\",\n default: 'h3ravel',\n when: () => !options.name,\n },\n {\n type: \"input\",\n name: \"description\",\n message: \"Project Description:\",\n default: 'Modern TypeScript runtime-agnostic web framework built on top of H3.',\n when: () => !options.desc,\n }]\n ).catch(err => {\n if (err instanceof AbortPromptError || err instanceof ExitPromptError) {\n Logger.info('Thanks for trying out H3ravel.')\n process.exit(0)\n }\n return err\n })\n\n let { template, install, location, token } = await inquirer.prompt([{\n type: \"input\",\n name: \"location\",\n message: \"Installation location relative to the current dir:\",\n default: slugify(options.name ?? appName ?? basename(process.cwd()), '-'),\n when: () => !pathName,\n },\n {\n type: \"list\",\n name: \"template\",\n message: \"Choose starter template kit:\",\n choices: <never>templates.map(e => ({\n name: e.name,\n value: e.alias,\n disabled: !e.source ? '(Unavailable at this time)' : false,\n })),\n default: 'full',\n when: () => !options.kit,\n },\n {\n type: \"input\",\n name: \"token\",\n message: \"Authentication token:\",\n when: () => options.kit && !options.token,\n },\n {\n type: 'confirm',\n name: \"install\",\n message: \"Would you want to install node_modules right away:\",\n default: true,\n when: () => !options.install,\n }]).catch(err => {\n if (err instanceof AbortPromptError || err instanceof ExitPromptError) {\n Logger.info('Thanks for trying out H3ravel.')\n process.exit(0)\n }\n return err\n })\n\n token = options.token ?? token\n appName = options.name ?? appName\n install = options.install ?? install\n template = options.kit ?? template\n location = pathName ?? location\n description = options.description ?? description\n\n const kit = templates.find(e => e.alias === template)!\n\n if (kit && !kit.source) {\n Logger.error(`ERROR: The ${kit.name} kit is not currently available`)\n process.exit(1)\n }\n\n const actions = new Actions(join(process.cwd(), location), appName, description);\n\n const spinner = ora(`Loading Template...`).start();\n await actions.download(kit?.source ?? template, install);\n\n spinner.info(Logger.parse([['Cleaning Up...', 'green']], '', false)).start();\n await actions.cleanup()\n\n spinner.info(Logger.parse([['Initializing Project...', 'green']], '', false)).start();\n await actions.copyExampleEnv()\n await actions.createTsConfig()\n\n spinner.succeed(Logger.parse([['Project initialization complete!', 'green']], '', false))\n\n await actions.complete()\n });\n\n program.parse();\n\n process.on('SIGINT', () => {\n })\n}\n\nmain()\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;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OAAO,CAAC,IAAI,QAAQ;AACpB,2BAAO,MAAM,cAAc,IAAI,KAAK,iCAAiC;AACrE,WAAQ,KAAK,EAAE;;EAGnB,MAAM,UAAU,IAAIC,oCAAa,QAAQ,KAAK,EAAE,SAAS,EAAE,SAAS,YAAY;EAEhF,MAAM,2BAAc,sBAAsB,CAAC,OAAO;AAClD,QAAM,QAAQ,SAAS,KAAK,UAAU,UAAU,QAAQ;AAExD,UAAQ,KAAKC,wBAAO,MAAM,CAAC,CAAC,kBAAkB,QAAQ,CAAC,EAAE,IAAI,MAAM,CAAC,CAAC,OAAO;AAC5E,QAAM,QAAQ,SAAS;AAEvB,UAAQ,KAAKA,wBAAO,MAAM,CAAC,CAAC,2BAA2B,QAAQ,CAAC,EAAE,IAAI,MAAM,CAAC,CAAC,OAAO;AACrF,QAAM,QAAQ,gBAAgB;AAC9B,QAAM,QAAQ,gBAAgB;AAE9B,UAAQ,QAAQA,wBAAO,MAAM,CAAC,CAAC,oCAAoC,QAAQ,CAAC,EAAE,IAAI,MAAM,CAAC;AAEzF,QAAM,QAAQ,UAAU;GAC1B;AAEN,SAAQ,OAAO;AAEf,SAAQ,GAAG,gBAAgB,GACzB;;AAGN,MAAM"}
package/bin/run.d.cts ADDED
@@ -0,0 +1 @@
1
+ export { };
package/bin/run.d.ts ADDED
@@ -0,0 +1 @@
1
+ export { };
package/bin/run.js ADDED
@@ -0,0 +1,296 @@
1
+ #!/usr/bin/env node
2
+ import { Argument, Command } from "commander";
3
+ import inquirer from "inquirer";
4
+ import ora from "ora";
5
+ import { basename, join, relative } from "node:path";
6
+ import { copyFile, mkdir, readFile, rm, unlink, writeFile } from "node:fs/promises";
7
+ import { detectPackageManager, installPackage } from "@antfu/install-pkg";
8
+ import { Logger } from "@h3ravel/shared";
9
+ import { downloadTemplate } from "giget";
10
+ import { existsSync } from "node:fs";
11
+ import { slugify } from "@h3ravel/support";
12
+ import { AbortPromptError, ExitPromptError } from "@inquirer/core";
13
+
14
+ //#region src/templates.ts
15
+ /**
16
+ * List of first party templates
17
+ */
18
+ const templates = [
19
+ {
20
+ name: "Full Starter Kit",
21
+ alias: "full",
22
+ hint: "A full H3ravel application with everything possible",
23
+ source: "github:h3ravel/h3ravel"
24
+ },
25
+ {
26
+ name: "Lean Starter Kit",
27
+ alias: "lean",
28
+ hint: "A lean H3ravel application with just the framework core",
29
+ source: null
30
+ },
31
+ {
32
+ name: "API Starter Kit",
33
+ alias: "api",
34
+ hint: "Creates a H3ravel application for building JSON APIs",
35
+ source: null
36
+ },
37
+ {
38
+ name: "Web Starter Kit",
39
+ alias: "web",
40
+ hint: "Creates a H3ravel application for building a server rendered app",
41
+ source: null
42
+ },
43
+ {
44
+ name: "Inertia Starter Kit",
45
+ alias: "inertia",
46
+ hint: "Inertia application with a frontend framework of your choice",
47
+ source: null
48
+ }
49
+ ];
50
+
51
+ //#endregion
52
+ //#region src/tsconfig.ts
53
+ const mainTsconfig = {
54
+ extends: "@h3ravel/shared/tsconfig.json",
55
+ compilerOptions: {
56
+ baseUrl: ".",
57
+ outDir: "dist",
58
+ paths: {
59
+ "src/*": ["./../src/*"],
60
+ "App/*": ["./../src/app/*"],
61
+ "root/*": ["./../*"],
62
+ "routes/*": ["./../src/routes/*"],
63
+ "config/*": ["./../src/config/*"],
64
+ "resources/*": ["./../src/resources/*"]
65
+ },
66
+ target: "es2022",
67
+ module: "es2022",
68
+ moduleResolution: "Node",
69
+ esModuleInterop: true,
70
+ strict: true,
71
+ allowJs: true,
72
+ skipLibCheck: true,
73
+ resolveJsonModule: true,
74
+ noEmit: true,
75
+ experimentalDecorators: true,
76
+ emitDecoratorMetadata: true
77
+ },
78
+ include: ["./**/*.d.ts", "./../**/*"],
79
+ exclude: ["./dist", "./node_modules"]
80
+ };
81
+ const baseTsconfig = { extends: "./.h3ravel/tsconfig.json" };
82
+
83
+ //#endregion
84
+ //#region src/actions.ts
85
+ var actions_default = class {
86
+ skipInstallation;
87
+ constructor(location, appName, description) {
88
+ this.location = location;
89
+ this.appName = appName;
90
+ this.description = description;
91
+ if (!this.location) this.location = join(process.cwd(), ".temp");
92
+ }
93
+ async download(template, install = false, auth) {
94
+ if (this.location?.includes(".temp")) await rm(this.location, {
95
+ force: true,
96
+ recursive: true
97
+ });
98
+ this.skipInstallation = !install;
99
+ this.removeLockFile();
100
+ return await downloadTemplate(template, {
101
+ dir: this.location,
102
+ auth,
103
+ install,
104
+ registry: await detectPackageManager() ?? "npm",
105
+ forceClean: false
106
+ });
107
+ }
108
+ async installPackage(name) {
109
+ await installPackage(name, {
110
+ cwd: this.location,
111
+ silent: true
112
+ });
113
+ }
114
+ async complete() {
115
+ const packageManager = await detectPackageManager() ?? "npm";
116
+ console.log("");
117
+ Logger.success("Your h3ravel project has been created successfully");
118
+ Logger.parse([["cd " + relative(process.cwd(), this.location), "cyan"]]);
119
+ Logger.parse([[`${packageManager} run dev`, "cyan"]]);
120
+ Logger.parse([["Open http://localhost:4444", "cyan"]]);
121
+ console.log("");
122
+ Logger.parse([["Have any questions", "white"]]);
123
+ Logger.parse([["Join our Discord server -", "white"], ["https://discord.gg/hsG2A8PuGb", "yellow"]]);
124
+ Logger.parse([["Checkout the documentation -", "white"], ["https://h3ravel.toneflix.net", "yellow"]]);
125
+ }
126
+ async cleanup() {
127
+ const pkgPath = join(this.location, "package.json");
128
+ const pkg = await readFile(pkgPath, "utf-8").then(JSON.parse);
129
+ delete pkg.packageManager;
130
+ pkg.name = slugify(this.appName ?? basename(this.location).replace(".", ""), "-");
131
+ if (this.description) pkg.description = this.description;
132
+ await Promise.allSettled([
133
+ writeFile(pkgPath, JSON.stringify(pkg, null, 2)),
134
+ this.removeLockFile(),
135
+ rm(join(this.location, "pnpm-workspace.yaml"), { force: true }),
136
+ rm(join(this.location, "README.md"), { force: true }),
137
+ rm(join(this.location, ".github"), {
138
+ force: true,
139
+ recursive: true
140
+ })
141
+ ]);
142
+ }
143
+ async removeLockFile() {
144
+ if (!this.skipInstallation) return;
145
+ await Promise.allSettled([
146
+ unlink(join(this.location, "package-lock.json")),
147
+ unlink(join(this.location, "yarn.lock")),
148
+ unlink(join(this.location, "pnpm-lock.yaml"))
149
+ ]);
150
+ }
151
+ async getBanner() {
152
+ return await readFile(join(process.cwd(), "./logo.txt"), "utf-8");
153
+ }
154
+ async copyExampleEnv() {
155
+ const envPath = join(this.location, ".env");
156
+ const exampleEnvPath = join(this.location, ".env.example");
157
+ if (existsSync(exampleEnvPath)) await copyFile(exampleEnvPath, envPath);
158
+ }
159
+ async createTsConfig() {
160
+ const tscPath = join(this.location, ".h3ravel");
161
+ await mkdir(tscPath, { recursive: true });
162
+ await writeFile(join(tscPath, "tsconfig.json"), JSON.stringify(mainTsconfig, null, 2));
163
+ await writeFile(join(this.location, "tsconfig.json"), JSON.stringify(baseTsconfig, null, 2));
164
+ }
165
+ };
166
+
167
+ //#endregion
168
+ //#region src/logo.ts
169
+ const logo = String.raw`
170
+ 111
171
+ 111111111
172
+ 1111111111 111111
173
+ 111111 111 111111
174
+ 111111 111 111111
175
+ 11111 111 11111
176
+ 1111111 111 1111111
177
+ 111 11111 111 111111 111 1111 1111 11111111 1111
178
+ 111 11111 1111 111111 111 1111 1111 1111 11111 1111
179
+ 111 11111 11111 111 1111 1111 111111111111 111111111111 1111 1111111 1111
180
+ 111 111111 1111 111 111111111111 111111 11111 1111 111 1111 11111111 1111 1111
181
+ 111 111 11111111 111 1101 1101 111111111 11111111 1111 1111111111111111101
182
+ 111 1111111111111111 1111 111 1111 1111 111 11111011 1111 111 1111111 1101 1111
183
+ 111 11111 1110111111111111 111 1111 1111 1111111101 1111 111111111 1111011 111111111 1111
184
+ 1111111 111110111110 111 1111 1111 111111 1111 11011101 10111 11111 1111
185
+ 11011 111111 11 11111
186
+ 111111 11101 111111
187
+ 111111 111 111111
188
+ 111111 111 111111
189
+ 111111111
190
+ 110
191
+ `;
192
+ const altLogo = String.raw`%c
193
+ _ _ _____ _
194
+ | | | |___ / _ __ __ ___ _____| |
195
+ | |_| | |_ \| '__/ _ \ \ / / _ \ |
196
+ | _ |___) | | | (_| |\ V / __/ |
197
+ |_| |_|____/|_| \__,_| \_/ \___|_|
198
+
199
+ `;
200
+
201
+ //#endregion
202
+ //#region src/run.ts
203
+ async function main() {
204
+ const program = new Command();
205
+ program.name("create-h3ravel").description("CLI to create new h3ravel app").version("0.1.0");
206
+ program.option("-n, --name <string>", "The name of your project.").option("-i, --install", "Install node_modules right away.").option("-t, --token <string>", "Kit repo authentication token.").option("-d, --desc <string>", "Project Description.").option("-k, --kit <string>\", \"Starter template kit").addArgument(new Argument("[location]", "The location where this project should be created relative to the current dir.")).action(async (pathName, options) => {
207
+ console.log(altLogo, `font-family: monospace`);
208
+ let { appName, description } = await inquirer.prompt([{
209
+ type: "input",
210
+ name: "appName",
211
+ message: "What is the name of your project:",
212
+ default: "h3ravel",
213
+ when: () => !options.name
214
+ }, {
215
+ type: "input",
216
+ name: "description",
217
+ message: "Project Description:",
218
+ default: "Modern TypeScript runtime-agnostic web framework built on top of H3.",
219
+ when: () => !options.desc
220
+ }]).catch((err) => {
221
+ if (err instanceof AbortPromptError || err instanceof ExitPromptError) {
222
+ Logger.info("Thanks for trying out H3ravel.");
223
+ process.exit(0);
224
+ }
225
+ return err;
226
+ });
227
+ let { template, install, location, token } = await inquirer.prompt([
228
+ {
229
+ type: "input",
230
+ name: "location",
231
+ message: "Installation location relative to the current dir:",
232
+ default: slugify(options.name ?? appName ?? basename(process.cwd()), "-"),
233
+ when: () => !pathName
234
+ },
235
+ {
236
+ type: "list",
237
+ name: "template",
238
+ message: "Choose starter template kit:",
239
+ choices: templates.map((e) => ({
240
+ name: e.name,
241
+ value: e.alias,
242
+ disabled: !e.source ? "(Unavailable at this time)" : false
243
+ })),
244
+ default: "full",
245
+ when: () => !options.kit
246
+ },
247
+ {
248
+ type: "input",
249
+ name: "token",
250
+ message: "Authentication token:",
251
+ when: () => options.kit && !options.token
252
+ },
253
+ {
254
+ type: "confirm",
255
+ name: "install",
256
+ message: "Would you want to install node_modules right away:",
257
+ default: true,
258
+ when: () => !options.install
259
+ }
260
+ ]).catch((err) => {
261
+ if (err instanceof AbortPromptError || err instanceof ExitPromptError) {
262
+ Logger.info("Thanks for trying out H3ravel.");
263
+ process.exit(0);
264
+ }
265
+ return err;
266
+ });
267
+ token = options.token ?? token;
268
+ appName = options.name ?? appName;
269
+ install = options.install ?? install;
270
+ template = options.kit ?? template;
271
+ location = pathName ?? location;
272
+ description = options.description ?? description;
273
+ const kit = templates.find((e) => e.alias === template);
274
+ if (kit && !kit.source) {
275
+ Logger.error(`ERROR: The ${kit.name} kit is not currently available`);
276
+ process.exit(1);
277
+ }
278
+ const actions = new actions_default(join(process.cwd(), location), appName, description);
279
+ const spinner = ora(`Loading Template...`).start();
280
+ await actions.download(kit?.source ?? template, install);
281
+ spinner.info(Logger.parse([["Cleaning Up...", "green"]], "", false)).start();
282
+ await actions.cleanup();
283
+ spinner.info(Logger.parse([["Initializing Project...", "green"]], "", false)).start();
284
+ await actions.copyExampleEnv();
285
+ await actions.createTsConfig();
286
+ spinner.succeed(Logger.parse([["Project initialization complete!", "green"]], "", false));
287
+ await actions.complete();
288
+ });
289
+ program.parse();
290
+ process.on("SIGINT", () => {});
291
+ }
292
+ main();
293
+
294
+ //#endregion
295
+ export { };
296
+ //# sourceMappingURL=run.js.map
package/bin/run.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run.js","names":["location?: string","appName?: string","description?: string","Actions"],"sources":["../src/templates.ts","../src/tsconfig.ts","../src/actions.ts","../src/logo.ts","../src/run.ts"],"sourcesContent":["/*\n * create-h3ravel\n *\n * (c) H3ravel Framework\n *\n * The H3ravel framework and all it's base packages are \n * open-sourced software licensed under the MIT license.\n */\n\n/**\n * List of first party templates\n */\nexport const templates = [\n {\n name: 'Full Starter Kit',\n alias: 'full',\n hint: 'A full H3ravel application with everything possible',\n source: 'github:h3ravel/h3ravel',\n },\n {\n name: 'Lean Starter Kit',\n alias: 'lean',\n hint: 'A lean H3ravel application with just the framework core',\n source: null,\n },\n {\n name: 'API Starter Kit',\n alias: 'api',\n hint: 'Creates a H3ravel application for building JSON APIs',\n source: null\n },\n {\n name: 'Web Starter Kit',\n alias: 'web',\n hint: 'Creates a H3ravel application for building a server rendered app',\n source: null\n },\n {\n name: 'Inertia Starter Kit',\n alias: 'inertia',\n hint: 'Inertia application with a frontend framework of your choice',\n source: null\n },\n]\n","export const mainTsconfig = {\n extends: \"@h3ravel/shared/tsconfig.json\",\n compilerOptions: {\n baseUrl: \".\",\n outDir: \"dist\",\n paths: {\n \"src/*\": [\"./../src/*\"],\n \"App/*\": [\"./../src/app/*\"],\n \"root/*\": [\"./../*\"],\n \"routes/*\": [\"./../src/routes/*\"],\n \"config/*\": [\"./../src/config/*\"],\n \"resources/*\": [\"./../src/resources/*\"]\n },\n target: \"es2022\",\n module: \"es2022\",\n moduleResolution: \"Node\",\n esModuleInterop: true,\n strict: true,\n allowJs: true,\n skipLibCheck: true,\n resolveJsonModule: true,\n noEmit: true,\n experimentalDecorators: true,\n emitDecoratorMetadata: true\n },\n include: [\"./**/*.d.ts\", \"./../**/*\"],\n exclude: [\"./dist\", \"./node_modules\"]\n}\n\nexport const baseTsconfig = {\n extends: \"./.h3ravel/tsconfig.json\"\n}\n","import { baseTsconfig, mainTsconfig } from \"./tsconfig\";\nimport { basename, join, relative } from \"node:path\";\nimport { copyFile, mkdir, readFile, rm, writeFile } from \"node:fs/promises\";\nimport { detectPackageManager, installPackage } from \"@antfu/install-pkg\";\n\nimport { Logger } from \"@h3ravel/shared\";\nimport { downloadTemplate } from \"giget\";\nimport { existsSync } from \"node:fs\";\nimport { slugify } from \"@h3ravel/support\";\nimport { unlink } from \"node:fs/promises\";\n\nexport default class {\n skipInstallation?: boolean\n\n constructor(private location?: string, private appName?: string, private description?: string) {\n if (!this.location) {\n this.location = join(process.cwd(), '.temp')\n }\n }\n\n async download (template: string, install = false, auth?: string) {\n if (this.location?.includes('.temp')) {\n await rm(this.location!, { force: true, recursive: true })\n }\n\n this.skipInstallation = !install\n this.removeLockFile()\n\n return await downloadTemplate(template, {\n dir: this.location,\n auth,\n install,\n registry: (await detectPackageManager()) ?? 'npm',\n forceClean: false\n });\n }\n\n async installPackage (name: string) {\n await installPackage(name, {\n cwd: this.location,\n silent: true,\n })\n }\n\n async complete () {\n const packageManager = (await detectPackageManager()) ?? 'npm'\n\n console.log('')\n\n Logger.success('Your h3ravel project has been created successfully')\n Logger.parse([['cd ' + relative(process.cwd(), this.location!), 'cyan']])\n Logger.parse([[`${packageManager} run dev`, 'cyan']])\n Logger.parse([['Open http://localhost:4444', 'cyan']])\n\n console.log('')\n\n Logger.parse([['Have any questions', 'white']])\n Logger.parse([['Join our Discord server -', 'white'], ['https://discord.gg/hsG2A8PuGb', 'yellow']])\n Logger.parse([['Checkout the documentation -', 'white'], ['https://h3ravel.toneflix.net', 'yellow']])\n }\n\n async cleanup () {\n const pkgPath = join(this.location!, 'package.json')\n const pkg = await readFile(pkgPath!, 'utf-8').then(JSON.parse)\n\n delete pkg.packageManager\n pkg.name = slugify(this.appName ?? basename(this.location!).replace('.', ''), '-')\n if (this.description) {\n pkg.description = this.description\n }\n\n await Promise.allSettled([\n writeFile(pkgPath, JSON.stringify(pkg, null, 2)),\n this.removeLockFile(),\n rm(join(this.location!, 'pnpm-workspace.yaml'), { force: true }),\n rm(join(this.location!, 'README.md'), { force: true }),\n rm(join(this.location!, '.github'), { force: true, recursive: true }),\n ])\n }\n\n async removeLockFile () {\n if (!this.skipInstallation) {\n return\n }\n\n await Promise.allSettled([\n unlink(join(this.location!, 'package-lock.json')),\n unlink(join(this.location!, 'yarn.lock')),\n unlink(join(this.location!, 'pnpm-lock.yaml')),\n ])\n }\n\n async getBanner () {\n return await readFile(join(process.cwd(), './logo.txt'), 'utf-8')\n }\n\n async copyExampleEnv () {\n const envPath = join(this.location!, '.env')\n const exampleEnvPath = join(this.location!, '.env.example')\n\n if (existsSync(exampleEnvPath)) {\n await copyFile(exampleEnvPath, envPath)\n }\n }\n\n async createTsConfig () {\n const tscPath = join(this.location!, '.h3ravel')\n\n await mkdir(tscPath, { recursive: true })\n await writeFile(join(tscPath, 'tsconfig.json'), JSON.stringify(mainTsconfig, null, 2))\n await writeFile(join(this.location!, 'tsconfig.json'), JSON.stringify(baseTsconfig, null, 2))\n }\n}\n","export const logo = String.raw`\n 111 \n 111111111 \n 1111111111 111111 \n 111111 111 111111 \n 111111 111 111111 \n11111 111 11111 \n1111111 111 1111111 \n111 11111 111 111111 111 1111 1111 11111111 1111\n111 11111 1111 111111 111 1111 1111 1111 11111 1111\n111 11111 11111 111 1111 1111 111111111111 111111111111 1111 1111111 1111\n111 111111 1111 111 111111111111 111111 11111 1111 111 1111 11111111 1111 1111\n111 111 11111111 111 1101 1101 111111111 11111111 1111 1111111111111111101\n111 1111111111111111 1111 111 1111 1111 111 11111011 1111 111 1111111 1101 1111\n111 11111 1110111111111111 111 1111 1111 1111111101 1111 111111111 1111011 111111111 1111\n1111111 111110111110 111 1111 1111 111111 1111 11011101 10111 11111 1111\n11011 111111 11 11111 \n 111111 11101 111111 \n 111111 111 111111 \n 111111 111 111111 \n 111111111 \n 110 \n`\n\nexport const altLogo = String.raw`%c\n _ _ _____ _ \n| | | |___ / _ __ __ ___ _____| |\n| |_| | |_ \\| '__/ _ \\ \\ / / _ \\ |\n| _ |___) | | | (_| |\\ V / __/ |\n|_| |_|____/|_| \\__,_| \\_/ \\___|_|\n\n`\n","#!/usr/bin/env node\n\nimport { Argument, Command } from 'commander';\nimport inquirer from \"inquirer\";\nimport { templates } from './templates';\nimport ora from 'ora';\nimport Actions from './actions';\nimport { basename, join } from 'node:path';\nimport { slugify } from '@h3ravel/support';\nimport { AbortPromptError, ExitPromptError } from '@inquirer/core';\nimport { Logger } from '@h3ravel/shared';\nimport { altLogo } from './logo';\n\nasync function main () {\n const program = new Command();\n\n program\n .name('create-h3ravel')\n .description('CLI to create new h3ravel app')\n .version('0.1.0');\n\n program\n .option(\"-n, --name <string>\", \"The name of your project.\")\n .option('-i, --install', 'Install node_modules right away.')\n .option('-t, --token <string>', 'Kit repo authentication token.')\n .option('-d, --desc <string>', 'Project Description.')\n .option('-k, --kit <string>\", \"Starter template kit')\n .addArgument(new Argument('[location]', 'The location where this project should be created relative to the current dir.'))\n .action(async (pathName, options) => {\n\n console.log(altLogo, `font-family: monospace`)\n\n let { appName, description } = await inquirer.prompt([\n {\n type: \"input\",\n name: \"appName\",\n message: \"What is the name of your project:\",\n default: 'h3ravel',\n when: () => !options.name,\n },\n {\n type: \"input\",\n name: \"description\",\n message: \"Project Description:\",\n default: 'Modern TypeScript runtime-agnostic web framework built on top of H3.',\n when: () => !options.desc,\n }]\n ).catch(err => {\n if (err instanceof AbortPromptError || err instanceof ExitPromptError) {\n Logger.info('Thanks for trying out H3ravel.')\n process.exit(0)\n }\n return err\n })\n\n let { template, install, location, token } = await inquirer.prompt([{\n type: \"input\",\n name: \"location\",\n message: \"Installation location relative to the current dir:\",\n default: slugify(options.name ?? appName ?? basename(process.cwd()), '-'),\n when: () => !pathName,\n },\n {\n type: \"list\",\n name: \"template\",\n message: \"Choose starter template kit:\",\n choices: <never>templates.map(e => ({\n name: e.name,\n value: e.alias,\n disabled: !e.source ? '(Unavailable at this time)' : false,\n })),\n default: 'full',\n when: () => !options.kit,\n },\n {\n type: \"input\",\n name: \"token\",\n message: \"Authentication token:\",\n when: () => options.kit && !options.token,\n },\n {\n type: 'confirm',\n name: \"install\",\n message: \"Would you want to install node_modules right away:\",\n default: true,\n when: () => !options.install,\n }]).catch(err => {\n if (err instanceof AbortPromptError || err instanceof ExitPromptError) {\n Logger.info('Thanks for trying out H3ravel.')\n process.exit(0)\n }\n return err\n })\n\n token = options.token ?? token\n appName = options.name ?? appName\n install = options.install ?? install\n template = options.kit ?? template\n location = pathName ?? location\n description = options.description ?? description\n\n const kit = templates.find(e => e.alias === template)!\n\n if (kit && !kit.source) {\n Logger.error(`ERROR: The ${kit.name} kit is not currently available`)\n process.exit(1)\n }\n\n const actions = new Actions(join(process.cwd(), location), appName, description);\n\n const spinner = ora(`Loading Template...`).start();\n await actions.download(kit?.source ?? template, install);\n\n spinner.info(Logger.parse([['Cleaning Up...', 'green']], '', false)).start();\n await actions.cleanup()\n\n spinner.info(Logger.parse([['Initializing Project...', 'green']], '', false)).start();\n await actions.copyExampleEnv()\n await actions.createTsConfig()\n\n spinner.succeed(Logger.parse([['Project initialization complete!', 'green']], '', false))\n\n await actions.complete()\n });\n\n program.parse();\n\n process.on('SIGINT', () => {\n })\n}\n\nmain()\n"],"mappings":";;;;;;;;;;;;;;;;;AAYA,MAAa,YAAY;CACrB;EACI,MAAM;EACN,OAAO;EACP,MAAM;EACN,QAAQ;EACX;CACD;EACI,MAAM;EACN,OAAO;EACP,MAAM;EACN,QAAQ;EACX;CACD;EACI,MAAM;EACN,OAAO;EACP,MAAM;EACN,QAAQ;EACX;CACD;EACI,MAAM;EACN,OAAO;EACP,MAAM;EACN,QAAQ;EACX;CACD;EACI,MAAM;EACN,OAAO;EACP,MAAM;EACN,QAAQ;EACX;CACJ;;;;AC3CD,MAAa,eAAe;CAC1B,SAAS;CACT,iBAAiB;EACf,SAAS;EACT,QAAQ;EACR,OAAO;GACL,SAAS,CAAC,aAAa;GACvB,SAAS,CAAC,iBAAiB;GAC3B,UAAU,CAAC,SAAS;GACpB,YAAY,CAAC,oBAAoB;GACjC,YAAY,CAAC,oBAAoB;GACjC,eAAe,CAAC,uBAAuB;GACxC;EACD,QAAQ;EACR,QAAQ;EACR,kBAAkB;EAClB,iBAAiB;EACjB,QAAQ;EACR,SAAS;EACT,cAAc;EACd,mBAAmB;EACnB,QAAQ;EACR,wBAAwB;EACxB,uBAAuB;EACxB;CACD,SAAS,CAAC,eAAe,YAAY;CACrC,SAAS,CAAC,UAAU,iBAAiB;CACtC;AAED,MAAa,eAAe,EAC1B,SAAS,4BACV;;;;ACpBD,4BAAqB;CACjB;CAEA,YAAY,AAAQA,UAAmB,AAAQC,SAAkB,AAAQC,aAAsB;EAA3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GACzB;;AAGN,MAAM"}
package/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "create-h3ravel",
3
3
  "type": "module",
4
- "version": "0.2.0",
4
+ "version": "0.2.3",
5
5
  "description": "Scaffold a new H3ravel applications using templates and starter kits",
6
6
  "main": "build/index.js",
7
+ "private": false,
7
8
  "bin": {
8
9
  "create-h3ravel": "bin/run.js"
9
10
  },
@@ -21,12 +22,13 @@
21
22
  ],
22
23
  "dependencies": {
23
24
  "@antfu/install-pkg": "1.1.0",
25
+ "@h3ravel/shared": "^0.18.1",
24
26
  "@h3ravel/support": "^0.10.0",
25
- "chalk": "^5.5.0",
27
+ "@inquirer/core": "^10.2.2",
26
28
  "commander": "^14.0.0",
27
29
  "giget": "^2.0.0",
28
- "inquirer": "^12.9.0",
29
- "ora": "^8.2.0"
30
+ "inquirer": "^12.9.6",
31
+ "ora": "^9.0.0"
30
32
  },
31
33
  "devDependencies": {
32
34
  "@changesets/cli": "^2.29.5",
@@ -38,7 +40,7 @@
38
40
  "jest-junit": "^16.0.0",
39
41
  "ts-jest": "^29.4.1",
40
42
  "ts-node": "^10.9.2",
41
- "tsup": "^8.5.0",
43
+ "tsdown": "^0.15.4",
42
44
  "tsx": "^4.20.3",
43
45
  "typescript": "^5.4.5"
44
46
  },
@@ -46,7 +48,7 @@
46
48
  "quick:test": "pnpm jest",
47
49
  "test": "pnpm run quick:test",
48
50
  "runner": "tsx --experimental-specifier-resolution=node src/run.ts",
49
- "build": "tsup && cp logo.txt bin/logo.txt",
51
+ "build": "tsdown",
50
52
  "version": "pnpm run build",
51
53
  "unlink": "npm unlink -g create-h3ravel",
52
54
  "release": "pnpm build && pnpm changeset version && pnpm changeset publish"
package/bin/logo.txt DELETED
@@ -1,21 +0,0 @@
1
- 111
2
- 111111111
3
- 1111111111 111111
4
- 111111 111 111111
5
- 111111 111 111111
6
- 11111 111 11111
7
- 1111111 111 1111111
8
- 111 11111 111 111111 111 1111 1111 11111111 1111
9
- 111 11111 1111 111111 111 1111 1111 1111 11111 1111
10
- 111 11111 11111 111 1111 1111 111111111111 111111111111 1111 1111111 1111
11
- 111 111111 1111 111 111111111111 111111 11111 1111 111 1111 11111111 1111 1111
12
- 111 111 11111111 111 1101 1101 111111111 11111111 1111 1111111111111111101
13
- 111 1111111111111111 1111 111 1111 1111 111 11111011 1111 111 1111111 1101 1111
14
- 111 11111 1110111111111111 111 1111 1111 1111111101 1111 111111111 1111011 111111111 1111
15
- 1111111 111110111110 111 1111 1111 111111 1111 11011101 10111 11111 1111
16
- 11011 111111 11 11111
17
- 111111 11101 111111
18
- 111111 111 111111
19
- 111111 111 111111
20
- 111111111
21
- 110