apimock-rs 4.0.0-rc.10 → 4.0.0-rc.11

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/index.js CHANGED
@@ -1,3 +1,5 @@
1
+ #!/usr/bin/env node
2
+
1
3
  const os = require("os")
2
4
  const { spawn } = require("child_process")
3
5
 
@@ -20,7 +22,7 @@ function spawnBinary(binaryPath) {
20
22
  // passing command line arguments to the executable
21
23
  const args = process.argv.slice(2)
22
24
 
23
- const child = spawn(binPath, args, {
25
+ const child = spawn(binaryPath, args, {
24
26
  stdio: "inherit", // sharing std i/o with the parent brings memory efficiency
25
27
  })
26
28
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apimock-rs",
3
- "version": "4.0.0-rc.10",
3
+ "version": "4.0.0-rc.11",
4
4
  "description": "HTTP server generating REST/JSON responses. Aims to be mocking helper to develop microservices and APIs.",
5
5
  "author": "nabbisen<nabbisen@scqr.net",
6
6
  "license": "Apache-2.0",
@@ -18,9 +18,9 @@
18
18
  "postinstall": "node postinstall.js"
19
19
  },
20
20
  "optionalDependencies": {
21
- "@apimock-rs/linux-x64-gnu": "4.0.0-rc.10",
22
- "@apimock-rs/darwin-arm64": "4.0.0-rc.10",
23
- "@apimock-rs/win32-x64-msvc": "4.0.0-rc.10"
21
+ "@apimock-rs/linux-x64-gnu": "4.0.0-rc.11",
22
+ "@apimock-rs/darwin-arm64": "4.0.0-rc.11",
23
+ "@apimock-rs/win32-x64-msvc": "4.0.0-rc.11"
24
24
  },
25
25
  "keywords": [
26
26
  "api",
package/postinstall.js CHANGED
@@ -2,22 +2,24 @@ const fs = require("fs")
2
2
  const os = require("os")
3
3
  const path = require("path")
4
4
 
5
+ const binaryName = "apimock"
6
+ const platformOrganization = "@apimock-rs"
7
+
5
8
  function srcDestBinaryPath() {
6
9
  const platform = os.platform()
7
10
 
8
- let targetPackage = null
9
- let binaryName = "apimock"
11
+ let platformPackage = null
10
12
  let extension = ""
11
13
 
12
14
  switch (platform) {
13
15
  case "linux":
14
- targetPackage = "bin-linux-x64-gnu"
16
+ platformPackage = "linux-x64-gnu"
15
17
  break
16
18
  case "darwin":
17
- targetPackage = "bin-darwin-arm64"
19
+ platformPackage = "darwin-arm64"
18
20
  break
19
21
  case "win32":
20
- targetPackage = "bin-win32-x64-msvc"
22
+ platformPackage = "win32-x64-msvc"
21
23
  extension = ".exe"
22
24
  break
23
25
  default:
@@ -26,7 +28,7 @@ function srcDestBinaryPath() {
26
28
  }
27
29
 
28
30
  const binDir = __dirname
29
- const srcDir = path.join(binDir, "..", targetPackage)
31
+ const srcDir = path.join(binDir, "..", platformOrganization, platformPackage)
30
32
  const srcBinary = path.join(srcDir, `${binaryName}${extension}`)
31
33
  const destBinary = path.join(binDir, `${binaryName}${extension}`)
32
34
 
@@ -41,6 +43,7 @@ function linkOrCopy(src, dest) {
41
43
 
42
44
  // Try symbolic link first
43
45
  fs.symlinkSync(src, dest, "file")
46
+ fs.chmodSync(src, 0o755)
44
47
  console.log(`linked ${src} --> ${dest}`)
45
48
  } catch (e) {
46
49
  // Fallback to file copy