Skip to content

Commit

Permalink
feat(sandbox): init sandbox
Browse files Browse the repository at this point in the history
  • Loading branch information
shigma committed Feb 16, 2022
1 parent 351184e commit bd54bb0
Show file tree
Hide file tree
Showing 16 changed files with 113 additions and 4 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
community
temp
dist
lib
Expand Down
2 changes: 1 addition & 1 deletion packages/create/template/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"@koishijs/plugin-dataview": "^1.2.0",
"@koishijs/plugin-insight": "^1.2.0",
"@koishijs/plugin-logger": "^1.2.0",
"@koishijs/plugin-manager": "^1.5.0",
"@koishijs/plugin-manager": "^1.5.1",
"@koishijs/plugin-status": "^5.3.0",
"koishi": "^4.2.1"
}
Expand Down
2 changes: 1 addition & 1 deletion plugins/frontend/manager/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@koishijs/plugin-manager",
"description": "Manage your bots and plugins with console",
"version": "1.5.0",
"version": "1.5.1",
"main": "lib/index.js",
"typings": "lib/index.d.ts",
"files": [
Expand Down
11 changes: 11 additions & 0 deletions plugins/frontend/sandbox/client/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { Context } from '@koishijs/client'
import Sandbox from './index.vue'

export default (ctx: Context) => {
ctx.addPage({
name: '模拟调试',
path: '/sandbox',
order: 300,
component: Sandbox,
})
}
5 changes: 5 additions & 0 deletions plugins/frontend/sandbox/client/index.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<template>
<k-card-aside>
<template #aside>2333</template>
</k-card-aside>
</template>
9 changes: 9 additions & 0 deletions plugins/frontend/sandbox/client/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "../../tsconfig.base",
"compilerOptions": {
"rootDir": ".",
},
"include": [
".",
],
}
44 changes: 44 additions & 0 deletions plugins/frontend/sandbox/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"name": "@koishijs/plugin-sandbox",
"description": "Test Your Virtual Bot in Console",
"version": "1.0.0",
"main": "lib/index.js",
"typings": "lib/index.d.ts",
"files": [
"lib",
"dist"
],
"author": "Shigma <shigma10826@gmail.com>",
"license": "MIT",
"scripts": {
"lint": "eslint src --ext .ts"
},
"repository": {
"type": "git",
"url": "git+https://github.com/koishijs/koishi.git"
},
"bugs": {
"url": "https://github.com/koishijs/koishi/issues"
},
"homepage": "https://koishi.js.org/plugins/frontend/sandbox/",
"keywords": [
"bot",
"qqbot",
"cqhttp",
"coolq",
"chatbot",
"koishi",
"plugin",
"test",
"tester",
"sandbox",
"mock"
],
"peerDependencies": {
"koishi": "^4.2.1"
},
"devDependencies": {
"@koishijs/client": "^3.0.1",
"@koishijs/plugin-console": "^3.0.1"
}
}
29 changes: 29 additions & 0 deletions plugins/frontend/sandbox/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { Context, Schema } from 'koishi'
import { DataService } from '@koishijs/plugin-console'
import { resolve } from 'path'

declare module '@koishijs/plugin-console' {
namespace Console {
interface Services {
sandbox: SandboxService
}
}
}

export interface Config {}

export const Config: Schema<Config> = Schema.object({})

export default class SandboxService extends DataService {
static using = ['console'] as const
static schema: Schema<Config> = Schema.object({})

constructor(ctx: Context, private config: Config) {
super(ctx, 'sandbox')

ctx.console.addEntry({
dev: resolve(__dirname, '../client/index.ts'),
prod: resolve(__dirname, '../dist'),
})
}
}
File renamed without changes.
2 changes: 1 addition & 1 deletion plugins/github/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@koishijs/plugin-github",
"description": "GitHub toolkit for Koishi",
"version": "4.0.3",
"version": "4.0.4",
"main": "lib/index.js",
"typings": "lib/index.d.ts",
"files": [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@koishijs/plugin-mock",
"description": "Tester for Koishi",
"description": "Test Mocker for Koishi",
"version": "1.0.2",
"main": "lib/index.js",
"typings": "lib/index.d.ts",
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 10 additions & 0 deletions plugins/mock/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": "../../tsconfig.base",
"compilerOptions": {
"rootDir": "src",
"outDir": "lib",
},
"include": [
"src",
],
}

0 comments on commit bd54bb0

Please sign in to comment.