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.
- package/dist/index.js +13 -8
- 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
|
-
|
|
109
|
-
|
|
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
|
-
|
|
251
|
-
|
|
252
|
-
return
|
|
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
|
|
259
|
-
if (
|
|
263
|
+
for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
|
|
264
|
+
if (isSkippedEntry(entry)) {
|
|
260
265
|
continue;
|
|
261
266
|
}
|
|
262
|
-
fs.rmSync(path.
|
|
267
|
+
fs.rmSync(path.join(dir, entry.name), { recursive: true, force: true });
|
|
263
268
|
}
|
|
264
269
|
}
|
|
265
270
|
function getPkgExecCmd(pkgManager, cmd) {
|