Prerequisites
Before you begin developing Utopia Fleet Builder, ensure you have the following installed:Node.js
Version 14.x or higher recommended
Grunt CLI
Task runner for build automation
Git
Version control system
Text Editor
VS Code, Sublime, or your preferred editor
Installation Steps
Install Grunt CLI
If you haven’t already, install Grunt globally:
You may need to use
sudo on macOS/Linux or run as Administrator on Windows.Install Dependencies
Install all project dependencies using npm:This installs:
- Grunt and all build plugins
- AngularJS dependencies
- Development tools (ESLint, etc.)
- Third-party libraries (jQuery PowerTip, etc.)
Build the Project
Generate the application files:This runs the default Grunt build task, which:
- Compiles and minifies JavaScript
- Processes Angular templates
- Minifies CSS stylesheets
- Generates game data JSON
- Copies assets to the build directory
Directory Structure
After installation, your project structure should look like this:Development Workflow
Available NPM Scripts
npm start
npm start
Runs the default Grunt build task. Equivalent to Use this for a one-time build of all assets.
npm run build.npm run build
npm run build
Explicitly runs the Grunt build process.
npm run watch
npm run watch
Watches source files for changes and automatically rebuilds:Watches:
- JavaScript files → triggers
build-js - CSS files → triggers
build-css - HTML templates → triggers
build-js - HTML index files → triggers
build-index - Data files → triggers
build-data - Gruntfile itself → reloads configuration
npm run dev
npm run dev
Combines build and watch for active development:
This runs
npm start followed by npm run watch.npm run serve
npm run serve
Builds the project and starts a local HTTP server:Opens the application at
http://localhost:8000npm run data
npm run data
Lints and regenerates only the game data:Runs:
npm run lint-data- ESLint fixes data filesnpm run generate-data- Compiles data.json
Typical Development Session
Start Local Server
In a second terminal, start the HTTP server:Open
http://localhost:8000 in your browser.Make Changes
Edit source files in
src/:- Modify JavaScript in
src/js/ - Update styles in
src/css/ - Change game data in
src/data/ - Edit templates in
src/templates/
Common Issues
Grunt command not found
Grunt command not found
Problem: Running
grunt or npm start fails with “command not found”.Solution: Install Grunt CLI globally:Permission denied errors
Permission denied errors
Problem: npm install fails with EACCES or permission errors.Solution: Either:
- Use
sudo npm install -g grunt-cli(not recommended) - Configure npm to use a different directory (recommended)
- Use a Node version manager like nvm
Outdated dependencies
Outdated dependencies
Problem: Security warnings or deprecated package warnings.Solution: Update dependencies:
Build outputs are not updating
Build outputs are not updating
Problem: Changes to source files don’t appear in the built application.Solution:
- Stop the watch task (Ctrl+C)
- Run a full rebuild:
npm start - Restart watch:
npm run watch - Hard refresh your browser
Next Steps
Once your environment is set up:Build Process
Learn about Grunt tasks and the build system
Data Structure
Understand how game data is organized
Contributing
Guidelines for contributing code
Game Data
Learn about ships, captains, and upgrades