ai-project-boilerplate 1.3.1 → 1.3.2
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 +29 -16
- package/package.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -110,24 +110,37 @@ async function checkForUpdate() {
|
|
|
110
110
|
const bold = (s) => `\x1b[1m${s}\x1b[0m`;
|
|
111
111
|
const dim = (s) => `\x1b[2m${s}\x1b[0m`;
|
|
112
112
|
|
|
113
|
-
const
|
|
114
|
-
|
|
115
|
-
const
|
|
116
|
-
const
|
|
117
|
-
|
|
118
|
-
const
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
const
|
|
124
|
-
const
|
|
125
|
-
const
|
|
113
|
+
const strip = (s) => s.replace(/\x1b\[[0-9;]*m/g, "");
|
|
114
|
+
|
|
115
|
+
const isPnpm = __filename.includes("pnpm");
|
|
116
|
+
const prefs = loadPrefs();
|
|
117
|
+
|
|
118
|
+
const updateCmd = (isPnpm || !prefs.suppressPnpmWarning)
|
|
119
|
+
? bold(cyan("pnpm add -g ai-project-boilerplate"))
|
|
120
|
+
: bold(cyan("npm install -g ai-project-boilerplate"));
|
|
121
|
+
|
|
122
|
+
const tag = bold(yellow("UPDATE AVAILABLE"));
|
|
123
|
+
const from = dim(CURRENT_VERSION);
|
|
124
|
+
const to = bold(cyan(latest));
|
|
125
|
+
const url = cyan(`https://github.com/${REPO}/releases/tag/v${latest}`);
|
|
126
|
+
|
|
127
|
+
const lines = [
|
|
128
|
+
` ${tag} ${from} → ${to}`,
|
|
129
|
+
` Run ${updateCmd} to update`,
|
|
130
|
+
` See what's changed: ${url}`,
|
|
131
|
+
];
|
|
132
|
+
|
|
133
|
+
if (!isPnpm && !prefs.suppressPnpmWarning) {
|
|
134
|
+
lines.push(` To suppress pnpm suggestion: ${bold(cyan("ai-project --no-pnpm-warning"))}`);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
const width = Math.max(...lines.map(l => strip(l).length)) + 2;
|
|
138
|
+
const border = yellow("─".repeat(width));
|
|
126
139
|
|
|
127
140
|
console.error(`\n${yellow("┌")}${border}${yellow("┐")}`);
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
141
|
+
for (const line of lines) {
|
|
142
|
+
console.error(`${yellow("│")} ${line.padEnd(line.length + width - strip(line).length - 1)}${yellow("│")}`);
|
|
143
|
+
}
|
|
131
144
|
console.error(`${yellow("└")}${border}${yellow("┘")}\n`);
|
|
132
145
|
return true;
|
|
133
146
|
}
|