bunkit-cli 0.9.0 → 0.9.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.
Files changed (2) hide show
  1. package/dist/index.js +11 -4
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -22707,12 +22707,19 @@ var init_types2 = __esm(() => {
22707
22707
  // ../core/src/project.ts
22708
22708
  async function createProject(config) {
22709
22709
  const projectPath = join(process.cwd(), config.path);
22710
- if (!await isDirectoryEmpty(projectPath)) {
22711
- const exists = await import_fs_extra2.default.pathExists(projectPath);
22712
- if (exists) {
22713
- throw new Error(`Directory "${config.path}" already exists and is not empty`);
22710
+ const currentDirName = basename(resolve(process.cwd()));
22711
+ if (currentDirName === config.name && config.path === config.name) {
22712
+ const isEmpty = await isDirectoryEmpty(process.cwd());
22713
+ if (isEmpty) {
22714
+ throw new Error(`You are already in a directory named "${config.name}". ` + `Since this directory is empty, you can initialize the project here directly. ` + `Please run "bunkit init" instead, or navigate to the parent directory first.`);
22715
+ } else {
22716
+ throw new Error(`You are already in a directory named "${config.name}" which is not empty. ` + `Creating the project here would result in "${config.name}/${config.name}". ` + `Please navigate to the parent directory first, or use a different project name.`);
22714
22717
  }
22715
22718
  }
22719
+ const targetExists = await import_fs_extra2.default.pathExists(projectPath);
22720
+ if (targetExists && !await isDirectoryEmpty(projectPath)) {
22721
+ throw new Error(`Directory "${config.path}" already exists and is not empty`);
22722
+ }
22716
22723
  await ensureDirectory(projectPath);
22717
22724
  await createPackageJson(projectPath, config);
22718
22725
  await createBaseFiles(projectPath, config);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bunkit-cli",
3
- "version": "0.9.0",
3
+ "version": "0.9.1",
4
4
  "description": "Beautiful CLI for creating production-ready Bun projects",
5
5
  "type": "module",
6
6
  "bin": {