Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
K
Koishi Plugin Ygocard
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
3rdeye
Koishi Plugin Ygocard
Commits
774aef24
Commit
774aef24
authored
Nov 21, 2021
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
catchup
parent
589953bb
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
134 additions
and
102 deletions
+134
-102
.gitlab-ci.yml
.gitlab-ci.yml
+0
-11
package-lock.json
package-lock.json
+96
-71
package.json
package.json
+8
-8
src/config.ts
src/config.ts
+5
-2
src/index.ts
src/index.ts
+5
-3
src/plugin.ts
src/plugin.ts
+4
-5
webpack.config.js
webpack.config.js
+16
-2
No files found.
.gitlab-ci.yml
View file @
774aef24
...
@@ -16,17 +16,6 @@ build:
...
@@ -16,17 +16,6 @@ build:
paths
:
paths
:
-
dist/
-
dist/
upload_to_minio
:
stage
:
deploy
dependencies
:
-
build
tags
:
-
linux
script
:
-
aws s3 --endpoint=https://minio.mycard.moe:9000 sync --delete dist/ s3://nanahira/koishi-plugin/ygocard
only
:
-
master
deploy_npm
:
deploy_npm
:
stage
:
deploy
stage
:
deploy
dependencies
:
dependencies
:
...
...
package-lock.json
View file @
774aef24
This diff is collapsed.
Click to expand it.
package.json
View file @
774aef24
...
@@ -26,10 +26,15 @@
...
@@ -26,10 +26,15 @@
"homepage"
:
"
https://code.mycard.moe/3rdeye/koishi-plugin-ygocard
"
,
"homepage"
:
"
https://code.mycard.moe/3rdeye/koishi-plugin-ygocard
"
,
"dependencies"
:
{
"dependencies"
:
{
"
better-sqlite3
"
:
"
^7.4.3
"
,
"
better-sqlite3
"
:
"
^7.4.3
"
,
"
source-map-support
"
:
"
^0.5.20
"
"
schemastery-gen
"
:
"
^1.0.3
"
,
"
source-map-support
"
:
"
^0.5.20
"
,
"
leven
"
:
"
3.1
"
,
"
lodash
"
:
"
^4.17.21
"
,
"
mustache
"
:
"
^4.2.0
"
,
"
class-transformer
"
:
"
^0.4.0
"
},
},
"peerDependencies"
:
{
"peerDependencies"
:
{
"
koishi
"
:
"
^4.0.0-
alpha.9
"
"
koishi
"
:
"
^4.0.0-
beta.2
"
},
},
"devDependencies"
:
{
"devDependencies"
:
{
"
@types/better-sqlite3
"
:
"
^7.4.0
"
,
"
@types/better-sqlite3
"
:
"
^7.4.0
"
,
...
@@ -38,15 +43,10 @@
...
@@ -38,15 +43,10 @@
"
@types/node
"
:
"
^16.11.1
"
,
"
@types/node
"
:
"
^16.11.1
"
,
"
@typescript-eslint/eslint-plugin
"
:
"
^4.33.0
"
,
"
@typescript-eslint/eslint-plugin
"
:
"
^4.33.0
"
,
"
@typescript-eslint/parser
"
:
"
^4.33.0
"
,
"
@typescript-eslint/parser
"
:
"
^4.33.0
"
,
"
class-transformer
"
:
"
^0.4.0
"
,
"
eslint
"
:
"
^7.32.0
"
,
"
eslint
"
:
"
^7.32.0
"
,
"
eslint-config-prettier
"
:
"
^8.3.0
"
,
"
eslint-config-prettier
"
:
"
^8.3.0
"
,
"
eslint-plugin-prettier
"
:
"
^3.4.1
"
,
"
eslint-plugin-prettier
"
:
"
^3.4.1
"
,
"
koishi
"
:
"
^4.0.0-alpha.9
"
,
"
koishi
"
:
"
^4.0.0-beta.2
"
,
"
koishi-utils-schemagen
"
:
"
^1.1.7
"
,
"
leven
"
:
"
3.1
"
,
"
lodash
"
:
"
^4.17.21
"
,
"
mustache
"
:
"
^4.2.0
"
,
"
prettier
"
:
"
^2.4.1
"
,
"
prettier
"
:
"
^2.4.1
"
,
"
raw-loader
"
:
"
^4.0.2
"
,
"
raw-loader
"
:
"
^4.0.2
"
,
"
ts-loader
"
:
"
^9.2.6
"
,
"
ts-loader
"
:
"
^9.2.6
"
,
...
...
src/config.ts
View file @
774aef24
import
{
DefineSchema
,
UseSchema
}
from
'
koishi-utils-schema
gen
'
;
import
{
DefineSchema
,
RegisterSchema
}
from
'
schemastery-
gen
'
;
import
{
Schema
}
from
'
koishi
'
;
import
{
Schema
}
from
'
koishi
'
;
import
{
YGOProCardLike
}
from
'
./YGOProCard
'
;
import
{
YGOProCardLike
}
from
'
./YGOProCard
'
;
import
_
from
'
lodash
'
;
import
_
from
'
lodash
'
;
import
{
renderTemplate
}
from
'
./utility
'
;
import
{
renderTemplate
}
from
'
./utility
'
;
@
RegisterSchema
()
export
class
YGOCardConfig
{
export
class
YGOCardConfig
{
@
DefineSchema
({
type
:
'
string
'
,
desc
:
'
命令名
'
,
default
:
'
card
'
})
@
DefineSchema
({
type
:
'
string
'
,
desc
:
'
命令名
'
,
default
:
'
card
'
})
commandName
:
string
;
commandName
:
string
;
...
@@ -19,7 +20,9 @@ export class YGOCardConfig {
...
@@ -19,7 +20,9 @@ export class YGOCardConfig {
@
DefineSchema
({
type
:
'
number
'
,
default
:
100
,
desc
:
'
查询最多显示的数量
'
})
@
DefineSchema
({
type
:
'
number
'
,
default
:
100
,
desc
:
'
查询最多显示的数量
'
})
matchCount
:
number
;
matchCount
:
number
;
@
UseSchema
(
Schema
.
select
([
'
cn
'
,
'
en
'
],
'
显示语言
'
).
default
(
'
cn
'
))
@
DefineSchema
({
schema
:
Schema
.
select
([
'
cn
'
,
'
en
'
],
'
显示语言
'
).
default
(
'
cn
'
),
})
lang
:
'
cn
'
|
'
en
'
;
lang
:
'
cn
'
|
'
en
'
;
@
DefineSchema
({
type
:
'
boolean
'
,
desc
:
'
是否展示卡图
'
,
default
:
true
})
@
DefineSchema
({
type
:
'
boolean
'
,
desc
:
'
是否展示卡图
'
,
default
:
true
})
...
...
src/index.ts
View file @
774aef24
import
'
source-map-support/register
'
;
import
'
source-map-support/register
'
;
import
{
Context
}
from
'
koishi
'
;
import
{
Context
}
from
'
koishi
'
;
import
{
Config
,
MyPlugin
}
from
'
./plugin
'
;
import
{
MyPlugin
}
from
'
./plugin
'
;
export
{
Config
}
from
'
./plugin
'
;
import
{
YGOCardConfig
}
from
'
./config
'
;
export
*
from
'
./plugin
'
;
export
*
from
'
./config
'
;
export
const
name
=
'
ygocard
'
;
export
const
name
=
'
ygocard
'
;
const
plugin
=
new
MyPlugin
();
const
plugin
=
new
MyPlugin
();
export
const
schema
=
plugin
.
schema
;
export
const
schema
=
plugin
.
schema
;
export
function
apply
(
ctx
:
Context
,
config
:
Config
)
{
export
function
apply
(
ctx
:
Context
,
config
:
YGOCard
Config
)
{
ctx
.
plugin
(
plugin
,
config
);
ctx
.
plugin
(
plugin
,
config
);
}
}
src/plugin.ts
View file @
774aef24
import
'
source-map-support/register
'
;
import
'
source-map-support/register
'
;
import
{
Context
,
Schema
}
from
'
koishi
'
;
import
{
Context
}
from
'
koishi
'
;
import
{
YGOCardConfig
}
from
'
./config
'
;
import
{
YGOCardConfig
}
from
'
./config
'
;
import
{
schemaFromClass
,
schemaTransform
}
from
'
koishi-utils-schemagen
'
;
import
sqlite
,
{
Database
}
from
'
better-sqlite3
'
;
import
sqlite
,
{
Database
}
from
'
better-sqlite3
'
;
import
{
promises
as
fs
}
from
'
fs
'
;
import
{
promises
as
fs
}
from
'
fs
'
;
import
_
from
'
lodash
'
;
import
_
from
'
lodash
'
;
...
@@ -16,7 +15,7 @@ export class MyPlugin {
...
@@ -16,7 +15,7 @@ export class MyPlugin {
private
ctx
:
Context
;
private
ctx
:
Context
;
private
dbs
:
Database
[]
=
[];
private
dbs
:
Database
[]
=
[];
name
=
'
ygocard-main
'
;
name
=
'
ygocard-main
'
;
schema
:
Schema
<
Config
>
=
schemaFromClass
(
YGOCardConfig
)
;
schema
=
YGOCardConfig
;
private
queryInDB
(
value
:
string
,
db
:
Database
)
{
private
queryInDB
(
value
:
string
,
db
:
Database
)
{
const
possibleValueNumber
=
parseInt
(
value
)
||
0
;
const
possibleValueNumber
=
parseInt
(
value
)
||
0
;
const
statement
=
db
.
prepare
<
[
number
,
string
,
string
]
>
(
const
statement
=
db
.
prepare
<
[
number
,
string
,
string
]
>
(
...
@@ -55,9 +54,9 @@ export class MyPlugin {
...
@@ -55,9 +54,9 @@ export class MyPlugin {
}),
}),
);
);
}
}
async
apply
(
ctx
:
Context
,
config
:
Config
)
{
async
apply
(
ctx
:
Context
,
config
:
YGOCard
Config
)
{
this
.
ctx
=
ctx
;
this
.
ctx
=
ctx
;
this
.
config
=
schemaTransform
(
YGOCardConfig
,
config
)
;
this
.
config
=
config
;
await
this
.
loadDBs
();
await
this
.
loadDBs
();
ctx
.
on
(
'
connect
'
,
()
=>
this
.
loadDBs
());
ctx
.
on
(
'
connect
'
,
()
=>
this
.
loadDBs
());
ctx
.
on
(
'
disconnect
'
,
()
=>
{
ctx
.
on
(
'
disconnect
'
,
()
=>
{
...
...
webpack.config.js
View file @
774aef24
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
'
,
...
@@ -23,10 +37,10 @@ module.exports = {
...
@@ -23,10 +37,10 @@ module.exports = {
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
'
,
'
better-sqlite3
'
:
'
better-sqlite3
'
,
...(
packAll
?
{}
:
externalsFromDep
())
,
},
},
};
};
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment