Building and Running RemixWarp
This guide covers how to build RemixWarp from source code and run it locally for development, testing, or contribution purposes.
Prerequisites
Required Software
Node.js and npm
- Node.js: Version 16.x or higher
- npm: Version 7.x or higher (comes with Node.js)
- Check versions:
node --version # Should be v16.x.x or higher
npm --version # Should be 7.x.x or higher
Git
- Git: For cloning repositories
- Check version:
git --version # Any recent version
Optional Tools
- Yarn: Alternative package manager
- Docker: For containerized development
- Visual Studio Code: Recommended editor
System Requirements
- RAM: 4GB minimum, 8GB recommended
- Storage: 2GB free space for all repositories
- CPU: Modern multi-core processor recommended
- OS: Windows 10+, macOS 10.14+, or Linux
Repository Setup
Clone Repositories
RemixWarp consists of multiple repositories that work together:
# Create main directory
mkdir RemixWarp-dev
cd RemixWarp-dev
# Clone main repositories
git clone http://localhost:8601
git clone http://localhost:8601
git clone http://localhost:8601
# Optional: Clone additional repos
git clone http://localhost:8601
git clone http://localhost:8601
Repository Structure
RemixWarp-dev/
├── scratch-gui/ # Main interface
├── scratch-vm/ # Virtual machine
├── scratch-blocks/ # Block definitions
├── packager/ # Project packager
└── docs/ # Documentation
Building Components
Building scratch-vm (Virtual Machine)
cd scratch-vm
# Install dependencies
npm install
# Build for development
npm run build
# Build for production
npm run build:prod
# Watch mode (rebuilds on changes)
npm run watch
Building scratch-blocks (Block Definitions)
cd scratch-blocks
# Install dependencies
npm install
# Build vertical blocks
npm run build:vertical
# Build horizontal blocks
npm run build:horizontal
# Build both
npm run build
# Watch mode
npm run watch
Building scratch-gui (Main Interface)
cd scratch-gui
# Install dependencies
npm install
# Link local dependencies (if using local scratch-vm/scratch-blocks)
npm link ../scratch-vm
npm link ../scratch-blocks
# Build for development
npm run build
# Build for production
npm run build:prod
Development Workflow
Running Development Server
Start GUI Development Server
cd scratch-gui
# Start development server
npm start
# Custom port
npm start -- --port 8602
# Enable hot reloading
npm run start:hot
Access Development Environment
- URL: http://localhost:8601 (default)
- Hot Reload: Changes apply automatically
- Debug Mode: Browser developer tools available
Development Scripts
Common npm Scripts
# Install all dependencies
npm install
# Start development server
npm start
# Run tests
npm test
# Run tests in watch mode
npm run test:watch
# Lint code
npm run lint
# Fix linting issues
npm run lint:fix
# Build for production
npm run build
# Analyze bundle size
npm run analyze
Linking Local Dependencies
Using npm link
# In scratch-vm directory
npm link
# In scratch-gui directory
npm link scratch-vm
Using relative paths (package.json)
{
"dependencies": {
"scratch-vm": "file:../scratch-vm",
"scratch-blocks": "file:../scratch-blocks"
}
}
Building for Production
Production Build Process
Build All Components
# Build scratch-vm
cd scratch-vm
npm run build:prod
# Build scratch-blocks
cd ../scratch-blocks
npm run build
# Build scratch-gui
cd ../scratch-gui
npm run build:prod
Optimization Options
# Enable source maps
BUILD_MODE=production GENERATE_SOURCEMAP=true npm run build
# Disable source maps (smaller files)
GENERATE_SOURCEMAP=false npm run build
# Analyze bundle
npm run analyze
Static File Generation
Generate Static Files
# Build static files for hosting
npm run build
# Files generated in build/ directory
ls build/
# static/ # CSS, JS, and media files
# index.html # Main HTML file
# manifest.json # Web app manifest
Deployment Preparation
# Create deployment package
tar -czf RemixWarp-build.tar.gz -C build .
# Or zip file
cd build && zip -r ../RemixWarp-build.zip .
Testing
Running Tests
Unit Tests
# Run all tests
npm test
# Run specific test file
npm test -- --testNamePattern="sprite"
# Run tests in watch mode
npm run test:watch
# Generate coverage report
npm run test:coverage
Integration Tests
# Run integration tests
npm run test:integration
# Run specific integration test
npm run test:integration -- --grep "load project"
End-to-End Tests
# Install E2E dependencies
npm install -g cypress
# Run E2E tests
npm run test:e2e
# Open Cypress GUI
npm run cypress:open