Skip to content

Commit 6d903eb

Browse files
committedMay 15, 2022
Merge branch 'release/v2.6.0'
2 parents 0b845ee + 51ead8d commit 6d903eb

10 files changed

+2579
-9680
lines changed
 

‎.eslintrc

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@
1414
"SharedArrayBuffer": "readonly"
1515
},
1616
"parserOptions": {
17-
"ecmaVersion": 6
17+
"ecmaVersion": 2020
1818
},
1919
"rules": {
2020
"jsdoc/check-alignment": 1,
21-
"jsdoc/check-examples": 1,
21+
"jsdoc/check-examples": 0,
2222
"jsdoc/check-indentation": 1,
2323
"jsdoc/check-param-names": 1,
2424
"jsdoc/check-syntax": 1,

‎.github/workflows/tests.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
timeout-minutes: 5
1616
strategy:
1717
matrix:
18-
node: [12, 14, 16]
18+
node: [14, 16, 18]
1919
name: Node ${{ matrix.node }} test
2020
steps:
2121
- name: Clone repository

‎.gitignore

+110-9
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,39 @@
11

2-
# Created by https://www.gitignore.io/api/node,visualstudiocode
3-
# Edit at https://www.gitignore.io/?templates=node,visualstudiocode
2+
# Created by https://www.toptal.com/developers/gitignore/api/node,visualstudiocode,macos
3+
# Edit at https://www.toptal.com/developers/gitignore?templates=node,visualstudiocode,macos
4+
5+
### macOS ###
6+
# General
7+
.DS_Store
8+
.AppleDouble
9+
.LSOverride
10+
11+
# Icon must end with two \r
12+
Icon
13+
14+
15+
# Thumbnails
16+
._*
17+
18+
# Files that might appear in the root of a volume
19+
.DocumentRevisions-V100
20+
.fseventsd
21+
.Spotlight-V100
22+
.TemporaryItems
23+
.Trashes
24+
.VolumeIcon.icns
25+
.com.apple.timemachine.donotpresent
26+
27+
# Directories potentially created on remote AFP share
28+
.AppleDB
29+
.AppleDesktop
30+
Network Trash Folder
31+
Temporary Items
32+
.apdisk
33+
34+
### macOS Patch ###
35+
# iCloud generated files
36+
*.icloud
437

538
### Node ###
639
# Logs
@@ -10,6 +43,7 @@ npm-debug.log*
1043
yarn-debug.log*
1144
yarn-error.log*
1245
lerna-debug.log*
46+
.pnpm-debug.log*
1347

1448
# Diagnostic reports (https://nodejs.org/api/report.html)
1549
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
@@ -25,6 +59,7 @@ lib-cov
2559

2660
# Coverage directory used by tools like istanbul
2761
coverage
62+
*.lcov
2863

2964
# nyc test coverage
3065
.nyc_output
@@ -45,15 +80,27 @@ build/Release
4580
node_modules/
4681
jspm_packages/
4782

48-
# TypeScript v1 declaration files
49-
typings/
83+
# Snowpack dependency directory (https://snowpack.dev/)
84+
web_modules/
85+
86+
# TypeScript cache
87+
*.tsbuildinfo
5088

5189
# Optional npm cache directory
5290
.npm
5391

5492
# Optional eslint cache
5593
.eslintcache
5694

95+
# Optional stylelint cache
96+
.stylelintcache
97+
98+
# Microbundle cache
99+
.rpt2_cache/
100+
.rts2_cache_cjs/
101+
.rts2_cache_es/
102+
.rts2_cache_umd/
103+
57104
# Optional REPL history
58105
.node_repl_history
59106

@@ -63,22 +110,40 @@ typings/
63110
# Yarn Integrity file
64111
.yarn-integrity
65112

66-
# dotenv environment variables file
113+
# dotenv environment variable files
67114
.env
68-
.env.test
115+
.env.development.local
116+
.env.test.local
117+
.env.production.local
118+
.env.local
69119

70120
# parcel-bundler cache (https://parceljs.org/)
71121
.cache
122+
.parcel-cache
72123

73-
# next.js build output
124+
# Next.js build output
74125
.next
126+
out
75127

76-
# nuxt.js build output
128+
# Nuxt.js build / generate output
77129
.nuxt
130+
dist
131+
132+
# Gatsby files
133+
.cache/
134+
# Comment in the public line in if your project uses Gatsby and not Next.js
135+
# https://nextjs.org/blog/next-9-1#public-directory-support
136+
# public
78137

79138
# vuepress build output
80139
.vuepress/dist
81140

141+
# vuepress v2.x temp and cache directory
142+
.temp
143+
144+
# Docusaurus cache and generated files
145+
.docusaurus
146+
82147
# Serverless directories
83148
.serverless/
84149

@@ -88,15 +153,51 @@ typings/
88153
# DynamoDB Local files
89154
.dynamodb/
90155

156+
# TernJS port file
157+
.tern-port
158+
159+
# Stores VSCode versions used for testing VSCode extensions
160+
.vscode-test
161+
162+
# yarn v2
163+
.yarn/cache
164+
.yarn/unplugged
165+
.yarn/build-state.yml
166+
.yarn/install-state.gz
167+
.pnp.*
168+
169+
### Node Patch ###
170+
# Serverless Webpack directories
171+
.webpack/
172+
173+
# Optional stylelint cache
174+
175+
# SvelteKit build / generate output
176+
.svelte-kit
177+
91178
### VisualStudioCode ###
92179
.vscode/*
93180
!.vscode/settings.json
94181
!.vscode/tasks.json
95182
!.vscode/launch.json
96183
!.vscode/extensions.json
184+
!.vscode/*.code-snippets
185+
186+
# Local History for Visual Studio Code
187+
.history/
188+
189+
# Built Visual Studio Code Extensions
190+
*.vsix
97191

98192
### VisualStudioCode Patch ###
99193
# Ignore all local history of files
100194
.history
195+
.ionide
196+
197+
# Support for Project snippet scope
198+
.vscode/*.code-snippets
199+
200+
# Ignore code-workspaces
201+
*.code-workspace
101202

102-
# End of https://www.gitignore.io/api/node,visualstudiocode
203+
# End of https://www.toptal.com/developers/gitignore/api/node,visualstudiocode,macos

‎.pre-commit-config.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
repos:
12
- repo: https://github.com/Yelp/detect-secrets
23
rev: v1.1.0
34
hooks:

‎CHANGELOG.md

+9-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
77

88
## [Unreleased]
99

10+
## [v2.6.0] - 2022-05-15
11+
### Fixed
12+
- [#36](https://github.com/ivanmarban/winston-telegram/pull/36) Handle uncaught exceptions.
13+
14+
### Removed
15+
- Replace sf dependency by custom string templating implementation.
16+
1017
## [v2.5.0] - 2021-11-9
1118
### Added
1219
- [#29](https://github.com/ivanmarban/winston-telegram/issues/29) Split long messages.
@@ -144,7 +151,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
144151
## [v0.1.0] - 2015-11-12
145152
- First version.
146153

147-
[unreleased]: https://github.com/ivanmarban/winston-telegram/compare/v2.5.0...develop
154+
[unreleased]: https://github.com/ivanmarban/winston-telegram/compare/v2.6.0...develop
155+
[v2.6.0]: https://github.com/ivanmarban/winston-telegram/compare/v2.5.0...v2.6.0
148156
[v2.5.0]: https://github.com/ivanmarban/winston-telegram/compare/v2.4.1...v2.5.0
149157
[v2.4.1]: https://github.com/ivanmarban/winston-telegram/compare/v2.4.0...v2.4.1
150158
[v2.4.0]: https://github.com/ivanmarban/winston-telegram/compare/v2.3.5...v2.4.0

‎README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ const logger = require('winston')
2929
const TelegramLogger = require('winston-telegram')
3030

3131
// or
32-
import * as TelegramLogger from 'winston-telegram';
32+
import TelegramLogger from 'winston-telegram';
3333

3434
logger.add(new TelegramLogger(options))
3535
```

‎lib/string-format.js

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
function format (str, data) {
2+
data = flattenObject(data)
3+
Object.keys(data).forEach(function (key) {
4+
str = str.replace(new RegExp('{' + key + '}', 'g'), data[key])
5+
})
6+
return str
7+
}
8+
9+
function flattenObject (obj, prefix = '') {
10+
return Object.keys(obj).reduce((acc, k) => {
11+
const pre = prefix.length ? prefix + '.' : ''
12+
if (typeof obj[k] === 'object') Object.assign(acc, flattenObject(obj[k], pre + k))
13+
else acc[pre + k] = obj[k]
14+
return acc
15+
}, {})
16+
}
17+
18+
module.exports = format

‎lib/winston-telegram.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77

88
const https = require('https')
9-
const format = require('sf')
9+
const format = require('./string-format')
1010
const Transport = require('winston-transport')
1111
const MAX_MESSAGE_LENGTH = 4096
1212

@@ -43,7 +43,7 @@ module.exports = class Telegram extends Transport {
4343
this.chatId = options.chatId
4444
this.parseMode = options.parseMode || ''
4545
this.level = options.level || 'info'
46-
this.handleExceptions = options.handleExceptions || true
46+
this.handleExceptions = options.handleExceptions ?? true
4747
this.unique = options.unique || false
4848
this.silent = options.silent || false
4949
this.disableNotification = options.disableNotification || false

‎package-lock.json

+2,420-9,648
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json

+15-16
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "winston-telegram",
33
"description": "A Telegram transport for winston",
4-
"version": "2.5.0",
4+
"version": "2.6.0",
55
"author": "Ivan Marban",
66
"repository": {
77
"type": "git",
@@ -19,35 +19,34 @@
1919
"bot"
2020
],
2121
"dependencies": {
22-
"sf": "^0.2.0",
2322
"winston-transport": "^4.3.0"
2423
},
2524
"peerDependencies": {
2625
"winston": "^3.0.0"
2726
},
2827
"main": "lib/winston-telegram",
2928
"engines": {
30-
"node": ">= 6.4.0"
29+
"node": ">= 14.0.0"
3130
},
3231
"types": "lib/winston-telegram",
3332
"license": "MIT",
3433
"devDependencies": {
35-
"chai": "^4.3.4",
34+
"chai": "^4.3.6",
3635
"coveralls": "^3.1.1",
37-
"eslint": "^7.32.0",
38-
"eslint-config-standard": "^16.0.3",
39-
"eslint-plugin-import": "^2.24.2",
40-
"eslint-plugin-jsdoc": "^36.1.0",
41-
"eslint-plugin-mocha": "^9.0.0",
36+
"eslint": "^8.15.0",
37+
"eslint-config-standard": "^17.0.0",
38+
"eslint-plugin-import": "^2.26.0",
39+
"eslint-plugin-jsdoc": "^39.2.9",
40+
"eslint-plugin-mocha": "^10.0.4",
41+
"eslint-plugin-n": "^15.2.0",
4242
"eslint-plugin-node": "^11.1.0",
43-
"eslint-plugin-promise": "^5.1.0",
44-
"eslint-plugin-standard": "^5.0.0",
45-
"mocha": "^9.1.1",
46-
"nock": "^13.1.3",
43+
"eslint-plugin-promise": "^6.0.0",
44+
"mocha": "^10.0.0",
45+
"nock": "^13.2.4",
4746
"nyc": "^15.1.0",
48-
"prettier-standard": "^15.0.1",
49-
"sinon": "^11.1.2",
50-
"winston": "^3.0.0"
47+
"prettier-standard": "^16.4.1",
48+
"sinon": "^14.0.0",
49+
"winston": "^3.7.2"
5150
},
5251
"scripts": {
5352
"lint": "eslint lib test examples --color",

0 commit comments

Comments
 (0)
Please sign in to comment.