[refactor] [s]: update copy methods

This commit is contained in:
Thadeu Cotts 2020-11-26 15:00:41 -03:00
parent 1dd149f995
commit 84d341a91f

View File

@ -2,17 +2,17 @@ const path = require("path");
const fs = require('fs');
const spawn = require('cross-spawn');
function _parserPath(projectPath){
function parserPath(projectPath){
return [process.cwd(), projectPath].join(path.sep)
}
function copy(root,destination){
const destinationPath = _parserPath(destination)
const destinationPath = parserPath(destination)
return spawn.sync('cp', ['-r', root, destinationPath]);
}
function isPathInUse(projectPath){
const fullPath = _parserPath(projectPath)
const fullPath = parserPath(projectPath)
const isPathExists = fs.existsSync(fullPath)
if(isPathExists) {
return fs.readdirSync(fullPath).length
@ -20,4 +20,4 @@ function isPathInUse(projectPath){
return isPathExists
}
module.exports = { copy, isPathInUse }
module.exports = { parserPath, copy, isPathInUse }