tiro-notes 0.27.29 → 0.27.34
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 +55 -15
- package/package.json +2 -2
- package/server/server.js +1 -1
- package/shared.helpers.build.js +2 -2
package/cli.js
CHANGED
|
@@ -1,9 +1,41 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
const isDev = false
|
|
2
|
+
|
|
3
|
+
// const isDev = false
|
|
4
|
+
const isDev = process.env.ISDEV
|
|
4
5
|
|
|
5
6
|
const tHelpers = isDev ? require('../shared.helpers.js') : require(`./shared.helpers.build.js`);
|
|
6
7
|
|
|
8
|
+
|
|
9
|
+
// CLI HELP MANUAL
|
|
10
|
+
const outputHelp = () => {
|
|
11
|
+
var p = require('./package.json');
|
|
12
|
+
const tiroHelpString = `
|
|
13
|
+
VERSION:
|
|
14
|
+
===
|
|
15
|
+
${p.name.toUpperCase()} v.${p.version} ${isDev ? '(**dev**)' : ''}
|
|
16
|
+
|
|
17
|
+
DESCRIPTION:
|
|
18
|
+
===
|
|
19
|
+
${p.description}
|
|
20
|
+
|
|
21
|
+
ARGS:
|
|
22
|
+
====
|
|
23
|
+
|
|
24
|
+
--https/-s : enable https ssl with self signed certificate (boolean, false by default)
|
|
25
|
+
--port/-p : port to use (number, 3023 by default)
|
|
26
|
+
--tunnel/-t : uses autossh to "publish" the app on the web, requires a server you can access with ssh and autossh installed on that device. (ex:npx tiro-notes@latest -t REMOTE_USER@REMOTE_URL:REMOTE_PORT)
|
|
27
|
+
--help/-h : help
|
|
28
|
+
|
|
29
|
+
EXAMPLES:
|
|
30
|
+
====
|
|
31
|
+
- npx tiro-notes
|
|
32
|
+
- npx tiro-notes --tunnel ubuntu@myserver.com:3023 --port 3033 --https true
|
|
33
|
+
- npx tiro-notes -t ubuntu@myserver.com:3023 -p 3033 -s true
|
|
34
|
+
`;
|
|
35
|
+
console.log(tiroHelpString);
|
|
36
|
+
|
|
37
|
+
}
|
|
38
|
+
|
|
7
39
|
// open frontend on default browser
|
|
8
40
|
const openInBrowser = (url) => {
|
|
9
41
|
var start = (process.platform == 'darwin'? 'open': process.platform == 'win32'? 'start': 'xdg-open');
|
|
@@ -16,18 +48,19 @@ function getCliArgs () {
|
|
|
16
48
|
var argsObj = {
|
|
17
49
|
port: 3023,
|
|
18
50
|
https: false,
|
|
51
|
+
help: false,
|
|
19
52
|
tunnel: {
|
|
20
53
|
enabled: false,
|
|
21
54
|
},
|
|
22
55
|
}
|
|
23
56
|
for (var i = 0; i < args.length; i++) {
|
|
24
57
|
if (i % 2 !== 0) continue
|
|
25
|
-
console.log(i);
|
|
26
58
|
var argName = args[i];
|
|
27
59
|
var argVal = args[i+1];
|
|
28
60
|
argName = argName.replace('--', '').replace('-','')
|
|
29
61
|
if (argName === 'p' || argName === 'port') argsObj.port = parseInt(argVal);
|
|
30
62
|
if (argName === 's' || argName === 'https') argsObj.https = true
|
|
63
|
+
if (argName === 'h' || argName === 'help') argsObj.help = true
|
|
31
64
|
if (argName === 't' || argName === 'tunnel') {
|
|
32
65
|
const argsArr = argVal.split(':')
|
|
33
66
|
if (argsArr.length > 1) {
|
|
@@ -88,28 +121,35 @@ function main () {
|
|
|
88
121
|
|
|
89
122
|
var argsObj = getCliArgs();
|
|
90
123
|
|
|
91
|
-
|
|
124
|
+
if (argsObj.help) {
|
|
92
125
|
|
|
93
|
-
|
|
94
|
-
const protocol = c.https ? 'https' : 'http'
|
|
95
|
-
const port = c.port
|
|
126
|
+
outputHelp();
|
|
96
127
|
|
|
97
|
-
|
|
98
|
-
openInBrowser(`${protocol}://localhost:${port}`);
|
|
128
|
+
} else {
|
|
99
129
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
130
|
+
startTiroServer(argsObj, (configServerObj) => {
|
|
131
|
+
|
|
132
|
+
const c = configServerObj
|
|
133
|
+
const protocol = c.https ? 'https' : 'http'
|
|
134
|
+
const port = c.port
|
|
135
|
+
|
|
136
|
+
// open in browser
|
|
137
|
+
openInBrowser(`${protocol}://localhost:${port}`);
|
|
138
|
+
|
|
139
|
+
// start tunnel with autossh if asked
|
|
140
|
+
startSshTunnel(argsObj);
|
|
141
|
+
|
|
142
|
+
})
|
|
143
|
+
}
|
|
104
144
|
}
|
|
105
145
|
|
|
106
146
|
const test = () => {
|
|
107
|
-
|
|
108
147
|
var argsObj = getCliArgs();
|
|
109
148
|
startSshTunnel(argsObj);
|
|
110
149
|
}
|
|
111
150
|
|
|
112
151
|
|
|
113
152
|
// start everything
|
|
114
|
-
isDev ? test() : main();
|
|
153
|
+
// isDev ? test() : main();
|
|
154
|
+
isDev ? main() : main();
|
|
115
155
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tiro-notes",
|
|
3
|
-
"version": "0.27.
|
|
4
|
-
"description": "Tiro Notes
|
|
3
|
+
"version": "0.27.34",
|
|
4
|
+
"description": "Tiro Notes CLI to start Tiro Notes from the command line!",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"clean-previous-build": "rm -r node-build",
|
|
7
7
|
"export-cli-module": "cp -r ../../build node-build; cp cli.js node-build/; cp package.json node-build/; ",
|