prettier-plugin-apex
Version:
Salesforce Apex plugin for Prettier
32 lines (31 loc) • 1.01 kB
JavaScript
import { parseArgs } from "util";
import { start } from "../src/http-server.js";
async function setup(host, port, password, allowedOrigins) {
await start(host, Number.parseInt(port, 10), password, allowedOrigins);
}
const options = {
host: {
short: "h",
default: "localhost",
type: "string",
},
port: {
short: "p",
default: "2117",
type: "string",
},
"cors-allowed-origins": {
describe: "Comma-delimited list of allowed origins to be added to CORS headers",
short: "c",
type: "string",
},
password: {
short: "s",
default: "secret",
type: "string",
describe: "Password that can be used to remotely shutdown the server",
},
};
const parsed = parseArgs({ options });
setup(parsed.values.host ?? options.host.default, parsed.values.port ?? options.port.default, parsed.values.password ?? options.password.default, parsed.values["cors-allowed-origins"]);