UNPKG

ts-node-builder

Version:
38 lines 1.01 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const shell = require("shelljs"); const fs_1 = require("fs"); /** * @description apply the copy array using the copy function * @param arr */ function copyArray(arr) { for (let copyOp of arr) { copy(copyOp.from, copyOp.to); } } exports.copyArray = copyArray; /** * @description function that copy files or folders and take the from path and the toPath * @param fromPath * @param toPath */ function copy(fromPath, toPath) { // validate file paths if (!isValidPath(fromPath)) return console.error(`Path "${fromPath}" does not exist`); if (!isValidPath(toPath)) shell.mkdir('-p', toPath); shell.cp('-ru', fromPath, toPath); } exports.copy = copy; /** * @description function that validate that file or folder actually exists * @param path */ function isValidPath(path) { if (!fs_1.existsSync(path)) return false; return true; } //# sourceMappingURL=copy.js.map