INNER CODE UNIT · JavaScript

removeFileDirectoryRecursively

mmazzarolo/react-native-modal-datetime-picker · scripts/examples_postinstall.js:33

const removeFileDirectoryRecursively = (fileDirPath) => {
  // Remove file
  if (!fs.lstatSync(fileDirPath).isDirectory()) {
    fs.unlinkSync(fileDirPath);
    return;
  }

  // Go down the directory an remove each file / directory recursively
  fs.readdirSync(fileDirPath).forEach((entry) => {
    const entryPath = path.join(fileDirPath, entry);
    removeFileDirectoryRecursively(entryPath);
  });
  fs.rmdirSync(fileDirPath);
};

/// Remove example/node_modules/react-native-library-name/node_modules directory
const removeLibraryNodeModulesPath = (nodeModulesPath) => {
  if (!fs.existsSync(nodeModulesPath)) {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…