mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2024-05-11 05:55:12 +00:00
Provide TypeScript typings for dnsconfig.js (#1830)
Co-authored-by: Jeffrey Cafferata <jeffrey@jcid.nl> Co-authored-by: Tom Limoncelli <tlimoncelli@stackoverflow.com>
This commit is contained in:
28
build/generate/dtsFile.go
Normal file
28
build/generate/dtsFile.go
Normal file
@ -0,0 +1,28 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"os"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func generateDTSFile(funcs string) error {
|
||||
names := []string{
|
||||
"base-types",
|
||||
"fetch",
|
||||
"others",
|
||||
}
|
||||
|
||||
combined := []string{
|
||||
"// 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"))
|
||||
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)
|
||||
return nil
|
||||
}
|
Reference in New Issue
Block a user