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 +1 -1
- package/dist/index.js +1 -1
- package/dist/update-notifier.js +16 -8
- package/package.json +1 -1
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(
|
|
137
|
+
console.info(chalk.yellow(`⚠ Almost exhausted! Renew or upgrade at `) + chalk.underline.cyan(`${cfg.apiUrl}/dashboard/billing`));
|
|
138
138
|
}
|
|
139
139
|
}
|
|
140
140
|
}
|
package/dist/update-notifier.js
CHANGED
|
@@ -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
|
|
28
|
-
const
|
|
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
|
-
│
|
|
33
|
-
|
|
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
|
}
|