A comprehensive build and compilation script for the Saito blockchain platform that handles CSS consolidation, JavaScript bundling, and system configuration.
The compile script is a Bash utility that manages the build process for Saito's lite client. It handles CSS compilation, module configuration, build numbering, and various reset operations for development and production environments.
npm run [mode] [options] #(./scripts/compile [MODE] [OPTIONS])
dev - Development Modenpm run compile dev #./scripts/compile dev
reset - Reset Non-Persistent Datanpm run reset #./scripts/compile reset
nuke - Complete Resetnpm run nuke #./scripts/compile nuke
recompile - JavaScript Onlynpm run compile #./scripts/compile recompile
config/build.json if missingconfig/options.conf (from template if missing)config/modules.config.js (from template if missing)dev)@import statementsstyle.css files for each modulemods/*/web/css/*.css → mods/*/web/style.cssgame-*.css files → web/saito/game.csssaito-*.css files → web/saito/saito.cssconfig/modules.config.jsreset)data/backup/*.sai, *.zip)nuke)memento.sq3assetstore.sq3registry.sq3league.sq3config/
├── build.json # Build number storage
├── options.conf # Runtime configuration
├── modules.config.js # Module definitions
├── .template.options.conf # Template configuration
└── .template.modules.config.js
mods/*/web/css/ # Module CSS files
web/saito/
├── game-*.css # Game-specific styles
├── saito-*.css # Core platform styles
└── css-imports/xclose.css # Shared components
web/saito/
├── saito.js # Compiled JavaScript bundle
├── game.css # Compiled game styles
└── saito.css # Compiled platform styles
mods/*/web/style.css # Per-module compiled styles
bundler/default/ # Production bundle directory
npm run compile dev #./scripts/compile dev
Use this for regular development work. Fast compilation with linked CSS for easy debugging.
npm run reset [dev] #./scripts/compile reset
Clean blockchain state but preserve user data. Good for testing features that need fresh chain state.
npm run nuke [dev] #./scripts/compile nuke
Use sparingly - completely wipes all data. Only for major testing or when you need to start completely fresh.
npm run compile #./scripts/compile recompile
Fastest option when you've only changed JavaScript/TypeScript code.
tsc) - For TypeScript compilationfind, sed, cat, cp, rmEdit config/modules.config.js to control which modules are included in lite client builds.
The script reads configuration from:
config/options.conf - Runtime optionsconfig/build.json - Build number trackingThe script automatically creates missing config files from templates. If you see template-related errors, ensure the template files exist in the config/ directory.
Check that all dependencies are installed:
npm install
Modify config/modules.config.js to control which modules are included in the lite client bundle.
Note: This script modifies files and databases. Always backup important data before running destructive operations like nuke.