1
0
mirror of https://github.com/StackExchange/dnscontrol.git synced 2024-05-11 05:55:12 +00:00

Embed types-dnscontrol.d.ts into the binary instead of fetching it via HTTP (#1942)

Co-authored-by: Tom Limoncelli <tlimoncelli@stackoverflow.com>
This commit is contained in:
Jed Fox
2023-01-17 12:10:43 -05:00
committed by GitHub
parent 83b4a301dc
commit 9b3ad81b1d
7 changed files with 9 additions and 19 deletions

View File

@@ -16,13 +16,13 @@ func generateDTSFile(funcs string) error {
"// WARNING: These type definitions are experimental and subject to change in future releases.",
}
for _, name := range names {
content, err := os.ReadFile(join("types", "src", name+".d.ts"))
content, err := os.ReadFile(join("commands", "types", name+".d.ts"))
if err != nil {
return err
}
combined = append(combined, string(content))
}
combined = append(combined, funcs)
os.WriteFile(join("types", "dnscontrol.d.ts"), []byte(strings.Join(combined, "\n\n")), 0644)
os.WriteFile(join("commands", "types", "dnscontrol.d.ts"), []byte(strings.Join(combined, "\n\n")), 0644)
return nil
}