unoverse 0.1.14 → 0.1.16
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/lib/create.mjs +11 -2
- package/package.json +1 -1
package/lib/create.mjs
CHANGED
|
@@ -72,8 +72,13 @@ async function validateRegistryToken(token) {
|
|
|
72
72
|
function resolveTarget(nameArg) {
|
|
73
73
|
const dir = nameArg || ".";
|
|
74
74
|
const here = dir === ".";
|
|
75
|
+
// DOTFILES DO NOT COUNT. A folder holding only .git, .claude, .vscode or .DS_Store is
|
|
76
|
+
// empty to the person standing in it: that is tool and editor config they had before
|
|
77
|
+
// they decided to build anything. Naming a few exceptions was not enough — a fresh
|
|
78
|
+
// folder opened in an editor already has .claude/ in it, and refusing that reads as
|
|
79
|
+
// the tool being broken.
|
|
75
80
|
const existing = existsSync(dir)
|
|
76
|
-
? readdirSync(dir).filter((f) => f
|
|
81
|
+
? readdirSync(dir).filter((f) => !f.startsWith("."))
|
|
77
82
|
: [];
|
|
78
83
|
if (existing.length) {
|
|
79
84
|
fail(here ? "this folder is not empty" : `./${dir} is not empty`);
|
|
@@ -207,6 +212,11 @@ export async function create(nameArg) {
|
|
|
207
212
|
}
|
|
208
213
|
|
|
209
214
|
if (choice === "2") {
|
|
215
|
+
// TARGET FIRST, credential second. This used to ask for the registry token, make a
|
|
216
|
+
// network round-trip to validate it, and only then discover the folder was not
|
|
217
|
+
// empty. Never ask for a credential you are about to throw away.
|
|
218
|
+
const name = resolveTarget(nameArg);
|
|
219
|
+
|
|
210
220
|
console.log(`\n ${cyan("A universe needs a registry access token.")}`);
|
|
211
221
|
console.log(` ${dim("It authorizes the platform's images. Your Unoverse admin issues it.")}\n`);
|
|
212
222
|
const token = await ask(rl, "Registry access token: ");
|
|
@@ -224,7 +234,6 @@ export async function create(nameArg) {
|
|
|
224
234
|
}
|
|
225
235
|
ok("token accepted");
|
|
226
236
|
|
|
227
|
-
const name = resolveTarget(nameArg);
|
|
228
237
|
download(name);
|
|
229
238
|
ok(`universe scaffolded in ${label(name)}`);
|
|
230
239
|
|
package/package.json
CHANGED