@autofleet/node-common 1.6.1 → 1.7.1
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/logger/example.js +1 -1
- package/logger/index.js +15 -1
- package/package.json +1 -1
- package/.circleci/config.yml +0 -26
- package/.dependabot/config.yml +0 -10
- package/.eslintrc.json +0 -8
- package/.github/workflows/main.yml +0 -37
- package/.gitlab-ci.yml +0 -13
- package/.vscode/launch.json +0 -14
package/logger/example.js
CHANGED
package/logger/index.js
CHANGED
|
@@ -11,6 +11,11 @@ const infoEnvNmaes = [
|
|
|
11
11
|
'test',
|
|
12
12
|
];
|
|
13
13
|
|
|
14
|
+
const serializeError = (error) => {
|
|
15
|
+
const fields = ['code', 'status', 'statusCode', 'message', 'messageData', 'name', 'stack', 'stackTrace'];
|
|
16
|
+
return fields.reduce((v, field) => ({ ...v, [field]: error[field] }), {});
|
|
17
|
+
};
|
|
18
|
+
|
|
14
19
|
const getLevel = (logLevel) => {
|
|
15
20
|
if (logLevel) return logLevel;
|
|
16
21
|
if (env.LOG_LEVEL) return env.LOG_LEVEL;
|
|
@@ -21,7 +26,7 @@ const getLevel = (logLevel) => {
|
|
|
21
26
|
|
|
22
27
|
const enumerateErrorFormat = winston.format((info) => {
|
|
23
28
|
if (info.message instanceof Error) {
|
|
24
|
-
info.message = Object.assign({ // eslint-disable-line
|
|
29
|
+
info.message = Object.assign({ // eslint-disable-line
|
|
25
30
|
message: info.message.message,
|
|
26
31
|
stack: info.message.stack,
|
|
27
32
|
}, info.message);
|
|
@@ -32,6 +37,15 @@ const enumerateErrorFormat = winston.format((info) => {
|
|
|
32
37
|
stack: info.stack,
|
|
33
38
|
}, info);
|
|
34
39
|
}
|
|
40
|
+
|
|
41
|
+
// eslint-disable-next-line array-callback-return
|
|
42
|
+
Object.keys(info).map((k) => {
|
|
43
|
+
if (info[k] instanceof Error) {
|
|
44
|
+
// eslint-disable-next-line no-param-reassign
|
|
45
|
+
info[k] = serializeError(info[k]);
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
|
|
35
49
|
return info;
|
|
36
50
|
});
|
|
37
51
|
|
package/package.json
CHANGED
package/.circleci/config.yml
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
version: 2
|
|
2
|
-
jobs:
|
|
3
|
-
test:
|
|
4
|
-
docker:
|
|
5
|
-
- image: circleci/node:11.14.0
|
|
6
|
-
steps:
|
|
7
|
-
- checkout
|
|
8
|
-
- restore_cache:
|
|
9
|
-
keys:
|
|
10
|
-
- v1-dependencies-{{ checksum "package.json" }}
|
|
11
|
-
# fallback to using the latest cache if no exact match is found
|
|
12
|
-
- v1-dependencies-
|
|
13
|
-
- run: npm i
|
|
14
|
-
- save_cache:
|
|
15
|
-
paths:
|
|
16
|
-
- node_modules
|
|
17
|
-
key: v1-dependencies-{{ checksum "package.json" }}
|
|
18
|
-
- run: npm run coverage
|
|
19
|
-
- run: rm -rf ./coverage
|
|
20
|
-
- run: npm run linter
|
|
21
|
-
|
|
22
|
-
workflows:
|
|
23
|
-
version: 2
|
|
24
|
-
build_and_test:
|
|
25
|
-
jobs:
|
|
26
|
-
- test
|
package/.dependabot/config.yml
DELETED
package/.eslintrc.json
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
|
|
2
|
-
# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages
|
|
3
|
-
|
|
4
|
-
name: Node.js Package
|
|
5
|
-
|
|
6
|
-
on:
|
|
7
|
-
push:
|
|
8
|
-
branches: [ master ]
|
|
9
|
-
|
|
10
|
-
jobs:
|
|
11
|
-
npm-test:
|
|
12
|
-
runs-on: ubuntu-latest
|
|
13
|
-
steps:
|
|
14
|
-
- uses: actions/checkout@v2
|
|
15
|
-
- uses: actions/setup-node@v1
|
|
16
|
-
with:
|
|
17
|
-
node-version: 12
|
|
18
|
-
registry-url: https://registry.npmjs.org/
|
|
19
|
-
- run: npm ci
|
|
20
|
-
- run: npm run linter
|
|
21
|
-
- run: npm run coverage
|
|
22
|
-
- run: rm -rf ./coverage
|
|
23
|
-
env:
|
|
24
|
-
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
|
|
25
|
-
|
|
26
|
-
publish-npm:
|
|
27
|
-
needs: npm-test
|
|
28
|
-
runs-on: ubuntu-latest
|
|
29
|
-
steps:
|
|
30
|
-
- uses: actions/checkout@v2
|
|
31
|
-
- uses: actions/setup-node@v1
|
|
32
|
-
with:
|
|
33
|
-
node-version: 12
|
|
34
|
-
registry-url: https://registry.npmjs.org/
|
|
35
|
-
- run: npm publish
|
|
36
|
-
env:
|
|
37
|
-
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
|
package/.gitlab-ci.yml
DELETED
package/.vscode/launch.json
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
// Use IntelliSense to learn about possible attributes.
|
|
3
|
-
// Hover to view descriptions of existing attributes.
|
|
4
|
-
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
|
5
|
-
"version": "0.2.0",
|
|
6
|
-
"configurations": [
|
|
7
|
-
{
|
|
8
|
-
"type": "node",
|
|
9
|
-
"request": "launch",
|
|
10
|
-
"name": "Launch Program",
|
|
11
|
-
"program": "${workspaceFolder}/events/index.js"
|
|
12
|
-
}
|
|
13
|
-
]
|
|
14
|
-
}
|