tiro-notes 0.27.20 → 0.27.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli.js +2 -2
- package/package.json +1 -1
- package/shared.helpers.build.js +5 -3
package/cli.js
CHANGED
|
@@ -40,10 +40,10 @@ function startTiroServer (argsObj, cb) {
|
|
|
40
40
|
console.log(`Starting Tiro-Notes from CLI with following arguments : ${JSON.stringify(argsObj)}`);
|
|
41
41
|
|
|
42
42
|
// start tiro server, detect success message and get server params
|
|
43
|
-
tHelpers.execCmd('node', [`${__dirname}/
|
|
43
|
+
tHelpers.execCmd('node', [`${__dirname}/server/server.js`], {
|
|
44
44
|
env: { TIRO_PORT: argsObj.port },
|
|
45
45
|
onLog: str => {
|
|
46
|
-
tHelpers.checkAndGetTiroConfig({platform: 'cli'
|
|
46
|
+
tHelpers.checkAndGetTiroConfig(str, {platform: 'cli', cb})
|
|
47
47
|
}
|
|
48
48
|
})
|
|
49
49
|
}
|
package/package.json
CHANGED
package/shared.helpers.build.js
CHANGED
|
@@ -15,21 +15,23 @@ const whichLog = (p) => p.platform === 'electron' ? writeLog : console.log
|
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
let hasStarted = false
|
|
18
|
-
const checkAndGetTiroConfig = (
|
|
18
|
+
const checkAndGetTiroConfig = (str, p) => {
|
|
19
19
|
if (!p) p = {}
|
|
20
20
|
if (!p.platform) p.platform = false
|
|
21
|
+
if (!p.cb) p.cb = () => {}
|
|
21
22
|
const log = whichLog(p);
|
|
22
23
|
|
|
23
24
|
if ( !hasStarted) {
|
|
24
25
|
const successMessage = 'SERVER_LOAD_SUCCESS';
|
|
25
26
|
if (str.includes(successMessage)) {
|
|
26
27
|
hasStarted = true;
|
|
27
|
-
|
|
28
|
+
str = str.split(successMessage)[1]
|
|
29
|
+
log(`*** ${str} *** (server success message detected here)`);
|
|
28
30
|
try {
|
|
29
31
|
let objStr = str.match(/\{.*\}/gm);
|
|
30
32
|
let configServerObj = JSON.parse(objStr)
|
|
31
33
|
log(`server config loaded successfully: ${JSON.stringify(configServerObj)}`);
|
|
32
|
-
if (cb) cb(configServerObj);
|
|
34
|
+
if (p.cb) p.cb(configServerObj);
|
|
33
35
|
} catch(e){
|
|
34
36
|
log(`ERROR! could not get the server config ${JSON.stringify(e)}`)
|
|
35
37
|
}
|