mirror of
https://github.com/fumiama/paper-manager.git
synced 2026-06-26 05:42:23 +08:00
implement production build
This commit is contained in:
29
frontend/vben/main.go
Normal file
29
frontend/vben/main.go
Normal file
@@ -0,0 +1,29 @@
|
||||
package vben
|
||||
|
||||
import (
|
||||
"archive/zip"
|
||||
"bytes"
|
||||
_ "embed" // embed dist.zip
|
||||
"io/fs"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
//go:generate npm run build
|
||||
|
||||
//go:generate zip -9 -r -D dist.zip dist/* -x "dist/.DS_Store" "dist/*/.DS_Store"
|
||||
|
||||
//go:embed dist.zip
|
||||
var distzipbytes []byte
|
||||
|
||||
// Distribution ...
|
||||
var Distribution = func() http.FileSystem {
|
||||
distzip, err := zip.NewReader(bytes.NewReader(distzipbytes), int64(len(distzipbytes)))
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
distfs, err := fs.Sub(fs.FS(distzip), "dist")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return http.FS(distfs)
|
||||
}()
|
||||
Reference in New Issue
Block a user