Build with Magefile #104341
4
Makefile
4
Makefile
@ -151,8 +151,8 @@ clean: buildtool
|
||||
devserver-website:
|
||||
go run ${HUGO_PKG} -s web/project-website serve
|
||||
|
||||
devserver-webapp:
|
||||
yarn --cwd web/app run dev --host
|
||||
devserver-webapp: buildtool
|
||||
"${BUILDTOOL_PATH}" devServerWebapp
|
||||
|
||||
deploy-website:
|
||||
$(MAKE) -s check-environment
|
||||
|
@ -18,27 +18,12 @@ const (
|
||||
)
|
||||
|
||||
var (
|
||||
generators = []string{
|
||||
"github.com/deepmap/oapi-codegen/cmd/oapi-codegen@v1.9.0",
|
||||
"github.com/golang/mock/mockgen@v1.6.0",
|
||||
}
|
||||
|
||||
// The directory that will contain the built webapp files, and some other
|
||||
// files that will be served as static files by the Flamenco Manager web
|
||||
// server.
|
||||
webStatic = filepath.Join("web", "static")
|
||||
)
|
||||
|
||||
// Install code generators.
|
||||
func InstallGenerators() error {
|
||||
for _, pkg := range generators {
|
||||
if err := sh.RunV(mg.GoCmd(), "install", pkg); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Build Flamenco Manager and Flamenco Worker, including the webapp and the add-on
|
||||
func Build() {
|
||||
mg.Deps(FlamencoManager, FlamencoWorker)
|
||||
|
13
magefiles/devserver.go
Normal file
13
magefiles/devserver.go
Normal file
@ -0,0 +1,13 @@
|
||||
//go:build mage
|
||||
|
||||
package main
|
||||
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
import (
|
||||
"github.com/magefile/mage/sh"
|
||||
)
|
||||
|
||||
func DevServerWebapp() error {
|
||||
return sh.RunV("yarn", "--cwd", "web/app", "run", "dev", "--host")
|
||||
}
|
45
magefiles/install.go
Normal file
45
magefiles/install.go
Normal file
@ -0,0 +1,45 @@
|
||||
//go:build mage
|
||||
|
||||
package main
|
||||
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/magefile/mage/mg"
|
||||
"github.com/magefile/mage/sh"
|
||||
)
|
||||
|
||||
var (
|
||||
generators = []string{
|
||||
"github.com/deepmap/oapi-codegen/cmd/oapi-codegen@v1.9.0",
|
||||
"github.com/golang/mock/mockgen@v1.6.0",
|
||||
}
|
||||
)
|
||||
|
||||
// Install build-time dependencies: code generators and NodeJS dependencies.
|
||||
func InstallDeps() {
|
||||
mg.SerialDeps(InstallGenerators, InstallDepsWebapp)
|
||||
}
|
||||
|
||||
// Install code generators.
|
||||
func InstallGenerators(ctx context.Context) error {
|
||||
r := NewRunner(ctx)
|
||||
for _, pkg := range generators {
|
||||
r.Run(mg.GoCmd(), "install", pkg)
|
||||
}
|
||||
return r.Wait()
|
||||
}
|
||||
|
||||
// Use Yarn to install the webapp's NodeJS dependencies
|
||||
func InstallDepsWebapp() error {
|
||||
env := map[string]string{
|
||||
"MSYS2_ARG_CONV_EXCL": "*",
|
||||
}
|
||||
return sh.RunWithV(env,
|
||||
"yarn",
|
||||
"--cwd", "web/app",
|
||||
"install",
|
||||
)
|
||||
}
|
Loading…
Reference in New Issue
Block a user