Apache ECharts is a TypeScript-first charting library. Most runtime code lives in src/, while build scripts, test utilities, and packaging logic live alongside it in dedicated top-level folders.
One thing worth knowing early is that this repo is assembled through explicit registration and curated entry files. New runtime code often needs to be connected not only in its local module, but also through public exports or bundle entry files before it becomes part of a user-facing build.
When a task touches contribution workflow, prefer the repo's own contributor-facing documents over this summary:
CONTRIBUTING.mdfor general contribution guidancehttps://github.com/apache/echarts/wiki/How-to-make-a-pull-requestfor PR workflow, test expectations, and git message conventionshttps://github.com/apache/echarts/wiki/How-to-setup-the-dev-environmentfor local setup and zrender-linked developmenthttps://github.com/apache/echarts/wiki/Security-Checklist-for-Code-Contributorsfor security-sensitive API and API-design checks.github/pull_request_template.mdfor PR structure.github/workflows/for CI expectations
This file is only a short orientation note. If there is any conflict, the repo's dedicated contributor docs should win.
A few stable rules from the PR wiki are especially worth keeping in mind:
- In non-release PRs, avoid committing
dist/,i18n/, andssr/client/dist/. - Follow the repo's PR template when opening or updating a pull request.
- Git messages follow the repo convention:
<type>(<scope>): <subject>. close #<issue_id>, with the issue-closing suffix omitted when there is no related issue. - If you need to work on linked
zrendercode, the dev-environment wiki recommends using an absolute symlink atnode_modules/zrenderinstead ofnpm link, because the watch flow depends on that setup. - Be cautious with security-sensitive web APIs such as
innerHTML, arbitrary DOM selectors,eval-like execution, raw style injection, and navigation-related APIs. If a feature must allow that kind of behavior, the security checklist expects clear documentation warnings.
src/: built-in charts, components, coordinate systems, models, renderers, features, themes, and i18n sourcesrc/export/*.ts: public modular export surfacessrc/echarts.all.ts,src/echarts.common.ts,src/echarts.simple.ts,src/echarts.ts: main bundle entry filesextension-src/: separately packaged extensionsssr/client/src/: SSR client sourcebuild/: build, packaging, prepublish, and generation scriptstest/ut/spec/: Jest unit teststest/*.html: browser-based rendering and interaction cases
In general, src/ is the main source of truth for built-in library behavior.
Some top-level files and folders are generated or packaging-oriented:
i18n/*.jsandi18n/*-obj.jsare generated fromsrc/i18n/*.tslib/,types/,extension/,ssr/client/lib/,ssr/client/types/, and rootindex*.jsare produced by the build/prepublish flowdist/contains build output
The top-level theme/*.js files are packaged theme sources rather than normal src/theme/ runtime modules, so they are best treated separately from the generated locale/build artifacts above.
This repo exposes functionality at a few different layers:
- local runtime modules under
src/ - modular public exports under
src/export/*.ts - bundled entry files under
src/echarts*.ts
Because of that structure, changes to charts, components, renderers, or features sometimes need corresponding updates in exports or entry files to show up in the expected public build.
The repository uses two main testing styles:
- Jest tests in
test/ut/spec/for logic-heavy behavior such as models, utilities, data transforms, and API behavior - HTML cases in
test/for rendering, layout, interaction, and visual regressions
For local development, npm run dev starts the watch build and opens the test/ directory. New HTML cases can be scaffolded with npm run mktest.
npm run checktypenpm run lintnpm testnpm run test:dts:fastnpm run dev
This repository consistently keeps ASF license headers in source and test files, and the codebase style is stable: single quotes, semicolons, and 4-space indentation are the norm. Small changes that follow nearby patterns tend to fit best here.