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