-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
33 lines (24 loc) · 891 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
'use strict';
const path = require('path');
const fs = require('fs');
const { WatchedDir } = require('broccoli-source');
var mergeTrees = require('broccoli-merge-trees');
const Funnel = require('broccoli-funnel');
const { BuildWorkers } = require('./broccoli-plugins/build-workers');
module.exports = {
name: require('./package').name,
treeForPublic() {
const workersDir = path.join(this.parent.root, 'workers');
let trees = [];
if (fs.existsSync(workersDir)) {
// 1. Watch workers dir
let workerTree = new WatchedDir(workersDir);
// 2. Do something witht his tree > name/index.ts to name.js
workerTree = new BuildWorkers([workerTree]);
// 3. Make it output to dist/workers
workerTree = new Funnel(workerTree, { destDir: 'workers' });
trees.push(workerTree);
}
return mergeTrees(trees, { overwrite: true });
},
};