@phreshos/cli 0.1.29 → 0.1.30
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.
|
@@ -8,12 +8,14 @@ const defaultLabel = "com.phreshos.system";
|
|
|
8
8
|
export default class MacOSSystemService {
|
|
9
9
|
run;
|
|
10
10
|
label;
|
|
11
|
+
environment;
|
|
11
12
|
plist;
|
|
12
13
|
domain;
|
|
13
14
|
target;
|
|
14
|
-
constructor(userHome, run = execute, label = defaultLabel, uid = process.getuid?.()) {
|
|
15
|
+
constructor(userHome, run = execute, label = defaultLabel, uid = process.getuid?.(), environment = process.env) {
|
|
15
16
|
this.run = run;
|
|
16
17
|
this.label = label;
|
|
18
|
+
this.environment = environment;
|
|
17
19
|
if (uid === undefined)
|
|
18
20
|
throw new Error("The current macOS user could not be identified");
|
|
19
21
|
this.plist = join(userHome, "Library", "LaunchAgents", `${this.label}.plist`);
|
|
@@ -40,7 +42,7 @@ export default class MacOSSystemService {
|
|
|
40
42
|
await mkdir(dirname(definition.output), { recursive: true });
|
|
41
43
|
const temporary = `${this.plist}.${randomUUID()}.tmp`;
|
|
42
44
|
try {
|
|
43
|
-
await writeFile(temporary, plist(this.label, definition), { mode: 0o600 });
|
|
45
|
+
await writeFile(temporary, plist(this.label, definition, this.environment), { mode: 0o600 });
|
|
44
46
|
await rename(temporary, this.plist);
|
|
45
47
|
}
|
|
46
48
|
finally {
|
|
@@ -84,7 +86,8 @@ export default class MacOSSystemService {
|
|
|
84
86
|
throw new Error(result.stderr.trim() || result.stdout.trim() || `${command} exited with code ${result.code}`);
|
|
85
87
|
}
|
|
86
88
|
}
|
|
87
|
-
function plist(label, definition) {
|
|
89
|
+
function plist(label, definition, environment) {
|
|
90
|
+
const path = environmentPath(environment);
|
|
88
91
|
return `<?xml version="1.0" encoding="UTF-8"?>
|
|
89
92
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
90
93
|
<plist version="1.0">
|
|
@@ -99,6 +102,12 @@ ${definition.arguments.map(argument => ` <string>${xml(argument)}</string
|
|
|
99
102
|
</array>
|
|
100
103
|
<key>WorkingDirectory</key>
|
|
101
104
|
<string>${xml(definition.directory)}</string>
|
|
105
|
+
${path === undefined ? "" : ` <key>EnvironmentVariables</key>
|
|
106
|
+
<dict>
|
|
107
|
+
<key>PATH</key>
|
|
108
|
+
<string>${xml(path)}</string>
|
|
109
|
+
</dict>
|
|
110
|
+
`}
|
|
102
111
|
<key>RunAtLoad</key>
|
|
103
112
|
<true/>
|
|
104
113
|
<key>KeepAlive</key>
|
|
@@ -116,6 +125,10 @@ ${definition.arguments.map(argument => ` <string>${xml(argument)}</string
|
|
|
116
125
|
</plist>
|
|
117
126
|
`;
|
|
118
127
|
}
|
|
128
|
+
function environmentPath(environment) {
|
|
129
|
+
const key = Object.keys(environment).find(name => name.toLowerCase() === "path");
|
|
130
|
+
return key === undefined ? undefined : environment[key];
|
|
131
|
+
}
|
|
119
132
|
function xml(value) {
|
|
120
133
|
return value.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll('"', """);
|
|
121
134
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "phresh",
|
|
3
3
|
"private": true,
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.18",
|
|
5
5
|
"description": "The official PhreshOS starter Program.",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"scripts": {
|
|
@@ -15,14 +15,14 @@
|
|
|
15
15
|
],
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@phreshos/client": "^0.1.22",
|
|
18
|
-
"@phreshos/core": "^0.1.
|
|
18
|
+
"@phreshos/core": "^0.1.20",
|
|
19
19
|
"@phreshos/react": "^0.1.10",
|
|
20
|
-
"@phreshos/server": "^0.1.
|
|
20
|
+
"@phreshos/server": "^0.1.21",
|
|
21
21
|
"react": "^19.2.8",
|
|
22
22
|
"react-dom": "^19.2.8"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@phreshos/cli": "^0.1.
|
|
25
|
+
"@phreshos/cli": "^0.1.30",
|
|
26
26
|
"@types/node": "^26.2.0",
|
|
27
27
|
"@types/react": "^19.2.18",
|
|
28
28
|
"@types/react-dom": "^19.2.4",
|
|
@@ -4,7 +4,7 @@ export default defineConfig({
|
|
|
4
4
|
identity: "phresh",
|
|
5
5
|
name: "Phresh Program",
|
|
6
6
|
description: "A minimal counter with direct Client and Server endpoints.",
|
|
7
|
-
version: "0.1.
|
|
7
|
+
version: "0.1.18",
|
|
8
8
|
icon: "icon.png",
|
|
9
9
|
categories: ["Development"],
|
|
10
10
|
keywords: ["example", "counter", "client", "server"],
|
|
@@ -12,7 +12,7 @@ export default defineConfig({
|
|
|
12
12
|
buildCommand: "vite-node scripts/build.ts",
|
|
13
13
|
server: {
|
|
14
14
|
location: "dist/server",
|
|
15
|
-
|
|
15
|
+
entryFile: "main.js",
|
|
16
16
|
development: {
|
|
17
17
|
startCommand: "vite-node source/server/main.ts"
|
|
18
18
|
}
|
|
@@ -23,7 +23,7 @@ export default defineConfig({
|
|
|
23
23
|
size: { width: 600, height: 500 },
|
|
24
24
|
development: {
|
|
25
25
|
url: "http://localhost:5200/",
|
|
26
|
-
startCommand: "vite
|
|
26
|
+
startCommand: "vite --config vite.client.ts"
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
})
|
package/dist/template.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"repository": "PhreshOS/phresh-program",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"sha256": "
|
|
3
|
+
"version": "0.1.18",
|
|
4
|
+
"sha256": "f612d9c2c55beac0dc618057a68fad177e40564e596047011173e0a5226b65d6",
|
|
5
5
|
"development": true
|
|
6
6
|
}
|