UNPKG

make-pesto

Version:

Pesto is a command-line tool to assist in creating Node.js packages. 🔪🌿

1 lines • 1.19 kB
Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"preparePath",{enumerable:true,get:function(){return preparePath}});const _fs=require("fs");const _runscript=require("./run-script");function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value}catch(error){reject(error);return}if(info.done){resolve(value)}else{Promise.resolve(value).then(_next,_throw)}}function _async_to_generator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value)}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err)}_next(undefined)})}}function preparePath(projectPath){return _preparePath.apply(this,arguments)}function _preparePath(){_preparePath=_async_to_generator(function*(projectPath){const folderExist=(0,_fs.existsSync)(projectPath);try{if(!folderExist){(0,_fs.mkdirSync)(projectPath)}else{yield(0,_runscript.runScript)(`rm -rf ${projectPath}/*`)}}catch(err){throw new Error(err)}});return _preparePath.apply(this,arguments)}