create-h3ravel 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/run.cjs +311 -0
- package/bin/run.cjs.map +1 -0
- package/bin/run.d.cts +1 -0
- package/bin/run.d.ts +1 -0
- package/bin/run.js +289 -0
- package/bin/run.js.map +1 -0
- package/package.json +5 -4
package/bin/run.cjs
ADDED
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
19
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
20
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
21
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
22
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
23
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
24
|
+
mod
|
|
25
|
+
));
|
|
26
|
+
|
|
27
|
+
// src/run.ts
|
|
28
|
+
var import_commander = require("commander");
|
|
29
|
+
var import_chalk2 = __toESM(require("chalk"), 1);
|
|
30
|
+
var import_inquirer = __toESM(require("inquirer"), 1);
|
|
31
|
+
|
|
32
|
+
// src/templates.ts
|
|
33
|
+
var templates = [
|
|
34
|
+
{
|
|
35
|
+
name: "Full Starter Kit",
|
|
36
|
+
alias: "full",
|
|
37
|
+
hint: "A full H3ravel application with everything possible",
|
|
38
|
+
source: "github:h3ravel/h3ravel"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
name: "Lean Starter Kit",
|
|
42
|
+
alias: "lean",
|
|
43
|
+
hint: "A lean H3ravel application with just the framework core",
|
|
44
|
+
source: null
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
name: "API Starter Kit",
|
|
48
|
+
alias: "api",
|
|
49
|
+
hint: "Creates a H3ravel application for building JSON APIs",
|
|
50
|
+
source: null
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
name: "Web Starter Kit",
|
|
54
|
+
alias: "web",
|
|
55
|
+
hint: "Creates a H3ravel application for building a server rendered app",
|
|
56
|
+
source: null
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
name: "Inertia Starter Kit",
|
|
60
|
+
alias: "inertia",
|
|
61
|
+
hint: "Inertia application with a frontend framework of your choice",
|
|
62
|
+
source: null
|
|
63
|
+
}
|
|
64
|
+
];
|
|
65
|
+
|
|
66
|
+
// src/run.ts
|
|
67
|
+
var import_ora = __toESM(require("ora"), 1);
|
|
68
|
+
|
|
69
|
+
// src/tsconfig.ts
|
|
70
|
+
var mainTsconfig = {
|
|
71
|
+
extends: "@h3ravel/shared/tsconfig.json",
|
|
72
|
+
compilerOptions: {
|
|
73
|
+
baseUrl: ".",
|
|
74
|
+
outDir: "dist",
|
|
75
|
+
paths: {
|
|
76
|
+
"src/*": [
|
|
77
|
+
"./../src/*"
|
|
78
|
+
],
|
|
79
|
+
"App/*": [
|
|
80
|
+
"./../src/app/*"
|
|
81
|
+
],
|
|
82
|
+
"root/*": [
|
|
83
|
+
"./../*"
|
|
84
|
+
],
|
|
85
|
+
"routes/*": [
|
|
86
|
+
"./../src/routes/*"
|
|
87
|
+
],
|
|
88
|
+
"config/*": [
|
|
89
|
+
"./../src/config/*"
|
|
90
|
+
],
|
|
91
|
+
"resources/*": [
|
|
92
|
+
"./../src/resources/*"
|
|
93
|
+
]
|
|
94
|
+
},
|
|
95
|
+
target: "es2022",
|
|
96
|
+
module: "es2022",
|
|
97
|
+
moduleResolution: "Node",
|
|
98
|
+
esModuleInterop: true,
|
|
99
|
+
strict: true,
|
|
100
|
+
allowJs: true,
|
|
101
|
+
skipLibCheck: true,
|
|
102
|
+
resolveJsonModule: true,
|
|
103
|
+
noEmit: true,
|
|
104
|
+
experimentalDecorators: true,
|
|
105
|
+
emitDecoratorMetadata: true
|
|
106
|
+
},
|
|
107
|
+
include: [
|
|
108
|
+
"./**/*.d.ts",
|
|
109
|
+
"./../**/*"
|
|
110
|
+
],
|
|
111
|
+
exclude: [
|
|
112
|
+
"./dist",
|
|
113
|
+
"./node_modules"
|
|
114
|
+
]
|
|
115
|
+
};
|
|
116
|
+
var baseTsconfig = {
|
|
117
|
+
extends: "./.h3ravel/tsconfig.json"
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
// src/actions.ts
|
|
121
|
+
var import_node_path = require("path");
|
|
122
|
+
var import_promises = require("fs/promises");
|
|
123
|
+
var import_install_pkg = require("@antfu/install-pkg");
|
|
124
|
+
var import_chalk = __toESM(require("chalk"), 1);
|
|
125
|
+
var import_giget = require("giget");
|
|
126
|
+
var import_node_fs = require("fs");
|
|
127
|
+
var import_support = require("@h3ravel/support");
|
|
128
|
+
var import_promises2 = require("fs/promises");
|
|
129
|
+
var actions_default = class {
|
|
130
|
+
static {
|
|
131
|
+
__name(this, "default");
|
|
132
|
+
}
|
|
133
|
+
location;
|
|
134
|
+
appName;
|
|
135
|
+
description;
|
|
136
|
+
skipInstallation;
|
|
137
|
+
constructor(location, appName, description) {
|
|
138
|
+
this.location = location;
|
|
139
|
+
this.appName = appName;
|
|
140
|
+
this.description = description;
|
|
141
|
+
if (!this.location) {
|
|
142
|
+
this.location = (0, import_node_path.join)(process.cwd(), ".temp");
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
async download(template, install = false, auth) {
|
|
146
|
+
if (this.location?.includes(".temp")) {
|
|
147
|
+
await (0, import_promises.rm)(this.location, {
|
|
148
|
+
force: true,
|
|
149
|
+
recursive: true
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
this.skipInstallation = !install;
|
|
153
|
+
this.removeLockFile();
|
|
154
|
+
return await (0, import_giget.downloadTemplate)(template, {
|
|
155
|
+
dir: this.location,
|
|
156
|
+
auth,
|
|
157
|
+
install,
|
|
158
|
+
registry: await (0, import_install_pkg.detectPackageManager)() ?? "npm",
|
|
159
|
+
forceClean: false
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
async installPackage(name) {
|
|
163
|
+
await (0, import_install_pkg.installPackage)(name, {
|
|
164
|
+
cwd: this.location,
|
|
165
|
+
silent: true
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
async complete() {
|
|
169
|
+
const packageManager = await (0, import_install_pkg.detectPackageManager)() ?? "npm";
|
|
170
|
+
console.log("");
|
|
171
|
+
console.log("Your h3ravel project has been created successfully!");
|
|
172
|
+
console.log(import_chalk.default.cyan("cd " + (0, import_node_path.relative)(process.cwd(), this.location)));
|
|
173
|
+
console.log(import_chalk.default.cyan(`${packageManager} run dev`));
|
|
174
|
+
console.log(import_chalk.default.cyan("Open http://localhost:4444"));
|
|
175
|
+
console.log("");
|
|
176
|
+
console.log(`Have any questions?`);
|
|
177
|
+
console.log(`Join our Discord server - ${import_chalk.default.yellow("https://discord.gg/hsG2A8PuGb")}`);
|
|
178
|
+
console.log(`Checkout the documentation - ${import_chalk.default.yellow("https://h3ravel.toneflix.net")}`);
|
|
179
|
+
}
|
|
180
|
+
async cleanup() {
|
|
181
|
+
const pkgPath = (0, import_node_path.join)(this.location, "package.json");
|
|
182
|
+
const pkg = await (0, import_promises.readFile)(pkgPath, "utf-8").then(JSON.parse);
|
|
183
|
+
delete pkg.packageManager;
|
|
184
|
+
pkg.name = (0, import_support.slugify)(this.appName ?? (0, import_node_path.basename)(this.location).replace(".", ""), "-");
|
|
185
|
+
if (this.description) {
|
|
186
|
+
pkg.description = this.description;
|
|
187
|
+
}
|
|
188
|
+
await Promise.allSettled([
|
|
189
|
+
(0, import_promises.writeFile)(pkgPath, JSON.stringify(pkg, null, 2)),
|
|
190
|
+
this.removeLockFile(),
|
|
191
|
+
(0, import_promises.rm)((0, import_node_path.join)(this.location, "pnpm-workspace.yaml"), {
|
|
192
|
+
force: true
|
|
193
|
+
}),
|
|
194
|
+
(0, import_promises.rm)((0, import_node_path.join)(this.location, "README.md"), {
|
|
195
|
+
force: true
|
|
196
|
+
}),
|
|
197
|
+
(0, import_promises.rm)((0, import_node_path.join)(this.location, ".github"), {
|
|
198
|
+
force: true,
|
|
199
|
+
recursive: true
|
|
200
|
+
})
|
|
201
|
+
]);
|
|
202
|
+
}
|
|
203
|
+
async removeLockFile() {
|
|
204
|
+
if (!this.skipInstallation) {
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
await Promise.allSettled([
|
|
208
|
+
(0, import_promises2.unlink)((0, import_node_path.join)(this.location, "package-lock.json")),
|
|
209
|
+
(0, import_promises2.unlink)((0, import_node_path.join)(this.location, "yarn.lock")),
|
|
210
|
+
(0, import_promises2.unlink)((0, import_node_path.join)(this.location, "pnpm-lock.yaml"))
|
|
211
|
+
]);
|
|
212
|
+
}
|
|
213
|
+
async getBanner() {
|
|
214
|
+
return await (0, import_promises.readFile)((0, import_node_path.join)(process.cwd(), "./logo.txt"), "utf-8");
|
|
215
|
+
}
|
|
216
|
+
async copyExampleEnv() {
|
|
217
|
+
const envPath = (0, import_node_path.join)(this.location, ".env");
|
|
218
|
+
const exampleEnvPath = (0, import_node_path.join)(this.location, ".env.example");
|
|
219
|
+
if ((0, import_node_fs.existsSync)(exampleEnvPath)) {
|
|
220
|
+
await (0, import_promises.copyFile)(exampleEnvPath, envPath);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
async createTsConfig() {
|
|
224
|
+
const tscPath = (0, import_node_path.join)(this.location, ".h3ravel");
|
|
225
|
+
await (0, import_promises.mkdir)(tscPath, {
|
|
226
|
+
recursive: true
|
|
227
|
+
});
|
|
228
|
+
await (0, import_promises.writeFile)((0, import_node_path.join)(tscPath, "tsconfig.json"), JSON.stringify(mainTsconfig, null, 2));
|
|
229
|
+
await (0, import_promises.writeFile)((0, import_node_path.join)(this.location, "tsconfig.json"), JSON.stringify(baseTsconfig, null, 2));
|
|
230
|
+
}
|
|
231
|
+
};
|
|
232
|
+
|
|
233
|
+
// src/run.ts
|
|
234
|
+
var import_node_path2 = require("path");
|
|
235
|
+
var import_support2 = require("@h3ravel/support");
|
|
236
|
+
var program = new import_commander.Command();
|
|
237
|
+
program.name("create-h3ravel").description("CLI to create new h3ravel app").version("0.1.0");
|
|
238
|
+
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 import_commander.Argument("[location]", "The location where this project should be created relative to the current dir.")).action(async (pathName, options) => {
|
|
239
|
+
let { appName, description } = await import_inquirer.default.prompt([
|
|
240
|
+
{
|
|
241
|
+
type: "input",
|
|
242
|
+
name: "appName",
|
|
243
|
+
message: "What is the name of your project:",
|
|
244
|
+
default: "h3ravel",
|
|
245
|
+
when: /* @__PURE__ */ __name(() => !options.name, "when")
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
type: "input",
|
|
249
|
+
name: "description",
|
|
250
|
+
message: "Project Description:",
|
|
251
|
+
when: /* @__PURE__ */ __name(() => !options.desc, "when")
|
|
252
|
+
}
|
|
253
|
+
]);
|
|
254
|
+
let { template, install, location, token } = await import_inquirer.default.prompt([
|
|
255
|
+
{
|
|
256
|
+
type: "input",
|
|
257
|
+
name: "location",
|
|
258
|
+
message: "Installation location relative to the current dir:",
|
|
259
|
+
default: (0, import_support2.slugify)(options.name ?? appName ?? (0, import_node_path2.basename)(process.cwd()), "-"),
|
|
260
|
+
when: /* @__PURE__ */ __name(() => !pathName, "when")
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
type: "list",
|
|
264
|
+
name: "template",
|
|
265
|
+
message: "Choose starter template kit:",
|
|
266
|
+
choices: templates.map((e) => ({
|
|
267
|
+
name: e.name,
|
|
268
|
+
value: e.alias,
|
|
269
|
+
disabled: !e.source ? "(Unavailable at this time)" : false
|
|
270
|
+
})),
|
|
271
|
+
default: "full",
|
|
272
|
+
when: /* @__PURE__ */ __name(() => !options.kit, "when")
|
|
273
|
+
},
|
|
274
|
+
{
|
|
275
|
+
type: "input",
|
|
276
|
+
name: "token",
|
|
277
|
+
message: "Authentication token:",
|
|
278
|
+
when: /* @__PURE__ */ __name(() => options.kit && !options.token, "when")
|
|
279
|
+
},
|
|
280
|
+
{
|
|
281
|
+
type: "confirm",
|
|
282
|
+
name: "install",
|
|
283
|
+
message: "Would you want to install node_modules right away:",
|
|
284
|
+
default: true,
|
|
285
|
+
when: /* @__PURE__ */ __name(() => !options.install, "when")
|
|
286
|
+
}
|
|
287
|
+
]);
|
|
288
|
+
token = options.token ?? token;
|
|
289
|
+
appName = options.name ?? appName;
|
|
290
|
+
install = options.install ?? install;
|
|
291
|
+
template = options.kit ?? template;
|
|
292
|
+
location = pathName ?? location;
|
|
293
|
+
description = options.description ?? description;
|
|
294
|
+
const kit = templates.find((e) => e.alias === template);
|
|
295
|
+
if (kit && !kit.source) {
|
|
296
|
+
console.log(import_chalk2.default.bgRed(" Error: "), import_chalk2.default.red(`The ${kit.name} kit is not currently available`));
|
|
297
|
+
process.exit(1);
|
|
298
|
+
}
|
|
299
|
+
const actions = new actions_default((0, import_node_path2.join)(process.cwd(), location), appName, description);
|
|
300
|
+
const spinner = (0, import_ora.default)(`Loading Template...`).start();
|
|
301
|
+
await actions.download(kit?.source ?? template, install);
|
|
302
|
+
spinner.info(import_chalk2.default.green("Cleaning Up...")).start();
|
|
303
|
+
await actions.cleanup();
|
|
304
|
+
spinner.info(import_chalk2.default.green("Initializing Project...")).start();
|
|
305
|
+
await actions.copyExampleEnv();
|
|
306
|
+
await actions.createTsConfig();
|
|
307
|
+
spinner.succeed(import_chalk2.default.green("Project initialized successfully!"));
|
|
308
|
+
await actions.complete();
|
|
309
|
+
});
|
|
310
|
+
program.parse();
|
|
311
|
+
//# sourceMappingURL=run.cjs.map
|
package/bin/run.cjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/run.ts","../src/templates.ts","../src/tsconfig.ts","../src/actions.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport { Argument, Command } from 'commander';\nimport chalk from 'chalk';\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';\n\nconst program = new Command();\n\nprogram\n .name('create-h3ravel')\n .description('CLI to create new h3ravel app')\n .version('0.1.0');\n\nprogram\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 let { appName, description } = await inquirer\n .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 when: () => !options.desc,\n }]\n )\n\n let { template, install, location, token } = await inquirer\n .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 },\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 console.log(chalk.bgRed(' Error: '), chalk.red(`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(chalk.green(\"Cleaning Up...\")).start();\n await actions.cleanup()\n\n spinner.info(chalk.green(\"Initializing Project...\")).start();\n await actions.copyExampleEnv()\n await actions.createTsConfig()\n\n spinner.succeed(chalk.green('Project initialized successfully!'))\n\n await actions.complete()\n });\n\nprogram.parse();\n","/*\n * create-h3ravel\n *\n * (c) H3ravel Framework\n *\n * The H3ravel framework and all it's base packages are \n * open-sourced software licensed under the MIT license.\n */\n\n/**\n * List of first party templates\n */\nexport const templates = [\n {\n name: 'Full Starter Kit',\n alias: 'full',\n hint: 'A full H3ravel application with everything possible',\n source: 'github:h3ravel/h3ravel',\n },\n {\n name: 'Lean Starter Kit',\n alias: 'lean',\n hint: 'A lean H3ravel application with just the framework core',\n source: null,\n },\n {\n name: 'API Starter Kit',\n alias: 'api',\n hint: 'Creates a H3ravel application for building JSON APIs',\n source: null\n },\n {\n name: 'Web Starter Kit',\n alias: 'web',\n hint: 'Creates a H3ravel application for building a server rendered app',\n source: null\n },\n {\n name: 'Inertia Starter Kit',\n alias: 'inertia',\n hint: 'Inertia application with a frontend framework of your choice',\n source: null\n },\n]\n","export const mainTsconfig = {\n extends: \"@h3ravel/shared/tsconfig.json\",\n compilerOptions: {\n baseUrl: \".\",\n outDir: \"dist\",\n paths: {\n \"src/*\": [\"./../src/*\"],\n \"App/*\": [\"./../src/app/*\"],\n \"root/*\": [\"./../*\"],\n \"routes/*\": [\"./../src/routes/*\"],\n \"config/*\": [\"./../src/config/*\"],\n \"resources/*\": [\"./../src/resources/*\"]\n },\n target: \"es2022\",\n module: \"es2022\",\n moduleResolution: \"Node\",\n esModuleInterop: true,\n strict: true,\n allowJs: true,\n skipLibCheck: true,\n resolveJsonModule: true,\n noEmit: true,\n experimentalDecorators: true,\n emitDecoratorMetadata: true\n },\n include: [\"./**/*.d.ts\", \"./../**/*\"],\n exclude: [\"./dist\", \"./node_modules\"]\n}\n\nexport const baseTsconfig = {\n extends: \"./.h3ravel/tsconfig.json\"\n}\n","import { baseTsconfig, mainTsconfig } from \"./tsconfig\";\nimport { basename, join, relative } from \"node:path\";\nimport { copyFile, mkdir, readFile, rm, writeFile } from \"node:fs/promises\";\nimport { detectPackageManager, installPackage } from \"@antfu/install-pkg\";\n\nimport chalk from \"chalk\";\nimport { downloadTemplate } from \"giget\";\nimport { existsSync } from \"node:fs\";\nimport { slugify } from \"@h3ravel/support\";\nimport { unlink } from \"node:fs/promises\";\n\nexport default class {\n skipInstallation?: boolean\n\n constructor(private location?: string, private appName?: string, private description?: string) {\n if (!this.location) {\n this.location = join(process.cwd(), '.temp')\n }\n }\n\n async download (template: string, install = false, auth?: string) {\n if (this.location?.includes('.temp')) {\n await rm(this.location!, { force: true, recursive: true })\n }\n\n this.skipInstallation = !install\n this.removeLockFile()\n\n return await downloadTemplate(template, {\n dir: this.location,\n auth,\n install,\n registry: (await detectPackageManager()) ?? 'npm',\n forceClean: false\n });\n }\n\n async installPackage (name: string) {\n await installPackage(name, {\n cwd: this.location,\n silent: true,\n })\n }\n\n async complete () {\n const packageManager = (await detectPackageManager()) ?? 'npm'\n console.log('')\n console.log('Your h3ravel project has been created successfully!')\n console.log(chalk.cyan('cd ' + relative(process.cwd(), this.location!)))\n console.log(chalk.cyan(`${packageManager} run dev`))\n console.log(chalk.cyan('Open http://localhost:4444'))\n console.log('')\n console.log(`Have any questions?`)\n console.log(`Join our Discord server - ${chalk.yellow('https://discord.gg/hsG2A8PuGb')}`)\n console.log(`Checkout the documentation - ${chalk.yellow('https://h3ravel.toneflix.net')}`)\n }\n\n async cleanup () {\n const pkgPath = join(this.location!, 'package.json')\n const pkg = await readFile(pkgPath!, 'utf-8').then(JSON.parse)\n\n delete pkg.packageManager\n pkg.name = slugify(this.appName ?? basename(this.location!).replace('.', ''), '-')\n if (this.description) {\n pkg.description = this.description\n }\n\n await Promise.allSettled([\n writeFile(pkgPath, JSON.stringify(pkg, null, 2)),\n this.removeLockFile(),\n rm(join(this.location!, 'pnpm-workspace.yaml'), { force: true }),\n rm(join(this.location!, 'README.md'), { force: true }),\n rm(join(this.location!, '.github'), { force: true, recursive: true }),\n ])\n }\n\n async removeLockFile () {\n if (!this.skipInstallation) {\n return\n }\n\n await Promise.allSettled([\n unlink(join(this.location!, 'package-lock.json')),\n unlink(join(this.location!, 'yarn.lock')),\n unlink(join(this.location!, 'pnpm-lock.yaml')),\n ])\n }\n\n async getBanner () {\n return await readFile(join(process.cwd(), './logo.txt'), 'utf-8')\n }\n\n async copyExampleEnv () {\n const envPath = join(this.location!, '.env')\n const exampleEnvPath = join(this.location!, '.env.example')\n\n if (existsSync(exampleEnvPath)) {\n await copyFile(exampleEnvPath, envPath)\n }\n }\n\n async createTsConfig () {\n const tscPath = join(this.location!, '.h3ravel')\n\n await mkdir(tscPath, { recursive: true })\n await writeFile(join(tscPath, 'tsconfig.json'), JSON.stringify(mainTsconfig, null, 2))\n await writeFile(join(this.location!, 'tsconfig.json'), JSON.stringify(baseTsconfig, null, 2))\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,uBAAkC;AAClC,IAAAA,gBAAkB;AAClB,sBAAqB;;;ACQd,IAAMC,YAAY;EACrB;IACIC,MAAM;IACNC,OAAO;IACPC,MAAM;IACNC,QAAQ;EACZ;EACA;IACIH,MAAM;IACNC,OAAO;IACPC,MAAM;IACNC,QAAQ;EACZ;EACA;IACIH,MAAM;IACNC,OAAO;IACPC,MAAM;IACNC,QAAQ;EACZ;EACA;IACIH,MAAM;IACNC,OAAO;IACPC,MAAM;IACNC,QAAQ;EACZ;EACA;IACIH,MAAM;IACNC,OAAO;IACPC,MAAM;IACNC,QAAQ;EACZ;;;;ADpCJ,iBAAgB;;;AENT,IAAMC,eAAe;EAC1BC,SAAS;EACTC,iBAAiB;IACfC,SAAS;IACTC,QAAQ;IACRC,OAAO;MACL,SAAS;QAAC;;MACV,SAAS;QAAC;;MACV,UAAU;QAAC;;MACX,YAAY;QAAC;;MACb,YAAY;QAAC;;MACb,eAAe;QAAC;;IAClB;IACAC,QAAQ;IACRC,QAAQ;IACRC,kBAAkB;IAClBC,iBAAiB;IACjBC,QAAQ;IACRC,SAAS;IACTC,cAAc;IACdC,mBAAmB;IACnBC,QAAQ;IACRC,wBAAwB;IACxBC,uBAAuB;EACzB;EACAC,SAAS;IAAC;IAAe;;EACzBC,SAAS;IAAC;IAAU;;AACtB;AAEO,IAAMC,eAAe;EAC1BlB,SAAS;AACX;;;AC9BA,uBAAyC;AACzC,sBAAyD;AACzD,yBAAqD;AAErD,mBAAkB;AAClB,mBAAiC;AACjC,qBAA2B;AAC3B,qBAAwB;AACxB,IAAAmB,mBAAuB;AAEvB,IAAA,kBAAA,MAAe;EAXf,OAWe;;;;;;EACXC;EAEA,YAAoBC,UAA2BC,SAA0BC,aAAsB;SAA3EF,WAAAA;SAA2BC,UAAAA;SAA0BC,cAAAA;AAC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AA,QAAMY,MAAM,mCAAA,CAAA;AAE5B,QAAMR,QAAQa,SAAQ;AAC1B,CAAA;AAEJxD,QAAQyD,MAAK;","names":["import_chalk","templates","name","alias","hint","source","mainTsconfig","extends","compilerOptions","baseUrl","outDir","paths","target","module","moduleResolution","esModuleInterop","strict","allowJs","skipLibCheck","resolveJsonModule","noEmit","experimentalDecorators","emitDecoratorMetadata","include","exclude","baseTsconfig","import_promises","skipInstallation","location","appName","description","join","process","cwd","download","template","install","auth","includes","rm","force","recursive","removeLockFile","downloadTemplate","dir","registry","detectPackageManager","forceClean","installPackage","name","silent","complete","packageManager","console","log","chalk","cyan","relative","yellow","cleanup","pkgPath","pkg","readFile","then","JSON","parse","slugify","basename","replace","Promise","allSettled","writeFile","stringify","unlink","getBanner","copyExampleEnv","envPath","exampleEnvPath","existsSync","copyFile","createTsConfig","tscPath","mkdir","mainTsconfig","baseTsconfig","import_node_path","import_support","program","Command","name","description","version","option","addArgument","Argument","action","pathName","options","appName","inquirer","prompt","type","message","default","when","desc","template","install","location","token","slugify","basename","process","cwd","choices","templates","map","e","value","alias","disabled","source","kit","find","console","log","chalk","bgRed","red","exit","actions","Actions","join","spinner","ora","start","download","info","green","cleanup","copyExampleEnv","createTsConfig","succeed","complete","parse"]}
|
package/bin/run.d.cts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
package/bin/run.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
package/bin/run.js
ADDED
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
4
|
+
|
|
5
|
+
// src/run.ts
|
|
6
|
+
import { Argument, Command } from "commander";
|
|
7
|
+
import chalk2 from "chalk";
|
|
8
|
+
import inquirer from "inquirer";
|
|
9
|
+
|
|
10
|
+
// src/templates.ts
|
|
11
|
+
var templates = [
|
|
12
|
+
{
|
|
13
|
+
name: "Full Starter Kit",
|
|
14
|
+
alias: "full",
|
|
15
|
+
hint: "A full H3ravel application with everything possible",
|
|
16
|
+
source: "github:h3ravel/h3ravel"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
name: "Lean Starter Kit",
|
|
20
|
+
alias: "lean",
|
|
21
|
+
hint: "A lean H3ravel application with just the framework core",
|
|
22
|
+
source: null
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
name: "API Starter Kit",
|
|
26
|
+
alias: "api",
|
|
27
|
+
hint: "Creates a H3ravel application for building JSON APIs",
|
|
28
|
+
source: null
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
name: "Web Starter Kit",
|
|
32
|
+
alias: "web",
|
|
33
|
+
hint: "Creates a H3ravel application for building a server rendered app",
|
|
34
|
+
source: null
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
name: "Inertia Starter Kit",
|
|
38
|
+
alias: "inertia",
|
|
39
|
+
hint: "Inertia application with a frontend framework of your choice",
|
|
40
|
+
source: null
|
|
41
|
+
}
|
|
42
|
+
];
|
|
43
|
+
|
|
44
|
+
// src/run.ts
|
|
45
|
+
import ora from "ora";
|
|
46
|
+
|
|
47
|
+
// src/tsconfig.ts
|
|
48
|
+
var mainTsconfig = {
|
|
49
|
+
extends: "@h3ravel/shared/tsconfig.json",
|
|
50
|
+
compilerOptions: {
|
|
51
|
+
baseUrl: ".",
|
|
52
|
+
outDir: "dist",
|
|
53
|
+
paths: {
|
|
54
|
+
"src/*": [
|
|
55
|
+
"./../src/*"
|
|
56
|
+
],
|
|
57
|
+
"App/*": [
|
|
58
|
+
"./../src/app/*"
|
|
59
|
+
],
|
|
60
|
+
"root/*": [
|
|
61
|
+
"./../*"
|
|
62
|
+
],
|
|
63
|
+
"routes/*": [
|
|
64
|
+
"./../src/routes/*"
|
|
65
|
+
],
|
|
66
|
+
"config/*": [
|
|
67
|
+
"./../src/config/*"
|
|
68
|
+
],
|
|
69
|
+
"resources/*": [
|
|
70
|
+
"./../src/resources/*"
|
|
71
|
+
]
|
|
72
|
+
},
|
|
73
|
+
target: "es2022",
|
|
74
|
+
module: "es2022",
|
|
75
|
+
moduleResolution: "Node",
|
|
76
|
+
esModuleInterop: true,
|
|
77
|
+
strict: true,
|
|
78
|
+
allowJs: true,
|
|
79
|
+
skipLibCheck: true,
|
|
80
|
+
resolveJsonModule: true,
|
|
81
|
+
noEmit: true,
|
|
82
|
+
experimentalDecorators: true,
|
|
83
|
+
emitDecoratorMetadata: true
|
|
84
|
+
},
|
|
85
|
+
include: [
|
|
86
|
+
"./**/*.d.ts",
|
|
87
|
+
"./../**/*"
|
|
88
|
+
],
|
|
89
|
+
exclude: [
|
|
90
|
+
"./dist",
|
|
91
|
+
"./node_modules"
|
|
92
|
+
]
|
|
93
|
+
};
|
|
94
|
+
var baseTsconfig = {
|
|
95
|
+
extends: "./.h3ravel/tsconfig.json"
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
// src/actions.ts
|
|
99
|
+
import { basename, join, relative } from "path";
|
|
100
|
+
import { copyFile, mkdir, readFile, rm, writeFile } from "fs/promises";
|
|
101
|
+
import { detectPackageManager, installPackage } from "@antfu/install-pkg";
|
|
102
|
+
import chalk from "chalk";
|
|
103
|
+
import { downloadTemplate } from "giget";
|
|
104
|
+
import { existsSync } from "fs";
|
|
105
|
+
import { slugify } from "@h3ravel/support";
|
|
106
|
+
import { unlink } from "fs/promises";
|
|
107
|
+
var actions_default = class {
|
|
108
|
+
static {
|
|
109
|
+
__name(this, "default");
|
|
110
|
+
}
|
|
111
|
+
location;
|
|
112
|
+
appName;
|
|
113
|
+
description;
|
|
114
|
+
skipInstallation;
|
|
115
|
+
constructor(location, appName, description) {
|
|
116
|
+
this.location = location;
|
|
117
|
+
this.appName = appName;
|
|
118
|
+
this.description = description;
|
|
119
|
+
if (!this.location) {
|
|
120
|
+
this.location = join(process.cwd(), ".temp");
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
async download(template, install = false, auth) {
|
|
124
|
+
if (this.location?.includes(".temp")) {
|
|
125
|
+
await rm(this.location, {
|
|
126
|
+
force: true,
|
|
127
|
+
recursive: true
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
this.skipInstallation = !install;
|
|
131
|
+
this.removeLockFile();
|
|
132
|
+
return await downloadTemplate(template, {
|
|
133
|
+
dir: this.location,
|
|
134
|
+
auth,
|
|
135
|
+
install,
|
|
136
|
+
registry: await detectPackageManager() ?? "npm",
|
|
137
|
+
forceClean: false
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
async installPackage(name) {
|
|
141
|
+
await installPackage(name, {
|
|
142
|
+
cwd: this.location,
|
|
143
|
+
silent: true
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
async complete() {
|
|
147
|
+
const packageManager = await detectPackageManager() ?? "npm";
|
|
148
|
+
console.log("");
|
|
149
|
+
console.log("Your h3ravel project has been created successfully!");
|
|
150
|
+
console.log(chalk.cyan("cd " + relative(process.cwd(), this.location)));
|
|
151
|
+
console.log(chalk.cyan(`${packageManager} run dev`));
|
|
152
|
+
console.log(chalk.cyan("Open http://localhost:4444"));
|
|
153
|
+
console.log("");
|
|
154
|
+
console.log(`Have any questions?`);
|
|
155
|
+
console.log(`Join our Discord server - ${chalk.yellow("https://discord.gg/hsG2A8PuGb")}`);
|
|
156
|
+
console.log(`Checkout the documentation - ${chalk.yellow("https://h3ravel.toneflix.net")}`);
|
|
157
|
+
}
|
|
158
|
+
async cleanup() {
|
|
159
|
+
const pkgPath = join(this.location, "package.json");
|
|
160
|
+
const pkg = await readFile(pkgPath, "utf-8").then(JSON.parse);
|
|
161
|
+
delete pkg.packageManager;
|
|
162
|
+
pkg.name = slugify(this.appName ?? basename(this.location).replace(".", ""), "-");
|
|
163
|
+
if (this.description) {
|
|
164
|
+
pkg.description = this.description;
|
|
165
|
+
}
|
|
166
|
+
await Promise.allSettled([
|
|
167
|
+
writeFile(pkgPath, JSON.stringify(pkg, null, 2)),
|
|
168
|
+
this.removeLockFile(),
|
|
169
|
+
rm(join(this.location, "pnpm-workspace.yaml"), {
|
|
170
|
+
force: true
|
|
171
|
+
}),
|
|
172
|
+
rm(join(this.location, "README.md"), {
|
|
173
|
+
force: true
|
|
174
|
+
}),
|
|
175
|
+
rm(join(this.location, ".github"), {
|
|
176
|
+
force: true,
|
|
177
|
+
recursive: true
|
|
178
|
+
})
|
|
179
|
+
]);
|
|
180
|
+
}
|
|
181
|
+
async removeLockFile() {
|
|
182
|
+
if (!this.skipInstallation) {
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
await Promise.allSettled([
|
|
186
|
+
unlink(join(this.location, "package-lock.json")),
|
|
187
|
+
unlink(join(this.location, "yarn.lock")),
|
|
188
|
+
unlink(join(this.location, "pnpm-lock.yaml"))
|
|
189
|
+
]);
|
|
190
|
+
}
|
|
191
|
+
async getBanner() {
|
|
192
|
+
return await readFile(join(process.cwd(), "./logo.txt"), "utf-8");
|
|
193
|
+
}
|
|
194
|
+
async copyExampleEnv() {
|
|
195
|
+
const envPath = join(this.location, ".env");
|
|
196
|
+
const exampleEnvPath = join(this.location, ".env.example");
|
|
197
|
+
if (existsSync(exampleEnvPath)) {
|
|
198
|
+
await copyFile(exampleEnvPath, envPath);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
async createTsConfig() {
|
|
202
|
+
const tscPath = join(this.location, ".h3ravel");
|
|
203
|
+
await mkdir(tscPath, {
|
|
204
|
+
recursive: true
|
|
205
|
+
});
|
|
206
|
+
await writeFile(join(tscPath, "tsconfig.json"), JSON.stringify(mainTsconfig, null, 2));
|
|
207
|
+
await writeFile(join(this.location, "tsconfig.json"), JSON.stringify(baseTsconfig, null, 2));
|
|
208
|
+
}
|
|
209
|
+
};
|
|
210
|
+
|
|
211
|
+
// src/run.ts
|
|
212
|
+
import { basename as basename2, join as join2 } from "path";
|
|
213
|
+
import { slugify as slugify2 } from "@h3ravel/support";
|
|
214
|
+
var program = new Command();
|
|
215
|
+
program.name("create-h3ravel").description("CLI to create new h3ravel app").version("0.1.0");
|
|
216
|
+
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) => {
|
|
217
|
+
let { appName, description } = await inquirer.prompt([
|
|
218
|
+
{
|
|
219
|
+
type: "input",
|
|
220
|
+
name: "appName",
|
|
221
|
+
message: "What is the name of your project:",
|
|
222
|
+
default: "h3ravel",
|
|
223
|
+
when: /* @__PURE__ */ __name(() => !options.name, "when")
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
type: "input",
|
|
227
|
+
name: "description",
|
|
228
|
+
message: "Project Description:",
|
|
229
|
+
when: /* @__PURE__ */ __name(() => !options.desc, "when")
|
|
230
|
+
}
|
|
231
|
+
]);
|
|
232
|
+
let { template, install, location, token } = await inquirer.prompt([
|
|
233
|
+
{
|
|
234
|
+
type: "input",
|
|
235
|
+
name: "location",
|
|
236
|
+
message: "Installation location relative to the current dir:",
|
|
237
|
+
default: slugify2(options.name ?? appName ?? basename2(process.cwd()), "-"),
|
|
238
|
+
when: /* @__PURE__ */ __name(() => !pathName, "when")
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
type: "list",
|
|
242
|
+
name: "template",
|
|
243
|
+
message: "Choose starter template kit:",
|
|
244
|
+
choices: templates.map((e) => ({
|
|
245
|
+
name: e.name,
|
|
246
|
+
value: e.alias,
|
|
247
|
+
disabled: !e.source ? "(Unavailable at this time)" : false
|
|
248
|
+
})),
|
|
249
|
+
default: "full",
|
|
250
|
+
when: /* @__PURE__ */ __name(() => !options.kit, "when")
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
type: "input",
|
|
254
|
+
name: "token",
|
|
255
|
+
message: "Authentication token:",
|
|
256
|
+
when: /* @__PURE__ */ __name(() => options.kit && !options.token, "when")
|
|
257
|
+
},
|
|
258
|
+
{
|
|
259
|
+
type: "confirm",
|
|
260
|
+
name: "install",
|
|
261
|
+
message: "Would you want to install node_modules right away:",
|
|
262
|
+
default: true,
|
|
263
|
+
when: /* @__PURE__ */ __name(() => !options.install, "when")
|
|
264
|
+
}
|
|
265
|
+
]);
|
|
266
|
+
token = options.token ?? token;
|
|
267
|
+
appName = options.name ?? appName;
|
|
268
|
+
install = options.install ?? install;
|
|
269
|
+
template = options.kit ?? template;
|
|
270
|
+
location = pathName ?? location;
|
|
271
|
+
description = options.description ?? description;
|
|
272
|
+
const kit = templates.find((e) => e.alias === template);
|
|
273
|
+
if (kit && !kit.source) {
|
|
274
|
+
console.log(chalk2.bgRed(" Error: "), chalk2.red(`The ${kit.name} kit is not currently available`));
|
|
275
|
+
process.exit(1);
|
|
276
|
+
}
|
|
277
|
+
const actions = new actions_default(join2(process.cwd(), location), appName, description);
|
|
278
|
+
const spinner = ora(`Loading Template...`).start();
|
|
279
|
+
await actions.download(kit?.source ?? template, install);
|
|
280
|
+
spinner.info(chalk2.green("Cleaning Up...")).start();
|
|
281
|
+
await actions.cleanup();
|
|
282
|
+
spinner.info(chalk2.green("Initializing Project...")).start();
|
|
283
|
+
await actions.copyExampleEnv();
|
|
284
|
+
await actions.createTsConfig();
|
|
285
|
+
spinner.succeed(chalk2.green("Project initialized successfully!"));
|
|
286
|
+
await actions.complete();
|
|
287
|
+
});
|
|
288
|
+
program.parse();
|
|
289
|
+
//# sourceMappingURL=run.js.map
|
package/bin/run.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/run.ts","../src/templates.ts","../src/tsconfig.ts","../src/actions.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport { Argument, Command } from 'commander';\nimport chalk from 'chalk';\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';\n\nconst program = new Command();\n\nprogram\n .name('create-h3ravel')\n .description('CLI to create new h3ravel app')\n .version('0.1.0');\n\nprogram\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 let { appName, description } = await inquirer\n .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 when: () => !options.desc,\n }]\n )\n\n let { template, install, location, token } = await inquirer\n .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 },\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 console.log(chalk.bgRed(' Error: '), chalk.red(`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(chalk.green(\"Cleaning Up...\")).start();\n await actions.cleanup()\n\n spinner.info(chalk.green(\"Initializing Project...\")).start();\n await actions.copyExampleEnv()\n await actions.createTsConfig()\n\n spinner.succeed(chalk.green('Project initialized successfully!'))\n\n await actions.complete()\n });\n\nprogram.parse();\n","/*\n * create-h3ravel\n *\n * (c) H3ravel Framework\n *\n * The H3ravel framework and all it's base packages are \n * open-sourced software licensed under the MIT license.\n */\n\n/**\n * List of first party templates\n */\nexport const templates = [\n {\n name: 'Full Starter Kit',\n alias: 'full',\n hint: 'A full H3ravel application with everything possible',\n source: 'github:h3ravel/h3ravel',\n },\n {\n name: 'Lean Starter Kit',\n alias: 'lean',\n hint: 'A lean H3ravel application with just the framework core',\n source: null,\n },\n {\n name: 'API Starter Kit',\n alias: 'api',\n hint: 'Creates a H3ravel application for building JSON APIs',\n source: null\n },\n {\n name: 'Web Starter Kit',\n alias: 'web',\n hint: 'Creates a H3ravel application for building a server rendered app',\n source: null\n },\n {\n name: 'Inertia Starter Kit',\n alias: 'inertia',\n hint: 'Inertia application with a frontend framework of your choice',\n source: null\n },\n]\n","export const mainTsconfig = {\n extends: \"@h3ravel/shared/tsconfig.json\",\n compilerOptions: {\n baseUrl: \".\",\n outDir: \"dist\",\n paths: {\n \"src/*\": [\"./../src/*\"],\n \"App/*\": [\"./../src/app/*\"],\n \"root/*\": [\"./../*\"],\n \"routes/*\": [\"./../src/routes/*\"],\n \"config/*\": [\"./../src/config/*\"],\n \"resources/*\": [\"./../src/resources/*\"]\n },\n target: \"es2022\",\n module: \"es2022\",\n moduleResolution: \"Node\",\n esModuleInterop: true,\n strict: true,\n allowJs: true,\n skipLibCheck: true,\n resolveJsonModule: true,\n noEmit: true,\n experimentalDecorators: true,\n emitDecoratorMetadata: true\n },\n include: [\"./**/*.d.ts\", \"./../**/*\"],\n exclude: [\"./dist\", \"./node_modules\"]\n}\n\nexport const baseTsconfig = {\n extends: \"./.h3ravel/tsconfig.json\"\n}\n","import { baseTsconfig, mainTsconfig } from \"./tsconfig\";\nimport { basename, join, relative } from \"node:path\";\nimport { copyFile, mkdir, readFile, rm, writeFile } from \"node:fs/promises\";\nimport { detectPackageManager, installPackage } from \"@antfu/install-pkg\";\n\nimport chalk from \"chalk\";\nimport { downloadTemplate } from \"giget\";\nimport { existsSync } from \"node:fs\";\nimport { slugify } from \"@h3ravel/support\";\nimport { unlink } from \"node:fs/promises\";\n\nexport default class {\n skipInstallation?: boolean\n\n constructor(private location?: string, private appName?: string, private description?: string) {\n if (!this.location) {\n this.location = join(process.cwd(), '.temp')\n }\n }\n\n async download (template: string, install = false, auth?: string) {\n if (this.location?.includes('.temp')) {\n await rm(this.location!, { force: true, recursive: true })\n }\n\n this.skipInstallation = !install\n this.removeLockFile()\n\n return await downloadTemplate(template, {\n dir: this.location,\n auth,\n install,\n registry: (await detectPackageManager()) ?? 'npm',\n forceClean: false\n });\n }\n\n async installPackage (name: string) {\n await installPackage(name, {\n cwd: this.location,\n silent: true,\n })\n }\n\n async complete () {\n const packageManager = (await detectPackageManager()) ?? 'npm'\n console.log('')\n console.log('Your h3ravel project has been created successfully!')\n console.log(chalk.cyan('cd ' + relative(process.cwd(), this.location!)))\n console.log(chalk.cyan(`${packageManager} run dev`))\n console.log(chalk.cyan('Open http://localhost:4444'))\n console.log('')\n console.log(`Have any questions?`)\n console.log(`Join our Discord server - ${chalk.yellow('https://discord.gg/hsG2A8PuGb')}`)\n console.log(`Checkout the documentation - ${chalk.yellow('https://h3ravel.toneflix.net')}`)\n }\n\n async cleanup () {\n const pkgPath = join(this.location!, 'package.json')\n const pkg = await readFile(pkgPath!, 'utf-8').then(JSON.parse)\n\n delete pkg.packageManager\n pkg.name = slugify(this.appName ?? basename(this.location!).replace('.', ''), '-')\n if (this.description) {\n pkg.description = this.description\n }\n\n await Promise.allSettled([\n writeFile(pkgPath, JSON.stringify(pkg, null, 2)),\n this.removeLockFile(),\n rm(join(this.location!, 'pnpm-workspace.yaml'), { force: true }),\n rm(join(this.location!, 'README.md'), { force: true }),\n rm(join(this.location!, '.github'), { force: true, recursive: true }),\n ])\n }\n\n async removeLockFile () {\n if (!this.skipInstallation) {\n return\n }\n\n await Promise.allSettled([\n unlink(join(this.location!, 'package-lock.json')),\n unlink(join(this.location!, 'yarn.lock')),\n unlink(join(this.location!, 'pnpm-lock.yaml')),\n ])\n }\n\n async getBanner () {\n return await readFile(join(process.cwd(), './logo.txt'), 'utf-8')\n }\n\n async copyExampleEnv () {\n const envPath = join(this.location!, '.env')\n const exampleEnvPath = join(this.location!, '.env.example')\n\n if (existsSync(exampleEnvPath)) {\n await copyFile(exampleEnvPath, envPath)\n }\n }\n\n async createTsConfig () {\n const tscPath = join(this.location!, '.h3ravel')\n\n await mkdir(tscPath, { recursive: true })\n await writeFile(join(tscPath, 'tsconfig.json'), JSON.stringify(mainTsconfig, null, 2))\n await writeFile(join(this.location!, 'tsconfig.json'), JSON.stringify(baseTsconfig, null, 2))\n }\n}\n"],"mappings":";;;;;AAEA,SAASA,UAAUC,eAAe;AAClC,OAAOC,YAAW;AAClB,OAAOC,cAAc;;;ACQd,IAAMC,YAAY;EACrB;IACIC,MAAM;IACNC,OAAO;IACPC,MAAM;IACNC,QAAQ;EACZ;EACA;IACIH,MAAM;IACNC,OAAO;IACPC,MAAM;IACNC,QAAQ;EACZ;EACA;IACIH,MAAM;IACNC,OAAO;IACPC,MAAM;IACNC,QAAQ;EACZ;EACA;IACIH,MAAM;IACNC,OAAO;IACPC,MAAM;IACNC,QAAQ;EACZ;EACA;IACIH,MAAM;IACNC,OAAO;IACPC,MAAM;IACNC,QAAQ;EACZ;;;;ADpCJ,OAAOC,SAAS;;;AENT,IAAMC,eAAe;EAC1BC,SAAS;EACTC,iBAAiB;IACfC,SAAS;IACTC,QAAQ;IACRC,OAAO;MACL,SAAS;QAAC;;MACV,SAAS;QAAC;;MACV,UAAU;QAAC;;MACX,YAAY;QAAC;;MACb,YAAY;QAAC;;MACb,eAAe;QAAC;;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I,OAAON,IAAIjC,IAAI,iCAAiC,CAAA;AAC/FuB,YAAQiB,KAAK,CAAA;EACjB;AAEA,QAAMC,UAAU,IAAIC,gBAAQC,MAAKpB,QAAQC,IAAG,GAAIL,QAAAA,GAAWV,SAASR,WAAAA;AAEpE,QAAM2C,UAAUC,IAAI,qBAAqB,EAAEC,MAAK;AAChD,QAAML,QAAQM,SAASd,KAAKD,UAAUf,UAAUC,OAAAA;AAEhD0B,UAAQI,KAAKX,OAAMY,MAAM,gBAAA,CAAA,EAAmBH,MAAK;AACjD,QAAML,QAAQS,QAAO;AAErBN,UAAQI,KAAKX,OAAMY,MAAM,yBAAA,CAAA,EAA4BH,MAAK;AAC1D,QAAML,QAAQU,eAAc;AAC5B,QAAMV,QAAQW,eAAc;AAE5BR,UAAQS,QAAQhB,OAAMY,MAAM,mCAAA,CAAA;AAE5B,QAAMR,QAAQa,SAAQ;AAC1B,CAAA;AAEJxD,QAAQyD,MAAK;","names":["Argument","Command","chalk","inquirer","templates","name","alias","hint","source","ora","mainTsconfig","extends","compilerOptions","baseUrl","outDir","paths","target","module","moduleResolution","esModuleInterop","strict","allowJs","skipLibCheck","resolveJsonModule","noEmit","experimentalDecorators","emitDecoratorMetadata","include","exclude","baseTsconfig","basename","join","relative","copyFile","mkdir","readFile","rm","writeFile","detectPackageManager","installPackage","chalk","downloadTemplate","existsSync","slugify","unlink","skipInstallation","location","appName","description","join","process","cwd","download","template","install","auth","includes","rm","force","recursive","removeLockFile","downloadTemplate","dir","registry","detectPackageManager","forceClean","installPackage","name","silent","complete","packageManager","console","log","chalk","cyan","relative","yellow","cleanup","pkgPath","pkg","readFile","then","JSON","parse","slugify","basename","replace","Promise","allSettled","writeFile","stringify","unlink","getBanner","copyExampleEnv","envPath","exampleEnvPath","existsSync","copyFile","createTsConfig","tscPath","mkdir","mainTsconfig","baseTsconfig","basename","join","slugify","program","Command","name","description","version","option","addArgument","Argument","action","pathName","options","appName","inquirer","prompt","type","message","default","when","desc","template","install","location","token","slugify","basename","process","cwd","choices","templates","map","e","value","alias","disabled","source","kit","find","console","log","chalk","bgRed","red","exit","actions","Actions","join","spinner","ora","start","download","info","green","cleanup","copyExampleEnv","createTsConfig","succeed","complete","parse"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-h3ravel",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.1",
|
|
5
5
|
"description": "Scaffold a new H3ravel applications using templates and starter kits",
|
|
6
6
|
"main": "build/index.js",
|
|
7
7
|
"bin": {
|
|
@@ -21,12 +21,13 @@
|
|
|
21
21
|
],
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@antfu/install-pkg": "1.1.0",
|
|
24
|
+
"@h3ravel/shared": "^0.18.1",
|
|
24
25
|
"@h3ravel/support": "^0.10.0",
|
|
25
|
-
"
|
|
26
|
+
"@inquirer/core": "^10.2.2",
|
|
26
27
|
"commander": "^14.0.0",
|
|
27
28
|
"giget": "^2.0.0",
|
|
28
|
-
"inquirer": "^12.9.
|
|
29
|
-
"ora": "^
|
|
29
|
+
"inquirer": "^12.9.6",
|
|
30
|
+
"ora": "^9.0.0"
|
|
30
31
|
},
|
|
31
32
|
"devDependencies": {
|
|
32
33
|
"@changesets/cli": "^2.29.5",
|