Commit f223b288 authored by nanahira's avatar nanahira

catchup

parent a5592430
......@@ -23,7 +23,7 @@ upload_to_minio:
tags:
- linux
script:
- aws s3 --endpoint=https://minio.mycard.moe:9000 sync --delete dist/ s3://nanahira/koishi-plugin/srvpro-roomlist
- aws s3 --endpoint=https://minio.mycard.moe:9000 sync --delete dist/full/ s3://nanahira/koishi-plugin/srvpro-roomlist
only:
- master
......
This diff is collapsed.
......@@ -6,7 +6,7 @@
"types": "dist/index.d.ts",
"scripts": {
"lint": "eslint --fix .",
"build": "webpack"
"build": "webpack && env PACK_ALL=1 webpack"
},
"repository": {
"type": "git",
......@@ -28,25 +28,24 @@
},
"homepage": "https://code.mycard.moe/3rdeye/koishi-plugin-srvpro-roomlist",
"dependencies": {
"source-map-support": "^0.5.20"
"schemastery-gen": "^1.0.3",
"source-map-support": "^0.5.20",
"lodash": "^4.17.21",
"class-transformer": "^0.4.0"
},
"peerDependencies": {
"koishi": "^4.0.0-alpha.9"
"koishi": "^4.0.0-beta.2"
},
"devDependencies": {
"@types/lodash": "^4.14.175",
"@types/node": "^16.11.1",
"@typescript-eslint/eslint-plugin": "^4.33.0",
"@typescript-eslint/parser": "^4.33.0",
"class-transformer": "^0.4.0",
"eslint": "^7.32.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-prettier": "^3.4.1",
"koishi": "^4.0.0-alpha.9",
"koishi-utils-schemagen": "^1.1.7",
"lodash": "^4.17.21",
"koishi": "^4.0.0-beta.2",
"prettier": "^2.4.1",
"proxy-agent": "^5.0.0",
"raw-loader": "^4.0.2",
"ts-loader": "^9.2.6",
"typescript": "^4.4.4",
......
import 'source-map-support/register';
import { DefineSchema, SchemaConf } from 'koishi-utils-schemagen';
import { Context } from 'koishi';
import { SRVProRoomInfo } from './def';
import { plainToClass } from 'class-transformer';
import { RegisterSchema, DefineSchema } from 'schemastery-gen';
export interface ServerLike {
name: string;
......@@ -15,7 +15,7 @@ export interface ServerLike {
displayPlayerIp?: boolean;
}
@SchemaConf({ desc: 'SRVPro 服务器' })
@RegisterSchema({ desc: 'SRVPro 服务器' })
export class Server implements ServerLike {
@DefineSchema({ desc: '服务器名称', required: true })
name: string;
......@@ -69,7 +69,7 @@ export interface MyPluginConfigLike {
servers: ServerLike[];
}
@SchemaConf({ required: true })
@RegisterSchema({ required: true })
export class MyPluginConfig implements MyPluginConfigLike {
@DefineSchema({ desc: '服务器列表命令名', default: 'serverlist' })
listCommandName: string;
......
import 'source-map-support/register';
import { Context } from 'koishi';
import { MyPlugin } from './plugin';
import { MyPluginConfig, MyPluginConfigLike } from './config';
import { MyPluginConfig } from './config';
export { MyPluginConfig } from './config';
export const name = 'srvpro-roomlist';
const plugin = new MyPlugin();
export const schema = plugin.schema;
export function apply(ctx: Context, config: MyPluginConfigLike) {
export function apply(ctx: Context, config: MyPluginConfig) {
ctx.plugin(plugin, config);
}
import 'source-map-support/register';
import { Context, Schema } from 'koishi';
import { MyPluginConfig, MyPluginConfigLike } from './config';
import { schemaFromClass, schemaTransform } from 'koishi-utils-schemagen';
import { Context } from 'koishi';
import { MyPluginConfig } from './config';
export class MyPlugin {
private config: MyPluginConfig;
private ctx: Context;
name = 'srvpro-roomlist-main';
schema: Schema<MyPluginConfigLike> = schemaFromClass(MyPluginConfig);
apply(ctx: Context, config: MyPluginConfigLike) {
schema = MyPluginConfig;
apply(ctx: Context, config: MyPluginConfig) {
this.ctx = ctx;
this.config = schemaTransform(MyPluginConfig, config);
this.config = config;
ctx
.command(`${this.config.listCommandName}`, '获取服务器列表')
.action(
......
const path = require("path");
const path = require('path');
const packgeInfo = require('./package.json');
function externalsFromDep() {
return Object.fromEntries(
[
...Object.keys(packgeInfo.dependencies || {}),
...Object.keys(packgeInfo.peerDependencies || {}),
]
.filter((dep) => dep !== 'source-map-support')
.map((dep) => [dep, dep]),
);
}
const packAll = !!process.env.PACK_ALL;
module.exports = {
entry: "./src/index.ts",
mode: "production",
target: "node",
devtool: "source-map",
entry: './src/index.ts',
mode: 'production',
target: 'node',
devtool: 'source-map',
module: {
rules: [
{
test: /\.tsx?$/,
use: "ts-loader",
use: 'ts-loader',
exclude: /node_modules/,
},
{ test: /\.mustache$/, use: "raw-loader" },
{ test: /\.mustache$/, use: 'raw-loader' },
],
},
resolve: {
extensions: [".tsx", ".ts", ".js"],
extensions: ['.tsx', '.ts', '.js'],
},
output: {
filename: "index.js",
filename: 'index.js',
library: {
type: "commonjs",
type: 'commonjs',
},
path: path.resolve(__dirname, "dist"),
path: path.resolve(__dirname, packAll ? 'dist/full' : 'dist'),
},
externals: {
'koishi': 'koishi',
}
koishi: 'koishi',
...(packAll ? {} : externalsFromDep()),
},
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment