Hardcode some parameters that shouldn't change.

This commit is contained in:
Dillon Kearns 2019-08-19 14:51:11 -07:00
parent 713d9f0690
commit 07152b8fa3

View File

@ -1,22 +1,18 @@
const { compileToString } = require("node-elm-compiler");
module.exports = runElm;
function runElm(elmBaseDirectory, callback) {
function runElm(callback) {
const elmBaseDirectory = "./elm-stuff/elm-pages";
const mainElmFile = "../../src/Main.elm";
const startingDir = process.cwd();
console.log("cwd", process.cwd());
process.chdir(elmBaseDirectory);
console.log("cwd", process.cwd());
compileToString(["./src/Main.elm"], {}).then(function(data) {
compileToString([mainElmFile], {}).then(function(data) {
eval(data.toString());
const app = Elm.Main.init({ flags: { imageAssets: {} } });
app.ports.toJsPort.subscribe(payload => {
console.log("payload", payload);
callback(payload);
process.chdir(startingDir);
console.log("cwd", process.cwd());
});
});
}
// runElm("./examples/docs/", function() {});