Skip to content

Commit

Permalink
Merge pull request #117 from jchw-forks/fix-gen-kaitai-serve
Browse files Browse the repository at this point in the history
Make serve.js generate kaitaiFsFiles like serve.py did.
  • Loading branch information
generalmimon authored Jun 27, 2020
2 parents 96284c1 + f78863b commit 44825a6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 5 additions & 1 deletion genKaitaiFsFiles.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,8 @@ function main() {
generate(outDir);
}

main();
if (!module.parent) {
main();
}

module.exports = generate;
2 changes: 2 additions & 0 deletions serve.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const { readdirSync, statSync } = require("fs");
const { join } = require("path");
const express = require("express");
const ts = require("typescript");
const genKaitaiFsFiles = require("./genKaitaiFsFiles");

const port = 8000;
const watchPattern = /(\.html$)|(^js\/)|(^css\/)$/;
Expand Down Expand Up @@ -81,6 +82,7 @@ app.get("/onchange", (req, res, next) => {
app.use(express.static("."));

function main() {
genKaitaiFsFiles('');
if (process.argv.includes("--compile")) {
startWatcher();
}
Expand Down

0 comments on commit 44825a6

Please sign in to comment.