@jsreport/jsreport-cli 3.2.2 → 4.0.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 CHANGED
@@ -7,6 +7,15 @@ See http://jsreport.net/learn/cli for documentation
7
7
 
8
8
  ## Changelog
9
9
 
10
+ ### 4.0.0
11
+
12
+ - minimum node.js version is now `18.15.0`
13
+ - update deps to fix npm audit
14
+
15
+ ### 3.2.3
16
+
17
+ - improve error logging
18
+
10
19
  ### 3.2.2
11
20
 
12
21
  - add support for tempDirectory and service name to win-install command
@@ -70,7 +70,6 @@ function getErrors (err) {
70
70
 
71
71
  function getErrorMessages (err) {
72
72
  const errors = getErrors(err)
73
- let count = errors.length
74
73
  let cleanState = false
75
74
  const messages = []
76
75
  const stacks = []
@@ -85,34 +84,26 @@ function getErrorMessages (err) {
85
84
 
86
85
  customProps = JSON.stringify(customProps)
87
86
 
88
- if (cleanState) {
89
- messages.push(`${formatError(error)}`)
90
- } else {
91
- messages.push(`${formatError(error)} (${count})`)
92
- }
87
+ messages.push(`${formatError(error)}`)
93
88
 
94
89
  if (customProps === '{}') {
95
90
  customProps = ''
96
91
  }
97
92
 
98
93
  if (currentStack !== '') {
99
- const causedBy = `caused by error (${count}):`
100
-
101
94
  if (customProps !== '') {
102
- stacks.push(`${causedBy}\n-> meta = ${customProps}\n-> stack\n${currentStack}`)
95
+ stacks.push(`-> meta = ${customProps}\n-> stack\n${currentStack}`)
103
96
  } else {
104
- stacks.push(`${causedBy}\n-> stack\n${currentStack}`)
97
+ stacks.push(`-> stack\n${currentStack}`)
105
98
  }
106
99
  }
107
-
108
- count--
109
100
  })
110
101
 
111
102
  if (!cleanState && stacks.length > 0) {
112
- messages.push(`\n${stacks.join('\n')}`)
103
+ return [messages, stacks]
113
104
  }
114
105
 
115
- return messages
106
+ return [messages, []]
116
107
  }
117
108
 
118
109
  function getSimpleProperties (obj) {
@@ -138,9 +129,37 @@ function getSimpleProperties (obj) {
138
129
  }
139
130
 
140
131
  function printError (err, logger) {
141
- const messages = getErrorMessages(err)
132
+ const [messages, stacks] = getErrorMessages(err)
133
+
134
+ for (let idx = 0; idx < messages.length; idx++) {
135
+ messages[idx] += ` (${messages.length - idx})`
136
+
137
+ if (idx > 0) {
138
+ messages[idx] = lowerCaseFirstLetter(messages[idx])
139
+ }
140
+ }
141
+
142
+ let errorLog = messages.join('\n(because) ')
143
+
144
+ if (stacks.length > 0) {
145
+ const reversedStacks = [...stacks].reverse()
146
+
147
+ for (let idx = 0; idx < reversedStacks.length; idx++) {
148
+ reversedStacks[idx] = `-- error (${idx + 1}) --\n${reversedStacks[idx]}`
149
+ }
150
+
151
+ errorLog += `\n\n${reversedStacks.join('\nwrapped by:\n')}`
152
+ }
153
+
154
+ logger.error(errorLog)
155
+ }
156
+
157
+ function lowerCaseFirstLetter (str) {
158
+ if (str === '' || typeof str !== 'string') {
159
+ return str
160
+ }
142
161
 
143
- logger.error(messages.join('. '))
162
+ return str.charAt(0).toLowerCase() + str.slice(1)
144
163
  }
145
164
 
146
165
  module.exports.printError = printError
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsreport/jsreport-cli",
3
- "version": "3.2.2",
3
+ "version": "4.0.0",
4
4
  "description": "Command line interface for jsreport",
5
5
  "keywords": [
6
6
  "jsreport",
@@ -50,14 +50,14 @@
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": "3.0.0",
53
+ "@jsreport/nodejs-client": "4.0.0",
54
54
  "chalk": "2.4.2",
55
55
  "cliui": "7.0.4",
56
56
  "inquirer": "8.2.0",
57
57
  "ip-address": "5.8.9",
58
58
  "is-absolute-url": "2.1.0",
59
59
  "is-promise": "2.1.0",
60
- "liftoff": "3.1.0",
60
+ "liftoff": "4.0.0",
61
61
  "lockfile": "1.0.4",
62
62
  "lodash.omit": "4.5.0",
63
63
  "nanoid": "3.2.0",
@@ -65,16 +65,16 @@
65
65
  "nssocket": "0.6.0",
66
66
  "once": "1.4.0",
67
67
  "prompt": "1.3.0",
68
- "semver": "5.6.0",
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": "3.3.2",
74
- "@jsreport/jsreport-core": "3.8.0",
75
- "@jsreport/jsreport-express": "3.4.2",
76
- "@jsreport/jsreport-fs-store": "3.2.3",
77
- "@jsreport/jsreport-handlebars": "3.2.1",
73
+ "@jsreport/jsreport-authentication": "4.0.0",
74
+ "@jsreport/jsreport-core": "4.0.0",
75
+ "@jsreport/jsreport-express": "4.0.0",
76
+ "@jsreport/jsreport-fs-store": "4.0.0",
77
+ "@jsreport/jsreport-handlebars": "4.0.0",
78
78
  "cross-env": "5.2.1",
79
79
  "execa": "1.0.0",
80
80
  "handlebars": "4.7.7",
@@ -91,7 +91,7 @@
91
91
  "winser-with-api": "1.0.2"
92
92
  },
93
93
  "engines": {
94
- "node": ">=16.11"
94
+ "node": ">=18.15"
95
95
  },
96
96
  "standard": {
97
97
  "ignore": [