Improved contribution docs for building locally (#79)

* Modified the desktop app building docs with more info and some fixes. Fixed the docs for webpage contributing guide.

* Update www.md

fixed a typo
This commit is contained in:
RayZ3R0 2024-10-29 23:07:24 +06:00 committed by GitHub
parent 5157abcb08
commit 5e02a4b29a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 57 additions and 23 deletions

View file

@ -13,7 +13,7 @@ Before you begin, ensure you have the following tools installed:
- [**Git**](https://git-scm.com/): Version control system to clone the repository and manage your code. - [**Git**](https://git-scm.com/): Version control system to clone the repository and manage your code.
- [**Node.js**](https://nodejs.org/): Required for building the browser. - [**Node.js**](https://nodejs.org/): Required for building the browser.
- [**npm**](https://www.npmjs.com/): Node package manager, which comes with Node.js. - [**npm**](https://www.npmjs.com/): Node package manager, which comes with Node.js.
- [**MozillaBuild**](https://wiki.mozilla.org/MozillaBuild): Meta-installer required to build the browser. - [**MozillaBuild**](https://wiki.mozilla.org/MozillaBuild): Meta-installer required to build the browser.
- [**Mercurial/TortoiseHg**](https://www.mercurial-scm.org/downloads): Required by Mozilla scripts, with its install directory added to PATH. - [**Mercurial/TortoiseHg**](https://www.mercurial-scm.org/downloads): Required by Mozilla scripts, with its install directory added to PATH.
- [**Python**](https://www.python.org/): Required by build scripts, with its install directory added to PATH. - [**Python**](https://www.python.org/): Required by build scripts, with its install directory added to PATH.
@ -22,8 +22,9 @@ Before you begin, ensure you have the following tools installed:
Clone the project Clone the project
```bash ```bash
git clone https://github.com/zen-browser/desktop.git --recurse-submodules git clone --depth 1 https://github.com/zen-browser/desktop.git
cd desktop cd desktop
git submodule update --init --recursive --depth 1
``` ```
Install dependencies Install dependencies
@ -34,43 +35,66 @@ npm i
Download and bootstrap the browser Download and bootstrap the browser
``` ```bash
npm run init npm run init
``` ```
Copy a language pack Run bootstrap to identify and fix potential errors
```bash
npm run bootstrap
``` ```
Copy a language pack
```bash
sh scripts/update-en-US-packs.sh sh scripts/update-en-US-packs.sh
``` ```
Start building the browser Start building the browser
``` ```bash
npm run build npm run build
``` ```
Finally, run the browser! Finally, run the browser!
``` ```bash
npm start npm start
``` ```
### Limiting CPU Usage During Build
On Linux, you can use cpulimit to restrict CPU usage of intensive build processes:
```bash
# Limit by process name
cpulimit -e rustc -l 50 # Limits rustc to 50% CPU
cpulimit -e clang -l 50 # Limits clang to 50% CPU
# Or limit by PID
cpulimit -p PID -l 50
```
On Windows, use Process Lasso or Process Hacker to set CPU affinity and priority:
1. Open Process Lasso/Process Hacker
2. Find rustc.exe or clang.exe processes
3. Right click -> Set CPU Affinity/Priority
## Making a Contribution ## Making a Contribution
#### 1. Fork the Repository #### 1. Fork the Repository
#### 2. Create a New Branch #### 2. Create a New Branch
Its a good practice to create a new branch for each feature or bug fix. Its a good practice to create a new branch for each feature or bug fix.
```bash ```bash
git checkout -b feature/your-feature-name git checkout -b feature/your-feature-name
``` ```
#### 3. Make Your Changes #### 3. Make Your Changes
Edit the code in your local repository. Edit the code in your local repository.
- Ensure that your changes do not break existing functionality. - Ensure that your changes do not break existing functionality.
- Write tests if applicable. - Write tests if applicable.
You can test your changes by You can test your changes by
@ -79,21 +103,21 @@ You can test your changes by
#### 4. Commit Your Changes #### 4. Commit Your Changes
Commit your changes with a descriptive message. Commit your changes with a descriptive message.
```bash ```bash
git commit -m "Add feature: your feature description" git commit -m "Add feature: your feature description"
``` ```
#### 5. Push Your Changes #### 5. Push Your Changes
Push your branch to your forked repository. Push your branch to your forked repository.
```bash ```bash
git push origin feature/your-feature-name git push origin feature/your-feature-name
``` ```
#### 6. Submit a Pull Request #### 6. Submit a Pull Request
Go to the original Zen Browser repository and submit a pull request from your forked repository. Go to the original Zen Browser repository and submit a pull request from your forked repository.
- Provide a clear title and description of your changes. - Provide a clear title and description of your changes.
- Reference any relevant issues in the pull request. - Reference any relevant issues in the pull request.
@ -101,10 +125,10 @@ Go to the original Zen Browser repository and submit a pull request from your fo
- [Zen Browser Repository](https://github.com/zen-browser/desktop) - [Zen Browser Repository](https://github.com/zen-browser/desktop)
- [[CONTRIBUTING| Contribution Guidelines]] - [[CONTRIBUTING| Contribution Guidelines]]
- [[CODE_OF_CONDUCT | Code of Conduct]] - [[CODE_OF_CONDUCT | Code of Conduct]]
- [Searchfox](https://searchfox.org/) a source code indexing tool for Mozilla Firefox - [Searchfox](https://searchfox.org/) a source code indexing tool for Mozilla Firefox
- [MDN Web Docs](https://developer.mozilla.org/) a documentation repository and learning resource for web developers - [MDN Web Docs](https://developer.mozilla.org/) a documentation repository and learning resource for web developers
--- ---
Thank you for contributing to Zen Browser! Your contributions are valuable and help make the project better for everyone. Thank you for contributing to Zen Browser! Your contributions are valuable and help make the project better for everyone.

View file

@ -41,17 +41,27 @@ npm install
This command installs all the necessary packages listed in the `package.json` file. This command installs all the necessary packages listed in the `package.json` file.
## Step 4: Start the Development Server ## Step 4: Build the Project
To build the project files:
```bash
npm run build
```
This command will compile and process all the source files into a production-ready format.
## Step 5: Start the Development Server
After installing the dependencies, you can start the development server: After installing the dependencies, you can start the development server:
```bash ```bash
npm start npm run dev
``` ```
This command will start a local server and open the homepage in your default web browser. The server will automatically reload whenever you make changes to the code. This command will start a local server and open the homepage in your default web browser. The server will automatically reload whenever you make changes to the code.
## Step 5: Make Your Changes ## Step 6: Make Your Changes
You can now start making changes to the homepage. The project structure is as follows: You can now start making changes to the homepage. The project structure is as follows:
@ -61,11 +71,11 @@ You can now start making changes to the homepage. The project structure is as fo
Feel free to explore and modify the files to implement new features or fix bugs. Feel free to explore and modify the files to implement new features or fix bugs.
## Step 6: Test Your Changes ## Step 7: Test Your Changes
Before submitting your changes, make sure they work as expected. Check the functionality across different pages and ensure that your changes do not introduce any new issues. Before submitting your changes, make sure they work as expected. Check the functionality across different pages and ensure that your changes do not introduce any new issues.
## Step 7: Commit and Push Your Changes ## Step 8: Commit and Push Your Changes
Once you are satisfied with your changes, commit them to your local repository: Once you are satisfied with your changes, commit them to your local repository:
@ -80,7 +90,7 @@ Push your changes to your forked repository:
git push origin main git push origin main
``` ```
## Step 8: Create a Pull Request ## Step 9: Create a Pull Request
After pushing your changes, go to the original Zen Browser Homepage Repository and submit a pull request: After pushing your changes, go to the original Zen Browser Homepage Repository and submit a pull request:
@ -101,4 +111,4 @@ Your pull request will be reviewed by the maintainers, and you may be asked to m
--- ---
Thank you for contributing to Zen Browser's homepage! Your contributions help make the project better for everyone. Thank you for contributing to Zen Browser's homepage! Your contributions help make the project better for everyone.