fix(cli): use dashed language name in generated package.json and Cargo.toml files
@@ -17,6 +17,9 @@ const CLI_VERSION: &'static str = env!("CARGO_PKG_VERSION");
pub fn generate_binding_files(repo_path: &Path, language_name: &str) -> Result<()> {
let bindings_dir = repo_path.join("bindings");
+ let dashed_language_name = language_name.replace("_", "-");
+ let dashed_language_name = dashed_language_name.as_str();
+
// Generate rust bindings if needed.
let rust_binding_dir = bindings_dir.join("rust");
if !rust_binding_dir.exists() {
@@ -33,7 +36,7 @@ pub fn generate_binding_files(repo_path: &Path, language_name: &str) -> Result<(
)?;
let cargo_toml_path = repo_path.join("Cargo.toml");
if !cargo_toml_path.exists() {
- generate_file(&cargo_toml_path, CARGO_TOML_TEMPLATE, language_name)?;
+ generate_file(&cargo_toml_path, CARGO_TOML_TEMPLATE, dashed_language_name)?;
}
}
@@ -92,7 +95,7 @@ pub fn generate_binding_files(repo_path: &Path, language_name: &str) -> Result<(
write_file(&package_json_path, package_json_str)?;
}
} else {
- generate_file(&package_json_path, PACKAGE_JSON_TEMPLATE, language_name)?;
+ generate_file(&package_json_path, PACKAGE_JSON_TEMPLATE, dashed_language_name)?;
}
// Remove files from old node binding paths.
