@mac-bug-screenshot/native-host 1.0.2 → 1.0.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.
package/README.md CHANGED
@@ -22,4 +22,12 @@ mac-bug-screenshot-install <확장_프로그램_ID>
22
22
  ## 게시 정보
23
23
 
24
24
  - npm 패키지: https://www.npmjs.com/package/@mac-bug-screenshot/native-host
25
- - 현재 버전: 1.0.1
25
+ - 현재 버전: 1.0.2
26
+
27
+ ## 문제 해결
28
+
29
+ - `Native host has exited` 오류가 뜨면 최신 버전으로 업데이트 후 재등록하세요.
30
+ ```bash
31
+ npm install -g @mac-bug-screenshot/native-host@latest
32
+ mac-bug-screenshot-install <확장_프로그램_ID>
33
+ ```
package/bin/install.js CHANGED
@@ -7,6 +7,8 @@ const HOST_NAME = "com.sobbangcompany.mac_bug_screenshot";
7
7
  const ROOT_DIR = path.resolve(__dirname, "..");
8
8
  const TEMPLATE_PATH = path.join(ROOT_DIR, "manifest.template.json");
9
9
  const HOST_PATH = path.join(ROOT_DIR, "host.js");
10
+ const WRAPPER_DIR = path.join(os.homedir(), ".mac-bug-screenshot");
11
+ const WRAPPER_PATH = path.join(WRAPPER_DIR, "native-host.sh");
10
12
  const TARGET_DIR = path.join(
11
13
  os.homedir(),
12
14
  "Library",
@@ -30,9 +32,19 @@ function main() {
30
32
 
31
33
  const template = fs.readFileSync(TEMPLATE_PATH, "utf8");
32
34
  const manifest = template
33
- .replace(/__HOST_PATH__/g, HOST_PATH)
35
+ .replace(/__HOST_PATH__/g, WRAPPER_PATH)
34
36
  .replace(/__EXTENSION_ID__/g, extensionId);
35
37
 
38
+ fs.mkdirSync(WRAPPER_DIR, { recursive: true });
39
+ const wrapperScript = [
40
+ "#!/bin/sh",
41
+ `NODE_PATH="${process.execPath}"`,
42
+ `HOST_PATH="${HOST_PATH}"`,
43
+ 'exec "$NODE_PATH" "$HOST_PATH"'
44
+ ].join("\n");
45
+ fs.writeFileSync(WRAPPER_PATH, wrapperScript);
46
+ fs.chmodSync(WRAPPER_PATH, 0o755);
47
+
36
48
  fs.mkdirSync(TARGET_DIR, { recursive: true });
37
49
  fs.writeFileSync(TARGET_PATH, manifest);
38
50
  fs.chmodSync(HOST_PATH, 0o755);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mac-bug-screenshot/native-host",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "Native messaging host for Mac Bug Screenshot.",
5
5
  "bin": {
6
6
  "mac-bug-screenshot-install": "bin/install.js"