fix(nodejs): detect bun project files

This commit is contained in:
Alex Grover 2024-10-23 10:57:09 -04:00
parent ddafaa62fc
commit 2e43a71b30
No known key found for this signature in database
GPG Key ID: 61EDC937193F5A4D
3 changed files with 19 additions and 13 deletions

View File

@ -1135,7 +1135,10 @@
"detect_files": [
"package.json",
".node-version",
".nvmrc"
".nvmrc",
"!bunfig.toml",
"!bun.lock",
"!bun.lockb"
],
"detect_folders": [
"node_modules"
@ -4737,7 +4740,10 @@
"default": [
"package.json",
".node-version",
".nvmrc"
".nvmrc",
"!bunfig.toml",
"!bun.lock",
"!bun.lockb"
],
"type": "array",
"items": {

View File

@ -645,7 +645,7 @@ By default the module will be shown if any of the following conditions are met:
*: This variable can only be used as a part of a style string
### Examples
### Example
#### Customize the format
@ -656,15 +656,6 @@ By default the module will be shown if any of the following conditions are met:
format = 'via [🍔 $version](bold green) '
```
#### Replace Node.js
You can override the `detect_files` property of [the nodejs module](#nodejs) in your config so as to only show the bun runtime:
```toml
[nodejs]
detect_files = ['package.json', '.node-version', '!bunfig.toml', '!bun.lockb']
```
## C
The `c` module shows some information about your C compiler. By default
@ -3108,6 +3099,8 @@ By default the module will be shown if any of the following conditions are met:
- The current directory contains a file with the `.js`, `.mjs` or `.cjs` extension
- The current directory contains a file with the `.ts`, `.mts` or `.cts` extension
Additionally, the module will be hidden by default if the directory contains a `bunfig.toml`, `bun.lock`, or `bun.lockb` file, overriding the above conditions.
### Options
| Option | Default | Description |

View File

@ -29,7 +29,14 @@ impl Default for NodejsConfig<'_> {
disabled: false,
not_capable_style: "bold red",
detect_extensions: vec!["js", "mjs", "cjs", "ts", "mts", "cts"],
detect_files: vec!["package.json", ".node-version", ".nvmrc"],
detect_files: vec![
"package.json",
".node-version",
".nvmrc",
"!bunfig.toml",
"!bun.lock",
"!bun.lockb",
],
detect_folders: vec!["node_modules"],
}
}