Development Workflow for scorm-again
This document outlines the recommended development workflow for contributing to the scorm-again project. It covers setting up your development environment, making changes, testing, and submitting pull requests.
Table of Contents
- Setting Up Your Development Environment
- Development Workflow
- Code Style and Formatting
- Building the Project
- Submitting Changes
Setting Up Your Development Environment
Prerequisites
- Node.js (LTS version recommended)
- npm
- git
Initial Setup
- Fork the repository on GitHub
- Clone your fork locally:
git clone https://github.com/YOUR-USERNAME/scorm-again.git
cd scorm-again - Add the original repository as a remote to keep your fork in sync:
git remote add upstream https://github.com/jcputney/scorm-again.git - Install dependencies:
npm install
Keeping Your Fork Updated
Regularly sync your fork with the upstream repository:
git fetch upstream
git checkout main
git merge upstream/main
Development Workflow
Creating a Feature Branch
Always create a new branch for your changes:
git checkout -b feature/your-feature-name
Use a descriptive branch name that reflects the changes you're making. Common prefixes include:
feature/for new featuresbugfix/for bug fixesdocs/for documentation changestest/for test-only changes
Making Changes
- Make your code changes following the project's coding standards
- Write or update tests for your changes
- Run tests locally to ensure they pass:
npm run test:min - Format your code:
npm run prettier - Fix any linting issues:
npm run fix
Committing Changes
-
Stage your changes:
git add . -
Commit your changes with a descriptive message:
git commit -m "A brief summary of the commit"For larger changes, use a multi-line commit message:
git commit -m "A brief summary of the commit
A paragraph describing what changed and its impact." -
Push your changes to your fork:
git push origin feature/your-feature-name
Code Style and Formatting
scorm-again follows specific coding conventions to maintain consistency across the codebase:
- Use the TypeScript style guide in
typescript_guidelines.md - Run Prettier to automatically format your code:
npm run prettier - Run ESLint to check for and fix code style issues:
npm run fix
Key style points:
- Use 2 spaces for indentation (soft tabs)
- Always put spaces after list items and method parameters
- Use spaces around operators and hash arrows
- Follow the naming conventions in the style guide
Building the Project
Development Build
To build the project during development:
npm run build:all
This will create the following files in the dist directory:
scorm-again.js- The full libraryscorm-again.min.js- Minified version of the full libraryscorm12.js- SCORM 1.2 API onlyscorm2004.js- SCORM 2004 API only
Testing Your Build
After building, you can test the library by:
- Including it in an HTML file:
<script src="dist/scorm-again.js"></script> - Creating a simple SCORM content package that uses the library
- Testing the package in a SCORM-compatible LMS or SCORM Cloud
Submitting Changes
Creating a Pull Request
- Ensure all tests pass:
npm run test:min - Push your changes to your fork if you haven't already:
git push origin feature/your-feature-name - Go to the scorm-again repository on GitHub
- Click "New Pull Request"
- Select "compare across forks"
- Select your fork and branch as the source
- Add a clear title and description for your pull request:
- Describe what the changes do
- Reference any related issues using the GitHub issue number (e.g., "Fixes #123")
- Mention any notable implementation details or design decisions
- List any manual testing you've performed
Pull Request Review Process
- Maintainers will review your code
- Automated tests will run on your pull request
- You may be asked to make changes based on feedback
- Once approved, your changes will be merged into the main branch
After Your Pull Request is Merged
- Update your local main branch:
git checkout main
git pull upstream main - Delete your feature branch (optional):
git branch -d feature/your-feature-name - Update your fork on GitHub:
git push origin main
By following this workflow, you'll help maintain a high-quality codebase and make the review process smoother for everyone involved.