Skip to main content
MorJS is an open-source project maintained by Ele.me. Contributions of all kinds are welcome — bug reports, feature requests, documentation improvements, and pull requests.
Full contributing guidelines are kept at mor.ele.me/guides/contributing. This page is a quick-start reference.

Repository Structure

MorJS is a Lerna monorepo. All packages live under packages/ and are published independently to npm under the @morjs scope.
morjs/
├── packages/
│   ├── cli/                    # MorJS CLI
│   ├── core/                   # Core runtime and plugin system
│   ├── api/                    # Cross-platform API surface
│   ├── runtime-mini/           # Mini-program runtime shims
│   ├── runtime-web/            # Web runtime
│   ├── plugin-compiler/        # Base compiler plugin
│   ├── plugin-compiler-alipay/ # Alipay target compiler
│   ├── plugin-compiler-wechat/ # WeChat target compiler
│   └── utils/                  # Shared utilities
├── scripts/
│   └── build.js               # Build script
├── CHANGELOG.md
└── lerna.json

Setting Up the Dev Environment

1

Fork and clone the repository

git clone https://github.com/eleme/morjs.git
cd morjs
2

Install dependencies

MorJS uses npm workspaces managed by Lerna. Run the standard install at the repo root:
npm install
This installs all workspace dependencies and links local packages to each other.
3

Build all packages

node ./scripts/build.js
The build script compiles TypeScript sources for every package in dependency order and outputs to each package’s lib/ and esm/ directories.
4

Watch mode (optional)

To rebuild a specific package on file changes while developing, run the package’s own dev script:
cd packages/plugin-compiler-alipay
npm run dev

Running Tests

Tests are colocated with each package and run via Lerna:
# Run all tests across all packages
lerna run test

# Run tests for a single package
cd packages/runtime-mini
npm test
Always run the full test suite before submitting a pull request. CI will reject PRs with failing tests.

Commit Convention

MorJS enforces Conventional Commits via commitlint. Every commit message must follow the pattern:
<type>(<scope>): <subject>
Allowed types:
TypeWhen to use
featA new feature
fixA bug fix
docsDocumentation only
styleFormatting, whitespace (no logic change)
refactorCode restructuring without behaviour change
perfPerformance improvement
testAdding or fixing tests
choreTooling, CI, build scripts
revertReverting a previous commit
Scope is the package name without the @morjs/ prefix, e.g.:
feat(plugin-compiler-alipay): support custom tabBar directory for different targets
fix(runtime-mini): remove saveImageToPhotosAlbum => saveImage transform for alipay-to-wechat
docs(cli): update config reference for autoInjectRuntime
Use git commit interactively or install commitizen (npm i -g commitizen) to generate compliant messages with a prompt.

Pull Request Process

1

Create a feature branch

Branch off main with a descriptive name:
git checkout -b feat/plugin-compiler-wechat-my-feature
2

Make your changes

  • Keep changes focused. One logical change per PR makes reviews faster.
  • Add or update tests to cover the new behaviour.
  • Update relevant documentation if the public API changes.
3

Verify everything passes

node ./scripts/build.js
lerna run test
4

Open a pull request

Push your branch and open a PR against main on GitHub. Fill in the PR template:
  • What — summarise what changed.
  • Why — explain the motivation.
  • How to test — describe the manual or automated steps to verify.
Link any related issues with Fixes #<issue> in the description.
5

Address review feedback

Maintainers will review your PR. Push additional commits to the same branch to address feedback. Avoid force-pushing after a review has started.

Code Style

  • TypeScript is required for all new code under packages/.
  • Existing ESLint and Prettier configuration is enforced via pre-commit hooks.
  • Run npm run lint in a package to check locally before committing.

Reporting Issues

Bug reports

Open a GitHub issue with a minimal reproduction. Include your MorJS version, target platform, and the error output.

Feature requests

Describe the use case and the desired behaviour. PRs that come with a linked issue are merged faster.

Code of Conduct

This project follows the Contributor Covenant. Please be respectful and constructive in all interactions.

Build docs developers (and LLMs) love