create-h3ravel 0.6.3 → 0.6.4

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
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- //#region rolldown:runtime
2
+ //#region \0rolldown/runtime.js
3
3
  var __create = Object.create;
4
4
  var __defProp = Object.defineProperty;
5
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -20,33 +20,21 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
20
20
  value: mod,
21
21
  enumerable: true
22
22
  }) : target, mod));
23
-
24
23
  //#endregion
25
- let __h3ravel_musket = require("@h3ravel/musket");
26
- __h3ravel_musket = __toESM(__h3ravel_musket);
24
+ let _h3ravel_musket = require("@h3ravel/musket");
27
25
  let inquirer = require("inquirer");
28
- inquirer = __toESM(inquirer);
29
- let __inquirer_core = require("@inquirer/core");
30
- __inquirer_core = __toESM(__inquirer_core);
26
+ inquirer = __toESM(inquirer, 1);
27
+ let _inquirer_core = require("@inquirer/core");
31
28
  let node_path = require("node:path");
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);
29
+ let _h3ravel_support = require("@h3ravel/support");
30
+ let _h3ravel_shared = require("@h3ravel/shared");
37
31
  let node_fs_promises = require("node:fs/promises");
38
- node_fs_promises = __toESM(node_fs_promises);
39
- let __antfu_install_pkg = require("@antfu/install-pkg");
40
- __antfu_install_pkg = __toESM(__antfu_install_pkg);
32
+ let _antfu_install_pkg = require("@antfu/install-pkg");
41
33
  let giget = require("giget");
42
- giget = __toESM(giget);
43
34
  let node_fs = require("node:fs");
44
- node_fs = __toESM(node_fs);
45
35
  let ora = require("ora");
46
- ora = __toESM(ora);
47
-
48
- //#region src/logo.ts
49
- const logo = String.raw`
36
+ ora = __toESM(ora, 1);
37
+ String.raw`
50
38
  111
51
39
  111111111
52
40
  1111111111 111111
@@ -77,7 +65,6 @@ const altLogo = String.raw`%c
77
65
  |_| |_|____/|_| \__,_| \_/ \___|_|
78
66
 
79
67
  `;
80
-
81
68
  //#endregion
82
69
  //#region src/templates.ts
