Thanks for helping out — contributions keep this project healthy and useful for the Necesse community.
This document explains how to get the project running locally, the project layout, and best practices for contributing changes (templates, generators, docs, and CI).
- The CLI scaffolds Necesse 1.0+ mods using modern Gradle (9.1) templates.
- Gradle wrapper support is optional: the generator writes
gradle/wrapper/gradle-wrapper.propertieswhen requested; contributors should rungradle wrapperlocally to generate platform scripts (gradlew,gradlew.bat). - Templates were updated for Necesse 1.0+ conventions (lifecycle methods
init/initResources/postInit,ModifierValueusage, andsrc/main/resources/localelocalization files). - VSCode recommended extensions and tasks are included in templates to simplify onboarding.
- The CLI supports
new(project scaffolding) andaddsubcommands (add items, mobs, tiles, buffs to existing mods).
- Clone the repository:
git clone https://github.com/yourusername/necesse-modding-cli.git
cd necesse-modding-cli- Install dependencies (Bun is recommended but Node/npm/yarn will work if you prefer):
bun install- Build the CLI:
bun run build- Link the CLI for local testing (optional):
cd apps/cli
bun link# Alternative aliases, they point to the same cli locally(using bun link) or when installed globally with -g
@necesse-modding/cli
create-necesse-mod
necesse-cli
necesse-modding-cli Notes:
- Use the
buncommands above if you have Bun installed. If you're using npm: replacebun run ...withnpm run ....
necesse-modding-cli/
├── apps/
│ └── cli/ # Main CLI application and templates
│ ├── src/
│ ├── dist/ # Built output
│ └── package.json
├── packages/ # Shared packages (core, templates, types, etc.)
└── package.json # Workspace root
The templates and generator code live under packages/templates and packages/core in the monorepo; the CLI in apps/cli consumes those packages.
cd apps/cli
bun run devThis runs the CLI in watch/dev mode for quick iteration.
bun run build# Format code
bun run format
# Typecheck + lint
bun run checkIf you're adding a template or changing generator behavior:
- Edit or add template files under
packages/templates/src(see existing templates:basic,item,qol,empty). - Template functions should return a
Record<string, string>mapping relative file paths to file contents. - Update
packages/templates/src/index.tsto export new templates. - If you change shared helper behavior, update
packages/core/srcaccordingly and add unit tests where useful.
Example template shape (TypeScript):
import type { ModConfig } from 'packages/types';
import { getCommonFiles } from './common';
export function myTemplate(config: ModConfig): Record<string, string> {
const files = getCommonFiles(config);
files['src/main/java/yourmod/Example.java'] = `// example`;
return files;
}The CLI's add command supports adding components to an existing mod (item, mob, tile, buff). To extend or modify add:
- Look in
apps/cli/src/commands/add.ts(orpackages/corehelpers) for the interactive prompts and file-write logic. - Keep
addidempotent where possible (do not overwrite existing files without prompting).
- Use TypeScript for new code.
- Follow the repository style (Biome/Prettier/ESLint where configured).
- Commit messages should follow Conventional Commits (feat/fix/docs/chore/refactor).
Before opening a PR:
- Run unit tests (if added) and the build:
bun run build. - Run
bun run checkto typecheck and lint. - Test generator output by running the CLI and scaffolding a sample mod:
# local linked CLI from apps/cli
create-necesse-mod --interactiveNotes: The alias is necessary because linked packages can't use their original names if they has scoped names (@scope)
- If including the Gradle wrapper properties, run
gradle wrapperinside the generated project to producegradlewscripts and then try./gradlew build(orgradlew.bat buildon Windows).
- Fork the repository and create a feature branch:
git checkout -b feat/my-feature. - Make changes and add tests where appropriate.
- Run the build and checks locally.
- Commit and push to your fork, open a PR describing the change and linking issues if any.
- Where is the Gradle wrapper? The CLI writes
gradle/wrapper/gradle-wrapper.propertieswhen requested; we intentionally avoid shipping generated platform scripts (gradlew,gradlew.bat) in the repository. Contributors should rungradle wrapperlocally when testing generated projects. - Which Gradle version do templates target? Gradle 9.1 (distribution referenced in the wrapper properties).
- Which Java version? Templates configure compatibility for Java 8 to match the supported runtime; check
packages/templates/src/common.tsfor specifics.
If you hit issues or have questions:
- Open an issue on GitHub
- Join the Necesse Modding Discord linked in the README
Thank you for contributing!