fix(nodejs): detect bun project files

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

View File

@ -1131,7 +1131,9 @@
"detect_files": [
"package.json",
".node-version",
".nvmrc"
".nvmrc",
"!bunfig.toml",
"!bun.lockb"
],
"detect_folders": [
"node_modules"
@ -4720,7 +4722,9 @@
"default": [
"package.json",
".node-version",
".nvmrc"
".nvmrc",
"!bunfig.toml",
"!bun.lockb"
],
"type": "array",
"items": {

View File

@ -644,7 +644,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
@ -655,15 +655,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
@ -3106,6 +3097,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` or `bun.lockb` file, overriding the above conditions.
### Options
| Option | Default | Description |

View File

@ -29,7 +29,13 @@ impl<'a> Default for NodejsConfig<'a> {
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.lockb",
],
detect_folders: vec!["node_modules"],
}
}