@fatsolutions/ganchos 1.1.0 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +85 -0
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# @fatsolutions/ganchos
|
|
2
|
+
|
|
3
|
+
Git Hook Manager for Polyglot Monorepos.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm add -D @fatsolutions/ganchos
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Quick Setup
|
|
12
|
+
|
|
13
|
+
Add your desired languages to `package.json`:
|
|
14
|
+
|
|
15
|
+
```json
|
|
16
|
+
{
|
|
17
|
+
"ganchos": {
|
|
18
|
+
"languages": ["typescript", "python", "cairo"]
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
The hooks will be automatically installed on `pnpm install` via the postinstall bootstrap.
|
|
24
|
+
|
|
25
|
+
## Manual Setup
|
|
26
|
+
|
|
27
|
+
If you prefer manual control, skip the `ganchos` field in `package.json` and use the CLI:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
# Enable languages
|
|
31
|
+
pnpm ganchos enable typescript python cairo
|
|
32
|
+
|
|
33
|
+
# Install the hooks
|
|
34
|
+
pnpm ganchos install
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## CLI Commands
|
|
38
|
+
|
|
39
|
+
| Command | Description |
|
|
40
|
+
|---------|-------------|
|
|
41
|
+
| `ganchos install` | Install git hooks based on configuration |
|
|
42
|
+
| `ganchos generate` | Generate hook content to stdout (for inspection) |
|
|
43
|
+
| `ganchos list` | List configured and available languages |
|
|
44
|
+
| `ganchos enable <languages...>` | Enable one or more languages |
|
|
45
|
+
| `ganchos disable <languages...>` | Disable one or more languages |
|
|
46
|
+
|
|
47
|
+
## Supported Languages
|
|
48
|
+
|
|
49
|
+
- **javascript** - ESLint, Prettier
|
|
50
|
+
- **typescript** - TypeScript compiler, ESLint, Prettier
|
|
51
|
+
- **python** - Black, isort, flake8, mypy *(work in progress)*
|
|
52
|
+
- **cairo** - scarb fmt, scarb lint
|
|
53
|
+
|
|
54
|
+
## How It Works
|
|
55
|
+
|
|
56
|
+
1. Configuration is stored in `.ganchos.json` (auto-generated, added to `.git/info/exclude`)
|
|
57
|
+
2. Language-specific hook scripts are located in `hooks/pre-commit/`
|
|
58
|
+
3. On commit, the pre-commit hook runs checks for all enabled languages on staged files
|
|
59
|
+
4. Auto-fixable issues (formatting) are fixed automatically; you'll be prompted to review and commit again
|
|
60
|
+
|
|
61
|
+
## Language-Specific Requirements
|
|
62
|
+
|
|
63
|
+
### JavaScript/TypeScript
|
|
64
|
+
- `eslint` and `prettier` available via `npx`
|
|
65
|
+
|
|
66
|
+
### Python
|
|
67
|
+
- Optional: `black`, `isort`, `flake8`, `mypy` installed in your environment
|
|
68
|
+
|
|
69
|
+
### Cairo (Starknet)
|
|
70
|
+
- `scarb` installed ([installation guide](https://docs.swmansion.com/scarb/))
|
|
71
|
+
- `Scarb.toml` present in project root or package directories
|
|
72
|
+
|
|
73
|
+
## Monorepo Support
|
|
74
|
+
|
|
75
|
+
Ganchos detects `packages/` subdirectories and runs language tools from the appropriate project roots:
|
|
76
|
+
- Looks for `package.json`, `tsconfig.json`, `pyproject.toml`, `Scarb.toml` in package directories
|
|
77
|
+
- Falls back to root-level configuration when appropriate
|
|
78
|
+
|
|
79
|
+
## Contributing
|
|
80
|
+
|
|
81
|
+
Contributions are welcome! Feel free to open issues or submit pull requests.
|
|
82
|
+
|
|
83
|
+
## License
|
|
84
|
+
|
|
85
|
+
GPL-2.0
|