refactor(infra): directory structure (#4615)

This commit is contained in:
Joooye_34
2023-10-18 23:30:08 +08:00
committed by GitHub
parent 814d552be8
commit bed9310519
1150 changed files with 539 additions and 584 deletions

View File

@@ -0,0 +1,10 @@
{
"root": false,
"parser": "vue-eslint-parser",
"parserOptions": {
"parser": "@typescript-eslint/parser",
"sourceType": "module",
"extraFileExtensions": [".vue"]
},
"extends": ["plugin:vue/vue3-recommended"]
}

View File

@@ -0,0 +1,26 @@
{
"name": "@affine/vue-hello-world-plugin",
"type": "module",
"private": true,
"description": "Vue hello world plugin",
"version": "0.10.0-canary.1",
"scripts": {
"dev": "af dev",
"build": "af build"
},
"affinePlugin": {
"release": "development",
"entry": {
"core": "./src/index.ts"
}
},
"dependencies": {
"@affine/component": "workspace:*",
"@affine/sdk": "workspace:*",
"element-plus": "^2.4.0",
"vue": "^3.3.4"
},
"devDependencies": {
"@affine/plugin-cli": "workspace:*"
}
}

View File

@@ -0,0 +1,26 @@
{
"name": "@affine/vue-hello-world-plugin",
"$schema": "../../../node_modules/nx/schemas/project-schema.json",
"namedInputs": {
"default": [
"{projectRoot}/**/*",
"{workspaceRoot}/tools/plugin-cli/src/**/*",
"sharedGlobals"
]
},
"targets": {
"build": {
"executor": "nx:run-script",
"options": {
"script": "build"
},
"dependsOn": ["^build"],
"inputs": ["default"],
"outputs": [
"{workspaceRoot}/packages/frontend/core/public/plugins/vue-hello-world",
"{workspaceRoot}/packages/frontend/electron/dist/plugins/vue-hello-world"
]
}
},
"tags": ["plugin"]
}

View File

@@ -0,0 +1,17 @@
<script setup lang="ts">
import { ref } from 'vue';
const count = ref(0);
</script>
<template>
<el-button @click="count++">
{{ count }}
</el-button>
</template>
<style scoped>
.el-button {
font-size: 30px;
}
</style>

View File

@@ -0,0 +1,5 @@
declare module '*.vue' {
import type { ComponentOptions } from 'vue';
const component: ComponentOptions;
export default component;
}

View File

@@ -0,0 +1,18 @@
import type { PluginContext } from '@affine/sdk/entry';
import ElementPlus from 'element-plus';
import { createApp } from 'vue';
import App from './app.vue';
export const entry = (context: PluginContext) => {
context.register('headerItem', div => {
const app = createApp(App);
app.use(ElementPlus);
app.mount(div, false, false);
return () => {
app.unmount();
};
});
return () => {};
};

View File

@@ -0,0 +1,14 @@
{
"extends": "../../../tsconfig.json",
"include": ["./src"],
"compilerOptions": {
"noEmit": false,
"outDir": "lib",
"jsx": "preserve"
},
"references": [
{
"path": "../../common/sdk"
}
]
}