WordCards/.mvvc/removeDeprecated.js
// remove deprecated folders by src path and dist path
remove deprecated folders by src path and dist path
remove deprecated folders by src path and dist path
function removeDeprecatedFolders(srcRootPath, distRootPath) {
  const srcTree = dirTree(srcRootPath)
  const distTree = dirTree(distRootPath)
  if (!srcTree || !distTree) {
    return new Promise(resolve => resolve())
  }
  let promises = []
  distTree.children
    .filter(dist => dist.type === 'directory')
    .map(dist => {
      let exsit = srcTree.children
        .filter(src => src.name !== shareFolderName && src.type === 'directory')
        .some(src => src.name === dist.name)
      if (!exsit) {
        promises.push(new Promise((resolve, reject) => {
          try {
            del(dist.path).then(paths => {
              console.log('Files and folders were deleted:\n', paths.join('\n'))
              resolve(paths)
            })
          } catch (e) {
            console.log(e)
            reject(e)
          }
        }))
      }
    })
  return Promise.all(promises)
}
function removeDeprecatedFolders ( srcRootPath , distRootPath ) { const srcTree = dirTree ( srcRootPath ) const distTree = dirTree ( distRootPath ) if ( ! srcTree || ! distTree ) { return new Promise ( resolve => resolve ( ) ) } let promises = [ ] distTree . children . filter ( dist => dist . type === 'directory' ) . map ( dist => { let exsit = srcTree . children . filter ( src => src . name !== shareFolderName && src . type === 'directory' ) . some ( src => src . name === dist . name ) if ( ! exsit ) { promises . push ( new Promise ( ( resolve , reject ) => { try { del ( dist . path ) . then ( paths => { console . log ( 'Files and folders were deleted:\n' , paths . join ( '\n' ) ) resolve ( paths ) } ) } catch ( e ) { console . log ( e ) reject ( e ) } } ) ) } } ) return Promise . all ( promises ) }
remove deprecated folders by src path and dist path
remove deprecated folders by src path and dist path