summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRandall Leeds <randall@apache.org>2016-02-20 18:28:24 -0800
committerRobert Newson <rnewson@apache.org>2016-09-09 14:09:35 +0100
commit4dbd858e4b3babb454a605f5d429e118f02c05b2 (patch)
tree86fd9d14bf5c438ce6ccec3c14eed22f541b7aeb
parentaae4ff745dc31b96b7130b4e0b17026dec802937 (diff)
downloadcouchdb-4dbd858e4b3babb454a605f5d429e118f02c05b2.tar.gz
do not pollute the global scope
-rw-r--r--support/build_js.escript4
1 files changed, 3 insertions, 1 deletions
diff --git a/support/build_js.escript b/support/build_js.escript
index 5050fd6c7..0b3a859ef 100644
--- a/support/build_js.escript
+++ b/support/build_js.escript
@@ -40,13 +40,15 @@ main([]) ->
"share/server/coffee-script.js",
"share/server/loop.js"],
+ Pre = "(function () {\n",
+ Post = "})();\n",
Concat = fun(Files, To) ->
AccBin = lists:foldl(fun(Path, Acc) ->
{ok, Bin} = file:read_file(Path),
[Bin | Acc]
end, [], Files),
- FinalBin = iolist_to_binary(lists:reverse(AccBin)),
+ FinalBin = iolist_to_binary(Pre ++ lists:reverse(AccBin) ++ Post),
file:write_file(To, FinalBin)
end,