This commit is contained in:
Pavel Djundik 2017-11-12 20:28:13 +02:00
parent e86a155ec2
commit adab03f730
3 changed files with 15 additions and 6 deletions

View file

@ -2,6 +2,8 @@
global.log = require("../log.js");
const fs = require("fs");
const path = require("path");
const program = require("commander");
const colors = require("colors/safe");
const Helper = require("../helper");
@ -22,6 +24,18 @@ if (program.home) {
log.warn(`Use the ${colors.green("LOUNGE_HOME")} environment variable instead.`);
}
// Check if the app was built before calling setHome as it wants to load manifest.json from the public folder
if (!fs.existsSync(path.join(
__dirname,
"..",
"..",
"public",
"manifest.json"
))) {
log.error(`The client application was not built. Run ${colors.bold("NODE_ENV=production npm run build")} to resolve this.`);
process.exit(1);
}
let home = program.home || process.env.LOUNGE_HOME;
if (!home) {

View file

@ -32,11 +32,6 @@ module.exports = function() {
(Node.js ${colors.green(process.versions.node)} on ${colors.green(process.platform)} ${process.arch})`);
log.info(`Configuration file: ${colors.green(Helper.CONFIG_PATH)}`);
if (!fs.existsSync("public/js/bundle.js")) {
log.error(`The client application was not built. Run ${colors.bold("NODE_ENV=production npm run build")} to resolve this.`);
process.exit();
}
var app = express()
.disable("x-powered-by")
.use(allRequests)

View file

@ -23,7 +23,7 @@ describe("Server", () => {
request(webURL, (error, response, body) => {
expect(error).to.be.null;
expect(body).to.include("<title>The Lounge</title>");
expect(body).to.include("https://thelounge.github.io/");
expect(body).to.include("js/bundle.js");
done();
});