Skip to content

Commit

Permalink
feat: 初始化
Browse files Browse the repository at this point in the history
  • Loading branch information
babanbang committed Aug 18, 2024
0 parents commit 5037ee7
Show file tree
Hide file tree
Showing 10 changed files with 883 additions and 0 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Release and Publish # 发布和发布的工作流程名称
on:
push:
branches:
- main # 仅当推送到 main 分支时触发
permissions:
contents: write # 设置内容的权限为写
pull-requests: write # 设置拉取请求的权限为写
jobs:
release-please:
# 设置工作流程运行环境为 Ubuntu
runs-on: ubuntu-latest
steps:
# 使用 release-please-action@v3 动作
- uses: google-github-actions/release-please-action@v3
id: release
with:
# 设置发布类型为 Node.js
release-type: node
# 设置包名
package-name: karin-plugin-mystool-starrail
# 设置发起PR的默认分支
default-branch: main
# 检出代码
- uses: actions/checkout@v4
if: ${{ steps.release.outputs.release_created }}
# 设置 Node.js 环境
- uses: actions/setup-node@v4
with:
# 设置 Node.js 版本
node-version: 20
# 设置 npm 注册表 URL
registry-url: "https://registry.npmjs.org"
if: ${{ steps.release.outputs.release_created }}
# 添加node-karin并安装依赖
- run: npm install --save-dev node-karin karin-plugin-mystool && npm install
if: ${{ steps.release.outputs.release_created }}
# 编译
- run: npm run build
if: ${{ steps.release.outputs.release_created }}
# 安装jq工具 删除开发依赖
- run: sudo apt-get install jq && jq 'del(.devDependencies)' package.json > package.json.tmp && mv package.json.tmp package.json
if: ${{ steps.release.outputs.release_created }}
# 发布带npm
- run: npm run pub
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
if: ${{ steps.release.outputs.release_created }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/node_modules/
/lib/
674 changes: 674 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<p align="center">
<a href="https://github.com/babanbang/StarRail/commits/main" style="text-decoration: none;">
<img alt="GitHub last commit" src="https://img.shields.io/github/last-commit/babanbang/StarRail?color=%23114514&style=flat-square">
</a>
<a href="https://github.com/babanbang/StarRail" style="text-decoration: none;">
<img alt="GitHub repo size" src="https://img.shields.io/github/repo-size/babanbang/StarRail?style=flat-square">
</a>
</p>

> [!TIP]
> 请先确保你已经安装了[Karin](https://github.com/KarinJS/Karin)[karin-plugin-MysTool](https://github.com/babanbang/karin-plugin-MysTool)
#### 安装使用(开发中...)
```bash
# 在karin根目录执行
pnpm add karin-plugin-mystool-starrail@latest -w
```
27 changes: 27 additions & 0 deletions config/lables.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# 版本
version: 2.3
# 角色数
avatar: 51
# 成就
achievement: 845
# 战利品
chest: 787
# 梦境护照贴纸
dream_paster: 230

# 模拟宇宙技能树激活
unlocked_skill: 42
# 模拟宇宙解锁奇物
unlocked_miracle: 61
# 模拟宇宙解锁祝福
unlocked_buff: 232

# 差分宇宙总结点
skill_tree: 37

# 寰宇蝗灾行者之道
locust_narrow: 31
# 寰宇蝗灾已解锁奇物
locust_miracle: 66
# 寰宇蝗灾已解锁事件
locust_event: 75
5 changes: 5 additions & 0 deletions config/panel.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# 面板服务选择:0:自动,1:Mihomo,2:Avocado(鳄梨), 3:EnkaHSR。
# 如设置三位数字则为分服务器设置,按顺序分别为 国服/B服/外服,例如113代表国服B服Mihomo,国外EnkaHSR。
serv: 0
# UID绑定了cookie时使用米游社面板
MysApi: false
14 changes: 14 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import neostandard from 'neostandard'

const data = neostandard({
ignores: ['node_modules', 'temp', 'logs', 'data'],
globals: ['logger', 'NodeJS'],
ts: true,
})

/** 关闭驼峰命名 */
data.forEach((val, index) => {
if (val?.rules?.['camelcase']) data[index].rules['camelcase'] = ['off']
})

export default data
52 changes: 52 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
"name": "karin-plugin-mystool-starrail",
"version": "0.0.0",
"author": "babanbang",
"type": "module",
"description": "karin plugin MysTool StarRail",
"homepage": "https://github.com/babanbang/StarRail",
"bugs": {
"url": "https://github.com/babanbang/StarRail/issues"
},
"repository": {
"type": "git",
"url": "git+https://github.com/babanbang/StarRail.git"
},
"main": "lib/index.js",
"scripts": {
"build": "tsc --project tsconfig.json && tsc-alias -p tsconfig.json",
"pub": "npm publish --access public"
},
"devDependencies": {
"@types/express": "^4.17.21",
"@types/lodash": "^4.17.7",
"@types/node": "^20.14.11",
"@types/node-schedule": "^2.1.7",
"@types/ws": "^8.5.11",
"eslint": "^9.7.0",
"neostandard": "^0.11.1",
"tsc-alias": "^1.8.10",
"typescript": "^5.5.3"
},
"karin": {
"apps": [
"lib/apps"
],
"outDir": "lib",
"rootDir": "src"
},
"files": [
"/lib/**/*.js",
"/lib/**/*.d.ts",
"/config/*.yaml",
"/config/*.js",
"resources",
"LICENSE",
"package.json",
"README.md"
],
"publishConfig": {
"access": "public",
"registry": "https://registry.npmjs.org"
}
}
10 changes: 10 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { Cfg, MysUtil, Data, GameNames, GamePathType, GameList } from 'karin-plugin-mystool'
import { logger } from 'node-karin'

MysUtil.initGame(GameList.Sr)
/** 初始化配置 */
Cfg.initCfg(GamePathType.sr)

const pkg = Cfg.package(GamePathType.sr)
const name = Data.getGamePath(GamePathType.sr)
logger.info(`${logger.violet(`[插件:${pkg.version}]`)} ${logger.green(name)}${GameNames.sr}初始化完成~`)
34 changes: 34 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"compilerOptions": {
"module": "ESNext",
"target": "ESNext",
"esModuleInterop": true,
"moduleResolution": "Bundler",
"outDir": "./lib",
"resolveJsonModule": true,
"allowSyntheticDefaultImports": true,
"baseUrl": ".",
"paths": {
"@/*": [
"src/*"
],
},
"types": [
"@types/node"
],
"rootDir": "./src",
"declaration": true,
"noImplicitAny": true,
"strict": true
},
"tsc-alias": {
"resolveFullPaths": true,
"resolveFullExtension": ".js"
},
"include": [
"src/**/*",
],
"exclude": [
"node_modules",
]
}

0 comments on commit 5037ee7

Please sign in to comment.