@casoon/astro-post-audit 0.2.2 → 0.2.3
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/install.cjs +13 -3
- package/package.json +1 -1
package/bin/install.cjs
CHANGED
|
@@ -150,10 +150,20 @@ async function main() {
|
|
|
150
150
|
const binDir = path.join(__dirname);
|
|
151
151
|
const binaryPath = path.join(binDir, binaryName);
|
|
152
152
|
|
|
153
|
-
// Skip if binary already exists
|
|
153
|
+
// Skip if binary already exists AND matches the expected version
|
|
154
154
|
if (fs.existsSync(binaryPath)) {
|
|
155
|
-
|
|
156
|
-
|
|
155
|
+
try {
|
|
156
|
+
const out = execSync(`"${binaryPath}" --version`, { encoding: "utf-8", timeout: 5000 }).trim();
|
|
157
|
+
// Output format: "astro-post-audit 0.2.2"
|
|
158
|
+
const installedVersion = out.split(/\s+/).pop();
|
|
159
|
+
if (installedVersion === VERSION) {
|
|
160
|
+
console.log(`${PACKAGE} v${VERSION} already installed, skipping download.`);
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
console.log(`${PACKAGE} version mismatch: installed ${installedVersion}, expected ${VERSION}. Re-downloading...`);
|
|
164
|
+
} catch {
|
|
165
|
+
console.log(`${PACKAGE} binary exists but version check failed. Re-downloading...`);
|
|
166
|
+
}
|
|
157
167
|
}
|
|
158
168
|
|
|
159
169
|
const url = getDownloadUrl(target);
|