-
Fork the repository
-
Create a feature branch
git checkout -b feature/your-feature-name
-
Make your changes
-
Commit your changes
git commit -m "Add: your feature description" -
Push to your fork
git push origin feature/your-feature-name
-
Create a Pull Request
This project includes automated CI/CD pipelines using GitHub Actions that handle both package publishing and GitHub Pages deployment when changes are pushed to the main branch.
When you push changes to the main branch, two workflows run automatically:
- Builds the project - Runs
npm run buildto compile TypeScript and generate distribution files - Publishes to NPM - Publishes to the public NPM registry for global installation
- Publishes to GitHub Packages - Also publishes to GitHub's package registry
- Builds demo - Runs
npm run build:demoto build the demo - Deploys to GitHub Pages - Makes the demo available at
https://mostage.app/demo
To release a new version:
# 1. Update version in package.json manually
npm version patch # or minor, major
# 2. Build and commit changes
git push
git push --tags
# 3. Push to main branch (triggers automatic deployment)
git push origin mainBefore the first release, you need to configure:
-
NPM Token:
- Go to npmjs.com → Access Tokens
- Create an Automation token
- Add it to GitHub repository secrets as
NPM_TOKEN
-
GitHub Pages:
- Go to Repository Settings → Pages
- Set Source to "GitHub Actions"
- No additional setup needed
-
GitHub Token:
- Automatically provided by GitHub Actions (no setup needed)
npm run devThis starts the Vite development server with hot reload using the example directory.
The project uses separate Vite configurations for different build targets:
npm run build:coreBuilds the main library (dist/core/index.js, dist/core/index.cjs, dist/core/mostage.css)
npm run build:cliBuilds the CLI tool (dist/cli/index.js, dist/cli/index.cjs)
npm run build:demoBuilds the demo for GitHub Pages (dist/demo/) and exports it as a self-contained HTML file (dist/demo/html/index.html)
npm run buildBuilds everything: core library + CLI + demo
The project uses separate Vite config files for better organization:
vite.dev.config.ts- Development servervite.build.core.config.ts- Core library buildvite.build.cli.config.ts- CLI build
After building, the dist/ directory is organized as follows:
dist/
├── cli/ # CLI executable files
│ ├── index.js # ES module CLI
│ └── index.cjs # CommonJS CLI
├── core/ # Core library files
│ ├── index.js # ES module library
│ ├── index.cjs # CommonJS library
│ ├── mostage.css # Core styles
│ ├── templates/ # Built-in templates
│ └── types/ # TypeScript definitions
│ └── index.d.ts
└── demo/ # Demo output (when built)
├── index.html # Original demo HTML
├── content.md
├── config.json
├── assets/
└── html/ # Exported self-contained HTML
└── index.html # Self-contained demo (266KB)
The CLI includes a powerful export command that supports multiple formats:
# Export to different formats
mostage export --format pdf
mostage export --format pptx
mostage export --format png
mostage export --format jpgExport Features:
- HTML: Self-contained HTML with embedded assets
- PDF: High-quality PDF with proper formatting
- PPTX: PowerPoint presentation with images and styling
- PNG/JPG: Individual slide images
Dependencies:
puppeteer: For PDF and image generationpptxgenjs: For PowerPoint exportsharp: For image processing
npm run previewPreview the built demo locally.
src/
├── cli/ # CLI source code
│ ├── commands/ # CLI commands
│ ├── generators/ # Code generators
│ └── utils/ # CLI utilities
├── core/ # Core library source
│ ├── components/ # UI components
│ ├── engine/ # Core engine
│ ├── plugins/ # Built-in plugins
│ ├── services/ # Core services
│ ├── styles/ # Core styles
│ ├── templates/ # Built-in templates
│ ├── themes/ # Built-in themes
│ └── utils/ # Core utilities
└── types/ # TypeScript type definitions
-
Core Library (
npm run build:core):- Compiles TypeScript to JavaScript
- Generates CSS bundle
- Copies templates to
dist/core/templates/ - Generates TypeScript definitions
-
CLI Tool (
npm run build:cli):- Compiles CLI TypeScript to JavaScript
- Creates executable files in
dist/cli/
-
Demo (
npm run build:demo):- Uses CLI to generate demo project
- Outputs to
dist/demo/
- Create plugin file in
src/plugins/your-plugin/ - Implement plugin interface:
export class YourPlugin {
name = "YourPlugin";
init(mostage: Mostage, config: any) {
// Initialize your plugin
}
destroy() {
// Cleanup resources
}
setEnabled(enabled: boolean) {
// Enable/disable functionality
}
}- No need to add to plugin loader — this is done automatically
- Create styles if needed
- Create theme file in
src/themes/your-theme.css - Use CSS custom properties for consistency
- Follow the existing theme structure
- Check existing Issues
- Create a new issue with detailed description
- Join discussions in the community