mirror of
https://github.com/tidys/cc-inspector-chrome
synced 2025-04-13 21:51:03 +00:00
init
This commit is contained in:
parent
b9a88e5ef1
commit
d72e53815c
63
cc-inspector/cc-plugin.config.ts
Normal file
63
cc-inspector/cc-plugin.config.ts
Normal file
@ -0,0 +1,63 @@
|
||||
// @ts-ignore
|
||||
import {
|
||||
CocosPluginManifest,
|
||||
CocosPluginOptions,
|
||||
Panel,
|
||||
PluginType,
|
||||
} from "cc-plugin/src/declare";
|
||||
|
||||
const pkgName = "cc-inspector";
|
||||
|
||||
function i18n(key: string) {
|
||||
return `i18n:${pkgName}.${key}`;
|
||||
}
|
||||
|
||||
const manifest: CocosPluginManifest = {
|
||||
name: pkgName,
|
||||
version: "1.0.0",
|
||||
description: "cc-inspector",
|
||||
author: "xu_yanfeng",
|
||||
main: "./src/main.ts",
|
||||
panels: [
|
||||
{
|
||||
name: "main",
|
||||
type: Panel.Type.DockAble,
|
||||
main: "./src/panel/index.ts",
|
||||
title: "cc-inspector",
|
||||
width: 500,
|
||||
height: 400,
|
||||
minWidth: 50,
|
||||
minHeight: 400,
|
||||
},
|
||||
],
|
||||
menus: [
|
||||
{
|
||||
path: `cc-inspector/${i18n("title")}`,
|
||||
message: {
|
||||
name: "showPanel",
|
||||
},
|
||||
},
|
||||
],
|
||||
i18n_en: "./src/i18n/en.ts",
|
||||
i18n_zh: "./src/i18n/zh.ts",
|
||||
chrome: {
|
||||
view_devtools: "",
|
||||
view_options: "",
|
||||
view_popup: "",
|
||||
script_background: "",
|
||||
script_content: "",
|
||||
script_inject: "",
|
||||
},
|
||||
};
|
||||
// 这里的options变量名暂时不支持修改,发布时会进行必要的修改
|
||||
const options: CocosPluginOptions = {
|
||||
server: {
|
||||
enabled: true,
|
||||
port: 2022,
|
||||
},
|
||||
watchBuild: true,
|
||||
outputProject: {
|
||||
web: "./web",
|
||||
},
|
||||
};
|
||||
export default { manifest, options };
|
4
cc-inspector/cc-plugin.json
Normal file
4
cc-inspector/cc-plugin.json
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"v2": "",
|
||||
"v3": ""
|
||||
}
|
21
cc-inspector/package.json
Normal file
21
cc-inspector/package.json
Normal file
@ -0,0 +1,21 @@
|
||||
{
|
||||
"author": "cc-plugin",
|
||||
"description": "cocos creator plugin",
|
||||
"devDependencies": {
|
||||
"@types/fs-extra": "9.0.1",
|
||||
"@types/node": "16.11.12",
|
||||
"@xuyanfeng/cc-ui": "0.2.14",
|
||||
"cc-plugin": "file:.yalc/cc-plugin"
|
||||
},
|
||||
"name": "cc-plugin-demo",
|
||||
"scripts": {
|
||||
"installForce": "yarn install --force",
|
||||
"ccp-pack-v2": "cc-plugin pack cp-v2",
|
||||
"ccp-pack-v3": "cc-plugin pack cp-v3",
|
||||
"ccp-pack-web": "cc-plugin pack web",
|
||||
"ccp-serve-v2": "cc-plugin serve cp-v2",
|
||||
"ccp-serve-v3": "cc-plugin serve cp-v3",
|
||||
"ccp-serve-web": "cc-plugin serve web"
|
||||
},
|
||||
"version": "1.0.0"
|
||||
}
|
1
cc-inspector/src/i18n/en.ts
Normal file
1
cc-inspector/src/i18n/en.ts
Normal file
@ -0,0 +1 @@
|
||||
export const title = 'my first plugin'
|
1
cc-inspector/src/i18n/zh.ts
Normal file
1
cc-inspector/src/i18n/zh.ts
Normal file
@ -0,0 +1 @@
|
||||
export const title = '我的第一个插件'
|
19
cc-inspector/src/main.ts
Normal file
19
cc-inspector/src/main.ts
Normal file
@ -0,0 +1,19 @@
|
||||
import pluginConfig from '../cc-plugin.config';
|
||||
import CCP from 'cc-plugin/src/ccp/entry-main';
|
||||
import { BuilderOptions } from 'cc-plugin/src/declare'
|
||||
|
||||
CCP.init(pluginConfig, {
|
||||
load: () => {
|
||||
console.log('plugin load')
|
||||
},
|
||||
builder: {
|
||||
onAfterBuild(target: BuilderOptions) {
|
||||
|
||||
}
|
||||
},
|
||||
messages: {
|
||||
showPanel() {
|
||||
CCP.Adaptation.Panel.open('self.main')
|
||||
}
|
||||
}
|
||||
})
|
15
cc-inspector/src/panel/index.ts
Normal file
15
cc-inspector/src/panel/index.ts
Normal file
@ -0,0 +1,15 @@
|
||||
import { createApp } from 'vue'
|
||||
import App from './index.vue'
|
||||
import CCP from 'cc-plugin/src/ccp/entry-render';
|
||||
import pluginConfig from '../../cc-plugin.config'
|
||||
import ccui from '@xuyanfeng/cc-ui';
|
||||
import '@xuyanfeng/cc-ui/dist/ccui.css';
|
||||
import '@xuyanfeng/cc-ui/iconfont/iconfont.css';
|
||||
|
||||
export default CCP.init(pluginConfig, {
|
||||
ready: function (rootElement: any, args: any) {
|
||||
const app = createApp(App)
|
||||
app.use(ccui)
|
||||
app.mount(rootElement)
|
||||
}
|
||||
})
|
38
cc-inspector/src/panel/index.vue
Normal file
38
cc-inspector/src/panel/index.vue
Normal file
@ -0,0 +1,38 @@
|
||||
<template>
|
||||
<div class="panel">
|
||||
Hi, {{ msg }}
|
||||
<CCButton @click="onClickBtn">btn click-{{ count }}</CCButton>
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts">
|
||||
import { defineComponent, onMounted, ref, provide, nextTick } from 'vue';
|
||||
import PluginConfig from '../../cc-plugin.config';
|
||||
import ccui from '@xuyanfeng/cc-ui';
|
||||
const { CCInput, CCButton } = ccui.components;
|
||||
export default defineComponent({
|
||||
name: 'index',
|
||||
components: { CCButton },
|
||||
setup(props, { emit }) {
|
||||
onMounted(() => {
|
||||
console.log('hi ~~~');
|
||||
});
|
||||
const msg = ref(PluginConfig.manifest.name);
|
||||
const count = ref(0);
|
||||
return {
|
||||
msg,
|
||||
count,
|
||||
onClickBtn() {
|
||||
count.value++;
|
||||
console.log('click btn');
|
||||
},
|
||||
};
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped lang="less">
|
||||
.panel {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
</style>
|
9
cc-inspector/tsconfig.json
Normal file
9
cc-inspector/tsconfig.json
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"experimentalDecorators": true,
|
||||
"target": "ES6",
|
||||
"module": "commonjs",
|
||||
"baseUrl": "./src"
|
||||
}
|
||||
}
|
6854
cc-inspector/yarn.lock
Normal file
6854
cc-inspector/yarn.lock
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user