-
Notifications
You must be signed in to change notification settings - Fork 2
/
index-builder.js
47 lines (35 loc) · 1.02 KB
/
index-builder.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
var fs = require('fs');
var validatorData,
errorBagData;
/*
* This is a ugly mess.
* Todo: Fix later
*/
fs.readFile('src/Validator.js', 'utf8', function (err, data) {
if (err) {
return console.log(err);
}
data = data.replace('export default {Validator};', '');
data = data.replace('export {Validator};', '');
validatorData = data;
fs.readFile('src/ErrorBag.js', 'utf8', function (err, data) {
if (err) {
return console.log(err);
}
data = data.replace('export default {ErrorBag};', '');
data = data.replace('export {ErrorBag};', '');
errorBagData = data;
//var result = "require('unfetch/polyfill');\n";
var result = "";
fs.readFile('src/FormSpine.js', 'utf8', function (err, data) {
if (err) {
return console.log(err);
}
result += data.replace('import Validator from "./Validator";', validatorData)
.replace('import ErrorBag from "./ErrorBag";', errorBagData);
fs.writeFile('src/index.js', result, 'utf8', function (err) {
if (err) return console.log(err);
});
});
});
});