forked from phaserjs/examples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.js
More file actions
33 lines (24 loc) · 686 Bytes
/
build.js
File metadata and controls
33 lines (24 loc) · 686 Bytes
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
33
var fs = require('fs');
var dirTree = require('directory-tree');
var indexer = require('./search/index-documents');
var rootDir = './public/src/';
var examplesJSON = './public/examples.json';
var filteredTree = dirTree(rootDir, {
extensions: /\.(js|json)$/,
exclude: /(3\.24)/
});
indexer.index(filteredTree);
filteredTree = JSON.stringify(filteredTree, null, 2);
filteredTree = filteredTree.replace(/public\//g, '');
filteredTree = filteredTree.replace(/public\\\\/g, '');
// Save the JSON
fs.writeFile(examplesJSON, filteredTree, function (error) {
if (error)
{
throw error;
}
else
{
console.log('examples.json saved');
}
});