UNPKG

publichost

Version:

Make your localhost public. Tunnel HTTP and WebSocket traffic to your local machine from any domain name.

47 lines (44 loc) 1.76 kB
#!/bin/env node import { DEFAULT_CLIENT_PORT, DEFAULT_START_OPTIONS, configManager, startFromConfig } from "./chunk-7NWSCVNS.js"; // src/cli.ts import { program } from "commander"; // src/commands/init.ts import { B } from "bhala"; function init(publicHostServerHost, subdomain, apiKey, { isHttps, port: localhostAppPort, workspacePath }) { const controlledStartOptions = { ...{ isHttps, localhostAppPort }, ...DEFAULT_START_OPTIONS }; configManager.setWorkspaceConfig({ apiKey, options: controlledStartOptions, publicHostServerHost, subdomain, workspacePath }); B.success("[PublicHost Client]", `[${subdomain}]`, `Subdomain linked to workspace ${workspacePath}.`); } // src/cli.ts program.name("ph").description("PublicHost CLI.").version("0.0.0"); program.command("init").description( [ "Create, link and save a new subdomain for the current workspace.", "", `Workspace configurations are saved to \`${configManager.configPath}\`.` ].join("\n") ).argument("<host>", 'PublicHost Server host (ex: "example.org" or "publichost.example.org").').argument("<subdomain>", 'Subdomain to link to the current workspace (ex: "my-app").').argument("<api_key>", "Your PublicHost Server API key.").option("-p, --port <port>", "Your localhost application port", DEFAULT_CLIENT_PORT).option( "-w, --workspace-path <workspace_path>", "Absolute path to the workspace to link the subdomain to", process.cwd() ).option("--is-https", "Use HTTPS instead of HTTP when connecting to your localhost application", false).action(init); program.command("start").description("Start listening for incoming requests.").action(startFromConfig); program.parse(process.argv); //# sourceMappingURL=cli.js.map