create-egregore 0.3.7 → 0.3.9
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/cli.js +9 -2
- package/lib/setup.js +14 -4
- package/package.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -67,10 +67,10 @@ async function main() {
|
|
|
67
67
|
|
|
68
68
|
async function tokenFlow(api, token) {
|
|
69
69
|
const s = ui.spinner("Claiming setup token...");
|
|
70
|
+
let data;
|
|
70
71
|
try {
|
|
71
|
-
|
|
72
|
+
data = await api.claimToken(token);
|
|
72
73
|
s.stop(`Claimed — setting up ${ui.bold(data.org_name)}`);
|
|
73
|
-
await install(data, ui);
|
|
74
74
|
} catch (err) {
|
|
75
75
|
s.fail("Token claim failed");
|
|
76
76
|
ui.error(err.message);
|
|
@@ -80,6 +80,13 @@ async function tokenFlow(api, token) {
|
|
|
80
80
|
ui.info(" npx create-egregore");
|
|
81
81
|
process.exit(1);
|
|
82
82
|
}
|
|
83
|
+
|
|
84
|
+
try {
|
|
85
|
+
await install(data, ui);
|
|
86
|
+
} catch (err) {
|
|
87
|
+
ui.error(`Install failed: ${err.message}`);
|
|
88
|
+
process.exit(1);
|
|
89
|
+
}
|
|
83
90
|
}
|
|
84
91
|
|
|
85
92
|
async function interactiveFlow(api) {
|
package/lib/setup.js
CHANGED
|
@@ -20,7 +20,7 @@ function run(cmd, opts = {}) {
|
|
|
20
20
|
* @param {string} targetDir - where to install (default: cwd)
|
|
21
21
|
*/
|
|
22
22
|
async function install(data, ui, targetDir) {
|
|
23
|
-
const { fork_url, memory_url, github_token, org_name, github_org, slug, api_key, repos = [] } = data;
|
|
23
|
+
const { fork_url, memory_url, github_token, org_name, github_org, slug, api_key, repos = [], telegram_group_link } = data;
|
|
24
24
|
const base = targetDir || process.cwd();
|
|
25
25
|
|
|
26
26
|
const dirSlug = (github_org || slug || "egregore").toLowerCase();
|
|
@@ -56,14 +56,19 @@ async function install(data, ui, targetDir) {
|
|
|
56
56
|
}
|
|
57
57
|
ui.success("Cloned memory");
|
|
58
58
|
|
|
59
|
-
// 3. Symlink
|
|
59
|
+
// 3. Symlink (use junction on Windows — no admin required)
|
|
60
60
|
ui.step(3, totalSteps, "Linking memory...");
|
|
61
61
|
const symlinkTarget = path.join(egregoreDir, "memory");
|
|
62
62
|
if (fs.existsSync(symlinkTarget)) {
|
|
63
63
|
ui.warn("memory/ symlink already exists");
|
|
64
64
|
} else {
|
|
65
|
-
|
|
66
|
-
|
|
65
|
+
if (process.platform === "win32") {
|
|
66
|
+
// Junctions require absolute paths on Windows
|
|
67
|
+
fs.symlinkSync(path.resolve(memoryDir), symlinkTarget, "junction");
|
|
68
|
+
} else {
|
|
69
|
+
const relPath = path.relative(egregoreDir, memoryDir);
|
|
70
|
+
fs.symlinkSync(relPath, symlinkTarget);
|
|
71
|
+
}
|
|
67
72
|
}
|
|
68
73
|
ui.success("Linked");
|
|
69
74
|
|
|
@@ -107,6 +112,11 @@ async function install(data, ui, targetDir) {
|
|
|
107
112
|
for (const repoName of clonedRepos) {
|
|
108
113
|
ui.info(` ${ui.cyan(`./${repoName}/`)} — Managed repo`);
|
|
109
114
|
}
|
|
115
|
+
if (telegram_group_link) {
|
|
116
|
+
console.log("");
|
|
117
|
+
ui.info(`Join the Telegram group for notifications:`);
|
|
118
|
+
ui.info(` ${ui.cyan(telegram_group_link)}`);
|
|
119
|
+
}
|
|
110
120
|
console.log("");
|
|
111
121
|
ui.info(`Next: open a ${ui.bold("new terminal")} and type ${ui.bold(alias.aliasName)} to start.`);
|
|
112
122
|
console.log("");
|