Skip to content

Commit

Permalink
Version 2.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
TheAppleFreak authored and TheAppleFreak committed Oct 4, 2021
1 parent 06a5daf commit 9d286dd
Show file tree
Hide file tree
Showing 12 changed files with 12,168 additions and 6,157 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Deploy

on:
release:
types: [ created ]

jobs:
deploy:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: "16.x"
registry-url: "https://registry.npmjs.org"
- run: npm ci
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
56 changes: 56 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Tests

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
test-windows:
runs-on: windows-latest

strategy:
matrix:
node-version: [16.x]

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npm run test

test-macos:
runs-on: macos-latest

strategy:
matrix:
node-version: [16.x]

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npm run test

test-linux:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [16.x]

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npm run test
86 changes: 0 additions & 86 deletions .yarn/releases/yarn-berry.js

This file was deleted.

5 changes: 0 additions & 5 deletions .yarn/sdks/integrations.yml

This file was deleted.

1 change: 0 additions & 1 deletion .yarnrc.yml

This file was deleted.

9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# CHANGELOG

## 2.1.0 (2021/10/4)

* You can now return `false` in the formatter function to prevent the plugin from posting a message to Slack. This functionality is courtesy of [Pull #14](https://github.com/TheAppleFreak/winston-slack-webhook-transport/pull/14), which closes [Issue #12](https://github.com/TheAppleFreak/winston-slack-webhook-transport/issues/12) in the process. Thanks @iedmrc and @daxadal!
* Updated documentation and typings to reflect the above change.
* Removed Yarn as the package manager in favor of using NPM instead.
* Set up Github Actions to simplify the process of updating the package on NPM in the future.
* Updated copyright year in LICENSE. Probably should have done that about 10 months ago... ¯\\_(ツ)_
* Updated dependencies

## 2.0.0 (2020/8/14)

**WARNING**: This is a potentially **BREAKING CHANGE**.
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2020 TheAppleFreak
Copyright (c) 2021 TheAppleFreak

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

A Slack transport for Winston 3+ that logs to a channel via webhooks.

[![NPM](https://nodei.co/npm/winston-slack-webhook-transport.png?downloads=true)](https://nodei.co/npm/winston-slack-webhook-transport/)
![Continuous Integration](https://github.com/TheAppleFreak/winston-slack-webhook-transport/actions/workflows/tests.yml/badge.svg) [![npm version](https://badge.fury.io/js/winston-slack-webhook-transport.svg)](https://www.npmjs.com/package/winston-slack-webhook-transport) [![downloads](https://img.shields.io/npm/dw/winston-slack-webhook-transport)]((https://www.npmjs.com/package/winston-slack-webhook-transport))

## Installation

Expand Down Expand Up @@ -44,7 +44,7 @@ logger.add(new SlackHook({ webhookUrl: "https://hooks.slack.com/services/xxx/xxx
### Options

* `webhookUrl` **REQUIRED** - Slack incoming webhook URL. [Follow steps 1 through 3 at this link to create a new webhook if you don't already have one](https://api.slack.com/messaging/webhooks).
* `formatter` - Custom function to format messages with. This function accepts the `info` object ([see Winston documentation](https://github.com/winstonjs/winston/blob/master/README.md#streams-objectmode-and-info-objects)) and must return an object with at least one of the following three keys: `text` (string), `attachments` (array of [attachment objects](https://api.slack.com/messaging/composing/layouts#attachments)), `blocks` (array of [layout block objects](https://api.slack.com/messaging/composing/layouts#adding-blocks)). These will be used to structure the format of the logged Slack message. By default, messages will use the format of `[level]: [message]` with no attachments or layout blocks.
* `formatter` - Custom function to format messages with. This function accepts the `info` object ([see Winston documentation](https://github.com/winstonjs/winston/blob/master/README.md#streams-objectmode-and-info-objects)) and must return an object with at least one of the following three keys: `text` (string), `attachments` (array of [attachment objects](https://api.slack.com/messaging/composing/layouts#attachments)), `blocks` (array of [layout block objects](https://api.slack.com/messaging/composing/layouts#adding-blocks)). These will be used to structure the format of the logged Slack message. By default, messages will use the format of `[level]: [message]` with no attachments or layout blocks. A value of `false` can also be returned to prevent a message from being sent to Slack.
* `level` - Level to log. Global settings will apply if left undefined.
* `unfurlLinks` - Enables or disables [link unfurling.](https://api.slack.com/reference/messaging/link-unfurling#no_unfurling_please) (Default: `false`)
* `unfurlMedia` - Enables or disables [media unfurling.](https://api.slack.com/reference/messaging/link-unfurling#no_unfurling_please) (Default: `false`)
Expand All @@ -55,6 +55,8 @@ logger.add(new SlackHook({ webhookUrl: "https://hooks.slack.com/services/xxx/xxx

`winston-slack-webhook-transport` supports the ability to format messages using Slack's message layout features. To do this, supply a custom formatter function that returns the [requisite object structure](https://api.slack.com/messaging/composing/layouts) to create the desired layout. You can use the [Slack Block Kit Builder](https://app.slack.com/block-kit-builder/) to quickly and easily prototype advanced layouts using Block Kit.

If for some reason you don't want to send a message to Slack, you can also return `false` to prevent the log message from being sent.

Note that if you're using Block Kit using either the `attachments` or `blocks` keys, the `text` parameter will function as a fallback for surfaces that do not support Block Kit, such as IRC clients or push notifications. It is recommended to include `text` when possible in these cases.

```javascript
Expand Down
Loading

0 comments on commit 9d286dd

Please sign in to comment.