mirror of
https://github.com/onsonr/sonr.git
synced 2025-03-10 13:07:09 +00:00
refactor: move dwn wasm build to pkg directory
This commit is contained in:
parent
9fcdfe5243
commit
4a76f105af
2
Makefile
2
Makefile
@ -302,7 +302,7 @@ motr:
|
||||
|
||||
dwn:
|
||||
@echo "(dwn) Building dwn.wasm -> IPFS Vault"
|
||||
GOOS=js GOARCH=wasm go build -o ./x/vault/types/internal/app.wasm ./x/vault/client/dwn/dwn.go
|
||||
GOOS=js GOARCH=wasm go build -o ./pkg/dwn/app.wasm ./x/vault/client/dwn/dwn.go
|
||||
|
||||
templ:
|
||||
@echo "(templ) Generating templ files"
|
||||
|
@ -30,7 +30,7 @@
|
||||
"make local-image"
|
||||
],
|
||||
"build:motr": [
|
||||
"make nebula",
|
||||
"make dwn",
|
||||
"make motr"
|
||||
],
|
||||
"build:sonrd": [
|
||||
|
Binary file not shown.
@ -1,4 +1,4 @@
|
||||
package vault
|
||||
package dwn
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
@ -8,8 +8,6 @@ import (
|
||||
|
||||
"github.com/a-h/templ"
|
||||
"github.com/ipfs/boxo/files"
|
||||
|
||||
"github.com/onsonr/sonr/pkg/dwn"
|
||||
)
|
||||
|
||||
//go:embed app.wasm
|
||||
@ -28,7 +26,7 @@ var (
|
||||
)
|
||||
|
||||
// NewVaultDirectory creates a new directory with the default files
|
||||
func NewVaultDirectory(cnfg *dwn.Config) (files.Node, error) {
|
||||
func NewVaultDirectory(cnfg *Config) (files.Node, error) {
|
||||
dwnJSON, err := json.Marshal(cnfg)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -54,7 +52,7 @@ func NewVaultDirectory(cnfg *dwn.Config) (files.Node, error) {
|
||||
}
|
||||
|
||||
// Use IndexHTML template to generate the index file
|
||||
func IndexHTMLFile(c *dwn.Config) (files.Node, error) {
|
||||
func IndexHTMLFile(c *Config) (files.Node, error) {
|
||||
str, err := templ.JSONString(c)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -69,7 +67,7 @@ func IndexHTMLFile(c *dwn.Config) (files.Node, error) {
|
||||
}
|
||||
|
||||
// MarshalConfigFile uses the config template to generate the dwn config file
|
||||
func MarshalConfigFile(c *dwn.Config) (files.Node, error) {
|
||||
func MarshalConfigFile(c *Config) (files.Node, error) {
|
||||
dwnConfigData, err := json.Marshal(c)
|
||||
if err != nil {
|
||||
return nil, err
|
@ -1,4 +1,4 @@
|
||||
package vault
|
||||
package dwn
|
||||
|
||||
var motrHandle = templ.NewOnceHandle()
|
||||
|
@ -1,7 +1,7 @@
|
||||
// Code generated by templ - DO NOT EDIT.
|
||||
|
||||
// templ: version: v0.2.778
|
||||
package vault
|
||||
package dwn
|
||||
|
||||
//lint:file-ignore SA4006 This context is only used if a nested component is present.
|
||||
|
@ -4,7 +4,6 @@ import (
|
||||
"github.com/ipfs/boxo/files"
|
||||
|
||||
"github.com/onsonr/sonr/pkg/dwn"
|
||||
vault "github.com/onsonr/sonr/x/vault/types/internal"
|
||||
)
|
||||
|
||||
type Vault struct {
|
||||
@ -18,7 +17,7 @@ func NewVault(keyshareJSON string, adddress string, chainID string, schema *dwn.
|
||||
Sonr: defaultSonrConfig(chainID),
|
||||
Schema: schema,
|
||||
}
|
||||
fileMap, err := vault.NewVaultDirectory(dwnCfg)
|
||||
fileMap, err := dwn.NewVaultDirectory(dwnCfg)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user