create-egregore 0.3.2 → 0.3.4
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 +2 -2
- package/lib/setup.js +11 -8
- package/package.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -38,7 +38,7 @@ function showHelp() {
|
|
|
38
38
|
ui.info(" npx create-egregore Interactive setup");
|
|
39
39
|
ui.info("");
|
|
40
40
|
ui.info("Options:");
|
|
41
|
-
ui.info(" --token <token> Setup token from egregore.
|
|
41
|
+
ui.info(" --token <token> Setup token from egregore-core.netlify.app");
|
|
42
42
|
ui.info(" --api <url> API URL override");
|
|
43
43
|
ui.info(" -h, --help Show this help");
|
|
44
44
|
ui.info("");
|
|
@@ -76,7 +76,7 @@ async function tokenFlow(api, token) {
|
|
|
76
76
|
ui.error(err.message);
|
|
77
77
|
ui.info("");
|
|
78
78
|
ui.info("The token may have expired or already been used.");
|
|
79
|
-
ui.info("Visit egregore.
|
|
79
|
+
ui.info("Visit egregore-core.netlify.app to get a new one, or run without --token:");
|
|
80
80
|
ui.info(" npx create-egregore");
|
|
81
81
|
process.exit(1);
|
|
82
82
|
}
|
package/lib/setup.js
CHANGED
|
@@ -78,7 +78,7 @@ async function install(data, ui, targetDir) {
|
|
|
78
78
|
// 5. Register instance + shell alias
|
|
79
79
|
ui.step(5, totalSteps, "Registering instance...");
|
|
80
80
|
registerInstance(dirSlug, org_name, egregoreDir);
|
|
81
|
-
const
|
|
81
|
+
const alias = await installShellAlias(egregoreDir, ui);
|
|
82
82
|
|
|
83
83
|
// 6+. Clone managed repos (if any)
|
|
84
84
|
const clonedRepos = [];
|
|
@@ -108,7 +108,7 @@ async function install(data, ui, targetDir) {
|
|
|
108
108
|
ui.info(` ${ui.cyan(`./${repoName}/`)} — Managed repo`);
|
|
109
109
|
}
|
|
110
110
|
console.log("");
|
|
111
|
-
ui.info(`Next:
|
|
111
|
+
ui.info(`Next: open a ${ui.bold("new terminal")} and type ${ui.bold(alias.aliasName)} to start.`);
|
|
112
112
|
console.log("");
|
|
113
113
|
}
|
|
114
114
|
|
|
@@ -159,7 +159,7 @@ async function installShellAlias(egregoreDir, ui) {
|
|
|
159
159
|
const script = path.join(egregoreDir, "bin", "ensure-shell-function.sh");
|
|
160
160
|
if (!fs.existsSync(script)) {
|
|
161
161
|
ui.warn("Shell alias script not found — add alias manually.");
|
|
162
|
-
return "egregore";
|
|
162
|
+
return { aliasName: "egregore", profileFile: ".zshrc" };
|
|
163
163
|
}
|
|
164
164
|
try {
|
|
165
165
|
// Get recommended name
|
|
@@ -167,17 +167,20 @@ async function installShellAlias(egregoreDir, ui) {
|
|
|
167
167
|
const defaultName = suggested || "egregore";
|
|
168
168
|
|
|
169
169
|
// Ask user what they want to call it
|
|
170
|
-
|
|
170
|
+
console.log("");
|
|
171
|
+
ui.info(`This instance will be launched with a shell command.`);
|
|
172
|
+
const answer = await ui.prompt(`Command name (Enter for ${ui.bold(defaultName)}):`);
|
|
171
173
|
const chosenName = answer || defaultName;
|
|
172
174
|
|
|
173
|
-
// Install with chosen name
|
|
175
|
+
// Install with chosen name — output is "name:/path/to/profile"
|
|
174
176
|
const output = execSync(`bash "${script}" install "${chosenName}"`, { stdio: "pipe", encoding: "utf-8", timeout: 10000 }).trim();
|
|
175
|
-
const aliasName = output || chosenName;
|
|
177
|
+
const [aliasName, profilePath] = (output || chosenName).split(":");
|
|
178
|
+
const profileFile = profilePath ? path.basename(profilePath) : ".zshrc";
|
|
176
179
|
ui.success(`Installed ${ui.dim(aliasName)} command`);
|
|
177
|
-
return aliasName;
|
|
180
|
+
return { aliasName, profilePath, profileFile };
|
|
178
181
|
} catch {
|
|
179
182
|
ui.warn("Could not install shell alias — add it manually.");
|
|
180
|
-
return "egregore";
|
|
183
|
+
return { aliasName: "egregore", profileFile: ".zshrc" };
|
|
181
184
|
}
|
|
182
185
|
}
|
|
183
186
|
|