Skip to content

This repository can serve as a starting point for writing ElasticView plugins. Feel free to base your own plugins on this repository.

License

Notifications You must be signed in to change notification settings

1340691923/eve-plugin-vue3-template

Repository files navigation

eve-plugin-vue3-template

Here is a template project for developing ElasticView plugins

中文 | English

Project start-up preparation:

Base start:
Make sure the ElasticView base program has been started

Environment configuration:
golang version >= 1.20
node version >= 20.14.0

install gowatch:
go install github.com/silenceper/gowatch@latest

Install auxiliary tools to the project root directory:
go build -o ev_plugin_zip .\cmd\ev_plugin_zip\main.go
go build -o ev_plugin_builder .\cmd\ev_plugin_builder\main.go

install pnpm:
npm install -g pnpm

Project infrastructure

-backend                      Backend project directory
    -api                      Controller layer
    -dto                      Web request structure
    -migrate                  SQLite data table version control module
    -versions                 Stores each version of the data table structure upgrade rollback
    -model                    Data access layer
    -my_error                 Template custom exception package
    -response                 Template custom response package
    -router                   Backend routing definition module
    -vo                       Web response structure
-cmd
    -ev_plugin_builder        Toolkit Used to compile binary plug-ins for various operating systems (windows, linux, darwin)
    -ev_plugin_zip            Toolkit Used to package project source code into zip
-frontend Frontend            project directory
    -dist                     Frontend final package file
    -src
    -api                      Interface access layer
    -lang                     Language package
    -layouts                  Default layout
    -plugin_sdk               Plugin sdk
    -router                   Frontend routing
    -views                    Page file

plugin.json:

{
  "developer": "xiaowenlong", //Developer Name
  "plugin_alias": "eve-plugin-vue3-template", //Plugin id is also called plugin alias
  "plugin_name":"hello-world", //plugin display name
  "frontend_debug": false, // Whether to enable front-end page debugging
  "version": "0.0.1",     //current version
  "main_go_file": "main.go", //  main.go file position
  "frontend_dev_port":7001, //Front-end project startup port
  "frontend_routes": [  // The front-end routing is consistent with routes
    {
      "path": "hello-world", 
      "name": "HelloWorld",
      "meta": {
        "title": "HelloWorld",
        "icon": "el-icon-coin"
      }
    },
    {
      "path": "db-test",
      "name": "db-test",
      "meta": {
        "title": "操作数据库",
        "icon": "el-icon-coin"
      }
    }
  ],
  "backend_routes": [   //Backend Routing
    {
      "path": "/api/HelloWorld",  //Interface access path
      "remark": "HelloWorld测试接口", 
      "needAuth": false       //Is authentication required?
    }
  ]
}




Backend plugin development

Project root directory execution:
1. go mod tidy
2. gowatch

Front-end plugin development


Key point: Modify frontend_debug in plugin.json to true

1. cd frontend && pnpm i

2. npm run dev

Front-end plugin packaging


1. cd frontend && npm run build

Back-end plugin packaging

Key point: Modify frontend_debug in plugin.json to false

Project root directory execution:
./ev_plugin_builder

A compressed package will appear in the dist directory. After decompression, it will be the plugin binary for different operating systems.

About

This repository can serve as a starting point for writing ElasticView plugins. Feel free to base your own plugins on this repository.

Resources

License

Stars

Watchers

Forks

Packages

No packages published