83
70
  /**
@@ -89,7 +76,7 @@ const templates = [
89
76
  alias: "full",
90
77
  hint: "A full H3ravel application with everything possible",
91
78
  source: "github:h3ravel/h3ravel#3fbb538",
92
- prereleaseSource: "github:h3ravel/h3ravel#2eec534"
79
+ prereleaseSource: "github:h3ravel/h3ravel#fe175fa"
93
80
  },
94
81
  {
95
82
  name: "Lean Starter Kit",
@@ -120,10 +107,12 @@ const templates = [
120
107
  prereleaseSource: void 0
121
108
  }
122
109
  ];
123
-
124
110
  //#endregion
125
111
  //#region src/actions.ts
126
112
  var actions_default = class {
113
+ location;
114
+ appName;
115
+ description;
127
116
  skipInstallation;
128
117
  constructor(location, appName, description) {
129
118
  this.location = location;
@@ -138,7 +127,7 @@ var actions_default = class {
138
127
  });
139
128
  else if ((0, node_fs.existsSync)(this.location)) {
140
129
  console.log("\n");
141
- __h3ravel_shared.Logger.parse([
130
+ _h3ravel_shared.Logger.parse([
142
131
  [" ERROR ", "bgRed"],
143
132
  [this.location, ["gray", "italic"]],
144
133
  ["is not empty.", "white"]
@@ -152,35 +141,35 @@ var actions_default = class {
152
141
  dir: this.location,
153
142
  auth,
154
143
  install,
155
- registry: await (0, __antfu_install_pkg.detectPackageManager)() ?? "npm",
144
+ registry: await (0, _antfu_install_pkg.detectPackageManager)() ?? "npm",
156
145
  forceClean: false
157
146
  });
158
147
  }
159
148
  async installPackage(name) {
160
- await (0, __antfu_install_pkg.installPackage)(name, {
149
+ await (0, _antfu_install_pkg.installPackage)(name, {
161
150
  cwd: this.location,
162
151
  silent: true
163
152
  });
164
153
  }
165
154
  async complete(installed = false) {
166
155
  console.log("");
167
- __h3ravel_shared.Logger.success("Your h3ravel project has been created successfully");
168
- __h3ravel_shared.Logger.parse([["cd", "cyan"], ["./" + (0, node_path.relative)(process.cwd(), this.location), "green"]]);
169
- if (!installed) __h3ravel_shared.Logger.parse([[await __h3ravel_shared.Resolver.getPakageInstallCommand(), "cyan"]]);
170
- __h3ravel_shared.Logger.parse([["npx", "cyan"], ["prepare", "green"]], " ");
171
- __h3ravel_shared.Logger.parse([["npx", "cyan"], ["musket fire", "green"]], " ");
172
- __h3ravel_shared.Logger.parse([["Open http://localhost:3000", "cyan"]]);
156
+ _h3ravel_shared.Logger.success("Your h3ravel project has been created successfully");
157
+ _h3ravel_shared.Logger.parse([["cd", "cyan"], ["./" + (0, node_path.relative)(process.cwd(), this.location), "green"]]);
158
+ if (!installed) _h3ravel_shared.Logger.parse([[await _h3ravel_shared.Resolver.getPakageInstallCommand(), "cyan"]]);
159
+ _h3ravel_shared.Logger.parse([["npx", "cyan"], ["prepare", "green"]], " ");
160
+ _h3ravel_shared.Logger.parse([["npx", "cyan"], ["musket fire", "green"]], " ");
161
+ _h3ravel_shared.Logger.parse([["Open http://localhost:3000", "cyan"]]);
173
162
  console.log("");
174
- __h3ravel_shared.Logger.parse([["Have any questions", "white"]]);
175
- __h3ravel_shared.Logger.parse([["Join our Discord server -", "white"], ["https://discord.gg/hsG2A8PuGb", "yellow"]]);
176
- __h3ravel_shared.Logger.parse([["Checkout the documentation -", "white"], ["https://h3ravel.toneflix.net", "yellow"]]);
163
+ _h3ravel_shared.Logger.parse([["Have any questions", "white"]]);
164
+ _h3ravel_shared.Logger.parse([["Join our Discord server -", "white"], ["https://discord.gg/hsG2A8PuGb", "yellow"]]);
165
+ _h3ravel_shared.Logger.parse([["Checkout the documentation -", "white"], ["https://h3ravel.toneflix.net", "yellow"]]);
177
166
  }
178
167
  async cleanup() {
179
168
  const pkgPath = (0, node_path.join)(this.location, "package.json");
180
169
  const pkg = await (0, node_fs_promises.readFile)(pkgPath, "utf-8").then(JSON.parse);
181
170
  delete pkg.packageManager;
182
- pkg.name = __h3ravel_support.Str.slugify(this.appName ?? (0, node_path.basename)(this.location).replace(".", ""), "-");
183
- pkg.scripts = __h3ravel_shared.packageJsonScript;
171
+ pkg.name = _h3ravel_support.Str.slugify(this.appName ?? (0, node_path.basename)(this.location).replace(".", ""), "-");
172
+ pkg.scripts = _h3ravel_shared.packageJsonScript;
184
173
  if (this.description) pkg.description = this.description;
185
174
  await Promise.allSettled([
186
175
  (0, node_fs_promises.writeFile)(pkgPath, JSON.stringify(pkg, null, 2)),
@@ -212,15 +201,14 @@ var actions_default = class {
212
201
  async createTsConfig() {
213
202
  const tscPath = (0, node_path.join)(this.location, ".h3ravel");
214
203
  await (0, node_fs_promises.mkdir)(tscPath, { recursive: true });
215
- await (0, node_fs_promises.writeFile)((0, node_path.join)(tscPath, "tsconfig.json"), JSON.stringify(__h3ravel_shared.mainTsconfig, null, 2));
216
- await (0, node_fs_promises.writeFile)((0, node_path.join)(this.location, "tsconfig.json"), JSON.stringify(__h3ravel_shared.baseTsconfig, null, 2));
204
+ await (0, node_fs_promises.writeFile)((0, node_path.join)(tscPath, "tsconfig.json"), JSON.stringify(_h3ravel_shared.mainTsconfig, null, 2));
205
+ await (0, node_fs_promises.writeFile)((0, node_path.join)(this.location, "tsconfig.json"), JSON.stringify(_h3ravel_shared.baseTsconfig, null, 2));
217
206
  if (!(0, node_fs.existsSync)((0, node_path.join)(this.location, "src/database/db.sqlite"))) await (0, node_fs_promises.writeFile)((0, node_path.join)(this.location, "src/database/db.sqlite"), "");
218
207
  }
219
208
  };
220
-
221
209
  //#endregion
222
210
  //#region src/Commands/CreateH3ravelCommand.ts
223
- var CreateH3ravelCommand = class extends __h3ravel_musket.Command {
211
+ var CreateH3ravelCommand = class extends _h3ravel_musket.Command {
224
212
  signature = `create-h3ravel
225
213
  {location?: The location where this project should be created relative to the current dir.}
226
214
  {--n|name?: The name of your project.}
@@ -249,7 +237,7 @@ var CreateH3ravelCommand = class extends __h3ravel_musket.Command {
249
237
  default: "Modern TypeScript runtime-agnostic web framework built on top of H3.",
250
238
  when: () => !options.desc
251
239
  }]).catch((err) => {
252
- if (err instanceof __inquirer_core.AbortPromptError || err instanceof __inquirer_core.ExitPromptError) {
240
+ if (err instanceof _inquirer_core.AbortPromptError || err instanceof _inquirer_core.ExitPromptError) {
253
241
  this.info("Thanks for trying out H3ravel.");
254
242
  process.exit(0);
255
243
  }
@@ -259,7 +247,7 @@ var CreateH3ravelCommand = class extends __h3ravel_musket.Command {
259
247
  type: "input",
260
248
  name: "location",
261
249
  message: "Installation location relative to the current dir:",
262
- default: __h3ravel_support.Str.slugify(options.name ?? appName ?? (0, node_path.basename)(process.cwd()), "-"),
250
+ default: _h3ravel_support.Str.slugify(options.name ?? appName ?? (0, node_path.basename)(process.cwd()), "-"),
263
251
  when: () => !pathName
264
252
  }, {
265
253
  type: "list",
@@ -273,7 +261,7 @@ var CreateH3ravelCommand = class extends __h3ravel_musket.Command {
273
261
  default: "full",
274
262
  when: () => !options.kit
275
263
  }]).catch((err) => {
276
- if (err instanceof __inquirer_core.AbortPromptError || err instanceof __inquirer_core.ExitPromptError) {
264
+ if (err instanceof _inquirer_core.AbortPromptError || err instanceof _inquirer_core.ExitPromptError) {
277
265
  this.info("Thanks for trying out H3ravel.");
278
266
  process.exit(0);
279
267
  }
@@ -305,7 +293,7 @@ var CreateH3ravelCommand = class extends __h3ravel_musket.Command {
305
293
  when: () => !options.install
306
294
  }
307
295
  ]).catch((err) => {
308
- if (err instanceof __inquirer_core.AbortPromptError || err instanceof __inquirer_core.ExitPromptError) {
296
+ if (err instanceof _inquirer_core.AbortPromptError || err instanceof _inquirer_core.ExitPromptError) {
309
297
  this.info("Thanks for trying out H3ravel.");
310
298
  process.exit(0);
311
299
  }
@@ -329,20 +317,17 @@ var CreateH3ravelCommand = class extends __h3ravel_musket.Command {
329
317
  const actions = new actions_default((0, node_path.join)(process.cwd(), location), appName, description);
330
318
  const spinner = (0, ora.default)(`Loading Template...`).start();
331
319
  await actions.download(source, install, void 0, options.overwrite);
332
- spinner.info(__h3ravel_shared.Logger.parse([["Cleaning Up...", "green"]], "", false)).start();
320
+ spinner.info(_h3ravel_shared.Logger.parse([["Cleaning Up...", "green"]], "", false)).start();
333
321
  await actions.cleanup();
334
- spinner.info(__h3ravel_shared.Logger.parse([["Initializing Project...", "green"]], "", false)).start();
322
+ spinner.info(_h3ravel_shared.Logger.parse([["Initializing Project...", "green"]], "", false)).start();
335
323
  await actions.copyExampleEnv();
336
324
  await actions.createTsConfig();
337
- spinner.succeed(__h3ravel_shared.Logger.parse([["Project initialization complete!", "green"]], "", false));
325
+ spinner.succeed(_h3ravel_shared.Logger.parse([["Project initialization complete!", "green"]], "", false));
338
326
  await actions.complete(install);
339
327
  }
340
328
  };
341
-
342
329
  //#endregion
343
330
  //#region src/run.ts
344
331
  var Application = class {};
345
- __h3ravel_musket.Kernel.init(new Application(), { rootCommand: CreateH3ravelCommand });
346
-
332
+ _h3ravel_musket.Kernel.init(new Application(), { rootCommand: CreateH3ravelCommand });
347
333
  //#endregion
348
- //# sourceMappingURL=run.cjs.map
@@ -10,9 +10,7 @@ import { detectPackageManager, installPackage } from "@antfu/install-pkg";
10
10
  import { downloadTemplate } from "giget";
11
11
  import { existsSync } from "node:fs";
12
12
  import ora from "ora";
13
-
14
- //#region src/logo.ts
15
- const logo = String.raw`
13
+ String.raw`
16
14
  111
17
15
  111111111
18
16
  1111111111 111111
@@ -43,7 +41,6 @@ const altLogo = String.raw`%c
43
41
  |_| |_|____/|_| \__,_| \_/ \___|_|
44
42
 
45
43
  `;
46
-
47
44
  //#endregion
48
45
  //#region src/templates.ts
49
46
  /**
@@ -55,7 +52,7 @@ const templates = [
55
52
  alias: "full",
56
53
  hint: "A full H3ravel application with everything possible",
57
54
  source: "github:h3ravel/h3ravel#3fbb538",
58
- prereleaseSource: "github:h3ravel/h3ravel#2eec534"
55
+ prereleaseSource: "github:h3ravel/h3ravel#fe175fa"
59
56
  },
60
57
  {
61
58
  name: "Lean Starter Kit",
@@ -86,10 +83,12 @@ const templates = [
86
83
  prereleaseSource: void 0
87
84
  }
88
85
  ];
89
-
90
86
  //#endregion
91
87
  //#region src/actions.ts
92
88
  var actions_default = class {
89
+ location;
90
+ appName;
91
+ description;
93
92
  skipInstallation;
94
93
  constructor(location, appName, description) {
95
94
  this.location = location;
@@ -183,7 +182,6 @@ var actions_default = class {
183
182
  if (!existsSync(join(this.location, "src/database/db.sqlite"))) await writeFile(join(this.location, "src/database/db.sqlite"), "");
184
183
  }
185
184
  };
186
-
187
185
  //#endregion
188
186
  //#region src/Commands/CreateH3ravelCommand.ts
189
187
  var CreateH3ravelCommand = class extends Command {
@@ -304,12 +302,9 @@ var CreateH3ravelCommand = class extends Command {
304
302
  await actions.complete(install);
305
303
  }
306
304
  };
307
-
308
305
  //#endregion
309
306
  //#region src/run.ts
310
307
  var Application = class {};
311
308
  Kernel.init(new Application(), { rootCommand: CreateH3ravelCommand });
312
-
313
309
  //#endregion
314
- export { };
315
- //# sourceMappingURL=run.js.map
310
+ export {};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "create-h3ravel",
3
3
  "type": "module",
4
- "version": "0.6.3",
4
+ "version": "0.6.4",
5
5
  "description": "Scaffold a new H3ravel applications using templates and starter kits",
6
6
  "main": "build/index.js",
7
7
  "private": false,
@@ -25,8 +25,8 @@
25
25
  ],
26
26
  "dependencies": {
27
27
  "@antfu/install-pkg": "1.1.0",
28
- "@h3ravel/collect.js": "^5.3.4",
29
- "@h3ravel/musket": "^0.6.12",
28
+ "@h3ravel/collect.js": "^5.3.7",
29
+ "@h3ravel/musket": "^0.10.1",
30
30
  "@h3ravel/shared": "^0.28.4",
31
31
  "@h3ravel/support": "^0.16.1",
32
32
  "@inquirer/core": "^10.2.2",
@@ -35,16 +35,15 @@
35
35
  "ora": "^9.0.0"
36
36
  },
37
37
  "devDependencies": {
38
- "@changesets/cli": "^2.29.5",
39
- "@swc/core": "^1.6.1",
40
- "@types/node": "^20.14.5",
41
- "eslint": "^9.32.0",
38
+ "@changesets/cli": "^2.31.0",
39
+ "@swc/core": "^1.15.41",
40
+ "@types/node": "^25.9.3",
41
+ "eslint": "^10.4.1",
42
42
  "ts-node": "^10.9.2",
43
- "tsdown": "^0.15.4",
44
- "tsx": "^4.20.3",
45
- "typescript": "^5.4.5",
46
- "vite-tsconfig-paths": "^5.1.4",
47
- "vitest": "^3.2.4"
43
+ "tsdown": "^0.22.2",
44
+ "tsx": "^4.22.4",
45
+ "typescript": "^6.0.3",
46
+ "vitest": "^4.1.8"
48
47
  },
49
48
  "scripts": {
50
49
  "quick:test": "pnpm vitest",
package/bin/run.cjs.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"run.cjs","names":["location?: string","appName?: string","description?: string","Resolver","Str","packageJsonScript","mainTsconfig","baseTsconfig","Command","AbortPromptError","ExitPromptError","Str","source: string","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#3fbb538',\n prereleaseSource: 'github:h3ravel/h3ravel#2eec534',\n },\n {\n name: 'Lean Starter Kit',\n alias: 'lean',\n hint: 'A lean H3ravel application with just the framework core',\n source: undefined,\n prereleaseSource: undefined\n },\n {\n name: 'API Starter Kit',\n alias: 'api',\n hint: 'Creates a H3ravel application for building JSON APIs',\n source: undefined,\n prereleaseSource: undefined\n },\n {\n name: 'Web Starter Kit',\n alias: 'web',\n hint: 'Creates a H3ravel application for building a server rendered app',\n source: undefined,\n prereleaseSource: undefined\n },\n {\n name: 'Inertia Starter Kit',\n alias: 'inertia',\n hint: 'Inertia application with a frontend framework of your choice',\n source: undefined,\n prereleaseSource: undefined\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'], ['prepare', 'green']], ' ')\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 {--p|pre: Download prerelease version if available.}\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 { location, template } = await inquirer.prompt([\n {\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 ]).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 /**\n * Find selected template kit\n */\n const kit = templates.find(e => e.alias === template)!\n\n let { install, token, pre } = await inquirer.prompt([\n {\n type: \"confirm\",\n name: \"pre\",\n message: `An alpha version of the ${kit.name.replace(/\\s*kit$/i, '').trim()} kit is available. Would you like to use it instead?`,\n default: false,\n when: () => kit.prereleaseSource && !options.pre,\n } as never,\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 }\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 pre = options.pre ?? pre\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 /**\n * Validate selected kit\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 source: string = pre && kit.prereleaseSource ? kit.prereleaseSource! : kit.source\n const actions = new Actions(join(process.cwd(), location), appName, description);\n const spinner = ora(`Loading Template...`).start();\n\n await actions.download(source, 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 rootCommand: CreateH3ravelCommand\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAa,OAAO,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;AAwB9B,MAAa,UAAU,OAAO,GAAG;;;;;;;;;;;;;;ACZjC,MAAa,YAAY;CACrB;EACI,MAAM;EACN,OAAO;EACP,MAAM;EACN,QAAQ;EACR,kBAAkB;EACrB;CACD;EACI,MAAM;EACN,OAAO;EACP,MAAM;EACN,QAAQ;EACR,kBAAkB;EACrB;CACD;EACI,MAAM;EACN,OAAO;EACP,MAAM;EACN,QAAQ;EACR,kBAAkB;EACrB;CACD;EACI,MAAM;EACN,OAAO;EACP,MAAM;EACN,QAAQ;EACR,kBAAkB;EACrB;CACD;EACI,MAAM;EACN,OAAO;EACP,MAAM;EACN,QAAQ;EACR,kBAAkB;EACrB;CACJ;;;;ACtCD,4BAAqB;CACjB;CAEA,YAAY,AAAQA,UAAmB,AAAQC,SAAkB,AAAQC,aAAsB;EAA3E;EAA2B;EAA0B;AACrE,MAAI,CAAC,KAAK,SACN,MAAK,+BAAgB,QAAQ,KAAK,EAAE,QAAQ;;CAIpD,MAAM,SAAU,UAAkB,UAAU,OAAO,MAAe,YAAY,OAAO;AACjF,MAAI,KAAK,UAAU,SAAS,QA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AQ,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;;;;;;AC7IvC,IAAM,cAAN,MAAkB;AAElBC,wBAAO,KAAK,IAAI,aAAa,EAAE,EAC3B,aAAa,sBAChB,CAAC"}
package/bin/run.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"run.js","names":["location?: string","appName?: string","description?: string","source: 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#3fbb538',\n prereleaseSource: 'github:h3ravel/h3ravel#2eec534',\n },\n {\n name: 'Lean Starter Kit',\n alias: 'lean',\n hint: 'A lean H3ravel application with just the framework core',\n source: undefined,\n prereleaseSource: undefined\n },\n {\n name: 'API Starter Kit',\n alias: 'api',\n hint: 'Creates a H3ravel application for building JSON APIs',\n source: undefined,\n prereleaseSource: undefined\n },\n {\n name: 'Web Starter Kit',\n alias: 'web',\n hint: 'Creates a H3ravel application for building a server rendered app',\n source: undefined,\n prereleaseSource: undefined\n },\n {\n name: 'Inertia Starter Kit',\n alias: 'inertia',\n hint: 'Inertia application with a frontend framework of your choice',\n source: undefined,\n prereleaseSource: undefined\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'], ['prepare', 'green']], ' ')\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 {--p|pre: Download prerelease version if available.}\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 { location, template } = await inquirer.prompt([\n {\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 ]).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 /**\n * Find selected template kit\n */\n const kit = templates.find(e => e.alias === template)!\n\n let { install, token, pre } = await inquirer.prompt([\n {\n type: \"confirm\",\n name: \"pre\",\n message: `An alpha version of the ${kit.name.replace(/\\s*kit$/i, '').trim()} kit is available. Would you like to use it instead?`,\n default: false,\n when: () => kit.prereleaseSource && !options.pre,\n } as never,\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 }\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 pre = options.pre ?? pre\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 /**\n * Validate selected kit\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 source: string = pre && kit.prereleaseSource ? kit.prereleaseSource! : kit.source\n const actions = new Actions(join(process.cwd(), location), appName, description);\n const spinner = ora(`Loading Template...`).start();\n\n await actions.download(source, 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 rootCommand: CreateH3ravelCommand\n})\n"],"mappings":";;;;;;;;;;;;;;AAAA,MAAa,OAAO,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;AAwB9B,MAAa,UAAU,OAAO,GAAG;;;;;;;;;;;;;;ACZjC,MAAa,YAAY;CACrB;EACI,MAAM;EACN,OAAO;EACP,MAAM;EACN,QAAQ;EACR,kBAAkB;EACrB;CACD;EACI,MAAM;EACN,OAAO;EACP,MAAM;EACN,QAAQ;EACR,kBAAkB;EACrB;CACD;EACI,MAAM;EACN,OAAO;EACP,MAAM;EACN,QAAQ;EACR,kBAAkB;EACrB;CACD;EACI,MAAM;EACN,OAAO;EACP,MAAM;EACN,QAAQ;EACR,kBAAkB;EACrB;CACD;EACI,MAAM;EACN,OAAO;EACP,MAAM;EACN,QAAQ;EACR,kBAAkB;EACrB;CACJ;;;;ACtCD,4BAAqB;CACjB;CAEA,YAAY,AAAQA,UAAmB,AAAQC,SAAkB,AAAQC,aAAsB;EAA3E;EAA2B;EAA0B;AACrE,MAAI,CAAC,KAAK,SACN,MAAK,WAAW,KAAK,QAAQ,KAAK,EAAE,QAAQ;;CAIpD,MAAM,SAAU,UAAkB,UAAU,OAAO,MAAe,YAAY,OAAO;AACjF,MAAI,KAAK,UAAU,SAAS,QAAQ,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