From a4f9e07f4ee854a9534817fb36cede30567c6a40 Mon Sep 17 00:00:00 2001
From: "B. Petersen" <r10s@b44t.com>
Date: Sat, 1 Jan 2022 20:45:59 +0100
Subject: [PATCH] create a script to create a .xdc

---
 .gitignore    |  2 ++
 README.md     |  4 ++--
 create-xdc.sh | 15 +++++++++++++++
 3 files changed, 19 insertions(+), 2 deletions(-)
 create mode 100644 .gitignore
 create mode 100755 create-xdc.sh

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..97f3520
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,2 @@
+*.xdc
+
diff --git a/README.md b/README.md
index fcf8629..275f554 100644
--- a/README.md
+++ b/README.md
@@ -16,8 +16,8 @@ no server or installation required.
 - once you call sendUpdate() in on peer,
   all peers will get the update with their update listeners.
 
-keep in mind, when bundling your webxdc app, `webxdc.js` is not needed,
-it will be provided by the target implementation.
+when your app is done, you can bundle it using `./create-xdc.sh your-app-name`
+and send it to your friends :)
 
 note, that the api is not yet complete,
 this is just a, maybe already useful, proof-of-concept for now.
diff --git a/create-xdc.sh b/create-xdc.sh
new file mode 100755
index 0000000..c017b71
--- /dev/null
+++ b/create-xdc.sh
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+if [ $# -eq 0 ]
+then
+    echo "usage: zip-xdc.sh PACKAGE_NAME"
+    exit
+fi
+
+PACKAGE_NAME=$1
+
+rm $PACKAGE_NAME.xdc 2> /dev/null
+zip -9 --recurse-paths $PACKAGE_NAME.xdc * --exclude README.md webxdc.js "*.sh" "*.xdc"
+
+echo "success, archive contents:"
+unzip -l $PACKAGE_NAME.xdc