"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _fs = _interopRequireDefault(require("fs"));

var _path = _interopRequireDefault(require("path"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function iterateDir(srcPath, callback) {
  function iterate(srcPath) {
    if (_fs.default.existsSync(srcPath)) {
      _fs.default.readdirSync(srcPath).forEach(fileOrDir => {
        let fromPath = _path.default.join(srcPath, fileOrDir);

        if (_fs.default.statSync(fromPath).isDirectory()) {
          iterate(fromPath);
        } else {
          callback(fromPath);
        }
      });
    }
  }

  iterate(srcPath);
}

var _default = () => {
  let dependencyFolders = [_path.default.join(process.cwd(), 'node_modules', '@zohodesk', 'components', 'lib'), _path.default.join(process.cwd(), 'node_modules', '@zohodesk', 'dot', 'lib'), _path.default.join(process.cwd(), 'node_modules', '@zohodesk', 'icons', 'lib'), _path.default.join(process.cwd(), 'node_modules', '@zohodesk', 'svg', 'lib'), _path.default.join(process.cwd(), 'node_modules', '@zohodesk', 'variables', 'lib')];
  let pattern = /if.*\(false\)/g;
  dependencyFolders.forEach(componentsFolder => {
    iterateDir(componentsFolder, filepath => {
      let src = _fs.default.readFileSync(filepath).toString();

      if (pattern.test(src)) {
        src = src.replace(pattern, 'if (true)');

        _fs.default.writeFileSync(filepath, src);
      }
    });
  });
};

exports.default = _default;