Files: fadded1d36d0afdf3d2d5097b49c26f69165e376 / main.js
1981 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 | // hackyArt: require('patchbay-hacky-art'), // TODO rework this to be in alignment with values |
40 | inbox: require('patch-inbox'), // TODO needs work |
41 | chess: require('ssb-chess-mithril'), |
42 | book: require('patchbay-book'), |
43 | gatherings: require('patchbay-gatherings') |
44 | } |
45 | |
46 | module.exports = { |
47 | plugins, |
48 | patchbay, |
49 | patchcore |
50 | } |
51 | |
52 | // for electro[n] |
53 | if (typeof window !== 'undefined' && !module.parent.parent) { |
54 | // TODO spin up settings check which modules are wanted |
55 | const args = [ ...values(plugins), patchbay, patchcore ] |
56 | // plugings loaded first will over-ride core modules loaded later |
57 | const sockets = combine.apply(null, args) |
58 | |
59 | const api = entry(sockets, nest('app.html.app', 'first')) |
60 | document.body.appendChild(api.app.html.app()) |
61 | } |
62 |
Built with git-ssb-web