periderm-cli 0.1.2 → 0.1.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/dist/config.js +1 -5
- package/dist/index.js +39 -28
- package/package.json +1 -1
package/dist/config.js
CHANGED
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import os from "node:os";
|
|
4
|
-
import dotenv from "dotenv";
|
|
5
|
-
// Try to load .env from the current working directory (useful for local development)
|
|
6
|
-
dotenv.config({ path: path.resolve(process.cwd(), ".env") });
|
|
7
4
|
const CONFIG_DIR = path.join(os.homedir(), ".periderm");
|
|
8
5
|
const CONFIG_FILE = path.join(CONFIG_DIR, "config.json");
|
|
9
|
-
|
|
10
|
-
const DEFAULT_API_URL = process.env.PERIDERM_API_URL;
|
|
6
|
+
const DEFAULT_API_URL = process.env.PERIDERM_API_URL || "https://periderm-cli.vercel.app";
|
|
11
7
|
export function readConfig() {
|
|
12
8
|
try {
|
|
13
9
|
if (fs.existsSync(CONFIG_FILE)) {
|
package/dist/index.js
CHANGED
|
@@ -369,39 +369,50 @@ program
|
|
|
369
369
|
console.info("");
|
|
370
370
|
await updatePromise;
|
|
371
371
|
});
|
|
372
|
-
|
|
373
|
-
console.
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
372
|
+
if (process.argv.length === 2) {
|
|
373
|
+
console.info("");
|
|
374
|
+
console.info(chalk.hex("#FF4D00")(PERIDERM_ASCII));
|
|
375
|
+
console.info("");
|
|
376
|
+
console.info(chalk.bold.white("Welcome to the Periderm CLI."));
|
|
377
|
+
console.info(chalk.gray("The ultimate pre-launch checklist for your codebase."));
|
|
378
|
+
console.info("");
|
|
379
|
+
program.help();
|
|
380
|
+
}
|
|
381
|
+
else {
|
|
382
|
+
program.parseAsync().catch(async (e) => {
|
|
383
|
+
console.error(e);
|
|
378
384
|
try {
|
|
379
|
-
const
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
385
|
+
const formData = new FormData();
|
|
386
|
+
formData.append("name", "Periderm CLI Crash Reporter");
|
|
387
|
+
let userEmail = "support@periderm.dev";
|
|
388
|
+
try {
|
|
389
|
+
const cfg = readConfig();
|
|
390
|
+
if (cfg.token) {
|
|
391
|
+
const v = await verifyToken(cfg.token);
|
|
392
|
+
if (v.valid && v.email) {
|
|
393
|
+
userEmail = v.email;
|
|
394
|
+
}
|
|
384
395
|
}
|
|
385
396
|
}
|
|
397
|
+
catch {
|
|
398
|
+
// ignore token verification errors during crash
|
|
399
|
+
}
|
|
400
|
+
formData.append("_replyto", userEmail);
|
|
401
|
+
const marker = `\n\n---\n[System Info: Sent from Periderm CLI]\n[User Email: ${userEmail === "support@periderm.dev" ? "Unknown" : userEmail}]`;
|
|
402
|
+
const errMsg = e instanceof Error ? `${e.message}\n${e.stack}` : String(e);
|
|
403
|
+
formData.append("message", `CLI Crash:\n\n${errMsg}${marker}`);
|
|
404
|
+
await fetch("https://formspree.io/f/mqakppnn", {
|
|
405
|
+
method: "POST",
|
|
406
|
+
body: formData,
|
|
407
|
+
headers: { Accept: "application/json" }
|
|
408
|
+
});
|
|
386
409
|
}
|
|
387
|
-
catch {
|
|
388
|
-
//
|
|
410
|
+
catch (err) {
|
|
411
|
+
// silently fail
|
|
389
412
|
}
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
formData.append("message", `CLI Crash:\n\n${errMsg}${marker}`);
|
|
394
|
-
await fetch("https://formspree.io/f/mqakppnn", {
|
|
395
|
-
method: "POST",
|
|
396
|
-
body: formData,
|
|
397
|
-
headers: { Accept: "application/json" }
|
|
398
|
-
});
|
|
399
|
-
}
|
|
400
|
-
catch (err) {
|
|
401
|
-
// silently fail
|
|
402
|
-
}
|
|
403
|
-
process.exit(1);
|
|
404
|
-
});
|
|
413
|
+
process.exit(1);
|
|
414
|
+
});
|
|
415
|
+
}
|
|
405
416
|
function readLine() {
|
|
406
417
|
return new Promise((resolve) => {
|
|
407
418
|
let data = "";
|