summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTrickyPi <33021497+TrickyPi@users.noreply.github.com>2022-01-30 17:28:00 +0800
committerGitHub <noreply@github.com>2022-01-30 10:28:00 +0100
commit65f29754d3a97a16ff4372bb59397f711787e54a (patch)
treefebcdfa6f20d87d61993353938a3af37fda1edfe
parente680540cfc4c783266183a589a26a33605bead43 (diff)
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
-rw-r--r--CONTRIBUTING.md4
-rw-r--r--docs/config/README.md2
-rw-r--r--docs/presets/README.md3
-rw-r--r--src/configs/nodejs.rs2
-rw-r--r--src/modules/nodejs.rs20
5 files changed, 17 insertions, 14 deletions
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index d34f01112..525128934 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -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
diff --git a/docs/config/README.md b/docs/config/README.md
index 3bf0ec9ca..ee542c5c3 100644
--- a/docs/config/README.md
+++ b/docs/config/README.md
@@ -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. |
diff --git a/docs/presets/README.md b/docs/presets/README.md
index 0262fd81a..ff968ca73 100644
--- a/docs/presets/README.md
+++ b/docs/presets/README.md
@@ -62,6 +62,9 @@ symbol = " "
[nix_shell]
symbol = " "
+[nodejs]
+symbol = " "
+
[package]
symbol = " "
diff --git a/src/configs/nodejs.rs b/src/configs/nodejs.rs
index fbafc7f50..6d4a59112 100644
--- a/src/configs/nodejs.rs
+++ b/src/configs/nodejs.rs
@@ -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",
diff --git a/src/modules/nodejs.rs b/src/modules/nodejs.rs
index 85d5dcc9e..cf77a8fd3 100644
--- a/src/modules/nodejs.rs
+++ b/src/modules/nodejs.rs
@@ -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()
}