[Pkg-javascript-commits] [node-debug] 01/01: libjs-debug and examples

Paolo Greppi paolog-guest at moszumanska.debian.org
Mon Nov 27 17:44:45 UTC 2017


This is an automated email from the git hooks/post-receive script.

paolog-guest pushed a commit to branch master
in repository node-debug.

commit bdb0b5a05d26a4948f10c7a72500a27111b84043
Author: Paolo Greppi <paolo.greppi at libpf.com>
Date:   Mon Nov 27 13:33:30 2017 +0100

    libjs-debug and examples
---
 debian/changelog                        |  8 ++++--
 debian/control                          | 19 +++++++++++-
 debian/examples                         |  1 -
 debian/libjs-debug.examples             |  1 +
 debian/libjs-debug.install              |  3 ++
 debian/node-debug.examples              |  1 +
 debian/{install => node-debug.install}  |  0
 debian/patches/01-examples_browser.diff | 51 +++++++++++++++++++++++++++++++++
 debian/patches/series                   |  1 +
 debian/rules                            |  5 ++++
 10 files changed, 86 insertions(+), 4 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index ef49993..c918e2d 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,12 +1,16 @@
-node-debug (3.1.0-1) UNRELEASED; urgency=medium
+node-debug (3.1.0-1) unstable; urgency=medium
 
   * New upstream release.
   * Bump standards versions
   * Unbundle node-ms and depend on it (Closes: #836205)
   * No need to patch away the build-dependency on sinon-chai since
     node-sinon-chai is now in the archive
+  * Also produce a libjs-debug binary
+  * Patch the provided browser example to use library from
+    /usr/share/javascript
+  * Provide another example for using this library in the browser
 
- -- Paolo Greppi <paolo.greppi at libpf.com>  Fri, 03 Nov 2017 09:28:39 +0100
+ -- Paolo Greppi <paolo.greppi at libpf.com>  Mon, 27 Nov 2017 13:32:52 +0100
 
 node-debug (2.5.1-2) unstable; urgency=medium
 
diff --git a/debian/control b/debian/control
index 9c891cd..823eb9b 100644
--- a/debian/control
+++ b/debian/control
@@ -11,9 +11,11 @@ Build-Depends: debhelper (>= 9)
  , dh-buildinfo
  , mocha
  , chai
+ , node-browserify-lite
+ , node-ms
  , node-sinon
  , node-sinon-chai
- , node-ms
+ , node-uglify
  , nodejs
 Standards-Version: 4.1.1
 Homepage: https://github.com/visionmedia/debug
@@ -36,3 +38,18 @@ Description: small debugging utility for Node.js
  A unique color is selected per-function for visibility.
  .
  Node.js is an event-based server-side JavaScript engine.
+
+Package: libjs-debug
+Architecture: all
+Depends:
+ ${misc:Depends}
+Description: small debugging utility
+ libjs-debug provides a small debugging utility for the browser.
+ .
+ With this module you simply invoke the exported function to generate
+ your debug function, passing it a name which will determine if a
+ noop function is returned, or a decorated console.error, so all of the
+ console format string goodies you're used to work fine.
+ A unique color is selected per-function for visibility.
+ .
+ The enable state is persisted in the localStorage.
diff --git a/debian/examples b/debian/examples
deleted file mode 100644
index 0bbe99e..0000000
--- a/debian/examples
+++ /dev/null
@@ -1 +0,0 @@
-example/*
diff --git a/debian/libjs-debug.examples b/debian/libjs-debug.examples
new file mode 100644
index 0000000..df8a8c1
--- /dev/null
+++ b/debian/libjs-debug.examples
@@ -0,0 +1 @@
+examples/browser/*
diff --git a/debian/libjs-debug.install b/debian/libjs-debug.install
new file mode 100644
index 0000000..2ab76d6
--- /dev/null
+++ b/debian/libjs-debug.install
@@ -0,0 +1,3 @@
+dist/debug.js /usr/share/javascript/debug
+dist/debug.min.js /usr/share/javascript/debug
+dist/debug.min.js.map /usr/share/javascript/debug
diff --git a/debian/node-debug.examples b/debian/node-debug.examples
new file mode 100644
index 0000000..0d529aa
--- /dev/null
+++ b/debian/node-debug.examples
@@ -0,0 +1 @@
+examples/node/*
diff --git a/debian/install b/debian/node-debug.install
similarity index 100%
rename from debian/install
rename to debian/node-debug.install
diff --git a/debian/patches/01-examples_browser.diff b/debian/patches/01-examples_browser.diff
new file mode 100644
index 0000000..982e0e5
--- /dev/null
+++ b/debian/patches/01-examples_browser.diff
@@ -0,0 +1,51 @@
+Description: Fix existing example to use libjs from /usr/share/javascript; add 2nd browser example.
+Forwarded: not-needed
+Author: Paolo Greppi <paolo.greppi at libpf.com>
+
+Index: node-debug/examples/browser/buttons.html
+===================================================================
+--- /dev/null
++++ node-debug/examples/browser/buttons.html
+@@ -0,0 +1,29 @@
++<html>
++  <head>
++    <title>Example use of debug library in the browser</title>
++    <script language="javascript" type="text/javascript" src="/javascript/debug/debug.min.js"></script>
++  </head>
++<body>
++  <ul>
++    <li>Copy this file to <code>/var/www/html/.</code></li>
++    <li>open it in Chromium or Firefox (<a href="http://locahost/example.html">http://locahost/example.html</a>)</li>
++    <li>reload it so that the localStorage settings are picked up</li>
++    <li>now open the inspector and see the debug messages</li>
++  </ul>
++  <button onclick="debug1('clicked!')">Debug 1</button>
++  <button onclick="debug2('clicked!')">Debug 2</button>
++  <script>
++    localStorage.debug = 'debug1,debug2,worker:*';
++    var debug1 = debug('debug1');
++    var debug2 = debug('debug2');
++    var a = debug('worker:a');
++    var b = debug('worker:b');
++    setInterval(function(){
++      a('doing some work');
++    }, 1000);
++    setInterval(function(){
++      b('doing some work');
++    }, 1200);
++  </script>
++  </body>
++</html>
+Index: node-debug/examples/browser/colors.html
+===================================================================
+--- node-debug.orig/examples/browser/colors.html
++++ node-debug/examples/browser/colors.html
+@@ -3,7 +3,7 @@
+   <head>
+     <title>debug()</title>
+     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+-    <script src="../../dist/debug.js"></script>
++    <script language="javascript" type="text/javascript" src="/javascript/debug/debug.min.js"></script>
+     <script>
+       debug.enable('*')
+ 
diff --git a/debian/patches/series b/debian/patches/series
index 803adc9..8c8136b 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,2 @@
+01-examples_browser.diff
 00-makefile.diff
diff --git a/debian/rules b/debian/rules
index 349f984..cd9d9f7 100755
--- a/debian/rules
+++ b/debian/rules
@@ -8,11 +8,16 @@
 	dh $@
 
 override_dh_auto_build:
+	mkdir -p dist/
+	NODE_PATH=/usr/lib/nodejs browserify-lite --standalone debug ./src/browser.js --outfile dist/debug.js
+	uglifyjs -o dist/debug.min.js --source-map=dist/debug.min.js.map dist/debug.js
 
 override_dh_auto_test:
 	mocha -R spec -- test/**.js
 
 override_dh_auto_clean:
+	dh_clean
+	rm -rf dist/
 
 override_dh_installchangelogs:
 	dh_installchangelogs -k CHANGELOG.md

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-debug.git



More information about the Pkg-javascript-commits mailing list