const 
fs = require('fs'),
electronPackager = require('electron-packager');

module.exports = function (grunt) {
	grunt.registerMultiTask('electron-packager', 'Run electron-plus commands',  function ()  {
    var done = this.async();
		var options = this.data.options;
		if (this.data.options === undefined) {
			throw new Error('`options` required');
		}
    fs.access(options.dir , function (err) {
      if (err){
        throw new Error('`dir` required - path the app');
      }
      electronPackager(typeof options === 'function' ? options.apply(grunt, arguments) : options, function (err,appPath)  {
        if (err) {
          grunt.warn(err);
          return;
        }else{
          grunt.log.writeln('\t'+appPath);
        }
        done();
      });
    });   
	});
};


@@ -1,15 +1,15 @@
 const
- 
 %0A
+%09
 fs = req
@@ -20,16 +20,17 @@
 ('fs'),%0A
+%09
 electron
@@ -96,17 +96,16 @@
 function
- 
 (grunt) 
@@ -181,17 +181,16 @@
 mmands',
- 
  functio
@@ -194,19 +194,15 @@
 tion
- 
 ()
- 
  %7B%0A
-    
+%09%09
 var 
@@ -224,23 +224,17 @@
 nc()
-;%0A%09%09var
+,
  options
  = t
@@ -233,28 +233,8 @@
 ions
- = this.data.options
 ;%0A%09%09
@@ -317,21 +317,140 @@
 d');%0A%09%09%7D
-%0A    
+ else %7B%0A%09%09%09options = typeof (ref = this.data.options) === 'function' ? ref.apply(grunt, arguments) : ref;%0A%09%09%7D%0A%09%09%0A%09%09try %7B%0A%09%09%09
 fs.acces
@@ -462,17 +462,16 @@
 ions.dir
- 
 , functi
@@ -472,25 +472,24 @@
 function
- 
 (err) %7B%0A
       if
@@ -480,30 +480,28 @@
 (err) %7B%0A
-      
+%09%09%09%09
 if (err)
 %7B%0A      
@@ -496,165 +496,101 @@
 err)
+ 
 %7B%0A
-        throw new Error('%60dir%60 required - path the app');%0A      %7D%0A      electronPackager(typeof options === 'function' ? options.apply(grunt, arguments) : 
+%09%09%09%09%09grunt.fatal(err instanceof Error ? err : new Error(err));%0A%09%09%09%09%7D%0A%09%09%09%09electronPackager(
 opti
@@ -606,22 +606,22 @@
 tion
- 
 (err,
+ 
 appPath)
   %7B%0A
@@ -620,20 +620,16 @@
 ath)
- 
  %7B%0A
-        
+%09%09%09%09%09
 if (
@@ -635,26 +635,22 @@
 (err) %7B%0A
-          
+%09%09%09%09%09%09
 grunt.wa
@@ -662,51 +662,42 @@
 r);%0A
-          return;%0A        %7D
+%09%09%09%09%09%09return;%0A%09%09%09%09%09%7D 
 else
+ 
 %7B%0A
-          
+%09%09%09%09%09%09
 grun
@@ -718,9 +718,11 @@
 '%5Ct'
-+
+ + 
 appP
@@ -731,54 +731,125 @@
 h);%0A
-        %7D%0A        done();%0A      %7D);%0A    %7D);   
+%09%09%09%09%09%7D%0A%09%09%09%09%09done();%0A%09%09%09%09%7D);%0A%09%09%09%7D);%0A%09%09%7D catch (err) %7B%0A%09%09%09grunt.fatal(err instanceof Error ? err : new Error(err));%0A%09%09%7D
 %0A%09%7D)
@@ -853,9 +853,8 @@
 %09%7D);%0A%7D;%0A
-%0A

Update electron-plus.js