-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjustfile
More file actions
146 lines (117 loc) · 3.21 KB
/
justfile
File metadata and controls
146 lines (117 loc) · 3.21 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
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
142
143
144
145
146
# List all available commands
default:
just --list
# Install dependencies
install:
npm install
# Run the development server
dev:
npm run dev
# Build the project for production
build:
npm run build
# Start the production server
start:
npm run start
# Run ESLint to check for issues
lint:
npm run lint
# Run ESLint with auto-fix
lint-fix:
npm run lint -- --fix
# Type check the project
typecheck:
npx tsc --noEmit
# Clean the build artifacts
clean:
rm -rf .next node_modules
# Run all the checks (lint + typecheck)
check:
just lint
just typecheck
# Run all commands in the local environment
all:
just check
just build
# Setup development environment
setup:
cp -n .env.example .env || true
just install
# Build Docker image locally
docker-build tag="latest":
docker build -t stackclass-frontend:{{ tag }} .
# Run Docker container locally
docker-run tag="latest" port="3000":
docker run -p {{ port }}:3000 --env-file .env stackclass-frontend:{{ tag }}
# Bump version in package.json (interactive)
bump-version:
#!/usr/bin/env bash
set -euo pipefail
# Show current version
current_version=$(node -p "require('./package.json').version")
echo "Current version: $current_version"
# Prompt for new version
read -p "New version: " new_version
# Validate version format
if ! [[ "$new_version" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Error: Version must be in format X.Y.Z (e.g., 1.0.0)"
exit 1
fi
echo ""
# Update package.json
npm version "$new_version" --no-git-tag-version
echo "Updated package.json"
# Run full validation
echo ""
echo "Running validation..."
just all
echo ""
echo "Version bump to $new_version completed! Run 'just release' to commit and push."
# Release current version (commit, tag, push)
release:
#!/usr/bin/env bash
set -euo pipefail
# Helper function for confirmation
confirm() {
read -p "$1 [y/N] " response
case "$response" in
[yY][eE][sS]|[yY]) return 0 ;;
*) return 1 ;;
esac
}
# Get current version from package.json
version=$(node -p "require('./package.json').version")
echo "=== Release v$version ==="
echo ""
# Step 1: Git add and commit
echo "=== [1/3] Git add and commit ==="
echo "Changes to be committed:"
git status --short
echo ""
if confirm "Run 'git add -A && git commit -m \"chore: bump version to $version\"'?"; then
git add -A
git commit -m "chore: bump version to $version"
echo ""
else
echo "Aborted at step 1/3."
exit 0
fi
# Step 2: Git tag
echo "=== [2/3] Git tag ==="
if confirm "Run 'git tag -m \"v$version\" v$version'?"; then
git tag -m "v$version" "v$version"
echo ""
else
echo "Aborted at step 2/3."
exit 0
fi
# Step 3: Push branch and tag
echo "=== [3/3] Push branch and tag ==="
if confirm "Run 'git push origin main v$version'?"; then
git push origin main "v$version"
echo ""
else
echo "Aborted at step 3/3."
exit 0
fi
echo "=== Release v$version completed successfully! ==="