Skip to content

Commit

Permalink
fix: auto detect deno.json for globbed slugs (#2852)
Browse files Browse the repository at this point in the history
  • Loading branch information
sweatybridge committed Nov 8, 2024
1 parent 136b6ae commit a062a45
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
15 changes: 12 additions & 3 deletions internal/functions/deploy/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,22 @@ func GetFunctionConfig(slugs []string, importMapPath string, noVerifyJWT *bool,
for _, name := range slugs {
function := utils.Config.Functions[name]
// Precedence order: flag > config > fallback
functionDir := filepath.Join(utils.FunctionsDir, name)
if len(function.Entrypoint) == 0 {
function.Entrypoint = filepath.Join(utils.FunctionsDir, name, "index.ts")
function.Entrypoint = filepath.Join(functionDir, "index.ts")
}
if len(importMapPath) > 0 {
function.ImportMap = importMapPath
} else if len(function.ImportMap) == 0 && fallbackExists {
function.ImportMap = utils.FallbackImportMapPath
} else if len(function.ImportMap) == 0 {
denoJsonPath := filepath.Join(functionDir, "deno.json")
denoJsoncPath := filepath.Join(functionDir, "deno.jsonc")
if _, err := fsys.Stat(denoJsonPath); err == nil {
function.ImportMap = denoJsonPath
} else if _, err := fsys.Stat(denoJsoncPath); err == nil {
function.ImportMap = denoJsoncPath
} else if fallbackExists {
function.ImportMap = utils.FallbackImportMapPath
}
}
if noVerifyJWT != nil {
function.VerifyJWT = cast.Ptr(!*noVerifyJWT)
Expand Down
2 changes: 0 additions & 2 deletions pkg/config/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,6 @@ func (a *settings) ToPostgresConfig() string {
// using toml, then replace double quotes with single.
data, _ := ToTomlBytes(*a)
body := bytes.ReplaceAll(data, []byte{'"'}, []byte{'\''})
body = bytes.ReplaceAll(body, []byte("= true"), []byte("= on"))
body = bytes.ReplaceAll(body, []byte("= false"), []byte("= off"))
return pgConfHeader + string(body)
}

Expand Down

0 comments on commit a062a45

Please sign in to comment.