Files
datahub/packages/create-portal-app/helpers/copy.js
2020-11-26 15:00:41 -03:00

23 lines
598 B
JavaScript

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