blob: 0da0b8909bf4b03863d9ea559619347b2ee8f9d9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
/* eslint-disable no-console */
const fs = require('fs');
const path = require('path');
const sh = require('shelljs');
const files = sh.find(path.join(__dirname, '..', 'sandbox', '**', '*.*'))
.filter((filepath) => path.extname(filepath) === '.example');
const changes = files.map(function(filepath) {
const p = path.parse(filepath);
const nonExample = path.join(p.dir, p.name);
return {
file: filepath,
copy: nonExample
};
}).filter(function(change) {
return !fs.existsSync(change.copy);
});
changes.forEach(function(change) {
fs.copyFileSync(change.file, change.copy);
});
if (changes.length) {
console.log('Updated Sandbox files for:');
console.log('\t' + changes.map((chg) => chg.copy).join('\n\t'));
} else {
console.log('No sandbox updates necessary');
}
|