git ssb

2+

mixmix / ticktack



Commit c27d9c765e55088d4fd855d29313c20839bb982c

Merge pull request #78 from ticktackim/STARTUP_ENV

add STARTUP_* env to make development quicker
mix irving authored on 1/24/2018, 9:16:29 PM
GitHub committed on 1/24/2018, 9:16:29 PM
Parent: ff085910be38e1563594bc54a5493521ef9128ed
Parent: b94fcfc813d82eea5f878455932ac4e3ebf5898d

Files changed

README.mdchanged
app/html/app.jschanged
package.jsonchanged
README.mdView
@@ -16,20 +16,15 @@
1616 ```
1717
1818 ### App env
1919
20-To run **development** setup with standard ssb key + network :
20+To run a **embedded sbot** setup (recomended - this is how the installer will run):
2121
22-1. start you sbot `$ sbot server`
23-2. run `$ npm run dev` in the repo directory
24-
25-To run a **production** setup:
26-
2722 1. run `npm start`
28-2. to debug sbot from terminal, run `$ ssb_appname=ticktack sbot whoami`
23+2. to debug sbot from terminal, run `$ sbot whoami` or `$ sbot progress`
2924
30-**Note** you'll need a `~/.ticktack/config` file to be able to do (2).
31-It should have the plugins you're using and a copy of the content of default-config.json, so will look something like:
25+**Note** you'll need a `~/.ssb/config` file to be able to do (2).
26+It should have the plugins you're using and a copy of the content of `default-config.json`, so will look something like (this example may be out of date, as we're no longer running a private network):
3227
3328 ```json
3429 {
3530 "plugins": {
@@ -43,8 +38,24 @@
4338 "autoinvite": "128.199.132.182:43750:@7xMrWP8708+LDvaJrRMRQJEixWYp4Oipa9ohqY7+NyQ=.ed25519~YC4ZnjHH8qzsyHe2sihW8WDlhxSUH33IthOi4EsldwQ="
4439 }
4540 ```
4641
42+There are a couple of ENV vars made available to make development easier:
43+```
44+$ STARTUP_DELAY=0 STARTUP_PAGE=addressBook npm start
45+```
46+`STARTUP_DELAY` - defaults to `2000`ms, setting it to 0 skips the splash screen pause
47+`STARTUP_PAGE` - defaults to `blogIndex`, setting this to another page makes refreshing the app to a particular named page easy.
48+
49+
50+To run **standalone sbot** setup with standard ssb key + network :
51+
52+1. start you sbot `$ sbot server`
53+2. run `$ npm run start-electro` in the repo directory
54+
55+Remember that you will need the right sbot plugins installed on your global sbot.
56+
57+
4758 ### Translations
4859
4960 Theses are in `/translations`.
5061 There's a helper script in there called `checker.js` which looks for translations in `en` (english) that are missing from `zh` (mandarin).
app/html/app.jsView
@@ -46,16 +46,18 @@
4646
4747 function startApp () {
4848 api.history.sync.push({page: 'splash'})
4949
50- setTimeout(enterApp, 2000)
50+ const delay = process.env.STARTUP_DELAY || 2000
51+ setTimeout(enterApp, delay)
5152 }
5253
5354 function enterApp() {
5455 const isOnboarded = api.settings.sync.get('onboarded')
56+ const initialPage = process.env.STARTUP_PAGE || 'blogIndex'
5557 if (isOnboarded) {
5658 autoPub()
57- api.history.sync.push({page: 'blogIndex'})
59+ api.history.sync.push({page: initialPage})
5860 }
5961 else {
6062 api.history.sync.push({
6163 page:'userEdit',
@@ -66,9 +68,9 @@
6668 // if they clicked something, just mark them onboarded
6769 api.settings.sync.set({ onboarded: true })
6870
6971 autoPub()
70- api.history.sync.push({ page: 'blogIndex' })
72+ api.history.sync.push({page: initialPage})
7173 }
7274 })
7375 }
7476
package.jsonView
@@ -5,9 +5,10 @@
55 "main": "index.js",
66 "scripts": {
77 "rebuild": "cross-script npm rebuild --runtime=electron \"--target=$(electron -v)\" \"--abi=$(electron --abi)\" --disturl=https://atom.io/download/atom-shell",
88 "start": "electron .",
9- "dev": "ssb_appname=ssb electro main.js",
9+ "start-dev": "STARTUP_DELAY=0 electron .",
10+ "start-electro": "ssb_appname=ssb electro main.js",
1011 "postinstall": "echo 'REMEMBER: npm run rebuild'",
1112 "test": "npm run test:deps",
1213 "test:deps": "dependency-check package.json --entry main.js --entry background-process.js && dependency-check package.json --entry main.js --entry background-process.js --extra --no-dev",
1314 "test:i18n": "node translations/checker.js"

Built with git-ssb-web