mirror of
https://github.com/kubevela/kubevela.git
synced 2026-08-19 04:26:39 +00:00
Fixes issue #2185
This commit is contained in:
@@ -65,25 +65,7 @@ doc-gen:
|
||||
rm -r docs/en/cli/*
|
||||
go run hack/docgen/gen.go
|
||||
|
||||
PWD := $(shell pwd)
|
||||
docs-build:
|
||||
docker run -it -v $(PWD)/docs/sidebars.js:/workspace/kubevela.io/sidebars.js \
|
||||
-v $(PWD)/docs/en:/workspace/kubevela.io/docs \
|
||||
oamdev/vela-webtool:v1 -t build
|
||||
|
||||
docs-start:
|
||||
docker run -it -p 3000:3000 -v $(PWD)/docs/sidebars.js:/workspace/kubevela.io/sidebars.js \
|
||||
-v $(PWD)/docs/en:/workspace/kubevela.io/docs \
|
||||
oamdev/vela-webtool:v1 -t start
|
||||
|
||||
api-gen:
|
||||
swag init -g references/apiserver/route.go --output references/apiserver/docs
|
||||
swagger-codegen generate -l html2 -i references/apiserver/docs/swagger.yaml -o references/apiserver/docs
|
||||
mv references/apiserver/docs/index.html docs/en/developers/references/restful-api/
|
||||
|
||||
generate-source:
|
||||
go run hack/frontend/source.go
|
||||
|
||||
PWD := $(shell pwd)
|
||||
cross-build:
|
||||
rm -rf _bin
|
||||
go get github.com/mitchellh/gox@v0.4.0
|
||||
@@ -330,13 +312,6 @@ else
|
||||
KUSTOMIZE=$(shell which kustomize)
|
||||
endif
|
||||
|
||||
start-dashboard:
|
||||
go run references/cmd/apiserver/main.go &
|
||||
cd references/dashboard && npm install && npm start && cd ..
|
||||
|
||||
swagger-gen:
|
||||
$(GOBIN)/swag init -g apiserver/route.go -d pkg/ -o references/apiserver/docs/
|
||||
|
||||
check-license-header:
|
||||
./hack/licence/header-check.sh
|
||||
|
||||
|
||||
@@ -1,68 +0,0 @@
|
||||
/*
|
||||
Copyright 2021 The KubeVela Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/base64"
|
||||
"flag"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/oam-dev/kubevela/hack/utils"
|
||||
|
||||
"github.com/mholt/archiver/v3"
|
||||
)
|
||||
|
||||
func main() {
|
||||
tgz := archiver.NewTarGz()
|
||||
defer tgz.Close()
|
||||
var archiveDir, output string
|
||||
flag.StringVar(&archiveDir, "path", "references/dashboard/dist", "specify frontend static file")
|
||||
flag.StringVar(&output, "output", "", "specify output dir, if not set, output base64 result of the gzip result")
|
||||
flag.Parse()
|
||||
var stdout bool
|
||||
if output == "" {
|
||||
stdout = true
|
||||
output = fmt.Sprintf("vela-frontend-%d.tgz", time.Now().Nanosecond())
|
||||
}
|
||||
err := tgz.Archive([]string{archiveDir}, output)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
os.Exit(1)
|
||||
}
|
||||
if stdout {
|
||||
data, err := ioutil.ReadFile(output)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
os.Exit(1)
|
||||
}
|
||||
PrintToFile(base64.StdEncoding.EncodeToString(data))
|
||||
_ = os.Remove(output)
|
||||
}
|
||||
}
|
||||
|
||||
func PrintToFile(data string) {
|
||||
var buffer bytes.Buffer
|
||||
buffer.WriteString(`package fake
|
||||
var FrontendSource = "`)
|
||||
utils.FprintZipData(&buffer, []byte(data))
|
||||
buffer.WriteString(`"`)
|
||||
_ = ioutil.WriteFile("references/cmd/cli/fake/source.go", buffer.Bytes(), 0644)
|
||||
}
|
||||
Reference in New Issue
Block a user