@dhis2/analytics

中文文档
29.9.0发布于 2026/11/09BSD-3-ClauseESM + CJS近 30 天下载 6501
原始使用文档
文档目录6 节
  1. Overview
  2. Publishing
  3. master branch
  4. .x branches
  5. Publishing pre-release versions during app development
  6. Report an issue

Analytics

master Test DHIS2: Release

24.x Test DHIS2: Release

Overview

The analytics library contains components and modules that are used in DHIS 2 analytics apps, including:

Module layout documentation

Publishing

The analytics package is published to npm as @dhis2/analytics.

To publish, mark the commit using semantic release terminology (see notes below for branch-specific restrictions). Once committed, github actions will take care of publishing the new version to npm.

master branch

The master branch follows semantic versioning according to spec.

.x branches

Commits to .x branches (e.g. 24.x) cannot trigger a major version bump, even if it is technically a breaking change. This is because the next version has already been published. Additionally, branches that use .x for the patch version (e.g. 11.0.x, 2.4.x), cannot trigger a minor version bump. In the unlikely case that you need to commit a change that would trigger a version bump that's not possible, you will have to mark it to only trigger a patch or minor bump respectively, then make sure to update the apps that are locked to the .x version of analytics

Publishing pre-release versions during app development

Builds for all non-production branches are automatically copied to d2-ci/analytics for use during development and testing, prior to production release.

To test changes in a development branch, change the analytics dependency of package.json of the app you are testing with. There are a few options:

  1. point to a specific commit:
"dependencies": {
        "@dhis2/analytics": "git+https://github.com/d2-ci/analytics.git#70249ebe8be39051fa10142f850de449e1ec488c",
        ...
}
  1. point to a branch:
"dependencies": {
        "@dhis2/analytics": "git+https://github.com/d2-ci/analytics.git#chore/some-chore",
        ...
}

Report an issue

The issue tracker can be found in DHIS2 JIRA under the LIBS project.

Deep links:

版本与发布记录

@dhis2/analytics 共发布 936 个版本,首次发布于 2019/06/25;过去 12 个月发布了 29 个版本。

版本发布日期距今
29.9.0latest2026/11/092 天前
29.8.22026/11/047 天前
29.8.12026/09/251 个月前
29.8.02026/09/241 个月前
29.7.12026/09/241 个月前
29.7.02026/09/241 个月前

其他发布通道:pivot-table-alpha → 3.0.0-alpha.1,v5-periodselector-alpha → 5.1.5-alpha.2,v5-translations-alpha → 6.0.3-alpha.2,release-16.x.x → 16.0.23,release-11.0.x → 11.0.20,release-20.x → 20.9.2。

关于 @dhis2/analytics 的常见问题

@dhis2/analytics 是什么?

master [![DHIS2: Release](https://github.com/dhis2/analytics/actions/workflows/node-publish.yml

如何安装 @dhis2/analytics?

在项目目录运行 npm install @dhis2/analytics,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:react(^16.3 || ^18)、@dhis2/ui(^10)、react-dom(^16.3 || ^ 18)、prop-types(^15)、styled-jsx(^4.0.1)、@dhis2/d2-i18n(^1.1)、@dhis2/app-runtime(^3)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@dhis2/analytics 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/dhis2__analytics 是否存在。

@dhis2/analytics 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@dhis2/analytics 可以商用吗?

@dhis2/analytics 使用 BSD-3-Clause 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。另外不得用原作者名义为衍生产品背书。以上为概括,不构成法律意见,请以许可原文为准。

@dhis2/analytics 的下载量有多少?

根据 npm 官方下载统计,@dhis2/analytics 在 2026/10/12 – 2026/11/10 这 30 天内被下载 6,501 次,日均约 217 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@dhis2/analytics 还在维护吗?

最新版本 29.9.0 发布于 2026/11/09(2 天前);至今共发布 936 个版本,其中过去 12 个月发布了 29 个;首次发布于 2019/06/25。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。