Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(nodejs): use e718 as the default of symbol in node configuration #3533

Merged
merged 3 commits into from
Jan 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion docs/config/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2168,7 +2168,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. |
TrickyPi marked this conversation as resolved.
Show resolved Hide resolved
| `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. |
Expand Down
3 changes: 3 additions & 0 deletions docs/presets/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ symbol = " "
[nix_shell]
symbol = ""

[nodejs]
symbol = ""

[package]
symbol = ""

Expand Down
2 changes: 1 addition & 1 deletion src/configs/nodejs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
20 changes: 10 additions & 10 deletions src/modules/nodejs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Expand All @@ -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()
}
Expand All @@ -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()
}
Expand All @@ -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()
}
Expand All @@ -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()
}
Expand All @@ -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()
}
Expand All @@ -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()
}
Expand All @@ -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()
}
Expand All @@ -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()
}
Expand All @@ -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()
}
Expand Down