You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
63 lines
1.5 KiB
JavaScript
63 lines
1.5 KiB
JavaScript
"use strict";
|
|
|
|
const path = require("path");
|
|
const chalk = require("chalk");
|
|
const process = require("process");
|
|
const unhandledError = require("unhandled-error");
|
|
|
|
unhandledError((error) => {
|
|
console.log("");
|
|
console.log(chalk.bold.red("An unexpected error occurred, and Browservis will now exit. Please report this on the bugtracker!"));
|
|
console.log(chalk.gray(error.stack));
|
|
console.log(error); // TODO: Remove this
|
|
|
|
});
|
|
|
|
const yargs = require("yargs");
|
|
const budoExpress = require("budo-express");
|
|
|
|
let argv = yargs
|
|
.demandCommand(2)
|
|
.parse();
|
|
|
|
let [ componentSource, processPath, ... processArguments ] = argv._;
|
|
|
|
let absoluteComponentSource = path.join(process.cwd(), componentSource);
|
|
let absoluteProcessPath = path.join(process.cwd(), processPath);
|
|
|
|
const app = require("../src/server/index.js")({
|
|
componentSource,
|
|
absoluteComponentSource,
|
|
processPath,
|
|
absoluteProcessPath,
|
|
processArguments
|
|
});
|
|
|
|
budoExpress({
|
|
port: 5990,
|
|
developmentMode: true,
|
|
expressApp: app,
|
|
basePath: path.join(__dirname, ".."),
|
|
entryFiles: "src/client/index.jsx",
|
|
staticPath: "public",
|
|
bundlePath: "js/bundle.js",
|
|
livereloadPattern: "**/*.{css,html,js,svg}",
|
|
browserify: {
|
|
extensions: [".jsx"],
|
|
transform: [
|
|
[require.resolve("babelify"), {
|
|
presets: [
|
|
require.resolve("@babel/preset-env"),
|
|
require.resolve("@babel/preset-react")
|
|
],
|
|
}],
|
|
[require.resolve("aliasify"), {
|
|
aliases: {
|
|
"__internal_display_component": absoluteComponentSource
|
|
}
|
|
}],
|
|
[require.resolve("brfs")]
|
|
]
|
|
}
|
|
});
|