Commit c27d9c765e55088d4fd855d29313c20839bb982c
Merge pull request #78 from ticktackim/STARTUP_ENV
add STARTUP_* env to make development quickermix 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.md | changed |
app/html/app.js | changed |
package.json | changed |
README.md | ||
---|---|---|
@@ -16,20 +16,15 @@ | ||
16 | 16 | ``` |
17 | 17 | |
18 | 18 | ### App env |
19 | 19 | |
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): | |
21 | 21 | |
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 | - | |
27 | 22 | 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` | |
29 | 24 | |
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): | |
32 | 27 | |
33 | 28 | ```json |
34 | 29 | { |
35 | 30 | "plugins": { |
@@ -43,8 +38,24 @@ | ||
43 | 38 | "autoinvite": "128.199.132.182:43750:@7xMrWP8708+LDvaJrRMRQJEixWYp4Oipa9ohqY7+NyQ=.ed25519~YC4ZnjHH8qzsyHe2sihW8WDlhxSUH33IthOi4EsldwQ=" |
44 | 39 | } |
45 | 40 | ``` |
46 | 41 | |
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 | + | |
47 | 58 | ### Translations |
48 | 59 | |
49 | 60 | Theses are in `/translations`. |
50 | 61 | 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.js | ||
---|---|---|
@@ -46,16 +46,18 @@ | ||
46 | 46 | |
47 | 47 | function startApp () { |
48 | 48 | api.history.sync.push({page: 'splash'}) |
49 | 49 | |
50 | - setTimeout(enterApp, 2000) | |
50 | + const delay = process.env.STARTUP_DELAY || 2000 | |
51 | + setTimeout(enterApp, delay) | |
51 | 52 | } |
52 | 53 | |
53 | 54 | function enterApp() { |
54 | 55 | const isOnboarded = api.settings.sync.get('onboarded') |
56 | + const initialPage = process.env.STARTUP_PAGE || 'blogIndex' | |
55 | 57 | if (isOnboarded) { |
56 | 58 | autoPub() |
57 | - api.history.sync.push({page: 'blogIndex'}) | |
59 | + api.history.sync.push({page: initialPage}) | |
58 | 60 | } |
59 | 61 | else { |
60 | 62 | api.history.sync.push({ |
61 | 63 | page:'userEdit', |
@@ -66,9 +68,9 @@ | ||
66 | 68 | // if they clicked something, just mark them onboarded |
67 | 69 | api.settings.sync.set({ onboarded: true }) |
68 | 70 | |
69 | 71 | autoPub() |
70 | - api.history.sync.push({ page: 'blogIndex' }) | |
72 | + api.history.sync.push({page: initialPage}) | |
71 | 73 | } |
72 | 74 | }) |
73 | 75 | } |
74 | 76 |
package.json | ||
---|---|---|
@@ -5,9 +5,10 @@ | ||
5 | 5 | "main": "index.js", |
6 | 6 | "scripts": { |
7 | 7 | "rebuild": "cross-script npm rebuild --runtime=electron \"--target=$(electron -v)\" \"--abi=$(electron --abi)\" --disturl=https://atom.io/download/atom-shell", |
8 | 8 | "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", | |
10 | 11 | "postinstall": "echo 'REMEMBER: npm run rebuild'", |
11 | 12 | "test": "npm run test:deps", |
12 | 13 | "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", |
13 | 14 | "test:i18n": "node translations/checker.js" |
Built with git-ssb-web