clqms-fe1/.serena/memories/suggested_commands.md

220 lines
3.6 KiB
Markdown
Raw Normal View History

# CLQMS Frontend - Suggested Commands
## Development Commands
```bash
# Start development server
pnpm run dev
# Start development server and open in browser
pnpm run dev -- --open
# Production build
pnpm run build
# Preview production build
pnpm run preview
# Sync SvelteKit (runs automatically on install)
pnpm run prepare
```
## Package Manager
- **Primary**: `pnpm` (preferred)
- Can also use `npm` or `yarn` if needed
## Development Server
- Dev server runs by default on `http://localhost:5173`
- API requests to `/api` are proxied to `http://localhost:8000`
- Hot module replacement (HMR) enabled
## Windows System Commands
Since the system is Windows, use these commands:
```bash
# List files
dir
# Change directory
cd path\to\directory
# Search for files
dir /s filename
# Search for text in files
findstr /s /i "searchterm" *.js
# Delete files
del filename
# Delete directories
rmdir /s /q directoryname
# Copy files
copy source destination
# Move files
move source destination
# Create directory
mkdir directoryname
# Display file content
type filename
# Edit files (use VS Code or other editor)
code filename
```
## Git Commands
```bash
# Check git status
git status
# View changes
git diff
# Stage changes
git add .
# Commit changes
git commit -m "commit message"
# Push to remote
git push
# Pull from remote
git pull
# Create new branch
git branch branch-name
# Switch branch
git checkout branch-name
# View commit history
git log --oneline
```
## Testing Commands (when configured)
```bash
# Run all tests (Vitest - when configured)
pnpm test
# Run tests in watch mode
pnpm test -- --watch
# Run single test file
pnpm test src/path/to/test.js
# Run E2E tests (Playwright - when configured)
pnpm run test:e2e
# Run E2E tests in headless mode
pnpm run test:e2e -- --headed=false
```
## Linting and Formatting (when configured)
```bash
# Run ESLint (when configured)
pnpm run lint
# Auto-fix lint issues
pnpm run lint -- --fix
# Format code with Prettier (when configured)
pnpm run format
```
## Environment Setup
```bash
# Install dependencies
pnpm install
# Create .env file for environment variables
echo "VITE_API_URL=http://localhost:8000" > .env
# Install dependencies (if package-lock.json exists)
npm install
```
## Useful pnpm Commands
```bash
# Add a dependency
pnpm add package-name
# Add a dev dependency
pnpm add -D package-name
# Update dependencies
pnpm update
# Remove a dependency
pnpm remove package-name
# List installed packages
pnpm list --depth 0
# Check for outdated packages
pnpm outdated
```
## Build and Deploy
```bash
# Build for production
pnpm run build
# Preview production build locally
pnpm run preview
# Clean build artifacts (if clean script exists)
pnpm run clean
```
## SvelteKit Specific Commands
```bash
# Sync SvelteKit type definitions
pnpm run prepare
# Check SvelteKit configuration
pnpm run check
# Generate types (if using TypeScript)
pnpm run check:types
```
## Common Troubleshooting
```bash
# Clear pnpm cache
pnpm store prune
# Reinstall all dependencies
rm -rf node_modules pnpm-lock.yaml && pnpm install
# Clear Vite cache
rm -rf .vite
# Check Node.js version
node --version
# Check pnpm version
pnpm --version
```
## Development Workflow
1. Start dev server: `pnpm run dev`
2. Open browser to `http://localhost:5173`
3. Make changes to files
4. See HMR updates in browser
5. Test changes
6. Commit changes when ready
## API Testing
```bash
# Test API endpoints via curl (in Git Bash or WSL)
curl -X GET http://localhost:8000/api/valueset
# Test with authentication (requires JWT token)
curl -X GET http://localhost:8000/api/patient -H "Authorization: Bearer YOUR_TOKEN"
```