-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
38 lines (31 loc) · 954 Bytes
/
index.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
import 'babel-polyfill';
import bluebird from 'bluebird';
import glob from 'glob';
import path from 'path';
import mkdirp from 'mkdirp';
import selenium from './selenium';
import chromedriver from './chromedriver';
import { unlink } from './util';
const globber = bluebird.promisify(glob);
const makeDir = bluebird.promisify(mkdirp);
/* eslint-disable no-console, func-names */
const ensure = async function(target) {
await makeDir(target);
console.log('Getting selenium');
await selenium(target);
console.log('Got selenium');
console.log('Getting chromedriver');
await chromedriver(target);
console.log('Got chromedriver');
};
const update = async function(target) {
const files = await globber(path.join(target, '**/*'));
await Promise.all(files.map(file => unlink(file)));
await ensure(target);
};
/* eslint-enable no-console, func-names */
const api = {
ensure,
update,
};
module.exports = api;