Acknowledge OSS libraries used in your React Native app
npm install react-native-legal
React Native Legal - Automagically generate license acknowledgements for your React Native app π
---
!Release
!Deploy Docs
!Integration tests - License Kit (Node)
!Unit tests - @callstack/licenses
!E2E tests - Android
!E2E tests - iOS
- Documentation
- Installation
- React Native
- Standalone CLI
- Node.js - API
- Usage
- I want to generate licenses in my Expo project
- I want to generate licenses reports in my bare RN project
- I want to generate licenses reports in my Node.js project
- I want to customize the presentation of the licenses in my JS/TS project
- Expo
- Contributing
- Acknowledgements
- License
Automagically generate license acknowledgements for your React Native app and any Node.js project π
| Android | iOS | AndroidTV | tvOS |
| ------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- |
| !Android example | !iOS example | !AndroidTV example | !tvOS example |
You can find the full documentation for all packages in this repository at callstackincubator.github.io/react-native-legal.
``sh`
yarn add react-native-legal
or
`sh`
npm i --save react-native-legal
`sh`
yarn add -D license-kit
or
`sh`
npm i --save-dev license-kit
`sh`
yarn add -D @callstack/licenses
or
`sh`
npm i --save-dev @callstack/licenses
This tool is split into 4 parts:
- a React Native library that lets you display native screen with a list of all dependencies and their licenses
- an Expo config plugin (for Expo projects) and a custom community cli plugin (for bare RN projects)
- a standalone CLI tool that can be used in any Node.js project to generate license metadata (license-kit)@callstack/licenses
- a shared package that exposes the core functionality of the license management tool, allowing customization of presentation logic in your Node.js scripts ()
1. Add the config plugin to the app.json/app.config.js
`diff`
{
"expo": {
"plugins": [
+ "react-native-legal"
]
}
}
2. Use the library in the codebase
`tsx
import * as React from 'react';
import { Button, View } from 'react-native';
import { ReactNativeLegal } from 'react-native-legal';
function launchNotice() {
ReactNativeLegal.launchLicenseListScreen('OSS Notice');
}
function MyComponent() {
return (
);
}
`
3. Use Prebuild or EAS to build the app
1. Invoke the CLI plugin from the root of your RN app
`sh`
npx react-native legal-generate
or
`sh`
yarn react-native legal-generate
2. Use the library in the codebase
`tsx
import * as React from 'react';
import { Button, View } from 'react-native';
import { ReactNativeLegal } from 'react-native-legal';
function launchNotice() {
ReactNativeLegal.launchLicenseListScreen('OSS Notice');
}
function MyComponent() {
return (
);
}
`
You can use the license-kit CLI tool to generate license reports in your Node.js project. Here's how to do it:
1. Run the CLI tool from the root of your Node.js project:
`sh`
npx license-kit report --format markdown --output ./public/licenses.md
or
`sh`
yarn license-kit report --format markdown --output ./public/licenses.md
This will scan your project's dependencies and generate a license report in the specified format (JSON, Markdown, raw text, or AboutLibraries-compatible JSON metadata).
For a list of supported flags and the default values, run npx license-kit --help or read them documented in the package's README. To read more about a specific command, run npx license-kit , e.g. npx license-kit report --help.
You can use the @callstack/licenses package to access the core functionalities of the license management tool. To do so, please read the programmatic usage documentation.
- β
You can use this library with Development Builds by adding react-native-legal to your app.json/app.config.js` plugins array.
- β This library can't be used in the "Expo Go" app because it requires custom native code.
See the contributing guide to learn how to contribute to the repository and the development workflow.
- AboutLibraries - collects and displays the license metadata for the Android app <3
- LicensePlist - generates license metadata for the iOS app <3
MIT