| Conditions | 1 |
| Paths | 64 |
| Total Lines | 30 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | import fse from 'fs-extra' |
||
| 30 | Array.prototype.forEach.call(publicFolders, (publicFolder) => { |
||
| 31 | var res = dircompare.compareSync(publicFolder, dest, {compareSize: true}) |
||
| 32 | |||
| 33 | res.diffSet.forEach(function (entry) { |
||
| 34 | var state = { |
||
| 35 | 'equal' : '==', |
||
| 36 | 'left' : '->', |
||
| 37 | 'right' : '<-', |
||
| 38 | 'distinct' : '<>' |
||
| 39 | }[entry.state] |
||
| 40 | |||
| 41 | var name1 = entry.name1 ? entry.name1 : '' |
||
| 42 | var name2 = entry.name2 ? entry.name2 : '' |
||
| 43 | |||
| 44 | let exclude = new RegExp(config.files.exclude) |
||
| 45 | if(!exclude.test(name1) && !exclude.test(name2) && entry.type1 !== 'directory' && entry.type2 !== 'directory') { |
||
| 46 | |||
| 47 | if(typeof entry.path1 !== 'undefined' && entry.path1 !== null) { |
||
| 48 | var original = entry.path1 |
||
| 49 | var basePath = original.replace(publicFolder, '') |
||
| 50 | var move = path.join(dest, basePath) |
||
| 51 | |||
| 52 | if(entry.type2 === 'missing' || entry.state === 'distinct') { |
||
| 53 | fse.removeSync(move) |
||
| 54 | fse.copySync(original, move) |
||
| 55 | } |
||
| 56 | } |
||
| 57 | } |
||
| 58 | }) |
||
| 59 | }) |
||
| 60 | |||
| 62 | } |