Skip to content

Commit

Permalink
fix(nodejs): use e718 as the default of symbol in node configuration (s…
Browse files Browse the repository at this point in the history
…tarship#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
  • Loading branch information
TrickyPi authored and Perniciosius committed Feb 21, 2022
1 parent b5db076 commit ea8cb16
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 14 deletions.
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 @@ -2206,7 +2206,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. |
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

0 comments on commit ea8cb16

Please sign in to comment.