feat(deno): detect `deno.json` and `deno.jsonc` (#3220)
* feat(deno): detect `deno.json` and `deno.jsonc` * update docs * update tests * cargo fmt * revert lockfile changes * revert doc updates to non-english files * Restore README.md * fmt
This commit is contained in:
parent
67cddb616b
commit
f48c7a26cf
|
@ -747,20 +747,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 `mod.ts`, `mod.js`, `deps.ts` or `deps.js` file
|
||||
- The current directory contains a `deno.json`, `deno.jsonc`, `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` | `["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", "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
|
||||
|
||||
|
|
|
@ -24,7 +24,14 @@ impl<'a> Default for DenoConfig<'a> {
|
|||
style: "green bold",
|
||||
disabled: false,
|
||||
detect_extensions: vec![],
|
||||
detect_files: vec!["mod.ts", "deps.ts", "mod.js", "deps.js"],
|
||||
detect_files: vec![
|
||||
"deno.json",
|
||||
"deno.jsonc",
|
||||
"mod.ts",
|
||||
"deps.ts",
|
||||
"mod.js",
|
||||
"deps.js",
|
||||
],
|
||||
detect_folders: vec![],
|
||||
}
|
||||
}
|
||||
|
|
|
@ -83,6 +83,26 @@ mod tests {
|
|||
dir.close()
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn folder_with_deno_json() -> io::Result<()> {
|
||||
let dir = tempfile::tempdir()?;
|
||||
File::create(dir.path().join("deno.json"))?.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_deno_jsonc() -> io::Result<()> {
|
||||
let dir = tempfile::tempdir()?;
|
||||
File::create(dir.path().join("deno.jsonc"))?.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()?;
|
||||
|
|
Loading…
Reference in New Issue