[Pkg-javascript-commits] [node-module-deps] 235/444: usage

Bastien Roucariès rouca at moszumanska.debian.org
Fri Dec 15 09:47:59 UTC 2017


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

rouca pushed a commit to branch master
in repository node-module-deps.

commit 0e1eae89d0b99f64b9f4f0369d186839cc0fcd6a
Author: James Halliday <mail at substack.net>
Date:   Thu May 15 14:18:03 2014 +0200

    usage
---
 bin/cmd.js    | 26 ++++++++++++++++++++++++++
 bin/usage.txt |  9 +++++++++
 cmd.js        | 13 -------------
 package.json  |  5 +++--
 4 files changed, 38 insertions(+), 15 deletions(-)

diff --git a/bin/cmd.js b/bin/cmd.js
new file mode 100755
index 0000000..3a58df2
--- /dev/null
+++ b/bin/cmd.js
@@ -0,0 +1,26 @@
+#!/usr/bin/env node
+var mdeps = require('../');
+var subarg = require('subarg');
+var fs = require('fs');
+var path = require('path');
+
+var argv = subarg(process.argv.slice(2), {
+    alias: { h: 'help', t: 'transform', g: 'globalTransform' }
+});
+if (argv.help) return usage(0);
+
+var JSONStream = require('JSONStream');
+
+var stringify = JSONStream.stringify();
+stringify.pipe(process.stdout);
+
+var files = argv._.map(function (file) {
+    return path.resolve(file);
+});
+mdeps(files, argv).pipe(stringify);
+
+function usage (code) {
+    var r = fs.createReadStream(__dirname + '/usage.txt');
+    r.pipe(process.stdout);
+    if (code) r.on('end', function () { process.exit(code) });
+}
diff --git a/bin/usage.txt b/bin/usage.txt
new file mode 100644
index 0000000..8bbcbab
--- /dev/null
+++ b/bin/usage.txt
@@ -0,0 +1,9 @@
+module-deps [FILES] OPTIONS
+
+  Generate json output for the entry point FILES.
+
+OPTIONS are:
+
+  -t TRANSFORM  Apply a TRANSFORM.
+  -g TRANSFORM  Apply a global TRANSFORM.
+
diff --git a/cmd.js b/cmd.js
deleted file mode 100755
index f9a4acb..0000000
--- a/cmd.js
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/usr/bin/env node
-var mdeps = require('./');
-var argv = require('minimist')(process.argv.slice(2));
-var JSONStream = require('JSONStream');
-
-var stringify = JSONStream.stringify();
-stringify.pipe(process.stdout);
-
-var path = require('path');
-var files = argv._.map(function (file) {
-    return path.resolve(file);
-});
-mdeps(files, argv).pipe(stringify);
diff --git a/package.json b/package.json
index 5e9688b..c8e4eda 100644
--- a/package.json
+++ b/package.json
@@ -4,7 +4,7 @@
   "description": "walk the dependency graph to generate json output that can be fed into browser-pack",
   "main": "index.js",
   "bin": {
-    "module-deps": "cmd.js"
+    "module-deps": "bin/cmd.js"
   },
   "dependencies": {
     "JSONStream": "~0.7.1",
@@ -18,7 +18,8 @@
     "resolve": "~0.6.3",
     "stream-combiner": "~0.1.0",
     "through2": "~0.4.1",
-    "readable-stream": "^1.0.27-1"
+    "readable-stream": "^1.0.27-1",
+    "subarg": "0.0.1"
   },
   "devDependencies": {
     "through": "~2.3.4",

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



More information about the Pkg-javascript-commits mailing list