@pdftron/pdfnet-node 11.9.1 → 11.10.0-2-beta

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/package.json +1 -1
  2. package/scripts/install.js +16 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pdftron/pdfnet-node",
3
- "version": "11.9.1",
3
+ "version": "11.10.0-2-beta",
4
4
  "main": "./lib/pdfnet.js",
5
5
  "types": "./lib/types.d.ts",
6
6
  "scripts": {
@@ -18,8 +18,23 @@ if (isElectron) {
18
18
 
19
19
  console.log('Downloading prebuilt binary from:', prebuildUrl);
20
20
 
21
+ function npmSupportsExec() {
22
+ try {
23
+ const version = execSync('npm --version', { encoding: 'utf8' }).trim();
24
+ const major = Number(version.split('.')[0]);
25
+ return major >= 7;
26
+ } catch {
27
+ return false;
28
+ }
29
+ }
30
+
21
31
  try {
22
- execSync(`npx prebuild-install --download ${prebuildUrl} --verbose`, { stdio: 'inherit' });
32
+ if (npmSupportsExec()) {
33
+ execSync(`npm exec prebuild-install -- --download ${prebuildUrl} --verbose`, { stdio: 'inherit' });
34
+ } else {
35
+ console.log("npm exec not found, falling back to npx")
36
+ execSync(`npx prebuild-install --download ${prebuildUrl} --verbose`, { stdio: 'inherit' });
37
+ }
23
38
 
24
39
  const extractedFolder = `node-v${abi}-${platform}-${arch}`;
25
40
  const libFolder = path.join(extractedFolder, 'lib');