create-h3ravel 0.1.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/README.md +108 -0
- package/bin/logo.txt +21 -0
- package/bin/run.cjs +250 -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 +228 -0
- package/bin/run.js.map +1 -0
- package/package.json +54 -0
package/README.md
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
<p align="center"><a href="https://h3ravel.toneflix.net" target="_blank"><img src="https://raw.githubusercontent.com/h3ravel/assets/refs/heads/main/logo-full.svg" width="400" alt="H3ravel Logo"></a></p>
|
|
2
|
+
|
|
3
|
+
[![Framework][ix]][lx]
|
|
4
|
+
[![Create H3ravel][i1]][l1]
|
|
5
|
+
|
|
6
|
+
# About Create H3ravel
|
|
7
|
+
|
|
8
|
+
Scaffold a new [H3ravel](https://h3ravel.toneflix.net) applications using kits and starter kits.
|
|
9
|
+
|
|
10
|
+
## Starter kits
|
|
11
|
+
|
|
12
|
+
You can use between one of the following official starter kits, or bring your own using the `--kit` flag.
|
|
13
|
+
|
|
14
|
+
- `full` : A full H3ravel application with everything possible.
|
|
15
|
+
- `lean` : A lean H3ravel application with just the framework core.
|
|
16
|
+
- `api` : Creates a H3ravel application for building JSON APIs.
|
|
17
|
+
- `web`: Creates a H3ravel application for building a server rendered app.
|
|
18
|
+
- `inertia`: Inertia application with a frontend framework of your choice.
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
```sh
|
|
23
|
+
# Using npm
|
|
24
|
+
npm init h3ravel
|
|
25
|
+
|
|
26
|
+
# Using yarn
|
|
27
|
+
yarn create h3ravel
|
|
28
|
+
|
|
29
|
+
# Using pnpm
|
|
30
|
+
pnpm create h3ravel
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Options
|
|
34
|
+
|
|
35
|
+
### `location`
|
|
36
|
+
|
|
37
|
+
You can pass the installation `location` directory as the first argument to the command. For example:
|
|
38
|
+
|
|
39
|
+
```sh
|
|
40
|
+
npm init h3ravel my-app
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
or even
|
|
44
|
+
|
|
45
|
+
```sh
|
|
46
|
+
npm init h3ravel ./
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
This argument is optional and the command will prompt you to enter the installation `location` if not provided.
|
|
50
|
+
|
|
51
|
+
> **Note** - The location must be empty or the command will fail.
|
|
52
|
+
|
|
53
|
+
### `--kit` | `-k` (Default: Prompts for selection)
|
|
54
|
+
|
|
55
|
+
You can also use your own starter kit hosted on Github, Gitlab, or Bitbucket, use the `--kit` flag to define the repo URL.
|
|
56
|
+
|
|
57
|
+
```sh
|
|
58
|
+
# Download from GitHub
|
|
59
|
+
npm init h3ravel -- --kit="github:github_user/repo"
|
|
60
|
+
|
|
61
|
+
# Github is the default provider, so if not specified, it will be assumed as github
|
|
62
|
+
npm init h3ravel -- --kit="github_user/repo"
|
|
63
|
+
|
|
64
|
+
# Download from GitLab
|
|
65
|
+
npm init h3ravel -- --kit="gitlab:user/repo"
|
|
66
|
+
|
|
67
|
+
# Download from BitBucket
|
|
68
|
+
npm init h3ravel -- --kit="bitbucket:user/repo"
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
You can also pass the branch or tag name as follows:
|
|
72
|
+
|
|
73
|
+
```sh
|
|
74
|
+
# Branch name
|
|
75
|
+
npm init h3ravel -- --kit="github:github_user/repo#branch-name"
|
|
76
|
+
|
|
77
|
+
# Tag name
|
|
78
|
+
npm init h3ravel -- --kit="github:github_user/repo#v1.0.0"
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### `--token` | `-t`
|
|
82
|
+
|
|
83
|
+
If you are using a custom starter kit hosted on a private repository, then you can pass the authentication token with the `--token` options:
|
|
84
|
+
|
|
85
|
+
```sh
|
|
86
|
+
npm init h3ravel -- --kit="github:github_user/repo" --token="github_token"
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## Contributing
|
|
90
|
+
|
|
91
|
+
Thank you for considering contributing to the H3ravel framework! The contribution guide can be found in the [H3ravel documentation](#!).
|
|
92
|
+
|
|
93
|
+
## Code of Conduct
|
|
94
|
+
|
|
95
|
+
In order to ensure that the H3ravel community is welcoming to all, please review and abide by the [Code of Conduct](#).
|
|
96
|
+
|
|
97
|
+
## Security Vulnerabilities
|
|
98
|
+
|
|
99
|
+
If you discover a security vulnerability within H3ravel, please send an e-mail to Legacy via hamzas.legacy@toneflix.ng. All security vulnerabilities will be promptly addressed.
|
|
100
|
+
|
|
101
|
+
## License
|
|
102
|
+
|
|
103
|
+
The H3ravel framework and all it's base packages are open-sourced software licensed under the [MIT license](LICENSE).
|
|
104
|
+
|
|
105
|
+
[ix]: https://img.shields.io/npm/v/%40h3ravel%2Fcore?style=flat-square&label=Framework&color=%230970ce
|
|
106
|
+
[lx]: https://www.npmjs.com/package/@h3ravel/core
|
|
107
|
+
[i1]: https://img.shields.io/npm/v/create-h3ravel?style=flat-square&label=create-h3ravel&color=%230970ce
|
|
108
|
+
[l1]: https://www.npmjs.com/package/@h3ravel/create-h3ravel
|
package/bin/logo.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
111
|
|
2
|
+
111111111
|
|
3
|
+
1111111111 111111
|
|
4
|
+
111111 111 111111
|
|
5
|
+
111111 111 111111
|
|
6
|
+
11111 111 11111
|
|
7
|
+
1111111 111 1111111
|
|
8
|
+
111 11111 111 111111 111 1111 1111 11111111 1111
|
|
9
|
+
111 11111 1111 111111 111 1111 1111 1111 11111 1111
|
|
10
|
+
111 11111 11111 111 1111 1111 111111111111 111111111111 1111 1111111 1111
|
|
11
|
+
111 111111 1111 111 111111111111 111111 11111 1111 111 1111 11111111 1111 1111
|
|
12
|
+
111 111 11111111 111 1101 1101 111111111 11111111 1111 1111111111111111101
|
|
13
|
+
111 1111111111111111 1111 111 1111 1111 111 11111011 1111 111 1111111 1101 1111
|
|
14
|
+
111 11111 1110111111111111 111 1111 1111 1111111101 1111 111111111 1111011 111111111 1111
|
|
15
|
+
1111111 111110111110 111 1111 1111 111111 1111 11011101 10111 11111 1111
|
|
16
|
+
11011 111111 11 11111
|
|
17
|
+
111111 11101 111111
|
|
18
|
+
111111 111 111111
|
|
19
|
+
111111 111 111111
|
|
20
|
+
111111111
|
|
21
|
+
110
|
package/bin/run.cjs
ADDED
|
@@ -0,0 +1,250 @@
|
|
|
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/actions.ts
|
|
70
|
+
var import_node_path = require("path");
|
|
71
|
+
var import_promises = require("fs/promises");
|
|
72
|
+
var import_install_pkg = require("@antfu/install-pkg");
|
|
73
|
+
var import_chalk = __toESM(require("chalk"), 1);
|
|
74
|
+
var import_giget = require("giget");
|
|
75
|
+
var import_node_fs = require("fs");
|
|
76
|
+
var import_support = require("@h3ravel/support");
|
|
77
|
+
var import_promises2 = require("fs/promises");
|
|
78
|
+
var actions_default = class {
|
|
79
|
+
static {
|
|
80
|
+
__name(this, "default");
|
|
81
|
+
}
|
|
82
|
+
location;
|
|
83
|
+
appName;
|
|
84
|
+
description;
|
|
85
|
+
skipInstallation;
|
|
86
|
+
constructor(location, appName, description) {
|
|
87
|
+
this.location = location;
|
|
88
|
+
this.appName = appName;
|
|
89
|
+
this.description = description;
|
|
90
|
+
if (!this.location) {
|
|
91
|
+
this.location = (0, import_node_path.join)(process.cwd(), ".temp");
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
async download(template, install = false, auth) {
|
|
95
|
+
if (this.location?.includes(".temp")) {
|
|
96
|
+
await (0, import_promises.rm)(this.location, {
|
|
97
|
+
force: true,
|
|
98
|
+
recursive: true
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
this.skipInstallation = !install;
|
|
102
|
+
this.removeLockFile();
|
|
103
|
+
return await (0, import_giget.downloadTemplate)(template, {
|
|
104
|
+
dir: this.location,
|
|
105
|
+
auth,
|
|
106
|
+
install,
|
|
107
|
+
registry: await (0, import_install_pkg.detectPackageManager)() ?? "npm",
|
|
108
|
+
forceClean: false
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
async installPackage(name) {
|
|
112
|
+
await (0, import_install_pkg.installPackage)(name, {
|
|
113
|
+
cwd: this.location,
|
|
114
|
+
silent: true
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
async complete() {
|
|
118
|
+
const packageManager = await (0, import_install_pkg.detectPackageManager)() ?? "npm";
|
|
119
|
+
console.log("");
|
|
120
|
+
console.log("Your h3ravel project has been created successfully!");
|
|
121
|
+
console.log(import_chalk.default.cyan("cd " + (0, import_node_path.relative)(process.cwd(), this.location)));
|
|
122
|
+
console.log(import_chalk.default.cyan(`${packageManager} run dev`));
|
|
123
|
+
console.log(import_chalk.default.cyan("Open http://localhost:4444"));
|
|
124
|
+
console.log("");
|
|
125
|
+
console.log(`Have any questions?`);
|
|
126
|
+
console.log(`Join our Discord server - ${import_chalk.default.yellow("https://discord.gg/hsG2A8PuGb")}`);
|
|
127
|
+
}
|
|
128
|
+
async cleanup() {
|
|
129
|
+
const pkgPath = (0, import_node_path.join)(this.location, "package.json");
|
|
130
|
+
const pkg = await (0, import_promises.readFile)(pkgPath, "utf-8").then(JSON.parse);
|
|
131
|
+
delete pkg.packageManager;
|
|
132
|
+
pkg.name = (0, import_support.slugify)(this.appName ?? (0, import_node_path.basename)(this.location).replace(".", ""), "-");
|
|
133
|
+
if (this.description) {
|
|
134
|
+
pkg.description = this.description;
|
|
135
|
+
}
|
|
136
|
+
await Promise.allSettled([
|
|
137
|
+
(0, import_promises.writeFile)(pkgPath, JSON.stringify(pkg, null, 2)),
|
|
138
|
+
this.removeLockFile(),
|
|
139
|
+
(0, import_promises.rm)((0, import_node_path.join)(this.location, "pnpm-workspace.yaml"), {
|
|
140
|
+
force: true
|
|
141
|
+
}),
|
|
142
|
+
(0, import_promises.rm)((0, import_node_path.join)(this.location, "README.md"), {
|
|
143
|
+
force: true
|
|
144
|
+
}),
|
|
145
|
+
(0, import_promises.rm)((0, import_node_path.join)(this.location, ".github"), {
|
|
146
|
+
force: true,
|
|
147
|
+
recursive: true
|
|
148
|
+
})
|
|
149
|
+
]);
|
|
150
|
+
}
|
|
151
|
+
async removeLockFile() {
|
|
152
|
+
if (!this.skipInstallation) {
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
await Promise.allSettled([
|
|
156
|
+
(0, import_promises2.unlink)((0, import_node_path.join)(this.location, "package-lock.json")),
|
|
157
|
+
(0, import_promises2.unlink)((0, import_node_path.join)(this.location, "yarn.lock")),
|
|
158
|
+
(0, import_promises2.unlink)((0, import_node_path.join)(this.location, "pnpm-lock.yaml"))
|
|
159
|
+
]);
|
|
160
|
+
}
|
|
161
|
+
async getBanner() {
|
|
162
|
+
return await (0, import_promises.readFile)((0, import_node_path.join)(process.cwd(), "./logo.txt"), "utf-8");
|
|
163
|
+
}
|
|
164
|
+
async copyExampleEnv() {
|
|
165
|
+
const envPath = (0, import_node_path.join)(this.location, ".env");
|
|
166
|
+
const exampleEnvPath = (0, import_node_path.join)(this.location, ".env.example");
|
|
167
|
+
if ((0, import_node_fs.existsSync)(exampleEnvPath)) {
|
|
168
|
+
await (0, import_promises.copyFile)(exampleEnvPath, envPath);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
// src/run.ts
|
|
174
|
+
var import_node_path2 = require("path");
|
|
175
|
+
var import_support2 = require("@h3ravel/support");
|
|
176
|
+
var program = new import_commander.Command();
|
|
177
|
+
program.name("create-h3ravel").description("CLI to create new h3ravel app").version("0.1.0");
|
|
178
|
+
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) => {
|
|
179
|
+
let { appName, description } = await import_inquirer.default.prompt([
|
|
180
|
+
{
|
|
181
|
+
type: "input",
|
|
182
|
+
name: "appName",
|
|
183
|
+
message: "What is the name of your project:",
|
|
184
|
+
default: "h3ravel",
|
|
185
|
+
when: /* @__PURE__ */ __name(() => !options.name, "when")
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
type: "input",
|
|
189
|
+
name: "description",
|
|
190
|
+
message: "Project Description:",
|
|
191
|
+
when: /* @__PURE__ */ __name(() => !options.desc, "when")
|
|
192
|
+
}
|
|
193
|
+
]);
|
|
194
|
+
let { template, install, location, token } = await import_inquirer.default.prompt([
|
|
195
|
+
{
|
|
196
|
+
type: "input",
|
|
197
|
+
name: "location",
|
|
198
|
+
message: "Installation location relative to the current dir:",
|
|
199
|
+
default: (0, import_support2.slugify)(options.name ?? appName ?? (0, import_node_path2.basename)(process.cwd()), "-"),
|
|
200
|
+
when: /* @__PURE__ */ __name(() => !pathName, "when")
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
type: "list",
|
|
204
|
+
name: "template",
|
|
205
|
+
message: "Choose starter template kit:",
|
|
206
|
+
choices: templates.map((e) => ({
|
|
207
|
+
name: e.name,
|
|
208
|
+
value: e.alias,
|
|
209
|
+
disabled: !e.source ? "(Unavailable at this time)" : false
|
|
210
|
+
})),
|
|
211
|
+
default: "full",
|
|
212
|
+
when: /* @__PURE__ */ __name(() => !options.kit, "when")
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
type: "input",
|
|
216
|
+
name: "token",
|
|
217
|
+
message: "Authentication token:",
|
|
218
|
+
when: /* @__PURE__ */ __name(() => options.kit && !options.token, "when")
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
type: "confirm",
|
|
222
|
+
name: "install",
|
|
223
|
+
message: "Would you want to install node_modules right away:",
|
|
224
|
+
default: true,
|
|
225
|
+
when: /* @__PURE__ */ __name(() => !options.install, "when")
|
|
226
|
+
}
|
|
227
|
+
]);
|
|
228
|
+
token = options.token ?? token;
|
|
229
|
+
appName = options.name ?? appName;
|
|
230
|
+
install = options.install ?? install;
|
|
231
|
+
template = options.kit ?? template;
|
|
232
|
+
location = pathName ?? location;
|
|
233
|
+
description = options.description ?? description;
|
|
234
|
+
const kit = templates.find((e) => e.alias === template);
|
|
235
|
+
if (kit && !kit.source) {
|
|
236
|
+
console.log(import_chalk2.default.bgRed(" Error: "), import_chalk2.default.red(`The ${kit.name} kit is not currently available`));
|
|
237
|
+
process.exit(1);
|
|
238
|
+
}
|
|
239
|
+
const actions = new actions_default((0, import_node_path2.join)(process.cwd(), location), appName, description);
|
|
240
|
+
const spinner = (0, import_ora.default)(`Loading Template...`).start();
|
|
241
|
+
await actions.download(kit?.source ?? template, install);
|
|
242
|
+
spinner.info(import_chalk2.default.green("Cleaning Up...")).start();
|
|
243
|
+
await actions.cleanup();
|
|
244
|
+
spinner.info(import_chalk2.default.green("Creating .env...")).start();
|
|
245
|
+
await actions.copyExampleEnv();
|
|
246
|
+
spinner.succeed(import_chalk2.default.green("Template Downloaded!"));
|
|
247
|
+
await actions.complete();
|
|
248
|
+
});
|
|
249
|
+
program.parse();
|
|
250
|
+
//# sourceMappingURL=run.cjs.map
|
package/bin/run.cjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/run.ts","../src/templates.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(\"Creating .env...\")).start();\n await actions.copyExampleEnv()\n\n spinner.succeed(chalk.green('Template Downloaded!'))\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","import { basename, join, relative } from \"node:path\";\nimport { copyFile, 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 }\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"],"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;;;AENhB,uBAAyC;AACzC,sBAAkD;AAClD,yBAAqD;AAErD,mBAAkB;AAClB,mBAAiC;AACjC,qBAA2B;AAC3B,qBAAwB;AACxB,IAAAC,mBAAuB;AAEvB,IAAA,kBAAA,MAAe;EAVf,OAUe;;;;;;EACXC;EAEA,YAAoBC,UAA2BC,SAA0BC,aAAsB;SAA3EF,WAAAA;SAA2BC,UAAAA;SAA0BC,cAAAA;AACrE,QAAI,CAAC,KAAKF,UAAU;AAChB,WAAKA,eAAWG,uBAAKC,QAAQC,IAAG,GAAI,OAAA;IACxC;EACJ;EAEA,MAAMC,SAAUC,UAAkBC,UAAU,OAAOC,MAAe;AAC9D,QAAI,KAAKT,UAAUU,SAAS,OAAA,GAAU;AAClC,gBAAMC,oBAAG,KAAKX,UAAW;QAAEY,OAAO;QAAMC,WAAW;MAAK,CAAA;IAC5D;AAEA,SAAKd,mBAAmB,CAACS;AACzB,SAAKM,eAAc;AAEnB,WAAO,UAAMC,+BAAiBR,UAAU;MACpCS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QiB,KAAK,CAAA;EACjB;AAEA,QAAMC,UAAU,IAAIC,oBAAQC,wBAAKpB,QAAQC,IAAG,GAAIL,QAAAA,GAAWV,SAASR,WAAAA;AAEpE,QAAM2C,cAAUC,WAAAA,SAAI,qBAAqB,EAAEC,MAAK;AAChD,QAAML,QAAQM,SAASd,KAAKD,UAAUf,UAAUC,OAAAA;AAEhD0B,UAAQI,KAAKX,cAAAA,QAAMY,MAAM,gBAAA,CAAA,EAAmBH,MAAK;AACjD,QAAML,QAAQS,QAAO;AAErBN,UAAQI,KAAKX,cAAAA,QAAMY,MAAM,kBAAA,CAAA,EAAqBH,MAAK;AACnD,QAAML,QAAQU,eAAc;AAE5BP,UAAQQ,QAAQf,cAAAA,QAAMY,MAAM,sBAAA,CAAA;AAE5B,QAAMR,QAAQY,SAAQ;AAC1B,CAAA;AAEJvD,QAAQwD,MAAK;","names":["import_chalk","templates","name","alias","hint","source","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","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","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,228 @@
|
|
|
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/actions.ts
|
|
48
|
+
import { basename, join, relative } from "path";
|
|
49
|
+
import { copyFile, readFile, rm, writeFile } from "fs/promises";
|
|
50
|
+
import { detectPackageManager, installPackage } from "@antfu/install-pkg";
|
|
51
|
+
import chalk from "chalk";
|
|
52
|
+
import { downloadTemplate } from "giget";
|
|
53
|
+
import { existsSync } from "fs";
|
|
54
|
+
import { slugify } from "@h3ravel/support";
|
|
55
|
+
import { unlink } from "fs/promises";
|
|
56
|
+
var actions_default = class {
|
|
57
|
+
static {
|
|
58
|
+
__name(this, "default");
|
|
59
|
+
}
|
|
60
|
+
location;
|
|
61
|
+
appName;
|
|
62
|
+
description;
|
|
63
|
+
skipInstallation;
|
|
64
|
+
constructor(location, appName, description) {
|
|
65
|
+
this.location = location;
|
|
66
|
+
this.appName = appName;
|
|
67
|
+
this.description = description;
|
|
68
|
+
if (!this.location) {
|
|
69
|
+
this.location = join(process.cwd(), ".temp");
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
async download(template, install = false, auth) {
|
|
73
|
+
if (this.location?.includes(".temp")) {
|
|
74
|
+
await rm(this.location, {
|
|
75
|
+
force: true,
|
|
76
|
+
recursive: true
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
this.skipInstallation = !install;
|
|
80
|
+
this.removeLockFile();
|
|
81
|
+
return await downloadTemplate(template, {
|
|
82
|
+
dir: this.location,
|
|
83
|
+
auth,
|
|
84
|
+
install,
|
|
85
|
+
registry: await detectPackageManager() ?? "npm",
|
|
86
|
+
forceClean: false
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
async installPackage(name) {
|
|
90
|
+
await installPackage(name, {
|
|
91
|
+
cwd: this.location,
|
|
92
|
+
silent: true
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
async complete() {
|
|
96
|
+
const packageManager = await detectPackageManager() ?? "npm";
|
|
97
|
+
console.log("");
|
|
98
|
+
console.log("Your h3ravel project has been created successfully!");
|
|
99
|
+
console.log(chalk.cyan("cd " + relative(process.cwd(), this.location)));
|
|
100
|
+
console.log(chalk.cyan(`${packageManager} run dev`));
|
|
101
|
+
console.log(chalk.cyan("Open http://localhost:4444"));
|
|
102
|
+
console.log("");
|
|
103
|
+
console.log(`Have any questions?`);
|
|
104
|
+
console.log(`Join our Discord server - ${chalk.yellow("https://discord.gg/hsG2A8PuGb")}`);
|
|
105
|
+
}
|
|
106
|
+
async cleanup() {
|
|
107
|
+
const pkgPath = join(this.location, "package.json");
|
|
108
|
+
const pkg = await readFile(pkgPath, "utf-8").then(JSON.parse);
|
|
109
|
+
delete pkg.packageManager;
|
|
110
|
+
pkg.name = slugify(this.appName ?? basename(this.location).replace(".", ""), "-");
|
|
111
|
+
if (this.description) {
|
|
112
|
+
pkg.description = this.description;
|
|
113
|
+
}
|
|
114
|
+
await Promise.allSettled([
|
|
115
|
+
writeFile(pkgPath, JSON.stringify(pkg, null, 2)),
|
|
116
|
+
this.removeLockFile(),
|
|
117
|
+
rm(join(this.location, "pnpm-workspace.yaml"), {
|
|
118
|
+
force: true
|
|
119
|
+
}),
|
|
120
|
+
rm(join(this.location, "README.md"), {
|
|
121
|
+
force: true
|
|
122
|
+
}),
|
|
123
|
+
rm(join(this.location, ".github"), {
|
|
124
|
+
force: true,
|
|
125
|
+
recursive: true
|
|
126
|
+
})
|
|
127
|
+
]);
|
|
128
|
+
}
|
|
129
|
+
async removeLockFile() {
|
|
130
|
+
if (!this.skipInstallation) {
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
await Promise.allSettled([
|
|
134
|
+
unlink(join(this.location, "package-lock.json")),
|
|
135
|
+
unlink(join(this.location, "yarn.lock")),
|
|
136
|
+
unlink(join(this.location, "pnpm-lock.yaml"))
|
|
137
|
+
]);
|
|
138
|
+
}
|
|
139
|
+
async getBanner() {
|
|
140
|
+
return await readFile(join(process.cwd(), "./logo.txt"), "utf-8");
|
|
141
|
+
}
|
|
142
|
+
async copyExampleEnv() {
|
|
143
|
+
const envPath = join(this.location, ".env");
|
|
144
|
+
const exampleEnvPath = join(this.location, ".env.example");
|
|
145
|
+
if (existsSync(exampleEnvPath)) {
|
|
146
|
+
await copyFile(exampleEnvPath, envPath);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
// src/run.ts
|
|
152
|
+
import { basename as basename2, join as join2 } from "path";
|
|
153
|
+
import { slugify as slugify2 } from "@h3ravel/support";
|
|
154
|
+
var program = new Command();
|
|
155
|
+
program.name("create-h3ravel").description("CLI to create new h3ravel app").version("0.1.0");
|
|
156
|
+
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) => {
|
|
157
|
+
let { appName, description } = await inquirer.prompt([
|
|
158
|
+
{
|
|
159
|
+
type: "input",
|
|
160
|
+
name: "appName",
|
|
161
|
+
message: "What is the name of your project:",
|
|
162
|
+
default: "h3ravel",
|
|
163
|
+
when: /* @__PURE__ */ __name(() => !options.name, "when")
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
type: "input",
|
|
167
|
+
name: "description",
|
|
168
|
+
message: "Project Description:",
|
|
169
|
+
when: /* @__PURE__ */ __name(() => !options.desc, "when")
|
|
170
|
+
}
|
|
171
|
+
]);
|
|
172
|
+
let { template, install, location, token } = await inquirer.prompt([
|
|
173
|
+
{
|
|
174
|
+
type: "input",
|
|
175
|
+
name: "location",
|
|
176
|
+
message: "Installation location relative to the current dir:",
|
|
177
|
+
default: slugify2(options.name ?? appName ?? basename2(process.cwd()), "-"),
|
|
178
|
+
when: /* @__PURE__ */ __name(() => !pathName, "when")
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
type: "list",
|
|
182
|
+
name: "template",
|
|
183
|
+
message: "Choose starter template kit:",
|
|
184
|
+
choices: templates.map((e) => ({
|
|
185
|
+
name: e.name,
|
|
186
|
+
value: e.alias,
|
|
187
|
+
disabled: !e.source ? "(Unavailable at this time)" : false
|
|
188
|
+
})),
|
|
189
|
+
default: "full",
|
|
190
|
+
when: /* @__PURE__ */ __name(() => !options.kit, "when")
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
type: "input",
|
|
194
|
+
name: "token",
|
|
195
|
+
message: "Authentication token:",
|
|
196
|
+
when: /* @__PURE__ */ __name(() => options.kit && !options.token, "when")
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
type: "confirm",
|
|
200
|
+
name: "install",
|
|
201
|
+
message: "Would you want to install node_modules right away:",
|
|
202
|
+
default: true,
|
|
203
|
+
when: /* @__PURE__ */ __name(() => !options.install, "when")
|
|
204
|
+
}
|
|
205
|
+
]);
|
|
206
|
+
token = options.token ?? token;
|
|
207
|
+
appName = options.name ?? appName;
|
|
208
|
+
install = options.install ?? install;
|
|
209
|
+
template = options.kit ?? template;
|
|
210
|
+
location = pathName ?? location;
|
|
211
|
+
description = options.description ?? description;
|
|
212
|
+
const kit = templates.find((e) => e.alias === template);
|
|
213
|
+
if (kit && !kit.source) {
|
|
214
|
+
console.log(chalk2.bgRed(" Error: "), chalk2.red(`The ${kit.name} kit is not currently available`));
|
|
215
|
+
process.exit(1);
|
|
216
|
+
}
|
|
217
|
+
const actions = new actions_default(join2(process.cwd(), location), appName, description);
|
|
218
|
+
const spinner = ora(`Loading Template...`).start();
|
|
219
|
+
await actions.download(kit?.source ?? template, install);
|
|
220
|
+
spinner.info(chalk2.green("Cleaning Up...")).start();
|
|
221
|
+
await actions.cleanup();
|
|
222
|
+
spinner.info(chalk2.green("Creating .env...")).start();
|
|
223
|
+
await actions.copyExampleEnv();
|
|
224
|
+
spinner.succeed(chalk2.green("Template Downloaded!"));
|
|
225
|
+
await actions.complete();
|
|
226
|
+
});
|
|
227
|
+
program.parse();
|
|
228
|
+
//# sourceMappingURL=run.js.map
|
package/bin/run.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/run.ts","../src/templates.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(\"Creating .env...\")).start();\n await actions.copyExampleEnv()\n\n spinner.succeed(chalk.green('Template Downloaded!'))\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","import { basename, join, relative } from \"node:path\";\nimport { copyFile, 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 }\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"],"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;IAC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;AACnD,QAAML,QAAQU,eAAc;AAE5BP,UAAQQ,QAAQf,OAAMY,MAAM,sBAAA,CAAA;AAE5B,QAAMR,QAAQY,SAAQ;AAC1B,CAAA;AAEJvD,QAAQwD,MAAK;","names":["Argument","Command","chalk","inquirer","templates","name","alias","hint","source","ora","basename","join","relative","copyFile","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","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","succeed","complete","parse"]}
|
package/package.json
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "create-h3ravel",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "0.1.0",
|
|
5
|
+
"description": "Scaffold a new H3ravel applications using templates and starter kits",
|
|
6
|
+
"main": "build/index.js",
|
|
7
|
+
"bin": {
|
|
8
|
+
"create-h3ravel": "bin/run.js"
|
|
9
|
+
},
|
|
10
|
+
"exports": {
|
|
11
|
+
".": "./bin/run.js"
|
|
12
|
+
},
|
|
13
|
+
"keywords": [
|
|
14
|
+
"h3ravel",
|
|
15
|
+
"create-h3ravel"
|
|
16
|
+
],
|
|
17
|
+
"files": [
|
|
18
|
+
"bin",
|
|
19
|
+
"bin/run.d.ts",
|
|
20
|
+
"bin/run.js"
|
|
21
|
+
],
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"@h3ravel/support": "^0.7.0",
|
|
24
|
+
"@antfu/install-pkg": "1.1.0",
|
|
25
|
+
"chalk": "^5.5.0",
|
|
26
|
+
"commander": "^14.0.0",
|
|
27
|
+
"giget": "^2.0.0",
|
|
28
|
+
"inquirer": "^12.9.0",
|
|
29
|
+
"ora": "^8.2.0"
|
|
30
|
+
},
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"@changesets/cli": "^2.29.5",
|
|
33
|
+
"@swc/core": "^1.6.1",
|
|
34
|
+
"@types/jest": "^30.0.0",
|
|
35
|
+
"@types/node": "^20.14.5",
|
|
36
|
+
"eslint": "^9.32.0",
|
|
37
|
+
"jest": "^30.0.5",
|
|
38
|
+
"jest-junit": "^16.0.0",
|
|
39
|
+
"ts-jest": "^29.4.1",
|
|
40
|
+
"ts-node": "^10.9.2",
|
|
41
|
+
"tsup": "^8.5.0",
|
|
42
|
+
"tsx": "^4.20.3",
|
|
43
|
+
"typescript": "^5.4.5"
|
|
44
|
+
},
|
|
45
|
+
"scripts": {
|
|
46
|
+
"quick:test": "pnpm jest",
|
|
47
|
+
"test": "pnpm run quick:test",
|
|
48
|
+
"runner": "tsx --experimental-specifier-resolution=node src/run.ts",
|
|
49
|
+
"build": "tsup && cp logo.txt bin/logo.txt",
|
|
50
|
+
"version": "pnpm run build",
|
|
51
|
+
"unlink": "npm unlink -g create-h3ravel",
|
|
52
|
+
"release": "pnpm build && pnpm changeset version && pnpm changeset publish"
|
|
53
|
+
}
|
|
54
|
+
}
|