-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #49 from launchrctl/web_build_extra_steps
Web build extra steps
- Loading branch information
Showing
11 changed files
with
287 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
*.tar | ||
*.gz | ||
dist/ | ||
/swagger-ui | ||
/.husky/_ | ||
.idea | ||
assets/ | ||
swagger-ui/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
//go:build !dev | ||
|
||
// Package executes Launchr application. | ||
package main | ||
|
||
import ( | ||
"embed" | ||
"os" | ||
|
||
"github.com/launchrctl/launchr" | ||
_ "github.com/launchrctl/web" | ||
) | ||
|
||
//go:embed assets/* | ||
var assets embed.FS | ||
|
||
func main() { | ||
os.Exit(launchr.Run(&launchr.AppOptions{AssetsFs: assets})) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
//go:build dev | ||
|
||
package web | ||
|
||
import ( | ||
"github.com/launchrctl/web/server" | ||
"io/fs" | ||
"os" | ||
) | ||
|
||
func prepareRunOption(_ *Plugin, opts *server.RunOptions) { | ||
opts.SwaggerUIFS = defaultSwaggerUIFS() | ||
opts.ClientFS = defaultClientFS() | ||
} | ||
|
||
func defaultSwaggerUIFS() fs.FS { | ||
return os.DirFS("./cmd/launchr/assets/github.com/launchrctl/web/swagger-ui/swagger-ui") | ||
} | ||
|
||
func defaultClientFS() fs.FS { | ||
return os.DirFS("./client/dist") | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,31 @@ | ||
//go:build !embed | ||
//go:build !dev | ||
|
||
package web | ||
|
||
import ( | ||
"io/fs" | ||
"os" | ||
|
||
"github.com/launchrctl/web/server" | ||
) | ||
|
||
func defaultSwaggerUIFS() fs.FS { | ||
return os.DirFS("./swagger-ui") | ||
func prepareRunOption(p *Plugin, opts *server.RunOptions) { | ||
assetsFs := p.app.GetPluginAssets(p) | ||
opts.SwaggerUIFS = defaultSwaggerUIFS(assetsFs) | ||
opts.ClientFS = defaultClientFS(assetsFs) | ||
} | ||
|
||
func defaultSwaggerUIFS(assets fs.FS) fs.FS { | ||
sub, err := fs.Sub(assets, "swagger-ui") | ||
if err != nil { | ||
panic(err) | ||
} | ||
return sub | ||
} | ||
|
||
func defaultClientFS() fs.FS { | ||
return os.DirFS("./client/dist") | ||
func defaultClientFS(assets fs.FS) fs.FS { | ||
sub, err := fs.Sub(assets, "dist") | ||
if err != nil { | ||
panic(err) | ||
} | ||
return sub | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.