forked from iiyo/WebStory-Engine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy.js
66 lines (50 loc) · 1.23 KB
/
deploy.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
var fs, processScriptsFileFn, concatJsFiles, scriptsFilePath;
fs = require('fs');
scriptsFilePath = 'scripts.json';
processScriptsFileFn = function (data)
{
var json;
try
{
json = JSON.parse(data);
}
catch (e)
{
console.log('Parsing file ' + scriptsFilePath + ' as JSON failed!');
console.log('Error was:' + e);
return;
}
concatJsFiles(json.files);
};
concatJsFiles = function (fileNames)
{
var fn, concatFile, len;
concatFile = '';
len = fileNames.length;
fn = function (path, i)
{
var concFn;
concFn = function (data)
{
concatFile += "\n\n" + data;
};
concFn(fs.readFileSync('./' + path, 'utf-8'));
};
fileNames.forEach(fn);
writeFileFn(concatFile);
};
writeFileFn = function (concatFile)
{
var errFn;
errFn = function (err)
{
if (err)
{
console.log(err);
return;
}
console.log('WebStory Engine file created.');
};
fs.writeFile('./releases/current/WebStoryEngine.js', concatFile, errFn);
};
processScriptsFileFn(fs.readFileSync(scriptsFilePath, 'utf-8'));