Skip to content

Commit

Permalink
init: project
Browse files Browse the repository at this point in the history
  • Loading branch information
oevery committed Jul 11, 2024
1 parent 6a924ca commit a83b549
Show file tree
Hide file tree
Showing 18 changed files with 6,263 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/npmpublish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: npm publish

on:
release:
types: [published]

jobs:
publish-npm:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 8
run_install: false

- name: Setup node
uses: actions/setup-node@v4
with:
node-version-file: .tool-versions
registry-url: 'https://registry.npmjs.org'
cache: 'pnpm'

- name: Install dependencies
run: pnpm install

- name: Build
run: pnpm build

- name: Publish to npm
run: pnpm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
2 changes: 2 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
shamefully-hoist=true
auto-install-peers=true
1 change: 1 addition & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodejs 20.15.0
53 changes: 53 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{
// Disable the default formatter, use eslint instead
"prettier.enable": false,
"editor.formatOnSave": false,

// Auto fix
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit",
"source.organizeImports": "never"
},

// Silent the stylistic rules in you IDE, but still auto fix them
"eslint.rules.customizations": [
{ "rule": "style/*", "severity": "off" },
{ "rule": "format/*", "severity": "off" },
{ "rule": "*-indent", "severity": "off" },
{ "rule": "*-spacing", "severity": "off" },
{ "rule": "*-spaces", "severity": "off" },
{ "rule": "*-order", "severity": "off" },
{ "rule": "*-dangle", "severity": "off" },
{ "rule": "*-newline", "severity": "off" },
{ "rule": "*quotes", "severity": "off" },
{ "rule": "*semi", "severity": "off" }
],

// Enable eslint for all supported languages
"eslint.validate": [
"javascript",
"javascriptreact",
"typescript",
"typescriptreact",
"vue",
"html",
"markdown",
"json",
"jsonc",
"yaml",
"toml",
"xml",
"gql",
"graphql",
"astro",
"css",
"less",
"scss",
"pcss",
"postcss"
],
"cSpell.words": [
"channelusername",
"supergroup"
]
}
33 changes: 33 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# pusher

A simple pusher. You can use this project to send message to multiple platforms with unify simple API.

**Work in Progress!!!**

## Supported platforms

- [x] telegram

## Installation

```bash
pnpm add @oevery/pusher
```

## Usage

```ts
import { TelegramProvider } from '@oevery/pusher'

const telegram = await TelegramProvider.create()

telegram.send('this is a test message.')
```

## Config

1. You can use `pusher.config.{js|ts}` to define pusher options.
2. Use environment like `PUSHER_TELEGRAM_TOKEN`.
3. Add options when create.

**High-priority parameters will override low-priority parameters.**
17 changes: 17 additions & 0 deletions build.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { resolve } from 'node:path'
import { defineBuildConfig } from 'unbuild'

export default defineBuildConfig({
alias: {
'~': resolve(__dirname, 'src'),
},
// failOnWarn: false,
entries: [
'src/index',
],
clean: true,
declaration: true,
rollup: {
emitCJS: true,
},
})
5 changes: 5 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import antfu from '@antfu/eslint-config'

export default antfu({
typescript: true,
})
65 changes: 65 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
{
"name": "@oevery/pusher",
"type": "module",
"version": "0.0.0",
"packageManager": "pnpm@9.4.0",
"description": "simple pusher.",
"author": {
"name": "oevery",
"email": "i@oevery.me",
"url": "https://github.com/oevery"
},
"license": "MIT",
"repository": "oevery/pusher",
"keywords": [
"pusher",
"push"
],
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.mjs",
"require": "./dist/index.cjs"
}
},
"main": "./dist/index.cjs",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"files": [
"dist"
],
"scripts": {
"build": "tsup",
"lint": "eslint .",
"lint:fix": "eslint . --fix"
},
"dependencies": {
"c12": "^1.11.1",
"change-case": "^5.4.4",
"consola": "^3.2.3",
"destr": "^2.0.3",
"klona": "^2.0.6",
"ofetch": "^1.3.4",
"ramda": "^0.30.1",
"type-fest": "^4.21.0",
"zod": "^3.23.8"
},
"devDependencies": {
"@antfu/eslint-config": "^2.22.0-beta.3",
"@types/node": "^20.14.10",
"@types/ramda": "^0.30.1",
"eslint": "^9.6.0",
"jiti": "^1.21.6",
"lint-staged": "^15.2.7",
"simple-git-hooks": "^2.11.1",
"tsup": "^8.1.0",
"typescript": "^5.5.3",
"unbuild": "^2.0.0"
},
"simple-git-hooks": {
"pre-commit": "pnpm lint-staged"
},
"lint-staged": {
"*": "eslint --fix"
}
}
Loading

0 comments on commit a83b549

Please sign in to comment.