create-h3ravel 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bin/run.cjs CHANGED
@@ -28,14 +28,14 @@ let inquirer = require("inquirer");
28
28
  inquirer = __toESM(inquirer);
29
29
  let ora = require("ora");
30
30
  ora = __toESM(ora);
31
+ let __h3ravel_shared = require("@h3ravel/shared");
32
+ __h3ravel_shared = __toESM(__h3ravel_shared);
31
33
  let node_path = require("node:path");
32
34
  node_path = __toESM(node_path);
33
35
  let node_fs_promises = require("node:fs/promises");
34
36
  node_fs_promises = __toESM(node_fs_promises);
35
37
  let __antfu_install_pkg = require("@antfu/install-pkg");
36
38
  __antfu_install_pkg = __toESM(__antfu_install_pkg);
37
- let __h3ravel_shared = require("@h3ravel/shared");
38
- __h3ravel_shared = __toESM(__h3ravel_shared);
39
39
  let giget = require("giget");
40
40
  giget = __toESM(giget);
41
41
  let node_fs = require("node:fs");
@@ -82,45 +82,6 @@ const templates = [
82
82
  }
83
83
  ];
84
84
 
85
- //#endregion
86
- //#region src/scripts.ts
87
- const mainTsconfig = {
88
- extends: "@h3ravel/shared/tsconfig.json",
89
- compilerOptions: {
90
- baseUrl: ".",
91
- outDir: "dist",
92
- paths: {
93
- "src/*": ["./../src/*"],
94
- "App/*": ["./../src/app/*"],
95
- "root/*": ["./../*"],
96
- "routes/*": ["./../src/routes/*"],
97
- "config/*": ["./../src/config/*"],
98
- "resources/*": ["./../src/resources/*"]
99
- },
100
- target: "es2022",
101
- module: "es2022",
102
- moduleResolution: "Node",
103
- esModuleInterop: true,
104
- strict: true,
105
- allowJs: true,
106
- skipLibCheck: true,
107
- resolveJsonModule: true,
108
- noEmit: true,
109
- experimentalDecorators: true,
110
- emitDecoratorMetadata: true
111
- },
112
- include: ["./**/*.d.ts", "./../**/*"],
113
- exclude: ["./dist", "./node_modules"]
114
- };
115
- const baseTsconfig = { extends: "./.h3ravel/tsconfig.json" };
116
- const packageJsonScript = {
117
- build: "NODE_ENV=production tsdown --config-loader unconfig -c tsdown.default.config.ts",
118
- dev: "NODE_ENV=development pnpm tsdown --config-loader unconfig -c tsdown.default.config.ts",
119
- start: "DIST_DIR=dist node -r source-map-support/register dist/server.js",
120
- lint: "eslint . --ext .ts",
121
- test: "NODE_NO_WARNINGS=1 NODE_ENV=testing jest --passWithNoTests"
122
- };
123
-
124
85
  //#endregion
125
86
  //#region src/actions.ts
