-
Notifications
You must be signed in to change notification settings - Fork 100
/
Copy pathjustfile
141 lines (115 loc) · 3.39 KB
/
justfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
_default:
just --list -u
alias f := format
alias r := ready
alias l := lint
alias t := test
alias rg := reset-git
# Installs the tools needed to develop
install-tools:
cargo install cargo-binstall
cargo binstall cargo-insta taplo-cli sqlx-cli
cargo binstall --git "https://github.com/astral-sh/uv" uv
bun install
# Upgrades the tools needed to develop
upgrade-tools:
cargo install cargo-binstall --force
cargo binstall cargo-insta taplo-cli sqlx-cli --force
cargo binstall --git "https://github.com/astral-sh/uv" uv --force
# Generates code generated files for the linter
gen-lint:
cargo run -p xtask_codegen -- analyser
cargo run -p xtask_codegen -- configuration
cargo run -p xtask_codegen -- bindings
cargo run -p rules_check
cargo run -p docs_codegen
just format
# Creates a new lint rule in the given path, with the given name. Name has to be camel case. Group should be lowercase.
new-lintrule group rulename:
cargo run -p xtask_codegen -- new-lintrule --category=lint --name={{rulename}} --group={{group}}
just gen-lint
# Format Rust, JS and TOML files
format:
cargo fmt
taplo format
bun biome format --write
format-ci:
cargo fmt --all --check
taplo format --check
bun biome format
format-ci-versions:
cargo --version
taplo --version
echo "Biome $(bun biome --version)"
[unix]
_touch file:
touch {{file}}
[windows]
_touch file:
(gci {{file}}).LastWriteTime = Get-Date
# Run tests of all crates
test:
cargo test run --no-fail-fast
# Run tests for the crate passed as argument e.g. just test-create pg_cli
test-crate name:
cargo test run -p {{name}} --no-fail-fast
# Run doc tests
test-doc:
cargo test --doc
# Alias for `cargo clippy`, it runs clippy on the whole codebase
lint:
cargo clippy
cargo run -p rules_check
bun biome lint
lint-fix:
cargo clippy --fix
cargo run -p rules_check
bun biome lint --write
lint-ci-versions:
rustc --version
rustup --version
cargo --version
cargo sqlx --version
cargo clippy --version
echo "Biome $(bun biome --version)"
lint-ci:
cargo sqlx prepare --check --workspace
cargo clippy --fix
cargo run -p rules_check
bun biome lint --write
serve-docs:
uv sync
uv run mkdocs serve
# When you finished coding, run this command. Note that you should have already committed your changes.
# If you haven't run `sqlx prepare` at least once, you need to run `docker compose up`
# to lint the queries.
ready:
git diff --exit-code --quiet
cargo run -p xtask_codegen -- configuration
cargo run -p docs_codegen
cargo run -p xtask_codegen -- bindings
just lint-fix
just format
git diff --exit-code --quiet
# Creates a new crate
new-crate name:
cargo new --lib crates/{{snakecase(name)}}
cargo run -p xtask_codegen -- new-crate --name={{snakecase(name)}}
# Prints the treesitter tree of the given SQL file
tree-print file:
cargo run --bin tree_print -- -f {{file}}
clear-branches:
git branch --merged | egrep -v "(^\\*|main)" | xargs git branch -d
reset-git:
git checkout main
git pull
just clear-branches
merge-main:
git fetch origin main:main
git merge main
# Make sure to set your PGT_LOG_PATH in your shell profile.
# You can use the PGT_LOG_LEVEL to set your log level.
# We recommend to install `bunyan` (npm i -g bunyan) and pipe the output through there for color-coding:
# just show-logs | bunyan
show-logs:
tail -f $(ls $PGT_LOG_PATH/server.log.* | sort -t- -k2,2 -k3,3 -k4,4 | tail -n 1)