Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
908bea0
refactor: extract common logic to shared package
artus9033 Jun 9, 2025
7d17de0
feat: rename to license-kit
thymikee Jun 9, 2025
73185ac
chore: update bin
thymikee Jun 9, 2025
0cd2111
chore: not private
thymikee Jun 9, 2025
2841e6f
chore: set version instead of workspace
thymikee Jun 9, 2025
fa761cb
chore: changeset
thymikee Jun 9, 2025
cdd6923
v0.1.1
thymikee Jun 9, 2025
b531ff5
fix: set shebang
thymikee Jun 9, 2025
115c900
chore: license-kit@0.1.2
thymikee Jun 9, 2025
51acaf5
refactor!: refactor extracted parts of code to the shared module
artus9033 Jun 12, 2025
f419c6d
chore: tsc watch script for development in shared package, updated docs
artus9033 Jun 12, 2025
b3b6f59
feat: print version of the CLI
artus9033 Jun 12, 2025
4b72608
feat: output and format flags to export to file in a given format, im…
artus9033 Jun 12, 2025
859f2e3
chore: added dev script to CLI package
artus9033 Jun 12, 2025
869e1f1
docs: rewrite of docs for all packages
artus9033 Jun 12, 2025
f7da356
docs: added badges to README.md
artus9033 Jun 12, 2025
1490774
docs: added links to documentation website in README.md
artus9033 Jun 12, 2025
d193c30
chore: stripped obsolete style rule for docs
artus9033 Jun 12, 2025
bcd60f8
feat!: split the CLI into commands: report, copyleft
artus9033 Jun 12, 2025
738a61e
docs: reorganized landing page layout
artus9033 Jun 12, 2025
cfdaedd
chore: stripped obsolete console.log statements
artus9033 Jun 12, 2025
e7c016a
chore: remove obsolete config file
artus9033 Jun 12, 2025
56b75f9
fix: import shared utilities from dependency package rather than loca…
artus9033 Jun 12, 2025
a85f910
fix: revert accidental removal of plugin-utils dir from package.json …
artus9033 Jun 12, 2025
129f1ef
chore: remove obsolete development plugin to reduce obsolete indirect…
artus9033 Jun 12, 2025
08fd87b
chore: replace del-cli with rimraf
artus9033 Jun 12, 2025
dcbd694
chore: remove obsolete eslint configuration
artus9033 Jun 12, 2025
39d7f02
Merge branch 'main' into feat/extracted-logic-and-cli
artus9033 Jun 13, 2025
b9d675e
chore: updated project banner
artus9033 Jun 13, 2025
c0a42ad
docs: rspress typedoc plugin for API docs for @callstack/react-native…
artus9033 Jun 13, 2025
f9c1809
chore: changes after CR
artus9033 Jun 13, 2025
3d04626
chore: added changesets
artus9033 Jun 13, 2025
19e68bd
feat: improve docs
mateusz1913 Jun 17, 2025
bfac40c
feat: improve shared package
mateusz1913 Jun 17, 2025
2f58502
feat: improve license-kit copyleft output and detection of copyleft l…
mateusz1913 Jun 17, 2025
0df99c0
chore: implement integration tests for license-kit
mateusz1913 Jun 17, 2025
afb7f33
Merge branch 'main' into feat/extracted-logic-and-cli
artus9033 Jun 18, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/bright-bags-peel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'license-kit': minor
---

Separated copyleft and report commands, general code refactor
5 changes: 5 additions & 0 deletions .changeset/bright-bags-scream.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'react-native-legal': minor
---

Consume extracted core logic from @callstack/react-native-legal-shared
5 changes: 5 additions & 0 deletions .changeset/many-things-joke.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@callstack/react-native-legal-shared': minor
---

Complete refactor, renamed generate* functions to write* and extracted generation logic to functions under previous generate\* names
6 changes: 6 additions & 0 deletions .changeset/tall-ghosts-stick.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'license-kit': patch
'@callstack/react-native-legal-shared': patch
---

