Thank you for your interest in contributing!
- Getting Started
- Development Workflow
- Code Style
- Project Structure
- Adding New Generators
- Testing Your Changes
- Commit Guidelines
- Pull Request Process
- Common Tasks
- Node.js >= 22 (Download)
- pnpm >= 10 (Installation)
- Fork and clone the repository
- Run
pnpm install - Run
pnpm generate-datato verify setup
- Create a new branch
- Make your changes
- Test your changes (see Testing Your Changes)
- Run
pnpm fix:eslint - Commit and push to your fork (Prettier runs automatically on commit)
- Open a Pull Request
This project uses:
- ESLint 9 with flat config for linting
- Prettier for code formatting
- Husky for pre-commit hooks
Prettier automatically formats staged files and organizes imports when you commit.
- Use TypeScript for all new code
- Follow existing code patterns in similar scripts
- Use descriptive variable names
- Add comments for complex logic
- Use the
writeFile()helper fromhelpers.tsfor file output - Use
@d2api/manifest-nodefor Destiny 2 manifest access
d2-additional-info/
├── src/ # TypeScript source files
│ ├── generate-*.ts # Data generation scripts
│ ├── main.ts # Orchestrates script execution
│ ├── helpers.ts # Shared utility functions
│ └── log.ts # Logging utilities
├── output/ # Generated JSON/TypeScript files
├── data/ # Static data and config files
│ ├── events/ # Event-related data
│ ├── seasons/ # Season-related data
│ └── generated-enums.ts # Auto-generated enums
├── built/ # Compiled JavaScript
└── .husky/ # Git hooks
src/main.ts- Entry point that runs all generator scripts in ordersrc/helpers.ts- Shared utilities likewriteFile()andreadJsonFile()src/generate-*.ts- Individual generator scripts (one per output file)
Generator scripts run in this order:
- Priority scripts (in exact order):
enums- Generates TypeScript enums from manifestseason-info- Generates season datasource-info- Generates source mappingswatermark-info- Generates watermark mappingsuniversal-ornament-plugsethashes- Generates ornament plug set hashes
- All other scripts run alphabetically
Priority scripts generate data that other scripts depend on.
To create a new data generator:
-
Create a new file in
src/namedgenerate-your-feature.ts -
Follow this pattern:
import { getAllDefs, getDef } from '@d2api/manifest-node'; import { writeFile } from './helpers.js'; const TAG = 'YOUR-FEATURE'; // Fetch data from manifest const items = getAllDefs('InventoryItem'); // Process data const result: Record<number, string> = {}; items.forEach((item) => { // Your logic here result[item.hash] = item.displayProperties.name; }); // Write output file writeFile('./output/your-feature.json', result);
-
If other scripts will depend on your script's output, add your script to
prioritizedScriptsinsrc/main.tsto ensure it runs first -
Document your output file in README.md's "Output Files" section
-
Test your generator:
pnpm generate-data-sub your-feature
If your script reads a JSON file that's written by another script during the same generate-data run, use readJsonFile() instead of static imports:
// ❌ Don't use static imports for files written during the same run
import seasons from 'data/seasons/seasons_unfiltered.json' with { type: 'json' };
// ✅ Use readJsonFile to bypass Node.js module cache
import { readJsonFile } from './helpers.js';
const seasons = readJsonFile<Record<string, number>>('./data/seasons/seasons_unfiltered.json');This ensures you always read the latest data from disk, not cached data from before the current run.
pnpm generate-data-sub script-nameWhere script-name is the generator filename without the generate- prefix and .ts extension. For example, src/generate-season-info.ts → season-info.
Example:
pnpm generate-data-sub season-info source-infopnpm generate-data- Check that your output file appears in
output/ - Verify the file contains expected data
- Ensure no errors were logged during generation
- Check for unexpected changes in other output files
⚠️ Important: NEVER manually edit JSON files anywhere (includingoutput/ordata/). All JSON files are generated by scripts and manual edits will be overwritten. If output is incorrect, fix the generator script or update TypeScript config files indata/, then re-run generators.
Write clear commit messages that describe what changed and why. No strict format required.
- Run
pnpm lint:eslint - Run
pnpm generate-data - Update README.md if you added new output files
Include:
- What you changed and why
- How to test the change
- Link to related issues (if any)
⚠️ Golden Rule: Never manually edit JSON files ordata/generated-enums.ts. All JSON files (inoutput/ordata/) are generated by scripts. You CAN edit TypeScript config files indata/(e.g.,bounty-config.ts). If JSON data is wrong, fix the generator script or update TypeScript config files, then re-run the generators.
Manifest updates are handled automatically by GitHub Actions. You don't need to do anything.
- Check for a TypeScript config file in
data/(e.g.,bounty-config.ts) - Update the config file or generator script (NOT JSON files!)
- Run the generator to regenerate output
- Submit a PR with the updated config/script and regenerated output
- Join the DIM Discord for quick help and discussion
- Check existing issues on GitHub
- Ask in a new issue if you need help
- Look at existing generators for examples
Be respectful and constructive in all interactions.
Thank you for contributing to d2-additional-info!