-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdev.just
More file actions
96 lines (80 loc) · 2.89 KB
/
dev.just
File metadata and controls
96 lines (80 loc) · 2.89 KB
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
# Copyright 2025 - 2025, identinet GmbH. All rights reserved.
# SPDX-License-Identifier: MIT
#
# These recipes are ment to be sourced by a Justfile in the root of a monorepository to quickly start application
# development.
SERVICES_DIRECTORY := "services"
SERVICES_IGNORE_FILE := ".noservice"
# Execute command in application
[group('development')]
_app_command APP *CMD:
#!/usr/bin/env nu
use std/log
let service = ["{{ SERVICES_DIRECTORY }}" "{{ APP }}" ] | path join
if not ($service | path exists) or ([$service "{{ SERVICES_IGNORE_FILE }}"] | path join | path exists) {
log error $"Service doesn't exist: ($service)"
exit 1
}
log info $"Starting service: ($service)"
cd $service
load-env (direnv export json | from json) # load environment variables
nix develop --command {{ CMD }}
# Start application
[group('development')]
dev APP:
just _app_command "{{ APP }}" just dev
alias d := dev
# Start all applications
[group('development')]
dev-all:
#!/usr/bin/env nu
ls "{{ SERVICES_DIRECTORY }}" | where type == "dir" | get name |
where (not ([$it "{{ SERVICES_IGNORE_FILE }}"] | path join | path exists)) |
str replace "{{ SERVICES_DIRECTORY }}/" "" | par-each {
# Workaround if services access git or other services that use locks
sleep ($"(random int 50..300)ms" | into duration)
just dev $in
}
alias da := dev-all
# List applications
[group('development')]
list:
#!/usr/bin/env nu
ls "{{ SERVICES_DIRECTORY }}" | where type == "dir" | get name |
where (not ([$it "{{ SERVICES_IGNORE_FILE }}"] | path join | path exists)) |
str replace "{{ SERVICES_DIRECTORY }}/" "" | wrap service
alias ls := list
# Lint application's code
[group('lint')]
lint APP:
just _app_command "{{ APP }}" just lint
alias l := lint
# Lint application's code and fix issues
[group('lint')]
lint-fix APP:
just _app_command "{{ APP }}" just lint-fix
alias lf := lint-fix
# Lint all applications
[group('lint')]
lint-all:
#!/usr/bin/env nu
ls "{{ SERVICES_DIRECTORY }}" | where type == "dir" | get name |
where (not ([$it "{{ SERVICES_IGNORE_FILE }}"] | path join | path exists)) |
str replace "{{ SERVICES_DIRECTORY }}/" "" | par-each {
# Workaround if services access git or other services that use locks
sleep ($"(random int 50..300)ms" | into duration)
just lint $in
}
alias la := lint-all
# Lint all applications and fix issues
[group('lint')]
lint-fix-all:
#!/usr/bin/env nu
ls "{{ SERVICES_DIRECTORY }}" | where type == "dir" | get name |
where (not ([$it "{{ SERVICES_IGNORE_FILE }}"] | path join | path exists)) |
str replace "{{ SERVICES_DIRECTORY }}/" "" | par-each {
# Workaround if services access git or other services that use locks
sleep ($"(random int 50..300)ms" | into duration)
just lint $in
}
alias lfa := lint-fix-all