feat(deno): add deno.lock file to default detect_files list (#6310)

* feat(deno): add `deno.lock` file to default `detect_files` list

* feat(deno): add `deno.lock` to default detect files in schema

* test: add test for `deno.lock` file presense

* docs: add `deno.lock` to list of default files

* chore: formatting

* Revert "docs: add `deno.lock` to list of default files"

This reverts commit 6d0dc577d5.

* docs: add `deno.lock` to default detect files in primary readme

* chore: revert formatting from latest version of dprint

* docs: add `deno.lock` to default detect files list and format
This commit is contained in:
Daniel Waltz 2024-10-14 16:05:23 -04:00 committed by GitHub
parent 2f120bee9d
commit 22c6c5201d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 24 additions and 11 deletions

View File

@ -311,6 +311,7 @@
"detect_files": [
"deno.json",
"deno.jsonc",
"deno.lock",
"mod.ts",
"deps.ts",
"mod.js",
@ -2739,6 +2740,7 @@
"default": [
"deno.json",
"deno.jsonc",
"deno.lock",
"mod.ts",
"deps.ts",
"mod.js",

View File

@ -1097,17 +1097,17 @@ format = 'via [🔰 $version](bold red) '
The `deno` module shows you your currently installed version of [Deno](https://deno.land/).
By default the module will be shown if any of the following conditions are met:
- The current directory contains a `deno.json`, `deno.jsonc`, `mod.ts`, `mod.js`, `deps.ts` or `deps.js` file
- The current directory contains a `deno.json`, `deno.jsonc`, `deno.lock`, `mod.ts`, `mod.js`, `deps.ts` or `deps.js` file
### Options
| Option | Default | Description |
| ------------------- | ----------------------------------------------------------------------- | ------------------------------------------------------------------------- |
| ------------------- | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------- |
| `format` | `'via [$symbol($version )]($style)'` | The format for the module. |
| `version_format` | `'v${raw}'` | The version format. Available vars are `raw`, `major`, `minor`, & `patch` |
| `symbol` | `'🦕 '` | A format string representing the symbol of Deno |
| `detect_extensions` | `[]` | Which extensions should trigger this module. |
| `detect_files` | `['deno.json', 'deno.jsonc', 'mod.ts', 'mod.js', 'deps.ts', 'deps.js']` | Which filenames should trigger this module. |
| `detect_files` | `['deno.json', 'deno.jsonc', 'deno.lock', 'mod.ts', 'mod.js', 'deps.ts', 'deps.js']` | Which filenames should trigger this module. |
| `detect_folders` | `[]` | Which folders should trigger this module. |
| `style` | `'green bold'` | The style for the module. |
| `disabled` | `false` | Disables the `deno` module. |

View File

@ -30,6 +30,7 @@ impl<'a> Default for DenoConfig<'a> {
detect_files: vec![
"deno.json",
"deno.jsonc",
"deno.lock",
"mod.ts",
"deps.ts",
"mod.js",

View File

@ -103,6 +103,16 @@ mod tests {
dir.close()
}
#[test]
fn folder_with_deno_lock() -> io::Result<()> {
let dir = tempfile::tempdir()?;
File::create(dir.path().join("deno.lock"))?.sync_all()?;
let actual = ModuleRenderer::new("deno").path(dir.path()).collect();
let expected = Some(format!("via {}", Color::Green.bold().paint("🦕 v1.8.3 ")));
assert_eq!(expected, actual);
dir.close()
}
#[test]
fn folder_with_mod_ts() -> io::Result<()> {
let dir = tempfile::tempdir()?;