@3-/srv-darwin 0.1.9
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/bun.lock +20 -0
- package/install.js +24 -0
- package/launchd.xml +22 -0
- package/package.json +21 -0
- package/uninstall.js +13 -0
package/bun.lock
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"lockfileVersion": 1,
|
|
3
|
+
"configVersion": 1,
|
|
4
|
+
"workspaces": {
|
|
5
|
+
"": {
|
|
6
|
+
"name": "@3-/srv-darwin",
|
|
7
|
+
"dependencies": {
|
|
8
|
+
"@3-/srv-obj-replace": "file:../obj_replace",
|
|
9
|
+
"zx": "^8.8.5",
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
"packages": {
|
|
14
|
+
"@3-/read": ["@3-/read@0.1.4", "", {}, "sha512-PZDRfIFuaFNAW6VjWupa7+g/3GbhES6shAgETN/RXtTdJxcIwl9HSBMy2sdfRqAc/FUeUJFL3F8PfpsdZbC8xg=="],
|
|
15
|
+
|
|
16
|
+
"@3-/srv-obj-replace": ["@3-/srv-obj-replace@file:../obj_replace", { "dependencies": { "@3-/read": "^0.1.4" } }],
|
|
17
|
+
|
|
18
|
+
"zx": ["zx@8.8.5", "", { "bin": { "zx": "build/cli.js" } }, "sha512-SNgDF5L0gfN7FwVOdEFguY3orU5AkfFZm9B5YSHog/UDHv+lvmd82ZAsOenOkQixigwH2+yyH198AwNdKhj+RA=="],
|
|
19
|
+
}
|
|
20
|
+
}
|
package/install.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import fs from "fs/promises";
|
|
2
|
+
import { homedir } from "os";
|
|
3
|
+
import { join } from "path";
|
|
4
|
+
import { $ } from "zx";
|
|
5
|
+
import gen from "@3-/srv-obj-replace/gen.js";
|
|
6
|
+
|
|
7
|
+
export default async ({ name, scriptPath: script_path }) => {
|
|
8
|
+
const { execPath: exec_path } = process,
|
|
9
|
+
home_dir = homedir(),
|
|
10
|
+
launch_agents_dir = join(home_dir, "Library", "LaunchAgents"),
|
|
11
|
+
plist_path = join(launch_agents_dir, `${name}.plist`),
|
|
12
|
+
logs_dir = join(home_dir, "Library", "Logs"),
|
|
13
|
+
out_log = join(logs_dir, `${name}.log`),
|
|
14
|
+
err_log = join(logs_dir, `${name}.err.log`);
|
|
15
|
+
|
|
16
|
+
await fs.mkdir(launch_agents_dir, { recursive: true });
|
|
17
|
+
await gen(
|
|
18
|
+
{ name, execPath: exec_path, scriptPath: script_path, outLog: out_log, errLog: err_log },
|
|
19
|
+
join(import.meta.dirname, "launchd.xml"),
|
|
20
|
+
plist_path
|
|
21
|
+
);
|
|
22
|
+
await $`launchctl bootout gui/$(id -u) ${plist_path} || true`;
|
|
23
|
+
await $`launchctl bootstrap gui/$(id -u) ${plist_path}`;
|
|
24
|
+
};
|
package/launchd.xml
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
+
<plist version="1.0">
|
|
4
|
+
<dict>
|
|
5
|
+
<key>Label</key>
|
|
6
|
+
<string>$name</string>
|
|
7
|
+
<key>ProgramArguments</key>
|
|
8
|
+
<array>
|
|
9
|
+
<string>$execPath</string>
|
|
10
|
+
<string>$scriptPath</string>
|
|
11
|
+
<string>run</string>
|
|
12
|
+
</array>
|
|
13
|
+
<key>RunAtLoad</key>
|
|
14
|
+
<true/>
|
|
15
|
+
<key>KeepAlive</key>
|
|
16
|
+
<true/>
|
|
17
|
+
<key>StandardOutPath</key>
|
|
18
|
+
<string>$outLog</string>
|
|
19
|
+
<key>StandardErrorPath</key>
|
|
20
|
+
<string>$errLog</string>
|
|
21
|
+
</dict>
|
|
22
|
+
</plist>
|
package/package.json
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@3-/srv-darwin",
|
|
3
|
+
"version": "0.1.9",
|
|
4
|
+
"os": [
|
|
5
|
+
"darwin"
|
|
6
|
+
],
|
|
7
|
+
"type": "module",
|
|
8
|
+
"exports": {
|
|
9
|
+
"./install.js": "./install.js",
|
|
10
|
+
"./uninstall.js": "./uninstall.js"
|
|
11
|
+
},
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"@3-/srv-obj-replace": "file:../obj_replace",
|
|
14
|
+
"zx": "^8.8.5"
|
|
15
|
+
},
|
|
16
|
+
"repository": "https://github.com/i18n-site/lib/tree/dev",
|
|
17
|
+
"homepage": "https://github.com/i18n-site/lib/tree/dev",
|
|
18
|
+
"bugs": {
|
|
19
|
+
"url": "https://github.com/i18n-site/lib/issues"
|
|
20
|
+
}
|
|
21
|
+
}
|
package/uninstall.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import fs from "fs/promises";
|
|
2
|
+
import { homedir } from "os";
|
|
3
|
+
import { join } from "path";
|
|
4
|
+
import { $ } from "zx";
|
|
5
|
+
|
|
6
|
+
export default async ({ name }) => {
|
|
7
|
+
const home_dir = homedir(),
|
|
8
|
+
launch_agents_dir = join(home_dir, "Library", "LaunchAgents"),
|
|
9
|
+
plist_path = join(launch_agents_dir, `${name}.plist`);
|
|
10
|
+
|
|
11
|
+
await $`launchctl bootout gui/$(id -u) ${plist_path} || true`;
|
|
12
|
+
await fs.rm(plist_path, { force: true });
|
|
13
|
+
};
|