@phreshos/cli 0.1.40 → 0.1.42
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/dist/cli.js +5 -5
- package/dist/control/endpoint.js +26 -9
- package/dist/control/options.js +8 -1
- package/dist/control/process.js +1 -9
- package/dist/control/program.js +7 -3
- package/dist/control/shared.js +27 -7
- package/dist/create.js +2 -2
- package/dist/describe-command.js +2 -0
- package/dist/install.js +8 -8
- package/dist/launch.js +5 -3
- package/dist/pack.js +5 -2
- package/dist/program-installation.js +0 -8
- package/dist/project-dependency.js +2 -2
- package/dist/prompts.js +4 -2
- package/dist/style.js +11 -2
- package/dist/system/lifecycle.js +1 -1
- package/dist/template/package.json +6 -6
- package/dist/template/phresh.config.ts +1 -1
- package/dist/template.json +2 -2
- package/dist/uninstall.js +4 -3
- package/package.json +3 -3
package/dist/cli.js
CHANGED
|
@@ -12,6 +12,7 @@ import systemCommands from "./system/command.js";
|
|
|
12
12
|
import controlCommands from "./control/command.js";
|
|
13
13
|
import describeCommands from "./describe-command.js";
|
|
14
14
|
import { commandContract } from "./command-contract.js";
|
|
15
|
+
import { blank, failure } from "./style.js";
|
|
15
16
|
const metadata = createRequire(import.meta.url)("../package.json");
|
|
16
17
|
const { version } = metadata;
|
|
17
18
|
const coreRange = metadata.dependencies["@phreshos/core"];
|
|
@@ -96,13 +97,12 @@ describe(program.command("install")
|
|
|
96
97
|
.description("install a local or official Program")
|
|
97
98
|
.argument("[name]", "name of an official Program")
|
|
98
99
|
.option("--run", "run the installed Program now")
|
|
99
|
-
.option("--startup", "run the Program when the System starts")
|
|
100
100
|
.action(async function (name, options) {
|
|
101
|
-
await install({ name, run: options.run === true
|
|
101
|
+
await install({ name, run: options.run === true });
|
|
102
102
|
}), [
|
|
103
103
|
"Without a name, builds and installs the Program declared by this project.",
|
|
104
104
|
"A name installs its verified official production release. --run launches",
|
|
105
|
-
"
|
|
105
|
+
"the installed Program now."
|
|
106
106
|
]);
|
|
107
107
|
describe(program.command("uninstall")
|
|
108
108
|
.description("uninstall a local or installed Program")
|
|
@@ -129,7 +129,7 @@ controlCommands(program);
|
|
|
129
129
|
describeCommands(program);
|
|
130
130
|
// Every command begins with the same breathing room. Keep this at the entry
|
|
131
131
|
// point so individual commands never need to manufacture their own opening.
|
|
132
|
-
|
|
132
|
+
blank();
|
|
133
133
|
if (process.argv.length === 2)
|
|
134
134
|
program.help();
|
|
135
135
|
try {
|
|
@@ -141,7 +141,7 @@ catch (error) {
|
|
|
141
141
|
else if (error instanceof ReportedFailure)
|
|
142
142
|
process.exitCode = 1;
|
|
143
143
|
else {
|
|
144
|
-
|
|
144
|
+
failure(error instanceof Error ? error.message : String(error));
|
|
145
145
|
process.exitCode = 1;
|
|
146
146
|
}
|
|
147
147
|
}
|
package/dist/control/endpoint.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {} from "commander";
|
|
1
|
+
import { Option } from "commander";
|
|
2
2
|
import { commandContract } from "../command-contract.js";
|
|
3
|
-
import { clientOverrideOptions, endpointOptions, outputOptions } from "./options.js";
|
|
4
|
-
import { bounded, clientLaunch, connected, endpoint, endpointView, integer, output, payload, requireProcess, wait } from "./shared.js";
|
|
3
|
+
import { clientOverrideOptions, endpointOptions, outputOptions, serverOverrideOptions } from "./options.js";
|
|
4
|
+
import { bounded, clientLaunch, connected, endpoint, endpointView, integer, output, payload, requireProcess, serverLaunch, wait } from "./shared.js";
|
|
5
5
|
export default function endpointCommands(root, connect) {
|
|
6
6
|
const endpoints = commandContract(root.command("endpoint")
|
|
7
7
|
.description("inspect, control, and communicate with Process Endpoints"));
|
|
@@ -10,16 +10,19 @@ export default function endpointCommands(root, connect) {
|
|
|
10
10
|
.action(async (options) => withEndpoint(connect, options, async (process, name) => {
|
|
11
11
|
output(await endpointView(process, name), options.compact);
|
|
12
12
|
}));
|
|
13
|
-
outputOptions(clientOverrideOptions(endpointOptions(endpoints.command("start")
|
|
14
|
-
.description("start a fresh Endpoint incarnation"))))
|
|
13
|
+
outputOptions(serverOverrideOptions(clientOverrideOptions(endpointOptions(endpoints.command("start")
|
|
14
|
+
.description("start a fresh Endpoint incarnation")))))
|
|
15
15
|
.action(async (options) => withEndpoint(connect, options, async (process, name) => {
|
|
16
|
-
const
|
|
17
|
-
|
|
16
|
+
const client = clientLaunch(options);
|
|
17
|
+
const server = serverLaunch(options);
|
|
18
|
+
if (name === "server" && client !== undefined)
|
|
18
19
|
throw new Error("Client overrides require --endpoint client");
|
|
20
|
+
if (name === "client" && server !== undefined)
|
|
21
|
+
throw new Error("Server overrides require --endpoint server");
|
|
19
22
|
if (name === "client")
|
|
20
|
-
await process.client.start(typeof
|
|
23
|
+
await process.client.start(typeof client === "object" ? client : undefined);
|
|
21
24
|
else
|
|
22
|
-
await process.server.start();
|
|
25
|
+
await process.server.start(typeof server === "object" ? server : undefined);
|
|
23
26
|
output(await endpointView(process, name), options.compact);
|
|
24
27
|
}));
|
|
25
28
|
outputOptions(endpointOptions(endpoints.command("stop")
|
|
@@ -38,6 +41,20 @@ export default function endpointCommands(root, connect) {
|
|
|
38
41
|
await process.server.waitReady(timeout(options.timeout));
|
|
39
42
|
output(await endpointView(process, "server"), options.compact);
|
|
40
43
|
}));
|
|
44
|
+
outputOptions(endpointOptions(endpoints.command("waitLifecycle")
|
|
45
|
+
.alias("wait-lifecycle")
|
|
46
|
+
.description("wait for one lifecycle transition of an exact Endpoint")
|
|
47
|
+
.addOption(new Option("--event <event>", "Endpoint lifecycle event")
|
|
48
|
+
.choices(["start", "stop"])
|
|
49
|
+
.makeOptionMandatory())
|
|
50
|
+
.option("--timeout <milliseconds>", "maximum wait in milliseconds", integer)))
|
|
51
|
+
.action(async (options) => withEndpoint(connect, options, async (process, name) => {
|
|
52
|
+
await wait(endpoint(process, name).lifecycle, options.event, timeout(options.timeout));
|
|
53
|
+
output({
|
|
54
|
+
scope: `endpoint:${process.identity}:${name}:lifecycle`,
|
|
55
|
+
event: options.event
|
|
56
|
+
}, options.compact);
|
|
57
|
+
}));
|
|
41
58
|
outputOptions(endpointOptions(endpoints.command("ask")
|
|
42
59
|
.description("ask a Server event and return its answer")
|
|
43
60
|
.requiredOption("--event <event>", "event name")
|
package/dist/control/options.js
CHANGED
|
@@ -19,6 +19,8 @@ export function clientOptions(command) {
|
|
|
19
19
|
}
|
|
20
20
|
export function clientOverrideOptions(command) {
|
|
21
21
|
return command
|
|
22
|
+
.option("--client-service", "address this Client incarnation through system.service()")
|
|
23
|
+
.option("--no-client-service", "do not address this Client incarnation through system.service()")
|
|
22
24
|
.option("--client-title <title>", "initial Window title")
|
|
23
25
|
.option("--client-width <value>", "initial Window width")
|
|
24
26
|
.option("--client-height <value>", "initial Window height")
|
|
@@ -28,8 +30,13 @@ export function clientOverrideOptions(command) {
|
|
|
28
30
|
.option("--client-location <location>", "initial page beneath the Client location")
|
|
29
31
|
.option("--client-minimized", "open the Window minimized");
|
|
30
32
|
}
|
|
33
|
+
export function serverOverrideOptions(command) {
|
|
34
|
+
return command
|
|
35
|
+
.option("--server-service", "address this Server incarnation through system.service()")
|
|
36
|
+
.option("--no-server-service", "do not address this Server incarnation through system.service()");
|
|
37
|
+
}
|
|
31
38
|
export function launchOptions(command) {
|
|
32
|
-
return clientOptions(command)
|
|
39
|
+
return serverOverrideOptions(clientOptions(command))
|
|
33
40
|
.option("--name <name>", "stable Program-local Process name")
|
|
34
41
|
.option("--server", "start the Server Endpoint")
|
|
35
42
|
.option("--no-server", "do not start the Server Endpoint")
|
package/dist/control/process.js
CHANGED
|
@@ -49,7 +49,7 @@ export default function processCommands(root, connect) {
|
|
|
49
49
|
outputOptions(process.command("wait")
|
|
50
50
|
.description("wait for one Process lifecycle event")
|
|
51
51
|
.addOption(new Option("--event <event>", "Process lifecycle event")
|
|
52
|
-
.choices(["
|
|
52
|
+
.choices(["create", "exit"])
|
|
53
53
|
.makeOptionMandatory())
|
|
54
54
|
.option("--process <identity>", "scope the event to one Process")
|
|
55
55
|
.option("--program <identity>", "scope the event to one Program")
|
|
@@ -75,14 +75,6 @@ export default function processCommands(root, connect) {
|
|
|
75
75
|
async function eventView(event, message, scoped) {
|
|
76
76
|
if (event === "create")
|
|
77
77
|
return processView(message);
|
|
78
|
-
if (event === "endpointStart" || event === "endpointStop") {
|
|
79
|
-
const endpoint = message;
|
|
80
|
-
const process = await endpoint.process();
|
|
81
|
-
return {
|
|
82
|
-
process: process.identity,
|
|
83
|
-
endpoint: endpoint === process.server ? "server" : "client"
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
78
|
const exit = message;
|
|
87
79
|
const process = exit.process ?? scoped;
|
|
88
80
|
return {
|
package/dist/control/program.js
CHANGED
|
@@ -48,15 +48,19 @@ export default function programCommands(root, connect) {
|
|
|
48
48
|
output({
|
|
49
49
|
scope: options.program ? `program:${options.program}` : "program",
|
|
50
50
|
event: options.event,
|
|
51
|
-
payload: await eventView(options.event, message)
|
|
51
|
+
payload: await eventView(options.event, message, options.program ? target : undefined)
|
|
52
52
|
}, options.compact);
|
|
53
53
|
}));
|
|
54
54
|
}
|
|
55
|
-
async function eventView(event, message) {
|
|
55
|
+
async function eventView(event, message, scoped) {
|
|
56
56
|
if (event === "uninstall") {
|
|
57
|
+
if (scoped)
|
|
58
|
+
return { program: await programView(scoped), everything: message === true };
|
|
57
59
|
const value = message;
|
|
58
|
-
return { program: await programView(value.program),
|
|
60
|
+
return { program: await programView(value.program), everything: value.everything };
|
|
59
61
|
}
|
|
62
|
+
if (scoped)
|
|
63
|
+
return programView(scoped);
|
|
60
64
|
return programView(message);
|
|
61
65
|
}
|
|
62
66
|
function timeout(value) {
|
package/dist/control/shared.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { System } from "@phreshos/node";
|
|
2
|
+
import { blank } from "../style.js";
|
|
2
3
|
export const connectSystem = () => System.connect();
|
|
3
4
|
export async function connected(connect, action) {
|
|
4
5
|
const system = await connect();
|
|
@@ -39,14 +40,19 @@ export async function programView(program) {
|
|
|
39
40
|
};
|
|
40
41
|
}
|
|
41
42
|
export async function processView(process) {
|
|
42
|
-
const [server, client] = await Promise.all([
|
|
43
|
+
const [server, client, serverService, clientService] = await Promise.all([
|
|
44
|
+
process.server.exists(),
|
|
45
|
+
process.client.exists(),
|
|
46
|
+
process.server.isService(),
|
|
47
|
+
process.client.isService()
|
|
48
|
+
]);
|
|
43
49
|
return {
|
|
44
50
|
identity: process.identity,
|
|
45
51
|
name: process.name,
|
|
46
52
|
program: process.program().identity,
|
|
47
53
|
startedAt: process.startedAt.toISOString(),
|
|
48
|
-
server: { declared: process.program().server !== null, running: server },
|
|
49
|
-
client: { declared: process.program().client !== null, running: client }
|
|
54
|
+
server: { declared: process.program().server !== null, running: server, service: serverService },
|
|
55
|
+
client: { declared: process.program().client !== null, running: client, service: clientService }
|
|
50
56
|
};
|
|
51
57
|
}
|
|
52
58
|
export async function endpointView(process, name) {
|
|
@@ -56,7 +62,8 @@ export async function endpointView(process, name) {
|
|
|
56
62
|
program: program.identity,
|
|
57
63
|
endpoint: name,
|
|
58
64
|
declared: name === "server" ? program.server !== null : program.client !== null,
|
|
59
|
-
running: await endpoint(process, name).exists()
|
|
65
|
+
running: await endpoint(process, name).exists(),
|
|
66
|
+
service: await endpoint(process, name).isService()
|
|
60
67
|
};
|
|
61
68
|
}
|
|
62
69
|
export async function windowView(process) {
|
|
@@ -74,6 +81,7 @@ export async function windowView(process) {
|
|
|
74
81
|
}
|
|
75
82
|
export function output(value, compact) {
|
|
76
83
|
console.log(JSON.stringify(value ?? null, null, compact ? undefined : 2));
|
|
84
|
+
blank();
|
|
77
85
|
}
|
|
78
86
|
export function payload(value) {
|
|
79
87
|
if (value === undefined)
|
|
@@ -118,12 +126,13 @@ export function page(values, search, offset = 0, limit = 30, text) {
|
|
|
118
126
|
}
|
|
119
127
|
export function launch(options, named = false) {
|
|
120
128
|
const client = clientLaunch(options);
|
|
129
|
+
const server = serverLaunch(options);
|
|
121
130
|
const values = entries(options.option);
|
|
122
131
|
const result = {};
|
|
123
132
|
if (options.name !== undefined)
|
|
124
133
|
result.name = options.name;
|
|
125
|
-
if (
|
|
126
|
-
result.server =
|
|
134
|
+
if (server !== undefined)
|
|
135
|
+
result.server = server;
|
|
127
136
|
if (client !== undefined)
|
|
128
137
|
result.client = client;
|
|
129
138
|
if (Object.keys(values).length)
|
|
@@ -133,6 +142,7 @@ export function launch(options, named = false) {
|
|
|
133
142
|
return result;
|
|
134
143
|
}
|
|
135
144
|
export function clientLaunch(options) {
|
|
145
|
+
const service = options.clientService;
|
|
136
146
|
const configured = options.clientTitle !== undefined
|
|
137
147
|
|| options.clientWidth !== undefined
|
|
138
148
|
|| options.clientHeight !== undefined
|
|
@@ -140,7 +150,8 @@ export function clientLaunch(options) {
|
|
|
140
150
|
|| options.clientY !== undefined
|
|
141
151
|
|| options.clientLayer !== undefined
|
|
142
152
|
|| options.clientLocation !== undefined
|
|
143
|
-
|| options.clientMinimized === true
|
|
153
|
+
|| options.clientMinimized === true
|
|
154
|
+
|| service !== undefined;
|
|
144
155
|
if (!configured)
|
|
145
156
|
return options.client;
|
|
146
157
|
if (options.client === false)
|
|
@@ -152,6 +163,7 @@ export function clientLaunch(options) {
|
|
|
152
163
|
throw new Error("--client-x and --client-y must be supplied together");
|
|
153
164
|
}
|
|
154
165
|
return {
|
|
166
|
+
...(service === undefined ? {} : { service }),
|
|
155
167
|
...(options.clientTitle === undefined ? {} : { title: options.clientTitle }),
|
|
156
168
|
...(options.clientWidth === undefined ? {} : { size: size(options.clientWidth, options.clientHeight) }),
|
|
157
169
|
...(options.clientX === undefined ? {} : { position: position(options.clientX, options.clientY) }),
|
|
@@ -160,6 +172,14 @@ export function clientLaunch(options) {
|
|
|
160
172
|
...(options.clientMinimized === true ? { minimize: true } : {})
|
|
161
173
|
};
|
|
162
174
|
}
|
|
175
|
+
export function serverLaunch(options) {
|
|
176
|
+
const service = options.serverService;
|
|
177
|
+
if (service === undefined)
|
|
178
|
+
return options.server;
|
|
179
|
+
if (options.server === false)
|
|
180
|
+
throw new Error("Server overrides cannot be combined with --no-server");
|
|
181
|
+
return { service };
|
|
182
|
+
}
|
|
163
183
|
export function collect(value, previous = []) {
|
|
164
184
|
return [...previous, value];
|
|
165
185
|
}
|
package/dist/create.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { installProjectDependencies, projectPackageManager, projectScript } from "./project-dependency.js";
|
|
2
2
|
import prompts from "./prompts.js";
|
|
3
|
-
import { accent, bold } from "./style.js";
|
|
3
|
+
import { accent, blank, bold } from "./style.js";
|
|
4
4
|
import { cpSync, existsSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, renameSync, rmSync, writeFileSync } from "node:fs";
|
|
5
5
|
import { basename, dirname, extname, relative, resolve } from "node:path";
|
|
6
6
|
/** Creates a complete Program from the bundled Phresh Program snapshot. */
|
|
@@ -60,7 +60,7 @@ export default async function create(options = {}, directory = process.cwd()) {
|
|
|
60
60
|
console.log(bold(`\n${bundled.development ? "Run Development Program" : "Run Program"}`));
|
|
61
61
|
console.log(accent(script));
|
|
62
62
|
console.log(bold("\nYou can now open the project and start building your Program"));
|
|
63
|
-
|
|
63
|
+
blank();
|
|
64
64
|
}
|
|
65
65
|
function template() {
|
|
66
66
|
const candidates = [
|
package/dist/describe-command.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { commandContract, readCommandContract } from "./command-contract.js";
|
|
2
|
+
import { blank } from "./style.js";
|
|
2
3
|
/** Add one machine-readable description entry point for the complete CLI tree. */
|
|
3
4
|
export default function describeCommands(program) {
|
|
4
5
|
commandContract(program.command("describe")
|
|
@@ -9,6 +10,7 @@ export default function describeCommands(program) {
|
|
|
9
10
|
const command = resolveCommand(program, path);
|
|
10
11
|
const description = describe(command, path);
|
|
11
12
|
console.log(JSON.stringify(description, null, options.compact ? undefined : 2));
|
|
13
|
+
blank();
|
|
12
14
|
}), { guidance: ["Omit the path to discover all top-level commands, then describe progressively deeper paths."] });
|
|
13
15
|
}
|
|
14
16
|
function resolveCommand(root, path) {
|
package/dist/install.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Project } from "@phreshos/node";
|
|
2
|
-
import { dim, heading, line } from "./style.js";
|
|
2
|
+
import { blank, dim, heading, line } from "./style.js";
|
|
3
3
|
import installProgram, {} from "./program-installation.js";
|
|
4
4
|
import { prepareOfficialProgram } from "./program-release.js";
|
|
5
5
|
/**
|
|
@@ -15,10 +15,10 @@ import { prepareOfficialProgram } from "./program-release.js";
|
|
|
15
15
|
* production Program is derived and sent. The command remains authoring
|
|
16
16
|
* metadata and never becomes part of the installed Program.
|
|
17
17
|
*
|
|
18
|
-
* Installation remains distinct from execution unless `run`
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
18
|
+
* Installation remains distinct from execution unless `run` is explicitly
|
|
19
|
+
* requested. A run created here belongs to the installed Program and
|
|
20
|
+
* therefore outlives this command; `phresh start` and `phresh dev` remain
|
|
21
|
+
* attached authoring runs whose lifetime is the terminal's.
|
|
22
22
|
*/
|
|
23
23
|
export default async function install(options = {}) {
|
|
24
24
|
const directory = options.directory ?? process.cwd();
|
|
@@ -32,11 +32,11 @@ export default async function install(options = {}) {
|
|
|
32
32
|
const { name, identity, version } = result.program;
|
|
33
33
|
heading(`${name || identity}${version ? ` ${version}` : ""}`, result.replaced ? "reinstalled" : "installed");
|
|
34
34
|
if (result.replaced)
|
|
35
|
-
console.log(` ${dim("its storage was kept, and its previous processes were ended")}
|
|
36
|
-
if (result.startupEnabled)
|
|
37
|
-
line("startup", "enabled");
|
|
35
|
+
console.log(` ${dim("its storage was kept, and its previous processes were ended")}`);
|
|
38
36
|
if (result.process)
|
|
39
37
|
line("process", result.process);
|
|
38
|
+
if (result.replaced || result.process)
|
|
39
|
+
blank();
|
|
40
40
|
}
|
|
41
41
|
return result;
|
|
42
42
|
}
|
package/dist/launch.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Project } from "@phreshos/node";
|
|
2
2
|
import { relative } from "node:path";
|
|
3
3
|
import { assertAvailable, commandFailure, DevelopmentClient, waitForDevelopmentClient } from "./development-client.js";
|
|
4
|
-
import { dim, heading, line } from "./style.js";
|
|
4
|
+
import { blank, dim, heading, line } from "./style.js";
|
|
5
5
|
/** Run the current project through one connected System. */
|
|
6
6
|
export default async function launch(mode, directory = process.cwd(), options = {}) {
|
|
7
7
|
const project = await Project.open(directory);
|
|
@@ -16,7 +16,7 @@ export default async function launch(mode, directory = process.cwd(), options =
|
|
|
16
16
|
line("storage", place(project.directory, String(definition.storage)));
|
|
17
17
|
if (Object.keys(options).length)
|
|
18
18
|
line("options", Object.entries(options).map(([name, value]) => `${name}=${value}`).join(" "));
|
|
19
|
-
|
|
19
|
+
blank();
|
|
20
20
|
const system = await (await import("@phreshos/node")).System.connect();
|
|
21
21
|
const controller = new AbortController();
|
|
22
22
|
const development = mode === "development" && definition.client && (definition.client.start ?? true)
|
|
@@ -70,7 +70,9 @@ export default async function launch(mode, directory = process.cwd(), options =
|
|
|
70
70
|
process.exit(130);
|
|
71
71
|
if (!ended)
|
|
72
72
|
throw new Error("The System closed before the Program ended");
|
|
73
|
-
|
|
73
|
+
blank();
|
|
74
|
+
console.log(` ${dim(ended.signal ? `ended on ${ended.signal}` : `ended with ${ended.code ?? 0}`)}`);
|
|
75
|
+
blank();
|
|
74
76
|
process.exit(ended.signal ? 128 : ended.code ?? 0);
|
|
75
77
|
}
|
|
76
78
|
async function consume(lifecycle, client) {
|
package/dist/pack.js
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { Project } from "@phreshos/node";
|
|
2
|
-
import { line } from "./style.js";
|
|
2
|
+
import { blank, line } from "./style.js";
|
|
3
3
|
/** Package the current Project and present only its command-facing progress. */
|
|
4
4
|
export default async function pack(directory = process.cwd()) {
|
|
5
5
|
const project = await Project.open(directory);
|
|
6
6
|
if (project.config.buildCommand)
|
|
7
7
|
line("build", project.config.buildCommand);
|
|
8
8
|
const packed = await project.pack();
|
|
9
|
-
|
|
9
|
+
if (project.config.buildCommand)
|
|
10
|
+
blank();
|
|
11
|
+
console.log(`Packed ${packed.archive}`);
|
|
12
|
+
blank();
|
|
10
13
|
return packed.archive;
|
|
11
14
|
}
|
|
@@ -7,7 +7,6 @@ export default async function installProgram(program, options = {}) {
|
|
|
7
7
|
const current = await system.program.find(identity);
|
|
8
8
|
const replaced = await current?.installed() ?? false;
|
|
9
9
|
let installed = null;
|
|
10
|
-
let startupEnabled = false;
|
|
11
10
|
let process = null;
|
|
12
11
|
let installationFinished = false;
|
|
13
12
|
try {
|
|
@@ -20,10 +19,6 @@ export default async function installProgram(program, options = {}) {
|
|
|
20
19
|
for await (const chunk of installed.install())
|
|
21
20
|
writeProgramCommandOutput(chunk);
|
|
22
21
|
installationFinished = true;
|
|
23
|
-
if (options.startup) {
|
|
24
|
-
await installed.startup.enable();
|
|
25
|
-
startupEnabled = true;
|
|
26
|
-
}
|
|
27
22
|
if (options.run)
|
|
28
23
|
process = (await installed.process.create()).identity;
|
|
29
24
|
}
|
|
@@ -41,14 +36,11 @@ export default async function installProgram(program, options = {}) {
|
|
|
41
36
|
}
|
|
42
37
|
if (!installed)
|
|
43
38
|
throw new Error("The System ended Program installation without confirming it");
|
|
44
|
-
if (options.startup && !startupEnabled)
|
|
45
|
-
throw new Error("The System installed the Program without confirming startup");
|
|
46
39
|
if (options.run && !process)
|
|
47
40
|
throw new Error("The System installed the Program without confirming that it is running");
|
|
48
41
|
return {
|
|
49
42
|
program: { identity: installed.identity, name: installed.name, version: installed.version },
|
|
50
43
|
replaced,
|
|
51
|
-
startupEnabled,
|
|
52
44
|
process
|
|
53
45
|
};
|
|
54
46
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { line } from "./style.js";
|
|
1
|
+
import { blank, line } from "./style.js";
|
|
2
2
|
import { spawn } from "node:child_process";
|
|
3
3
|
import { existsSync, readFileSync } from "node:fs";
|
|
4
4
|
import { resolve } from "node:path";
|
|
@@ -33,7 +33,7 @@ export default async function ensureProjectDependency(name, range, directory = p
|
|
|
33
33
|
const manager = projectPackageManager(directory, manifest.packageManager);
|
|
34
34
|
line("dependency", name, `${manager.name}, ${range}`);
|
|
35
35
|
await run(manager.name, [...manager.addArgs(section), `${name}@${range}`], directory);
|
|
36
|
-
|
|
36
|
+
blank();
|
|
37
37
|
}
|
|
38
38
|
function run(command, args, directory, output = "inherit") {
|
|
39
39
|
return new Promise(function (settle, refuse) {
|
package/dist/prompts.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { cancel, confirm, intro, isCancel, log, outro, select, spinner, text } from "@clack/prompts";
|
|
2
2
|
import colors from "picocolors";
|
|
3
|
-
import { caution, column, ending, line, section } from "./style.js";
|
|
3
|
+
import { blank, caution, column, ending, line, section } from "./style.js";
|
|
4
4
|
/** Signals an ordinary interactive cancellation rather than an operation failure. */
|
|
5
5
|
export class PromptCancelled extends Error {
|
|
6
6
|
}
|
|
@@ -36,8 +36,10 @@ export default function prompts() {
|
|
|
36
36
|
function message(value = "") {
|
|
37
37
|
if (interactive)
|
|
38
38
|
log.message(value, { spacing: 0 });
|
|
39
|
+
else if (value)
|
|
40
|
+
console.log(` ${value}`);
|
|
39
41
|
else
|
|
40
|
-
|
|
42
|
+
blank();
|
|
41
43
|
}
|
|
42
44
|
function warning(value) {
|
|
43
45
|
if (interactive)
|
package/dist/style.js
CHANGED
|
@@ -6,6 +6,10 @@ export const accent = colors.cyan;
|
|
|
6
6
|
export const positive = colors.green;
|
|
7
7
|
export const caution = colors.yellow;
|
|
8
8
|
export const negative = colors.red;
|
|
9
|
+
/** Writes one intentional blank line between terminal report blocks. */
|
|
10
|
+
export function blank() {
|
|
11
|
+
console.log("");
|
|
12
|
+
}
|
|
9
13
|
// A label, what it says, and where that came from. The label is quiet
|
|
10
14
|
// and the value is not, because the value is the thing being reported.
|
|
11
15
|
//
|
|
@@ -20,12 +24,17 @@ export function column(label) {
|
|
|
20
24
|
}
|
|
21
25
|
export function heading(title, note) {
|
|
22
26
|
section(title, note);
|
|
23
|
-
|
|
27
|
+
blank();
|
|
24
28
|
}
|
|
25
29
|
export function section(title, note) {
|
|
26
30
|
console.log(` ${bold(title)}${note ? ` ${dim("·")} ${dim(note)}` : ""}`);
|
|
27
31
|
}
|
|
28
32
|
export function ending(message) {
|
|
29
33
|
console.log(` ${bold(message)}`);
|
|
30
|
-
|
|
34
|
+
blank();
|
|
35
|
+
}
|
|
36
|
+
/** Writes one consistently indented command failure followed by closing space. */
|
|
37
|
+
export function failure(message) {
|
|
38
|
+
console.error(` phresh: ${message}`);
|
|
39
|
+
console.error("");
|
|
31
40
|
}
|
package/dist/system/lifecycle.js
CHANGED
|
@@ -201,7 +201,7 @@ export default class SystemLifecycle {
|
|
|
201
201
|
}
|
|
202
202
|
}
|
|
203
203
|
async function provisionSetup() {
|
|
204
|
-
await installProgram({ name: "setup", run: true,
|
|
204
|
+
await installProgram({ name: "setup", run: true, announce: false });
|
|
205
205
|
}
|
|
206
206
|
function definition(installation, executable) {
|
|
207
207
|
return {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "phresh",
|
|
3
3
|
"private": true,
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.24",
|
|
5
5
|
"description": "The official PhreshOS starter Program.",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"scripts": {
|
|
@@ -14,15 +14,15 @@
|
|
|
14
14
|
"starter"
|
|
15
15
|
],
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@phreshos/client": "^0.1.
|
|
18
|
-
"@phreshos/core": "^0.1.
|
|
19
|
-
"@phreshos/react": "^0.1.
|
|
20
|
-
"@phreshos/server": "^0.1.
|
|
17
|
+
"@phreshos/client": "^0.1.27",
|
|
18
|
+
"@phreshos/core": "^0.1.28",
|
|
19
|
+
"@phreshos/react": "^0.1.15",
|
|
20
|
+
"@phreshos/server": "^0.1.28",
|
|
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.42",
|
|
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.24",
|
|
8
8
|
icon: "icon.png",
|
|
9
9
|
categories: ["Development"],
|
|
10
10
|
keywords: ["example", "counter", "client", "server"],
|
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.24",
|
|
4
|
+
"sha256": "eefb7d148a8d78669a2cd7572c095bc34965e8a7d787c1e1c7945b7fa8224be6",
|
|
5
5
|
"development": true
|
|
6
6
|
}
|
package/dist/uninstall.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { readConfig } from "./project.js";
|
|
2
|
-
import { dim, heading } from "./style.js";
|
|
2
|
+
import { blank, dim, heading } from "./style.js";
|
|
3
3
|
import writeProgramCommandOutput from "./program-command-output.js";
|
|
4
4
|
/** Uninstall an installed Program by name or by the current project's identity. */
|
|
5
5
|
export default async function uninstall(options = {}) {
|
|
@@ -15,8 +15,9 @@ export default async function uninstall(options = {}) {
|
|
|
15
15
|
writeProgramCommandOutput(chunk);
|
|
16
16
|
heading(identity, "uninstalled");
|
|
17
17
|
console.log(options.everything
|
|
18
|
-
? ` ${dim("Its processes, installed files, stored data, and runtime record were removed.")}
|
|
19
|
-
: ` ${dim("Its installed files were removed. Processes, stored data, and runtime state were kept.")}
|
|
18
|
+
? ` ${dim("Its processes, installed files, stored data, and runtime record were removed.")}`
|
|
19
|
+
: ` ${dim("Its installed files were removed. Processes, stored data, and runtime state were kept.")}`);
|
|
20
|
+
blank();
|
|
20
21
|
}
|
|
21
22
|
finally {
|
|
22
23
|
await system.disconnect();
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@phreshos/cli",
|
|
3
3
|
"type": "module",
|
|
4
|
-
|
|
4
|
+
"version": "0.1.42",
|
|
5
5
|
"description": "The Phresh command-line interface for Program projects and system management.",
|
|
6
6
|
"engines": {
|
|
7
7
|
"node": ">=20.10"
|
|
@@ -49,8 +49,8 @@
|
|
|
49
49
|
"packageManager": "bun@1.3.14",
|
|
50
50
|
"dependencies": {
|
|
51
51
|
"@clack/prompts": "^1.7.0",
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
"@phreshos/core": "^0.1.29",
|
|
53
|
+
"@phreshos/node": "^0.1.7",
|
|
54
54
|
"adm-zip": "^0.6.0",
|
|
55
55
|
"commander": "^15.0.0",
|
|
56
56
|
"picocolors": "^1.1.1"
|