unoverse 0.1.16 → 0.1.18
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/bin/unoverse.mjs +9 -6
- package/lib/create.mjs +5 -2
- package/package.json +1 -1
package/bin/unoverse.mjs
CHANGED
|
@@ -20,9 +20,15 @@ import { create } from "../lib/create.mjs";
|
|
|
20
20
|
* root. Found means the operator commands exist; not found means they simply are not
|
|
21
21
|
* offered, instead of being advertised and then refusing.
|
|
22
22
|
*/
|
|
23
|
+
// Two layouts, one search. A universe keeps the machinery in .unoverse/; the platform
|
|
24
|
+
// monorepo keeps it in scripts/. Neither is typed by a human.
|
|
25
|
+
const OPERATOR = [".unoverse/operator.sh", "scripts/operator.sh"];
|
|
26
|
+
|
|
23
27
|
function findUniverse() {
|
|
24
28
|
for (let dir = process.cwd(); ; ) {
|
|
25
|
-
|
|
29
|
+
for (const rel of OPERATOR) {
|
|
30
|
+
if (existsSync(join(dir, rel))) return { root: dir, script: join(dir, rel) };
|
|
31
|
+
}
|
|
26
32
|
const parent = resolve(dir, "..");
|
|
27
33
|
if (parent === dir) return null;
|
|
28
34
|
dir = parent;
|
|
@@ -30,11 +36,8 @@ function findUniverse() {
|
|
|
30
36
|
}
|
|
31
37
|
|
|
32
38
|
/** Run an operator command in the universe we are standing in. */
|
|
33
|
-
function operator(
|
|
34
|
-
const r = spawnSync("bash", [
|
|
35
|
-
stdio: "inherit",
|
|
36
|
-
cwd: root,
|
|
37
|
-
});
|
|
39
|
+
function operator(u, args) {
|
|
40
|
+
const r = spawnSync("bash", [u.script, ...args], { stdio: "inherit", cwd: u.root });
|
|
38
41
|
process.exit(r.status ?? 0);
|
|
39
42
|
}
|
|
40
43
|
|
package/lib/create.mjs
CHANGED
|
@@ -242,13 +242,16 @@ export async function create(nameArg) {
|
|
|
242
242
|
// already in hand and already validated, so hand it over and configure now.
|
|
243
243
|
rl.close();
|
|
244
244
|
console.log("");
|
|
245
|
-
const
|
|
245
|
+
const operatorScript = [".unoverse/operator.sh", "scripts/operator.sh"]
|
|
246
|
+
.map((rel) => `${name}/${rel}`)
|
|
247
|
+
.find((f) => existsSync(f));
|
|
248
|
+
const r = spawnSync("bash", [operatorScript, "init"], {
|
|
246
249
|
stdio: "inherit",
|
|
247
250
|
cwd: name,
|
|
248
251
|
env: { ...process.env, UNOVERSE_DOCR_TOKEN: token },
|
|
249
252
|
});
|
|
250
253
|
if (r.status !== 0) {
|
|
251
|
-
fail(
|
|
254
|
+
fail(`setup did not finish. Run 'unoverse init'${name === "." ? "" : ` in ./${name}`} to pick it up`);
|
|
252
255
|
process.exit(r.status ?? 1);
|
|
253
256
|
}
|
|
254
257
|
console.log(`
|
package/package.json
CHANGED