Skip to content

Commit c3cc0f8

Browse files
dev: Add script for setting up local dev environment
1 parent 9fbc902 commit c3cc0f8

File tree

4 files changed

+23
-8
lines changed

4 files changed

+23
-8
lines changed

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
token: ${{ secrets.GITHUB_TOKEN }}
2222
version: latest
2323
# CLI arguments
24-
args: --check lua/ tests/
24+
args: make lint
2525
tests:
2626
strategy:
2727
fail-fast: false

CONTRIBUTING.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,14 @@ If you're reporting a `core` feature, please be sure to provide a link that desc
1515

1616
If you spot something missing in our [docs](DOCS.md), don't hesitate making a PR. The [wiki](https://github.com/nvim-orgmode/orgmode/wiki) can be edited freely.
1717

18+
## Local dev
19+
20+
Requirements:
21+
- [StyLua](https://github.com/JohnnyMorganz/StyLua) - For formatting
22+
23+
To set up local development, run `make setup_dev`. This will add a pre-commit hook that will auto format all files before committing them.
24+
You can always manually format all files with `make format` command
25+
1826
## Code
1927

2028
You can take a look at our [feature completeness](https://github.com/nvim-orgmode/orgmode/wiki/Feature-Completeness) list and see if any of the missing features catch your interest.
@@ -36,13 +44,6 @@ spec you want to test. Example:
3644
make test FILE=./tests/plenary/api/api_spec.lua
3745
```
3846

39-
### Formatting
40-
41-
Formatting is done via [StyLua](https://github.com/JohnnyMorganz/StyLua). To format everything run:
42-
```
43-
make format
44-
```
45-
4647
### Parser
4748

4849
Parsing is done via builtin treesitter parser and the [tree-sitter-org](https://github.com/milisims/tree-sitter-org) grammar.

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,9 @@ docs:
66
md2vim -desc "*orgmode* *orgmode.nvim*\n* NOTE: This file is autogenerated from DOCS.md file" DOCS.md doc/orgmode.txt
77
api_docs:
88
nvim --headless --clean -u ./scripts/gendoc.lua
9+
setup_dev:
10+
cp ./scripts/pre-commit-hook.sh ./.git/hooks/pre-commit && chmod +x ./.git/hooks/pre-commit
11+
lint:
12+
stylua --check lua/ tests/
913
format:
1014
stylua lua/ tests/

scripts/pre-commit-hook.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
3+
# Run `make format` to format files
4+
make format
5+
6+
# Add only modified files to the staging area
7+
git diff --cached --name-only --diff-filter=ACMRTUXB | xargs git add
8+
9+
# Continue with the commit
10+
exit 0

0 commit comments

Comments
 (0)