lib/index.js
function compile(_ref2) {
    var resource = _ref2.resource,
        dest = _ref2.dest,
        mode = _ref2.mode;

    dest = dest || 'dest';
    resource = resource || '*.vue';
    mode = ['amd', 'commonjs', 'umd', 'global'].indexOf(mode) > -1 ? mode : 'amd';
    if ((0, _fs.existsSync)(dest)) {
        if (!(0, _fs.statSync)(dest).isDirectory()) {
            throw new Error('the destination path is already exist and it is not a directory');
        }
    } else {
        (0, _fs.mkdirSync)(dest);
    }

    var files = _glob2.default.sync(resource);
    files.forEach(function (file) {
        var name = (0, _path.parse)(file).name;
        try {
            var code = generateCode(file, mode);
            var outputPath = (0, _path.format)({
                dir: dest,
                name: name,
                ext: '.js'
            });
            (0, _fs.writeFileSync)(outputPath, code);
        } catch (e) {
            throw e;
        }
    });
}
function compile(_ref2) {
    var resource = _ref2.resource,
        dest = _ref2.dest,
        mode = _ref2.mode;

    dest = dest || 'dest';
    resource = resource || '*.vue';
    mode = ['amd', 'commonjs', 'umd', 'global'].indexOf(mode) > -1 ? mode : 'amd';
    if ((0, _fs.existsSync)(dest)) {
        if (!(0, _fs.statSync)(dest).isDirectory()) {
            throw new Error('the destination path is already exist and it is not a directory');
        }
    } else {
        (0, _fs.mkdirSync)(dest);
    }

    var files = _glob2.default.sync(resource);
    files.forEach(function (file) {
        var name = (0, _path.parse)(file).name;
        try {
            var code = generateCode(file, mode);
            var outputPath = (0, _path.format)({
                dir: dest,
                name: name,
                ext: '.js'
            });
            (0, _fs.writeFileSync)(outputPath, code);
        } catch (e) {
            throw e;
        }
    });
}
function compile ( _ref2 ) { var resource = _ref2 . resource , dest = _ref2 . dest , mode = _ref2 . mode ; dest = dest || 'dest' ; resource = resource || '*.vue' ; mode = [ 'amd' , 'commonjs' , 'umd' , 'global' ] . indexOf ( mode ) > - 1 ? mode : 'amd' ; if ( ( 0 , _fs . existsSync ) ( dest ) ) { if ( ! ( 0 , _fs . statSync ) ( dest ) . isDirectory ( ) ) { throw new Error ( 'the destination path is already exist and it is not a directory' ) ; } } else { ( 0 , _fs . mkdirSync ) ( dest ) ; } var files = _glob2 . default . sync ( resource ) ; files . forEach ( function ( file ) { var name = ( 0 , _path . parse ) ( file ) . name ; try { var code = generateCode ( file , mode ) ; var outputPath = ( 0 , _path . format ) ( { dir : dest , name : name , ext : '.js' } ) ; ( 0 , _fs . writeFileSync ) ( outputPath , code ) ; } catch ( e ) { throw e ; } } ) ; }
compile .vue to .js with appointed destination directory

@param {Object} options compile config info
@param {string} options.resource glob pattern file path
@param {string} options.dest output destination directory
@param {string} options.mode one of amd/commonjs/umd/global
compile . vue to . js with appointed destination directory