@emberkit/cli 0.4.0 → 0.5.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/dist/cli.js +99 -11
- package/dist/commands/create.js +36 -523
- package/dist/templates/api.js +280 -0
- package/dist/templates/blog.js +358 -0
- package/dist/templates/dashboard.js +407 -0
- package/dist/templates/index.js +179 -38
- package/dist/templates/minimal.js +89 -0
- package/dist/templates/projects.js +536 -0
- package/dist/templates/saas.js +539 -0
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import inquirer from "inquirer";
|
|
1
2
|
import { dev } from "./commands/dev.js";
|
|
2
3
|
import { build } from "./commands/build.js";
|
|
3
4
|
import { preview } from "./commands/preview.js";
|
|
4
5
|
import { create } from "./commands/create.js";
|
|
6
|
+
import { TEMPLATES } from "./commands/create.js";
|
|
5
7
|
export async function runCLI(args) {
|
|
6
8
|
const [command, ...restArgs] = args.slice(2);
|
|
7
9
|
if (!command) {
|
|
@@ -45,36 +47,122 @@ function showHelp() {
|
|
|
45
47
|
Usage: emberkit <command> [options]
|
|
46
48
|
|
|
47
49
|
Commands:
|
|
48
|
-
create
|
|
50
|
+
create [name] Create a new EmberKit project
|
|
49
51
|
dev Start development server
|
|
50
52
|
build Build for production
|
|
51
53
|
preview Preview production build
|
|
52
54
|
generate <type> Generate code (routes, components, etc.)
|
|
53
55
|
|
|
54
56
|
Options:
|
|
55
|
-
--
|
|
56
|
-
--
|
|
57
|
+
--template, -t <id> Project template to use
|
|
58
|
+
--no-install Skip dependency installation
|
|
59
|
+
--help, -h Show this help message
|
|
60
|
+
--version, -v Show version number
|
|
61
|
+
|
|
62
|
+
Templates:
|
|
63
|
+
basic Simple starter with Tailwind CSS (default)
|
|
64
|
+
with-ui Starter with EmberKit UI components
|
|
65
|
+
minimal Barebones project, no CSS framework
|
|
66
|
+
blog Blog with file-based routing and Tailwind
|
|
67
|
+
saas SaaS landing page with auth routes
|
|
68
|
+
dashboard Admin dashboard with sidebar layout
|
|
69
|
+
api REST API server with CRUD endpoints
|
|
57
70
|
|
|
58
71
|
Examples:
|
|
59
72
|
emberkit create my-app
|
|
60
|
-
emberkit
|
|
61
|
-
emberkit
|
|
62
|
-
emberkit
|
|
73
|
+
emberkit create my-blog --template blog
|
|
74
|
+
emberkit create my-saas -t saas
|
|
75
|
+
emberkit create
|
|
63
76
|
`);
|
|
64
77
|
}
|
|
65
78
|
async function handleCreate(args) {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
console.error("Usage: emberkit create <project-name>");
|
|
70
|
-
process.exit(1);
|
|
79
|
+
if (args.includes("--help") || args.includes("-h")) {
|
|
80
|
+
showCreateHelp();
|
|
81
|
+
return;
|
|
71
82
|
}
|
|
83
|
+
const name = extractFlag(args, 0);
|
|
84
|
+
const template = extractFlagValue(args, "--template", "-t");
|
|
72
85
|
const noInstall = args.includes("--no-install");
|
|
86
|
+
if (!name) {
|
|
87
|
+
const answers = await inquirer.prompt([
|
|
88
|
+
{
|
|
89
|
+
type: "input",
|
|
90
|
+
name: "name",
|
|
91
|
+
message: "What is your project name?",
|
|
92
|
+
default: "my-emberkit-app",
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
type: "list",
|
|
96
|
+
name: "template",
|
|
97
|
+
message: "Choose a template:",
|
|
98
|
+
choices: TEMPLATES.map((t) => ({
|
|
99
|
+
name: `${t.name.padEnd(12)} — ${t.desc}`,
|
|
100
|
+
value: t.id,
|
|
101
|
+
})),
|
|
102
|
+
default: "basic",
|
|
103
|
+
},
|
|
104
|
+
]);
|
|
105
|
+
await create({
|
|
106
|
+
name: answers.name,
|
|
107
|
+
template: answers.template,
|
|
108
|
+
noInstall,
|
|
109
|
+
});
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
73
112
|
await create({
|
|
74
113
|
name,
|
|
114
|
+
template,
|
|
75
115
|
noInstall,
|
|
76
116
|
});
|
|
77
117
|
}
|
|
118
|
+
function showCreateHelp() {
|
|
119
|
+
console.log(`
|
|
120
|
+
🔥 EmberKit — Create a new project
|
|
121
|
+
|
|
122
|
+
Usage: emberkit create [name] [options]
|
|
123
|
+
|
|
124
|
+
Arguments:
|
|
125
|
+
name Project name (optional, prompts if omitted)
|
|
126
|
+
|
|
127
|
+
Options:
|
|
128
|
+
--template, -t <id> Project template to use
|
|
129
|
+
--no-install Skip dependency installation
|
|
130
|
+
--help, -h Show this help
|
|
131
|
+
|
|
132
|
+
Templates:
|
|
133
|
+
basic Simple starter with Tailwind CSS (default)
|
|
134
|
+
with-ui Starter with EmberKit UI components
|
|
135
|
+
minimal Barebones project, no CSS framework
|
|
136
|
+
blog Blog with file-based routing and Tailwind
|
|
137
|
+
saas SaaS landing page with auth routes
|
|
138
|
+
dashboard Admin dashboard with sidebar layout
|
|
139
|
+
api REST API server with CRUD endpoints
|
|
140
|
+
|
|
141
|
+
Examples:
|
|
142
|
+
emberkit create my-app
|
|
143
|
+
emberkit create my-blog --template blog
|
|
144
|
+
emberkit create my-saas -t saas
|
|
145
|
+
emberkit create (interactive mode)
|
|
146
|
+
`);
|
|
147
|
+
}
|
|
148
|
+
function extractFlag(args, index) {
|
|
149
|
+
return args.filter((a) => !a.startsWith("-"))[index];
|
|
150
|
+
}
|
|
151
|
+
function extractFlagValue(args, longFlag, shortFlag) {
|
|
152
|
+
const flags = shortFlag ? [longFlag, shortFlag] : [longFlag];
|
|
153
|
+
for (let i = 0; i < args.length; i++) {
|
|
154
|
+
if (flags.includes(args[i])) {
|
|
155
|
+
return args[i + 1];
|
|
156
|
+
}
|
|
157
|
+
if (args[i].startsWith(`${longFlag}=`)) {
|
|
158
|
+
return args[i].split("=")[1];
|
|
159
|
+
}
|
|
160
|
+
if (shortFlag && args[i].startsWith(`${shortFlag}=`)) {
|
|
161
|
+
return args[i].split("=")[1];
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
return undefined;
|
|
165
|
+
}
|
|
78
166
|
async function runGenerate(args) {
|
|
79
167
|
const [type, name] = args;
|
|
80
168
|
if (!type || !name) {
|