Files: 4e7982f745d702f29aca19ba8c0f9eb788c82493 / main.js
1831 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 patchbay = { |
10 | patchbay: { |
11 | about: bulk(__dirname, [ 'about/**/*.js' ]), |
12 | app: bulk(__dirname, [ 'app/**/*.js' ]), |
13 | blob: bulk(__dirname, [ 'blob/**/*.js' ]), |
14 | channel: bulk(__dirname, [ 'channel/**/*.js' ]), |
15 | contact: bulk(__dirname, [ 'contact/**/*.js' ]), |
16 | message: bulk(__dirname, [ 'message/**/*.js' ]), |
17 | router: bulk(__dirname, [ 'router/**/*.js' ]), |
18 | styles: bulk(__dirname, [ 'styles/**/*.js' ]), |
19 | sbot: bulk(__dirname, [ 'sbot/**/*.js' ]), |
20 | |
21 | config: require('./config'), // shouldn't be in here ? |
22 | contextMenu: require('patch-context'), |
23 | suggestions: require('patch-suggest'), |
24 | settings: require('patch-settings'), |
25 | drafts: require('patch-drafts'), |
26 | inbox: require('patch-inbox'), // TODO - ideally this would be a standalone patch-* module |
27 | history: require('patch-history') |
28 | } |
29 | } |
30 | |
31 | const post = { |
32 | patchbay: { |
33 | message: bulk(__dirname, [ 'post-patchcore/message/**/*.js' ]) |
34 | } |
35 | } |
36 | |
37 | // from more specialized to more general |
38 | const sockets = combine( |
39 | require('patchbay-scry'), |
40 | require('patchbay-dark-crystal'), |
41 | require('patchbay-poll'), |
42 | require('ssb-chess'), |
43 | require('patchbay-gatherings'), |
44 | require('patchbay-book'), |
45 | patchbay, |
46 | require('patchcore'), |
47 | post |
48 | ) |
49 | |
50 | // remove patchcore reply for our version |
51 | var pcReplyIndex = sockets.message.html.action.findIndex(x => x.name === 'reply') |
52 | if (pcReplyIndex !== -1) { delete sockets.message.html.action[pcReplyIndex] } |
53 | |
54 | const api = entry(sockets, nest('app.html.app', 'first')) |
55 | const app = api.app.html.app |
56 | |
57 | module.exports = patchbay |
58 | |
59 | // for electro[n] |
60 | if (typeof window !== 'undefined') { |
61 | document.body.appendChild(app()) |
62 | } |
63 |
Built with git-ssb-web