|
| 1 | +[中文贡献指南](../CONTRIBUTING.md) |
| 2 | + |
| 3 | +# ScriptCat Contributing Guide |
| 4 | + |
| 5 | +We greatly appreciate your contributions to ScriptCat! This guide aims to help you contribute to ScriptCat in a more standardized way, so please read it carefully. |
| 6 | + |
| 7 | +## Submitting Issues |
| 8 | + |
| 9 | +Before submitting an issue, we recommend that you first check the [existing Issues](https://github.com/scriptscat/scriptcat/issues) to avoid duplicate submissions. |
| 10 | + |
| 11 | +### Reporting Problems, Bugs & Vulnerabilities |
| 12 | + |
| 13 | +ScriptCat is an evolving project. If you encounter problems during use and are confident that these issues are caused by ScriptCat, we welcome you to submit an Issue. When submitting, please include detailed reproduction steps and runtime environment information. |
| 14 | + |
| 15 | +### Proposing New Features |
| 16 | + |
| 17 | +We welcome you to propose new feature suggestions in Issues. To help us better understand your needs, we recommend that you describe the feature in as much detail as possible and provide what you think might be a possible solution. |
| 18 | + |
| 19 | +## Pull Request |
| 20 | + |
| 21 | +ScriptCat uses [pnpm](https://pnpm.io/) to manage project dependencies. If you already have npm installed, the following commands can help you quickly set up the development environment: |
| 22 | + |
| 23 | +```bash |
| 24 | +# Install node.js dependencies |
| 25 | +pnpm install |
| 26 | +``` |
| 27 | + |
| 28 | +We recommend using a [proxy](https://pnpm.io/npmrc#https-proxy) to solve pnpm network issues rather than using mirrors. |
| 29 | + |
| 30 | +```bash |
| 31 | +pnpm config set proxy http://127.0.0.1:7890 |
| 32 | +pnpm config set https-proxy https://127.0.0.1:7890 |
| 33 | +``` |
| 34 | + |
| 35 | +### Commit Guidelines |
| 36 | + |
| 37 | +We hope that each commit can clearly describe its purpose, and each commit should ideally contain only one modification. Our commit message format follows the [gitmoji](https://gitmoji.dev/) specification. For example: |
| 38 | + |
| 39 | +```bash |
| 40 | +git commit -m "✨ add login feature" |
| 41 | +``` |
| 42 | + |
| 43 | +This example indicates that a new feature has been added: login functionality. |
| 44 | + |
| 45 | +### Workflow Overview |
| 46 | + |
| 47 | +The `main` branch is ScriptCat's primary branch. To maintain code integrity, please do not directly modify the `main` branch. You should create a new branch and make modifications on this branch, then initiate a Pull Request targeting the `main` branch. Please try to use Chinese for Pull Request titles to facilitate automatic changelog generation. |
| 48 | + |
| 49 | +If you are not a member of the ScriptCat team, you can first fork this repository and then initiate a Pull Request to the `main` branch of this repository. When creating commits, please follow the commit message guidelines mentioned above. We will merge your contributions to the main branch after code review is completed. |
| 50 | + |
| 51 | +## Writing Documentation |
| 52 | + |
| 53 | +ScriptCat's documentation is in a separate repository: [scriptcat.org](https://docs.scriptcat.org), written using [docusaurus](https://docusaurus.io/). There are some [Markdown](https://docusaurus.io/zh-CN/docs/markdown-features) features that can help you. If you need to preview the modified documentation locally, you can use the following commands to install documentation dependencies and start the dev server: |
| 54 | + |
| 55 | +```bash |
| 56 | +npm install |
| 57 | +npm start |
| 58 | +``` |
| 59 | + |
| 60 | +### Help Us Translate |
| 61 | + |
| 62 | +[Crowdin](https://crowdin.com/project/scriptcat) is an online multilingual translation platform. If you are interested in helping us translate ScriptCat-related content, you can find the ScriptCat project on Crowdin and start translation work. |
| 63 | + |
| 64 | +- `src/locales` is the translation file directory for the [extension](https://github.com/scriptscat/scriptcat) |
| 65 | +- `public/locales` is the translation file directory for the [script site](https://github.com/scriptscat/scriptlist-frontend) |
| 66 | + |
| 67 | +#### Enable WYSIWYG Mode for Extension |
| 68 | + |
| 69 | +> New version not yet supplemented |
| 70 | +
|
| 71 | +#### Enable WYSIWYG Mode for Script Site |
| 72 | + |
| 73 | +Visit the script site at: [https://scriptcat.org/ach-UG](https://scriptcat.org/ach-UG) to enable WYSIWYG mode |
| 74 | + |
| 75 | +## Participating in Development |
| 76 | + |
| 77 | +ScriptCat uses ESLint to standardize code style and Vitest for unit testing. You can use the following commands to run them: |
| 78 | + |
| 79 | +```bash |
| 80 | +pnpm test |
| 81 | +pnpm run lint |
| 82 | +``` |
| 83 | + |
| 84 | +ScriptCat's page development uses the following technologies: |
| 85 | + |
| 86 | +- [React](https://reactjs.org/) |
| 87 | +- UI framework [arco](https://arco.design) |
| 88 | +- CSS framework [unocss](https://unocss.dev/interactive/) |
| 89 | +- RsPack bundling tool [rspack](https://rspack.dev/) |
| 90 | + |
| 91 | +If you want to run ScriptCat locally, you can use the following commands: |
| 92 | + |
| 93 | +```bash |
| 94 | +pnpm run dev |
| 95 | +# Please note that for unknown reasons, if you need to use incognito windows, you need to use the following command for development |
| 96 | +pnpm run dev:noMap |
| 97 | +``` |
| 98 | + |
| 99 | +If you want to package the extension, you can use the following command: |
| 100 | + |
| 101 | +```bash |
| 102 | +pnpm run pack |
| 103 | +``` |
| 104 | + |
| 105 | +Before packaging, please ensure that the `scriptcat.pem` file is generated in the `dist` directory. |
| 106 | + |
| 107 | +## Important Notes |
| 108 | + |
| 109 | +- After running `pnpm run dev`, you need to import and load the contents of the `dist/ext` directory into the browser extension, then start editing code and save. The browser updates in real-time, but changes involving `manifest.json`, `service_worker`, `offscreen`, and `sandbox` require reloading. |
0 commit comments