diff --git a/.github/config-schema.json b/.github/config-schema.json index 6ec2c4b0e..6061fecca 100644 --- a/.github/config-schema.json +++ b/.github/config-schema.json @@ -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": { diff --git a/docs/config/README.md b/docs/config/README.md index d481f84d2..71a14f2bd 100644 --- a/docs/config/README.md +++ b/docs/config/README.md @@ -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 | diff --git a/src/configs/nodejs.rs b/src/configs/nodejs.rs index 7c47424e1..0b729a48a 100644 --- a/src/configs/nodejs.rs +++ b/src/configs/nodejs.rs @@ -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"], } }