create-skybridge 0.29.0 → 0.29.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 +13 -8
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -105,8 +105,8 @@ export async function init(args = process.argv.slice(2)) {
105
105
  emptyDir(targetDir);
106
106
  break;
107
107
  case "no":
108
- cancel();
109
- return;
108
+ prompts.log.error("Target directory is not empty.");
109
+ process.exit(1);
110
110
  }
111
111
  }
112
112
  const root = path.join(process.cwd(), targetDir);
@@ -247,19 +247,24 @@ function sanitizeTargetDir(targetDir) {
247
247
  // Remove leading/trailing slashes
248
248
  .replace(/^\/+|\/+$/g, ""));
249
249
  }
250
- function isEmpty(path) {
251
- const files = fs.readdirSync(path);
252
- return files.length === 0 || (files.length === 1 && files[0] === ".git");
250
+ // Skip user's SPEC.md and IDE/agent preferences (.idea, .claude, etc.)
251
+ function isSkippedEntry(entry) {
252
+ return ((entry.name.startsWith(".") && entry.isDirectory()) ||
253
+ entry.name === "SPEC.md");
254
+ }
255
+ function isEmpty(dirPath) {
256
+ const entries = fs.readdirSync(dirPath, { withFileTypes: true });
257
+ return entries.every(isSkippedEntry);
253
258
  }
254
259
  function emptyDir(dir) {
255
260
  if (!fs.existsSync(dir)) {
256
261
  return;
257
262
  }
258
- for (const file of fs.readdirSync(dir)) {
259
- if (file === ".git") {
263
+ for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
264
+ if (isSkippedEntry(entry)) {
260
265
  continue;
261
266
  }
262
- fs.rmSync(path.resolve(dir, file), { recursive: true, force: true });
267
+ fs.rmSync(path.join(dir, entry.name), { recursive: true, force: true });
263
268
  }
264
269
  }
265
270
  function getPkgExecCmd(pkgManager, cmd) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-skybridge",
3
- "version": "0.29.0",
3
+ "version": "0.29.1",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": "Alpic",