fix(nodejs): use e718 as the default of symbol in node configuration (#3533)
* fix: use e718 as the default of symbol in node configuration * wip: change nodejs symbol in docs/config & add a nodejs symbol configuration in docs/presets * wip: update CONTRIBUTING.md
This commit is contained in:
parent
e680540cfc
commit
65f29754d3
|
@ -8,9 +8,9 @@ If you have any questions that aren't addressed in this document, please don't h
|
|||
|
||||
## Glossary
|
||||
|
||||
- **Module**: A component in the prompt giving information based on contextual information from your OS. For example, the `nodejs` module shows the version of NodeJS that is currently installed on your computer, if your current directory is a NodeJS project.
|
||||
- **Module**: A component in the prompt giving information based on contextual information from your OS. For example, the `rust` module shows the version of Rust that is currently installed on your computer, if your current directory is a Rust project.
|
||||
|
||||
- **Segment**: Smaller sub-components that compose a module. For example, the `symbol` segment in the `nodejs` module contains the character that is shown before the version number (`⬢` by default).
|
||||
- **Segment**: Smaller sub-components that compose a module. For example, the `symbol` segment in the `rust` module contains the character that is shown before the version number (`🦀` by default).
|
||||
|
||||
## Philosophy
|
||||
|
||||
|
|
|
@ -2169,7 +2169,7 @@ By default the module will be shown if any of the following conditions are met:
|
|||
| ------------------- | ------------------------------------ | ----------------------------------------------------------------------------------------------------- |
|
||||
| `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 Node.js. |
|
||||
| `symbol` | `" "` | A format string representing the symbol of Node.js. |
|
||||
| `detect_extensions` | `["js", "mjs", "cjs", "ts"]` | Which extensions should trigger this module. |
|
||||
| `detect_files` | `["package.json", ".node-version"]` | Which filenames should trigger this module. |
|
||||
| `detect_folders` | `["node_modules"]` | Which folders should trigger this module. |
|
||||
|
|
|
@ -62,6 +62,9 @@ symbol = " "
|
|||
[nix_shell]
|
||||
symbol = " "
|
||||
|
||||
[nodejs]
|
||||
symbol = " "
|
||||
|
||||
[package]
|
||||
symbol = " "
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ impl<'a> Default for NodejsConfig<'a> {
|
|||
NodejsConfig {
|
||||
format: "via [$symbol($version )]($style)",
|
||||
version_format: "v${raw}",
|
||||
symbol: " ",
|
||||
symbol: " ",
|
||||
style: "bold green",
|
||||
disabled: false,
|
||||
not_capable_style: "bold red",
|
||||
|
|
|
@ -139,7 +139,7 @@ mod tests {
|
|||
File::create(dir.path().join("package.json"))?.sync_all()?;
|
||||
|
||||
let actual = ModuleRenderer::new("nodejs").path(dir.path()).collect();
|
||||
let expected = Some(format!("via {}", Color::Green.bold().paint(" v12.0.0 ")));
|
||||
let expected = Some(format!("via {}", Color::Green.bold().paint(" v12.0.0 ")));
|
||||
assert_eq!(expected, actual);
|
||||
dir.close()
|
||||
}
|
||||
|
@ -163,7 +163,7 @@ mod tests {
|
|||
File::create(dir.path().join(".node-version"))?.sync_all()?;
|
||||
|
||||
let actual = ModuleRenderer::new("nodejs").path(dir.path()).collect();
|
||||
let expected = Some(format!("via {}", Color::Green.bold().paint(" v12.0.0 ")));
|
||||
let expected = Some(format!("via {}", Color::Green.bold().paint(" v12.0.0 ")));
|
||||
assert_eq!(expected, actual);
|
||||
dir.close()
|
||||
}
|
||||
|
@ -174,7 +174,7 @@ mod tests {
|
|||
File::create(dir.path().join(".nvmrc"))?.sync_all()?;
|
||||
|
||||
let actual = ModuleRenderer::new("nodejs").path(dir.path()).collect();
|
||||
let expected = Some(format!("via {}", Color::Green.bold().paint(" v12.0.0 ")));
|
||||
let expected = Some(format!("via {}", Color::Green.bold().paint(" v12.0.0 ")));
|
||||
assert_eq!(expected, actual);
|
||||
dir.close()
|
||||
}
|
||||
|
@ -185,7 +185,7 @@ mod tests {
|
|||
File::create(dir.path().join("index.js"))?.sync_all()?;
|
||||
|
||||
let actual = ModuleRenderer::new("nodejs").path(dir.path()).collect();
|
||||
let expected = Some(format!("via {}", Color::Green.bold().paint(" v12.0.0 ")));
|
||||
let expected = Some(format!("via {}", Color::Green.bold().paint(" v12.0.0 ")));
|
||||
assert_eq!(expected, actual);
|
||||
dir.close()
|
||||
}
|
||||
|
@ -196,7 +196,7 @@ mod tests {
|
|||
File::create(dir.path().join("index.mjs"))?.sync_all()?;
|
||||
|
||||
let actual = ModuleRenderer::new("nodejs").path(dir.path()).collect();
|
||||
let expected = Some(format!("via {}", Color::Green.bold().paint(" v12.0.0 ")));
|
||||
let expected = Some(format!("via {}", Color::Green.bold().paint(" v12.0.0 ")));
|
||||
assert_eq!(expected, actual);
|
||||
dir.close()
|
||||
}
|
||||
|
@ -207,7 +207,7 @@ mod tests {
|
|||
File::create(dir.path().join("index.cjs"))?.sync_all()?;
|
||||
|
||||
let actual = ModuleRenderer::new("nodejs").path(dir.path()).collect();
|
||||
let expected = Some(format!("via {}", Color::Green.bold().paint(" v12.0.0 ")));
|
||||
let expected = Some(format!("via {}", Color::Green.bold().paint(" v12.0.0 ")));
|
||||
assert_eq!(expected, actual);
|
||||
dir.close()
|
||||
}
|
||||
|
@ -218,7 +218,7 @@ mod tests {
|
|||
File::create(dir.path().join("index.ts"))?.sync_all()?;
|
||||
|
||||
let actual = ModuleRenderer::new("nodejs").path(dir.path()).collect();
|
||||
let expected = Some(format!("via {}", Color::Green.bold().paint(" v12.0.0 ")));
|
||||
let expected = Some(format!("via {}", Color::Green.bold().paint(" v12.0.0 ")));
|
||||
assert_eq!(expected, actual);
|
||||
dir.close()
|
||||
}
|
||||
|
@ -230,7 +230,7 @@ mod tests {
|
|||
fs::create_dir_all(&node_modules)?;
|
||||
|
||||
let actual = ModuleRenderer::new("nodejs").path(dir.path()).collect();
|
||||
let expected = Some(format!("via {}", Color::Green.bold().paint(" v12.0.0 ")));
|
||||
let expected = Some(format!("via {}", Color::Green.bold().paint(" v12.0.0 ")));
|
||||
assert_eq!(expected, actual);
|
||||
dir.close()
|
||||
}
|
||||
|
@ -249,7 +249,7 @@ mod tests {
|
|||
file.sync_all()?;
|
||||
|
||||
let actual = ModuleRenderer::new("nodejs").path(dir.path()).collect();
|
||||
let expected = Some(format!("via {}", Color::Green.bold().paint(" v12.0.0 ")));
|
||||
let expected = Some(format!("via {}", Color::Green.bold().paint(" v12.0.0 ")));
|
||||
assert_eq!(expected, actual);
|
||||
dir.close()
|
||||
}
|
||||
|
@ -268,7 +268,7 @@ mod tests {
|
|||
file.sync_all()?;
|
||||
|
||||
let actual = ModuleRenderer::new("nodejs").path(dir.path()).collect();
|
||||
let expected = Some(format!("via {}", Color::Red.bold().paint(" v12.0.0 ")));
|
||||
let expected = Some(format!("via {}", Color::Red.bold().paint(" v12.0.0 ")));
|
||||
assert_eq!(expected, actual);
|
||||
dir.close()
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue