@launchfile/macos-dev 0.13.0 → 0.14.0
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/provider.d.ts +3 -1
- package/dist/provider.js +7 -5
- package/dist/shell.js +15 -23
- package/package.json +5 -4
package/dist/provider.d.ts
CHANGED
|
@@ -246,9 +246,11 @@ export type PrintedPublication = Pick<LaunchState, "appUrl" | "primaryEndpoint">
|
|
|
246
246
|
export declare function componentAddress(key: string, port: number, publication?: PrintedPublication): string;
|
|
247
247
|
/**
|
|
248
248
|
* The "<component> is running at …" lines `up` prints, one per `ports` key.
|
|
249
|
+
* `verb` is the phrase between the label and the address; a dry run passes
|
|
250
|
+
* "would be reachable at" because nothing has started.
|
|
249
251
|
* Pure, so the placement of the supplied URL is testable without a launch.
|
|
250
252
|
*/
|
|
251
|
-
export declare function summaryLines(appName: string, ports: Record<string, number>, publication?: PrintedPublication): string[];
|
|
253
|
+
export declare function summaryLines(appName: string, ports: Record<string, number>, publication?: PrintedPublication, verb?: string): string[];
|
|
252
254
|
/** The "Components:" lines `status` prints, one per `ports` key. */
|
|
253
255
|
export declare function statusLines(ports: Record<string, number>, publication?: PrintedPublication): string[];
|
|
254
256
|
export declare function launchDown(opts?: {
|
package/dist/provider.js
CHANGED
|
@@ -898,7 +898,7 @@ export async function launchUp(opts = {}) {
|
|
|
898
898
|
await saveState(projectDir, state);
|
|
899
899
|
if (opts.dryRun) {
|
|
900
900
|
console.log("\n[dry-run] Would now run build, release, and start commands.");
|
|
901
|
-
printSummary(launch.name, componentPorts, state);
|
|
901
|
+
printSummary(launch.name, componentPorts, state, "would be reachable at");
|
|
902
902
|
return;
|
|
903
903
|
}
|
|
904
904
|
// 14. Run source-mode prepare \u2014 `install ?? build` (D-38), on demand.
|
|
@@ -1010,21 +1010,23 @@ export function componentAddress(key, port, publication) {
|
|
|
1010
1010
|
}
|
|
1011
1011
|
/**
|
|
1012
1012
|
* The "<component> is running at …" lines `up` prints, one per `ports` key.
|
|
1013
|
+
* `verb` is the phrase between the label and the address; a dry run passes
|
|
1014
|
+
* "would be reachable at" because nothing has started.
|
|
1013
1015
|
* Pure, so the placement of the supplied URL is testable without a launch.
|
|
1014
1016
|
*/
|
|
1015
|
-
export function summaryLines(appName, ports, publication) {
|
|
1017
|
+
export function summaryLines(appName, ports, publication, verb = "is running at") {
|
|
1016
1018
|
return Object.entries(ports).map(([name, port]) => {
|
|
1017
1019
|
const label = name === "default" ? appName : name;
|
|
1018
|
-
return ` ${label}
|
|
1020
|
+
return ` ${label} ${verb} ${componentAddress(name, port, publication)}`;
|
|
1019
1021
|
});
|
|
1020
1022
|
}
|
|
1021
1023
|
/** The "Components:" lines `status` prints, one per `ports` key. */
|
|
1022
1024
|
export function statusLines(ports, publication) {
|
|
1023
1025
|
return Object.entries(ports).map(([name, port]) => ` ${name}: ${componentAddress(name, port, publication)}`);
|
|
1024
1026
|
}
|
|
1025
|
-
function printSummary(appName, ports, publication) {
|
|
1027
|
+
function printSummary(appName, ports, publication, verb) {
|
|
1026
1028
|
console.log("");
|
|
1027
|
-
for (const line of summaryLines(appName, ports, publication)) {
|
|
1029
|
+
for (const line of summaryLines(appName, ports, publication, verb)) {
|
|
1028
1030
|
console.log(line);
|
|
1029
1031
|
}
|
|
1030
1032
|
console.log("\n Press Ctrl+C to stop all processes.");
|
package/dist/shell.js
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* own app (`commands:`, `health:`, `release:`), where shell syntax is the
|
|
13
13
|
* documented contract. Never build one of these by interpolation.
|
|
14
14
|
*/
|
|
15
|
-
import {
|
|
15
|
+
import { execFile as cpExecFile, } from "node:child_process";
|
|
16
16
|
import { redactSecrets } from "./redact.js";
|
|
17
17
|
const DEFAULT_TIMEOUT_MS = 120_000;
|
|
18
18
|
const MAX_BUFFER = 10 * 1024 * 1024;
|
|
@@ -35,11 +35,10 @@ function failure(display, result) {
|
|
|
35
35
|
return Object.assign(new Error(`Command failed: ${redactSecrets(display)}\n${redactSecrets(result.stderr)}`), { result });
|
|
36
36
|
}
|
|
37
37
|
/**
|
|
38
|
-
*
|
|
39
|
-
*
|
|
38
|
+
* Spawn `cmd` with `args` via `execFile` and settle with a structured result.
|
|
39
|
+
* `display` is what the user sees echoed and what a failure message names.
|
|
40
40
|
*/
|
|
41
|
-
|
|
42
|
-
const display = [cmd, ...args].join(" ");
|
|
41
|
+
function run(cmd, args, display, opts) {
|
|
43
42
|
if (!opts.silent) {
|
|
44
43
|
// An argument can carry a resolved secret (a generated DB password, a
|
|
45
44
|
// credential-bearing URL). Scrub before echo.
|
|
@@ -61,6 +60,13 @@ export async function shell(cmd, args, opts = {}) {
|
|
|
61
60
|
});
|
|
62
61
|
});
|
|
63
62
|
}
|
|
63
|
+
/**
|
|
64
|
+
* Run a command with an argument array. Arguments reach the OS directly, so
|
|
65
|
+
* they are never parsed as shell syntax.
|
|
66
|
+
*/
|
|
67
|
+
export async function shell(cmd, args, opts = {}) {
|
|
68
|
+
return run(cmd, args, [cmd, ...args].join(" "), opts);
|
|
69
|
+
}
|
|
64
70
|
/** Run a command with an argument array, return true if exit code is 0. */
|
|
65
71
|
export async function shellOk(cmd, args, opts) {
|
|
66
72
|
const result = await shell(cmd, args, {
|
|
@@ -79,23 +85,9 @@ export async function shellOk(cmd, args, opts) {
|
|
|
79
85
|
* verbatim — building one by interpolating a value makes it injectable.
|
|
80
86
|
*/
|
|
81
87
|
export async function shellScript(command, opts = {}) {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
cwd: opts.cwd,
|
|
87
|
-
env: opts.env ? { ...process.env, ...opts.env } : undefined,
|
|
88
|
-
timeout: opts.timeout ?? DEFAULT_TIMEOUT_MS,
|
|
89
|
-
maxBuffer: MAX_BUFFER,
|
|
90
|
-
};
|
|
91
|
-
return new Promise((resolve, reject) => {
|
|
92
|
-
cpExec(command, execOpts, (error, stdout, stderr) => {
|
|
93
|
-
const result = toResult(error, stdout, stderr);
|
|
94
|
-
if (error && !opts.allowFailure)
|
|
95
|
-
reject(failure(command, result));
|
|
96
|
-
else
|
|
97
|
-
resolve(result);
|
|
98
|
-
});
|
|
99
|
-
});
|
|
88
|
+
// The command string is one argv element of an explicit `/bin/sh -c`, the
|
|
89
|
+
// same shape `@launchfile/docker` uses. The shell parses the author's
|
|
90
|
+
// string; nothing this provider adds is ever spliced into it.
|
|
91
|
+
return run("/bin/sh", ["-c", command], command, opts);
|
|
100
92
|
}
|
|
101
93
|
//# sourceMappingURL=shell.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@launchfile/macos-dev",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.0",
|
|
4
4
|
"description": "macOS dev provider for Launchfile — run apps locally via brew services and native runtimes",
|
|
5
5
|
"os": [
|
|
6
6
|
"darwin"
|
|
@@ -36,14 +36,15 @@
|
|
|
36
36
|
"directory": "providers/macos-dev"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@launchfile/sdk": "^0.
|
|
39
|
+
"@launchfile/sdk": "^0.14.0",
|
|
40
40
|
"semver": "^7.7.4"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@biomejs/biome": "^2.5.
|
|
43
|
+
"@biomejs/biome": "^2.5.15",
|
|
44
|
+
"@launchfile/docker": "^0.14.0",
|
|
44
45
|
"@types/bun": "^1.4.2",
|
|
45
46
|
"@types/semver": "^7.7.1",
|
|
46
47
|
"typescript": "^7.0.2",
|
|
47
|
-
"vitest": "^5.0.
|
|
48
|
+
"vitest": "^5.0.3"
|
|
48
49
|
}
|
|
49
50
|
}
|