├── .editorconfig ├── .gitignore ├── .npmignore ├── .travis.yml ├── README.md ├── asset └── Notifier.app │ └── Contents │ ├── Info.plist │ ├── MacOS │ └── Notifier │ ├── PkgInfo │ └── Resources │ ├── Terminal.icns │ └── en.lproj │ ├── Credits.rtf │ ├── InfoPlist.strings │ └── MainMenu.nib ├── bin ├── .gitattributes ├── mod ├── mod-debug.cmd └── mod-dev.cmd ├── doc ├── README.md ├── api │ ├── README.md │ ├── exports.md │ ├── file.md │ ├── template.md │ └── utils.md ├── tasks │ ├── README.md │ ├── build.md │ ├── cat.md │ ├── compile.md │ ├── cp.md │ ├── create.md │ ├── deploy.md │ ├── download.md │ ├── hash.md │ ├── help.md │ ├── init.md │ ├── lint.md │ ├── min.md │ ├── mkdir.md │ ├── mv.md │ ├── pack.md │ ├── replace.md │ ├── rev.md │ ├── rm.md │ ├── server.md │ ├── strip.md │ └── watch.md ├── template │ ├── README-api.md │ ├── README-task.md │ ├── README.md │ ├── api.md │ └── task.md └── tutorial │ ├── configuring-tasks.md │ ├── creating-plugins.md │ └── getting-started.md ├── example ├── buildmobile │ ├── Modfile.js │ ├── README.md │ ├── css │ │ ├── base.css │ │ └── main.css │ ├── img │ │ └── icon.png │ ├── index.html │ └── js │ │ ├── ios.js │ │ ├── main.js │ │ └── var │ │ ├── document.js │ │ ├── location.js │ │ ├── navigator.js │ │ └── zepto.js ├── buildnormal │ ├── Modfile.js │ ├── README.md │ ├── css │ │ ├── base.css │ │ └── main.css │ ├── img │ │ └── icon.png │ ├── index.html │ └── js │ │ ├── bar.js │ │ ├── baz.js │ │ ├── corge.js │ │ ├── foo.js │ │ ├── quux.js │ │ └── qux.js ├── buildrequirejs │ ├── Modfile.js │ ├── README.md │ ├── css │ │ ├── base.css │ │ └── main.css │ ├── index.html │ └── js │ │ ├── $.js │ │ ├── main.js │ │ └── standalone.js ├── buildseajs │ ├── Modfile.js │ ├── README.md │ ├── css │ │ └── style.css │ ├── index.html │ └── js │ │ ├── main.js │ │ └── spinning.js ├── catcss │ ├── Modfile.js │ ├── bar.css │ ├── foo.css │ └── foo.png ├── catjs │ ├── Modfile.js │ ├── bar.js │ └── foo.js ├── compileamd │ ├── Modfile.js │ ├── README.md │ ├── index.html │ └── js │ │ ├── asyncModule.js │ │ ├── main.js │ │ ├── syncModule.js │ │ └── var │ │ ├── $.js │ │ ├── document.js │ │ ├── location.js │ │ └── navigator.js ├── compilecmd │ ├── Modfile.js │ ├── index.html │ └── js │ │ ├── a.js │ │ ├── b.js │ │ ├── c.js │ │ ├── config.js │ │ └── main.js ├── compilecss │ ├── Modfile.js │ └── conditional.css ├── compilehtml │ ├── Modfile.js │ └── conditional.html ├── compilejs │ ├── Modfile.js │ └── conditional.js ├── compilemultipage │ ├── Modfile.js │ ├── README.md │ ├── js │ │ ├── app │ │ │ ├── controller │ │ │ │ ├── Base.js │ │ │ │ ├── c1.js │ │ │ │ └── c2.js │ │ │ ├── lib.js │ │ │ ├── main1.js │ │ │ ├── main2.js │ │ │ └── model │ │ │ │ ├── Base.js │ │ │ │ ├── m1.js │ │ │ │ └── m2.js │ │ ├── common.js │ │ └── lib │ │ │ ├── backbone.js │ │ │ ├── jquery.js │ │ │ └── underscore.js │ ├── page1.html │ └── page2.html ├── configasync │ ├── Modfile.js │ ├── foobar.css │ └── foobar.js ├── configgroup │ ├── Modfile.js │ ├── foobar.css │ └── foobar.js ├── confignestedtargets │ └── Modfile.js ├── configoptions │ └── Modfile.js ├── configtemplate │ ├── Modfile.js │ ├── bar │ │ └── b.js │ ├── baz │ │ └── c.js │ └── foo │ │ └── a.js ├── cp │ └── Modfile.js ├── datauri │ ├── Modfile.js │ ├── test.css │ └── test.png ├── deployhttp │ ├── .testskip │ └── Modfile.js ├── deployssh │ ├── .testskip │ └── Modfile.js ├── download │ └── Modfile.js ├── mincss │ ├── Modfile.js │ ├── foo.png │ └── test.css ├── minhtml │ ├── Modfile.js │ └── index.html ├── minjs │ ├── Modfile.js │ └── js │ │ ├── unminify.js │ │ └── unminify.min.js ├── mkdir │ └── Modfile.js ├── plugingrunttask │ ├── Modfile.js │ ├── bar.js │ └── foo.js ├── plugininlinetask │ └── Modfile.js ├── pluginlocaltask │ ├── Modfile.js │ └── mytask.js ├── pluginnpmtask │ ├── Modfile.js │ └── test.styl ├── replace │ ├── Modfile.js │ └── foo.js ├── stripcode │ ├── Modfile.js │ └── foo.js ├── stripeol │ ├── Modfile.js │ └── foo.js ├── striptab │ ├── Modfile.js │ └── foo.js └── watchstyl │ ├── .testskip │ ├── Modfile.js │ └── styl │ ├── bar.styl │ └── foo.styl ├── index.js ├── lib ├── builtin.js ├── config.js ├── generators │ ├── git │ │ ├── .gitattributes │ │ └── .gitignore │ ├── jquery │ │ ├── index.js │ │ ├── {{name}}.jquery.json │ │ └── {{name}}.js │ ├── json │ │ ├── index.js │ │ └── templates │ │ │ └── package.json │ ├── licenses │ │ ├── Apache-2.0-LICENSE.txt │ │ ├── GPL-2.0-LICENSE.txt │ │ ├── MIT-LICENSE.txt │ │ ├── MPL-2.0-LICENSE.txt │ │ └── index.js │ ├── mocha │ │ └── test │ │ │ ├── index.html │ │ │ ├── lib │ │ │ ├── chai.js │ │ │ ├── expect.js │ │ │ └── mocha │ │ │ │ ├── mocha.css │ │ │ │ └── mocha.js │ │ │ ├── runner │ │ │ └── mocha.js │ │ │ └── spec │ │ │ └── spec.js │ ├── modfile │ │ └── Modfile.js │ ├── plugin │ │ ├── Modfile.js │ │ ├── README.md │ │ ├── index.js │ │ └── {{main_name}}.js │ ├── readme │ │ └── README.md │ └── webview │ │ ├── index.html │ │ ├── index.js │ │ ├── main.css │ │ └── main.js ├── options.js ├── plugins.js ├── runner.js ├── tasks │ ├── build.js │ ├── cat.js │ ├── compile.js │ ├── cp.js │ ├── datauri.js │ ├── deploy.js │ ├── download.js │ ├── exec.js │ ├── help.js │ ├── htmlminifier.js │ ├── init.js │ ├── min.js │ ├── mkdir.js │ ├── mv.js │ ├── optimizecss.js │ ├── replace.js │ ├── rev.js │ ├── rm.js │ ├── search.js │ ├── strip.js │ ├── template.js │ ├── uglifyjs.js │ └── watch.js └── utils │ ├── file.js │ ├── format.js │ ├── github.js │ ├── htmlparser.js │ ├── index.js │ ├── logger.js │ ├── notifier.js │ ├── sea.js │ ├── sshclient.js │ ├── suggester.js │ └── template.js ├── package.json └── test ├── apitesting ├── Modfile.js └── apitesting.js └── testrunner.js /.editorconfig: -------------------------------------------------------------------------------- 1 | # This file is for unifying the coding style for different editors and IDEs 2 | # editorconfig.org 3 | 4 | root = true 5 | 6 | [*] 7 | end_of_line = lf 8 | charset = utf-8 9 | trim_trailing_whitespace = true 10 | insert_final_newline = true 11 | indent_style = space 12 | indent_size = 4 13 | 14 | [package.json] 15 | indent_style = space 16 | indent_size = 2 17 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Include your project-specific ignores in this file 2 | # Read about how to use .gitignore: https://help.github.com/articles/ignoring-files 3 | 4 | # Numerous always-ignore extensions 5 | *.diff 6 | *.err 7 | *.orig 8 | *.log 9 | *.rej 10 | *.swo 11 | *.swp 12 | *.vi 13 | *~ 14 | *.sass-cache 15 | 16 | # OS or Editor folders 17 | .DS_Store 18 | ._* 19 | Thumbs.db 20 | .cache 21 | .project 22 | .settings 23 | .tmproj 24 | nbproject 25 | *.sublime-project 26 | *.sublime-workspace 27 | 28 | # Dreamweaver added files 29 | _notes 30 | dwsync.xml 31 | 32 | # Komodo 33 | *.komodoproject 34 | .komodotools 35 | 36 | # Espresso 37 | *.esproj 38 | *.espressostorage 39 | 40 | # Rubinius 41 | *.rbc 42 | 43 | # Folders to ignore 44 | .hg 45 | .svn 46 | .CVS 47 | intermediate 48 | publish 49 | .idea 50 | node_modules 51 | dist 52 | 53 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | doc/ 2 | test/ 3 | example/ 4 | node_modules/ 5 | .* 6 | *~ -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | 3 | node_js: 4 | - 0.8 5 | - 0.10 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