126
87
  var actions_default = class {
@@ -131,11 +92,21 @@ var actions_default = class {
131
92
  this.description = description;
132
93
  if (!this.location) this.location = (0, node_path.join)(process.cwd(), ".temp");
133
94
  }
134
- async download(template, install = false, auth) {
135
- if (this.location?.includes(".temp")) await (0, node_fs_promises.rm)(this.location, {
95
+ async download(template, install = false, auth, overwrite = false) {
96
+ if (this.location?.includes(".temp") || overwrite && (0, node_fs.existsSync)(this.location)) await (0, node_fs_promises.rm)(this.location, {
136
97
  force: true,
137
98
  recursive: true
138
99
  });
100
+ else if ((0, node_fs.existsSync)(this.location)) {
101
+ console.log("\n");
102
+ __h3ravel_shared.Logger.parse([
103
+ [" ERROR ", "bgRed"],
104
+ [this.location, ["gray", "italic"]],
105
+ ["is not empty.", "white"]
106
+ ], " ");
107
+ console.log("");
108
+ process.exit(0);
109
+ }
139
110
  this.skipInstallation = !install;
140
111
  this.removeLockFile();
141
112
  return await (0, giget.downloadTemplate)(template, {
@@ -152,11 +123,12 @@ var actions_default = class {
152
123
  silent: true
153
124
  });
154
125
  }
155
- async complete() {
126
+ async complete(installed = false) {
156
127
  console.log("");
157
128
  __h3ravel_shared.Logger.success("Your h3ravel project has been created successfully");
158
- __h3ravel_shared.Logger.parse([["cd " + (0, node_path.relative)(process.cwd(), this.location), "cyan"]]);
159
- __h3ravel_shared.Logger.parse([[`npx musket fire`, "cyan"]]);
129
+ __h3ravel_shared.Logger.parse([["cd", "cyan"], ["./" + (0, node_path.relative)(process.cwd(), this.location), "green"]]);
130
+ if (!installed) __h3ravel_shared.Logger.parse([[await __h3ravel_shared.Resolver.getPakageInstallCommand(), "cyan"]]);
131
+ __h3ravel_shared.Logger.parse([["npx", "cyan"], ["musket fire", "green"]], " ");
160
132
  __h3ravel_shared.Logger.parse([["Open http://localhost:3000", "cyan"]]);
161
133
  console.log("");
162
134
  __h3ravel_shared.Logger.parse([["Have any questions", "white"]]);
@@ -168,7 +140,7 @@ var actions_default = class {
168
140
  const pkg = await (0, node_fs_promises.readFile)(pkgPath, "utf-8").then(JSON.parse);
169
141
  delete pkg.packageManager;
170
142
  pkg.name = (0, __h3ravel_support.slugify)(this.appName ?? (0, node_path.basename)(this.location).replace(".", ""), "-");
171
- pkg.scripts = packageJsonScript;
143
+ pkg.scripts = __h3ravel_shared.packageJsonScript;
172
144
  if (this.description) pkg.description = this.description;
173
145
  await Promise.allSettled([
174
146
  (0, node_fs_promises.writeFile)(pkgPath, JSON.stringify(pkg, null, 2)),
@@ -200,8 +172,8 @@ var actions_default = class {
200
172
  async createTsConfig() {
201
173
  const tscPath = (0, node_path.join)(this.location, ".h3ravel");
202
174
  await (0, node_fs_promises.mkdir)(tscPath, { recursive: true });
203
- await (0, node_fs_promises.writeFile)((0, node_path.join)(tscPath, "tsconfig.json"), JSON.stringify(mainTsconfig, null, 2));
204
- await (0, node_fs_promises.writeFile)((0, node_path.join)(this.location, "tsconfig.json"), JSON.stringify(baseTsconfig, null, 2));
175
+ await (0, node_fs_promises.writeFile)((0, node_path.join)(tscPath, "tsconfig.json"), JSON.stringify(__h3ravel_shared.mainTsconfig, null, 2));
176
+ await (0, node_fs_promises.writeFile)((0, node_path.join)(this.location, "tsconfig.json"), JSON.stringify(__h3ravel_shared.baseTsconfig, null, 2));
205
177
  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"), "");
206
178
  }
207
179
  };
@@ -245,7 +217,7 @@ const altLogo = String.raw`%c
245
217
  async function main() {
246
218
  const program = new commander.Command();
247
219
  program.name("create-h3ravel").description("CLI to create new h3ravel app").version("0.1.0");
248
- program.option("-n, --name <string>", "The name of your project.").option("-i, --install", "Install node_modules right away.").option("-t, --token <string>", "Kit repo authentication token.").option("-d, --desc <string>", "Project Description.").option("-k, --kit <string>\", \"Starter template kit").addArgument(new commander.Argument("[location]", "The location where this project should be created relative to the current dir.")).action(async (pathName, options) => {
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) => {
249
221
  console.log(altLogo, `font-family: monospace`);
250
222
  let { appName, description } = await inquirer.default.prompt([{
251
223
  type: "input",
@@ -319,14 +291,14 @@ async function main() {
319
291
  }
320
292
  const actions = new actions_default((0, node_path.join)(process.cwd(), location), appName, description);
321
293
  const spinner = (0, ora.default)(`Loading Template...`).start();
322
- await actions.download(kit?.source ?? template, install);
294
+ await actions.download(kit?.source ?? template, install, void 0, options.overwrite);
323
295
  spinner.info(__h3ravel_shared.Logger.parse([["Cleaning Up...", "green"]], "", false)).start();
324
296
  await actions.cleanup();
325
297
  spinner.info(__h3ravel_shared.Logger.parse([["Initializing Project...", "green"]], "", false)).start();
326
298
  await actions.copyExampleEnv();
327
299
  await actions.createTsConfig();
328
300
  spinner.succeed(__h3ravel_shared.Logger.parse([["Project initialization complete!", "green"]], "", false));
329
- await actions.complete();
301
+ await actions.complete(install);
330
302
  });
331
303
  program.parse();
332
304
  process.on("SIGINT", () => {});
package/bin/run.cjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"run.cjs","names":["location?: string","appName?: string","description?: string","Command","Argument","AbortPromptError","ExitPromptError","Actions","Logger"],"sources":["../src/templates.ts","../src/scripts.ts","../src/actions.ts","../src/logo.ts","../src/run.ts"],"sourcesContent":["/*\n * create-h3ravel\n *\n * (c) H3ravel Framework\n *\n * The H3ravel framework and all it's base packages are \n * open-sourced software licensed under the MIT license.\n */\n\n/**\n * List of first party templates\n */\nexport const templates = [\n {\n name: 'Full Starter Kit',\n alias: 'full',\n hint: 'A full H3ravel application with everything possible',\n source: 'github:h3ravel/h3ravel',\n },\n {\n name: 'Lean Starter Kit',\n alias: 'lean',\n hint: 'A lean H3ravel application with just the framework core',\n source: null,\n },\n {\n name: 'API Starter Kit',\n alias: 'api',\n hint: 'Creates a H3ravel application for building JSON APIs',\n source: null\n },\n {\n name: 'Web Starter Kit',\n alias: 'web',\n hint: 'Creates a H3ravel application for building a server rendered app',\n source: null\n },\n {\n name: 'Inertia Starter Kit',\n alias: 'inertia',\n hint: 'Inertia application with a frontend framework of your choice',\n source: null\n },\n]\n","export const mainTsconfig = {\n extends: \"@h3ravel/shared/tsconfig.json\",\n compilerOptions: {\n baseUrl: \".\",\n outDir: \"dist\",\n paths: {\n \"src/*\": [\"./../src/*\"],\n \"App/*\": [\"./../src/app/*\"],\n \"root/*\": [\"./../*\"],\n \"routes/*\": [\"./../src/routes/*\"],\n \"config/*\": [\"./../src/config/*\"],\n \"resources/*\": [\"./../src/resources/*\"]\n },\n target: \"es2022\",\n module: \"es2022\",\n moduleResolution: \"Node\",\n esModuleInterop: true,\n strict: true,\n allowJs: true,\n skipLibCheck: true,\n resolveJsonModule: true,\n noEmit: true,\n experimentalDecorators: true,\n emitDecoratorMetadata: true\n },\n include: [\"./**/*.d.ts\", \"./../**/*\"],\n exclude: [\"./dist\", \"./node_modules\"]\n}\n\nexport const baseTsconfig = {\n extends: \"./.h3ravel/tsconfig.json\"\n}\n\nexport const packageJsonScript = {\n build: \"NODE_ENV=production tsdown --config-loader unconfig -c tsdown.default.config.ts\",\n dev: \"NODE_ENV=development pnpm tsdown --config-loader unconfig -c tsdown.default.config.ts\",\n start: \"DIST_DIR=dist node -r source-map-support/register dist/server.js\",\n lint: \"eslint . --ext .ts\",\n test: \"NODE_NO_WARNINGS=1 NODE_ENV=testing jest --passWithNoTests\",\n}\n","import { baseTsconfig, mainTsconfig, packageJsonScript } from \"./scripts\";\nimport { basename, join, relative } from \"node:path\";\nimport { copyFile, mkdir, readFile, rm, writeFile } from \"node:fs/promises\";\nimport { detectPackageManager, installPackage } from \"@antfu/install-pkg\";\n\nimport { Logger } from \"@h3ravel/shared\";\nimport { downloadTemplate } from \"giget\";\nimport { existsSync } from \"node:fs\";\nimport { slugify } from \"@h3ravel/support\";\nimport { unlink } from \"node:fs/promises\";\n\nexport default class {\n skipInstallation?: boolean\n\n constructor(private location?: string, private appName?: string, private description?: string) {\n if (!this.location) {\n this.location = join(process.cwd(), '.temp')\n }\n }\n\n async download (template: string, install = false, auth?: string) {\n if (this.location?.includes('.temp')) {\n await rm(this.location!, { force: true, recursive: true })\n }\n\n this.skipInstallation = !install\n this.removeLockFile()\n\n return await downloadTemplate(template, {\n dir: this.location,\n auth,\n install,\n registry: (await detectPackageManager()) ?? 'npm',\n forceClean: false\n });\n }\n\n async installPackage (name: string) {\n await installPackage(name, {\n cwd: this.location,\n silent: true,\n })\n }\n\n async complete () {\n console.log('')\n\n Logger.success('Your h3ravel project has been created successfully')\n Logger.parse([['cd ' + relative(process.cwd(), this.location!), 'cyan']])\n Logger.parse([[`npx musket fire`, 'cyan']])\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 .addArgument(new Argument('[location]', 'The location where this project should be created relative to the current dir.'))\n .action(async (pathName, options) => {\n\n console.log(altLogo, `font-family: monospace`)\n\n let { appName, description } = await inquirer.prompt([\n {\n type: \"input\",\n name: \"appName\",\n message: \"What is the name of your project:\",\n default: 'h3ravel',\n when: () => !options.name,\n },\n {\n type: \"input\",\n name: \"description\",\n message: \"Project Description:\",\n default: 'Modern TypeScript runtime-agnostic web framework built on top of H3.',\n when: () => !options.desc,\n }]\n ).catch(err => {\n if (err instanceof AbortPromptError || err instanceof ExitPromptError) {\n Logger.info('Thanks for trying out H3ravel.')\n process.exit(0)\n }\n return err\n })\n\n let { template, install, location, token } = await inquirer.prompt([{\n type: \"input\",\n name: \"location\",\n message: \"Installation location relative to the current dir:\",\n default: slugify(options.name ?? appName ?? basename(process.cwd()), '-'),\n when: () => !pathName,\n },\n {\n type: \"list\",\n name: \"template\",\n message: \"Choose starter template kit:\",\n choices: <never>templates.map(e => ({\n name: e.name,\n value: e.alias,\n disabled: !e.source ? '(Unavailable at this time)' : false,\n })),\n default: 'full',\n when: () => !options.kit,\n },\n {\n type: \"input\",\n name: \"token\",\n message: \"Authentication token:\",\n when: () => options.kit && !options.token,\n },\n {\n type: 'confirm',\n name: \"install\",\n message: \"Would you want to install node_modules right away:\",\n default: true,\n when: () => !options.install,\n }]).catch(err => {\n if (err instanceof AbortPromptError || err instanceof ExitPromptError) {\n Logger.info('Thanks for trying out H3ravel.')\n process.exit(0)\n }\n return err\n })\n\n token = options.token ?? token\n appName = options.name ?? appName\n install = options.install ?? install\n template = options.kit ?? template\n location = pathName ?? location\n description = options.description ?? description\n\n const kit = templates.find(e => e.alias === template)!\n\n if (kit && !kit.source) {\n Logger.error(`ERROR: The ${kit.name} kit is not currently available`)\n process.exit(1)\n }\n\n const actions = new Actions(join(process.cwd(), location), appName, description);\n\n const spinner = ora(`Loading Template...`).start();\n await actions.download(kit?.source ?? template, install);\n\n spinner.info(Logger.parse([['Cleaning Up...', 'green']], '', false)).start();\n await actions.cleanup()\n\n spinner.info(Logger.parse([['Initializing Project...', 'green']], '', false)).start();\n await actions.copyExampleEnv()\n await actions.createTsConfig()\n\n spinner.succeed(Logger.parse([['Project initialization complete!', 'green']], '', false))\n\n await actions.complete()\n });\n\n program.parse();\n\n process.on('SIGINT', () => {\n })\n}\n\nmain()\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYA,MAAa,YAAY;CACrB;EACI,MAAM;EACN,OAAO;EACP,MAAM;EACN,QAAQ;EACX;CACD;EACI,MAAM;EACN,OAAO;EACP,MAAM;EACN,QAAQ;EACX;CACD;EACI,MAAM;EACN,OAAO;EACP,MAAM;EACN,QAAQ;EACX;CACD;EACI,MAAM;EACN,OAAO;EACP,MAAM;EACN,QAAQ;EACX;CAC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AIC,oCAAa,QAAQ,KAAK,EAAE,SAAS,EAAE,SAAS,YAAY;EAEhF,MAAM,2BAAc,sBAAsB,CAAC,OAAO;AAClD,QAAM,QAAQ,SAAS,KAAK,UAAU,UAAU,QAAQ;AAExD,UAAQ,KAAKC,wBAAO,MAAM,CAAC,CAAC,kBAAkB,QAAQ,CAAC,EAAE,IAAI,MAAM,CAAC,CAAC,OAAO;AAC5E,QAAM,QAAQ,SAAS;AAEvB,UAAQ,KAAKA,wBAAO,MAAM,CAAC,CAAC,2BAA2B,QAAQ,CAAC,EAAE,IAAI,MAAM,CAAC,CAAC,OAAO;AACrF,QAAM,QAAQ,gBAAgB;AAC9B,QAAM,QAAQ,gBAAgB;AAE9B,UAAQ,QAAQA,wBAAO,MAAM,CAAC,CAAC,oCAAoC,QAAQ,CAAC,EAAE,IAAI,MAAM,CAAC;AAEzF,QAAM,QAAQ,UAAU;GAC1B;AAEN,SAAQ,OAAO;AAEf,SAAQ,GAAG,gBAAgB,GACzB;;AAGN,MAAM"}
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', () => {\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,OAAO;AAC1B,aAAW,YAAY;AACvB,gBAAc,QAAQ,eAAe;EAErC,MAAM,MAAM,UAAU,MAAK,MAAK,EAAE,UAAU,SAAS;AAErD,MAAI,OAAO,CAAC,IAAI,QAAQ;AACpB,2BAAO,MAAM,cAAc,IAAI,KAAK,iCAAiC;AACrE,WAAQ,KAAK,EAAE;;EAGnB,MAAM,UAAU,IAAIC,oCAAa,QAAQ,KAAK,EAAE,SAAS,EAAE,SAAS,YAAY;EAEhF,MAAM,2BAAc,sBAAsB,CAAC,OAAO;AAClD,QAAM,QAAQ,SAAS,KAAK,UAAU,UAAU,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"}
package/bin/run.js CHANGED
@@ -2,10 +2,10 @@
2
2
  import { Argument, Command } from "commander";
3
3
  import inquirer from "inquirer";
4
4
  import ora from "ora";
5
+ import { Logger, Resolver, baseTsconfig, mainTsconfig, packageJsonScript } from "@h3ravel/shared";
5
6
  import { basename, join, relative } from "node:path";
6
7
  import { copyFile, mkdir, readFile, rm, unlink, writeFile } from "node:fs/promises";
7
8
  import { detectPackageManager, installPackage } from "@antfu/install-pkg";
8
- import { Logger } from "@h3ravel/shared";
9
9
  import { downloadTemplate } from "giget";
10
10
  import { existsSync } from "node:fs";
11
11
  import { slugify } from "@h3ravel/support";
@@ -48,45 +48,6 @@ const templates = [
48
48
  }
49
49
  ];
50
50
 
51
- //#endregion
52
- //#region src/scripts.ts
53
- const mainTsconfig = {
54
- extends: "@h3ravel/shared/tsconfig.json",
55
- compilerOptions: {
56
- baseUrl: ".",
57
- outDir: "dist",
58
- paths: {
59
- "src/*": ["./../src/*"],
60
- "App/*": ["./../src/app/*"],
61
- "root/*": ["./../*"],
62
- "routes/*": ["./../src/routes/*"],
63
- "config/*": ["./../src/config/*"],
64
- "resources/*": ["./../src/resources/*"]
65
- },
66
- target: "es2022",
67
- module: "es2022",
68
- moduleResolution: "Node",
69
- esModuleInterop: true,
70
- strict: true,
71
- allowJs: true,
72
- skipLibCheck: true,
73
- resolveJsonModule: true,
74
- noEmit: true,
75
- experimentalDecorators: true,
76
- emitDecoratorMetadata: true
77
- },
78
- include: ["./**/*.d.ts", "./../**/*"],
79
- exclude: ["./dist", "./node_modules"]
80
- };
81
- const baseTsconfig = { extends: "./.h3ravel/tsconfig.json" };
82
- const packageJsonScript = {
83
- build: "NODE_ENV=production tsdown --config-loader unconfig -c tsdown.default.config.ts",
84
- dev: "NODE_ENV=development pnpm tsdown --config-loader unconfig -c tsdown.default.config.ts",
85
- start: "DIST_DIR=dist node -r source-map-support/register dist/server.js",
86
- lint: "eslint . --ext .ts",
87
- test: "NODE_NO_WARNINGS=1 NODE_ENV=testing jest --passWithNoTests"
88
- };
89
-
90
51
  //#endregion
91
52
  //#region src/actions.ts
92
53
  var actions_default = class {
@@ -97,11 +58,21 @@ var actions_default = class {
97
58
  this.description = description;
98
59
  if (!this.location) this.location = join(process.cwd(), ".temp");
99
60
  }
100
- async download(template, install = false, auth) {
101
- if (this.location?.includes(".temp")) await rm(this.location, {
61
+ async download(template, install = false, auth, overwrite = false) {
62
+ if (this.location?.includes(".temp") || overwrite && existsSync(this.location)) await rm(this.location, {
102
63
  force: true,
103
64
  recursive: true
104
65
  });
66
+ else if (existsSync(this.location)) {
67
+ console.log("\n");
68
+ Logger.parse([
69
+ [" ERROR ", "bgRed"],
70
+ [this.location, ["gray", "italic"]],
71
+ ["is not empty.", "white"]
72
+ ], " ");
73
+ console.log("");
74
+ process.exit(0);
75
+ }
105
76
  this.skipInstallation = !install;
106
77
  this.removeLockFile();
107
78
  return await downloadTemplate(template, {
@@ -118,11 +89,12 @@ var actions_default = class {
118
89
  silent: true
119
90
  });
120
91
  }
121
- async complete() {
92
+ async complete(installed = false) {
122
93
  console.log("");
123
94
  Logger.success("Your h3ravel project has been created successfully");
124
- Logger.parse([["cd " + relative(process.cwd(), this.location), "cyan"]]);
125
- Logger.parse([[`npx musket fire`, "cyan"]]);
95
+ Logger.parse([["cd", "cyan"], ["./" + relative(process.cwd(), this.location), "green"]]);
96
+ if (!installed) Logger.parse([[await Resolver.getPakageInstallCommand(), "cyan"]]);
97
+ Logger.parse([["npx", "cyan"], ["musket fire", "green"]], " ");
126
98
  Logger.parse([["Open http://localhost:3000", "cyan"]]);
127
99
  console.log("");
128
100
  Logger.parse([["Have any questions", "white"]]);
@@ -211,7 +183,7 @@ const altLogo = String.raw`%c
211
183
  async function main() {
212
184
  const program = new Command();
213
185
  program.name("create-h3ravel").description("CLI to create new h3ravel app").version("0.1.0");
214
- program.option("-n, --name <string>", "The name of your project.").option("-i, --install", "Install node_modules right away.").option("-t, --token <string>", "Kit repo authentication token.").option("-d, --desc <string>", "Project Description.").option("-k, --kit <string>\", \"Starter template kit").addArgument(new Argument("[location]", "The location where this project should be created relative to the current dir.")).action(async (pathName, options) => {
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) => {
215
187
  console.log(altLogo, `font-family: monospace`);
216
188
  let { appName, description } = await inquirer.prompt([{
217
189
  type: "input",
@@ -285,14 +257,14 @@ async function main() {
285
257
  }
286
258
  const actions = new actions_default(join(process.cwd(), location), appName, description);
287
259
  const spinner = ora(`Loading Template...`).start();
288
- await actions.download(kit?.source ?? template, install);
260
+ await actions.download(kit?.source ?? template, install, void 0, options.overwrite);
289
261
  spinner.info(Logger.parse([["Cleaning Up...", "green"]], "", false)).start();
290
262
  await actions.cleanup();
291
263
  spinner.info(Logger.parse([["Initializing Project...", "green"]], "", false)).start();
292
264
  await actions.copyExampleEnv();
293
265
  await actions.createTsConfig();
294
266
  spinner.succeed(Logger.parse([["Project initialization complete!", "green"]], "", false));
295
- await actions.complete();
267
+ await actions.complete(install);
296
268
  });
297
269
  program.parse();
298
270
  process.on("SIGINT", () => {});
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/scripts.ts","../src/actions.ts","../src/logo.ts","../src/run.ts"],"sourcesContent":["/*\n * create-h3ravel\n *\n * (c) H3ravel Framework\n *\n * The H3ravel framework and all it's base packages are \n * open-sourced software licensed under the MIT license.\n */\n\n/**\n * List of first party templates\n */\nexport const templates = [\n {\n name: 'Full Starter Kit',\n alias: 'full',\n hint: 'A full H3ravel application with everything possible',\n source: 'github:h3ravel/h3ravel',\n },\n {\n name: 'Lean Starter Kit',\n alias: 'lean',\n hint: 'A lean H3ravel application with just the framework core',\n source: null,\n },\n {\n name: 'API Starter Kit',\n alias: 'api',\n hint: 'Creates a H3ravel application for building JSON APIs',\n source: null\n },\n {\n name: 'Web Starter Kit',\n alias: 'web',\n hint: 'Creates a H3ravel application for building a server rendered app',\n source: null\n },\n {\n name: 'Inertia Starter Kit',\n alias: 'inertia',\n hint: 'Inertia application with a frontend framework of your choice',\n source: null\n },\n]\n","export const mainTsconfig = {\n extends: \"@h3ravel/shared/tsconfig.json\",\n compilerOptions: {\n baseUrl: \".\",\n outDir: \"dist\",\n paths: {\n \"src/*\": [\"./../src/*\"],\n \"App/*\": [\"./../src/app/*\"],\n \"root/*\": [\"./../*\"],\n \"routes/*\": [\"./../src/routes/*\"],\n \"config/*\": [\"./../src/config/*\"],\n \"resources/*\": [\"./../src/resources/*\"]\n },\n target: \"es2022\",\n module: \"es2022\",\n moduleResolution: \"Node\",\n esModuleInterop: true,\n strict: true,\n allowJs: true,\n skipLibCheck: true,\n resolveJsonModule: true,\n noEmit: true,\n experimentalDecorators: true,\n emitDecoratorMetadata: true\n },\n include: [\"./**/*.d.ts\", \"./../**/*\"],\n exclude: [\"./dist\", \"./node_modules\"]\n}\n\nexport const baseTsconfig = {\n extends: \"./.h3ravel/tsconfig.json\"\n}\n\nexport const packageJsonScript = {\n build: \"NODE_ENV=production tsdown --config-loader unconfig -c tsdown.default.config.ts\",\n dev: \"NODE_ENV=development pnpm tsdown --config-loader unconfig -c tsdown.default.config.ts\",\n start: \"DIST_DIR=dist node -r source-map-support/register dist/server.js\",\n lint: \"eslint . --ext .ts\",\n test: \"NODE_NO_WARNINGS=1 NODE_ENV=testing jest --passWithNoTests\",\n}\n","import { baseTsconfig, mainTsconfig, packageJsonScript } from \"./scripts\";\nimport { basename, join, relative } from \"node:path\";\nimport { copyFile, mkdir, readFile, rm, writeFile } from \"node:fs/promises\";\nimport { detectPackageManager, installPackage } from \"@antfu/install-pkg\";\n\nimport { Logger } from \"@h3ravel/shared\";\nimport { downloadTemplate } from \"giget\";\nimport { existsSync } from \"node:fs\";\nimport { slugify } from \"@h3ravel/support\";\nimport { unlink } from \"node:fs/promises\";\n\nexport default class {\n skipInstallation?: boolean\n\n constructor(private location?: string, private appName?: string, private description?: string) {\n if (!this.location) {\n this.location = join(process.cwd(), '.temp')\n }\n }\n\n async download (template: string, install = false, auth?: string) {\n if (this.location?.includes('.temp')) {\n await rm(this.location!, { force: true, recursive: true })\n }\n\n this.skipInstallation = !install\n this.removeLockFile()\n\n return await downloadTemplate(template, {\n dir: this.location,\n auth,\n install,\n registry: (await detectPackageManager()) ?? 'npm',\n forceClean: false\n });\n }\n\n async installPackage (name: string) {\n await installPackage(name, {\n cwd: this.location,\n silent: true,\n })\n }\n\n async complete () {\n console.log('')\n\n Logger.success('Your h3ravel project has been created successfully')\n Logger.parse([['cd ' + relative(process.cwd(), this.location!), 'cyan']])\n Logger.parse([[`npx musket fire`, 'cyan']])\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 .addArgument(new Argument('[location]', 'The location where this project should be created relative to the current dir.'))\n .action(async (pathName, options) => {\n\n console.log(altLogo, `font-family: monospace`)\n\n let { appName, description } = await inquirer.prompt([\n {\n type: \"input\",\n name: \"appName\",\n message: \"What is the name of your project:\",\n default: 'h3ravel',\n when: () => !options.name,\n },\n {\n type: \"input\",\n name: \"description\",\n message: \"Project Description:\",\n default: 'Modern TypeScript runtime-agnostic web framework built on top of H3.',\n when: () => !options.desc,\n }]\n ).catch(err => {\n if (err instanceof AbortPromptError || err instanceof ExitPromptError) {\n Logger.info('Thanks for trying out H3ravel.')\n process.exit(0)\n }\n return err\n })\n\n let { template, install, location, token } = await inquirer.prompt([{\n type: \"input\",\n name: \"location\",\n message: \"Installation location relative to the current dir:\",\n default: slugify(options.name ?? appName ?? basename(process.cwd()), '-'),\n when: () => !pathName,\n },\n {\n type: \"list\",\n name: \"template\",\n message: \"Choose starter template kit:\",\n choices: <never>templates.map(e => ({\n name: e.name,\n value: e.alias,\n disabled: !e.source ? '(Unavailable at this time)' : false,\n })),\n default: 'full',\n when: () => !options.kit,\n },\n {\n type: \"input\",\n name: \"token\",\n message: \"Authentication token:\",\n when: () => options.kit && !options.token,\n },\n {\n type: 'confirm',\n name: \"install\",\n message: \"Would you want to install node_modules right away:\",\n default: true,\n when: () => !options.install,\n }]).catch(err => {\n if (err instanceof AbortPromptError || err instanceof ExitPromptError) {\n Logger.info('Thanks for trying out H3ravel.')\n process.exit(0)\n }\n return err\n })\n\n token = options.token ?? token\n appName = options.name ?? appName\n install = options.install ?? install\n template = options.kit ?? template\n location = pathName ?? location\n description = options.description ?? description\n\n const kit = templates.find(e => e.alias === template)!\n\n if (kit && !kit.source) {\n Logger.error(`ERROR: The ${kit.name} kit is not currently available`)\n process.exit(1)\n }\n\n const actions = new Actions(join(process.cwd(), location), appName, description);\n\n const spinner = ora(`Loading Template...`).start();\n await actions.download(kit?.source ?? template, install);\n\n spinner.info(Logger.parse([['Cleaning Up...', 'green']], '', false)).start();\n await actions.cleanup()\n\n spinner.info(Logger.parse([['Initializing Project...', 'green']], '', false)).start();\n await actions.copyExampleEnv()\n await actions.createTsConfig()\n\n spinner.succeed(Logger.parse([['Project initialization complete!', 'green']], '', false))\n\n await actions.complete()\n });\n\n program.parse();\n\n process.on('SIGINT', () => {\n })\n}\n\nmain()\n"],"mappings":";;;;;;;;;;;;;;;;;AAYA,MAAa,YAAY;CACrB;EACI,MAAM;EACN,OAAO;EACP,MAAM;EACN,QAAQ;EACX;CACD;EACI,MAAM;EACN,OAAO;EACP,MAAM;EACN,QAAQ;EACX;CACD;EACI,MAAM;EACN,OAAO;EACP,MAAM;EACN,QAAQ;EACX;CACD;EACI,MAAM;EACN,OAAO;EACP,MAAM;EACN,QAAQ;EACX;CACD;EACI,MAAM;EACN,OAAO;EACP,MAAM;EACN,QAAQ;EACX;CACJ;;;;AC3CD,MAAa,eAAe;CAC1B,SAAS;CACT,iBAAiB;EACf,SAAS;EACT,QAAQ;EACR,OAAO;GACL,SAAS,CAAC,aAAa;GACvB,SAAS,CAAC,iBAAiB;GAC3B,UAAU,CAAC,SAAS;GACpB,YAAY,CAAC,oBAAoB;GACjC,YAAY,CAAC,oBAAoB;GACjC,eAAe,CAAC,uBAAuB;GACxC;EACD,QAAQ;EACR,QAAQ;EACR,kBAAkB;EAClB,iBAAiB;EACjB,QAAQ;EACR,SAAS;EACT,cAAc;EACd,mBAAmB;EACnB,QAAQ;EACR,wBAAwB;EACxB,uBAAuB;EACxB;CACD,SAAS,CAAC,eAAe,YAAY;CACrC,SAAS,CAAC,UAAU,iBAAiB;CACtC;AAED,MAAa,eAAe,EAC1B,SAAS,4BACV;AAED,MAAa,oBAAoB;CAC/B,OAAO;CACP,KAAK;CACL,OAAO;CACP,MAAM;CACN,MAAM;CACP;;;;AC5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,QAAQ,OAAO,MAAM,CAAC,CAAC,oCAAoC,QAAQ,CAAC,EAAE,IAAI,MAAM,CAAC;AAEzF,QAAM,QAAQ,UAAU;GAC1B;AAEN,SAAQ,OAAO;AAEf,SAAQ,GAAG,gBAAgB,GACzB;;AAGN,MAAM"}
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,AAAQA,UAAmB,AAAQC,SAAkB,AAAQC,aAAsB;EAA3E;EAA2B;EAA0B;AACrE,MAAI,CAAC,KAAK,SACN,MAAK,WAAW,KAAK,QAAQ,KAAK,EAAE,QAAQ;;CAI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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"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "create-h3ravel",
3
3
  "type": "module",
4
- "version": "0.4.0",
4
+ "version": "0.5.0",
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/shared": "^0.18.1",
29
- "@h3ravel/support": "^0.10.0",
28
+ "@h3ravel/shared": "^0.20.7",
29
+ "@h3ravel/support": "^0.10.2",
30
30
  "@inquirer/core": "^10.2.2",
31
31
  "commander": "^14.0.0",
32
32
  "giget": "^2.0.0",