Skip to content

Commit c8453b0

Browse files
committed
docs: update docs
1 parent efb3e75 commit c8453b0

7 files changed

Lines changed: 195 additions & 10 deletions

File tree

README.md

Lines changed: 188 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,21 +175,206 @@ sudo dnf install webkit2gtk4.1-devel \
175175
librsvg2-devel
176176
```
177177

178-
### Run in Development Mode
178+
### Getting Started
179179

180+
1. **Clone and install dependencies:**
180181
```bash
182+
git clone https://github.com/vietanhdev/ThinkUtils.git
183+
cd thinkutils
181184
npm install
182-
npm run tauri dev
183185
```
184186

185-
### Build for Production
187+
2. **Run in development mode:**
188+
```bash
189+
npm run tauri dev
190+
```
186191

192+
3. **Build for production:**
187193
```bash
188194
npm run tauri build
189195
```
190196

191197
The built packages will be in `src-tauri/target/release/bundle/`
192198

199+
### Code Quality & Linting
200+
201+
ThinkUtils uses comprehensive linting and formatting tools to maintain code quality:
202+
203+
- **ESLint** - JavaScript linting
204+
- **HTMLHint** - HTML validation
205+
- **Stylelint** - CSS linting
206+
- **Prettier** - Code formatting
207+
- **Husky** - Git hooks for pre-commit checks
208+
- **lint-staged** - Run linters on staged files only
209+
210+
#### Available Commands
211+
212+
```bash
213+
# Run all linters
214+
npm run lint
215+
216+
# Auto-fix issues
217+
npm run lint:fix
218+
219+
# Format all files
220+
npm run format
221+
222+
# Full validation (lint + format check)
223+
npm run validate
224+
```
225+
226+
#### Pre-commit Hooks
227+
228+
Pre-commit hooks are automatically set up when you run `npm install`. They will:
229+
230+
1.**Auto-format** staged files (JavaScript, HTML, CSS, JSON)
231+
2.**Lint** staged files and fix auto-fixable issues
232+
3.**Validate** all code before allowing commit
233+
4.**Block commit** if linting fails
234+
235+
**What happens on commit:**
236+
```bash
237+
git commit -m "Your message"
238+
239+
🔍 Running pre-commit checks...
240+
📝 Formatting and linting staged files...
241+
✓ JavaScript files formatted and linted
242+
✓ CSS files formatted and linted
243+
✓ HTML files validated
244+
✅ All checks passed!
245+
```
246+
247+
**If issues are found:**
248+
```bash
249+
❌ Linting failed. Please fix the issues and try again.
250+
```
251+
252+
The commit will be blocked until you fix the issues. Most issues can be auto-fixed:
253+
```bash
254+
npm run lint:fix
255+
git add .
256+
git commit -m "Your message"
257+
```
258+
259+
#### IDE Integration
260+
261+
**VS Code** (Recommended):
262+
1. Install recommended extensions (popup will appear)
263+
2. Reload VS Code
264+
3. Files will auto-format on save!
265+
266+
Recommended extensions:
267+
- ESLint
268+
- Prettier
269+
- HTMLHint
270+
- Stylelint
271+
272+
**Other IDEs:**
273+
See `LINTING_SETUP.md` for configuration instructions.
274+
275+
#### Bypassing Pre-commit Hooks
276+
277+
In rare cases where you need to bypass hooks (not recommended):
278+
```bash
279+
git commit --no-verify -m "Your message"
280+
```
281+
282+
### Project Structure
283+
284+
```
285+
thinkutils/
286+
├── src/ # Frontend
287+
│ ├── index.html # Main UI
288+
│ ├── styles.css # Styling
289+
│ └── js/ # Modular JavaScript
290+
│ ├── app.js # Main entry point
291+
│ ├── dom.js # DOM references
292+
│ ├── state.js # State management
293+
│ ├── utils.js # Utilities
294+
│ ├── navigation.js # View switching
295+
│ ├── titlebar.js # Window controls
296+
│ ├── about.js # About dialog
297+
│ └── views/ # Feature modules
298+
│ ├── home.js
299+
│ ├── fan.js
300+
│ ├── battery.js
301+
│ ├── performance.js
302+
│ ├── monitor.js
303+
│ ├── sync.js
304+
│ └── system.js
305+
├── src-tauri/ # Backend (Rust)
306+
│ ├── src/
307+
│ │ └── lib.rs # Tauri commands
308+
│ └── tauri.conf.json # Configuration
309+
├── .husky/ # Git hooks
310+
│ └── pre-commit # Pre-commit validation
311+
├── .eslintrc.json # ESLint config
312+
├── .prettierrc.json # Prettier config
313+
├── .stylelintrc.json # Stylelint config
314+
├── .htmlhintrc # HTMLHint config
315+
└── .lintstagedrc.json # lint-staged config
316+
```
317+
318+
### Development Workflow
319+
320+
1. **Create a feature branch:**
321+
```bash
322+
git checkout -b feature/your-feature
323+
```
324+
325+
2. **Make your changes:**
326+
- Edit files in `src/` for frontend
327+
- Edit files in `src-tauri/src/` for backend
328+
329+
3. **Test your changes:**
330+
```bash
331+
npm run tauri dev
332+
```
333+
334+
4. **Validate code quality:**
335+
```bash
336+
npm run validate
337+
```
338+
339+
5. **Commit your changes:**
340+
```bash
341+
git add .
342+
git commit -m "feat: add your feature"
343+
```
344+
- Pre-commit hooks will automatically format and lint
345+
- Commit will be blocked if validation fails
346+
347+
6. **Push and create PR:**
348+
```bash
349+
git push origin feature/your-feature
350+
```
351+
352+
### Coding Standards
353+
354+
- **JavaScript**: ES6+ modules, single quotes, semicolons
355+
- **HTML**: HTML5, lowercase tags, double quotes for attributes
356+
- **CSS**: Standard CSS, consistent spacing
357+
- **Formatting**: 2-space indentation, LF line endings
358+
- **Commits**: Follow [Conventional Commits](https://www.conventionalcommits.org/)
359+
360+
### Testing
361+
362+
```bash
363+
# Run linters
364+
npm run lint
365+
366+
# Run auto-fix
367+
npm run lint:fix
368+
369+
# Full validation
370+
npm run validate
371+
```
372+
373+
### Documentation
374+
375+
- `src/js/README.md` - JavaScript module documentation
376+
- `docs/` - Feature documentation
377+
193378
## Usage
194379

195380
### Running the Application

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "thinkutils",
33
"private": true,
4-
"version": "0.1.2",
4+
"version": "0.1.3",
55
"type": "module",
66
"scripts": {
77
"tauri": "tauri",

src-tauri/Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src-tauri/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "thinkutils"
3-
version = "0.1.2"
3+
version = "0.1.3"
44
description = "A Tauri App"
55
authors = ["you"]
66
edition = "2021"

src-tauri/tauri.conf.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"$schema": "https://schema.tauri.app/config/2",
33
"productName": "thinkutils",
4-
"version": "0.1.2",
4+
"version": "0.1.3",
55
"identifier": "com.vietanhnv.thinkutils",
66
"build": {
77
"frontendDist": "../src"

src/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@
195195
<img src="assets/logo.svg" width="48" height="48" alt="ThinkUtils Logo" />
196196
</div>
197197
<h2>ThinkUtils</h2>
198-
<p class="dialog-version">Version 0.1.2</p>
198+
<p class="dialog-version">Version 0.1.3</p>
199199
<button id="close-about" class="dialog-close">
200200
<svg
201201
width="20"

0 commit comments

Comments
 (0)