Commit 5903ffb0 authored by nanahira's avatar nanahira

catchup

parent 31f5e155
...@@ -23,7 +23,7 @@ upload_to_minio: ...@@ -23,7 +23,7 @@ upload_to_minio:
tags: tags:
- linux - linux
script: script:
- aws s3 --endpoint=https://minio.mycard.moe:9000 sync --delete dist/ s3://nanahira/koishi-plugin/hisoutensoku-jammer - aws s3 --endpoint=https://minio.mycard.moe:9000 sync --delete dist/full/ s3://nanahira/koishi-plugin/hisoutensoku-jammer
only: only:
- master - master
......
This diff is collapsed.
...@@ -6,10 +6,13 @@ ...@@ -6,10 +6,13 @@
"dependencies": { "dependencies": {
"source-map-support": "^0.5.19" "source-map-support": "^0.5.19"
}, },
"peerDependencies": {
"koishi": "^4.0.0-beta.2"
},
"devDependencies": { "devDependencies": {
"@types/lodash": "^4.14.175", "@types/lodash": "^4.14.175",
"@types/node": "^15.0.1", "@types/node": "^15.0.1",
"koishi": "^4.0.0-alpha.8", "koishi": "^4.0.0-beta.2",
"lodash": "^4.17.21", "lodash": "^4.17.21",
"moment": "^2.29.1", "moment": "^2.29.1",
"raw-loader": "^4.0.2", "raw-loader": "^4.0.2",
...@@ -20,7 +23,7 @@ ...@@ -20,7 +23,7 @@
"webpack-cli": "^4.6.0" "webpack-cli": "^4.6.0"
}, },
"scripts": { "scripts": {
"build": "webpack" "build": "webpack && env PACK_ALL=1 webpack"
}, },
"repository": { "repository": {
"type": "git", "type": "git",
......
...@@ -4,8 +4,8 @@ import { Attacker } from "./attacker"; ...@@ -4,8 +4,8 @@ import { Attacker } from "./attacker";
import moment from "moment"; import moment from "moment";
export interface HisoutensokuJammerConfig { export interface HisoutensokuJammerConfig {
attackTimeout: number; attackTimeout?: number;
addressWhitelist: string[]; addressWhitelist?: string[];
} }
const chineseCharacterList = [ const chineseCharacterList = [
...@@ -125,6 +125,6 @@ export function apply( ...@@ -125,6 +125,6 @@ export function apply(
ctx: Context, ctx: Context,
config: HisoutensokuJammerConfig config: HisoutensokuJammerConfig
) { ) {
const hisoutensokuJammer = new HisoutensokuJammer(ctx, Schema.validate(config, schema)); const hisoutensokuJammer = new HisoutensokuJammer(ctx, config);
hisoutensokuJammer.apply(); hisoutensokuJammer.apply();
} }
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 = { module.exports = {
entry: "./src/index.ts", entry: './src/index.ts',
mode: "production", mode: 'production',
target: "node", target: 'node',
devtool: "source-map", devtool: 'source-map',
module: { module: {
rules: [ rules: [
{ {
test: /\.tsx?$/, test: /\.tsx?$/,
use: "ts-loader", use: 'ts-loader',
exclude: /node_modules/, exclude: /node_modules/,
}, },
{ test: /\.mustache$/, use: "raw-loader" }, { test: /\.mustache$/, use: 'raw-loader' },
], ],
}, },
resolve: { resolve: {
extensions: [".tsx", ".ts", ".js"], extensions: ['.tsx', '.ts', '.js'],
}, },
output: { output: {
filename: "index.js", filename: 'index.js',
library: { library: {
type: "commonjs", type: 'commonjs',
}, },
path: path.resolve(__dirname, "dist"), path: path.resolve(__dirname, packAll ? 'dist/full' : 'dist'),
}, },
externals: { 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