create-h3ravel 0.5.1 → 0.6.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/bin/run.cjs CHANGED
@@ -22,16 +22,18 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
22
22
  }) : target, mod));
23
23
 
24
24
  //#endregion
25
- let commander = require("commander");
26
- commander = __toESM(commander);
25
+ let __h3ravel_musket = require("@h3ravel/musket");
26
+ __h3ravel_musket = __toESM(__h3ravel_musket);
27
27
  let inquirer = require("inquirer");
28
28
  inquirer = __toESM(inquirer);
29
- let ora = require("ora");
30
- ora = __toESM(ora);
31
- let __h3ravel_shared = require("@h3ravel/shared");
32
- __h3ravel_shared = __toESM(__h3ravel_shared);
29
+ let __inquirer_core = require("@inquirer/core");
30
+ __inquirer_core = __toESM(__inquirer_core);
33
31
  let node_path = require("node:path");
34
32
  node_path = __toESM(node_path);
33
+ let __h3ravel_support = require("@h3ravel/support");
34
+ __h3ravel_support = __toESM(__h3ravel_support);
35
+ let __h3ravel_shared = require("@h3ravel/shared");
36
+ __h3ravel_shared = __toESM(__h3ravel_shared);
35
37
  let node_fs_promises = require("node:fs/promises");
36
38
  node_fs_promises = __toESM(node_fs_promises);
37
39
  let __antfu_install_pkg = require("@antfu/install-pkg");
@@ -40,11 +42,43 @@ let giget = require("giget");
40
42
  giget = __toESM(giget);
41
43
  let node_fs = require("node:fs");
42
44
  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);
45
+ let ora = require("ora");
46
+ ora = __toESM(ora);
47
+
48
+ //#region src/logo.ts
49
+ const logo = String.raw`
50
+ 111
51
+ 111111111
52
+ 1111111111 111111
53
+ 111111 111 111111
54
+ 111111 111 111111
55
+ 11111 111 11111
56
+ 1111111 111 1111111
57
+ 111 11111 111 111111 111 1111 1111 11111111 1111
58
+ 111 11111 1111 111111 111 1111 1111 1111 11111 1111
59
+ 111 11111 11111 111 1111 1111 111111111111 111111111111 1111 1111111 1111
60
+ 111 111111 1111 111 111111111111 111111 11111 1111 111 1111 11111111 1111 1111
61
+ 111 111 11111111 111 1101 1101 111111111 11111111 1111 1111111111111111101
62
+ 111 1111111111111111 1111 111 1111 1111 111 11111011 1111 111 1111111 1101 1111
63
+ 111 11111 1110111111111111 111 1111 1111 1111111101 1111 111111111 1111011 111111111 1111
64
+ 1111111 111110111110 111 1111 1111 111111 1111 11011101 10111 11111 1111
65
+ 11011 111111 11 11111
66
+ 111111 11101 111111
67
+ 111111 111 111111
68
+ 111111 111 111111
69
+ 111111111
70
+ 110
71
+ `;
72
+ const altLogo = String.raw`%c
73
+ _ _ _____ _
74
+ | | | |___ / _ __ __ ___ _____| |
75
+ | |_| | |_ \| '__/ _ \ \ / / _ \ |
76
+ | _ |___) | | | (_| |\ V / __/ |
77
+ |_| |_|____/|_| \__,_| \_/ \___|_|
78
+
79
+ `;
47
80
 
81
+ //#endregion
48
82
  //#region src/templates.ts
49
83
  /**
50
84
  * List of first party templates
@@ -139,7 +173,7 @@ var actions_default = class {
139
173
  const pkgPath = (0, node_path.join)(this.location, "package.json");
140
174
  const pkg = await (0, node_fs_promises.readFile)(pkgPath, "utf-8").then(JSON.parse);
141
175
  delete pkg.packageManager;
142
- pkg.name = (0, __h3ravel_support.slugify)(this.appName ?? (0, node_path.basename)(this.location).replace(".", ""), "-");
176
+ pkg.name = __h3ravel_support.Str.slugify(this.appName ?? (0, node_path.basename)(this.location).replace(".", ""), "-");
143
177
  pkg.scripts = __h3ravel_shared.packageJsonScript;
144
178
  if (this.description) pkg.description = this.description;
145
179
  await Promise.allSettled([
@@ -179,45 +213,21 @@ var actions_default = class {
179
213
  };
180
214
 
181
215
  //#endregion
182
- //#region src/logo.ts
183
- const logo = String.raw`
184
- 111
185
- 111111111
186
- 1111111111 111111
187
- 111111 111 111111
188
- 111111 111 111111
189
- 11111 111 11111
190
- 1111111 111 1111111
191
- 111 11111 111 111111 111 1111 1111 11111111 1111
192
- 111 11111 1111 111111 111 1111 1111 1111 11111 1111
193
- 111 11111 11111 111 1111 1111 111111111111 111111111111 1111 1111111 1111
194
- 111 111111 1111 111 111111111111 111111 11111 1111 111 1111 11111111 1111 1111
195
- 111 111 11111111 111 1101 1101 111111111 11111111 1111 1111111111111111101
196
- 111 1111111111111111 1111 111 1111 1111 111 11111011 1111 111 1111111 1101 1111
197
- 111 11111 1110111111111111 111 1111 1111 1111111101 1111 111111111 1111011 111111111 1111
198
- 1111111 111110111110 111 1111 1111 111111 1111 11011101 10111 11111 1111
199
- 11011 111111 11 11111
200
- 111111 11101 111111
201
- 111111 111 111111
202
- 111111 111 111111
203
- 111111111
204
- 110
205
- `;
206
- const altLogo = String.raw`%c
207
- _ _ _____ _
208
- | | | |___ / _ __ __ ___ _____| |
209
- | |_| | |_ \| '__/ _ \ \ / / _ \ |
210
- | _ |___) | | | (_| |\ V / __/ |
211
- |_| |_|____/|_| \__,_| \_/ \___|_|
212
-
213
- `;
214
-
215
- //#endregion
216
- //#region src/run.ts
217
- async function main() {
218
- const program = new commander.Command();
219
- program.name("create-h3ravel").description("CLI to create new h3ravel app").version("0.1.0");
220
- 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.").option("-o, --overwrite", "Overwrite the installation directory if it is not empty.").addArgument(new commander.Argument("[location]", "The location where this project should be created relative to the current dir.")).action(async (pathName, options) => {
216
+ //#region src/Commands/CreateH3ravelCommand.ts
217
+ var CreateH3ravelCommand = class extends __h3ravel_musket.Command {
218
+ signature = `create-h3ravel
219
+ {location?: The location where this project should be created relative to the current dir.}
220
+ {--n|name?: The name of your project.}
221
+ {--i|install: Install node_modules right away}
222
+ {--t|token?: Kit repo authentication token.}
223
+ {--d|desc?: Project Description.}
224
+ {--k|kit?: Starter template kit.}
225
+ {--o|overwrite: Overwrite the installation directory if it is not empty.}
226
+ `;
227
+ description = "Display a personalized greeting.";
228
+ async handle() {
229
+ const options = this.options();
230
+ const pathName = this.argument("location");
221
231
  console.log(altLogo, `font-family: monospace`);
222
232
  let { appName, description } = await inquirer.default.prompt([{
223
233
  type: "input",
@@ -233,7 +243,7 @@ async function main() {
233
243
  when: () => !options.desc
234
244
  }]).catch((err) => {
235
245
  if (err instanceof __inquirer_core.AbortPromptError || err instanceof __inquirer_core.ExitPromptError) {
236
- __h3ravel_shared.Logger.info("Thanks for trying out H3ravel.");
246
+ this.info("Thanks for trying out H3ravel.");
237
247
  process.exit(0);
238
248
  }
239
249
  return err;
@@ -243,7 +253,7 @@ async function main() {
243
253
  type: "input",
244
254
  name: "location",
245
255
  message: "Installation location relative to the current dir:",
246
- default: (0, __h3ravel_support.slugify)(options.name ?? appName ?? (0, node_path.basename)(process.cwd()), "-"),
256
+ default: __h3ravel_support.Str.slugify(options.name ?? appName ?? (0, node_path.basename)(process.cwd()), "-"),
247
257
  when: () => !pathName
248
258
  },
249
259
  {
@@ -273,7 +283,7 @@ async function main() {
273
283
  }
274
284
  ]).catch((err) => {
275
285
  if (err instanceof __inquirer_core.AbortPromptError || err instanceof __inquirer_core.ExitPromptError) {
276
- __h3ravel_shared.Logger.info("Thanks for trying out H3ravel.");
286
+ this.info("Thanks for trying out H3ravel.");
277
287
  process.exit(0);
278
288
  }
279
289
  return err;
@@ -286,7 +296,7 @@ async function main() {
286
296
  description = options.description ?? description;
287
297
  const kit = templates.find((e) => e.alias === template);
288
298
  if (kit && !kit.source) {
289
- __h3ravel_shared.Logger.error(`ERROR: The ${kit.name} kit is not currently available`);
299
+ this.error(`ERROR: The ${kit.name} kit is not currently available`);
290
300
  process.exit(1);
291
301
  }
292
302
  const actions = new actions_default((0, node_path.join)(process.cwd(), location), appName, description);
@@ -299,11 +309,13 @@ async function main() {
299
309
  await actions.createTsConfig();
300
310
  spinner.succeed(__h3ravel_shared.Logger.parse([["Project initialization complete!", "green"]], "", false));
301
311
  await actions.complete(install);
302
- });
303
- program.parse();
304
- process.on("SIGINT", () => {});
305
- }
306
- main();
312
+ }
313
+ };
314
+
315
+ //#endregion
316
+ //#region src/run.ts
317
+ var Application = class {};
318
+ __h3ravel_musket.Kernel.init(new Application(), { rootCommand: CreateH3ravelCommand });
307
319
 
308
320
  //#endregion
309
321
  //# sourceMappingURL=run.cjs.map
package/bin/run.cjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"run.cjs","names":["location?: string","appName?: string","description?: string","Resolver","packageJsonScript","mainTsconfig","baseTsconfig","Command","Argument","AbortPromptError","ExitPromptError","Actions","Logger"],"sources":["../src/templates.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","import { Resolver, baseTsconfig, mainTsconfig, packageJsonScript } from \"@h3ravel/shared\";\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, overwrite = false) {\n if (this.location?.includes('.temp') || (overwrite && existsSync(this.location!))) {\n await rm(this.location!, { force: true, recursive: true })\n } else if (existsSync(this.location!)) {\n console.log('\\n')\n Logger.parse([[' ERROR ', 'bgRed'], [this.location!, ['gray', 'italic']], ['is not empty.', 'white']], ' ')\n console.log('')\n process.exit(0)\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 (installed = false) {\n console.log('')\n\n Logger.success('Your h3ravel project has been created successfully')\n Logger.parse([['cd', 'cyan'], ['./' + relative(process.cwd(), this.location!), 'green']])\n if (!installed) {\n Logger.parse([[await Resolver.getPakageInstallCommand(), 'cyan']])\n }\n Logger.parse([['npx', 'cyan'], ['musket fire', 'green']], ' ')\n Logger.parse([['Open http://localhost:3000', '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 pkg.scripts = packageJsonScript\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 if (!existsSync(join(this.location!, 'src/database/db.sqlite'))) {\n await writeFile(join(this.location!, 'src/database/db.sqlite'), '')\n }\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 .option('-o, --overwrite', 'Overwrite the installation directory if it is not empty.')\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, undefined, options.overwrite);\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(install)\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,MA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AAM,2BAAc,sBAAsB,CAAC,OAAO;AAClD,QAAM,QAAQ,SAAS,KAAK,UAAU,UAAU,SAAS,QAAW,QAAQ,UAAU;AAEtF,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,SAAS,QAAQ;GACjC;AAEN,SAAQ,OAAO;AAEf,SAAQ,GAAG,gBAAgB,GACzB;;AAGN,MAAM"}
1
+ {"version":3,"file":"run.cjs","names":["location?: string","appName?: string","description?: string","Resolver","Str","packageJsonScript","mainTsconfig","baseTsconfig","Command","AbortPromptError","ExitPromptError","Str","Actions","Logger","Kernel"],"sources":["../src/logo.ts","../src/templates.ts","../src/actions.ts","../src/Commands/CreateH3ravelCommand.ts","../src/run.ts"],"sourcesContent":["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","/*\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","import { Logger, Resolver, baseTsconfig, mainTsconfig, packageJsonScript } from \"@h3ravel/shared\";\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 { Str } from \"@h3ravel/support\";\nimport { downloadTemplate } from \"giget\";\nimport { existsSync } from \"node:fs\";\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, overwrite = false) {\n if (this.location?.includes('.temp') || (overwrite && existsSync(this.location!))) {\n await rm(this.location!, { force: true, recursive: true })\n } else if (existsSync(this.location!)) {\n console.log('\\n')\n Logger.parse([[' ERROR ', 'bgRed'], [this.location!, ['gray', 'italic']], ['is not empty.', 'white']], ' ')\n console.log('')\n process.exit(0)\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 (installed = false) {\n console.log('')\n\n Logger.success('Your h3ravel project has been created successfully')\n Logger.parse([['cd', 'cyan'], ['./' + relative(process.cwd(), this.location!), 'green']])\n if (!installed) {\n Logger.parse([[await Resolver.getPakageInstallCommand(), 'cyan']])\n }\n Logger.parse([['npx', 'cyan'], ['musket fire', 'green']], ' ')\n Logger.parse([['Open http://localhost:3000', '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 = Str.slugify(this.appName ?? basename(this.location!).replace('.', ''), '-')\n pkg.scripts = packageJsonScript\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 if (!existsSync(join(this.location!, 'src/database/db.sqlite'))) {\n await writeFile(join(this.location!, 'src/database/db.sqlite'), '')\n }\n }\n}\n","import { Command } from \"@h3ravel/musket\";\nimport { altLogo } from \"src/logo\";\nimport inquirer from \"inquirer\";\nimport { AbortPromptError, ExitPromptError } from \"@inquirer/core\";\nimport { basename, join } from \"node:path\";\nimport { templates } from \"src/templates\";\nimport { Str } from \"@h3ravel/support\";\nimport Actions from 'src/actions';\nimport ora from \"ora\";\nimport { Logger } from \"@h3ravel/shared\";\n\nexport class CreateH3ravelCommand extends Command {\n protected signature = `create-h3ravel\n {location?: The location where this project should be created relative to the current dir.}\n {--n|name?: The name of your project.}\n {--i|install: Install node_modules right away}\n {--t|token?: Kit repo authentication token.}\n {--d|desc?: Project Description.}\n {--k|kit?: Starter template kit.}\n {--o|overwrite: Overwrite the installation directory if it is not empty.}\n `;\n protected description = 'Display a personalized greeting.';\n\n async handle () {\n const options = this.options();\n const pathName = this.argument('location');\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 this.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: Str.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 this.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 this.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, undefined, options.overwrite);\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(install)\n }\n}\n","#!/usr/bin/env node\n\nimport { CreateH3ravelCommand } from './Commands/CreateH3ravelCommand';\nimport { Kernel } from '@h3ravel/musket';\n\nclass Application { }\n\nKernel.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,cAAc,IAAI,KAAK,iCAAiC;AACnE,WAAQ,KAAK,EAAE;;EAGnB,MAAM,UAAU,IAAIE,oCAAa,QAAQ,KAAK,EAAE,SAAS,EAAE,SAAS,YAAY;EAEhF,MAAM,2BAAc,sBAAsB,CAAC,OAAO;AAClD,QAAM,QAAQ,SAAS,KAAK,UAAU,UAAU,SAAS,QAAW,QAAQ,UAAU;AAEtF,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,SAAS,QAAQ;;;;;;AClHvC,IAAM,cAAN,MAAkB;AAElBC,wBAAO,KAAK,IAAI,aAAa,EAAE,EAC3B,aAAa,sBAChB,CAAC"}
package/bin/run.js CHANGED
@@ -1,16 +1,50 @@
1
1
  #!/usr/bin/env node
2
- import { Argument, Command } from "commander";
2
+ import { Command, Kernel } from "@h3ravel/musket";
3
3
  import inquirer from "inquirer";
4
- import ora from "ora";
5
- import { Logger, Resolver, baseTsconfig, mainTsconfig, packageJsonScript } from "@h3ravel/shared";
4
+ import { AbortPromptError, ExitPromptError } from "@inquirer/core";
6
5
  import { basename, join, relative } from "node:path";
6
+ import { Str } from "@h3ravel/support";
7
+ import { Logger, Resolver, baseTsconfig, mainTsconfig, packageJsonScript } from "@h3ravel/shared";
7
8
  import { copyFile, mkdir, readFile, rm, unlink, writeFile } from "node:fs/promises";
8
9
  import { detectPackageManager, installPackage } from "@antfu/install-pkg";
9
10
  import { downloadTemplate } from "giget";
10
11
  import { existsSync } from "node:fs";
11
- import { slugify } from "@h3ravel/support";
12
- import { AbortPromptError, ExitPromptError } from "@inquirer/core";
12
+ import ora from "ora";
13
+
14
+ //#region src/logo.ts
15
+ const logo = String.raw`
16
+ 111
17
+ 111111111
18
+ 1111111111 111111
19
+ 111111 111 111111
20
+ 111111 111 111111
21
+ 11111 111 11111
22
+ 1111111 111 1111111
23
+ 111 11111 111 111111 111 1111 1111 11111111 1111
24
+ 111 11111 1111 111111 111 1111 1111 1111 11111 1111
25
+ 111 11111 11111 111 1111 1111 111111111111 111111111111 1111 1111111 1111
26
+ 111 111111 1111 111 111111111111 111111 11111 1111 111 1111 11111111 1111 1111
27
+ 111 111 11111111 111 1101 1101 111111111 11111111 1111 1111111111111111101
28
+ 111 1111111111111111 1111 111 1111 1111 111 11111011 1111 111 1111111 1101 1111
29
+ 111 11111 1110111111111111 111 1111 1111 1111111101 1111 111111111 1111011 111111111 1111
30
+ 1111111 111110111110 111 1111 1111 111111 1111 11011101 10111 11111 1111
31
+ 11011 111111 11 11111
32
+ 111111 11101 111111
33
+ 111111 111 111111
34
+ 111111 111 111111
35
+ 111111111
36
+ 110
37
+ `;
38
+ const altLogo = String.raw`%c
39
+ _ _ _____ _
40
+ | | | |___ / _ __ __ ___ _____| |
41
+ | |_| | |_ \| '__/ _ \ \ / / _ \ |
42
+ | _ |___) | | | (_| |\ V / __/ |
43
+ |_| |_|____/|_| \__,_| \_/ \___|_|
13
44
 
45
+ `;
46
+
47
+ //#endregion
14
48
  //#region src/templates.ts
15
49
  /**
16
50
  * List of first party templates
@@ -105,7 +139,7 @@ var actions_default = class {
105
139
  const pkgPath = join(this.location, "package.json");
106
140
  const pkg = await readFile(pkgPath, "utf-8").then(JSON.parse);
107
141
  delete pkg.packageManager;
108
- pkg.name = slugify(this.appName ?? basename(this.location).replace(".", ""), "-");
142
+ pkg.name = Str.slugify(this.appName ?? basename(this.location).replace(".", ""), "-");
109
143
  pkg.scripts = packageJsonScript;
110
144
  if (this.description) pkg.description = this.description;
111
145
  await Promise.allSettled([
@@ -145,45 +179,21 @@ var actions_default = class {
145
179
  };
146
180
 
147
181
  //#endregion
148
- //#region src/logo.ts
149
- const logo = String.raw`
150
- 111
151
- 111111111
152
- 1111111111 111111
153
- 111111 111 111111
154
- 111111 111 111111
155
- 11111 111 11111
156
- 1111111 111 1111111
157
- 111 11111 111 111111 111 1111 1111 11111111 1111
158
- 111 11111 1111 111111 111 1111 1111 1111 11111 1111
159
- 111 11111 11111 111 1111 1111 111111111111 111111111111 1111 1111111 1111
160
- 111 111111 1111 111 111111111111 111111 11111 1111 111 1111 11111111 1111 1111
161
- 111 111 11111111 111 1101 1101 111111111 11111111 1111 1111111111111111101
162
- 111 1111111111111111 1111 111 1111 1111 111 11111011 1111 111 1111111 1101 1111
163
- 111 11111 1110111111111111 111 1111 1111 1111111101 1111 111111111 1111011 111111111 1111
164
- 1111111 111110111110 111 1111 1111 111111 1111 11011101 10111 11111 1111
165
- 11011 111111 11 11111
166
- 111111 11101 111111
167
- 111111 111 111111
168
- 111111 111 111111
169
- 111111111
170
- 110
171
- `;
172
- const altLogo = String.raw`%c
173
- _ _ _____ _
174
- | | | |___ / _ __ __ ___ _____| |
175
- | |_| | |_ \| '__/ _ \ \ / / _ \ |
176
- | _ |___) | | | (_| |\ V / __/ |
177
- |_| |_|____/|_| \__,_| \_/ \___|_|
178
-
179
- `;
180
-
181
- //#endregion
182
- //#region src/run.ts
183
- async function main() {
184
- const program = new Command();
185
- program.name("create-h3ravel").description("CLI to create new h3ravel app").version("0.1.0");
186
- 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.").option("-o, --overwrite", "Overwrite the installation directory if it is not empty.").addArgument(new Argument("[location]", "The location where this project should be created relative to the current dir.")).action(async (pathName, options) => {
182
+ //#region src/Commands/CreateH3ravelCommand.ts
183
+ var CreateH3ravelCommand = class extends Command {
184
+ signature = `create-h3ravel
185
+ {location?: The location where this project should be created relative to the current dir.}
186
+ {--n|name?: The name of your project.}
187
+ {--i|install: Install node_modules right away}
188
+ {--t|token?: Kit repo authentication token.}
189
+ {--d|desc?: Project Description.}
190
+ {--k|kit?: Starter template kit.}
191
+ {--o|overwrite: Overwrite the installation directory if it is not empty.}
192
+ `;
193
+ description = "Display a personalized greeting.";
194
+ async handle() {
195
+ const options = this.options();
196
+ const pathName = this.argument("location");
187
197
  console.log(altLogo, `font-family: monospace`);
188
198
  let { appName, description } = await inquirer.prompt([{
189
199
  type: "input",
@@ -199,7 +209,7 @@ async function main() {
199
209
  when: () => !options.desc
200
210
  }]).catch((err) => {
201
211
  if (err instanceof AbortPromptError || err instanceof ExitPromptError) {
202
- Logger.info("Thanks for trying out H3ravel.");
212
+ this.info("Thanks for trying out H3ravel.");
203
213
  process.exit(0);
204
214
  }
205
215
  return err;
@@ -209,7 +219,7 @@ async function main() {
209
219
  type: "input",
210
220
  name: "location",
211
221
  message: "Installation location relative to the current dir:",
212
- default: slugify(options.name ?? appName ?? basename(process.cwd()), "-"),
222
+ default: Str.slugify(options.name ?? appName ?? basename(process.cwd()), "-"),
213
223
  when: () => !pathName
214
224
  },
215
225
  {
@@ -239,7 +249,7 @@ async function main() {
239
249
  }
240
250
  ]).catch((err) => {
241
251
  if (err instanceof AbortPromptError || err instanceof ExitPromptError) {
242
- Logger.info("Thanks for trying out H3ravel.");
252
+ this.info("Thanks for trying out H3ravel.");
243
253
  process.exit(0);
244
254
  }
245
255
  return err;
@@ -252,7 +262,7 @@ async function main() {
252
262
  description = options.description ?? description;
253
263
  const kit = templates.find((e) => e.alias === template);
254
264
  if (kit && !kit.source) {
255
- Logger.error(`ERROR: The ${kit.name} kit is not currently available`);
265
+ this.error(`ERROR: The ${kit.name} kit is not currently available`);
256
266
  process.exit(1);
257
267
  }
258
268
  const actions = new actions_default(join(process.cwd(), location), appName, description);
@@ -265,11 +275,13 @@ async function main() {
265
275
  await actions.createTsConfig();
266
276
  spinner.succeed(Logger.parse([["Project initialization complete!", "green"]], "", false));
267
277
  await actions.complete(install);
268
- });
269
- program.parse();
270
- process.on("SIGINT", () => {});
271
- }
272
- main();
278
+ }
279
+ };
280
+
281
+ //#endregion
282
+ //#region src/run.ts
283
+ var Application = class {};
284
+ Kernel.init(new Application(), { rootCommand: CreateH3ravelCommand });
273
285
 
274
286
  //#endregion
275
287
  export { };
package/bin/run.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"run.js","names":["location?: string","appName?: string","description?: string","Actions"],"sources":["../src/templates.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","import { Resolver, baseTsconfig, mainTsconfig, packageJsonScript } from \"@h3ravel/shared\";\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, overwrite = false) {\n if (this.location?.includes('.temp') || (overwrite && existsSync(this.location!))) {\n await rm(this.location!, { force: true, recursive: true })\n } else if (existsSync(this.location!)) {\n console.log('\\n')\n Logger.parse([[' ERROR ', 'bgRed'], [this.location!, ['gray', 'italic']], ['is not empty.', 'white']], ' ')\n console.log('')\n process.exit(0)\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 (installed = false) {\n console.log('')\n\n Logger.success('Your h3ravel project has been created successfully')\n Logger.parse([['cd', 'cyan'], ['./' + relative(process.cwd(), this.location!), 'green']])\n if (!installed) {\n Logger.parse([[await Resolver.getPakageInstallCommand(), 'cyan']])\n }\n Logger.parse([['npx', 'cyan'], ['musket fire', 'green']], ' ')\n Logger.parse([['Open http://localhost:3000', '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 pkg.scripts = packageJsonScript\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 if (!existsSync(join(this.location!, 'src/database/db.sqlite'))) {\n await writeFile(join(this.location!, 'src/database/db.sqlite'), '')\n }\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 .option('-o, --overwrite', 'Overwrite the installation directory if it is not empty.')\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, undefined, options.overwrite);\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(install)\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;;;;AChCD,4BAAqB;CACjB;CAEA,YAAY,AA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gBAAQ,KAAK,QAAQ,KAAK,EAAE,SAAS,EAAE,SAAS,YAAY;EAEhF,MAAM,UAAU,IAAI,sBAAsB,CAAC,OAAO;AAClD,QAAM,QAAQ,SAAS,KAAK,UAAU,UAAU,SAAS,QAAW,QAAQ,UAAU;AAEtF,UAAQ,KAAK,OAAO,MAAM,CAAC,CAAC,kBAAkB,QAAQ,CAAC,EAAE,IAAI,MAAM,CAAC,CAAC,OAAO;AAC5E,QAAM,QAAQ,SAAS;AAEvB,UAAQ,KAAK,OAAO,MAAM,CAAC,CAAC,2BAA2B,QAAQ,CAAC,EAAE,IAAI,MAAM,CAAC,CAAC,OAAO;AACrF,QAAM,QAAQ,gBAAgB;AAC9B,QAAM,QAAQ,gBAAgB;AAE9B,UAAQ,QAAQ,OAAO,MAAM,CAAC,CAAC,oCAAoC,QAAQ,CAAC,EAAE,IAAI,MAAM,CAAC;AAEzF,QAAM,QAAQ,SAAS,QAAQ;GACjC;AAEN,SAAQ,OAAO;AAEf,SAAQ,GAAG,gBAAgB,GACzB;;AAGN,MAAM"}
1
+ {"version":3,"file":"run.js","names":["location?: string","appName?: string","description?: string","Actions"],"sources":["../src/logo.ts","../src/templates.ts","../src/actions.ts","../src/Commands/CreateH3ravelCommand.ts","../src/run.ts"],"sourcesContent":["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","/*\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","import { Logger, Resolver, baseTsconfig, mainTsconfig, packageJsonScript } from \"@h3ravel/shared\";\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 { Str } from \"@h3ravel/support\";\nimport { downloadTemplate } from \"giget\";\nimport { existsSync } from \"node:fs\";\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, overwrite = false) {\n if (this.location?.includes('.temp') || (overwrite && existsSync(this.location!))) {\n await rm(this.location!, { force: true, recursive: true })\n } else if (existsSync(this.location!)) {\n console.log('\\n')\n Logger.parse([[' ERROR ', 'bgRed'], [this.location!, ['gray', 'italic']], ['is not empty.', 'white']], ' ')\n console.log('')\n process.exit(0)\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 (installed = false) {\n console.log('')\n\n Logger.success('Your h3ravel project has been created successfully')\n Logger.parse([['cd', 'cyan'], ['./' + relative(process.cwd(), this.location!), 'green']])\n if (!installed) {\n Logger.parse([[await Resolver.getPakageInstallCommand(), 'cyan']])\n }\n Logger.parse([['npx', 'cyan'], ['musket fire', 'green']], ' ')\n Logger.parse([['Open http://localhost:3000', '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 = Str.slugify(this.appName ?? basename(this.location!).replace('.', ''), '-')\n pkg.scripts = packageJsonScript\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 if (!existsSync(join(this.location!, 'src/database/db.sqlite'))) {\n await writeFile(join(this.location!, 'src/database/db.sqlite'), '')\n }\n }\n}\n","import { Command } from \"@h3ravel/musket\";\nimport { altLogo } from \"src/logo\";\nimport inquirer from \"inquirer\";\nimport { AbortPromptError, ExitPromptError } from \"@inquirer/core\";\nimport { basename, join } from \"node:path\";\nimport { templates } from \"src/templates\";\nimport { Str } from \"@h3ravel/support\";\nimport Actions from 'src/actions';\nimport ora from \"ora\";\nimport { Logger } from \"@h3ravel/shared\";\n\nexport class CreateH3ravelCommand extends Command {\n protected signature = `create-h3ravel\n {location?: The location where this project should be created relative to the current dir.}\n {--n|name?: The name of your project.}\n {--i|install: Install node_modules right away}\n {--t|token?: Kit repo authentication token.}\n {--d|desc?: Project Description.}\n {--k|kit?: Starter template kit.}\n {--o|overwrite: Overwrite the installation directory if it is not empty.}\n `;\n protected description = 'Display a personalized greeting.';\n\n async handle () {\n const options = this.options();\n const pathName = this.argument('location');\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 this.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: Str.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 this.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 this.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, undefined, options.overwrite);\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(install)\n }\n}\n","#!/usr/bin/env node\n\nimport { CreateH3ravelCommand } from './Commands/CreateH3ravelCommand';\nimport { Kernel } from '@h3ravel/musket';\n\nclass Application { }\n\nKernel.init(new Application(), {\n r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,eAAe;EAErC,MAAM,MAAM,UAAU,MAAK,MAAK,EAAE,UAAU,SAAS;AAErD,MAAI,OAAO,CAAC,IAAI,QAAQ;AACpB,QAAK,MAAM,cAAc,IAAI,KAAK,iCAAiC;AACnE,WAAQ,KAAK,EAAE;;EAGnB,MAAM,UAAU,IAAIC,gBAAQ,KAAK,QAAQ,KAAK,EAAE,SAAS,EAAE,SAAS,YAAY;EAEhF,MAAM,UAAU,IAAI,sBAAsB,CAAC,OAAO;AAClD,QAAM,QAAQ,SAAS,KAAK,UAAU,UAAU,SAAS,QAAW,QAAQ,UAAU;AAEtF,UAAQ,KAAK,OAAO,MAAM,CAAC,CAAC,kBAAkB,QAAQ,CAAC,EAAE,IAAI,MAAM,CAAC,CAAC,OAAO;AAC5E,QAAM,QAAQ,SAAS;AAEvB,UAAQ,KAAK,OAAO,MAAM,CAAC,CAAC,2BAA2B,QAAQ,CAAC,EAAE,IAAI,MAAM,CAAC,CAAC,OAAO;AACrF,QAAM,QAAQ,gBAAgB;AAC9B,QAAM,QAAQ,gBAAgB;AAE9B,UAAQ,QAAQ,OAAO,MAAM,CAAC,CAAC,oCAAoC,QAAQ,CAAC,EAAE,IAAI,MAAM,CAAC;AAEzF,QAAM,QAAQ,SAAS,QAAQ;;;;;;AClHvC,IAAM,cAAN,MAAkB;AAElB,OAAO,KAAK,IAAI,aAAa,EAAE,EAC3B,aAAa,sBAChB,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "create-h3ravel",
3
3
  "type": "module",
4
- "version": "0.5.1",
4
+ "version": "0.6.1",
5
5
  "description": "Scaffold a new H3ravel applications using templates and starter kits",
6
6
  "main": "build/index.js",
7
7
  "private": false,
@@ -25,10 +25,10 @@
25
25
  ],
26
26
  "dependencies": {
27
27
  "@antfu/install-pkg": "1.1.0",
28
+ "@h3ravel/musket": "^0.2.0",
28
29
  "@h3ravel/shared": "^0.22.2",
29
30
  "@h3ravel/support": "^0.14.1",
30
31
  "@inquirer/core": "^10.2.2",
31
- "commander": "^14.0.0",
32
32
  "giget": "^2.0.0",
33
33
  "inquirer": "^12.9.6",
34
34
  "ora": "^9.0.0"
@@ -36,19 +36,17 @@
36
36
  "devDependencies": {
37
37
  "@changesets/cli": "^2.29.5",
38
38
  "@swc/core": "^1.6.1",
39
- "@types/jest": "^30.0.0",
40
39
  "@types/node": "^20.14.5",
41
40
  "eslint": "^9.32.0",
42
- "jest": "^30.0.5",
43
- "jest-junit": "^16.0.0",
44
- "ts-jest": "^29.4.1",
45
41
  "ts-node": "^10.9.2",
46
42
  "tsdown": "^0.15.4",
47
43
  "tsx": "^4.20.3",
48
- "typescript": "^5.4.5"
44
+ "typescript": "^5.4.5",
45
+ "vite-tsconfig-paths": "^5.1.4",
46
+ "vitest": "^3.2.4"
49
47
  },
50
48
  "scripts": {
51
- "quick:test": "pnpm jest",
49
+ "quick:test": "pnpm vitest",
52
50
  "test": "pnpm run quick:test",
53
51
  "runner": "tsx --experimental-specifier-resolution=node src/run.ts",
54
52
  "build": "tsdown",