docs: add icon contribution guide

This commit is contained in:
sxyazi 2025-05-03 02:17:11 +08:00
parent 5da39722e4
commit a201c93419
No known key found for this signature in database
5 changed files with 98 additions and 59 deletions

19
.github/pull_request_template.md vendored Normal file
View file

@ -0,0 +1,19 @@
## Which issue does this PR close?
<!--
For any fixes and enhancements, we usually require an associated issue to be filed where clearly detailed your proposed changes and why they are necessary, which ensures we are aligned and reduces the risk of re-work.
-->
<!--
You can use GitHub syntax to link an issue to this PR, such as `Closes #1000`, which indicates this PR will close issue #1000.
-->
Closes #
## Rationale of this PR
<!--
A clear and concise description of the rationale of this change, to help our reviewers understand your intent and why it is necessary.
If this has already been detailed in the associated issue, please skip this section.
-->

View file

@ -10,7 +10,7 @@ This guide will help you understand how to contribute to the project.
2. [Project Structure](#project-structure) 2. [Project Structure](#project-structure)
3. [Development Setup](#development-setup) 3. [Development Setup](#development-setup)
4. [How to Contribute](#how-to-contribute) 4. [How to Contribute](#how-to-contribute)
5. [Pull Request Process](#pull-request-process) 5. [Pull Requests](#pull-requests)
## Getting Started ## Getting Started
@ -26,14 +26,14 @@ Before you begin, ensure you have met the following requirements:
1. Fork the [Yazi repository](https://github.com/sxyazi/yazi) to your GitHub account. 1. Fork the [Yazi repository](https://github.com/sxyazi/yazi) to your GitHub account.
2. Clone your fork to your local machine: 2. Clone your fork to your local machine:
```sh ```sh
git clone https://github.com/<your-username>/yazi.git git clone https://github.com/<your-username>/yazi.git
``` ```
3. Set up the upstream remote: 3. Set up the upstream remote:
```sh ```sh
git remote add upstream https://github.com/sxyazi/yazi.git git remote add upstream https://github.com/sxyazi/yazi.git
``` ```
## Project Structure ## Project Structure
@ -46,16 +46,23 @@ A brief overview of the project's structure:
├── scripts/ # Helper scripts used by CI/CD ├── scripts/ # Helper scripts used by CI/CD
├── snap/ # Snapcraft configuration ├── snap/ # Snapcraft configuration
├── yazi-adapter/ # Yazi image adapter ├── yazi-adapter/ # Yazi image adapter
├── yazi-binding/ # Yazi Lua bindings
├── yazi-boot/ # Yazi bootstrapper ├── yazi-boot/ # Yazi bootstrapper
├── yazi-cli/ # Yazi command-line interface ├── yazi-cli/ # Yazi command-line interface
├── yazi-codegen/ # Yazi code generator
├── yazi-config/ # Yazi configuration file parser ├── yazi-config/ # Yazi configuration file parser
├── yazi-core/ # Yazi core logic ├── yazi-core/ # Yazi core logic
├── yazi-dds/ # Yazi data distribution service ├── yazi-dds/ # Yazi data distribution service
├── yazi-ffi/ # Yazi foreign function interface
├── yazi-fm/ # Yazi file manager ├── yazi-fm/ # Yazi file manager
├── yazi-fs/ # Yazi file system
├── yazi-macro/ # Yazi macros
├── yazi-plugin/ # Yazi plugin system ├── yazi-plugin/ # Yazi plugin system
├── yazi-proxy/ # Yazi event proxy ├── yazi-proxy/ # Yazi event proxy
├── yazi-scheduler/ # Yazi task scheduler ├── yazi-scheduler/ # Yazi task scheduler
├── yazi-shared/ # Yazi shared library ├── yazi-shared/ # Yazi shared library
├── yazi-term/ # Yazi terminal extensions
├── yazi-widgets/ # Yazi user interface widgets
├── .github/ # GitHub-specific files and workflows ├── .github/ # GitHub-specific files and workflows
├── Cargo.toml # Rust workflow configuration ├── Cargo.toml # Rust workflow configuration
└── README.md # Project overview └── README.md # Project overview
@ -65,82 +72,95 @@ A brief overview of the project's structure:
1. Ensure the latest stable Rust is installed: 1. Ensure the latest stable Rust is installed:
```sh ```sh
rustc --version rustc --version
cargo --version cargo --version
``` ```
2. Build the project: 2. Build the project:
```sh ```sh
cargo build cargo build
``` ```
3. Run the tests: 3. Run the tests:
```sh ```sh
cargo test --workspace cargo test --workspace --verbose
``` ```
4. Format the code (requires `rustfmt` nightly): 4. Format the code (requires `rustfmt` nightly):
```sh ```sh
rustup component add rustfmt --toolchain nightly rustup component add rustfmt --toolchain nightly
rustfmt +nightly **/*.rs rustfmt +nightly **/*.rs
``` ```
## How to Contribute ## How to Contribute
### Reporting Bugs ### Reporting Bugs
If you find a bug, please file an issue. If you encounter a bug and have found a way to reliably reproduce it on the latest `main` branch, please file a [bug report](https://github.com/sxyazi/yazi/issues/new?template=bug.yml) with a [minimal reproducer](https://stackoverflow.com/help/minimal-reproducible-example).
### Suggesting Features ### Suggesting Features
If you have a feature request, please file an issue. If you want to request a feature, please file a [feature request](https://github.com/sxyazi/yazi/issues/new?template=feature.yml). Please make sure to search for existing issues and discussions before submitting.
### Improving Documentation ### Improving Documentation
Yazi's documentation placed at [yazi-rs/yazi-rs.github.io](https://github.com/yazi-rs/yazi-rs.github.io), contributions related to documentation need to be made within this repository. Yazi's documentation placed at [yazi-rs/yazi-rs.github.io](https://github.com/yazi-rs/yazi-rs.github.io), contributions related to documentation need to be made there.
### Improving Icons
Yazi's icon originates from [`nvim-web-devicons`](https://github.com/nvim-tree/nvim-web-devicons), and it is periodically grabbed and updated with the latest changes from upstream via [`generate.lua`](https://github.com/sxyazi/yazi/blob/main/scripts/icons/generate.lua).
Contributions related to the icon should be made upstream to facilitate easier automation of this process.
### Submitting Code Changes ### Submitting Code Changes
1. Create a new branch for your changes: 1. Create a new branch for your changes:
```sh ```sh
git checkout -b your-branch-name git checkout -b your-branch-name
``` ```
2. Make your changes. Ensure that your code follows the project's [coding style](https://github.com/sxyazi/yazi/blob/main/rustfmt.toml) and passes all tests. 2. Make your changes. Ensure that your code follows the project's [coding style](https://github.com/sxyazi/yazi/blob/main/rustfmt.toml) and passes all tests.
3. Commit your changes with a descriptive commit message: 3. Commit your changes with a descriptive commit message:
```sh ```sh
git commit -m "feat: an awesome feature" git commit -m "feat: an awesome feature"
``` ```
4. Push your changes to your fork: 4. Push your changes to your fork:
```sh
git push origin your-branch-name
```
## Pull Request Process ```sh
git push origin your-branch-name
```
## Pull Requests
If you have an idea, before raising a pull request, we encourage you to file an issue to propose it, ensuring that we are aligned and reducing the risk of re-work.
We want you to succeed, and it can be discouraging to find that a lot of re-work is needed.
### Process
1. Ensure your fork is up-to-date with the upstream repository: 1. Ensure your fork is up-to-date with the upstream repository:
```sh ```sh
git fetch upstream git fetch upstream
git checkout main git checkout main
git merge upstream/main git merge upstream/main
``` ```
2. Rebase your feature branch onto the main branch: 2. Rebase your feature branch onto the `main` branch:
```sh ```sh
git checkout your-branch-name git checkout your-branch-name
git rebase main git rebase main
``` ```
3. Create a pull request to the `main` branch of the upstream repository. Follow the pull request template and ensure that: 3. Create a pull request to the `main` branch of the upstream repository. Follow the pull request template and ensure that:
- Your code passes all tests and lints. - Your code passes all tests and lints.
- Your pull request description clearly explains the changes and why they are needed. - Your pull request description clearly explains the changes and why they are needed.
4. Address any review comments. Make sure to push updates to the same branch on your fork. 4. Address any review comments. Make sure to push updates to the same branch on your fork.

View file

@ -4,7 +4,7 @@ version = "25.4.8"
edition = "2024" edition = "2024"
license = "MIT" license = "MIT"
authors = [ "sxyazi <sxyazi@gmail.com>" ] authors = [ "sxyazi <sxyazi@gmail.com>" ]
description = "Yazi codegen" description = "Yazi code generator"
homepage = "https://yazi-rs.github.io" homepage = "https://yazi-rs.github.io"
repository = "https://github.com/sxyazi/yazi" repository = "https://github.com/sxyazi/yazi"

View file

@ -1,25 +1,25 @@
#[derive(Default)] #[derive(Default)]
pub struct Backstack<T: Eq> { pub struct Backstack<T> {
cursor: usize, cursor: usize,
stack: Vec<T>, stack: Vec<T>,
} }
impl<T: Eq> Backstack<T> { impl<T: Eq + Clone> Backstack<T> {
pub fn push(&mut self, item: T) { pub fn push(&mut self, item: &T) {
if self.stack.is_empty() { if self.stack.is_empty() {
self.stack.push(item); self.stack.push(item.clone());
return; return;
} }
if self.stack[self.cursor] == item { if self.stack[self.cursor] == *item {
return; return;
} }
self.cursor += 1; self.cursor += 1;
if self.cursor == self.stack.len() { if self.cursor == self.stack.len() {
self.stack.push(item); self.stack.push(item.clone());
} else { } else {
self.stack[self.cursor] = item; self.stack[self.cursor] = item.clone();
self.stack.truncate(self.cursor + 1); self.stack.truncate(self.cursor + 1);
} }
@ -57,11 +57,11 @@ mod tests {
#[test] #[test]
fn test_backstack() { fn test_backstack() {
let mut bs = Backstack::default(); let mut bs = Backstack::default();
bs.push(1); bs.push(&1);
assert_eq!(bs.stack[bs.cursor], 1); assert_eq!(bs.stack[bs.cursor], 1);
bs.push(2); bs.push(&2);
bs.push(3); bs.push(&3);
assert_eq!(bs.stack[bs.cursor], 3); assert_eq!(bs.stack[bs.cursor], 3);
assert_eq!(bs.shift_backward(), Some(&2)); assert_eq!(bs.shift_backward(), Some(&2));
@ -74,7 +74,7 @@ mod tests {
assert_eq!(bs.shift_forward(), None); assert_eq!(bs.shift_forward(), None);
bs.shift_backward(); bs.shift_backward();
bs.push(4); bs.push(&4);
assert_eq!(bs.stack[bs.cursor], 4); assert_eq!(bs.stack[bs.cursor], 4);
assert_eq!(bs.shift_forward(), None); assert_eq!(bs.shift_forward(), None);

View file

@ -68,7 +68,7 @@ impl Tab {
// Backstack // Backstack
if opt.target.is_regular() { if opt.target.is_regular() {
self.backstack.push(opt.target.clone()); self.backstack.push(&opt.target);
} }
Pubsub::pub_from_cd(self.id, self.cwd()); Pubsub::pub_from_cd(self.id, self.cwd());