@phero/dev
Advanced tools
Comparing version 0.9.9 to 0.9.12
@@ -25,4 +25,10 @@ export declare const DEFAULT_SERVER_PORT = 3030; | ||
name: ServerCommandName.Export; | ||
flavor: ServerExportFlavor; | ||
verbose: boolean; | ||
} | ||
export declare enum ServerExportFlavor { | ||
NodeJS = "nodejs", | ||
GCloudFunctions = "gcloud-functions", | ||
Vercel = "vercel" | ||
} | ||
export interface ServerCommandBuild { | ||
@@ -29,0 +35,0 @@ name: ServerCommandName.Build; |
@@ -6,3 +6,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.parsePheroCommand = exports.parseClientCommand = exports.parseServerCommand = exports.PheroCommandName = exports.ClientCommandName = exports.ServerCommandName = exports.DEFAULT_CLIENT_PORT = exports.DEFAULT_SERVER_URL = exports.DEFAULT_SERVER_PORT = void 0; | ||
exports.parsePheroCommand = exports.parseClientCommand = exports.parseServerCommand = exports.PheroCommandName = exports.ClientCommandName = exports.ServerExportFlavor = exports.ServerCommandName = exports.DEFAULT_CLIENT_PORT = exports.DEFAULT_SERVER_URL = exports.DEFAULT_SERVER_PORT = void 0; | ||
const arg_1 = __importDefault(require("arg")); | ||
@@ -21,2 +21,8 @@ exports.DEFAULT_SERVER_PORT = 3030; | ||
})(ServerCommandName = exports.ServerCommandName || (exports.ServerCommandName = {})); | ||
var ServerExportFlavor; | ||
(function (ServerExportFlavor) { | ||
ServerExportFlavor["NodeJS"] = "nodejs"; | ||
ServerExportFlavor["GCloudFunctions"] = "gcloud-functions"; | ||
ServerExportFlavor["Vercel"] = "vercel"; | ||
})(ServerExportFlavor = exports.ServerExportFlavor || (exports.ServerExportFlavor = {})); | ||
// Client | ||
@@ -47,2 +53,3 @@ var ClientCommandName; | ||
"--port": Number, | ||
"--flavor": String, | ||
"-v": "--version", | ||
@@ -65,7 +72,8 @@ "-h": "--help", | ||
case ServerCommandName.Export: | ||
return { name, verbose }; | ||
const flavor = parseServerExportFlavor(args["--flavor"]); | ||
return { name, flavor, verbose }; | ||
case ServerCommandName.Build: | ||
return { name, verbose }; | ||
default: | ||
throw new Error(`unknown server command: ${name}`); | ||
throw new Error(`Unknown server command: ${name}`); | ||
} | ||
@@ -162,1 +170,17 @@ } | ||
exports.parsePheroCommand = parsePheroCommand; | ||
function parseServerExportFlavor(flavor) { | ||
switch (flavor) { | ||
case ServerExportFlavor.NodeJS: | ||
return ServerExportFlavor.NodeJS; | ||
case ServerExportFlavor.GCloudFunctions: | ||
return ServerExportFlavor.GCloudFunctions; | ||
case ServerExportFlavor.Vercel: | ||
return ServerExportFlavor.Vercel; | ||
default: | ||
throw new Error(`Required flavor parameter, must be one of: ${[ | ||
ServerExportFlavor.NodeJS, | ||
ServerExportFlavor.GCloudFunctions, | ||
ServerExportFlavor.Vercel, | ||
].join(", ")}`); | ||
} | ||
} |
@@ -91,2 +91,3 @@ "use strict"; | ||
--verbose Output debug information | ||
--flavor Provide the export flavor, must be either "nodejs", "gcloud-functions" or "vercel" | ||
`; | ||
@@ -93,0 +94,0 @@ exports.serverHelpBuild = (0, chalk_1.default) ` |
{ | ||
"name": "@phero/dev", | ||
"version": "0.9.9", | ||
"version": "0.9.12", | ||
"main": "dist/index.js", | ||
@@ -40,3 +40,3 @@ "homepage": "https://phero.dev", | ||
}, | ||
"gitHead": "34cc72f3777c55c1463a3ee945f07289a2e68a86" | ||
"gitHead": "0d0351d6f2746e96688852991e09ffa9822ca852" | ||
} |
@@ -34,5 +34,12 @@ import arg from "arg" | ||
name: ServerCommandName.Export | ||
flavor: ServerExportFlavor | ||
verbose: boolean | ||
} | ||
export enum ServerExportFlavor { | ||
NodeJS = "nodejs", | ||
GCloudFunctions = "gcloud-functions", | ||
Vercel = "vercel", | ||
} | ||
export interface ServerCommandBuild { | ||
@@ -154,2 +161,3 @@ name: ServerCommandName.Build | ||
"--port": Number, | ||
"--flavor": String, | ||
"-v": "--version", | ||
@@ -179,3 +187,4 @@ "-h": "--help", | ||
case ServerCommandName.Export: | ||
return { name, verbose } | ||
const flavor = parseServerExportFlavor(args["--flavor"]) | ||
return { name, flavor, verbose } | ||
@@ -186,3 +195,3 @@ case ServerCommandName.Build: | ||
default: | ||
throw new Error(`unknown server command: ${name}`) | ||
throw new Error(`Unknown server command: ${name}`) | ||
} | ||
@@ -289,1 +298,22 @@ } | ||
} | ||
function parseServerExportFlavor( | ||
flavor: string | undefined, | ||
): ServerExportFlavor { | ||
switch (flavor) { | ||
case ServerExportFlavor.NodeJS: | ||
return ServerExportFlavor.NodeJS | ||
case ServerExportFlavor.GCloudFunctions: | ||
return ServerExportFlavor.GCloudFunctions | ||
case ServerExportFlavor.Vercel: | ||
return ServerExportFlavor.Vercel | ||
default: | ||
throw new Error( | ||
`Required flavor parameter, must be one of: ${[ | ||
ServerExportFlavor.NodeJS, | ||
ServerExportFlavor.GCloudFunctions, | ||
ServerExportFlavor.Vercel, | ||
].join(", ")}`, | ||
) | ||
} | ||
} |
@@ -90,2 +90,3 @@ import chalk from "chalk" | ||
--verbose Output debug information | ||
--flavor Provide the export flavor, must be either "nodejs", "gcloud-functions" or "vercel" | ||
` | ||
@@ -92,0 +93,0 @@ |
@@ -1,2 +0,2 @@ | ||
import http, { Server } from "http" | ||
import http from "http" | ||
import EventSource from "eventsource" | ||
@@ -3,0 +3,0 @@ |
75651
1622