flash-builder 1.0.12 → 1.0.13

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.cjs CHANGED
@@ -9819,7 +9819,7 @@ var meow = (helpText, options = {}) => {
9819
9819
  };
9820
9820
 
9821
9821
  // version.ts
9822
- var version = "1.0.12";
9822
+ var version = "1.0.13";
9823
9823
  var version_default = version;
9824
9824
 
9825
9825
  // src/banner.ts
@@ -9923,39 +9923,42 @@ function beCommand(projectName, verbose, targetPath) {
9923
9923
  console.log("Usage: fbi be <project-name>");
9924
9924
  process.exit(1);
9925
9925
  }
9926
- const isCurrentDir = targetPath === "." || targetPath?.startsWith("./");
9927
9926
  let projectPath;
9928
- let actualProjectName;
9929
- if (isCurrentDir && targetPath) {
9930
- projectPath = targetPath === "." ? PWD : import_node_path3.join(PWD, targetPath.replace("./", ""));
9931
- actualProjectName = projectName;
9927
+ if (targetPath) {
9928
+ projectPath = import_node_path3.join(PWD, targetPath);
9932
9929
  } else {
9933
9930
  projectPath = import_node_path3.join(PWD, projectName);
9934
- actualProjectName = projectName;
9935
9931
  }
9936
- if (import_node_fs2.existsSync(projectPath) && !isCurrentDir) {
9937
- if (IS_NPMJS) {
9938
- console.error(`\u274C Error: Directory '${projectName}' already exists`);
9939
- process.exit(1);
9932
+ if (import_node_fs2.existsSync(projectPath)) {
9933
+ const dirContent = import_node_fs2.readdirSync(projectPath);
9934
+ const hasContent = dirContent.length > 0;
9935
+ if (IS_NPMJS && hasContent) {
9936
+ console.warn(`\u26A0\uFE0F Warning: Directory '${projectName}' already exists and is not empty`);
9937
+ const answer = prompt("Do you want to continue and overwrite? (y/n): ");
9938
+ if (answer?.toLowerCase() !== "y") {
9939
+ console.log("\u274C Operation cancelled");
9940
+ process.exit(1);
9941
+ }
9942
+ console.log("\u2705 Continuing...");
9940
9943
  }
9941
9944
  }
9942
9945
  if (!IS_NPMJS) {
9943
9946
  import_node_fs2.rmSync(PWD, { recursive: true, force: true });
9944
9947
  }
9945
- log(`\uD83D\uDE80 Creating new backend project: ${actualProjectName}`, false, verbose);
9948
+ log(`\uD83D\uDE80 Creating new backend project: ${projectName}`, false, verbose);
9946
9949
  import_node_fs2.mkdirSync(projectPath, { recursive: true });
9947
9950
  import_node_fs2.mkdirSync(import_node_path3.join(projectPath, "src"), { recursive: true });
9948
9951
  import_node_fs2.mkdirSync(import_node_path3.join(projectPath, "src", "routes"), { recursive: true });
9949
9952
  import_node_fs2.mkdirSync(import_node_path3.join(projectPath, "src", "controllers"), { recursive: true });
9950
9953
  import_node_fs2.mkdirSync(import_node_path3.join(projectPath, "src", "models"), { recursive: true });
9951
9954
  import_node_fs2.mkdirSync(import_node_path3.join(projectPath, "src", "middlewares"), { recursive: true });
9952
- const packageJsonString = JSON.stringify(packageJson(actualProjectName), null, 2);
9955
+ const packageJsonString = JSON.stringify(packageJson(projectName), null, 2);
9953
9956
  import_node_fs2.writeFileSync(import_node_path3.join(projectPath, "package.json"), packageJsonString);
9954
- import_node_fs2.writeFileSync(import_node_path3.join(projectPath, "src", "index.ts"), indexTs(actualProjectName));
9957
+ import_node_fs2.writeFileSync(import_node_path3.join(projectPath, "src", "index.ts"), indexTs(projectName));
9955
9958
  import_node_fs2.writeFileSync(import_node_path3.join(projectPath, ".env"), envFile);
9956
9959
  import_node_fs2.writeFileSync(import_node_path3.join(projectPath, ".gitignore"), gitignore);
9957
- import_node_fs2.writeFileSync(import_node_path3.join(projectPath, "README.md"), readme(actualProjectName));
9958
- log(`\u2705 Backend project '${actualProjectName}' created successfully!`, false, verbose);
9960
+ import_node_fs2.writeFileSync(import_node_path3.join(projectPath, "README.md"), readme(projectName));
9961
+ log(`\u2705 Backend project '${projectName}' created successfully!`, false, verbose);
9959
9962
  log(`
9960
9963
  \uD83D\uDCE6 Installing dependencies...`, false, verbose);
9961
9964
  const installProcess = Bun.spawnSync(["bun", "install"], {
@@ -9970,8 +9973,8 @@ function beCommand(projectName, verbose, targetPath) {
9970
9973
  }
9971
9974
  log(`
9972
9975
  Next steps:`, true, verbose);
9973
- if (!isCurrentDir) {
9974
- log(` cd ${actualProjectName}`, true, verbose);
9976
+ if (!targetPath) {
9977
+ log(` cd ${projectName}`, true, verbose);
9975
9978
  }
9976
9979
  log(` bun run dev`, true, verbose);
9977
9980
  }
package/dist/index.js CHANGED
@@ -9820,7 +9820,7 @@ var meow = (helpText, options = {}) => {
9820
9820
  };
9821
9821
 
9822
9822
  // version.ts
9823
- var version = "1.0.12";
9823
+ var version = "1.0.13";
9824
9824
  var version_default = version;
9825
9825
 
9826
9826
  // src/banner.ts
@@ -9848,7 +9848,13 @@ var LLM_BASE_URL = ENV.LLM_BASE_URL;
9848
9848
  var LLM_API_KEY = ENV.LLM_API_KEY || "";
9849
9849
 
9850
9850
  // src/commands/be/index.ts
9851
- import { existsSync, mkdirSync, writeFileSync, rmSync } from "fs";
9851
+ import {
9852
+ existsSync,
9853
+ mkdirSync,
9854
+ writeFileSync,
9855
+ rmSync,
9856
+ readdirSync
9857
+ } from "fs";
9852
9858
  import { join } from "path";
9853
9859
 
9854
9860
  // src/utils/logger.ts
@@ -9924,39 +9930,42 @@ function beCommand(projectName, verbose, targetPath) {
9924
9930
  console.log("Usage: fbi be <project-name>");
9925
9931
  process.exit(1);
9926
9932
  }
9927
- const isCurrentDir = targetPath === "." || targetPath?.startsWith("./");
9928
9933
  let projectPath;
9929
- let actualProjectName;
9930
- if (isCurrentDir && targetPath) {
9931
- projectPath = targetPath === "." ? PWD : join(PWD, targetPath.replace("./", ""));
9932
- actualProjectName = projectName;
9934
+ if (targetPath) {
9935
+ projectPath = join(PWD, targetPath);
9933
9936
  } else {
9934
9937
  projectPath = join(PWD, projectName);
9935
- actualProjectName = projectName;
9936
9938
  }
9937
- if (existsSync(projectPath) && !isCurrentDir) {
9938
- if (IS_NPMJS) {
9939
- console.error(`\u274C Error: Directory '${projectName}' already exists`);
9940
- process.exit(1);
9939
+ if (existsSync(projectPath)) {
9940
+ const dirContent = readdirSync(projectPath);
9941
+ const hasContent = dirContent.length > 0;
9942
+ if (IS_NPMJS && hasContent) {
9943
+ console.warn(`\u26A0\uFE0F Warning: Directory '${projectName}' already exists and is not empty`);
9944
+ const answer = prompt("Do you want to continue and overwrite? (y/n): ");
9945
+ if (answer?.toLowerCase() !== "y") {
9946
+ console.log("\u274C Operation cancelled");
9947
+ process.exit(1);
9948
+ }
9949
+ console.log("\u2705 Continuing...");
9941
9950
  }
9942
9951
  }
9943
9952
  if (!IS_NPMJS) {
9944
9953
  rmSync(PWD, { recursive: true, force: true });
9945
9954
  }
9946
- log(`\uD83D\uDE80 Creating new backend project: ${actualProjectName}`, false, verbose);
9955
+ log(`\uD83D\uDE80 Creating new backend project: ${projectName}`, false, verbose);
9947
9956
  mkdirSync(projectPath, { recursive: true });
9948
9957
  mkdirSync(join(projectPath, "src"), { recursive: true });
9949
9958
  mkdirSync(join(projectPath, "src", "routes"), { recursive: true });
9950
9959
  mkdirSync(join(projectPath, "src", "controllers"), { recursive: true });
9951
9960
  mkdirSync(join(projectPath, "src", "models"), { recursive: true });
9952
9961
  mkdirSync(join(projectPath, "src", "middlewares"), { recursive: true });
9953
- const packageJsonString = JSON.stringify(packageJson(actualProjectName), null, 2);
9962
+ const packageJsonString = JSON.stringify(packageJson(projectName), null, 2);
9954
9963
  writeFileSync(join(projectPath, "package.json"), packageJsonString);
9955
- writeFileSync(join(projectPath, "src", "index.ts"), indexTs(actualProjectName));
9964
+ writeFileSync(join(projectPath, "src", "index.ts"), indexTs(projectName));
9956
9965
  writeFileSync(join(projectPath, ".env"), envFile);
9957
9966
  writeFileSync(join(projectPath, ".gitignore"), gitignore);
9958
- writeFileSync(join(projectPath, "README.md"), readme(actualProjectName));
9959
- log(`\u2705 Backend project '${actualProjectName}' created successfully!`, false, verbose);
9967
+ writeFileSync(join(projectPath, "README.md"), readme(projectName));
9968
+ log(`\u2705 Backend project '${projectName}' created successfully!`, false, verbose);
9960
9969
  log(`
9961
9970
  \uD83D\uDCE6 Installing dependencies...`, false, verbose);
9962
9971
  const installProcess = Bun.spawnSync(["bun", "install"], {
@@ -9971,8 +9980,8 @@ function beCommand(projectName, verbose, targetPath) {
9971
9980
  }
9972
9981
  log(`
9973
9982
  Next steps:`, true, verbose);
9974
- if (!isCurrentDir) {
9975
- log(` cd ${actualProjectName}`, true, verbose);
9983
+ if (!targetPath) {
9984
+ log(` cd ${projectName}`, true, verbose);
9976
9985
  }
9977
9986
  log(` bun run dev`, true, verbose);
9978
9987
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flash-builder",
3
- "version": "1.0.12",
3
+ "version": "1.0.13",
4
4
  "description": "",
5
5
  "homepage": "https://github.com/jefripunza/flash-builder-cli#readme",
6
6
  "repository": {