1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-08-06 17:41:00 +00:00

Use canonical imports

This commit is contained in:
Frédéric Guillot 2018-08-24 21:51:50 -07:00
parent 7f2612d9a6
commit dbcc5d8a97
263 changed files with 962 additions and 956 deletions

View file

@ -24,7 +24,7 @@ import (
const tpl = `// Code generated by go generate; DO NOT EDIT.
package {{ .Package }}
package {{ .Package }} // import "miniflux.app/{{ .ImportPath }}"
var {{ .Map }} = map[string]string{
{{ range $constant, $content := .Files }}` + "\t" + `"{{ $constant }}": ` + "`{{ $content }}`" + `,
@ -38,9 +38,11 @@ var {{ .Map }}Checksums = map[string]string{
var bundleTpl = template.Must(template.New("").Parse(tpl))
type Bundle struct {
Package, Map string
Files map[string]string
Checksums map[string]string
Package string
Map string
ImportPath string
Files map[string]string
Checksums map[string]string
}
func (b *Bundle) Write(filename string) {
@ -53,12 +55,13 @@ func (b *Bundle) Write(filename string) {
bundleTpl.Execute(f, b)
}
func NewBundle(pkg, mapName string) *Bundle {
func NewBundle(pkg, mapName, importPath string) *Bundle {
return &Bundle{
Package: pkg,
Map: mapName,
Files: make(map[string]string),
Checksums: make(map[string]string),
Package: pkg,
Map: mapName,
ImportPath: importPath,
Files: make(map[string]string),
Checksums: make(map[string]string),
}
}
@ -97,7 +100,7 @@ func concat(files []string) string {
}
func generateJSBundle(bundleFile string, bundleFiles map[string][]string, prefixes, suffixes map[string]string) {
bundle := NewBundle("static", "Javascripts")
bundle := NewBundle("static", "Javascripts", "ui/static")
m := minify.New()
m.AddFunc("text/javascript", js.Minify)
@ -127,7 +130,7 @@ func generateJSBundle(bundleFile string, bundleFiles map[string][]string, prefix
}
func generateCSSBundle(bundleFile string, themes map[string][]string) {
bundle := NewBundle("static", "Stylesheets")
bundle := NewBundle("static", "Stylesheets", "ui/static")
m := minify.New()
m.AddFunc("text/css", css.Minify)
@ -146,7 +149,7 @@ func generateCSSBundle(bundleFile string, themes map[string][]string) {
}
func generateBinaryBundle(bundleFile string, srcFiles []string) {
bundle := NewBundle("static", "Binaries")
bundle := NewBundle("static", "Binaries", "ui/static")
for _, srcFile := range srcFiles {
data := readFile(srcFile)
@ -161,7 +164,7 @@ func generateBinaryBundle(bundleFile string, srcFiles []string) {
}
func generateBundle(bundleFile, pkg, mapName string, srcFiles []string) {
bundle := NewBundle(pkg, mapName)
bundle := NewBundle(pkg, mapName, pkg)
for _, srcFile := range srcFiles {
data := readFile(srcFile)