[Pkg-javascript-commits] [node-umd] 10/11: Add cli
Bastien Roucariès
rouca at moszumanska.debian.org
Mon Apr 17 07:38:05 UTC 2017
This is an automated email from the git hooks/post-receive script.
rouca pushed a commit to annotated tag 1.2.0
in repository node-umd.
commit 1abfc9ec66d5f1ea2d176399224d937970a2b618
Author: ForbesLindesay <forbes at lindesay.co.uk>
Date: Fri Jun 7 12:16:01 2013 +0100
Add cli
---
README.md | 23 ++++++++++++++++++++---
bin/cli.js | 39 +++++++++++++++++++++++++++++++++++++++
package.json | 17 +++++++----------
3 files changed, 66 insertions(+), 13 deletions(-)
diff --git a/README.md b/README.md
index cadb616..d293518 100644
--- a/README.md
+++ b/README.md
@@ -1,8 +1,14 @@
-<img src="http://i.imgur.com/ypw29XY.png" align="right"/>
# umd
+<img src="http://i.imgur.com/ypw29XY.png" align="right"/>
Universal Module Definition for use in automated build systems
+ - simple synchronous wrapping of a string
+ - optional wrapping of a "stream" with genuine streaming
+ - `return` style module support
+ - CommonJS support
+ - prevents internal UMDs from conflicting
+
## Source Format
In order for the UMD wrapper to work the source code for your module should `return` the export, e.g.
@@ -39,8 +45,19 @@ For examples, see the examples directory. The CommonJS module format is also su
return the text which will be inserted after a module.
+## Command Line
+
+```
+Usage: umd <name> <source> <destination> [options]
+
+Pipe Usage: umd <name> [options] < source > destination
+
+Options:
+
+ -h --help Display usage information
+ -c --commonJS Use CommonJS module format
+ ```
+
## License
MIT
-
-![viewcount](https://viewcount.jepso.com/count/ForbesLindesay/umd.png)
diff --git a/bin/cli.js b/bin/cli.js
new file mode 100644
index 0000000..58ad1f1
--- /dev/null
+++ b/bin/cli.js
@@ -0,0 +1,39 @@
+#!/usr/bin/env node
+
+var read = require('fs').createReadStream
+var write = require('fs').createWriteStream
+
+var umd = require('../')
+
+var args = process.argv.slice(2)
+
+var help = false
+var commonJS = false
+args = args.filter(function (arg) {
+ if (arg === '-h' || arg === '--help') {
+ help = true
+ return false
+ } else if (arg === '-c' || arg === '--commonJS') {
+ commonJS = true
+ return false
+ }
+ return true
+})
+
+if (help || !args[0]) {
+ console.log('Usage: umd <name> <source> <destination> [options]')
+ console.log('')
+ console.log('Pipe Usage: umd <name> [options] < source > destination')
+ console.log('')
+ console.log('Options:')
+ console.log('')
+ console.log(' -h --help Display usage information')
+ console.log(' -c --commonJS Use CommonJS module format')
+ console.log('')
+ if (!help) process.exit(1)
+} else {
+ var source = args[1] ? read(args[1]) : process.stdin
+ var dest = args[2] ? write(args[2]) : process.stdout
+
+ source.pipe(umd(args[0], commonJS)).pipe(dest)
+}
\ No newline at end of file
diff --git a/package.json b/package.json
index 6c73116..eba68be 100644
--- a/package.json
+++ b/package.json
@@ -2,26 +2,23 @@
"name": "umd",
"version": "1.1.1",
"description": "Universal Module Definition for use in automated build systems",
- "main": "index.js",
- "directories": {
- "example": "examples"
- },
"dependencies": {
"rfile": "~1.0.0",
"ruglify": "~1.0.0",
"through": "~2.3.1",
"uglify-js": "~2.2.5"
},
- "devDependencies": {},
+ "devDependencies": {
+ "win-spawn": "~1.1.2"
+ },
"scripts": {
- "test": "echo \"Error: no test specified\" && exit 1"
+ "test": "echo \"Error: no test specified\" && exit 1",
+ "prepublish": "win-line-endings"
},
"repository": {
"type": "git",
"url": "https://github.com/ForbesLindesay/umd.git"
},
"author": "ForbesLindesay",
- "license": "MIT",
- "readmeFilename": "README.md",
- "gitHead": "7f34f679e59a5051e6d4fe7e6be9657a440bbc86"
-}
\ No newline at end of file
+ "license": "MIT"
+}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-umd.git
More information about the Pkg-javascript-commits
mailing list