pvgttm-web/app.js

31 lines
797 B
JavaScript
Raw Normal View History

2023-02-20 16:46:46 +00:00
#!/usr/bin/env node
"use strict";
require("dotenv").config();
const path = require("path"),
build = require("./lib/build"),
serve = require("./lib/serve"),
watch = require("./lib/watch"),
{ log, readJsonIfExists } = require("./lib/utils"),
{ version } = require("./package.json"),
localConfig =
readJsonIfExists(path.resolve(process.cwd(), "site.config.json5")) ||
{},
siteOpts = require("./lib/loadConfig")(localConfig, "MULE"),
config = {
...siteOpts,
logFunction: log,
},
yargs = require("yargs")
.version(version)
.alias("v", "version")
.usage("Usage: $0 start|stop")
.demandCommand(1),
{ argv } = yargs;
if (argv._[0] === "build") return build(config);
else if (argv._[0] === "serve") return serve(config);
else if (argv._[0] === "watch") return watch(config);