-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathclean.js
32 lines (25 loc) · 892 Bytes
/
clean.js
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
32
import shelljs from 'shelljs';
shelljs.config.silent = true;
const leaveIndex = (dir, basePath = 'src/pages/docs/') => {
// remove everything but leave dir's index.js/index.less
const fullPath = basePath + dir;
const entries = shelljs.ls('-d', fullPath + '/*');
const matchIndex = new RegExp(`${fullPath}/index\\.(js|(module\\.)?less)`);
entries.forEach(entry => {
if (!matchIndex.test(entry)) {
shelljs.rm('-r', entry);
}
});
};
leaveIndex('modules');
leaveIndex('developer-guide');
leaveIndex('developer-tools');
// Remove the data (parsed content) output directory
shelljs.rm('-r', 'data');
// Remove the public output directory
shelljs.rm('-r', 'public');
// Remove the sample runner
shelljs.rm('-r', 'static/*-runner');
// Remove theme icons
shelljs.rm('-r', 'static/*.svg');
console.log('Clean, with `raw` directory left intact.'); // eslint-disable-line no-console