fix(bindings): add tree-sitter as npm dev dependency
npm is supposed to automatically install peer dependencies since v7
but sometimes it's not doing it and we need this dependency for tests
(cherry picked from commit e67f9f8f7a)
This commit is contained in:
parent
9504c247d6
commit
d5b8c19d0b
2 changed files with 32 additions and 9 deletions
|
|
@ -302,14 +302,36 @@ pub fn generate_grammar_files(
|
|||
};
|
||||
|
||||
// Create package.json
|
||||
missing_path(repo_path.join("package.json"), |path| {
|
||||
generate_file(
|
||||
path,
|
||||
PACKAGE_JSON_TEMPLATE,
|
||||
dashed_language_name.as_str(),
|
||||
&generate_opts,
|
||||
)
|
||||
})?;
|
||||
missing_path_else(
|
||||
repo_path.join("package.json"),
|
||||
allow_update,
|
||||
|path| {
|
||||
generate_file(
|
||||
path,
|
||||
PACKAGE_JSON_TEMPLATE,
|
||||
dashed_language_name.as_str(),
|
||||
&generate_opts,
|
||||
)
|
||||
},
|
||||
|path| {
|
||||
let contents = fs::read_to_string(path)?
|
||||
.replace(
|
||||
r#""node-addon-api": "^8.3.1"#,
|
||||
r#""node-addon-api": "^8.5.0""#,
|
||||
)
|
||||
.replace(
|
||||
indoc! {r#"
|
||||
"prebuildify": "^6.0.1",
|
||||
"tree-sitter-cli":"#},
|
||||
indoc! {r#"
|
||||
"prebuildify": "^6.0.1",
|
||||
"tree-sitter": "^0.22.4",
|
||||
"tree-sitter-cli":"#},
|
||||
);
|
||||
write_file(path, contents)?;
|
||||
Ok(())
|
||||
},
|
||||
)?;
|
||||
|
||||
// Do not create a grammar.js file in a repo with multiple language configs
|
||||
if !tree_sitter_config.has_multiple_language_configs() {
|
||||
|
|
|
|||
|
|
@ -29,11 +29,12 @@
|
|||
"*.wasm"
|
||||
],
|
||||
"dependencies": {
|
||||
"node-addon-api": "^8.3.1",
|
||||
"node-addon-api": "^8.5.0",
|
||||
"node-gyp-build": "^4.8.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"prebuildify": "^6.0.1",
|
||||
"tree-sitter": "^0.22.4",
|
||||
"tree-sitter-cli": "^CLI_VERSION"
|
||||
},
|
||||
"peerDependencies": {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue