-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
53 lines (30 loc) · 1.35 KB
/
app.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
require('events').EventEmitter.prototype._maxListeners = 0;
require('events').EventEmitter.prototype._maxListeners = 0;
require('events').EventEmitter.defaultMaxListeners = 0
const createCsvWriter = require('csv-writer').createArrayCsvWriter;
let name = process.argv[2];
//name = "dewalt";
(async () => {
const start= new Date().getTime();
let sheet = await require("./source/model/google_sheet")(name);
// muttable array (add own price)
sheet = await require("./source/model/own_price")(sheet);
// muttable array (add competitor price)
sheet = await require("./source/model/competitor_price")(sheet);
// muttable (add addition columns)
sheet = await require("./source/model/add_colums")(sheet);
//console.log( sheet );
//calc value
sheet = await require("./source/model/calculate")(sheet);
const createCsvWriter = require('csv-writer').createArrayCsvWriter;
const end = new Date().getTime();
let elapsed = parseInt( (end - start)/1000 ) ;
const endTime = new Date().getTime();
const csvWriter = createCsvWriter({
path: 'tmp/'+name+"-"+endTime+'.csv'
});
await csvWriter.writeRecords(sheet) // returns a promise
//Create EXCEL
excel = await require("./source/model/excel")(sheet, name);
file = await require("./source/model/email")(name, excel);
})();