react-native-legal 1.2.0 → 1.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,13 +1,51 @@
1
- # `react-native-legal`
2
-
3
- Automagically generate license acknowledgements for your React Native app 🚀
4
-
5
- | Android | iOS | AndroidTV | tvOS |
6
- | - | - | - | - |
7
- | ![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) |
1
+ <a href="https://www.callstack.com/open-source?utm_campaign=generic&utm_source=github&utm_medium=referral&utm_content=react-native-legal" align="center">
2
+ <picture>
3
+ <img alt="React Native Legal" src="https://github.com/callstackincubator/react-native-legal/raw/refs/heads/main/images/rn-legal-banner.jpg">
4
+ </picture>
5
+ </a>
6
+
7
+ <p align="center">
8
+ <b>React Native Legal</b> - Automagically generate license acknowledgements for your React Native app 🚀
9
+ </p>
10
+
11
+ ---
12
+
13
+ ![Release](https://github.com/callstackincubator/react-native-legal/actions/workflows/release.yml/badge.svg)
14
+ ![Deploy Docs](https://github.com/callstackincubator/react-native-legal/actions/workflows/deploy-docs.yml/badge.svg)
15
+ ![Integration tests - License Kit (Node)](https://github.com/callstackincubator/react-native-legal/actions/workflows/test-integration-node.yml/badge.svg)
16
+ ![Unit tests - @callstack/licenses](https://github.com/callstackincubator/react-native-legal/actions/workflows/test-unit-licenses-api.yml/badge.svg)
17
+ ![E2E tests - Android](https://github.com/callstackincubator/react-native-legal/actions/workflows/test-e2e-android.yaml/badge.svg)
18
+ ![E2E tests - iOS](https://github.com/callstackincubator/react-native-legal/actions/workflows/test-e2e-ios.yaml/badge.svg)
19
+
20
+ - [Documentation](#documentation)
21
+ - [Installation](#installation)
22
+ - [React Native](#react-native)
23
+ - [Standalone CLI](#standalone-cli)
24
+ - [Node.js - API](#nodejs---api)
25
+ - [Usage](#usage)
26
+ - [I want to generate licenses in my Expo project ](#i-want-to-generate-licenses-in-my-expo-project-)
27
+ - [I want to generate licenses reports in my bare RN project ](#i-want-to-generate-licenses-reports-in-my-bare-rn-project-)
28
+ - [I want to generate licenses reports in my Node.js project](#i-want-to-generate-licenses-reports-in-my-nodejs-project)
29
+ - [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)
30
+ - [Expo](#expo)
31
+ - [Contributing](#contributing)
32
+ - [Acknowledgements](#acknowledgements)
33
+ - [License](#license)
34
+
35
+ Automagically generate license acknowledgements for your React Native app and any Node.js project 🚀
36
+
37
+ | Android | iOS | AndroidTV | tvOS |
38
+ | ------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- |
39
+ | ![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-bare.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) |
40
+
41
+ ## Documentation
42
+
43
+ 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/).
8
44
 
9
45
  ## Installation
10
46
 
47
+ ### React Native
48
+
11
49
  ```sh
12
50
  yarn add react-native-legal
13
51
  ```
@@ -18,11 +56,38 @@ or
18
56
  npm i --save react-native-legal
19
57
  ```
20
58
 
59
+ ### Standalone CLI
60
+
61
+ ```sh
62
+ yarn add -D license-kit
63
+ ```
64
+
65
+ or
66
+
67
+ ```sh
68
+ npm i --save-dev license-kit
69
+ ```
70
+
71
+ ### Node.js - API
72
+
73
+ ```sh
74
+ yarn add -D @callstack/licenses
75
+ ```
76
+
77
+ or
78
+
79
+ ```sh
80
+ npm i --save-dev @callstack/licenses
81
+ ```
82
+
21
83
  ## Usage
22
84
 
23
- This tool is split into 2 parts:
24
- - a library that lets you display native screen with a list of all dependencies and their licenses
25
- - 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)
85
+ This tool is split into 4 parts:
86
+
87
+ - a React Native library that lets you display native screen with a list of all dependencies and their licenses
88
+ - 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)
89
+ - a standalone CLI tool that can be used in any Node.js project to generate license metadata (`license-kit`)
90
+ - a shared package that exposes the core functionality of the license management tool, allowing customization of presentation logic in your Node.js scripts (`@callstack/licenses`)
26
91
 
27
92
  ### I want to generate licenses in my Expo project <a name="usage-expo"></a>
28
93
 
@@ -60,7 +125,7 @@ function MyComponent() {
60
125
 
61
126
  3. Use [Prebuild](https://docs.expo.dev/workflow/prebuild/) or [EAS](https://docs.expo.dev/eas/) to build the app
62
127
 
63
- ### I want to generate licenses in my bare RN project <a name="usage-bare-rn"></a>
128
+ ### I want to generate licenses reports in my bare RN project <a name="usage-bare-rn"></a>
64
129
 
65
130
  1. Invoke the CLI plugin from the root of your RN app
66
131
 
@@ -94,6 +159,30 @@ function MyComponent() {
94
159
  }
95
160
  ```
96
161
 
162
+ ### I want to generate licenses reports in my Node.js project
163
+
164
+ You can use the `license-kit` CLI tool to generate license reports in your Node.js project. Here's how to do it:
165
+
166
+ 1. Run the CLI tool from the root of your Node.js project:
167
+
168
+ ```sh
169
+ npx license-kit report --format markdown --output ./public/licenses.md
170
+ ```
171
+
172
+ or
173
+
174
+ ```sh
175
+ yarn license-kit report --format markdown --output ./public/licenses.md
176
+ ```
177
+
178
+ 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).
179
+
180
+ 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`.
181
+
182
+ ### I want to customize the presentation of the licenses in my JS/TS project
183
+
184
+ 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](https://callstackincubator.github.io/react-native-legal/docs/programmatic-usage#usage).
185
+
97
186
  ## Expo
98
187
 
99
188
  - ✅ 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.
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.androidCommand = void 0;
7
7
  const path_1 = __importDefault(require("path"));
8
- const common_1 = require("../../../plugin-utils/build/common");
8
+ const licenses_1 = require("@callstack/licenses");
9
9
  const addListActivity_1 = require("./addListActivity");
10
10
  const applyAndConfigureAboutLibrariesPlugin_1 = require("./applyAndConfigureAboutLibrariesPlugin");
11
11
  const declareAboutLibrariesPlugin_1 = require("./declareAboutLibrariesPlugin");
@@ -16,8 +16,8 @@ const declareAboutLibrariesPlugin_1 = require("./declareAboutLibrariesPlugin");
16
16
  * installs & configures AboutLibraries Gradle plugin and adds Android Activity with a list of dependencies and their licenses
17
17
  */
18
18
  function androidCommand(androidProjectPath) {
19
- const licenses = (0, common_1.scanDependencies)(path_1.default.join(path_1.default.resolve(androidProjectPath, '..'), 'package.json'));
20
- (0, common_1.generateAboutLibrariesNPMOutput)(licenses, androidProjectPath);
19
+ const licenses = (0, licenses_1.scanDependencies)(path_1.default.join(path_1.default.resolve(androidProjectPath, '..'), 'package.json'));
20
+ (0, licenses_1.writeAboutLibrariesNPMOutput)(licenses, androidProjectPath);
21
21
  (0, declareAboutLibrariesPlugin_1.declareAboutLibrariesPlugin)(androidProjectPath);
22
22
  (0, applyAndConfigureAboutLibrariesPlugin_1.applyAndConfigureAboutLibrariesPlugin)(androidProjectPath);
23
23
  (0, addListActivity_1.addListActivity)(androidProjectPath);
@@ -1,2 +1,2 @@
1
- declare function generateLegal(androidProjectPath: string, iosProjectPath: string): void;
1
+ declare function generateLegal(androidProjectPath: string | undefined, iosProjectPath: string | undefined): void;
2
2
  export default generateLegal;
@@ -3,7 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const androidCommand_1 = require("./android/androidCommand");
4
4
  const iosCommand_1 = require("./ios/iosCommand");
5
5
  function generateLegal(androidProjectPath, iosProjectPath) {
6
- (0, androidCommand_1.androidCommand)(androidProjectPath);
7
- (0, iosCommand_1.iosCommand)(iosProjectPath);
6
+ if (androidProjectPath) {
7
+ (0, androidCommand_1.androidCommand)(androidProjectPath);
8
+ }
9
+ if (iosProjectPath) {
10
+ (0, iosCommand_1.iosCommand)(iosProjectPath);
11
+ }
8
12
  }
9
13
  exports.default = generateLegal;
@@ -14,6 +14,7 @@ function addSettingsBundle(iosProjectPath) {
14
14
  (0, ios_1.addSettingsBundleUtil)(iosProjectPath, ({ settingsBundleFilename }) => {
15
15
  const projectName = (0, utils_1.getIOSProjectName)(iosProjectPath);
16
16
  const { pbxproj, pbxprojPath } = (0, utils_1.getIOSPbxProj)(iosProjectPath);
17
+ pbxproj.removeFile(settingsBundleFilename, pbxproj.findPBXGroupKey({ name: projectName }));
17
18
  const settingsBundleFile = pbxproj.addFile(settingsBundleFilename, pbxproj.findPBXGroupKey({ name: projectName }));
18
19
  if (!settingsBundleFile) {
19
20
  throw new Error('Could not add Settings.bundle file reference to xcode project');
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.iosCommand = void 0;
7
7
  const path_1 = __importDefault(require("path"));
8
- const common_1 = require("../../../plugin-utils/build/common");
8
+ const licenses_1 = require("@callstack/licenses");
9
9
  const addSettingsBundle_1 = require("./addSettingsBundle");
10
10
  const registerLicensePlistBuildPhase_1 = require("./registerLicensePlistBuildPhase");
11
11
  /**
@@ -15,8 +15,8 @@ const registerLicensePlistBuildPhase_1 = require("./registerLicensePlistBuildPha
15
15
  * configures Settings.bundle and registers a shell script generating LicensePlist metadata for iOS dependencies
16
16
  */
17
17
  function iosCommand(iosProjectPath) {
18
- const licenses = (0, common_1.scanDependencies)(path_1.default.join(path_1.default.resolve(iosProjectPath, '..'), 'package.json'));
19
- (0, common_1.generateLicensePlistNPMOutput)(licenses, iosProjectPath);
18
+ const licenses = (0, licenses_1.scanDependencies)(path_1.default.join(path_1.default.resolve(iosProjectPath, '..'), 'package.json'));
19
+ (0, licenses_1.writeLicensePlistNPMOutput)(licenses, iosProjectPath);
20
20
  (0, addSettingsBundle_1.addSettingsBundle)(iosProjectPath);
21
21
  (0, registerLicensePlistBuildPhase_1.registerLicensePlistBuildPhase)(iosProjectPath);
22
22
  }
@@ -5,8 +5,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.getIOSPbxProj = exports.getIOSProjectName = exports.addToAllPbxResourcesBuildPhases = exports.getAllApplicationNativeTargets = exports.getFirstApplicationNativeTarget = void 0;
7
7
  const path_1 = __importDefault(require("path"));
8
+ const glob_1 = __importDefault(require("glob"));
8
9
  const xcode_1 = __importDefault(require("xcode"));
9
- const glob = require('glob');
10
10
  const ignoredPaths = ['**/@(Carthage|Pods|vendor|node_modules)/**'];
11
11
  /**
12
12
  * Used to obtain first target of type "com.apple.product-type.application"
@@ -67,7 +67,7 @@ exports.addToAllPbxResourcesBuildPhases = addToAllPbxResourcesBuildPhases;
67
67
  * Returns the name of the main group in the project (the main folder where `AppDelegate` usually lives)
68
68
  */
69
69
  function getIOSProjectName(iosProjectPath) {
70
- const [appDelegatePath] = glob.sync('*/AppDelegate.@(m|mm|swift)', {
70
+ const [appDelegatePath] = glob_1.default.sync('*/AppDelegate.@(m|mm|swift)', {
71
71
  cwd: iosProjectPath,
72
72
  absolute: true,
73
73
  nocase: true,
@@ -81,7 +81,7 @@ exports.getIOSProjectName = getIOSProjectName;
81
81
  * Used to grab the XcodeProject instance
82
82
  */
83
83
  function getIOSPbxProj(iosProjectPath) {
84
- const [xcodeprojPath] = glob.sync('*.xcodeproj', {
84
+ const [xcodeprojPath] = glob_1.default.sync('*.xcodeproj', {
85
85
  cwd: iosProjectPath,
86
86
  absolute: true,
87
87
  nocase: true,
@@ -1,6 +1,6 @@
1
1
  import path from 'path';
2
2
 
3
- import { generateAboutLibrariesNPMOutput, scanDependencies } from '../../../plugin-utils/build/common';
3
+ import { scanDependencies, writeAboutLibrariesNPMOutput } from '@callstack/licenses';
4
4
 
5
5
  import { addListActivity } from './addListActivity';
6
6
  import { applyAndConfigureAboutLibrariesPlugin } from './applyAndConfigureAboutLibrariesPlugin';
@@ -15,7 +15,7 @@ import { declareAboutLibrariesPlugin } from './declareAboutLibrariesPlugin';
15
15
  export function androidCommand(androidProjectPath: string) {
16
16
  const licenses = scanDependencies(path.join(path.resolve(androidProjectPath, '..'), 'package.json'));
17
17
 
18
- generateAboutLibrariesNPMOutput(licenses, androidProjectPath);
18
+ writeAboutLibrariesNPMOutput(licenses, androidProjectPath);
19
19
 
20
20
  declareAboutLibrariesPlugin(androidProjectPath);
21
21
  applyAndConfigureAboutLibrariesPlugin(androidProjectPath);
@@ -1,9 +1,14 @@
1
1
  import { androidCommand } from './android/androidCommand';
2
2
  import { iosCommand } from './ios/iosCommand';
3
3
 
4
- function generateLegal(androidProjectPath: string, iosProjectPath: string) {
5
- androidCommand(androidProjectPath);
6
- iosCommand(iosProjectPath);
4
+ function generateLegal(androidProjectPath: string | undefined, iosProjectPath: string | undefined) {
5
+ if (androidProjectPath) {
6
+ androidCommand(androidProjectPath);
7
+ }
8
+
9
+ if (iosProjectPath) {
10
+ iosCommand(iosProjectPath);
11
+ }
7
12
  }
8
13
 
9
14
  export default generateLegal;
@@ -11,6 +11,9 @@ export function addSettingsBundle(iosProjectPath: string) {
11
11
  addSettingsBundleUtil(iosProjectPath, ({ settingsBundleFilename }) => {
12
12
  const projectName = getIOSProjectName(iosProjectPath);
13
13
  const { pbxproj, pbxprojPath } = getIOSPbxProj(iosProjectPath);
14
+
15
+ pbxproj.removeFile(settingsBundleFilename, pbxproj.findPBXGroupKey({ name: projectName }));
16
+
14
17
  const settingsBundleFile = pbxproj.addFile(settingsBundleFilename, pbxproj.findPBXGroupKey({ name: projectName }));
15
18
 
16
19
  if (!settingsBundleFile) {
@@ -1,6 +1,6 @@
1
1
  import path from 'path';
2
2
 
3
- import { generateLicensePlistNPMOutput, scanDependencies } from '../../../plugin-utils/build/common';
3
+ import { scanDependencies, writeLicensePlistNPMOutput } from '@callstack/licenses';
4
4
 
5
5
  import { addSettingsBundle } from './addSettingsBundle';
6
6
  import { registerLicensePlistBuildPhase } from './registerLicensePlistBuildPhase';
@@ -14,7 +14,7 @@ import { registerLicensePlistBuildPhase } from './registerLicensePlistBuildPhase
14
14
  export function iosCommand(iosProjectPath: string) {
15
15
  const licenses = scanDependencies(path.join(path.resolve(iosProjectPath, '..'), 'package.json'));
16
16
 
17
- generateLicensePlistNPMOutput(licenses, iosProjectPath);
17
+ writeLicensePlistNPMOutput(licenses, iosProjectPath);
18
18
 
19
19
  addSettingsBundle(iosProjectPath);
20
20
  registerLicensePlistBuildPhase(iosProjectPath);
@@ -1,10 +1,9 @@
1
1
  import path from 'path';
2
2
 
3
+ import glob from 'glob';
3
4
  import type { XcodeProject } from 'xcode';
4
5
  import xcode from 'xcode';
5
6
 
6
- const glob = require('glob');
7
-
8
7
  const ignoredPaths = ['**/@(Carthage|Pods|vendor|node_modules)/**'];
9
8
 
10
9
  /**
@@ -17,4 +17,4 @@
17
17
  },
18
18
  "include": ["./src"],
19
19
  "exclude": ["**/__mocks__/*", "**/__tests__/*"]
20
- }
20
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-legal",
3
- "version": "1.2.0",
3
+ "version": "1.3.1",
4
4
  "description": "Acknowledge OSS libraries used in your React Native app",
5
5
  "keywords": [
6
6
  "react-native",
@@ -49,6 +49,7 @@
49
49
  "tsc": "tsc"
50
50
  },
51
51
  "devDependencies": {
52
+ "@types/glob": "^8.1.0",
52
53
  "@types/xml2js": "^0.4.11",
53
54
  "expo": "~52.0.36",
54
55
  "expo-module-scripts": "^4.0.0",
@@ -57,6 +58,7 @@
57
58
  "react-native-builder-bob": "0.23.1"
58
59
  },
59
60
  "dependencies": {
61
+ "@callstack/licenses": "^0.2.1",
60
62
  "glob": "^7.1.3",
61
63
  "xcode": "^3.0.1",
62
64
  "xml2js": "^0.6.2"
@@ -5,8 +5,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.withAndroidLegal = void 0;
7
7
  const path_1 = __importDefault(require("path"));
8
+ const licenses_1 = require("@callstack/licenses");
8
9
  const config_plugins_1 = require("expo/config-plugins");
9
- const common_1 = require("../../../plugin-utils/build/common");
10
10
  const addListActivity_1 = require("./addListActivity");
11
11
  const applyAndConfigureAboutLibrariesPlugin_1 = require("./applyAndConfigureAboutLibrariesPlugin");
12
12
  const declareAboutLibrariesPlugin_1 = require("./declareAboutLibrariesPlugin");
@@ -18,8 +18,8 @@ const declareAboutLibrariesPlugin_1 = require("./declareAboutLibrariesPlugin");
18
18
  */
19
19
  const withAndroidLegal = (config) => {
20
20
  (0, config_plugins_1.withAndroidManifest)(config, async (exportedConfig) => {
21
- const licenses = (0, common_1.scanDependencies)(path_1.default.join(exportedConfig.modRequest.projectRoot, 'package.json'));
22
- (0, common_1.generateAboutLibrariesNPMOutput)(licenses, exportedConfig.modRequest.platformProjectRoot);
21
+ const licenses = (0, licenses_1.scanDependencies)(path_1.default.join(exportedConfig.modRequest.projectRoot, 'package.json'));
22
+ (0, licenses_1.writeAboutLibrariesNPMOutput)(licenses, exportedConfig.modRequest.platformProjectRoot);
23
23
  return exportedConfig;
24
24
  });
25
25
  config = (0, declareAboutLibrariesPlugin_1.declareAboutLibrariesPlugin)(config);
@@ -5,8 +5,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.withIosLegal = void 0;
7
7
  const path_1 = __importDefault(require("path"));
8
+ const licenses_1 = require("@callstack/licenses");
8
9
  const config_plugins_1 = require("expo/config-plugins");
9
- const common_1 = require("../../../plugin-utils/build/common");
10
10
  const addSettingsBundle_1 = require("./addSettingsBundle");
11
11
  const registerLicensePlistBuildPhase_1 = require("./registerLicensePlistBuildPhase");
12
12
  /**
@@ -17,8 +17,8 @@ const registerLicensePlistBuildPhase_1 = require("./registerLicensePlistBuildPha
17
17
  */
18
18
  const withIosLegal = (config) => {
19
19
  (0, config_plugins_1.withXcodeProject)(config, async (exportedConfig) => {
20
- const licenses = (0, common_1.scanDependencies)(path_1.default.join(exportedConfig.modRequest.projectRoot, 'package.json'));
21
- (0, common_1.generateLicensePlistNPMOutput)(licenses, exportedConfig.modRequest.platformProjectRoot);
20
+ const licenses = (0, licenses_1.scanDependencies)(path_1.default.join(exportedConfig.modRequest.projectRoot, 'package.json'));
21
+ (0, licenses_1.writeLicensePlistNPMOutput)(licenses, exportedConfig.modRequest.platformProjectRoot);
22
22
  return exportedConfig;
23
23
  });
24
24
  config = (0, addSettingsBundle_1.addSettingsBundle)(config);
@@ -1,9 +1,8 @@
1
1
  import path from 'path';
2
2
 
3
+ import { scanDependencies, writeAboutLibrariesNPMOutput } from '@callstack/licenses';
3
4
  import { type ConfigPlugin, withAndroidManifest } from 'expo/config-plugins';
4
5
 
5
- import { generateAboutLibrariesNPMOutput, scanDependencies } from '../../../plugin-utils/build/common';
6
-
7
6
  import { addListActivity } from './addListActivity';
8
7
  import { applyAndConfigureAboutLibrariesPlugin } from './applyAndConfigureAboutLibrariesPlugin';
9
8
  import { declareAboutLibrariesPlugin } from './declareAboutLibrariesPlugin';
@@ -18,7 +17,7 @@ export const withAndroidLegal: ConfigPlugin = (config) => {
18
17
  withAndroidManifest(config, async (exportedConfig) => {
19
18
  const licenses = scanDependencies(path.join(exportedConfig.modRequest.projectRoot, 'package.json'));
20
19
 
21
- generateAboutLibrariesNPMOutput(licenses, exportedConfig.modRequest.platformProjectRoot);
20
+ writeAboutLibrariesNPMOutput(licenses, exportedConfig.modRequest.platformProjectRoot);
22
21
  return exportedConfig;
23
22
  });
24
23
  config = declareAboutLibrariesPlugin(config);
@@ -1,9 +1,8 @@
1
1
  import path from 'path';
2
2
 
3
+ import { scanDependencies, writeLicensePlistNPMOutput } from '@callstack/licenses';
3
4
  import { type ConfigPlugin, withXcodeProject } from 'expo/config-plugins';
4
5
 
5
- import { generateLicensePlistNPMOutput, scanDependencies } from '../../../plugin-utils/build/common';
6
-
7
6
  import { addSettingsBundle } from './addSettingsBundle';
8
7
  import { registerLicensePlistBuildPhase } from './registerLicensePlistBuildPhase';
9
8
 
@@ -17,7 +16,7 @@ export const withIosLegal: ConfigPlugin = (config) => {
17
16
  withXcodeProject(config, async (exportedConfig) => {
18
17
  const licenses = scanDependencies(path.join(exportedConfig.modRequest.projectRoot, 'package.json'));
19
18
 
20
- generateLicensePlistNPMOutput(licenses, exportedConfig.modRequest.platformProjectRoot);
19
+ writeLicensePlistNPMOutput(licenses, exportedConfig.modRequest.platformProjectRoot);
21
20
  return exportedConfig;
22
21
  });
23
22
  config = addSettingsBundle(config);
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.addListActivityUtil = exports.applyAndConfigureAboutLibrariesPluginUtil = exports.declareAboutLibrariesPluginUtil = void 0;
4
- const common_1 = require("./common");
4
+ const licenses_1 = require("@callstack/licenses");
5
5
  /**
6
6
  * Applies Gradle Plugin Portal & AboutLibraries Gradle plugin repositories (if needed) inside root build.gradle
7
7
  */
@@ -55,7 +55,7 @@ exports.applyAndConfigureAboutLibrariesPluginUtil = applyAndConfigureAboutLibrar
55
55
  */
56
56
  function addListActivityUtil(activities) {
57
57
  const listActivity = prepareListActivity();
58
- if (!(0, common_1.arrayIncludesObject)(activities, listActivity)) {
58
+ if (!licenses_1.MiscUtils.arrayIncludesObject(activities, listActivity)) {
59
59
  activities?.push(listActivity);
60
60
  console.log('About Libraries activity - ADDED');
61
61
  }
@@ -47,7 +47,7 @@ function registerLicensePlistBuildPhaseUtil(projectTargetId, pbxproj) {
47
47
  */
48
48
  const newBuildPhase = pbxproj.addBuildPhase([], 'PBXShellScriptBuildPhase', GENERATE_LICENSE_PLIST_BUILD_PHASE_COMMENT, projectTargetId, {
49
49
  shellPath: '/bin/sh',
50
- shellScript: '${PODS_ROOT}/LicensePlist/license-plist --output-path ./Settings.bundle',
50
+ shellScript: '${PODS_ROOT}/LicensePlist/license-plist --add-version-numbers --output-path ./Settings.bundle',
51
51
  });
52
52
  /**
53
53
  * In order to correctly link all metadata from `Settings.bundle` to the app
@@ -1,4 +1,4 @@
1
- import { arrayIncludesObject } from './common';
1
+ import { MiscUtils } from '@callstack/licenses';
2
2
 
3
3
  /**
4
4
  * Applies Gradle Plugin Portal & AboutLibraries Gradle plugin repositories (if needed) inside root build.gradle
@@ -62,7 +62,7 @@ export function applyAndConfigureAboutLibrariesPluginUtil(androidAppBuildGradleC
62
62
  export function addListActivityUtil<T>(activities: T[]): T[] {
63
63
  const listActivity = prepareListActivity();
64
64
 
65
- if (!arrayIncludesObject(activities, listActivity)) {
65
+ if (!MiscUtils.arrayIncludesObject(activities, listActivity)) {
66
66
  activities?.push(listActivity as T);
67
67
  console.log('About Libraries activity - ADDED');
68
68
  } else {
@@ -59,7 +59,7 @@ export function registerLicensePlistBuildPhaseUtil(
59
59
  projectTargetId,
60
60
  {
61
61
  shellPath: '/bin/sh',
62
- shellScript: '${PODS_ROOT}/LicensePlist/license-plist --output-path ./Settings.bundle',
62
+ shellScript: '${PODS_ROOT}/LicensePlist/license-plist --add-version-numbers --output-path ./Settings.bundle',
63
63
  },
64
64
  );
65
65
  /**
@@ -17,4 +17,4 @@
17
17
  },
18
18
  "include": ["./src"],
19
19
  "exclude": ["**/__mocks__/*", "**/__tests__/*"]
20
- }
20
+ }
@@ -6,7 +6,7 @@ module.exports = {
6
6
  func: ([], { project: { android, ios } }, {}) => {
7
7
  const generateLegal = require('./bare-plugin/build').default;
8
8
 
9
- generateLegal(android.sourceDir, ios.sourceDir);
9
+ generateLegal(android?.sourceDir, ios?.sourceDir);
10
10
  },
11
11
  },
12
12
  ],
@@ -1,46 +0,0 @@
1
- type LicenseObj = {
2
- author?: string;
3
- content?: string;
4
- description?: string;
5
- file?: string;
6
- type?: string;
7
- url?: string;
8
- version: string;
9
- };
10
- /**
11
- * Makes a deep-check between array items and provided object, returns true if array has provided object.
12
- */
13
- export declare function arrayIncludesObject(array?: unknown[], object?: unknown): boolean | undefined;
14
- /**
15
- * Scans `package.json` and searches for all packages under `dependencies` field. Supports monorepo projects.
16
- */
17
- export declare function scanDependencies(appPackageJsonPath: string): Record<string, LicenseObj>;
18
- /**
19
- * Generates LicensePlist-compatible metadata for NPM dependencies
20
- *
21
- * This will take scanned NPM licenses and produce following output inside iOS project's directory:
22
- *
23
- * | - ios
24
- * | ---- myawesomeapp
25
- * | ---- myawesomeapp.xcodeproj
26
- * | ---- myawesomeapp.xcodeworkspace
27
- * | ---- license_plist.yml <--- generated LicensePlist config with NPM dependencies
28
- * | ---- Podfile
29
- * | ---- Podfile.lock
30
- */
31
- export declare function generateLicensePlistNPMOutput(licenses: Record<string, LicenseObj>, iosProjectPath: string): void;
32
- /**
33
- * Generates AboutLibraries-compatible metadata for NPM dependencies
34
- *
35
- * This will take scanned NPM licenses and produce following output inside android project's directory:
36
- *
37
- * | - android
38
- * | ---- app
39
- * | ---- config <--- generated AboutLibraries config directory
40
- * | ------- libraries <--- generated directory with JSON files list of NPM dependencies
41
- * | ------- licenses <--- generated directory with JSON files list of used licenses
42
- * | ---- build.gradle
43
- * | ---- settings.gradle
44
- */
45
- export declare function generateAboutLibrariesNPMOutput(licenses: Record<string, LicenseObj>, androidProjectPath: string): void;
46
- export {};