Skip to content

Commit f33b61d

Browse files
committed
changes to work as standalone
1 parent ca24d6d commit f33b61d

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@
66
"test": "echo \"Error: no test specified\" && exit 1",
77
"standard": "node_modules/.bin/standard \"**.js\" --parser babel-eslint",
88
"standard:fix": "node_modules/.bin/standard \"**.js\" --parser babel-eslint --fix",
9-
"report:daily": "node src/daily_report.js",
10-
"report:monthly": "node src/daily_report.js"
9+
"report:daily": "node src/daily.js",
10+
"report:monthly": "node src/monthly.js"
1111
},
1212
"author": "",
1313
"license": "ISC",
1414
"dependencies": {
1515
"async": "3.1.0",
1616
"aws-sdk": "2.518.0",
17-
"csv-parse": "^4.11.1",
17+
"csv-parse": "4.11.1",
1818
"request": "2.87.0",
1919
"unzipper": "0.10.0"
2020
},

src/daily_report.js src/daily.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ acumDay = 0
2727
let parser = parse({
2828
delimiter: ','
2929
}, function (err, data) {
30-
if (err) callback(err)
30+
if (err) throw new Error(err)
3131

3232
let columnHeaders = common.getColumnPositions(data[0])
3333

src/monthly_report.js src/monthly.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ if (!process.env.SLACK_CHANNEL) throw new Error('Error running the report: SLACK
2323
if (!process.env.AWS_ACCOUNT_ID) throw new Error('Error running the report: AWS_ACCOUNT_ID envar not set')
2424

2525
let parser = parse({delimiter: ','}, function (err, data) {
26-
if (err) callback(err)
26+
if (err) throw new Error(err)
2727

2828
let columnHeaders = common.getColumnPositions(data[0])
2929

@@ -41,7 +41,7 @@ let parser = parse({delimiter: ','}, function (err, data) {
4141
let message = 'payload={"channel": "' + SLACK_CHANNEL + '", "username": "AWS Monthly Report", "text": "AWS cost report for ' + thisMonth + '\n```\n' + report + '\n```\nTotal Spent: `' + acumTotal.toFixed(2) + '`", "icon_emoji": ":aws:"}'
4242

4343
// Send to Slack
44-
common.slackNotify(message, callback)
44+
common.slackNotify(message)
4545
})
4646
})
4747

0 commit comments

Comments
 (0)