Skip to content

Commit 723ea77

Browse files
committed
feat: now exposed as robo-config plugin
1 parent 73c6687 commit 723ea77

39 files changed

+1255
-200
lines changed

.eslintignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
src/plugin/tasks/*/**/*.js
2+
test/projects/*/**/*.js

.gitignore

-3
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,3 @@ lib/
8989
# ----------------------------------------
9090

9191
/test/lambda/env.recording.yml
92-
/config
93-
!/config/example.yml
94-
/.serverless

.structignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
test/projects/assorted/@default/test/index.spec.js

config/example.yml

-6
This file was deleted.

package.json

+7-7
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,8 @@
4949
"lodash.defaults": "4.2.0",
5050
"lodash.difference": "4.5.0",
5151
"lodash.get": "4.4.2",
52-
"optimist": "0.6.1",
5352
"request": "2.88.0",
54-
"request-promise": "4.2.4",
55-
"yaml-boost": "1.9.14"
53+
"request-promise": "4.2.4"
5654
},
5755
"devDependencies": {
5856
"@babel/cli": "7.5.5",
@@ -61,10 +59,10 @@
6159
"@babel/register": "7.5.5",
6260
"@blackflux/eslint-plugin-rules": "1.3.7",
6361
"@blackflux/robo-config-plugin": "2.5.13",
64-
"babel-eslint": "10.0.2",
62+
"babel-eslint": "10.0.3",
6563
"chai": "4.2.0",
6664
"coveralls": "3.0.6",
67-
"eslint": "6.2.1",
65+
"eslint": "6.2.2",
6866
"eslint-config-airbnb-base": "14.0.0",
6967
"eslint-plugin-import": "2.18.2",
7068
"eslint-plugin-json": "1.4.0",
@@ -74,8 +72,9 @@
7472
"lambda-tdd": "2.9.13",
7573
"mocha": "6.2.0",
7674
"nock": "v11.3.2",
77-
"node-tdd": "2.2.0",
75+
"node-tdd": "2.2.4",
7876
"nyc": "14.1.1",
77+
"robo-config": "3.3.0",
7978
"semantic-release": "15.13.24"
8079
},
8180
"licenses": [
@@ -108,7 +107,8 @@
108107
"node_modules/*",
109108
"coverage/*",
110109
"lib/*",
111-
"serverless.js"
110+
"src/plugin/tasks/**",
111+
"test/projects/**"
112112
],
113113
"reporter": [
114114
"lcov",

serverless.js

-5
This file was deleted.

src/handler.js

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
const get = require('lodash.get');
2+
const rollbar = require('lambda-rollbar')({
3+
verbose: process.env.VERBOSE === '1',
4+
accessToken: process.env.ROLLBAR_ACCESS_TOKEN,
5+
environment: process.env.ENVIRONMENT,
6+
enabled: process.env.ROLLBAR_ACCESS_TOKEN !== undefined,
7+
reportLevel: get(process.env, 'ROLLBAR_REPORT_LEVEL', 'WARNING').toLowerCase(),
8+
template: 'aws-cloud-watch'
9+
});
10+
const processLogs = require('./logic/process-logs');
11+
const subscribe = require('./logic/subscribe');
12+
const setRetention = require('./logic/set-retention');
13+
const emptyBucket = require('./logic/empty-bucket');
14+
15+
const callbackify = (fn) => (event, context, rb) => new Promise((resolve, reject) => fn(
16+
event,
17+
context,
18+
(err, resp) => (err ? reject(err) : resolve(resp)),
19+
rb
20+
));
21+
22+
module.exports.processLogs = rollbar.wrap(callbackify(processLogs));
23+
module.exports.subscribe = rollbar.wrap(callbackify(subscribe));
24+
module.exports.setRetention = rollbar.wrap(callbackify(setRetention));
25+
module.exports.emptyBucket = rollbar.wrap(callbackify(emptyBucket));

src/index.js

+11-24
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,12 @@
1-
const get = require('lodash.get');
2-
const rollbar = require('lambda-rollbar')({
3-
verbose: process.env.VERBOSE === '1',
4-
accessToken: process.env.ROLLBAR_ACCESS_TOKEN,
5-
environment: process.env.ENVIRONMENT,
6-
enabled: process.env.ROLLBAR_ACCESS_TOKEN !== undefined,
7-
reportLevel: get(process.env, 'ROLLBAR_REPORT_LEVEL', 'WARNING').toLowerCase(),
8-
template: 'aws-cloud-watch'
9-
});
10-
const processLogs = require('./logic/process-logs');
11-
const subscribe = require('./logic/subscribe');
12-
const setRetention = require('./logic/set-retention');
13-
const emptyBucket = require('./logic/empty-bucket');
14-
15-
const callbackify = (fn) => (event, context, rb) => new Promise((resolve, reject) => fn(
16-
event,
17-
context,
18-
(err, resp) => (err ? reject(err) : resolve(resp)),
19-
rb
20-
));
1+
const path = require('path');
2+
const handler = require('./handler');
213

22-
module.exports.processLogs = rollbar.wrap(callbackify(processLogs));
23-
module.exports.subscribe = rollbar.wrap(callbackify(subscribe));
24-
module.exports.setRetention = rollbar.wrap(callbackify(setRetention));
25-
module.exports.emptyBucket = rollbar.wrap(callbackify(emptyBucket));
4+
module.exports = ({
5+
name: '@blackflux/robo-config-plugin',
6+
taskDir: path.join(__dirname, 'plugin', 'tasks'),
7+
reqDir: path.join(__dirname, 'plugin', 'reqs'),
8+
varDir: path.join(__dirname, 'plugin', 'vars'),
9+
targetDir: path.join(__dirname, 'plugin', 'targets'),
10+
docDir: path.join(__dirname, 'plugin', 'docs'),
11+
exports: handler
12+
});

0 commit comments

Comments
 (0)