diff --git a/cli/src/generate/binding_files.rs b/cli/src/generate/binding_files.rs index 8ce7e4a4..8414b65d 100644 --- a/cli/src/generate/binding_files.rs +++ b/cli/src/generate/binding_files.rs @@ -11,6 +11,8 @@ const BUILD_RS_TEMPLATE: &'static str = include_str!("./templates/build.rs"); const CARGO_TOML_TEMPLATE: &'static str = include_str!("./templates/cargo.toml"); const PACKAGE_JSON_TEMPLATE: &'static str = include_str!("./templates/package.json"); const PARSER_NAME_PLACEHOLDER: &'static str = "PARSER_NAME"; +const CLI_VERSION_PLACEHOLDER: &'static str = "CLI_VERSION"; +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"); @@ -110,7 +112,9 @@ pub fn generate_binding_files(repo_path: &Path, language_name: &str) -> Result<( fn generate_file(path: &Path, template: &str, language_name: &str) -> Result<()> { write_file( path, - template.replace(PARSER_NAME_PLACEHOLDER, language_name), + template + .replace(PARSER_NAME_PLACEHOLDER, language_name) + .replace(CLI_VERSION_PLACEHOLDER, CLI_VERSION), ) } diff --git a/cli/src/generate/templates/package.json b/cli/src/generate/templates/package.json index bba22b82..18598797 100644 --- a/cli/src/generate/templates/package.json +++ b/cli/src/generate/templates/package.json @@ -11,7 +11,7 @@ "nan": "^2.12.1" }, "devDependencies": { - "tree-sitter-cli": "^0.17.3" + "tree-sitter-cli": "^CLI_VERSION" }, "scripts": { "test": "tree-sitter test"