@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.
Files changed (2) hide show
  1. package/bin/install.cjs +13 -3
  2. 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 (e.g., local dev)
153
+ // Skip if binary already exists AND matches the expected version
154
154
  if (fs.existsSync(binaryPath)) {
155
- console.log(`${PACKAGE} binary already exists, skipping download.`);
156
- return;
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);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@casoon/astro-post-audit",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "description": "Astro integration for post-build auditing: SEO, links, and lightweight WCAG checks",
5
5
  "license": "MIT",
6
6
  "type": "module",