create-egregore 0.7.0 → 0.7.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/lib/local.js +35 -38
- package/lib/setup.js +1 -1
- package/lib/ui.js +2 -2
- package/package.json +1 -1
package/lib/local.js
CHANGED
|
@@ -491,46 +491,43 @@ async function localFounderFlow(ui) {
|
|
|
491
491
|
|
|
492
492
|
// 19. Optional invite
|
|
493
493
|
console.log("");
|
|
494
|
-
const
|
|
495
|
-
if (
|
|
496
|
-
const
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
await addCollaborator(githubToken, githubOrg,
|
|
503
|
-
|
|
504
|
-
await addCollaborator(githubToken, githubOrg, mr, invUsername).catch(() => {});
|
|
505
|
-
}
|
|
506
|
-
|
|
507
|
-
// Create person file
|
|
508
|
-
const invPersonContent = [
|
|
509
|
-
"---",
|
|
510
|
-
`name: ${invUsername}`,
|
|
511
|
-
`github: ${invUsername}`,
|
|
512
|
-
`invited_by: ${user.login}`,
|
|
513
|
-
`joined: ${today}`,
|
|
514
|
-
"---",
|
|
515
|
-
"",
|
|
516
|
-
].join("\n");
|
|
517
|
-
const invPersonFile = path.join(memoryDir, "people", `${invUsername}.md`);
|
|
518
|
-
if (!fs.existsSync(invPersonFile)) {
|
|
519
|
-
fs.writeFileSync(invPersonFile, invPersonContent);
|
|
520
|
-
try {
|
|
521
|
-
run("git add -A", { cwd: memoryDir });
|
|
522
|
-
run(`git commit -m "Invite ${invUsername}"`, { cwd: memoryDir });
|
|
523
|
-
run("git push", { cwd: memoryDir });
|
|
524
|
-
} catch {}
|
|
525
|
-
}
|
|
494
|
+
const invUsername = await ui.prompt("Invite a teammate? Enter their GitHub username (or press Enter to skip):");
|
|
495
|
+
if (invUsername) {
|
|
496
|
+
const invSpin = ui.spinner(`Inviting ${invUsername}...`);
|
|
497
|
+
try {
|
|
498
|
+
// Add as collaborator to all repos
|
|
499
|
+
await addCollaborator(githubToken, githubOrg, repoName, invUsername);
|
|
500
|
+
await addCollaborator(githubToken, githubOrg, memoryRepoName, invUsername);
|
|
501
|
+
for (const mr of selectedRepos) {
|
|
502
|
+
await addCollaborator(githubToken, githubOrg, mr, invUsername).catch(() => {});
|
|
503
|
+
}
|
|
526
504
|
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
505
|
+
// Create person file
|
|
506
|
+
const invPersonContent = [
|
|
507
|
+
"---",
|
|
508
|
+
`name: ${invUsername}`,
|
|
509
|
+
`github: ${invUsername}`,
|
|
510
|
+
`invited_by: ${user.login}`,
|
|
511
|
+
`joined: ${today}`,
|
|
512
|
+
"---",
|
|
513
|
+
"",
|
|
514
|
+
].join("\n");
|
|
515
|
+
const invPersonFile = path.join(memoryDir, "people", `${invUsername}.md`);
|
|
516
|
+
if (!fs.existsSync(invPersonFile)) {
|
|
517
|
+
fs.writeFileSync(invPersonFile, invPersonContent);
|
|
518
|
+
try {
|
|
519
|
+
run("git add -A", { cwd: memoryDir });
|
|
520
|
+
run(`git commit -m "Invite ${invUsername}"`, { cwd: memoryDir });
|
|
521
|
+
run("git push", { cwd: memoryDir });
|
|
522
|
+
} catch {}
|
|
533
523
|
}
|
|
524
|
+
|
|
525
|
+
invSpin.stop(`Invited ${invUsername}`);
|
|
526
|
+
console.log("");
|
|
527
|
+
ui.info(`Tell them to run:`);
|
|
528
|
+
ui.info(` ${ui.bold(`npx create-egregore@latest join ${githubOrg}/${repoName}`)}`);
|
|
529
|
+
} catch (err) {
|
|
530
|
+
invSpin.fail(`Could not invite ${invUsername}: ${err.message}`);
|
|
534
531
|
}
|
|
535
532
|
}
|
|
536
533
|
|
package/lib/setup.js
CHANGED
|
@@ -357,7 +357,7 @@ async function installShellAlias(egregoreDir, ui) {
|
|
|
357
357
|
if (fs.existsSync(configPath)) {
|
|
358
358
|
try { slug = JSON.parse(fs.readFileSync(configPath, "utf-8")).slug || ""; } catch {}
|
|
359
359
|
}
|
|
360
|
-
defaultName = slug
|
|
360
|
+
defaultName = slug || "egregore-2";
|
|
361
361
|
}
|
|
362
362
|
|
|
363
363
|
// Ask user (skip prompt in non-interactive mode)
|
package/lib/ui.js
CHANGED
|
@@ -69,11 +69,11 @@ function spinner(msg) {
|
|
|
69
69
|
return {
|
|
70
70
|
stop(result) {
|
|
71
71
|
clearInterval(interval);
|
|
72
|
-
process.stdout.write(`\r ${GREEN}✓${RESET} ${result || msg}\n`);
|
|
72
|
+
process.stdout.write(`\r\x1b[2K ${GREEN}✓${RESET} ${result || msg}\n`);
|
|
73
73
|
},
|
|
74
74
|
fail(result) {
|
|
75
75
|
clearInterval(interval);
|
|
76
|
-
process.stdout.write(`\r ${RED}✗${RESET} ${result || msg}\n`);
|
|
76
|
+
process.stdout.write(`\r\x1b[2K ${RED}✗${RESET} ${result || msg}\n`);
|
|
77
77
|
},
|
|
78
78
|
};
|
|
79
79
|
}
|