Files: a601d157ddcecfcae2a4c1f3088109dbe87ed7e8 / main.js
1740 bytesRaw
1 | const combine = require('depject') |
2 | const entry = require('depject/entry') |
3 | const nest = require('depnest') |
4 | const bulk = require('bulk-require') |
5 | |
6 | // polyfills |
7 | require('setimmediate') |
8 | |
9 | const patchcore = require('patchcore') |
10 | delete patchcore.patchcore.message.html.action.reply |
11 | // prune an action we don't want |
12 | |
13 | const patchbay = { |
14 | patchbay: { |
15 | about: bulk(__dirname, [ 'about/**/*.js' ]), |
16 | app: bulk(__dirname, [ 'app/**/*.js' ]), |
17 | blob: bulk(__dirname, [ 'blob/**/*.js' ]), |
18 | channel: bulk(__dirname, [ 'channel/**/*.js' ]), |
19 | contact: bulk(__dirname, [ 'contact/**/*.js' ]), |
20 | message: bulk(__dirname, [ 'message/**/*.js' ]), |
21 | router: bulk(__dirname, [ 'router/**/*.js' ]), |
22 | styles: bulk(__dirname, [ 'styles/**/*.js' ]), |
23 | sbot: bulk(__dirname, [ 'sbot/**/*.js' ]), |
24 | |
25 | config: require('./config'), // shouldn't be in here ? |
26 | contextMenu: require('patch-context'), |
27 | suggestions: require('patch-suggest'), |
28 | settings: require('patch-settings'), |
29 | drafts: require('patch-drafts'), |
30 | history: require('patch-history') |
31 | } |
32 | } |
33 | module.exports = patchbay |
34 | |
35 | // for electro[n] |
36 | if (typeof window !== 'undefined') { |
37 | // TODO spin up settings check which modules are wanted |
38 | const plugins = [ |
39 | require('patchbay-scry'), |
40 | require('patchbay-dark-crystal'), |
41 | require('patchbay-poll'), |
42 | require('patch-inbox'), // TODO needs work |
43 | require('ssb-chess-mithril'), |
44 | require('patchbay-book'), |
45 | require('patchbay-gatherings') |
46 | ] |
47 | const args = [ ...plugins, patchbay, patchcore ] |
48 | // plugings loaded first will over-ride core modules loaded later |
49 | const sockets = combine.apply(null, args) |
50 | |
51 | const api = entry(sockets, nest('app.html.app', 'first')) |
52 | document.body.appendChild(api.app.html.app()) |
53 | } |
54 |
Built with git-ssb-web