-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4efac39
commit 3e6a8d2
Showing
19 changed files
with
1,094 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,5 +2,4 @@ node_modules | |
dist | ||
*.local | ||
.vscode/* | ||
!.vscode/extensions.json | ||
app/tool | ||
!.vscode/extensions.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# 项目名称 | ||
VITE_APP_NAME = MiaoJi(喵记) | ||
|
||
# Issue 仓库名称 | ||
VITE_ISSUE_REPO = test-github | ||
|
||
# Issue 仓库持有者 | ||
VITE_ISSUE_owner = xiaohuohumax | ||
|
||
# Issue 标签创建权限 Token | ||
VITE_GITHUB_TOKEN = |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# @miaoji/label | ||
|
||
## 0.1.1 | ||
|
||
### Patch Changes | ||
|
||
- Updated dependencies | ||
- @miaoji/api@1.4.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# MiaoJi(喵记)标签辅助工具 | ||
|
||
**此工具用于快速创建 MiaoJi(喵记) Issue 标签** | ||
|
||
## 使用 | ||
|
||
1. 修改环境变量 (仓库, 拥有者, Token等) | ||
2. 修改[配置](./app.config.ts)自定义标签 (名称, 描述, 颜色等) | ||
3. 执行脚本 | ||
|
||
``` | ||
pnpm i | ||
pnpm start | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
import { Label } from '@miaoji/api'; | ||
import { defaultLabel, LabelName } from '@miaoji/base'; | ||
|
||
const { label } = defaultLabel; | ||
|
||
const appConfig: AppConfig = { | ||
// 需要创建的标签 | ||
// 颜色不填则为随机 | ||
cLabels: [ | ||
{ | ||
title: '主要功能标签', | ||
labels: [ | ||
{ | ||
name: label.communicationLabel, | ||
description: '留言', | ||
}, | ||
{ | ||
name: label.linkLabel, | ||
description: '友链', | ||
}, | ||
{ | ||
name: label.aboutLabel, | ||
description: '关于', | ||
}, | ||
{ | ||
name: label.docLabel, | ||
description: '文章', | ||
}, | ||
{ | ||
name: label.bannerLabel, | ||
description: '轮播图', | ||
}, | ||
{ | ||
name: label.historyLabel, | ||
description: '历史记录', | ||
}, | ||
{ | ||
name: label.photoLabel, | ||
description: '相册', | ||
} | ||
] | ||
}, | ||
{ | ||
title: '友链相关', | ||
labels: [ | ||
{ | ||
name: label.applyLinkLabel, | ||
description: '友链申请', | ||
}, | ||
] | ||
}, | ||
{ | ||
title: '历史记录相关', | ||
labels: [ | ||
{ | ||
name: 'func:history:warning', | ||
description: '历史:警告', | ||
color: 'f08a00' | ||
}, | ||
{ | ||
name: 'func:history:success', | ||
description: '历史:成功', | ||
color: '2a947d' | ||
}, | ||
{ | ||
name: 'func:history:info', | ||
description: '历史:信息', | ||
color: '3889c5' | ||
}, | ||
{ | ||
name: 'func:history:error', | ||
description: '历史:错误', | ||
color: 'd03a52' | ||
}, | ||
{ | ||
name: 'func:history:default', | ||
description: '历史:默认', | ||
color: '909092' | ||
}, | ||
] | ||
}, | ||
{ | ||
title: '其他辅助', | ||
labels: [ | ||
{ | ||
name: label.hiddenCommentLabel, | ||
description: '隐藏评论', | ||
}, | ||
] | ||
}, | ||
], | ||
name: import.meta.env.VITE_APP_NAME, | ||
api: { | ||
// github rest api 一般不变 | ||
apiBaseUrl: 'https://api.github.com', | ||
// 仓库名称 | ||
repo: import.meta.env.VITE_ISSUE_REPO, | ||
// 持有者 | ||
owner: import.meta.env.VITE_ISSUE_owner, | ||
// github token Issue 标签创建权限 | ||
accessToken: import.meta.env.VITE_GITHUB_TOKEN, | ||
}, | ||
// 标签 | ||
label: label, | ||
}; | ||
|
||
export type CLabel = Partial<Omit<Label, 'id'>> & { | ||
name: string | ||
} | ||
|
||
type AppConfig = { | ||
cLabels: { | ||
title: string, | ||
labels: CLabel[] | ||
}[], | ||
name: string, | ||
api: { | ||
apiBaseUrl: string, | ||
repo: string, | ||
owner: string, | ||
accessToken?: string | ||
}, | ||
label: LabelName | ||
} | ||
|
||
export default appConfig; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"name": "@miaoji/label", | ||
"version": "0.1.1", | ||
"description": "MiaoJi(喵记)标签辅助工具", | ||
"main": "index.ts", | ||
"type": "module", | ||
"repository": "https://github.com/xiaohuohumax/MiaoJi", | ||
"author": { | ||
"name": "xiaohuohumax", | ||
"url": "https://github.com/xiaohuohumax" | ||
}, | ||
"scripts": { | ||
"start": "vite-node src/index.ts" | ||
}, | ||
"keywords": [], | ||
"license": "MIT", | ||
"dependencies": { | ||
"@inquirer/prompts": "^3.3.0", | ||
"@miaoji/api": "workspace:^", | ||
"@miaoji/base": "workspace:^", | ||
"@miaoji/util": "workspace:^", | ||
"@types/node": "^20.10.6", | ||
"await-to-js": "^3.0.0", | ||
"axios": "^1.6.3", | ||
"typescript": "^5.0.2", | ||
"vite-node": "^1.1.3" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { LabelApi } from '@miaoji/api'; | ||
import { RequestExecutor } from '@miaoji/util'; | ||
import appConfig from '../../app.config'; | ||
|
||
const executor = RequestExecutor.create({ | ||
baseURL: appConfig.api.apiBaseUrl, | ||
timeout: 10_0000, | ||
headers: { | ||
Accept: 'application/json', | ||
Authorization: 'Bearer ' + appConfig.api.accessToken | ||
}, | ||
interceptors: { | ||
reqtInterceptors(config) { | ||
return config; | ||
}, | ||
reqInterceptorCatch(err) { | ||
return Promise.reject(err); | ||
}, | ||
resInterceptors(response) { | ||
return response; | ||
}, | ||
resInterceptorCatch(err) { | ||
return Promise.reject(err); | ||
}, | ||
} | ||
}); | ||
|
||
export const labelApi = new LabelApi(executor, appConfig.api.owner, appConfig.api.repo); |
Oops, something went wrong.