@ystemsrx/cfshare 0.1.4 → 0.1.5
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 +336 -336
- package/README.zh.md +336 -336
- package/dist/src/cli.js +6 -6
- package/package.json +1 -1
- package/src/cli.ts +6 -6
package/dist/src/cli.js
CHANGED
|
@@ -58,8 +58,8 @@ function printHelp() {
|
|
|
58
58
|
" --config <json> Runtime config JSON (same as plugin config)",
|
|
59
59
|
" --config-file <path> Read runtime config from JSON file",
|
|
60
60
|
" --workspace-dir <dir> Workspace dir for expose_files context",
|
|
61
|
-
" --keep-alive Keep process running after expose_*",
|
|
62
|
-
" --no-keep-alive Exit
|
|
61
|
+
" --keep-alive Keep process running after expose_* (foreground)",
|
|
62
|
+
" --no-keep-alive Exit after printing expose_* result (default)",
|
|
63
63
|
" --compact Compact JSON output",
|
|
64
64
|
" -h, --help Show help",
|
|
65
65
|
" -v, --version Show version",
|
|
@@ -212,11 +212,11 @@ function createRuntimeApi(config) {
|
|
|
212
212
|
pluginConfig: runtimeConfig,
|
|
213
213
|
};
|
|
214
214
|
}
|
|
215
|
-
function shouldKeepAlive(
|
|
215
|
+
function shouldKeepAlive(keepAliveFlag) {
|
|
216
216
|
if (typeof keepAliveFlag === "boolean") {
|
|
217
217
|
return keepAliveFlag;
|
|
218
218
|
}
|
|
219
|
-
return
|
|
219
|
+
return false;
|
|
220
220
|
}
|
|
221
221
|
async function waitUntilExposureStops(manager, id) {
|
|
222
222
|
await new Promise((resolve, reject) => {
|
|
@@ -357,12 +357,12 @@ async function main() {
|
|
|
357
357
|
const manager = new CfshareManager(createRuntimeApi(config));
|
|
358
358
|
const result = await runTool(manager, command, params, options);
|
|
359
359
|
process.stdout.write(`${JSON.stringify(result, null, options.compact ? undefined : 2)}\n`);
|
|
360
|
-
if (shouldKeepAlive(
|
|
360
|
+
if (shouldKeepAlive(options.keepAlive)) {
|
|
361
361
|
const exposureId = typeof result === "object" && result ? result.id : undefined;
|
|
362
362
|
if (typeof exposureId !== "string" || !exposureId) {
|
|
363
363
|
return;
|
|
364
364
|
}
|
|
365
|
-
process.stderr.write(`cfshare: exposure ${exposureId} is running. Press Ctrl+C to stop
|
|
365
|
+
process.stderr.write(`cfshare: exposure ${exposureId} is running. Press Ctrl+C to stop.\n`);
|
|
366
366
|
await waitUntilExposureStops(manager, exposureId);
|
|
367
367
|
}
|
|
368
368
|
}
|
package/package.json
CHANGED
package/src/cli.ts
CHANGED
|
@@ -79,8 +79,8 @@ function printHelp() {
|
|
|
79
79
|
" --config <json> Runtime config JSON (same as plugin config)",
|
|
80
80
|
" --config-file <path> Read runtime config from JSON file",
|
|
81
81
|
" --workspace-dir <dir> Workspace dir for expose_files context",
|
|
82
|
-
" --keep-alive Keep process running after expose_*",
|
|
83
|
-
" --no-keep-alive Exit
|
|
82
|
+
" --keep-alive Keep process running after expose_* (foreground)",
|
|
83
|
+
" --no-keep-alive Exit after printing expose_* result (default)",
|
|
84
84
|
" --compact Compact JSON output",
|
|
85
85
|
" -h, --help Show help",
|
|
86
86
|
" -v, --version Show version",
|
|
@@ -245,11 +245,11 @@ function createRuntimeApi(config: CfsharePluginConfig): CfshareRuntimeApi {
|
|
|
245
245
|
};
|
|
246
246
|
}
|
|
247
247
|
|
|
248
|
-
function shouldKeepAlive(
|
|
248
|
+
function shouldKeepAlive(keepAliveFlag: boolean | undefined): boolean {
|
|
249
249
|
if (typeof keepAliveFlag === "boolean") {
|
|
250
250
|
return keepAliveFlag;
|
|
251
251
|
}
|
|
252
|
-
return
|
|
252
|
+
return false;
|
|
253
253
|
}
|
|
254
254
|
|
|
255
255
|
async function waitUntilExposureStops(manager: CfshareManager, id: string): Promise<void> {
|
|
@@ -472,13 +472,13 @@ async function main() {
|
|
|
472
472
|
const result = await runTool(manager, command, params, options);
|
|
473
473
|
process.stdout.write(`${JSON.stringify(result, null, options.compact ? undefined : 2)}\n`);
|
|
474
474
|
|
|
475
|
-
if (shouldKeepAlive(
|
|
475
|
+
if (shouldKeepAlive(options.keepAlive)) {
|
|
476
476
|
const exposureId = typeof result === "object" && result ? (result as { id?: unknown }).id : undefined;
|
|
477
477
|
if (typeof exposureId !== "string" || !exposureId) {
|
|
478
478
|
return;
|
|
479
479
|
}
|
|
480
480
|
process.stderr.write(
|
|
481
|
-
`cfshare: exposure ${exposureId} is running. Press Ctrl+C to stop
|
|
481
|
+
`cfshare: exposure ${exposureId} is running. Press Ctrl+C to stop.\n`,
|
|
482
482
|
);
|
|
483
483
|
await waitUntilExposureStops(manager, exposureId);
|
|
484
484
|
}
|