-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathindex.js
More file actions
26 lines (19 loc) · 772 Bytes
/
index.js
File metadata and controls
26 lines (19 loc) · 772 Bytes
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
require('dotenv').config();
const Sourcebit = require('./lib/sourcebit');
module.exports.fetch = (config, runtimeParameters, transformCallback) => {
if (!config) {
throw new Error('ERROR: Could not find a valid `sourcebit.js` configuration file.');
}
if (typeof runtimeParameters === 'function') {
transformCallback = runtimeParameters;
runtimeParameters = {};
}
const instance = new Sourcebit({ runtimeParameters, transformCallback });
const { plugins = [] } = config;
instance.loadPlugins(plugins);
const transformData = instance.bootstrapAll().then(() => instance.transform());
if (typeof transformCallback !== 'function') {
return transformData;
}
};
module.exports.Sourcebit = Sourcebit;