periderm-cli 0.1.8 → 0.1.10

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 CHANGED
@@ -8,7 +8,7 @@ export function readConfig() {
8
8
  try {
9
9
  if (fs.existsSync(CONFIG_FILE)) {
10
10
  const raw = JSON.parse(fs.readFileSync(CONFIG_FILE, "utf8"));
11
- return { apiUrl: raw.apiUrl || DEFAULT_API_URL, token: raw.token };
11
+ return { apiUrl: process.env.PERIDERM_API_URL || raw.apiUrl || DEFAULT_API_URL, token: raw.token };
12
12
  }
13
13
  }
14
14
  catch (e) {
package/dist/index.js CHANGED
@@ -134,7 +134,7 @@ program
134
134
  console.info("");
135
135
  console.info(`${chalk.white("Quota:")} ${chalk.bold.white(`${remaining} scans remaining`)}`);
136
136
  if (remaining <= 3) {
137
- console.info(chalk.yellow(`⚠️ Almost exhausted! Renew or upgrade at `) + chalk.underline.cyan(`${cfg.apiUrl}/dashboard/billing`));
137
+ console.info(chalk.yellow(`⚠ Almost exhausted! Renew or upgrade at `) + chalk.underline.cyan(`${cfg.apiUrl}/dashboard/billing`));
138
138
  }
139
139
  }
140
140
  }
@@ -24,15 +24,23 @@ export async function checkUpdate() {
24
24
  if (latestVersion && latestVersion !== currentVersion) {
25
25
  const cfg = readConfig();
26
26
  const apiUrl = cfg?.apiUrl;
27
- const isWin = process.platform === "win32";
28
- const updateCmd = isWin ? `npm install -g ${name}` : `curl -fsSL ${apiUrl}/install.sh | bash`;
27
+ const isUnix = process.platform !== "win32" && process.platform !== "android";
28
+ const npmCmd = isUnix ? `sudo npm install -g ${name}` : `npm install -g ${name}`;
29
+ const curlCmd = `curl -fsSL ${apiUrl}/install.sh | bash`;
30
+ const title = `A new version of Periderm CLI is available: ${currentVersion} → ${latestVersion}`;
31
+ const textNpm = `Update via npm: ${npmCmd}`;
32
+ const textCurl = `Update via curl: ${curlCmd}`;
33
+ const width = Math.max(title.length, textNpm.length, textCurl.length) + 4;
34
+ const pad = (rawLen) => " ".repeat(Math.max(0, width - rawLen - 2));
29
35
  const box = `
30
- ╭──────────────────────────────────────────────────────────────╮
31
-
32
- A new version of Periderm CLI is available: ${chalk.dim(currentVersion)} → ${chalk.green(latestVersion)}
33
- │ Run ${chalk.cyan(updateCmd)} to update.
34
-
35
- ╰──────────────────────────────────────────────────────────────╯
36
+ ╭${"─".repeat(width)}╮
37
+ │${" ".repeat(width)}
38
+ A new version of Periderm CLI is available: ${chalk.dim(currentVersion)} → ${chalk.green(latestVersion)}${pad(title.length)}
39
+ │${" ".repeat(width)}
40
+ Update via npm: ${chalk.cyan(npmCmd)}${pad(textNpm.length)}
41
+ │ Update via curl: ${chalk.cyan(curlCmd)}${pad(textCurl.length)}│
42
+ │${" ".repeat(width)}│
43
+ ╰${"─".repeat(width)}╯
36
44
  `;
37
45
  console.log(box);
38
46
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "periderm-cli",
3
- "version": "0.1.8",
3
+ "version": "0.1.10",
4
4
  "description": "A pre-launch checklist for your codebase.",
5
5
  "type": "module",
6
6
  "bin": {