aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard van der Hoff <richard@matrix.org>2015-12-02 14:04:24 +0000
committerRichard van der Hoff <richard@matrix.org>2015-12-02 14:04:24 +0000
commit2bb7f3b1e6d7735d1f03f332c57c34dc81ae88c2 (patch)
tree9f1973e3959284f4a417dc8d5f6ffa7da8c993e3
parent28622db92f006b27b25dcaf6d06eb7b0e69c8687 (diff)
Tweak javascript build to make npm better
Build into 'javascript' dir and tell package.json exactly which files we care about.
-rw-r--r--javascript/.gitignore2
-rwxr-xr-xjavascript/build.py7
-rw-r--r--javascript/package.json4
3 files changed, 8 insertions, 5 deletions
diff --git a/javascript/.gitignore b/javascript/.gitignore
new file mode 100644
index 0000000..3613cfd
--- /dev/null
+++ b/javascript/.gitignore
@@ -0,0 +1,2 @@
+/exported_functions.json
+/olm.js
diff --git a/javascript/build.py b/javascript/build.py
index 722a8b9..093532a 100755
--- a/javascript/build.py
+++ b/javascript/build.py
@@ -24,9 +24,6 @@ source_files = glob.glob("src/*.cpp")
pre_js, = glob.glob("javascript/*pre.js")
post_js, = glob.glob("javascript/*post.js")
-if not os.path.exists("build"):
- os.mkdir("build")
-
functions = set()
RE_FUNCTION=re.compile("(olm_[^( ]*)\\(")
with open("include/olm/olm.hh") as header:
@@ -36,7 +33,7 @@ with open("include/olm/olm.hh") as header:
functions.add(match.groups()[0])
-exported_functions = os.path.abspath("build/exported_functions.json")
+exported_functions = os.path.abspath("javascript/exported_functions.json")
with open(exported_functions, "w") as json_file:
json.dump(["_" + function for function in functions], json_file)
@@ -61,7 +58,7 @@ compile_args += ("--post-js", post_js)
compile_args += ("-s", "EXPORTED_FUNCTIONS=@" + exported_functions)
compile_args += sys.argv[1:]
-library = "build/olm.js"
+library = "javascript/olm.js"
def run(args):
print args
diff --git a/javascript/package.json b/javascript/package.json
index efcdaa5..b27d6eb 100644
--- a/javascript/package.json
+++ b/javascript/package.json
@@ -3,6 +3,10 @@
"version": "0.1.0",
"description": "An implementation of a well known cryptographic ratchet",
"main": "olm.js",
+ "files": [
+ "olm.js",
+ "README.md"
+ ],
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},