feat: support config showPublisher

This commit is contained in:
Shigma 2023-01-27 23:22:05 +08:00
parent fb75824145
commit b2cf70c17d
No known key found for this signature in database
GPG Key ID: 414458B84ACF8744
2 changed files with 8 additions and 3 deletions

View File

@ -1,7 +1,7 @@
{ {
"name": "koishi-plugin-market-info", "name": "koishi-plugin-market-info",
"description": "Koishi plugin market information", "description": "Koishi plugin market information",
"version": "1.1.3", "version": "1.1.4",
"main": "lib/index.js", "main": "lib/index.js",
"typings": "lib/index.d.ts", "typings": "lib/index.d.ts",
"files": [ "files": [

View File

@ -24,6 +24,7 @@ export interface Config {
interval: number interval: number
showHidden: boolean showHidden: boolean
showDeletion: boolean showDeletion: boolean
showPublisher: boolean
showDescription: boolean showDescription: boolean
} }
@ -32,6 +33,7 @@ export const Config: Schema<Config> = Schema.object({
interval: Schema.number().default(Time.minute * 30).description('轮询间隔 (毫秒)。'), interval: Schema.number().default(Time.minute * 30).description('轮询间隔 (毫秒)。'),
showHidden: Schema.boolean().default(false).description('是否显示隐藏的插件。'), showHidden: Schema.boolean().default(false).description('是否显示隐藏的插件。'),
showDeletion: Schema.boolean().default(false).description('是否显示删除的插件。'), showDeletion: Schema.boolean().default(false).description('是否显示删除的插件。'),
showPublisher: Schema.boolean().default(false).description('是否显示插件发布者。'),
showDescription: Schema.boolean().default(false).description('是否显示插件描述。'), showDescription: Schema.boolean().default(false).description('是否显示插件描述。'),
}) })
@ -69,8 +71,11 @@ export function apply(ctx: Context, config: Config) {
if (!version1) { if (!version1) {
let output = `新增:${name}` let output = `新增:${name}`
const { description } = current[name].manifest if (config.showPublisher) output += ` (@${current[name].publisher.username})`
if (config.showDescription) output += `\n ${description.zh || description.en}` if (config.showDescription) {
const { description } = current[name].manifest
output += `\n ${description.zh || description.en}`
}
return output return output
} }