Skip to content

Commit 7d64333

Browse files
chore: prepare for npm publish
1 parent ab8fb26 commit 7d64333

3 files changed

Lines changed: 142 additions & 2 deletions

File tree

CONTRIBUTING.md

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
# Contributing to loq
2+
3+
Thanks for your interest in contributing!
4+
5+
## Getting Started
6+
7+
```bash
8+
# Clone the repo
9+
git clone https://github.com/code-with-auto/loq.git
10+
cd loq
11+
12+
# Install dependencies
13+
bun install
14+
15+
# Run tests
16+
bun test
17+
18+
# Run in dev mode
19+
bun run dev
20+
```
21+
22+
## Development Workflow
23+
24+
1. Fork the repo
25+
2. Create a feature branch: `git checkout -b feat/my-feature`
26+
3. Make your changes
27+
4. Run tests: `bun test`
28+
5. Run type check: `bun run typecheck`
29+
6. Commit with conventional commits
30+
7. Push and open a PR
31+
32+
## Commit Messages
33+
34+
Use conventional commits:
35+
36+
```
37+
feat: add support for Docker log format
38+
fix: handle missing timestamp in syslog
39+
docs: update README with new examples
40+
test: add coverage for edge cases
41+
refactor: simplify query executor
42+
chore: update dependencies
43+
ci: fix GitHub Actions workflow
44+
```
45+
46+
## Adding a New Parser
47+
48+
See the [Custom Formats Guide](https://code-with-auto.github.io/loq/guide/custom-formats.html#contributing-built-in-parsers) for detailed instructions.
49+
50+
Quick overview:
51+
52+
1. Create `src/parser/formats/myformat.ts`
53+
2. Implement `LogParser` interface
54+
3. Register in `src/parser/auto-detect.ts`
55+
4. Add tests in `tests/parser/myformat.test.ts`
56+
5. Submit PR
57+
58+
## Project Structure
59+
60+
```
61+
loq/
62+
├── src/
63+
│ ├── index.ts # CLI entry point
64+
│ ├── cli/args.ts # Argument parsing
65+
│ ├── config/loader.ts # Config file loading
66+
│ ├── parser/
67+
│ │ ├── types.ts # Core types
68+
│ │ ├── auto-detect.ts # Format detection
69+
│ │ └── formats/ # Built-in parsers
70+
│ ├── query/
71+
│ │ ├── lexer.ts # Tokenizer
72+
│ │ ├── parser.ts # Query parser
73+
│ │ ├── ast.ts # AST types
74+
│ │ └── executor.ts # Query execution
75+
│ ├── output/
76+
│ │ ├── formatter.ts # Output formatting
77+
│ │ └── colors.ts # Terminal colors
78+
│ └── utils/time.ts # Time utilities
79+
├── tests/ # Test files
80+
└── docs/ # VitePress docs
81+
```
82+
83+
## Code Style
84+
85+
- TypeScript with strict mode
86+
- No semicolons (Bun default)
87+
- 2 space indentation
88+
- Prefer `const` over `let`
89+
- Use descriptive variable names
90+
91+
## Running Tests
92+
93+
```bash
94+
# Run all tests
95+
bun test
96+
97+
# Run specific test file
98+
bun test tests/parser/json.test.ts
99+
100+
# Run with coverage
101+
bun test --coverage
102+
103+
# Watch mode
104+
bun test --watch
105+
```
106+
107+
## Questions?
108+
109+
Open an issue or start a discussion on GitHub.

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 code-with-auto
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

package.json

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,15 @@
44
"description": "Fast, friendly CLI log analyzer - jq for logs",
55
"module": "src/index.ts",
66
"type": "module",
7+
"main": "src/index.ts",
78
"bin": {
89
"loq": "./src/index.ts"
910
},
11+
"files": [
12+
"src",
13+
"README.md",
14+
"LICENSE"
15+
],
1016
"scripts": {
1117
"start": "bun run src/index.ts",
1218
"dev": "bun --watch src/index.ts",
@@ -39,6 +45,10 @@
3945
"syslog",
4046
"parser"
4147
],
42-
"author": "",
43-
"license": "MIT"
48+
"author": "code-with-auto",
49+
"license": "MIT",
50+
"homepage": "https://code-with-auto.github.io/loq/",
51+
"bugs": {
52+
"url": "https://github.com/code-with-auto/loq/issues"
53+
}
4454
}

0 commit comments

Comments
 (0)