2023-01-13 05:59:42 +08:00
|
|
|
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 {
|
2023-01-18 01:10:43 +08:00
|
|
|
content, err := os.ReadFile(join("commands", "types", name+".d.ts"))
|
2023-01-13 05:59:42 +08:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
combined = append(combined, string(content))
|
|
|
|
}
|
|
|
|
combined = append(combined, funcs)
|
2023-01-18 01:10:43 +08:00
|
|
|
os.WriteFile(join("commands", "types", "dnscontrol.d.ts"), []byte(strings.Join(combined, "\n\n")), 0644)
|
2023-01-13 05:59:42 +08:00
|
|
|
return nil
|
|
|
|
}
|