'use strict';

var fs = require('fs');
var path = require('path');

function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }

var fs__default = /*#__PURE__*/_interopDefault(fs);
var path__default = /*#__PURE__*/_interopDefault(path);

function copyDir(srcDir, destDir) {
  fs__default.default.mkdirSync(destDir, { recursive: true });
  for (const file of fs__default.default.readdirSync(srcDir)) {
    const srcFile = path__default.default.resolve(srcDir, file);
    if (srcFile === destDir) {
      continue;
    }
    const destFile = path__default.default.resolve(destDir, file);
    const stat = fs__default.default.statSync(srcFile);
    if (stat.isDirectory()) {
      copyDir(srcFile, destFile);
    } else {
      fs__default.default.copyFileSync(srcFile, destFile);
    }
  }
}

exports.copyDir = copyDir;
