Skip to content

Commit 656050f

Browse files
committed
chore: justfile
1 parent a2acc79 commit 656050f

File tree

5 files changed

+94
-14
lines changed

5 files changed

+94
-14
lines changed

README.md

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,35 @@ https://github.com/sponsors/mhanberg
3737

3838
## Development
3939

40+
Next LS uses [just](https://github.com/casey/just) to coordinate command tasks.
41+
4042
```bash
43+
# list all tasks
44+
just --list
45+
# show a fzf finder of all tasks
46+
just choose
47+
48+
# default task, runs `deps compile build-local
49+
just
50+
4151
# install deps
42-
mix deps.get
52+
just deps
53+
54+
# install compile
55+
just compile
4356

4457
# start the local server for development in TCP mode
4558
# see editor extension docs for information on how to connect to a server in TCP mode
46-
bin/start --port 9000
59+
just start
4760

4861
# run the tests
49-
mix test
62+
just test
63+
64+
# build a local burrito'd exe
65+
just build-local
66+
67+
# build burrito'd exes for all platforms
68+
just build-all
5069
```
5170

5271
## Production release
@@ -59,18 +78,18 @@ Executables are output to `./burrito_out`.
5978

6079
```bash
6180
# produces executables for all the targets specified in the `mix.exs` file
62-
NEXTLS_RELEASE_MODE="burrito" MIX_ENV=prod mix release
81+
just build-all
6382

6483
# produce an executable for a single target
65-
BURRITO_TARGET=linux_amd64 MIX_ENV=prod mix release
84+
just build-local
6685
```
6786

6887
### Traditional
6988

7089
You can also build Next LS as a traditional Mix release.
7190

7291
```bash
73-
MIX_ENV=prod mix release plain
92+
just build-plain
7493
```
7594

7695
## Contributing

config/config.exs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,12 @@ import Config
22

33
config :next_ls, :indexing_timeout, 100
44

5+
case System.get_env("NEXTLS_RELEASE_MODE", "plain") do
6+
"burrito" ->
7+
config :next_ls, arg_parser: {Burrito.Util.Args, :get_arguments, []}
8+
9+
"plain" ->
10+
config :next_ls, arg_parser: {System, :argv, []}
11+
end
12+
513
import_config "#{config_env()}.exs"

config/runtime.exs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,5 @@
11
import Config
22

3-
case System.get_env("NEXTLS_RELEASE_MODE", "plain") do
4-
"burrito" ->
5-
config :next_ls, arg_parser: {Burrito.Util.Args, :get_arguments, []}
6-
7-
"plain" ->
8-
config :next_ls, arg_parser: {System, :argv, []}
9-
end
10-
113
if System.get_env("NEXTLS_OTEL") == "1" do
124
config :next_ls,
135
otel: true

flake.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@
111111
elixir
112112
aliased_7zz
113113
pkgs.autoconf
114+
pkgs.just
114115
pkgs.automake
115116
pkgs.ncurses5
116117
pkgs.openssl

justfile

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
default: deps compile build-local
2+
3+
choose:
4+
just --choose
5+
6+
deps:
7+
mix deps.get
8+
9+
compile:
10+
mix compile
11+
12+
start:
13+
bin/start --port 9000
14+
15+
test:
16+
mix test
17+
18+
format:
19+
mix format
20+
21+
lint:
22+
#!/usr/bin/env bash
23+
set -euxo pipefail
24+
25+
mix format --check-formatted
26+
mix credo
27+
mix dialyzer
28+
29+
[unix]
30+
build-local:
31+
#!/usr/bin/env bash
32+
case "{{os()}}-{{arch()}}" in
33+
"linux-arm" | "linux-aarch64")
34+
target=linux_arm64;;
35+
"linux-x86" | "linux-x86_64")
36+
target=linux_amd64;;
37+
"macos-arm" | "macos-aarch64")
38+
target=darwin_arm64;;
39+
"macos-x86" | "macos-x86_64")
40+
target=darwin_amd64;;
41+
*)
42+
echo "unsupported OS/Arch combination"
43+
exit 1;;
44+
esac
45+
46+
NEXTLS_RELEASE_MODE=burrito BURRITO_TARGET="$target" MIX_ENV=prod mix release
47+
48+
[windows]
49+
build-local:
50+
# idk actually how to set env vars like this on windows, might crash
51+
NEXTLS_RELEASE_MODE=burrito BURRITO_TARGET="windows_amd64" MIX_ENV=prod mix release
52+
53+
build-all:
54+
NEXTLS_RELEASE_MODE=burrito MIX_ENV=prod mix release
55+
56+
build-plain:
57+
MIX_ENV=prod mix release plain
58+
59+
bump-spitfire:
60+
mix deps.update spitfire

0 commit comments

Comments
 (0)