From a561b643b2d0a520df4a30f27eb88a1bf3a07cb9 Mon Sep 17 00:00:00 2001 From: Johannes Maas Date: Tue, 8 Sep 2020 18:25:03 +0200 Subject: [PATCH 1/3] Rename example .elm file to match its module definition --- examples/{HelloWorld.elm => Main.elm} | 0 examples/compileHelloWorld.js | 6 +++--- 2 files changed, 3 insertions(+), 3 deletions(-) rename examples/{HelloWorld.elm => Main.elm} (100%) diff --git a/examples/HelloWorld.elm b/examples/Main.elm similarity index 100% rename from examples/HelloWorld.elm rename to examples/Main.elm diff --git a/examples/compileHelloWorld.js b/examples/compileHelloWorld.js index c5f1156..961972a 100644 --- a/examples/compileHelloWorld.js +++ b/examples/compileHelloWorld.js @@ -1,17 +1,17 @@ var compile = require("../index.js").compile; var compileToString = require("../index.js").compileToString; -compile(["./HelloWorld.elm"], { +compile(["./Main.elm"], { output: "compiled-hello-world.js" }).on('close', function(exitCode) { console.log("Finished with exit code", exitCode); }); -compileToString(["./HelloWorld.elm"], {}).then(function(data){ +compileToString(["./Main.elm"], {}).then(function(data){ console.log("compileToString produced a string with this length:", data.toString().length); }); -compileToString(["./HelloWorld.elm"], { output: "index.html" }).then(function(data){ +compileToString(["./Main.elm"], { output: "index.html" }).then(function(data){ console.log("compileToString --output index.html produced a string with this length:", data.toString().length); }); From 9ccf2b912c5493c9520d6a9d503a60fa17e15925 Mon Sep 17 00:00:00 2001 From: Johannes Maas Date: Tue, 8 Sep 2020 18:26:30 +0200 Subject: [PATCH 2/3] Fix example .js requiring a missing file by pointing it to compiled .js --- examples/compileHelloWorld.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/compileHelloWorld.js b/examples/compileHelloWorld.js index 961972a..a426954 100644 --- a/examples/compileHelloWorld.js +++ b/examples/compileHelloWorld.js @@ -1,5 +1,5 @@ -var compile = require("../index.js").compile; -var compileToString = require("../index.js").compileToString; +var compile = require("../dist/index.js").compile; +var compileToString = require("../dist/index.js").compileToString; compile(["./Main.elm"], { output: "compiled-hello-world.js" From d763b60d7d1b8668248d39e169f013fb83b6d4e4 Mon Sep 17 00:00:00 2001 From: Johannes Maas Date: Tue, 8 Sep 2020 18:26:48 +0200 Subject: [PATCH 3/3] Add build step to example instructions in README --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 783aa1c..58be000 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,7 @@ Wraps [Elm](https://elm-lang.org) and exposes a [Node](https://nodejs.org) API t ```bash $ npm install +$ npm run build $ cd examples $ node compileHelloWorld.js ```