-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Patrizio Bekerle <patrizio@bekerle.com>
- Loading branch information
Showing
4 changed files
with
136 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
use nix |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
# Use `just <recipe>` to run a recipe | ||
# https://just.systems/man/en/ | ||
|
||
# By default, run the `--list` command | ||
default: | ||
@just --list | ||
|
||
# Variables | ||
|
||
zellijSession := "esign-app" | ||
|
||
# Open a terminal with the cabinet-app session | ||
[group('dev')] | ||
term-run: | ||
zellij --layout term.kdl attach {{ zellijSession }} -c | ||
|
||
# Kill the cabinet-app session | ||
[group('dev')] | ||
term-kill: | ||
-zellij delete-session {{ zellijSession }} -f | ||
|
||
# Kill and run a terminal with the cabinet-app session | ||
[group('dev')] | ||
term: term-kill term-run | ||
|
||
# Open a browser with the application | ||
[group('dev')] | ||
open-browser: | ||
xdg-open https://localhost:8001 | ||
|
||
# Interactive npm watch script selector | ||
[group('dev')] | ||
watch: | ||
#!/usr/bin/env bash | ||
set -euo pipefail | ||
# Define the watch scripts with descriptions | ||
watch_scripts=( | ||
"watch: Whitelabel app" | ||
"watch-custom: TU Graz app" | ||
) | ||
|
||
# Use fzf to select a script | ||
selected_script=$(printf '%s\n' "${watch_scripts[@]}" | fzf \ | ||
--height 40% \ | ||
--layout=reverse \ | ||
--border \ | ||
--prompt='Select NPM watch script > ' \ | ||
--preview='echo "Will run: npm run $(echo {} | cut -d: -f1)"' \ | ||
--preview-window=up:1 \ | ||
| cut -d: -f1) | ||
|
||
# Check if a script was selected | ||
if [[ -n "$selected_script" ]]; then | ||
# Get the full line for the selected script | ||
full_text=$(printf '%s\n' "${watch_scripts[@]}" | grep "^$selected_script:") | ||
|
||
# Set Zellij pane name | ||
if command -v zellij &> /dev/null; then | ||
zellij action rename-pane "$full_text" | ||
fi | ||
|
||
echo "Running: npm run $selected_script" | ||
npm run "$selected_script" | ||
else | ||
echo "No script selected. Exiting." | ||
exit 1 | ||
fi | ||
|
||
# Format all justfiles | ||
[group('linter')] | ||
just-format: | ||
#!/usr/bin/env bash | ||
# Find all files named "justfile" recursively and run just --fmt --unstable on them | ||
find . -type f -name "justfile" -print0 | while IFS= read -r -d '' file; do | ||
echo "Formatting $file" | ||
just --fmt --unstable -f "$file" | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ pkgs ? import <nixpkgs> {} }: | ||
pkgs.mkShell { | ||
# nativeBuildInputs is usually what you want -- tools you need to run | ||
nativeBuildInputs = with pkgs; [ | ||
nodejs_20 | ||
curl | ||
zellij # smart terminal workspace | ||
lazygit # git terminal | ||
just # task runner | ||
fzf # fuzzy finder, for "just watch" | ||
]; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// https://zellij.dev/documentation/creating-a-layout | ||
layout { | ||
tab name="main" focus=true { | ||
pane size=1 borderless=true { | ||
plugin location="zellij:tab-bar" | ||
} | ||
pane size="60%" { | ||
command "lazygit" | ||
focus true | ||
} | ||
pane split_direction="vertical" size="40%" { | ||
pane { | ||
command "just" | ||
args "watch" | ||
} | ||
pane { | ||
command "npm" | ||
args "install" | ||
} | ||
} | ||
// pane split_direction="vertical" { | ||
// pane { | ||
// command "docker" | ||
// args "compose" "up" | ||
// cwd "./docker" | ||
// } | ||
// pane { | ||
// cwd "./docker" | ||
// } | ||
// } | ||
pane size=1 borderless=true { | ||
plugin location="zellij:status-bar" | ||
} | ||
} | ||
tab name="term" { | ||
pane size=1 borderless=true { | ||
plugin location="zellij:tab-bar" | ||
} | ||
pane | ||
pane size=1 borderless=true { | ||
plugin location="zellij:status-bar" | ||
} | ||
} | ||
} |