Stopped developping on modjs and switched to chajs

2 | 3 |

4 | 5 | Mod.js 6 | 7 |

8 | 9 |

10 | NPM version 11 | Build Status 12 |

13 | 14 | Mod.js is a [task-based](https://github.com/taskjs/spec) workflow tooling for web, it helps developers quickly build robust and high-performance HTML5 applications. 15 | 16 | ## Why Mod.js? 17 | * Focus on the workflow of web development 18 | * Much built-in tasks, most pleasant out-of-the-box experience 19 | - Built-in source minify: `JS, CSS, HTML` 20 | - Built-in modular JS compile: `AMD, CMD (will support ES6 Module, CommonJS Module soon)` 21 | - Built-in CSS @import file combination 22 | - Built-in source stripping, automatically remove debugging code 23 | - Built-in basic file operation: `cat, rm, mv, mkdir, cp, rev` 24 | - Built-in file watcher, trigger custom tasks when file change 25 | * More simplicity plugin mechanism, auto-install plugins 26 | * Configuration less(even zero), do more 27 | - Build by html: `mod build index.html` 28 | * Compatible with [Grunt](http://gruntjs.com) plugins, with literally hundreds of plugins to choose from 29 | 30 | ## Installation 31 | [Mod.js](https://npmjs.org/package/modjs) is installed using [NPM(Node Package Manager)](http://npmjs.org/) 32 | ```sh 33 | $ npm install modjs -g 34 | ``` 35 | 36 | ## Tutorials 37 | * [Getting Started](https://github.com/modjs/mod/tree/master/doc/tutorial/getting-started.md) 38 | * [Configuring Tasks](https://github.com/modjs/mod/blob/master/doc/tutorial/configuring-tasks.md) 39 | * [Creating Plugins](https://github.com/modjs/mod/tree/master/doc/tutorial/creating-plugins.md) 40 | 41 | ## Documents 42 | * [Built-in Task](https://github.com/modjs/mod/tree/master/doc/tasks) 43 | * [Plugin API](https://github.com/modjs/mod/tree/master/doc/api) 44 | 45 | ## Quick Build Demo 46 | * [Plain Project Build](https://github.com/modjs/mod/tree/master/example/buildnormal) 47 | * [Mobile Project Build](https://github.com/modjs/mod/tree/master/example/buildmobile) 48 | * [RequireJS Project Build](https://github.com/modjs/mod/tree/master/example/buildrequirejs) 49 | 50 | ## Built-in Task Examples 51 | * [Concatenate JS Files](https://github.com/modjs/mod/tree/master/example/catjs) 52 | * [Concatenate CSS Files](https://github.com/modjs/mod/tree/master/example/catcss) 53 | * [AMD Modules Compile](https://github.com/modjs/mod/tree/master/example/compileamd) 54 | * [CMD Modules Compile](https://github.com/modjs/mod/tree/master/example/compilecmd) 55 | * [Mutil-page Modules Compile](https://github.com/modjs/mod/tree/master/example/compilemultipage) 56 | * [JS Conditional Compilation](https://github.com/modjs/mod/tree/master/example/compilejs) 57 | * [CSS Conditional Compilation](https://github.com/modjs/mod/tree/master/example/compilecss) 58 | * [HTML Conditional Compilation](https://github.com/modjs/mod/tree/master/example/compilehtml) 59 | * [JS Minify](https://github.com/modjs/mod/tree/master/example/minjs) 60 | * [CSS Minify](https://github.com/modjs/mod/tree/master/example/mincss) 61 | * [HTML Minify](https://github.com/modjs/mod/tree/master/example/minhtml) 62 | * [Code Stripping](https://github.com/modjs/mod/tree/master/example/stripcode) 63 | * [EOL Stripping](https://github.com/modjs/mod/tree/master/example/stripeol) 64 | * [Tab Stripping](https://github.com/modjs/mod/tree/master/example/striptab) 65 | * [Inline Images DataURI](https://github.com/modjs/mod/tree/master/example/datauri) 66 | * [Make Dir](https://github.com/modjs/mod/tree/master/example/mkdir) 67 | * [Copy Files](https://github.com/modjs/mod/tree/master/example/cp) 68 | * [String Replace](https://github.com/modjs/mod/tree/master/example/replace) 69 | 70 | ## Plugins Examples 71 | * [NPM Task: mod-stylus](https://github.com/modjs/mod/tree/master/example/pluginnpmtask) 72 | * [Local Task: mytask.js](https://github.com/modjs/mod/tree/master/example/pluginlocaltask) 73 | * [Grunt Task: grunt-contrib-concat](https://github.com/modjs/mod/tree/master/example/plugingrunttask) 74 | 75 | ## IDE Support 76 | * [Sublime-Mod](https://github.com/yuanyan/sublime-mod) 77 | 78 | ## Platform Support 79 | Mod support Windows, OS X, Linux... 80 | 81 | ## Issue Submission 82 | Submit a [new issue](https://github.com/modjs/mod/issues/new). 83 | 84 | ## Release History 85 | 86 | * 2014-02-28 v0.4.6 Fix r.js build error. 87 | * 2014-02-20 v0.4.5 Remove built-in `server` task.     88 | 89 | ## About 90 | Mod is an open-source project by [Tencent](http://www.tencent.com/en-us/) which builds on top of [Node.js](https://nodejs.org). 91 | We utilize a number of useful open-source solutions including: 92 | 93 | * UglifyJS 94 | * CleanCSS 95 | * HTMLMinifiler 96 | * RequireJS 97 | 98 | ## Used by people within (JOIN US) 99 | ![Tencent](http://upload.wikimedia.org/wikipedia/commons/thumb/2/22/Tencent_Logo.svg/200px-Tencent_Logo.svg.png) 100 | 101 | ## License 102 | Mod.js is released under a [MIT](http://yuanyan.mit-license.org/) license. 103 | -------------------------------------------------------------------------------- /asset/Notifier.app/Contents/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | BuildMachineOSBuild 6 | 13A2093 7 | CFBundleDevelopmentRegion 8 | en 9 | CFBundleExecutable 10 | Notifier 11 | CFBundleIconFile 12 | Terminal 13 | CFBundleIdentifier 14 | nl.superalloy.oss.Notifier 15 | CFBundleInfoDictionaryVersion 16 | 6.0 17 | CFBundleName 18 | Notifier 19 | CFBundlePackageType 20 | APPL 21 | CFBundleShortVersionString 22 | 1.5.1 23 | CFBundleSignature 24 | ???? 25 | CFBundleVersion 26 | 9 27 | DTCompiler 28 | com.apple.compilers.llvm.clang.1_0 29 | DTPlatformBuild 30 | 5A2053 31 | DTPlatformVersion 32 | GM 33 | DTSDKBuild 34 | 13A595 35 | DTSDKName 36 | macosx10.9 37 | DTXcode 38 | 0501 39 | DTXcodeBuild 40 | 5A2053 41 | LSMinimumSystemVersion 42 | 10.8 43 | LSUIElement 44 | 45 | NSHumanReadableCopyright 46 | Copyright © 2012 Eloy Durán. All rights reserved. 47 | NSMainNibFile 48 | MainMenu 49 | NSPrincipalClass 50 | NSApplication 51 | 52 | 53 | -------------------------------------------------------------------------------- /asset/Notifier.app/Contents/MacOS/Notifier: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/modjs/mod/e1215bd34e5f8d610e8ae17542c8e1cbd3c0a75f/asset/Notifier.app/Contents/MacOS/Notifier -------------------------------------------------------------------------------- /asset/Notifier.app/Contents/PkgInfo: -------------------------------------------------------------------------------- 1 | APPL???? -------------------------------------------------------------------------------- /asset/Notifier.app/Contents/Resources/Terminal.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/modjs/mod/e1215bd34e5f8d610e8ae17542c8e1cbd3c0a75f/asset/Notifier.app/Contents/Resources/Terminal.icns -------------------------------------------------------------------------------- /asset/Notifier.app/Contents/Resources/en.lproj/Credits.rtf: -------------------------------------------------------------------------------- 1 | {\rtf0\ansi{\fonttbl\f0\fswiss Helvetica;} 2 | {\colortbl;\red255\green255\blue255;} 3 | \paperw9840\paperh8400 4 | \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural 5 | 6 | \f0\b\fs24 \cf0 Engineering: 7 | \b0 \ 8 | Some people\ 9 | \ 10 | 11 | \b Human Interface Design: 12 | \b0 \ 13 | Some other people\ 14 | \ 15 | 16 | \b Testing: 17 | \b0 \ 18 | Hopefully not nobody\ 19 | \ 20 | 21 | \b Documentation: 22 | \b0 \ 23 | Whoever\ 24 | \ 25 | 26 | \b With special thanks to: 27 | \b0 \ 28 | Mom\ 29 | } 30 | -------------------------------------------------------------------------------- /asset/Notifier.app/Contents/Resources/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/modjs/mod/e1215bd34e5f8d610e8ae17542c8e1cbd3c0a75f/asset/Notifier.app/Contents/Resources/en.lproj/InfoPlist.strings -------------------------------------------------------------------------------- /asset/Notifier.app/Contents/Resources/en.lproj/MainMenu.nib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/modjs/mod/e1215bd34e5f8d610e8ae17542c8e1cbd3c0a75f/asset/Notifier.app/Contents/Resources/en.lproj/MainMenu.nib -------------------------------------------------------------------------------- /bin/.gitattributes: -------------------------------------------------------------------------------- 1 | * text eol=lf 2 | -------------------------------------------------------------------------------- /bin/mod: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | var utils = require('../lib/utils/index'); 4 | var logger = require('../lib/utils/logger'); 5 | var runner = require('../lib/runner'); 6 | var config = require('../lib/config'); 7 | var colors = require('colors'); 8 | var _ = require('lodash'); 9 | 10 | var argv = process.argv; 11 | for (var i = 0; i < process.argv.length; i += 1) { 12 | var arg = argv[i]; 13 | if (arg === '--debug') { 14 | process.argv.splice(i, 1); 15 | logger.level = 'debug'; 16 | } else if (arg === '--no-color' || arg === '--no-colors') { 17 | process.argv.splice(i, 1); 18 | colors.mode = 'none'; 19 | var originLog = console.log; 20 | console.log = function () { 21 | var args = _.toArray(arguments); 22 | args.map(function (arg) { 23 | return colors.stripColors(arg); 24 | }); 25 | originLog.apply(this, args); 26 | }; 27 | } else if (arg === '--force') { 28 | process.argv.splice(i, 1); 29 | logger.force = true; 30 | } 31 | } 32 | 33 | var cmd = argv.slice(2).shift(); 34 | if (cmd === '-h' || cmd === '--help') { 35 | cmd = 'help'; 36 | } 37 | 38 | if (cmd === '-v' || cmd === '--version') { 39 | var ver = utils.getVersion(); 40 | console.log(ver.green); 41 | } else { 42 | config.load({ 43 | cmd: cmd 44 | }, function (rc) { 45 | runner.run({ 46 | rc: rc, 47 | cmd: cmd 48 | }); 49 | }) 50 | } 51 | -------------------------------------------------------------------------------- /bin/mod-debug.cmd: -------------------------------------------------------------------------------- 1 | @IF EXIST "%~dp0\node.exe" ( 2 | "%~dp0\node.exe --debug-brk" "%~dp0\mod" %* 3 | ) ELSE ( 4 | node --debug-brk "%~dp0\mod" %* 5 | ) -------------------------------------------------------------------------------- /bin/mod-dev.cmd: -------------------------------------------------------------------------------- 1 | @IF EXIST "%~dp0\node.exe" ( 2 | "%~dp0\node.exe" "%~dp0\mod" %* 3 | ) ELSE ( 4 | node "%~dp0\mod" %* 5 | ) -------------------------------------------------------------------------------- /doc/README.md: -------------------------------------------------------------------------------- 1 | # Documents 2 | ## Tutorials 3 | * [Getting Started](https://github.com/modjs/mod/tree/master/doc/tutorial/getting-started.md) 4 | * [Configuring Tasks](https://github.com/modjs/mod/blob/master/doc/tutorial/configuring-tasks.md) 5 | * [Creating Plugins](https://github.com/modjs/mod/tree/master/doc/tutorial/creating-plugins.md) 6 | 7 | ## Built-in Tasks 8 | Mod supports a powerful set of high-level tasks: 9 | 10 | * [help](https://github.com/modjs/mod/tree/master/doc/tasks/help.md) - get help on mod 11 | * [build](https://github.com/modjs/mod/tree/master/doc/tasks/build.md) - build project with html 12 | * [init](https://github.com/modjs/mod/tree/master/doc/tasks/init.md) - generate project skeleton from template 13 | * [watch](https://github.com/modjs/mod/tree/master/doc/tasks/watch.md) - run predefined tasks whenever watched files change 14 | * [deploy](https://github.com/modjs/mod/tree/master/doc/tasks/deploy.md) - remote deployment via ssh 15 | * [download](https://github.com/modjs/mod/tree/master/doc/tasks/download.md) - download resource from URI 16 | * [compile](https://github.com/modjs/mod/tree/master/doc/tasks/compile.md) - compile JavaScript/CSS/HTML source 17 | * [min](https://github.com/modjs/mod/tree/master/doc/tasks/min.md) - minify JavaScript/CSS/HTML source 18 | * [replace](https://github.com/modjs/mod/tree/master/doc/tasks/replace.md) - replace the contents of files 19 | * [cat](https://github.com/modjs/mod/tree/master/doc/tasks/cat.md) - concatenate the content of files 20 | * [cp](https://github.com/modjs/mod/tree/master/doc/tasks/cp.md) - copy one or more files to another location 21 | * [mkdir](https://github.com/modjs/mod/tree/master/doc/tasks/mkdir.md) - make a new directory 22 | * [mv](https://github.com/modjs/mod/tree/master/doc/tasks/mv.md) - move or rename files or directories 23 | * [rm](https://github.com/modjs/mod/tree/master/doc/tasks/rm.md) - remove files 24 | * [rev](https://github.com/modjs/mod/tree/master/doc/tasks/rev.md) - rename file with it hash value 25 | * [strip](https://github.com/modjs/mod/tree/master/doc/tasks/strip.md) - source stripping 26 | 27 | ## API 28 | 29 | * [exports](https://github.com/modjs/mod/tree/master/doc/api/exports.md) - The exports API 30 | * [exports.file](https://github.com/modjs/mod/tree/master/doc/api/file.md) - There are many provided methods for reading and writing files, traversing the filesystem and finding files by matching globbing patterns. Many of these methods are wrappers around built-in Node.js file functionality, but with additional error handling, logging and character encoding normalization. 31 | * [exports.utils](https://github.com/modjs/mod/tree/master/doc/api/utils.md) - Miscellaneous utilities 32 | * [exports.template](https://github.com/modjs/mod/tree/master/doc/api/template.md) - Compiles templates into strings 33 | * [exports._](http://underscorejs.org/) - Underscore provides 80-odd functions that support both the usual functional suspects: map, select, invoke — as well as more specialized helpers: function binding, javascript templating, deep equality testing, and so on. It delegates to built-in functions, if present, so modern browsers will use the native implementations of forEach, map, reduce, filter, every, some and indexOf. 34 | * [exports.async](https://github.com/caolan/async) - Async provides around 20 functions that include the usual 'functional' suspects (map, reduce, filter, each…) as well as some common patterns for asynchronous control flow (parallel, series, waterfall…). All these functions assume you follow the node.js convention of providing a single callback as the last argument of your async function. 35 | * [exports.request](https://github.com/mikeal/request) - Simplified HTTP request method 36 | * [exports.prompt](https://github.com/flatiron/prompt) - Using prompt is relatively straight forward. There are two core methods you should be aware of: prompt.get() and prompt.addProperties(). There methods take strings representing property names in addition to objects for complex property validation (and more). 37 | 38 | 39 | -------------------------------------------------------------------------------- /doc/api/README.md: -------------------------------------------------------------------------------- 1 | ## API 2 | 3 | * [exports](https://github.com/modjs/mod/tree/master/doc/api/exports.md) - The exports API 4 | * [exports.file](https://github.com/modjs/mod/tree/master/doc/api/file.md) - There are many provided methods for reading and writing files, traversing the filesystem and finding files by matching globbing patterns. Many of these methods are wrappers around built-in Node.js file functionality, but with additional error handling, logging and character encoding normalization. 5 | * [exports.utils](https://github.com/modjs/mod/tree/master/doc/api/utils.md) - Miscellaneous utilities 6 | * [exports.template](https://github.com/modjs/mod/tree/master/doc/api/template.md) - Compiles templates into strings 7 | * [exports._](http://underscorejs.org/) - Underscore provides 80-odd functions that support both the usual functional suspects: map, select, invoke — as well as more specialized helpers: function binding, javascript templating, deep equality testing, and so on. It delegates to built-in functions, if present, so modern browsers will use the native implementations of forEach, map, reduce, filter, every, some and indexOf. 8 | * [exports.async](https://github.com/caolan/async) - Async provides around 20 functions that include the usual 'functional' suspects (map, reduce, filter, each…) as well as some common patterns for asynchronous control flow (parallel, series, waterfall…). All these functions assume you follow the node.js convention of providing a single callback as the last argument of your async function. 9 | * [exports.request](https://github.com/mikeal/request) - Simplified HTTP request method 10 | * [exports.prompt](https://github.com/flatiron/prompt) - Using prompt is relatively straight forward. There are two core methods you should be aware of: prompt.get() and prompt.addProperties(). There methods take strings representing property names in addition to objects for complex property validation (and more). 11 | -------------------------------------------------------------------------------- /doc/api/exports.md: -------------------------------------------------------------------------------- 1 | ## exports 2 | > The exports API 3 | 4 | 5 | ### Properties 6 | 7 | #### exports.taskName 8 |

    Describe: Current task's name

9 |
10 | 11 | #### exports.template 12 |

    Describe: Compiles templates into strings

13 |
14 | 15 | #### exports.utils 16 |

    Describe: Miscellaneous utilities

17 |
18 | 19 | #### exports.file 20 |

    Describe: Provided many methods for reading and writing files, traversing the filesystem and finding files by matching globbing patterns. Many of these methods are wrappers around built-in Node.js file functionality, but with additional error handling, logging and character encoding normalization.

21 |
22 | 23 | #### exports._ 24 |

    Describe: Tons of super-useful array, function and object utility methods.

25 |
26 | 27 | #### exports.async 28 |

    Describe: Async utilities for node and the browser

29 |
30 | 31 | #### exports.files 32 |

    Describe: An array of all file paths that match the given wildcard patterns.

33 |
34 | 35 | 36 | 37 | 38 | ### Methods 39 | 40 | #### exports.loadTask(taskName) 41 |

    Describe: Load a task

42 |

    Return: {object}

43 | 44 |
45 | 46 | #### exports.runTask(name [, options] [, callback]) 47 |

    Describe: Run task

48 | 49 | 50 |
51 | 52 | #### exports.runTargets(targets [, callback]) 53 |

    Describe: Run targets

54 | 55 | 56 |
57 | 58 | #### exports.config([name]) 59 |

    Describe: Get peoject config

60 |

    Return: {*}

61 | 62 |
63 | 64 | #### exports.logger 65 |

    Describe: Logging object

66 | 67 | 68 |
69 | 70 | #### exports.log(arg1 [,arg2...]) 71 |

    Describe: Print log

72 | 73 | 74 |
75 | 76 | #### exports.debug(arg1 [,arg2...]) 77 |

    Describe: Print debug

78 | 79 | 80 |
81 | 82 | #### exports.error(arg1 [,arg2...]) 83 |

    Describe: Print error

84 | 85 | 86 |
87 | 88 | #### exports.warn(arg1 [,arg2...]) 89 |

    Describe: Print warning

90 | 91 | 92 |
93 | 94 | #### exports.notify 95 |

    Describe: Push message to OSX notification system

96 | 97 |

    Example:

98 | ```js 99 | exports.notify({ 100 | title: 'Hi', 101 | message: 'I am ok' 102 | }); 103 | ``` 104 | 105 |
106 | 107 | #### exports.help() 108 |

    Describe: Print task help

109 | 110 | 111 |
112 | 113 | #### exports.request 114 |

    Describe: Simplified HTTP request method

115 | 116 |

    Example:

117 | ```js 118 | request('http://www.google.com', function (error, response, body) { 119 | if (!error && response.statusCode == 200) { 120 | console.log(body) // Print the google web page. 121 | } 122 | }) 123 | ``` 124 | 125 |
126 | 127 | #### exports.prompt 128 |

    Describe: Using prompt is relatively straight forward. There are two core methods you should be aware of: prompt.get() and prompt.addProperties(). There methods take strings representing property names in addition to objects for complex property validation (and more).

129 | 130 |

    Example:

131 | ```js 132 | // Start the prompt 133 | prompt.start(); 134 | // Get two properties from the user: username and email 135 | prompt.get(['username', 'email'], function (err, result) { 136 | // Log the results. 137 | console.log('Command-line input received:'); 138 | console.log(' username: ' + result.username); 139 | console.log(' email: ' + result.email); 140 | }); 141 | ``` 142 | 143 |
144 | 145 | 146 | 147 | 148 | -------------------------------------------------------------------------------- /doc/api/file.md: -------------------------------------------------------------------------------- 1 | ## file 2 | > There are many provided methods for reading and writing files, traversing the filesystem and finding files by matching globbing patterns. Many of these methods are wrappers around built-in Node.js file functionality, but with additional error handling, logging and character encoding normalization. 3 | 4 | 5 | 6 | 7 | ### Methods 8 | 9 | #### file.exists(filepath) 10 |

    Describe: File exists

11 | 12 | 13 |
14 | 15 | #### file.isFile(filepath) 16 |

    Describe: Is the given path a file? Returns a boolean.

17 | 18 | 19 |
20 | 21 | #### file.isPlaintextFile(filepath) 22 |

    Describe: Is the given path a plaintext file? Returns a boolean.

23 | 24 | 25 |
26 | 27 | #### file.isUTF8EncodingFile(filepath) 28 |

    Describe: Is the given path a UTF8 encoding file? Returns a boolean.

29 | 30 | 31 |
32 | 33 | #### file.suffix(filename, suffix) 34 |

    Describe: File suffix append

35 |

    Return: {*}

36 |

    Example:

37 | ```js 38 | file.suffiex("jquery.js", "min") // => jquery.min.js 39 | ``` 40 | 41 |
42 | 43 | #### file.isDir(filepath) 44 |

    Describe: Is the given path a directory? Returns a boolean.

45 | 46 | 47 |
48 | 49 | #### file.isDirname(filepath) 50 |

    Describe: Is dir format name

51 | 52 | 53 |
54 | 55 | #### file.readJSON(filepath) 56 |

    Describe: Read a file from the filesystem and parse as JSON

57 | 58 | 59 |
60 | 61 | #### file.findPackageJSON 62 |

    Describe: Looks for a project's package.json file. Walks up the directory tree untilit finds a package.json file or hits the root. Does not throw when nopackages.json is found, just returns null.

63 | 64 | 65 |
66 | 67 | #### file.readPackageJSON( [dir] ) 68 |

    Describe: Read a package.json file's contents, parsing the data as JSON and returning the result

69 | 70 | 71 |
72 | 73 | #### file.listdir(dir, callback) 74 |

    Describe: List directories within a directory.

75 | 76 | 77 |
78 | 79 | #### file.glob(pattern [, rootdir]) 80 |

    Describe: Get the pattern matched files, default root dir is cwd

81 | 82 | 83 |
84 | 85 | #### file.expand(patterns [, options]) 86 |

    Describe: Return a unique array of all file or directory paths that match the given globbing pattern(s).

87 |

    Return: {array} matche files

88 |

    Example:

89 | ```js 90 | file.expand(['!./foo/.css', './foo/']) 91 | ``` 92 | 93 |
94 | 95 | #### file.delete(filepath) 96 |

    Describe: Delete the specified filepath. Will delete files and folders recursively.

97 | 98 | 99 |
100 | 101 | #### file.read(filepath [, encoding]) 102 |

    Describe: Read and return a file's contents.

103 | 104 | 105 |
106 | 107 | #### file.write(filepath, contents [, encoding]) 108 |

    Describe: Write the specified contents to a file, creating intermediate directories if necessary

109 | 110 | 111 |
112 | 113 | #### file.writeTemp(filepath, contents [, encoding]) 114 |

    Describe: Write the specified contents to a temp file

115 | 116 | 117 |
118 | 119 | #### file.copy(src, dest) 120 |

    Describe: Copy a source file or directory to a destination path, creating intermediate directories if necessary

121 | 122 | 123 |
124 | 125 | #### file.find(dirpath, filename); 126 |

    Describe: Search for a filename in the given directory or all parent directories.

127 |

    Return: {string}

128 | 129 |
130 | 131 | #### file.mkdir(dirpath [, mode]) 132 |

    Describe: Given a path to a directory, create it, and all the intermediate directories as well

133 | 134 |

    Example:

135 | ```js 136 | file.mkdir("/tmp/dir", 755) 137 | ``` 138 | 139 |
140 | 141 | #### file.mkdirTemp([dirname] [, mode]) 142 |

    Describe: Create temp dir

143 |

    Return: {string}

144 | 145 |
146 | 147 | #### file.walkdir(rootdir, callback) 148 |

    Describe: Recurse into a directory, executing callback for each file.

149 | 150 |

    Example:

151 | ```js 152 | file.walkdir("/tmp", function(error, path, dirs, name) { 153 | // path is the current directory we're in 154 | // dirs is the list of directories below it 155 | // names is the list of files in it 156 | }) 157 | ``` 158 | 159 |
160 | 161 | 162 | 163 | 164 | -------------------------------------------------------------------------------- /doc/api/template.md: -------------------------------------------------------------------------------- 1 | ## template 2 | > Compiles templates into strings 3 | 4 | 5 | ### Properties 6 | 7 | #### template.settings 8 |

    Describe: By default, uses ERB-style template delimiters, change the following template settings to use alternative delimiters.

9 |
10 | 11 | 12 | 13 | 14 | ### Methods 15 | 16 | #### template(text, data, settings) 17 |

    Describe: Compiles templates into strings

18 | 19 |

    Example:

20 | ```js 21 | template("hello <%= foo %>", {foo:"modjs"}) // => hello modjs 22 | ``` 23 | 24 |
25 | 26 | #### template.registerHelper(name, helper) 27 |

    Describe: Helpers can be accessed from any context in a template

28 | 29 |

    Example:

30 | ```js 31 | template.registerHelper("echo", function(val){ 32 | console.log(val); 33 | }) 34 | ``` 35 | 36 |
37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /doc/api/utils.md: -------------------------------------------------------------------------------- 1 | ## utils 2 | > miscellaneous utilities 3 | 4 | 5 | 6 | 7 | ### Methods 8 | 9 | #### utils.getHttpProxy( hostname ) 10 |

    Describe: Get the system's http proxy

11 | 12 | 13 |
14 | 15 | #### utils.isRelativeURI(uri) 16 |

    Describe: Is a relative URI?

17 | 18 |

    Example:

19 | ```js 20 | utils.isRelativeURI("../path/to"); // => return true 21 | utils.isRelativeURI("path/to"); // => return true 22 | utils.isRelativeURI("#id"); // => return false 23 | utils.isRelativeURI("http://www.qq.com"); // => return false 24 | utils.isRelativeURI("/relative/to/root"); // => return false 25 | utils.isRelativeURI("//without/protocol"); // => return false 26 | utils.isRelativeURI("data:image/gif;base64,lGODlhEAA..."); // => return false 27 | ``` 28 | 29 |
30 | 31 | #### utils.download(url, local, callback) 32 |

    Describe: Download file

33 | 34 | 35 |
36 | 37 | #### utils.isPlainObject(obj) 38 |

    Describe: Check to see if an object is a plain object (created using “{}” or “new Object”).

39 | 40 | 41 |
42 | 43 | #### utils.clone(obj) 44 |

    Describe: Deep copy of the object

45 | 46 | 47 |
48 | 49 | #### utils.walk(value, fn, fnContinue) 50 |

    Describe: Recurse through objects and arrays, executing fn for each non-object.

51 | 52 | 53 |
54 | 55 | #### utils.namespace(obj, parts, create) 56 |

    Describe: Get the value of a deeply-nested property exist in an object.

57 | 58 | 59 |
60 | 61 | #### utils.merge(a, b) 62 |

    Describe: Deep merge for JSON objects, overwrites conflicting properties

63 | 64 | 65 |
66 | 67 | #### utils.arrayify() 68 |

    Describe: Convert 'a,b,c' to [a,b,c]

69 | 70 | 71 |
72 | 73 | #### utils.getVersion() 74 |

    Describe: Reads the version property from modjs's package.json

75 | 76 | 77 |
78 | 79 | #### utils.open(target, appName, callback) 80 |

    Describe: Open application

81 | 82 | 83 |
84 | 85 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /doc/tasks/README.md: -------------------------------------------------------------------------------- 1 | ## Built-in Tasks 2 | Mod supports a powerful set of high-level tasks: 3 | 4 | * [help](https://github.com/modjs/mod/tree/master/doc/tasks/help.md) - get help on mod 5 | * [build](https://github.com/modjs/mod/tree/master/doc/tasks/build.md) - build project with html 6 | * [init](https://github.com/modjs/mod/tree/master/doc/tasks/init.md) - generate project skeleton from template 7 | * [watch](https://github.com/modjs/mod/tree/master/doc/tasks/watch.md) - run predefined tasks whenever watched files change 8 | * [deploy](https://github.com/modjs/mod/tree/master/doc/tasks/deploy.md) - remote deployment via ssh 9 | * [download](https://github.com/modjs/mod/tree/master/doc/tasks/download.md) - download resource from URI 10 | * [compile](https://github.com/modjs/mod/tree/master/doc/tasks/compile.md) - compile JavaScript/CSS/HTML source 11 | * [min](https://github.com/modjs/mod/tree/master/doc/tasks/min.md) - minify JavaScript/CSS/HTML source 12 | * [replace](https://github.com/modjs/mod/tree/master/doc/tasks/replace.md) - replace the contents of files 13 | * [cat](https://github.com/modjs/mod/tree/master/doc/tasks/cat.md) - concatenate the content of files 14 | * [cp](https://github.com/modjs/mod/tree/master/doc/tasks/cp.md) - copy one or more files to another location 15 | * [mkdir](https://github.com/modjs/mod/tree/master/doc/tasks/mkdir.md) - make a new directory 16 | * [mv](https://github.com/modjs/mod/tree/master/doc/tasks/mv.md) - move or rename files or directories 17 | * [rm](https://github.com/modjs/mod/tree/master/doc/tasks/rm.md) - remove files 18 | * [rev](https://github.com/modjs/mod/tree/master/doc/tasks/rev.md) - rename file with it hash value 19 | * [strip](https://github.com/modjs/mod/tree/master/doc/tasks/strip.md) - source stripping 20 | -------------------------------------------------------------------------------- /doc/tasks/build.md: -------------------------------------------------------------------------------- 1 | ## build 2 | > Build project with html 3 | 4 | ### Usage 5 | 6 | ```sh 7 | $ mod build [options] 8 | ``` 9 | 10 | ### Options 11 | 12 | #### dest 13 | 14 |

    Default: dist

15 |

    Describe: Destination build directory

16 |
17 | 18 | #### rev 19 | 20 |

    Default: true

21 |

    Describe: Insert a hash of the file content into the filename end

22 |
23 | 24 | #### charset 25 | 26 |

    Default: utf-8

27 |

    Describe: File encoding type

28 |
29 | 30 | #### wrap 31 | 32 |

    Default: false

33 |

    Describe: Wrap any build bundle in a start and end text specified by wrap

34 |
35 | 36 | #### urlPrepend 37 | 38 |

    Default:

39 |

    Describe: Url prepend with relative address

40 |
41 | 42 | #### stripDefine 43 | 44 |

    Default: false

45 |

    Describe: Strip all definitions in generated source

46 |
47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /doc/tasks/cat.md: -------------------------------------------------------------------------------- 1 | ## cat 2 | > Concatenate the content of files 3 | 4 | ### Usage 5 | 6 | ```sh 7 | $ mod cat [options] 8 | ``` 9 | 10 | ### Options 11 | 12 | #### dest 13 | 14 |

    Default:

15 |

    Describe: Destination file

16 |
17 | 18 | #### charset 19 | 20 |

    Default: utf-8

21 |

    Describe: File encoding type

22 |
23 | 24 | #### endings 25 | 26 |

    Default: 27 |

28 |

    Describe: Make sure each file endings with newline

29 |
30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /doc/tasks/cp.md: -------------------------------------------------------------------------------- 1 | ## cp 2 | > Copy one or more files to another location 3 | 4 | ### Usage 5 | 6 | ```sh 7 | $ mod cp [options] 8 | ``` 9 | 10 | ### Options 11 | 12 | #### dest 13 | 14 | 15 |

    Describe: Destination directory or file

16 |
17 | 18 | #### flatten 19 | 20 | 21 |

    Describe: Remove all path parts from generated dest paths

22 |
23 | 24 | #### recursive 25 | 26 |

    Default: true

27 |

    Describe: Copy directories recursively

28 |
29 | 30 | #### verbose 31 | 32 |

    Default: true

33 |

    Describe: Shows file/directory names after they are copied

34 |
35 | 36 | #### force 37 | 38 |

    Default: true

39 |

    Describe: Force overwriting the existing files

40 |
41 | 42 | #### update 43 | 44 |

    Default: false

45 |

    Describe: Copy only when the SOURCE file is newer than the destination file or when the destination file is missing

46 |
47 | 48 | #### backup 49 | 50 |

    Default: true

51 |

    Describe: Make a backup of each existing destination file

52 |
53 | 54 | #### parents 55 | 56 |

    Default: false

57 |

    Describe: Full path to be copied to the destination directory

58 |
59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /doc/tasks/create.md: -------------------------------------------------------------------------------- 1 | ## create 2 | > Generate project skeleton and create project directory 3 | 4 | ### Usage 5 | 6 | ```sh 7 | $ mod create [options] 8 | ``` 9 | 10 | ### Options 11 | 12 | #### template 13 | 14 | 15 |

    Describe: Destination template

16 |
17 | 18 | #### dest 19 | 20 |

    Default: .

21 |

    Describe: Target project directory

22 |
23 | 24 | #### mod 25 |

    Type: Boolean

26 | 27 |

    Describe: Create a mod files in target directory

28 |
29 | 30 | #### json 31 |

    Type: Boolean

32 | 33 |

    Describe: Create a package.json file in target directory

34 |
35 | 36 | #### git 37 |

    Type: Boolean

38 | 39 |

    Describe: Create git files in target directory

40 |
41 | 42 | #### readme 43 |

    Type: Boolean

44 | 45 |

    Describe: Create a README.md file in target directory

46 |
47 | 48 | #### mocha 49 |

    Type: Boolean

50 | 51 |

    Describe: Create test files in target directory

52 |
53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /doc/tasks/deploy.md: -------------------------------------------------------------------------------- 1 | ## deploy 2 | > Remote deployment via ssh 3 | 4 | ### Usage 5 | 6 | ```sh 7 | $ mod deploy [options] 8 | ``` 9 | 10 | ### Options 11 | 12 | #### src 13 | 14 | 15 |

    Describe: Local file or directory

16 |
17 | 18 | #### basedir 19 | 20 | 21 |

    Describe: Local file base dir

22 |
23 | 24 | #### dest 25 | 26 | 27 |

    Describe: The remote, eg. username:password@host:/path/to/

28 |
29 | 30 | #### port 31 | 32 |

    Default: 22

33 |

    Describe: The port to connect to on the remote host.

34 |
35 | 36 | #### username 37 | 38 | 39 |

    Describe: The remote username

40 |
41 | 42 | #### password 43 | 44 | 45 |

    Describe: The remote password

46 |
47 | 48 | #### host 49 | 50 | 51 |

    Describe: The remote host

52 |
53 | 54 | #### path 55 | 56 | 57 |

    Describe: The remote path

58 |
59 | 60 | #### protocol 61 | 62 |

    Default: ssh

63 |

    Describe: Deploy tunnel protocol, ssh or http

64 |
65 | 66 | #### url 67 | 68 | 69 |

    Describe: The upload url

70 |
71 | 72 | #### overwrite 73 | 74 |

    Default: true

75 |

    Describe: Overwrite existed file

76 |
77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | -------------------------------------------------------------------------------- /doc/tasks/download.md: -------------------------------------------------------------------------------- 1 | ## download 2 | > Download resource from URI 3 | 4 | ### Usage 5 | 6 | ```sh 7 | $ mod download [options] 8 | ``` 9 | 10 | ### Options 11 | 12 | #### src 13 | 14 | 15 |

    Describe: The URI which to download a resource

16 |
17 | 18 | #### dest 19 | 20 |

    Default: ./

21 |

    Describe: The file or directory where to store the requested resource(s)

22 |
23 | 24 | #### verbose 25 | 26 | 27 |

    Describe: Show verbose progress information

28 |
29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /doc/tasks/hash.md: -------------------------------------------------------------------------------- 1 | ## hash 2 | > Rename file with it hash value 3 | 4 | ### Usage 5 | 6 | ```sh 7 | $ mod hash [options] 8 | ``` 9 | 10 | ### Options 11 | 12 | #### algorithm 13 | 14 |

    Default: md5

15 |

    Describe: Target build level

16 |
17 | 18 | #### encoding 19 | 20 |

    Default: hex

21 |

    Describe: File encoding type

22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /doc/tasks/help.md: -------------------------------------------------------------------------------- 1 | ## help 2 | > Get help on mod 3 | 4 | ### Usage 5 | 6 | ```sh 7 | $ mod help [command] 8 | ``` 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /doc/tasks/init.md: -------------------------------------------------------------------------------- 1 | ## init 2 | > Generate project skeleton from template 3 | 4 | ### Usage 5 | 6 | ```sh 7 | $ mod init