forked from furkleindustries/inklecate-node
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinklecate.js
37 lines (30 loc) · 917 Bytes
/
inklecate.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
const execute = require('./execute');
const { relative } = require('path');
module.exports = (args) => new Promise((resolve, reject) => {
if (!args) {
return reject('No args provided to inklecate method.');
}
const countAllVisits = Boolean(args.countAllVisits);
const outputFilepath = args.outputFilepath ?
relative(process.cwd(), args.outputFilepath) :
null;
const isCaching = Boolean(!outputFilepath);
const verbose = Boolean(args.verbose);
const DEBUG = Boolean(args.DEBUG);
const inputFilepath = relative(process.cwd(), args.inputFilepath);
if (!inputFilepath) {
return reject('No input filepath provided to inklecate-node\'s ' +
'inklecate method.');
}
const executeArgs = {
countAllVisits,
isCaching,
outputFilepath,
verbose,
DEBUG,
};
return execute({
...executeArgs,
inputFilepath,
}).then(resolve, reject);
});