Skip to content

Commit

Permalink
feat(eleventy-plugin-telegram): rename package
Browse files Browse the repository at this point in the history
  • Loading branch information
jackdbd committed Jul 5, 2022
1 parent 07126ca commit 3d23189
Show file tree
Hide file tree
Showing 18 changed files with 203 additions and 210 deletions.
4 changes: 2 additions & 2 deletions config/jest.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ const project = (package_name) => {

// https://jestjs.io/docs/configuration#projects-arraystring--projectconfig
const projects = [
project('eleventy-plugin-text-to-speech'),
project('eleventy-telegram-plugin')
project('eleventy-plugin-telegram'),
project('eleventy-plugin-text-to-speech')
]

const config = {
Expand Down
291 changes: 135 additions & 156 deletions package-lock.json

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions packages/demo-site/config/eleventy.cjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const path = require('node:path')
const slugify = require('slugify')
const { telegramPlugin } = require('@jackdbd/eleventy-telegram-plugin')
const { telegramPlugin } = require('@jackdbd/eleventy-plugin-telegram')
const {
textToSpeechPlugin
} = require('@jackdbd/eleventy-plugin-text-to-speech')
Expand Down Expand Up @@ -36,7 +36,8 @@ module.exports = function (eleventyConfig) {
eleventyConfig.addPlugin(telegramPlugin, {
chatId,
token,
textBeforeBuild: `<i>demo-site</i> build <b>START</b>`
textBeforeBuild: `<i>demo-site</i> build <b>START</b>`,
textAfterBuild: `<i>demo-site</i> build <b>FINISHED</b>`
})

eleventyConfig.addPlugin(textToSpeechPlugin, {
Expand Down
2 changes: 1 addition & 1 deletion packages/demo-site/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"peerDependencies": {},
"devDependencies": {
"@11ty/eleventy": "^1.0.1",
"@jackdbd/eleventy-telegram-plugin": "*",
"@jackdbd/eleventy-plugin-telegram": "*",
"@jackdbd/eleventy-plugin-text-to-speech": "*"
}
}
File renamed without changes.
52 changes: 52 additions & 0 deletions packages/eleventy-plugin-telegram/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# @jackdbd/eleventy-plugin-telegram

[![npm version](https://badge.fury.io/js/@jackdbd%2Feleventy-plugin-telegram.svg)](https://badge.fury.io/js/@jackdbd%2Feleventy-plugin-telegram)
![Snyk Vulnerabilities for npm package](https://img.shields.io/snyk/vulnerabilities/npm/@jackdbd%2Feleventy-plugin-telegram)

Eleventy plugin that send messages to a Telegram chat of your choice.

## Installation

```sh
npm install --save-dev @jackdbd/eleventy-plugin-telegram
```


## Usage

```js
const { telegramPlugin } = require('@jackdbd/eleventy-plugin-telegram')

module.exports = function (eleventyConfig) {
// some eleventy configuration...

eleventyConfig.addPlugin(telegramPlugin, {
chatId: 'YOUR_TELEGRAM_CHAT_ID',
token: 'YOUR_TELEGRAM_BOT_TOKEN',
textBeforeBuild: '11ty have just started building my site',
textAfterBuild: '11ty has finished building my awesome site'
})

// some more eleventy configuration...
}
```

See Telegram [sendMessage](https://core.telegram.org/bots/api#sendmessage) API method for formatting options.

## Configuration

### Required parameters

| Parameter | Explanation |
| --- | --- |
| `chatId` | Your Telegram chat ID. |
| `token` | Your Telegram Bot token. If you forgot the API token of a Telegram bot you created, you can retrieve it at any time using BotFather. Just go to `BotFather > bot list > API token`. |

### Options

| Option | Default | Explanation |
| --- | --- | --- |
| `textBeforeBuild` | `🏎️ 11ty has <b>started</b> building the site` | Text message to send when Eleventy starts building the site. |
| `textAfterBuild` | `🏁 11ty has <b>finished</b> building the site` | Text message to send when Eleventy finishes building the site. |

> :information_source: a Telegram message can be 1-4096 characters long, after entities parsing. See [formatting options here](https://core.telegram.org/bots/api#formatting-options).
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@jackdbd/eleventy-telegram-plugin",
"version": "1.0.0-alpha.1",
"name": "@jackdbd/eleventy-plugin-telegram",
"version": "0.0.1",
"description": "Eleventy plugin for Telegram",
"author": {
"name": "Giacomo Debidda",
Expand All @@ -21,7 +21,7 @@
"type": "git",
"url": "https://github.com/jackdbd/undici"
},
"homepage": "https://github.com/jackdbd/undici/tree/main/packages/eleventy-telegram-plugin#readme",
"homepage": "https://github.com/jackdbd/undici/tree/main/packages/eleventy-plugin-telegram#readme",
"engines": {
"node": ">=16.0.0"
},
Expand Down Expand Up @@ -53,8 +53,8 @@
"nuke": "npm run clean && rimraf node_modules 'package-lock.json'",
"precommit": "lint-staged --config ../../config/lint-staged.cjs",
"size": "pkg-size ./lib --sort-by=brotli --ignore-files {*.d.ts,*.map}",
"test": "TELEGRAM=$(cat ../../secrets/telegram.json) jest --config ../../config/jest.cjs --rootDir ../../ --selectProjects eleventy-telegram-plugin",
"test:ci": "jest --config ../../config/jest.cjs --rootDir ../../ --ci --coverage --selectProjects eleventy-telegram-plugin"
"test": "TELEGRAM=$(cat ../../secrets/telegram.json) jest --config ../../config/jest.cjs --rootDir ../../ --selectProjects eleventy-plugin-telegram",
"test:ci": "jest --config ../../config/jest.cjs --rootDir ../../ --ci --coverage --selectProjects eleventy-plugin-telegram"
},
"dependencies": {
"joi": "^17.6.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const base_config = require('../../config/semantic-release.cjs')
// The rest of the semantic-release configuration should stay the same.
// https://github.com/semantic-release/git#message
const message =
'chore(eleventy-telegram-plugin): release v.${nextRelease.version} [skip ci]\n\n${nextRelease.notes}'
'chore(eleventy-plugin-telegram): release v.${nextRelease.version} [skip ci]\n\n${nextRelease.notes}'
////////////////////////////////////////////////////////////////////////////////

const git = [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const PREFIX = '[💬 11ty-telegram-plugin] '
export const PREFIX = '[💬 11ty-plugin-telegram] '

export const DEFAULT = {
TEXT_BEFORE_BUILD: `🏎️ 11ty has <b>started</b> building the site`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { sendMessage } from './send-message.js'
import type { SendMessageConfig } from './send-message.js'
import type { ChatId } from './types.js'

const debug = makeDebug('eleventy-telegram-plugin/index')
const debug = makeDebug('eleventy-plugin-telegram/index')

const makeEleventyEventHandler = (
_eleventyConfig: EleventyConfig,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import type {
TelegramAPISendMessageError
} from './types.js'

const debug = makeDebug('eleventy-telegram-plugin/send-message')
const debug = makeDebug('eleventy-plugin-telegram/send-message')

export interface SendMessageConfig {
chatId: ChatId
Expand Down
5 changes: 0 additions & 5 deletions packages/eleventy-telegram-plugin/CHANGELOG.md

This file was deleted.

34 changes: 0 additions & 34 deletions packages/eleventy-telegram-plugin/README.md

This file was deleted.

2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"files": [],
"references": [
{
"path": "./packages/eleventy-telegram-plugin/tsconfig.json"
"path": "./packages/eleventy-plugin-telegram/tsconfig.json"
},
{
"path": "./packages/eleventy-plugin-text-to-speech/tsconfig.json"
Expand Down

0 comments on commit 3d23189

Please sign in to comment.