Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ jobs:
with:
node-version: 22

- run: npm install
- run: npm run lint
- name: Install just
uses: extractions/setup-just@v3

- run: cp .env.example .env
- run: npm run build --if-present
- run: just setup
- run: just all
59 changes: 37 additions & 22 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,61 +29,76 @@ and provide as much detail as possible, including:
cd frontend
```

3. **Create a Branch**: Create a new branch for your changes.
3. **Install Prerequisites**: Make sure you have [just](https://github.com/casey/just) installed.

4. **Setup Development Environment**:

```bash
just setup # Copies .env.example to .env and installs dependencies
```

5. **Create a Branch**: Create a new branch for your changes.

```bash
git checkout -b your-branch-name
```

4. **Make Changes**: Make your changes locally.
6. **Make Changes**: Make your changes locally.

5. **Run Tests**: Ensure all tests pass before submitting your changes.
7. **Run Checks**: Ensure all checks pass before submitting your changes.

```bash
npm run test
just all # Runs lint, typecheck, and build
```

6. **Commit Changes**: Commit your changes with a clear commit message.
8. **Commit Changes**: Commit your changes with a clear commit message.

```bash
git add .
git commit -m "Describe your changes"
```

7. **Push Changes**: Push your changes to GitHub.
9. **Push Changes**: Push your changes to GitHub.

```bash
git push origin your-branch-name
```

8. **Create a Pull Request**: Create a Pull Request on GitHub and describe your changes.
10. **Create a Pull Request**: Create a Pull Request on GitHub and describe your changes.
Make sure your PR includes the following:

- The purpose of the changes
- Related issue number (if applicable)
- Any other relevant context
- The purpose of the changes
- Related issue number (if applicable)
- Any other relevant context

### Code Style

Please follow the project's code style guidelines. Here are some general
recommendations for Next.js projects:
Please follow the project's code style guidelines:

- Use `ESLint` for static code analysis and `Prettier` for code formatting.
- Run the following commands to ensure your code adheres to the style
guidelines:
- Use `ESLint` for static code analysis
- Run the following commands to ensure your code adheres to the style guidelines:

```bash
npm run lint # Runs ESLint to check for issues
npm run format # Runs Prettier to format your code
just lint # Runs ESLint to check for issues
just lint-fix # Runs ESLint with auto-fix
just typecheck # Runs TypeScript type checking
```

### Testing
### Available Commands

Ensure your changes include appropriate tests and that all tests pass.
Run the following command to execute tests:
Run `just` to see all available commands:

```bash
npm run test
just # List all commands
just setup # Setup development environment
just dev # Run development server
just build # Build for production
just lint # Run ESLint
just lint-fix # Run ESLint with auto-fix
just typecheck # Type check the project
just check # Run all checks (lint + typecheck)
just all # Run all checks and build
just clean # Clean build artifacts
```

### Documentation
Expand All @@ -98,4 +113,4 @@ will be licensed under the project's [LICENSE](LICENSE).

---

Thank you for contributing! 🎉
Thank you for contributing!
46 changes: 38 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,52 @@ A modern frontend for StackClass built with Next.js.
- **Vercel Deployment**: Easy deployment on Vercel.
- **Responsive Design**: Works on all devices.

## Prerequisites

- [Node.js](https://nodejs.org/) 22 or later
- [just](https://github.com/casey/just) command runner (recommended)

## Getting Started

First, run the development server:
This project uses [just](https://github.com/casey/just) as a command runner. To see all available commands:

```bash
just
```

### Setup

```bash
just setup # Copies .env.example to .env and installs dependencies
```

### Development

```bash
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev
just dev # Run the development server
```

Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.

### Other Commands

```bash
just build # Build for production
just lint # Run ESLint
just typecheck # Run TypeScript type checking
just check # Run all checks (lint + typecheck)
just all # Run all checks and build
just clean # Clean build artifacts
```

### Docker

```bash
just docker-build # Build Docker image
just docker-run # Run Docker container
just docker-build v1.0.0 # Build with specific tag
```

## Contributing

If anything feels off, or if you feel that some functionality is missing, please
Expand Down
146 changes: 146 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,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! ==="