An open source license scanning and display library for HarmonyOS.
Note
This library does not support Cangjie HarmonyOS apps. Per Huawei's documentation, Cangjie HarmonyOS apps cannot add ArkTS pages or call third-party ArkTS libraries; this library is a third-party library built on ArkTS pages and components.
- End-to-end — scans your dependencies at build time and displays the license list in your app. No manual JSON editing, no drift.
- Prebuilt UI pages — drop-in list/detail UI built on ArkUI & UI Design Kit, adaptive for both phone and large screens.
- Custom UI, no problem — use the core package alone to load and parse the license data and render it in any UI you build.
- Always up to date — the Hvigor plugin scans
oh_modules/on every build. The license list always matches what you ship. - AI-assisted integration — ships an Agent Skill so an AI can wire the library into your project for you.
Tip
You can install the Agent Skills provided by this library to let an AI Agent help integrate it into your HarmonyOS project quickly:
npx skills add composable-tu/osslibrariesohpm install osslibraries_uiThe license scanner is a standalone Hvigor plugin osslibraries-hvigor-plugin that runs before ArkTS compilation and writes osslibraries.json into the rawfile directory of the entry module (the target module can be customized; entry is used here as an example).
Install via npm:
npm install osslibraries-hvigor-plugin --save-devOther package managers also work:
yarn add osslibraries-hvigor-plugin --dev
pnpm add osslibraries-hvigor-plugin -D
vp add osslibraries-hvigor-plugin -D
vlt install osslibraries-hvigor-plugin -D
bun add osslibraries-hvigor-plugin -DThen edit entry/hvigorfile.ts to register the plugin:
import { hapTasks } from '@ohos/hvigor-ohos-plugin';
import { ossScanPlugin } from 'osslibraries-hvigor-plugin';
export default {
system: hapTasks,
plugins: [ossScanPlugin()]
}Tip
If you have modules that should not appear in the license list, pass their dependency names to selfModules:
plugins: [ossScanPlugin({ selfModules: ["mylibrary", "3rdlibrary"] })];On each build, the plugin scans oh_modules/ and generates entry/src/main/resources/rawfile/osslibraries.json.
At the top of a page file in the entry module (e.g. Index.ets), add:
import 'osslibraries_ui/src/main/ets/pages/OSSLibrariesLicensePage';
No changes are needed in entry's main_pages.json — just keep its own pages.
From any page in your app, navigate via pushNamedRoute:
this.getUIContext().getRouter().pushNamedRoute({
name: 'OSSLibrariesLicensePage'
});
The OSSLibraries UI for wearable devices is a separate osslibraries_ui_wear module:
ohpm install osslibraries_ui_wearRegister the Hvigor plugin in the wearable module, same as for osslibraries_ui:
import { hapTasks } from '@ohos/hvigor-ohos-plugin';
import { ossScanPlugin } from 'osslibraries-hvigor-plugin';
export default {
system: hapTasks,
plugins: [ossScanPlugin()]
}At the top of a page file in the wearable module (e.g. Index.ets), import the pages to register the named routes:
import 'osslibraries_ui_wear/src/main/ets/pages/OSSLibrariesLicenseListPageWear';
import 'osslibraries_ui_wear/src/main/ets/pages/OSSLibrariesLicenseDetailPageWear';
Then navigate via pushNamedRoute:
this.getUIContext().getRouter().pushNamedRoute({
name: 'OSSLibrariesLicenseListPageWear'
});
You can skip the predefined OSSLibraries UI pages and use the core module directly:
ohpm install osslibrariesThe core package handles data loading and parsing. In your custom page, call LibsLoader.fromRawfile(context) to get a sorted Libs instance:
import { common } from '@kit.AbilityKit';
import { Libs, LibsHolder, LibsLoader } from 'osslibraries';
const context: common.Context = this.getUIContext().getHostContext() as common.Context;
const libs: Libs = await LibsLoader.fromRawfile(context);
// Find a library
const lib = libs.findLibrary('@ohos/hypium');
// Share data across pages
LibsHolder.set(libs);
Mulan PSL v2
This project references the implementation of mikepenz/AboutLibraries to some extent. Thanks for the inspiration.

