Import package configuration data from a YAML or JSON file.
Details
This function reads and validates a configuration file. The file must exist and contain valid YAML or JSON. If the file is malformed, a helpful error message will indicate the parsing issue.
Examples
# Write a temporary YAML config, then import it
config_path <- tempfile(fileext = ".yml")
writeLines("pkg_name: demopkg\nfirst_name: Jane\nlast_name: Doe", config_path)
config <- import_config(config_path, "yaml")
print(config$pkg_name)
#> [1] "demopkg"
unlink(config_path)