@jsreport/jsreport-cli 4.0.4 → 4.1.0
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/README.md +9 -0
- package/example.server.js +12 -0
- package/lib/commander/startProcessing.js +19 -29
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -7,6 +7,15 @@ See http://jsreport.net/learn/cli for documentation
|
|
|
7
7
|
|
|
8
8
|
## Changelog
|
|
9
9
|
|
|
10
|
+
### 4.1.0
|
|
11
|
+
|
|
12
|
+
- update deps to fix audit
|
|
13
|
+
- add graceful shutdown to the server.js
|
|
14
|
+
|
|
15
|
+
### 4.0.5
|
|
16
|
+
|
|
17
|
+
- update dev prompt to prompts to fix audit
|
|
18
|
+
|
|
10
19
|
### 4.0.4
|
|
11
20
|
|
|
12
21
|
- dont use console.error(e.stack) and just console.error(e) to avoid loosing e.cause inner error
|
package/example.server.js
CHANGED
|
@@ -12,3 +12,15 @@ if (process.env.JSREPORT_CLI) {
|
|
|
12
12
|
process.exit(1)
|
|
13
13
|
})
|
|
14
14
|
}
|
|
15
|
+
|
|
16
|
+
async function shutdown () {
|
|
17
|
+
try {
|
|
18
|
+
await jsreport.close()
|
|
19
|
+
process.exit(0)
|
|
20
|
+
} catch (e) {
|
|
21
|
+
console.error(e)
|
|
22
|
+
process.exit(1)
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
process.on('SIGTERM', shutdown)
|
|
26
|
+
process.on('SIGINT', shutdown)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const yargs = require('yargs')
|
|
2
|
-
const
|
|
2
|
+
const prompts = require('prompts')
|
|
3
3
|
const startCommand = require('./startCommand')
|
|
4
4
|
const jsreportInstance = require('./jsreportInstance')
|
|
5
5
|
const cliPackageJson = require('../../package.json')
|
|
@@ -158,37 +158,27 @@ module.exports = async function startProcessing (commander, logger, args) {
|
|
|
158
158
|
argv.password = needsPassword
|
|
159
159
|
}, true)
|
|
160
160
|
} else {
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
prompt.message = ''
|
|
165
|
-
|
|
166
|
-
prompt.get([{
|
|
161
|
+
try {
|
|
162
|
+
const response = await prompts({
|
|
163
|
+
type: 'password',
|
|
167
164
|
name: 'password',
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
hidden: true,
|
|
172
|
-
required: true
|
|
173
|
-
}], (err, result) => {
|
|
174
|
-
if (err) {
|
|
175
|
-
const errorToReject = new Error('No value for password option')
|
|
176
|
-
errorToReject.cleanState = true
|
|
177
|
-
|
|
178
|
-
commander.emit('started', errorToReject, null)
|
|
179
|
-
|
|
180
|
-
return reject(errorToReject)
|
|
181
|
-
}
|
|
165
|
+
message: 'Password',
|
|
166
|
+
validate: value => value.trim() === '' ? 'Password can\'t be empty' : true
|
|
167
|
+
})
|
|
182
168
|
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
169
|
+
// we add middleware to pre-define the "p/password" option to
|
|
170
|
+
commander._cli.middleware((argv) => {
|
|
171
|
+
argv.p = response.password
|
|
172
|
+
argv.password = response.password
|
|
173
|
+
}, true)
|
|
174
|
+
} catch (error) {
|
|
175
|
+
const errorToReject = new Error('No value for password option')
|
|
176
|
+
errorToReject.cleanState = true
|
|
188
177
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
178
|
+
commander.emit('started', errorToReject, null)
|
|
179
|
+
|
|
180
|
+
throw errorToReject
|
|
181
|
+
}
|
|
192
182
|
}
|
|
193
183
|
}
|
|
194
184
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jsreport/jsreport-cli",
|
|
3
|
-
"version": "4.0
|
|
3
|
+
"version": "4.1.0",
|
|
4
4
|
"description": "Command line interface for jsreport",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jsreport",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"test:watch": "mocha --recursive \"./test/*.spec.js\" \"./test/commands/**/*.spec.js\" --timeout 28000 --exit --watch"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@jsreport/nodejs-client": "4.0.
|
|
53
|
+
"@jsreport/nodejs-client": "4.0.4",
|
|
54
54
|
"chalk": "2.4.2",
|
|
55
55
|
"cliui": "7.0.4",
|
|
56
56
|
"inquirer": "8.2.0",
|
|
@@ -60,20 +60,20 @@
|
|
|
60
60
|
"liftoff": "4.0.0",
|
|
61
61
|
"lockfile": "1.0.4",
|
|
62
62
|
"lodash.omit": "4.5.0",
|
|
63
|
-
"nanoid": "3.
|
|
63
|
+
"nanoid": "3.3.8",
|
|
64
64
|
"npm-install-package": "2.1.0",
|
|
65
65
|
"nssocket": "0.6.0",
|
|
66
66
|
"once": "1.4.0",
|
|
67
|
-
"
|
|
67
|
+
"prompts": "2.4.2",
|
|
68
68
|
"semver": "7.5.4",
|
|
69
69
|
"silent-spawn": "0.4.0",
|
|
70
70
|
"yargs": "17.3.1"
|
|
71
71
|
},
|
|
72
72
|
"devDependencies": {
|
|
73
|
-
"@jsreport/jsreport-authentication": "4.
|
|
74
|
-
"@jsreport/jsreport-core": "4.
|
|
75
|
-
"@jsreport/jsreport-express": "4.
|
|
76
|
-
"@jsreport/jsreport-fs-store": "4.0
|
|
73
|
+
"@jsreport/jsreport-authentication": "4.2.3",
|
|
74
|
+
"@jsreport/jsreport-core": "4.6.0",
|
|
75
|
+
"@jsreport/jsreport-express": "4.2.0",
|
|
76
|
+
"@jsreport/jsreport-fs-store": "4.1.0",
|
|
77
77
|
"@jsreport/jsreport-handlebars": "4.0.1",
|
|
78
78
|
"cross-env": "5.2.1",
|
|
79
79
|
"execa": "1.0.0",
|