[pve-devel] [PATCH novnc v3 5/6] transpile javascript before packaging
Dominik Csapak
d.csapak at proxmox.com
Mon May 22 16:58:14 CEST 2017
instead of using the babel-shim (which is not production-ready),
create a bundle app.js file with node-es6-module-transpiler in the
dh_auto_build step
this way, we only need to ship 1 js file instead of many
Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
Makefile | 2 +-
debian/control | 2 +-
debian/install | 15 ++++++-----
debian/patches/0010-use-only-app.js.patch | 44 +++++++++++++++++++++++++++++++
debian/patches/series | 1 +
debian/rules | 4 +++
6 files changed, 59 insertions(+), 9 deletions(-)
create mode 100644 debian/patches/0010-use-only-app.js.patch
diff --git a/Makefile b/Makefile
index 4ac049f..5ef857d 100644
--- a/Makefile
+++ b/Makefile
@@ -17,7 +17,7 @@ deb: ${DEB}
${DEB}: | submodule
rm -rf ${SRCDIR}.tmp
cp -rpa ${SRCDIR} ${SRCDIR}.tmp
- cp -a debian ${SRCDIR}.tmp/debian
+ cp -a debian ${SRCDIR}.tmp/
echo "git clone git://git.proxmox.com/git/novnc-pve.git\\ngit checkout ${GITVERSION}" > ${SRCDIR}.tmp/debian/SOURCE
cd ${SRCDIR}.tmp; dpkg-buildpackage -rfakeroot -b -uc -us
lintian ${DEB}
diff --git a/debian/control b/debian/control
index 1a895c8..63a74ad 100644
--- a/debian/control
+++ b/debian/control
@@ -2,7 +2,7 @@ Source: novnc-pve
Section: web
Priority: optional
Maintainer: Proxmox Support Team <support at proxmox.com>
-Build-Depends: debhelper (>= 7.0.0~), quilt
+Build-Depends: debhelper (>= 7.0.0~), quilt, node-es6-module-transpiler
Standards-Version: 3.8.3
Homepage: https://github.com/kanaka/noVNC/
diff --git a/debian/install b/debian/install
index 37f355f..7f6c294 100644
--- a/debian/install
+++ b/debian/install
@@ -1,7 +1,8 @@
-app usr/share/novnc-pve
-core usr/share/novnc-pve
-docs usr/share/novnc-pve
-po usr/share/novnc-pve
-utils usr/share/novnc-pve
-vendor usr/share/novnc-pve
-index.html.tpl usr/share/novnc-pve
+app/images usr/share/novnc-pve/app
+app/locale usr/share/novnc-pve/app
+app/sounds usr/share/novnc-pve/app
+app/styles usr/share/novnc-pve/app
+app/error-handler.js usr/share/novnc-pve/app
+app.js usr/share/novnc-pve
+docs usr/share/novnc-pve
+index.html.tpl usr/share/novnc-pve
diff --git a/debian/patches/0010-use-only-app.js.patch b/debian/patches/0010-use-only-app.js.patch
new file mode 100644
index 0000000..e225250
--- /dev/null
+++ b/debian/patches/0010-use-only-app.js.patch
@@ -0,0 +1,44 @@
+From 6d3945c7c0b680a871d789215659f04e42acd6e7 Mon Sep 17 00:00:00 2001
+From: Dominik Csapak <d.csapak at proxmox.com>
+Date: Tue, 16 May 2017 10:36:15 +0200
+Subject: [PATCH 10/10] use only app.js
+
+because we will use the commonjs version,
+we only need to use the generated app.js
+
+Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
+---
+ vnc.html | 17 +----------------
+ 1 file changed, 1 insertion(+), 16 deletions(-)
+
+diff --git a/vnc.html b/vnc.html
+index ff70e0c..40c726b 100644
+--- a/vnc.html
++++ b/vnc.html
+@@ -46,22 +46,7 @@
+ </script>
+
+ <!-- begin scripts -->
+- <!-- promise polyfills promises for IE11 -->
+- <script src="/novnc/vendor/promise.js"></script>
+- <!-- ES2015/ES6 modules polyfill -->
+- <script type="module">
+- window._noVNC_has_module_support = true;
+- </script>
+- <script>
+- window.addEventListener("load", function() {
+- if (window._noVNC_has_module_support) return;
+- var loader = document.createElement("script");
+- loader.src = "/novnc/vendor/browser-es-module-loader/dist/browser-es-module-loader.js";
+- document.head.appendChild(loader);
+- });
+- </script>
+- <!-- actual script modules -->
+- <script type="module" src="/novnc/app/ui.js"></script>
++ <script src="/novnc/app.js"></script>
+ <!-- end scripts -->
+ </head>
+
+--
+2.11.0
+
diff --git a/debian/patches/series b/debian/patches/series
index f528c37..086ff43 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -7,3 +7,4 @@
0007-add-replaceable-snippets-in-vnc.html.patch
0008-focus-canvas-after-load.patch
0009-decrease-animation-time.patch
+0010-use-only-app.js.patch
diff --git a/debian/rules b/debian/rules
index 169ef3d..15a62e9 100755
--- a/debian/rules
+++ b/debian/rules
@@ -5,6 +5,10 @@
export DEB_BUILD_HARDENING=1
+override_dh_auto_build:
+ compile-modules convert -f bundle app/ui.js > app.js
+ dh_auto_build
+
override_dh_install:
cp vnc.html index.html.tpl
dh_install
--
2.11.0
More information about the pve-devel
mailing list