Skip to content

Commit

Permalink
v2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
vv314 committed Dec 20, 2023
1 parent 9c74207 commit 2e05a13
Show file tree
Hide file tree
Showing 39 changed files with 4,262 additions and 3,635 deletions.
23 changes: 20 additions & 3 deletions .github/workflows/grab-coupon.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,30 @@ jobs:
uses: actions/setup-node@v3
with:
node-version-file: 'package.json'
cache: 'yarn'

- uses: pnpm/action-setup@v2
name: Install pnpm
with:
run_install: false

- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: yarn install --frozen-lockfile
run: pnpm install

- name: Run app
run: yarn start
run: pnpm start
env:
TOKEN: ${{ secrets.TOKEN }}
BARK_KEY: ${{ secrets.BARK_KEY }}
Expand Down
98 changes: 0 additions & 98 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,106 +1,8 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

.DS_Store

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache

# Next.js build output
.next

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and *not* Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port
19 changes: 13 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,31 +1,38 @@
# 参与贡献

1. [Fork 项目](https://help.github.com/articles/fork-a-repo/)
2. 安装依赖 (`yarn install`)
2. 安装依赖 (`pnpm install`)
3. 创建你的特性分支 (`git checkout -b my-new-feature`)
4. 提交你的修改 (`git commit -am 'Added some feature'`)
5. 测试你的修改 (`yarn test`)
5. 测试你的修改 (`pnpm test`)
6. 推送分支 (`git push origin my-new-feature`)
7. [创建 Pull Request](https://help.github.com/articles/creating-a-pull-request/)

## 开发

- 使用 Node 16+ 运行环境
- 使用 [Yarn](https://yarnpkg.com/) 作为包管理工具
- 使用 [Node.js](https://nodejs.org/) 18+ 运行环境
- 使用 [[email protected]](https://pnpm.io/) 作为包管理工具
- 使用 [ECMAScript](https://nodejs.org/api/esm.html#modules-ecmascript-modules) 模块规范
- 推荐使用 [corepack](https://github.com/nodejs/corepack) 匹配包管理器版本

### 初始化安装

```sh
npm run bootstrap
```

## 测试

使用 [Jest](https://github.com/facebook/jest) 作为测试套件。测试命令:

```sh
yarn test
pnpm test
```

## 编码规范

使用 [ESLint](https://eslint.org/)[editorconfig](http://editorconfig.org) 保持代码风格和最佳实践。请确保你的 PR 符合指南的要求,检测命令:

```sh
yarn lint
pnpm lint
```
39 changes: 28 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,31 @@
![外卖神券天天领](https://p0.meituan.net/dptakeaway/11b0b51183806e09f55a530fc0dd0409328863.jpg)
<p align="center">
<a href="https://github.com/vv314/actions-mtz-coupons" rel="noopener noreferrer">
<img width="260" src="https://github-production-user-asset-6210df.s3.amazonaws.com/7637375/291613192-73636f3d-7271-4802-b0fe-328c479c1e35.png">
</a>
</p>
<br/>
<p align="center">
<a href="https://github.com/vv314/actions-mtz-coupons"><img src="https://img.shields.io/github/actions/workflow/status/vv314/actions-mtz-coupons/grab-coupon.yml?branch=main&label=%E9%A2%86%E7%BA%A2%E5%8C%85&logo=github%20actions&style=flat" alt="workflow"></a>
<a href="https://github.com/vv314/actions-mtz-coupons/releases"><img src="https://img.shields.io/github/v/release/vv314/actions-mtz-coupons" alt="release"></a>
<a href="https://github.com/vv314/actions-mtz-coupons"><img src="https://img.shields.io/github/last-commit/vv314/actions-mtz-coupons/main?label=update" alt="update"></a>
<a href="https://github.com/vv314/actions-mtz-coupons/fork"><img src="https://img.shields.io/github/forks/vv314/actions-mtz-coupons" alt="forks"></a>
</p>
<br/>

# 🧧 外卖神券天天领

<p>外卖神券天天领,超值红包享不停;以自动化的方式领取外卖红包。</p><br/>

> [!TIP]
> ★ 专注领劵,不搞杂七杂八<br/>★ 多帐号支持,全村都能配上<br/>★ 并行化任务,数管齐下更有效率<br/>★ 异常重试,一次不行再来一次<br/>★ 多路消息通知,总有一个到达你<br/>★ Github Actions 部署,操作如此简单
> <br/>
# 🧧【美团】外卖神券天天领

![workflow](https://img.shields.io/github/actions/workflow/status/vv314/actions-mtz-coupons/grab-coupon.yml?branch=main&label=%E9%A2%86%E7%BA%A2%E5%8C%85&logo=github%20actions&style=flat) ![release](https://img.shields.io/github/v/release/vv314/actions-mtz-coupons) ![update](https://img.shields.io/github/last-commit/vv314/actions-mtz-coupons/main?label=update) ![fork](https://img.shields.io/github/forks/vv314/actions-mtz-coupons)

外卖神券天天领,超值红包享不停;以自动化的方式领取美团红包。
## 一、📕 使用手册

> ★ 专注领劵,不搞杂七杂八<br/>★ 多帐号支持,全村都能配上<br/>★ 并行化任务,数管齐下更有效率<br/>★ 异常重试,一次不行再来一次<br/>★ 多路消息通知,总有一个到达你<br/>★ Github Actions 部署,从未如此简单
#### 环境要求

## 一、📕 使用手册
- [Node.js](https://nodejs.org/) v18.0 及以上
- [pnpm](https://pnpm.io/) v8.0 及以上

#### 获取账号 TOKEN

Expand Down Expand Up @@ -392,7 +409,7 @@ Telegram 搜索 [@userinfobot](https://t.me/useridinfobot),点击 `/start`,

- 新建 `QMSG_ADMIN` 项,填入 qq 号

## 二、🔄 脚本更新
## 二、⬇️ 脚本更新

此项目将长期维护,为了确保副本能够及时享受到上游更新,请定期执行同步操作。

Expand Down Expand Up @@ -433,7 +450,7 @@ QYWX_SEND_CONF={"agentId": "1000002", "corpId": "wwxxxe9ddxxxc50xxx", "corpSecre
SEC69162axxxf59sdss23|https://oapi.dingtalk.com/robot/send?access_token=09bsdfa66xxxa608bsds
```

### 3.1 本地调试
### 3.1 本地运行

```bash
npm run start:local
Expand All @@ -445,7 +462,7 @@ npm run start:local
npm run test
```

## 四、参与贡献
## 四、🏗 参与贡献

请参阅:[CONTRIBUTING.md](https://github.com/vv314/actions-mtz-coupons/blob/main/CONTRIBUTING.md)

Expand Down
11 changes: 5 additions & 6 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ process.on('unhandledRejection', (e) => {
})

import pLimit from 'p-limit'
import Notifier from './lib/notifier/index.js'
import parseToken from './lib/parse-token.js'
import updateNotifier from './lib/update-notifier.js'
import { getCoupons } from './lib/coupons/index.js'
import { readPkgJson } from './lib/util.js'
import Notifier from './src/notifier/index.js'
import { parseToken } from './src/user.js'
import updateNotifier from './src/update-notifier.js'
import { getCoupons } from './src/coupons/index.js'
import { readPkgJson } from './src/util/index.js'

const { version: currentVersion } = readPkgJson()

Expand Down Expand Up @@ -201,7 +201,6 @@ async function checkUpdate(timeout) {

async function main() {
const tokens = parseToken(TOKEN)

const tasks = await runTaskQueue(tokens)

const globalPushInfo = sendGlobalNotify(tasks)
Expand Down
36 changes: 0 additions & 36 deletions lib/parse-token.js

This file was deleted.

17 changes: 12 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "actions-mtz-coupons",
"description": "外卖神券天天领",
"version": "1.9.0",
"version": "2.0.0",
"keywords": [
"外卖",
"红包"
Expand All @@ -10,18 +10,23 @@
"type": "module",
"author": "Vincent <[email protected]>",
"scripts": {
"bootstrap": "corepack enable && corepack pnpm i",
"start": "node index",
"start:local": "node index.local",
"lint": "eslint .",
"test": "yarn node --experimental-vm-modules $(yarn bin jest)",
"test": "NODE_OPTIONS=--experimental-vm-modules npx jest",
"sync": "node ./sync-upstream"
},
"packageManager": "^[email protected]",
"dependencies": {
"@wasmer/wasi": "^1.2.2",
"base64-js": "^1.5.1",
"crc-32": "^1.2.2",
"fflate": "^0.8.1",
"https-proxy-agent": "^5.0.1",
"node-fetch": "^3.3.0",
"p-limit": "^4.0.0",
"semver": "^7.3.8",
"sjcl": "^1.0.8",
"timeout-signal": "^2.0.0",
"tough-cookie": "^4.1.2"
},
Expand All @@ -30,6 +35,7 @@
"eslint": "^8.31.0",
"eslint-plugin-import": "^2.27.4",
"eslint-plugin-jest": "^27.2.1",
"fs-extra": "^11.2.0",
"jest": "^29.3.1"
},
"private": true,
Expand All @@ -42,7 +48,8 @@
},
"homepage": "https://github.com/vv314/actions-mtwm-coupons#readme",
"engines": {
"node": ">=16.0.0"
"node": ">=18.17.1"
},
"license": "MIT"
"license": "MIT",
"packageManager": "[email protected]+sha256.28ca61ece5a496148b73fabc9afb820f9c3fec4f55f04ce45a2cea0a5219f2e1"
}
Loading

0 comments on commit 2e05a13

Please sign in to comment.