diff --git a/bin/help.md b/bin/help.md index 9b24a92..cb68a80 100644 --- a/bin/help.md +++ b/bin/help.md @@ -17,6 +17,7 @@ Basic options: -u, --id ID for AMD module (default is anonymous) -m, --sourcemap Generate sourcemap (`-m inline` for inline map) --no-strict Don't emit a `"use strict";` in the generated modules. +--no-indent Don't indent result Examples: diff --git a/bin/rollup b/bin/rollup index fc9dab9..8132e92 100755 --- a/bin/rollup +++ b/bin/rollup @@ -9,6 +9,7 @@ command = minimist( process.argv.slice( 2 ), { strict: 'useStrict', // Short options + d: 'indent', e: 'external', f: 'format', g: 'globals', diff --git a/bin/runRollup.js b/bin/runRollup.js index 48868c5..1717c0c 100644 --- a/bin/runRollup.js +++ b/bin/runRollup.js @@ -58,7 +58,8 @@ function bundle ( options, method ) { globals: options.globals, moduleId: options.id, moduleName: options.name, - sourceMap: options.sourcemap + sourceMap: options.sourcemap, + indent: options.indent !== false }; if ( options.output ) { diff --git a/test/cli/indent-none/_config.js b/test/cli/indent-none/_config.js new file mode 100644 index 0000000..a9d1307 --- /dev/null +++ b/test/cli/indent-none/_config.js @@ -0,0 +1,6 @@ +var assert = require( 'assert' ); + +module.exports = { + description: 'disables indentation with --no-indent', + command: 'rollup main.js --format umd --no-indent' +}; diff --git a/test/cli/indent-none/_expected.js b/test/cli/indent-none/_expected.js new file mode 100644 index 0000000..79e7659 --- /dev/null +++ b/test/cli/indent-none/_expected.js @@ -0,0 +1,9 @@ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory() : + typeof define === 'function' && define.amd ? define(factory) : + factory(); +}(this, function () { 'use strict'; + +assert.equal( 1 + 1, 2 ); + +})); diff --git a/test/cli/indent-none/main.js b/test/cli/indent-none/main.js new file mode 100644 index 0000000..17eee8f --- /dev/null +++ b/test/cli/indent-none/main.js @@ -0,0 +1 @@ +assert.equal( 1 + 1, 2 ); diff --git a/test/cli/module-name/_config.js b/test/cli/module-name/_config.js index 49c1fa4..da790e4 100644 --- a/test/cli/module-name/_config.js +++ b/test/cli/module-name/_config.js @@ -1,4 +1,4 @@ module.exports = { description: 'generates UMD export with correct moduleName', command: 'rollup main.js --format umd --name myBundle' -} +};