Skip to content

Commit

Permalink
refa: rename config to manager
Browse files Browse the repository at this point in the history
  • Loading branch information
shigma committed May 14, 2024
1 parent bd477e5 commit 298df91
Show file tree
Hide file tree
Showing 28 changed files with 23 additions and 29 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ declare module '@cordisjs/client' {

export const coreDeps = [
'@cordisjs/plugin-webui',
'@cordisjs/plugin-config',
'@cordisjs/plugin-manager',
'@cordisjs/plugin-server',
]

Expand Down
File renamed without changes.
15 changes: 8 additions & 7 deletions plugins/config/package.json → plugins/manager/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@cordisjs/plugin-config",
"name": "@cordisjs/plugin-manager",
"description": "Manage your bots and plugins with console",
"version": "2.8.6",
"version": "0.1.0",
"type": "module",
"exports": {
".": {
Expand All @@ -14,6 +14,7 @@
"default": "./lib/shared.js"
},
"./src/*": "./src/*",
"./client": "./client/index.ts",
"./package.json": "./package.json"
},
"files": [
Expand Down Expand Up @@ -42,7 +43,7 @@
"dist"
],
"description": {
"en": "Configure your plugins with WebUI",
"en": "Manage your plugins with WebUI",
"zh": "使用控制台查看、配置你的插件"
},
"service": {
Expand All @@ -55,12 +56,12 @@
}
},
"peerDependencies": {
"@cordisjs/loader": "^0.9.0",
"@cordisjs/plugin-webui": "^0.1.0",
"cordis": "^3.14.0"
"@cordisjs/loader": "^0.10.0",
"@cordisjs/plugin-webui": "^0.1.1",
"cordis": "^3.15.0"
},
"devDependencies": {
"@cordisjs/client": "^0.1.0",
"@cordisjs/client": "^0.1.1",
"@cordisjs/plugin-hmr": "^0.2.1"
},
"dependencies": {
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export abstract class Manager extends Service {
super(ctx, 'manager', true)

if (!ctx.loader?.writable) {
throw new Error('@cordisjs/plugin-config is only available for json/yaml config file')
throw new Error('@cordisjs/plugin-manager is only available for json/yaml config file')
}
}

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion plugins/notifier/client/config.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<script setup lang="ts">
import { Element } from '@cordisjs/element'
import {} from '@cordisjs/plugin-config/client'
import {} from '@cordisjs/plugin-manager/client'
import { useContext, useRpc, send } from '@cordisjs/client'
import type NotifierService from '../src'
import { h, computed, resolveComponent, FunctionalComponent } from 'vue'
Expand Down
15 changes: 6 additions & 9 deletions plugins/notifier/package.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,20 @@
{
"name": "@cordisjs/plugin-notifier",
"description": "Notifier service for Koishi",
"description": "Notifier service for Cordis",
"version": "0.1.0",
"main": "lib/index.cjs",
"types": "lib/index.d.ts",
"type": "module",
"exports": {
".": {
"import": "./lib/index.mjs",
"require": "./lib/index.cjs",
"types": "./lib/index.d.ts"
"types": "./lib/index.d.ts",
"default": "./lib/index.mjs"
},
"./src/*": "./src/*",
"./client": "./client/index.ts",
"./package.json": "./package.json"
},
"files": [
"lib",
"dist",
"src"
"dist"
],
"author": "Shigma <[email protected]>",
"license": "MIT",
Expand Down Expand Up @@ -62,7 +59,7 @@
},
"devDependencies": {
"@cordisjs/client": "^0.1.1",
"@cordisjs/plugin-config": "^2.8.6"
"@cordisjs/plugin-manager": "^0.1.0"
},
"dependencies": {
"@cordisjs/element": "^0.1.0",
Expand Down
16 changes: 6 additions & 10 deletions plugins/notifier/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { Context, Schema, Service } from 'cordis'
import { Dict, isNullable, remove } from 'cosmokit'
import { h } from '@cordisjs/element'
import type { Entry } from '@cordisjs/plugin-webui'
import { resolve } from 'path'

declare module 'cordis' {
interface Context {
Expand Down Expand Up @@ -105,15 +104,12 @@ class NotifierService extends Service {
ctx.inject(['webui'], (ctx) => {
ctx.on('dispose', () => this.entry = undefined)

this.entry = ctx.webui.addEntry(process.env.KOISHI_BASE ? [
process.env.KOISHI_BASE + '/dist/index.js',
process.env.KOISHI_BASE + '/dist/style.css',
] : process.env.KOISHI_ENV === 'browser' ? [
// @ts-ignore
import.meta.url.replace(/\/src\/[^/]+$/, '/client/index.ts'),
] : {
dev: resolve(__dirname, '../client/index.ts'),
prod: resolve(__dirname, '../dist'),
this.entry = ctx.webui.addEntry({
dev: import.meta.resolve('../client/index.ts'),
prod: [
import.meta.resolve('../dist/index.js'),
import.meta.resolve('../dist/style.css'),
],
}, () => ({
notifiers: this.store.map(notifier => notifier.toJSON()),
}))
Expand Down

0 comments on commit 298df91

Please sign in to comment.