create-bodhi-js 0.3.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +27 -11
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -22,7 +22,11 @@ var TEMPLATE_FILES = [
|
|
|
22
22
|
"index.html",
|
|
23
23
|
"public/404.html",
|
|
24
24
|
"README.md",
|
|
25
|
-
"playwright.config.ts"
|
|
25
|
+
"playwright.config.ts",
|
|
26
|
+
"CONTRIBUTING.md",
|
|
27
|
+
"src/App.tsx",
|
|
28
|
+
".github/SECURITY.md",
|
|
29
|
+
".github/ISSUE_TEMPLATE/config.yml"
|
|
26
30
|
];
|
|
27
31
|
async function processTemplates(targetDir, vars) {
|
|
28
32
|
for (const file of TEMPLATE_FILES) {
|
|
@@ -156,6 +160,14 @@ async function create(projectName, options) {
|
|
|
156
160
|
p.intro(pc.bgCyan(pc.black(" create-bodhi-js ")));
|
|
157
161
|
let targetDir = projectName;
|
|
158
162
|
const template = options.template;
|
|
163
|
+
if (targetDir) {
|
|
164
|
+
if (!/^[a-z0-9-]+$/.test(targetDir)) {
|
|
165
|
+
p.log.error(
|
|
166
|
+
"Invalid project name. Use lowercase letters, numbers, and hyphens only (e.g., my-chat-app)"
|
|
167
|
+
);
|
|
168
|
+
process.exit(1);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
159
171
|
if (!targetDir) {
|
|
160
172
|
const result = await p.text({
|
|
161
173
|
message: "Project name:",
|
|
@@ -180,7 +192,7 @@ async function create(projectName, options) {
|
|
|
180
192
|
process.exit(1);
|
|
181
193
|
}
|
|
182
194
|
let enableGithubPages = options.githubPages ?? false;
|
|
183
|
-
if (
|
|
195
|
+
if (options.githubPages === void 0) {
|
|
184
196
|
const result = await p.confirm({
|
|
185
197
|
message: "Enable GitHub Pages deployment?",
|
|
186
198
|
initialValue: false
|
|
@@ -195,15 +207,19 @@ async function create(projectName, options) {
|
|
|
195
207
|
let basePath = "/";
|
|
196
208
|
let pathSegmentsToKeep = 0;
|
|
197
209
|
if (enableGithubPages) {
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
210
|
+
if (options.githubOrg) {
|
|
211
|
+
githubOrg = options.githubOrg;
|
|
212
|
+
} else {
|
|
213
|
+
const orgResult = await p.text({
|
|
214
|
+
message: "Github Repo Owner (User/Org):",
|
|
215
|
+
placeholder: "<gh-user>"
|
|
216
|
+
});
|
|
217
|
+
if (p.isCancel(orgResult)) {
|
|
218
|
+
p.cancel("Operation cancelled");
|
|
219
|
+
process.exit(0);
|
|
220
|
+
}
|
|
221
|
+
githubOrg = orgResult;
|
|
205
222
|
}
|
|
206
|
-
githubOrg = orgResult;
|
|
207
223
|
basePath = `/${targetDir}/`;
|
|
208
224
|
pathSegmentsToKeep = 1;
|
|
209
225
|
}
|
|
@@ -235,7 +251,7 @@ async function create(projectName, options) {
|
|
|
235
251
|
|
|
236
252
|
// src/index.ts
|
|
237
253
|
var program = new Command();
|
|
238
|
-
program.name("create-bodhi-js").description("Scaffold Bodhi-powered applications").version("0.1.0").argument("[project-name]", "Name of the project").option("-t, --template <name>", "Template to use (react, svelte, vue)", "react").option("--no-install", "Skip dependency installation").option("--no-git", "Skip git initialization").option("--github-pages", "Enable GitHub Pages deployment setup").action(async (projectName, options) => {
|
|
254
|
+
program.name("create-bodhi-js").description("Scaffold Bodhi-powered applications").version("0.1.0").argument("[project-name]", "Name of the project").option("-t, --template <name>", "Template to use (react, svelte, vue)", "react").option("--no-install", "Skip dependency installation").option("--no-git", "Skip git initialization").option("--github-pages", "Enable GitHub Pages deployment setup").option("--github-org <org>", "GitHub repository owner (user/org)").action(async (projectName, options) => {
|
|
239
255
|
await create(projectName, options);
|
|
240
256
|
});
|
|
241
257
|
program.parse();
|