-
Notifications
You must be signed in to change notification settings - Fork 0
/
justfile
79 lines (65 loc) · 2.19 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
#################################################
# Basic just configuration
#################################################
environment := env_var_or_default("ENVIRONMENT", "development")
secrets_path := "secrets/" + environment
dotenv_path := "secrets/.env"
set dotenv-load := true
set dotenv-path := "./secrets/.env"
mod app "src/app/.app.justfile"
mod auth "src/auth/.auth.justfile"
mod db "src/db/.db.justfile"
[private]
default: help
# Show this help text
[group("General")]
help: current_environment
@just --list --unsorted --justfile {{ justfile() }}
#################################################
# Code Utils
#################################################
# Reformat all source files
[group("Code Utils")]
format:
@bun prettier -w .
@just --fmt
@just --fmt --justfile src/app/.app.justfile
@just --fmt --justfile src/auth/.auth.justfile
@just --fmt --justfile src/db/.db.justfile
# Lint source files
[group("Code Utils")]
lint:
@bun tsc
@bun eslint .
#################################################
# Environment
#################################################
# CHange ENVironment
[group("Environment")]
chenv new_env:
@export \
ENVIRONMENT={{ quote(new_env) }} \
&& just genenv
# Generate a .env file based on secrets/{environment}. Set the `ENVIRONMENT` envvar to change environment.
[group("Environment")]
genenv:
@export \
DOTENV_PATH={{ quote(dotenv_path) }} \
SECRETS_PATH={{ quote(secrets_path) }} \
&& bun zx -- .tooling/env/generate_dotenv_file.ts
# Print the environment of the variables in the current .env file
[group("Environment")]
current_environment:
@export \
ENVIRONMENT={{ quote(environment) }} \
&& bun zx -- .tooling/env/log_current_env.ts
#################################################
# Internal utils
#################################################
# Configures bash completions for graphile-migrate and just. This will modify your '~/.bashrc'!
[private]
enable_bash_completions:
@bun graphile-migrate completion >> ~/.bashrc
@just --completions bash > ~/.just.sh
@echo 'source ~/.just.sh' >> ~/.bashrc
@echo "Please run 'source ~/.just.sh' in any active shells!"