Initial commit
This commit is contained in:
30
app.js
Normal file
30
app.js
Normal file
@@ -0,0 +1,30 @@
|
||||
#!/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);
|
||||
Reference in New Issue
Block a user