tiro-notes 0.27.27 → 0.27.28

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 CHANGED
@@ -1,6 +1,8 @@
1
1
  #!/usr/bin/env node
2
- //const tHelpers = require('../shared.helpers.js'); // for dev purposes
3
- const tHelpers = require(`./shared.helpers.build.js`);
2
+ //const isDev = true
3
+ const isDev = false
4
+
5
+ const tHelpers = isDev ? require('../shared.helpers.js') : require(`./shared.helpers.build.js`);
4
6
 
5
7
  // open frontend on default browser
6
8
  const openInBrowser = (url) => {
@@ -52,12 +54,15 @@ function startTiroServer (argsObj, cb) {
52
54
  const startSshTunnel = (argsObj) => {
53
55
  if (argsObj.tunnel.enabled) {
54
56
  // kill previous autossh processes
57
+ let cb2 = true
55
58
  let cb1 = true
56
59
  tHelpers.execCmd('killall', [`autossh`], {
57
60
  logName:'tunnel 1/3',
58
- onDone: () => {
61
+ onLog: () => {
62
+ if (!cb2) return
63
+ cb2 = false
59
64
  // check if autossh is working
60
- tHelpers.execCmd('autossh', [`--help`], {
65
+ tHelpers.execCmd('autossh', [`-V`], {
61
66
  logName:'tunnel 2/3',
62
67
  onLog: str => {
63
68
  if (!cb1) return
@@ -93,6 +98,13 @@ function main () {
93
98
  })
94
99
  }
95
100
 
101
+ const test = () => {
102
+
103
+ var argsObj = getCliArgs();
104
+ startSshTunnel(argsObj);
105
+ }
106
+
107
+
96
108
  // start everything
97
- main();
109
+ isDev ? test() : main();
98
110
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tiro-notes",
3
- "version": "0.27.27",
3
+ "version": "0.27.28",
4
4
  "description": "Tiro Notes for CLI",
5
5
  "scripts": {
6
6
  "clean-previous-build": "rm -r node-build",
@@ -45,10 +45,10 @@ const execCmd = (cmd, params, p) => {
45
45
  if (!p) p = {}
46
46
  if (!p.env) p.env = {}
47
47
  if (!p.platform) p.platform = false
48
- p.logName = !p.logName ? '' : `${p.logName}`
48
+ p.logName = !p.logName ? '' : `${p.logName} `
49
49
  const log = whichLog(p);
50
50
 
51
- log(`ExecCMD ${JSON.stringify({cmd, params, p})}`);
51
+ log(`[${p.logName}] === ExecCMD ${JSON.stringify({cmd, params, p})}`);
52
52
 
53
53
  let child
54
54
  let spawn = require( 'child_process' ).spawn;
@@ -62,7 +62,8 @@ const execCmd = (cmd, params, p) => {
62
62
  });
63
63
  child.stderr.on( 'data', data => {
64
64
  const str = `[${p.logName} ${cmd} ERROR!] : ${data}`;
65
- log( str );
65
+ console.log( str );
66
+ if (p && p.onLog) p.onLog(str)
66
67
  });
67
68
  if (p && p.onDone) p.onDone()
68
69
  return child;