feat: setup new packages in monorepo
3 changes: 2 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/** @type {import("eslint").Linter.Config} */
const config = {
root: true,
extends: '@callstack',
extends: ['@callstack'],
ignorePatterns: ['node_modules/', '**/node_modules/', 'lib/', '**/lib/', 'build/', '**/build/'],
rules: {
// Place to specify ESLint rules. Can be used to overwrite rules specified from the extended configs
Expand All @@ -15,6 +15,7 @@ const config = {
'**/babel.config.js',
'**/jest.config.js',
'**/metro.config.js',
'**/rspress.config.ts',
],
},
],
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ project.xcworkspace

# Library
build/
packages/react-native-legal/lib/
packages/*/lib/
packages/*/build/

# Expo example
examples/expo-example/android
Expand Down
14 changes: 13 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ To get started with the project, run `yarn` in the root directory to install the
yarn
```

All packages in this monorepo depend on the [shared package](packages/shared) (`@callstack/react-native-legal-shared`). This package needs to be rebuilt whenever you make changes to it since other packages consume the exported, built JS code with emitted typings. You can do this by running the following command from the root directory, which will start `tsc` in watch mode:

```sh
yarn workspace @callstack/react-native-legal-shared dev
```

While developing, you will have 2 example apps that can be used to test your changes.
Any changes you make in your library's JavaScript code will be reflected in the example app without a rebuild.
If you change any native code, then you'll need to rebuild the example app.
Expand Down Expand Up @@ -79,6 +85,7 @@ The codebase of Expo Config Plugin is located in:
- `packages/react-native-legal/plugin`
- `packages/react-native-legal/plugin-utils`
- `packages/react-native-legal/app.plugin.js` (the entry point)
- `packages/license-kit` (logic)

To test the changes, build the plugin run (from the root directory, the one with consisting all workspaces):

Expand All @@ -99,8 +106,9 @@ The codebase of RN CLI plugin is located in:
- `packages/react-native-legal/bare-plugin`
- `packages/react-native-legal/plugin-utils`
- `packages/react-native-legal/react-native.config.js` (the entry point)
- `packages/license-kit` (logic)

To test the changes, build the plugin run (from the root directory, the one with consisting all workspaces):
To test the changes, build the plugin (run from the root directory, the one with consisting all workspaces):

```sh
yarn workspace react-native-legal build-plugins
Expand Down Expand Up @@ -145,23 +153,27 @@ yarn format:swift
Objective-C code is linted and formatted using following commands:

Lint code

```sh
yarn lint:objc
```

Fixing formatting errors

```sh
yarn format:objc
```

For Kotlin codebase, run the following to verify code quality:

Lint Kotlin code

```sh
yarn lint:android
```

Format Kotlin code

```sh
yarn format:android
```
Expand Down
112 changes: 105 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<a href="https://www.callstack.com/open-source?utm_campaign=generic&utm_source=github&utm_medium=referral&utm_content=react-native-legal" align="center">
<picture>
<img alt="React Native Legal" src="https://github.com/user-attachments/assets/dd266822-1f3c-48ff-816c-7aaeb95d85aa">
<img alt="React Native Legal" src="./images/banner.jpg">
</picture>
</a>

Expand All @@ -10,12 +10,40 @@

---

