rumdl 0.1.43 → 0.1.45

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/rumdl +19 -14
  2. package/package.json +8 -8
package/bin/rumdl CHANGED
@@ -254,18 +254,28 @@ function findBinary() {
254
254
  }
255
255
 
256
256
  /**
257
- * Verify the binary is executable
257
+ * Ensure the binary is executable, fixing permissions if needed.
258
+ * npm does not preserve file permissions when publishing packages,
259
+ * so binaries may need chmod +x after install.
258
260
  */
259
- function verifyBinary(binaryPath) {
261
+ function ensureExecutable(binaryPath) {
262
+ if (process.platform === "win32") {
263
+ return; // Windows doesn't use Unix file permissions
264
+ }
265
+
260
266
  try {
261
267
  fs.accessSync(binaryPath, fs.constants.X_OK);
262
- return true;
263
268
  } catch {
264
- // On Windows, X_OK check may fail but binary can still run
265
- if (process.platform === "win32") {
266
- return fs.existsSync(binaryPath);
269
+ debug(`Binary not executable, fixing permissions: ${binaryPath}`);
270
+ try {
271
+ fs.chmodSync(binaryPath, 0o755);
272
+ } catch (chmodErr) {
273
+ throw new Error(
274
+ `Binary found but not executable: ${binaryPath}\n` +
275
+ `Automatic chmod failed: ${chmodErr.message}\n` +
276
+ `Try manually: chmod +x "${binaryPath}"`
277
+ );
267
278
  }
268
- return false;
269
279
  }
270
280
  }
271
281
 
@@ -277,13 +287,8 @@ function main() {
277
287
  const binaryPath = findBinary();
278
288
  debug(`Using binary: ${binaryPath}`);
279
289
 
280
- // Verify the binary is executable
281
- if (!verifyBinary(binaryPath)) {
282
- throw new Error(
283
- `Binary found but not executable: ${binaryPath}\n` +
284
- `Try: chmod +x "${binaryPath}"`
285
- );
286
- }
290
+ // Ensure the binary is executable (npm doesn't preserve file permissions)
291
+ ensureExecutable(binaryPath);
287
292
 
288
293
  // Spawn the binary with all arguments
289
294
  const result = spawnSync(binaryPath, process.argv.slice(2), {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rumdl",
3
- "version": "0.1.43",
3
+ "version": "0.1.45",
4
4
  "description": "A fast Markdown linter written in Rust",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -33,12 +33,12 @@
33
33
  "node": ">=18.0.0"
34
34
  },
35
35
  "optionalDependencies": {
36
- "@rumdl/cli-darwin-x64": "0.1.43",
37
- "@rumdl/cli-darwin-arm64": "0.1.43",
38
- "@rumdl/cli-linux-x64": "0.1.43",
39
- "@rumdl/cli-linux-arm64": "0.1.43",
40
- "@rumdl/cli-linux-x64-musl": "0.1.43",
41
- "@rumdl/cli-linux-arm64-musl": "0.1.43",
42
- "@rumdl/cli-win32-x64": "0.1.43"
36
+ "@rumdl/cli-darwin-x64": "0.1.45",
37
+ "@rumdl/cli-darwin-arm64": "0.1.45",
38
+ "@rumdl/cli-linux-x64": "0.1.45",
39
+ "@rumdl/cli-linux-arm64": "0.1.45",
40
+ "@rumdl/cli-linux-x64-musl": "0.1.45",
41
+ "@rumdl/cli-linux-arm64-musl": "0.1.45",
42
+ "@rumdl/cli-win32-x64": "0.1.45"
43
43
  }
44
44
  }