@deltachat/stdio-rpc-server 1.137.4 → 1.138.5

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.
@@ -27,7 +27,7 @@ For a more complete example refer to https://github.com/deltachat-bot/echo/pull/
27
27
 
28
28
  ## How to use on an unsupported platform
29
29
 
30
- <!-- todo instructions, will uses an env var for pointing to `deltachat-rpx-server` binary -->
30
+ <!-- todo instructions, will uses an env var for pointing to `deltachat-rpc-server` binary -->
31
31
 
32
32
  <!-- todo copy parts from https://github.com/deltachat/deltachat-desktop/blob/7045c6f549e4b9d5caa0709d5bd314bbd9fd53db/docs/UPDATE_CORE.md -->
33
33
 
@@ -61,7 +61,7 @@ When you import this package it searches for the rpc server in the following loc
61
61
  - Then pass it as an artifact to the last CI action that publishes the main package.
62
62
  - upload all packages from `deltachat-rpc-server/npm-package/platform_package`.
63
63
  - then publish `deltachat-rpc-server/npm-package`,
64
- - this will run `update_optional_dependencie_and_version.js` (in the `prepack` script),
64
+ - this will run `update_optional_dependencies_and_version.js` (in the `prepack` script),
65
65
  which puts all platform packages into `optionalDependencies` and updates the `version` in `package.json`
66
66
 
67
67
  ## How to build a version you can use localy on your host machine for development
package/index.js CHANGED
@@ -65,31 +65,15 @@ export async function getRPCServerPath(
65
65
 
66
66
  // 2. check if it can be found in PATH
67
67
  if (!process.env[SKIP_SEARCH_IN_PATH] && !skipSearchInPath) {
68
- const path_dirs = process.env["PATH"].split(/:|;/);
69
- // check cargo dir first
70
- const cargo_dirs = path_dirs.filter((p) => p.endsWith(".cargo/bin"));
71
- const findExecutable = async (directory) => {
72
- const files = await readdir(directory);
73
- const file = files.find((p) =>
74
- basename(p).includes(PATH_EXECUTABLE_NAME)
75
- );
76
- if (file) {
77
- return join(directory, file);
78
- } else {
79
- throw null;
80
- }
81
- };
82
- const executable_search = // TODO make code simpler to read
83
- (await Promise.allSettled(cargo_dirs.map(findExecutable))).find(
84
- ({ status }) => status === "fulfilled"
85
- ) ||
86
- (await Promise.allSettled(path_dirs.map(findExecutable))).find(
87
- ({ status }) => status === "fulfilled"
88
- );
89
- // TODO maybe we could the system do this stuff automatically
90
- // by just trying to execute it and then use "which" (unix) or "where" (windows) to get the path to the executable
91
- if (executable_search.status === "fulfilled") {
92
- const executable = executable_search.value;
68
+ const exec = promisify(execFile);
69
+
70
+ const { stdout: executable } =
71
+ os.platform() !== "win32"
72
+ ? await exec("command", ["-v", PATH_EXECUTABLE_NAME])
73
+ : await exec("where", [PATH_EXECUTABLE_NAME]);
74
+
75
+ // by just trying to execute it and then use "command -v deltachat-rpc-server" (unix) or "where deltachat-rpc-server" (windows) to get the path to the executable
76
+ if (executable.length > 1) {
93
77
  // test if it is the right version
94
78
  try {
95
79
  // for some unknown reason it is in stderr and not in stdout
@@ -153,7 +137,7 @@ export async function startDeltaChat(directory, options) {
153
137
  };
154
138
 
155
139
  //@ts-expect-error
156
- dc.pathToServerBinary = pathToServerBinary
140
+ dc.pathToServerBinary = pathToServerBinary;
157
141
 
158
142
  return dc;
159
143
  }
package/package.json CHANGED
@@ -1,26 +1,30 @@
1
1
  {
2
- "type": "module",
3
- "name": "@deltachat/stdio-rpc-server",
4
- "version": "1.137.4",
5
2
  "license": "MPL-2.0",
6
3
  "main": "index.js",
7
- "types": "index.d.ts",
8
- "scripts": {
9
- "prepack": "node scripts/update_optional_dependencies_and_version.js"
10
- },
4
+ "name": "@deltachat/stdio-rpc-server",
11
5
  "optionalDependencies": {
12
- "@deltachat/stdio-rpc-server-darwin-arm64": "1.137.4",
13
- "@deltachat/stdio-rpc-server-android-arm64": "1.137.4",
14
- "@deltachat/stdio-rpc-server-linux-arm64": "1.137.4",
15
- "@deltachat/stdio-rpc-server-linux-arm": "1.137.4",
16
- "@deltachat/stdio-rpc-server-android-arm": "1.137.4",
17
- "@deltachat/stdio-rpc-server-win32-i32": "1.137.4",
18
- "@deltachat/stdio-rpc-server-linux-i32": "1.137.4",
19
- "@deltachat/stdio-rpc-server-darwin-x64": "1.137.4",
20
- "@deltachat/stdio-rpc-server-win32-x64": "1.137.4",
21
- "@deltachat/stdio-rpc-server-linux-x64": "1.137.4"
6
+ "@deltachat/stdio-rpc-server-darwin-arm64": "1.138.5",
7
+ "@deltachat/stdio-rpc-server-android-arm64": "1.138.5",
8
+ "@deltachat/stdio-rpc-server-linux-arm64": "1.138.5",
9
+ "@deltachat/stdio-rpc-server-linux-arm": "1.138.5",
10
+ "@deltachat/stdio-rpc-server-android-arm": "1.138.5",
11
+ "@deltachat/stdio-rpc-server-win32-i32": "1.138.5",
12
+ "@deltachat/stdio-rpc-server-linux-i32": "1.138.5",
13
+ "@deltachat/stdio-rpc-server-darwin-x64": "1.138.5",
14
+ "@deltachat/stdio-rpc-server-win32-x64": "1.138.5",
15
+ "@deltachat/stdio-rpc-server-linux-x64": "1.138.5"
22
16
  },
23
17
  "peerDependencies": {
24
18
  "@deltachat/jsonrpc-client": "*"
25
- }
19
+ },
20
+ "repository": {
21
+ "type": "git",
22
+ "url": "https://github.com/deltachat/deltachat-core-rust.git"
23
+ },
24
+ "scripts": {
25
+ "prepack": "node scripts/update_optional_dependencies_and_version.js"
26
+ },
27
+ "type": "module",
28
+ "types": "index.d.ts",
29
+ "version": "1.138.5"
26
30
  }