guqing
2022-06-10 16:29:08 +08:00
17 changed files with 3231 additions and 0 deletions

View File

@@ -0,0 +1,12 @@
# EditorConfig is awesome: https://EditorConfig.org
# top-most EditorConfig file
root = true
[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = false
insert_final_newline = true

View File

@@ -0,0 +1,15 @@
/* eslint-env node */
require("@rushstack/eslint-patch/modern-module-resolution");
module.exports = {
"root": true,
"extends": [
"plugin:vue/vue3-essential",
"eslint:recommended",
"@vue/eslint-config-typescript/recommended",
"@vue/eslint-config-prettier"
],
"env": {
"vue/setup-compiler-macros": true
}
}

28
admin-frontend/.gitignore vendored Normal file
View File

@@ -0,0 +1,28 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
node_modules
.DS_Store
dist
dist-ssr
coverage
*.local
/cypress/videos/
/cypress/screenshots/
# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

3
admin-frontend/README.md Normal file
View File

@@ -0,0 +1,3 @@
# halo-plugin-frontend-templateWIP
> Front-end template for Halo 2.0 pluggable system

6
admin-frontend/env.d.ts vendored Normal file
View File

@@ -0,0 +1,6 @@
/// <reference types="vite/client" />
declare module "*.vue" {
import Vue from "vue";
export default Vue;
}

View File

@@ -0,0 +1,37 @@
{
"name": "halo-plugin-frontend-template",
"version": "0.0.0",
"scripts": {
"dev": "vite build --watch",
"build": "vite build",
"preview": "vite preview --port 4173",
"test:unit": "vitest --environment jsdom",
"type-check": "vue-tsc --noEmit -p tsconfig.vitest.json --composite false",
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore"
},
"dependencies": {
"@halo-dev/admin-shared": "link:/Users/ryanwang/Workspace/github/ruibaby/halo-admin-next/packages/shared",
"@halo-dev/components": "link:/Users/ryanwang/Workspace/github/ruibaby/halo-admin-next/packages/components",
"vue": "^3.2.36"
},
"devDependencies": {
"@rushstack/eslint-patch": "^1.1.0",
"@types/jsdom": "^16.2.14",
"@types/node": "^16.11.36",
"@vitejs/plugin-vue": "^2.3.3",
"@vitejs/plugin-vue-jsx": "^1.3.10",
"@vue/eslint-config-prettier": "^7.0.0",
"@vue/eslint-config-typescript": "^10.0.0",
"@vue/test-utils": "^2.0.0",
"@vue/tsconfig": "^0.1.3",
"eslint": "^8.5.0",
"eslint-plugin-vue": "^8.2.0",
"jsdom": "^19.0.0",
"npm-run-all": "^4.1.5",
"prettier": "^2.5.1",
"typescript": "~4.7.2",
"vite": "^2.9.9",
"vitest": "^0.13.0",
"vue-tsc": "^0.35.2"
}
}

2974
admin-frontend/pnpm-lock.yaml generated Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 5.5 KiB

View File

@@ -0,0 +1,16 @@
<script lang="ts">
import {defineComponent, ref} from "vue";
export default defineComponent({
name: "HelloWorld",
setup() {
const msg = ref("Hello World");
return {
msg,
};
},
});
</script>
<template>
<div>{{ msg }}</div>
</template>

View File

@@ -0,0 +1,36 @@
import type { Plugin } from "@halo-dev/admin-shared/src/types";
import DefaultView from "./views/DefaultView.vue";
import { IconGrid } from "@halo-dev/components";
import "./styles/index.css";
const plugin: Plugin = {
name: "PluginTemplate",
components: [],
extensionPoints: {},
routes: [
{
path: "/hello-world",
name: "HelloWorld",
component: DefaultView,
},
],
menus: [
{
name: "From PluginTemplate",
items: [
{
name: "HelloWorld",
path: "/hello-world",
icon: IconGrid,
},
],
},
],
activated() {
// TODO
},
deactivated() {
// TODO
},
};
export default plugin;

View File

@@ -0,0 +1,3 @@
.title {
font-size: 20px;
}

View File

@@ -0,0 +1,23 @@
<script lang="ts">
import { defineComponent } from "vue";
import logo from "../assets/logo.svg";
export default defineComponent({
name: "DefaultView",
setup() {
return {
logo,
logoCircle
};
},
});
</script>
<template>
<div class="title">Hello World</div>
<img :src="logo" alt="logo" />
</template>
<style scoped>
.title {
color: red;
}
</style>

View File

@@ -0,0 +1,12 @@
{
"extends": "@vue/tsconfig/tsconfig.web.json",
"include": ["./env.d.ts", "./src/**/*", "./src/**/*.vue"],
"exclude": ["./src/**/__tests__/*"],
"compilerOptions": {
"composite": true,
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"]
}
}
}

View File

@@ -0,0 +1,8 @@
{
"extends": "@vue/tsconfig/tsconfig.node.json",
"include": ["vite.config.*", "vitest.config.*", "cypress.config.*"],
"compilerOptions": {
"composite": true,
"types": ["node"]
}
}

View File

@@ -0,0 +1,14 @@
{
"files": [],
"references": [
{
"path": "./tsconfig.config.json"
},
{
"path": "./tsconfig.app.json"
},
{
"path": "./tsconfig.vitest.json"
}
]
}

View File

@@ -0,0 +1,9 @@
{
"extends": "./tsconfig.app.json",
"exclude": [],
"compilerOptions": {
"composite": true,
"lib": [],
"types": ["node", "jsdom"]
}
}

View File

@@ -0,0 +1,34 @@
import {fileURLToPath, URL} from "url";
import {defineConfig} from "vite";
import vue from "@vitejs/plugin-vue";
import vueJsx from "@vitejs/plugin-vue-jsx";
// https://vitejs.dev/config/
export default defineConfig({
plugins: [vue(), vueJsx()],
resolve: {
alias: {
"@": fileURLToPath(new URL("./src", import.meta.url)),
},
},
build: {
outDir: fileURLToPath(new URL("../src/main/resources/admin", import.meta.url)),
emptyOutDir: true,
lib: {
entry: "src/index.ts",
name: "PluginTemplate",
formats: ["iife"],
fileName: () => "halo-plugin-template.js",
},
rollupOptions: {
external: ["vue", "@halo-dev/shared", "@halo-dev/components"],
output: {
globals: {
vue: "Vue",
"@halo-dev/components": "components",
},
},
},
},
});