Skip to main content
Custom diagrams are developed in separate GitHub repositories, compiled locally, and then uploaded to the Calcs.com template builder. This workflow allows for sophisticated diagram development using modern web technologies.

Overview

The workflow involves:
  1. Development: Code diagrams in TypeScript/JavaScript
  2. Compilation: Build diagrams into deployable assets
  3. Upload: Deploy compiled files to template builder
  4. Integration: Use diagrams in Calcs.com templates

System Requirements

Prerequisites (macOS):
  • Homebrew package manager
  • Node.js and npm
  • Git
  • Code editor (VS Code recommended)
For Windows users, the process may differ slightly.

First Time Setup

1. Install Development Tools

2. Clone Repository

3. Navigate to Diagram Folder

4. Install Dependencies

You must run npm install in each diagram folder if the repository contains multiple diagrams.

Regular Development Workflow

1. Update Repository

2. Install Dependencies (if needed)

3. Compile Diagram

4. Locate Output Files

After compilation, you’ll find the built files:
For Static Diagrams:
  • Location: /dist/compiled.js
  • File type: JavaScript module
  • Usage: Upload to template builder
For Interactive Diagrams:
  • Location: output/index.html
  • File type: HTML with embedded JavaScript
  • Usage: Upload to template builder
If Both Types:
  • Both files may need to be uploaded if modifications were made to each

5. Upload to Template Builder

Repository Structure Examples

Single Diagram Repository

Multi-Diagram Repository

Development Best Practices

Version Control

Testing Workflow

  1. Local Testing: Use npm test during development
  2. Integration Testing: Upload to development template
  3. User Testing: Test with real calculation scenarios
  4. Production Deployment: Upload to live templates

Dependency Management

Troubleshooting

Common Issues

Issue: npm run-script compile failsSolutions:
  1. Ensure npm install was run successfully
  2. Check for TypeScript/JavaScript syntax errors
  3. Verify all required dependencies are installed
  4. Check Node.js version compatibility
Issue: Compiled file doesn’t work in template builderSolutions:
  1. Verify correct file was uploaded (compiled.js or index.html)
  2. Check file size limits
  3. Ensure diagram parameters match template expectations
  4. Test with minimal parameter set first

Debug Mode

Video Tutorial

For a complete visual walkthrough of this workflow:
📹 Watch the complete tutorial: GitHub to Calcs Builder WorkflowThis video covers the entire process from repository setup to template deployment.

Next Steps

After successfully compiling and uploading your diagram:
  1. Test Integration: Verify the diagram works in a test template
  2. Parameter Validation: Ensure all parameters are handled correctly
  3. Documentation: Update template documentation
  4. User Testing: Get feedback from intended users
  5. Production Deployment: Release to live templates
Keep a local development environment set up for quick iterations. The compilation and upload process becomes much faster with practice.
Always test compiled diagrams thoroughly before uploading to production templates. Diagram errors can break template functionality for end users.