@things-factory/env 7.0.1-beta.6 → 7.0.1-rc.5
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/lib/logger.js +4 -4
- package/lib/operato-modules.js +36 -0
- package/package.json +2 -2
package/lib/logger.js
CHANGED
@@ -4,7 +4,7 @@ var config = require('./config')
|
|
4
4
|
var { createLogger, format, transports } = require('winston')
|
5
5
|
require('winston-daily-rotate-file')
|
6
6
|
|
7
|
-
const { combine,
|
7
|
+
const { combine, errors, splat, printf } = format
|
8
8
|
|
9
9
|
var { file: fileConfig, console: consoleConfig } = config.get('logger', {})
|
10
10
|
|
@@ -35,11 +35,11 @@ const systemTimestamp = format((info, opts) => {
|
|
35
35
|
return info
|
36
36
|
})
|
37
37
|
|
38
|
-
const logFormat = printf(({ level, message, timestamp }) => {
|
39
|
-
return `${timestamp} ${level}: ${message}`
|
38
|
+
const logFormat = printf(({ level, message, timestamp, stack }) => {
|
39
|
+
return `${timestamp} ${level}: ${stack || message}`
|
40
40
|
})
|
41
41
|
|
42
42
|
module.exports = createLogger({
|
43
|
-
format: combine(systemTimestamp({ tz: SYSTEM_TZ }), splat(), logFormat),
|
43
|
+
format: combine(errors({ stack: true }), systemTimestamp({ tz: SYSTEM_TZ }), splat(), logFormat),
|
44
44
|
transports: logTransports
|
45
45
|
})
|
@@ -0,0 +1,36 @@
|
|
1
|
+
const path = require('path')
|
2
|
+
const { appRootPath } = require('./app-root-path')
|
3
|
+
const orderedModuleNames = require('./dependency-order')
|
4
|
+
|
5
|
+
const selfModulePackage = require(path.resolve(appRootPath, 'package.json'))
|
6
|
+
const selfModuleName = selfModulePackage.name
|
7
|
+
|
8
|
+
const operatoModues = orderedModuleNames.reduce((sum, name) => {
|
9
|
+
const dependencies =
|
10
|
+
name === selfModuleName ? selfModulePackage['dependencies'] : require(`${name}/package.json`)['dependencies'] || {}
|
11
|
+
|
12
|
+
Object.keys(dependencies)
|
13
|
+
.filter(dep => {
|
14
|
+
try {
|
15
|
+
const pkg = require(`${dep}/package.json`)
|
16
|
+
return pkg && pkg['operato']
|
17
|
+
} catch (err) {
|
18
|
+
return
|
19
|
+
}
|
20
|
+
})
|
21
|
+
.forEach(dep => {
|
22
|
+
sum[dep] = true
|
23
|
+
})
|
24
|
+
|
25
|
+
return sum
|
26
|
+
}, {})
|
27
|
+
|
28
|
+
const operatoModuleNames = Object.keys(operatoModues)
|
29
|
+
|
30
|
+
if (selfModulePackage['operato'] && !operatoModuleNames.includes(selfModuleName)) {
|
31
|
+
operatoModuleNames.push(selfModuleName)
|
32
|
+
}
|
33
|
+
|
34
|
+
console.log('operato module names', operatoModuleNames)
|
35
|
+
|
36
|
+
module.exports = operatoModuleNames
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@things-factory/env",
|
3
|
-
"version": "7.0.1-
|
3
|
+
"version": "7.0.1-rc.5",
|
4
4
|
"description": "Things Factory running environment helper library",
|
5
5
|
"main": "index.js",
|
6
6
|
"author": "heartyoh@hatiolab.com",
|
@@ -27,5 +27,5 @@
|
|
27
27
|
"winston": "^3.2.1",
|
28
28
|
"winston-daily-rotate-file": "^4.2.1"
|
29
29
|
},
|
30
|
-
"gitHead": "
|
30
|
+
"gitHead": "7d5d340e80a8efde9be08bb7b1e019d944bc3628"
|
31
31
|
}
|