ohmydashboard 0.2.2 → 0.3.0
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/dist/cli.js +24 -5
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -56,6 +56,7 @@ function parseArgs(args) {
|
|
|
56
56
|
let useSsh = false;
|
|
57
57
|
let branch = DEFAULT_BRANCH;
|
|
58
58
|
let useGit = false;
|
|
59
|
+
let noGit = false;
|
|
59
60
|
for (let i = 0; i < args.length; i += 1) {
|
|
60
61
|
const arg = args[i];
|
|
61
62
|
if (!arg)
|
|
@@ -68,6 +69,10 @@ function parseArgs(args) {
|
|
|
68
69
|
useGit = true;
|
|
69
70
|
continue;
|
|
70
71
|
}
|
|
72
|
+
if (arg === "--no-git") {
|
|
73
|
+
noGit = true;
|
|
74
|
+
continue;
|
|
75
|
+
}
|
|
71
76
|
if (arg === "--ssh") {
|
|
72
77
|
useSsh = true;
|
|
73
78
|
continue;
|
|
@@ -92,7 +97,7 @@ function parseArgs(args) {
|
|
|
92
97
|
targetDir = arg;
|
|
93
98
|
}
|
|
94
99
|
}
|
|
95
|
-
return { targetDir, repoUrl, showHelp, useSsh, branch, useGit };
|
|
100
|
+
return { targetDir, repoUrl, showHelp, useSsh, branch, useGit, noGit };
|
|
96
101
|
}
|
|
97
102
|
function defaultExec(command, args, options) {
|
|
98
103
|
return new Promise((resolve, reject) => {
|
|
@@ -184,16 +189,25 @@ async function runCli(args, deps) {
|
|
|
184
189
|
const downloadRepo = deps.downloadRepo ?? defaultDownloadRepo;
|
|
185
190
|
const cwd = deps.cwd ?? process.cwd();
|
|
186
191
|
const log = deps.log ?? console.log;
|
|
187
|
-
const { targetDir, repoUrl, showHelp, useSsh, branch, useGit } = parseArgs(args);
|
|
192
|
+
const { targetDir, repoUrl, showHelp, useSsh, branch, useGit, noGit } = parseArgs(args);
|
|
188
193
|
if (showHelp) {
|
|
189
|
-
log("Usage: npx ohmydashboard [target-dir] [--repo <url>] [--branch <name>] [--git] [--ssh]");
|
|
194
|
+
log("Usage: npx ohmydashboard [target-dir] [--repo <url>] [--branch <name>] [--no-git] [--ssh]");
|
|
195
|
+
log("");
|
|
196
|
+
log("Options:");
|
|
197
|
+
log(" [target-dir] Directory name (default: ohmydashboard)");
|
|
198
|
+
log(" --repo <url> Custom GitHub repo URL");
|
|
199
|
+
log(" --branch <name> Branch to clone (default: main)");
|
|
200
|
+
log(" --no-git Download as tarball instead of git clone");
|
|
201
|
+
log(" --ssh Use SSH URL for git clone");
|
|
202
|
+
log(" --help, -h Show this help message");
|
|
190
203
|
return;
|
|
191
204
|
}
|
|
192
205
|
const targetPath = path.join(cwd, targetDir);
|
|
193
206
|
if (fs.existsSync(targetPath)) {
|
|
194
207
|
throw new Error("Target directory already exists");
|
|
195
208
|
}
|
|
196
|
-
|
|
209
|
+
const shouldUseGit = noGit ? false : true;
|
|
210
|
+
if (shouldUseGit) {
|
|
197
211
|
const cloneArgs = ["clone"];
|
|
198
212
|
if (branch) {
|
|
199
213
|
cloneArgs.push("--branch", branch);
|
|
@@ -204,7 +218,7 @@ async function runCli(args, deps) {
|
|
|
204
218
|
else {
|
|
205
219
|
const parsed = parseGitHubRepo(repoUrl);
|
|
206
220
|
if (!parsed) {
|
|
207
|
-
throw new Error("Repo must be a GitHub URL or owner/repo
|
|
221
|
+
throw new Error("Repo must be a GitHub URL or owner/repo.");
|
|
208
222
|
}
|
|
209
223
|
await downloadRepo({
|
|
210
224
|
owner: parsed.owner,
|
|
@@ -224,4 +238,9 @@ async function runCli(args, deps) {
|
|
|
224
238
|
log(" 2) pnpm dev");
|
|
225
239
|
log("");
|
|
226
240
|
log("Then open http://localhost:3000 and connect integrations at /settings");
|
|
241
|
+
if (shouldUseGit) {
|
|
242
|
+
log("");
|
|
243
|
+
log("To update later:");
|
|
244
|
+
log(` cd ${targetDir} && git pull && pnpm install`);
|
|
245
|
+
}
|
|
227
246
|
}
|