| Android | iOS | AndroidTV | tvOS |
| - | - | - | - |
![E2E tests - Android](https://github.com/callstackincubator/react-native-legal/actions/workflows/test-e2e-android.yaml/badge.svg)
![E2E tests - iOS](https://github.com/callstackincubator/react-native-legal/actions/workflows/test-e2e-ios.yaml/badge.svg)
![Release](https://github.com/callstackincubator/react-native-legal/actions/workflows/release.yml/badge.svg)
![Deploy Docs](https://github.com/callstackincubator/react-native-legal/actions/workflows/deploy-docs.yml/badge.svg)

- [Documentation](#documentation)
- [Installation](#installation)
- [React Native](#react-native)
- [Standalone CLI](#standalone-cli)
- [Node.js - API](#nodejs---api)
- [Usage](#usage)
- [I want to generate licenses in my Expo project ](#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-bare-rn-project-)
- [I want to generate licenses reports in my Node.js project](#i-want-to-generate-licenses-reports-in-my-nodejs-project)
- [I want to customize the presentation of the licenses in my JS/TS project](#i-want-to-customize-the-presentation-of-the-licenses-in-my-jsts-project)
- [Expo](#expo)
- [Contributing](#contributing)
- [Acknowledgements](#acknowledgements)
- [License](#license)

Automagically generate license acknowledgements for your React Native app and any Node.js project 🚀

| Android | iOS | AndroidTV | tvOS |
| ------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- |
| ![Android example](https://github.com/callstackincubator/react-native-legal/raw/main/static/android-expo.gif) | ![iOS example](https://github.com/callstackincubator/react-native-legal/raw/main/static/ios-expo.gif) | ![AndroidTV example](https://github.com/callstackincubator/react-native-legal/raw/main/static/android-tv.gif) | ![tvOS example](https://github.com/callstackincubator/react-native-legal/raw/main/static/tvos.gif) |

## Documentation

You can find the full documentation for all packages in this repository at [callstackincubator.github.io/react-native-legal](https://callstackincubator.github.io/react-native-legal/).

## Installation

### React Native

```sh
yarn add react-native-legal
```
Expand All @@ -26,11 +54,38 @@ or
npm i --save react-native-legal
```

### Standalone CLI

```sh
yarn add -D license-kit
```

or

```sh
npm i --save-dev license-kit
```

### Node.js - API

```sh
yarn add @callstack/react-native-legal-shared
```

or

```sh
npm i --save @callstack/react-native-legal-shared
```

## Usage

This tool is split into 2 parts:
- a library that lets you display native screen with a list of all dependencies and their licenses
- a [config plugin](https://docs.expo.dev/config-plugins/introduction/?redirected) (for Expo projects) and a [custom community cli plugin](https://github.com/react-native-community/cli/blob/main/docs/plugins.md) (for bare RN projects)
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](https://docs.expo.dev/config-plugins/introduction/?redirected) (for Expo projects) and a [custom community cli plugin](https://github.com/react-native-community/cli/blob/main/docs/plugins.md) (for bare RN projects)
- a standalone CLI tool that can be used in any Node.js project to generate license metadata
- a shared package that exposes the core functionality of the license management tool, allowing customization of presentation logic in your Node.js scripts

### I want to generate licenses in my Expo project <a name="usage-expo"></a>

Expand Down Expand Up @@ -68,7 +123,7 @@ function MyComponent() {

3. Use [Prebuild](https://docs.expo.dev/workflow/prebuild/) or [EAS](https://docs.expo.dev/eas/) to build the app

### I want to generate licenses in my bare RN project <a name="usage-bare-rn"></a>
### I want to generate licenses reports in my bare RN project <a name="usage-bare-rn"></a>

1. Invoke the CLI plugin from the root of your RN app

Expand Down Expand Up @@ -102,6 +157,49 @@ function MyComponent() {
}
```

### I want to generate licenses reports in my Node.js project

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](./packages/license-kit/README.md#command-line-options). To read more about a specific command, run `npx license-kit <command> --help`, e.g. `npx license-kit report --help`.

### I want to customize the presentation of the licenses in my JS/TS project

You can use the `@callstack/react-native-legal-shared` package to access the core functionalities of the license management tool. Here's a basic example of how to use it:
Comment thread
artus9033 marked this conversation as resolved.

```typescript
import {
generateAboutLibrariesNPMOutput,
generateLicensePlistNPMOutput,
scanDependencies,
} from '@callstack/react-native-legal-shared';

// scan dependencies of a package
const licenses = scanDependencies(packageJsonPath);

// generate AboutLibraries-compatible JSON metadata
const aboutLibrariesCompatibleReport = generateAboutLibrariesNPMOutput(licenses);

// generate LicensePlist-compatible metadata
const licensePlistReport = generateLicensePlistNPMOutput(licenses);
```

For more advanced usage, read the [programmatic usage documentation](https://callstackincubator.github.io/react-native-legal/docs/programmatic-usage#usage).

## Expo

- ✅ You can use this library with [Development Builds](https://docs.expo.dev/development/introduction/) by adding `react-native-legal` to your `app.json`/`app.config.js` plugins array.
Expand Down
3 changes: 3 additions & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@ doc_build/
.vscode/*
!.vscode/extensions.json
.idea

# @rspress/plugin-typedoc
docs/api
101 changes: 101 additions & 0 deletions docs/components/CustomHomePage.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
import { usePageData } from 'rspress/runtime';
import { Button, HomeFeature, HomeFooter, HomeHero } from 'rspress/theme';

export function CustomHomePage() {
const {
page: { routePath },
} = usePageData();

return (
<>
<HomeHero
frontmatter={{
hero: {
name:
`<span class="hero-name">React Native Legal</span>` +
'<br/>' +
`<span class="hero-name">License Kit</span>`,
text: '',
tagline:
`<span class="hero-tagline" style="line-height: 1.4;">` +
'Automagically generate license acknowledgements' +
'\n' +
'for your <ins>React Native app</ins> & <ins>any Node.js</ins> project' +
`</span>`,
actions: [
{ theme: 'brand', text: 'React Native', link: '/docs/react-native' },
{ theme: 'brand', text: 'CLI', link: '/docs/standalone-cli' },
{ theme: 'brand', text: 'API', link: '/docs/programmatic-usage' },
{ theme: 'alt', text: 'GitHub', link: 'https://github.com/callstackincubator/react-native-legal' },
],
},
}}
routePath={routePath}
/>

<HomeFeature
frontmatter={{
features: [
{
title: 'Native Integration',
details:
'Uses native platform tools (LicensePlist for iOS and AboutLibraries for Android) to generate and display licenses.',
icon: '📱',
link: '/docs/react-native',
},
{
title: 'Expo & Bare Workflow Support',
details:
'Works with both Expo managed workflow via Config Plugin and React Native CLI via custom command.',
icon: '🔌',
link: '/docs/react-native#setup',
},
{
title: 'NodeJS / Non-RN Projects Support',
details:
'Works with any Node.js project, not just React Native apps. Use it to generate license reports for any Node.js application.',
icon: '💻',
link: '/docs/standalone-cli',
},
{
title: 'Versatile output formats (CLI & Programmatic)',
details:
'Generate license reports in a format of choice (JSON, Markdown, raw text, AboutLibraries-compatible JSON metadata).',
icon: '📝',
link: '/docs/standalone-cli#command-line-options',
},
{
title: 'Programmatic API',
details:
'Core functionalities are exposed as an importable package you can use programmatically and adjust the presentation / processing of the report contents.',
icon: '🛠️',
link: '/docs/programmatic-usage',
},
{
title: 'Automatic Scanning',
details:
'Automatically scans your dependencies and generates license information for both iOS and Android platforms.',
icon: '🔎',
link: '/docs/react-native',
},
],
}}
routePath={routePath}
/>

<div className="docs-introduction-cta">
<span
onClick={() => {
window.location.pathname = routePath + (routePath.endsWith('/') ? '' : '/') + 'docs/introduction';
}}
>
<Button text="Not sure, which to choose?" theme="alt" type="button" size="medium" />
</span>
</div>

<div className="home-footer-wrapper">
<HomeFooter />
</div>
</>
);
}
25 changes: 25 additions & 0 deletions docs/components/PackagesPresentation.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { LinkCard } from 'rspress/theme';

export function PackagesPresentation() {
return (
<div className="flex-intro-cards">
<LinkCard
href="/react-native-legal/docs/react-native"
title="React Native"
description="I'm using React Native, either bare (RN CLI) or with Expo and want to display a licenses screen in my app."
/>

<LinkCard
href="/react-native-legal/docs/standalone-cli"
title="Node.js CLI"
description="I'm building a Node.js app or a non-React-Native project and want to generate license reports for my dependencies."
/>

<LinkCard
href="/react-native-legal/docs/programmatic-usage"
title="Programmatic API"
description="I want to use the core functionalities but adjust the presentation of the license report, or process the data in a different way."
/>
</div>
);
}
Loading
Loading