Skip to content

Commit

Permalink
feat(deno): add deno.lock file to default detect_files list (star…
Browse files Browse the repository at this point in the history
…ship#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 6d0dc57.

* 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
  • Loading branch information
danielwaltz authored Oct 14, 2024
1 parent 2f120be commit 22c6c52
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 11 deletions.
2 changes: 2 additions & 0 deletions .github/config-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,7 @@
"detect_files": [
"deno.json",
"deno.jsonc",
"deno.lock",
"mod.ts",
"deps.ts",
"mod.js",
Expand Down Expand Up @@ -2739,6 +2740,7 @@
"default": [
"deno.json",
"deno.jsonc",
"deno.lock",
"mod.ts",
"deps.ts",
"mod.js",
Expand Down
22 changes: 11 additions & 11 deletions docs/config/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1097,20 +1097,20 @@ 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_folders` | `[]` | Which folders should trigger this module. |
| `style` | `'green bold'` | The style for the module. |
| `disabled` | `false` | Disables the `deno` module. |
| 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', '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. |

### Variables

Expand Down
1 change: 1 addition & 0 deletions src/configs/deno.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
10 changes: 10 additions & 0 deletions src/modules/deno.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()?;
Expand Down

0 comments on commit 22c6c52

Please sign in to comment.