a2r
Version:
A2R Framework
31 lines (30 loc) • 1.2 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const path_1 = __importDefault(require("path"));
const fs_1 = require("@a2r/fs");
/**
* Copies project contents to docker avoiding `node_modules` folder
* @param srcPath Source path
* @param dockerName Docker name
* @param dockerWorkingPath Docker working path
*/
const copyProjectContentsToPath = async (srcPath, destPath) => {
const files = await (0, fs_1.readDir)(srcPath, { withFileTypes: true });
await Promise.all(files
.filter((file) => file.name !== 'node_modules')
.map(async (file) => {
const fullSrcPath = path_1.default.resolve(srcPath, file.name);
const fullDestPath = path_1.default.resolve(destPath, file.name);
if (file.isDirectory()) {
await (0, fs_1.ensureDir)(fullDestPath);
await (0, fs_1.copyContents)(fullSrcPath, fullDestPath);
}
else {
await (0, fs_1.copyFile)(fullSrcPath, fullDestPath);
}
}));
};
exports.default = copyProjectContentsToPath;