create-bodhi-js 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +22 -10
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -160,6 +160,14 @@ async function create(projectName, options) {
160
160
  p.intro(pc.bgCyan(pc.black(" create-bodhi-js ")));
161
161
  let targetDir = projectName;
162
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
+ }
163
171
  if (!targetDir) {
164
172
  const result = await p.text({
165
173
  message: "Project name:",
@@ -184,7 +192,7 @@ async function create(projectName, options) {
184
192
  process.exit(1);
185
193
  }
186
194
  let enableGithubPages = options.githubPages ?? false;
187
- if (!options.githubPages) {
195
+ if (options.githubPages === void 0) {
188
196
  const result = await p.confirm({
189
197
  message: "Enable GitHub Pages deployment?",
190
198
  initialValue: false
@@ -199,15 +207,19 @@ async function create(projectName, options) {
199
207
  let basePath = "/";
200
208
  let pathSegmentsToKeep = 0;
201
209
  if (enableGithubPages) {
202
- const orgResult = await p.text({
203
- message: "Github Repo Owner (User/Org):",
204
- placeholder: "<gh-user>"
205
- });
206
- if (p.isCancel(orgResult)) {
207
- p.cancel("Operation cancelled");
208
- process.exit(0);
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;
209
222
  }
210
- githubOrg = orgResult;
211
223
  basePath = `/${targetDir}/`;
212
224
  pathSegmentsToKeep = 1;
213
225
  }
@@ -239,7 +251,7 @@ async function create(projectName, options) {
239
251
 
240
252
  // src/index.ts
241
253
  var program = new Command();
242
- 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) => {
243
255
  await create(projectName, options);
244
256
  });
245
257
  program.parse();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-bodhi-js",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "description": "Scaffold Bodhi-powered applications with React, TypeScript, Vite, and more",
5
5
  "type": "module",
6
6
  "bin": {