Skip to content

Commit

Permalink
Merge pull request #11 from zheng1/refactor
Browse files Browse the repository at this point in the history
Add readme locals
  • Loading branch information
zheng1 authored Oct 28, 2022
2 parents 94d5431 + 33fba81 commit aa0fe08
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
6 changes: 6 additions & 0 deletions pkg/extension/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ const (
_tplKeyValuesYaml
_tplKeyHelmignore
_tplKeyFavicon
_tplKeyReadmeZh
_tplKeyReadmeEn
_tplKeyFrontendChartYaml
_tplKeyFrontendChartValues
_tplKeyFrontendDeploymentYaml
Expand All @@ -45,6 +47,8 @@ var (
_tplKeyValuesYaml: "/values.yaml",
_tplKeyHelmignore: "/.helmignore",
_tplKeyFavicon: "/favicon.svg",
_tplKeyReadmeZh: "/README_zh.md",
_tplKeyReadmeEn: "/README.md",
_tplKeyFrontendChartYaml: "/charts/frontend/Chart.yaml",
_tplKeyFrontendChartValues: "/charts/frontend/values.yaml",
_tplKeyFrontendDeploymentYaml: "/charts/frontend/templates/deployment.yaml",
Expand All @@ -68,6 +72,8 @@ var (
_tplKeyValuesYaml: tplValuesYaml,
_tplKeyHelmignore: tplHelmignore,
_tplKeyFavicon: tplFavicon,
_tplKeyReadmeZh: tplReadmeZh,
_tplKeyReadmeEn: tplReadmeEn,
_tplKeyFrontendChartYaml: _tplFrontendChartYaml,
_tplKeyFrontendChartValues: _tplFrontendValuesYaml,
_tplKeyFrontendDeploymentYaml: _tplFrontendDeploymentYaml,
Expand Down
5 changes: 4 additions & 1 deletion pkg/extension/template_chart.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const (
tplExtensionYaml = `apiVersion: v1
name: [[ .Name ]]
description: [[ .Desc ]]
version: 0.0.1
version: 0.1.0
displayName:
zh: 示例扩展组件
en: Sample Extension
Expand Down Expand Up @@ -62,4 +62,7 @@ backend:
.vscode/
`
tplFavicon = `<svg xmlns="http://www.w3.org/2000/svg" width="477.333" height="477.333"><svg version="1.0" xmlns="http://www.w3.org/2000/svg" width="477.333" height="477.333" viewBox="0 0 358 358" fill="#00ad6e"><path d="M174.5 5.4c-1.1.8-28.5 16.8-61 35.6-32.4 18.9-65.2 37.9-72.8 42.4l-13.7 8v175.3l12.8 7.4c7 4.1 13.6 7.9 14.7 8.5 1.1.6 15.3 8.9 31.5 18.4 16.2 9.4 31.3 18.2 33.5 19.5 2.2 1.2 15.9 9.2 30.5 17.8 14.6 8.5 26.6 15.4 26.8 15.2.2-.2.4-114.8.2-129 0-3.8-.3-4.1-6.2-7.5-3.5-1.9-8.3-4.7-10.8-6.2s-5.1-3.1-5.9-3.4c-.8-.4-8.6-5-17.5-10.2-20.1-11.8-25.5-15-28.3-16.4-1.3-.6-2.3-1.4-2.3-1.7 0-.5 7-4.8 22.5-13.6 7-4 31.5-18.3 37.4-21.8 2.5-1.5 6.1-3.5 7.9-4.4 2.3-1.2 3.2-2.4 3.2-4.2.4-21.1.4-131.1 0-131-.3 0-1.4.6-2.5 1.3zm40 64.8c0 29.4.4 45.3 1 45.3.9 0 14.9-7.6 19.5-10.5 1.4-.9 8.6-5.1 15.7-9.1 14-7.9 41.9-24.2 42.5-24.7.6-.6-14.5-9.6-42.1-25.3-2.5-1.5-11.7-6.7-20.3-11.8-8.6-5-15.8-9.1-16-9.1-.2 0-.3 20.4-.3 45.2z"/><path d="M295.5 111.5c-18.7 10.7-34.7 19.8-35.5 20.3-.8.5-8.7 5-17.5 9.9-8.8 5-26.1 14.8-38.5 21.9-12.4 7-23.5 13.3-24.8 13.9-2.9 1.6-3.7 1 14.8 11.2 1.9 1.1 15.1 8.6 29.3 16.7 14.1 8 27.4 15.6 29.5 16.7 2 1.2 10.5 6 18.7 10.7 8.3 4.7 17 9.6 19.5 11 2.5 1.4 12.2 6.9 21.7 12.3 9.5 5.5 17.6 9.9 18 9.9 1.2 0 1-173.3-.2-173.6-.6-.1-16.3 8.5-35 19.1zm-81 176c0 25 .1 45.5.2 45.5.3 0 3.7-2 16.8-9.5 23-13.3 29.1-16.8 31.5-18.4 1.4-.8 2.7-1.6 3-1.6.3 0 1.6-.8 3-1.7 1.4-.8 7.5-4.4 13.5-7.8 6.1-3.5 11.1-6.4 11.3-6.5.4-.3-77.5-45.5-78.5-45.5-.4 0-.8 20.5-.8 45.5z"/></svg><style>@media (prefers-color-scheme:light){:root{filter:none}}</style></svg>`

tplReadmeZh = `这是一个示例扩展组件,这里展示了他的详细介绍,你可以在这里使用 Markdown 语法编写内容。`
tplReadmeEn = `This is a sample extension, which is shown in more detail here, and you can write it here using Markdown syntax.`
)
4 changes: 2 additions & 2 deletions pkg/extension/type.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,8 @@ func (ext *Extension) ToKubernetesResources() []byte {
Name: cmName,
Namespace: "kubesphere-system",
},
Data: map[string]string{
"chart.tgz": base64.StdEncoding.EncodeToString(ext.ChartData),
BinaryData: map[string][]byte{
"chart.tgz": ext.ChartData,
},
}
cmByte, err := yaml.Marshal(cm)
Expand Down

0 comments on commit aa0fe08

Please sign in to comment.