react-native-legal 1.4.0 → 1.4.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
@@ -190,7 +190,7 @@ You can use the `@callstack/licenses` package to access the core functionalities
190
190
 
191
191
  ## Contributing
192
192
 
193
- See the [contributing guide](./CONTRIBUTING) to learn how to contribute to the repository and the development workflow.
193
+ See the [contributing guide](./CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.
194
194
 
195
195
  ## Acknowledgements
196
196
 
@@ -31,7 +31,8 @@ object ReactNativeLegalModuleImpl {
31
31
  cachedData = retrieveLibrariesArray(reactContext)
32
32
  }
33
33
 
34
- return Arguments.createMap().apply { putArray("data", Arguments.fromList(cachedData)) }
34
+ val libraries = cachedData ?: emptyList<Bundle>()
35
+ return Arguments.createMap().apply { putArray("data", Arguments.fromList(libraries)) }
35
36
  }
36
37
 
37
38
  private fun retrieveLibrariesArray(reactContext: ReactApplicationContext): List<Bundle>? {
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.androidCommand = void 0;
7
- const path_1 = __importDefault(require("path"));
7
+ const node_path_1 = __importDefault(require("node:path"));
8
8
  const licenses_1 = require("@callstack/licenses");
9
9
  const addListActivity_1 = require("./addListActivity");
10
10
  const applyAndConfigureAboutLibrariesPlugin_1 = require("./applyAndConfigureAboutLibrariesPlugin");
@@ -16,7 +16,7 @@ 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, licenses_1.scanDependencies)(path_1.default.join(path_1.default.resolve(androidProjectPath, '..'), 'package.json'));
19
+ const licenses = (0, licenses_1.scanDependencies)(node_path_1.default.join(node_path_1.default.resolve(androidProjectPath, '..'), 'package.json'));
20
20
  (0, licenses_1.writeAboutLibrariesNPMOutput)(licenses, androidProjectPath);
21
21
  (0, declareAboutLibrariesPlugin_1.declareAboutLibrariesPlugin)(androidProjectPath);
22
22
  (0, applyAndConfigureAboutLibrariesPlugin_1.applyAndConfigureAboutLibrariesPlugin)(androidProjectPath);
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.modifyXMLFileContent = exports.modifyFileContent = void 0;
7
- const fs_1 = __importDefault(require("fs"));
7
+ const node_fs_1 = __importDefault(require("node:fs"));
8
8
  const xml2js_1 = __importDefault(require("xml2js"));
9
9
  /**
10
10
  * Used to modify a file at a specified file path
@@ -13,9 +13,9 @@ const xml2js_1 = __importDefault(require("xml2js"));
13
13
  * The modified result should be returned from a callback parameter as a utf-8 string
14
14
  */
15
15
  function modifyFileContent(filepath, transformFile) {
16
- const content = fs_1.default.readFileSync(filepath, { encoding: 'utf-8' });
16
+ const content = node_fs_1.default.readFileSync(filepath, { encoding: 'utf-8' });
17
17
  const modifiedContent = transformFile(content);
18
- fs_1.default.writeFileSync(filepath, modifiedContent);
18
+ node_fs_1.default.writeFileSync(filepath, modifiedContent);
19
19
  }
20
20
  exports.modifyFileContent = modifyFileContent;
21
21
  /**
@@ -26,12 +26,12 @@ exports.modifyFileContent = modifyFileContent;
26
26
  */
27
27
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
28
28
  async function modifyXMLFileContent(filepath, transformXMLFile) {
29
- const content = fs_1.default.readFileSync(filepath, { encoding: 'utf-8' });
29
+ const content = node_fs_1.default.readFileSync(filepath, { encoding: 'utf-8' });
30
30
  const parser = new xml2js_1.default.Parser();
31
31
  const obj = await parser.parseStringPromise(content);
32
32
  const modifiedObj = transformXMLFile(obj);
33
33
  const builder = new xml2js_1.default.Builder({ headless: true });
34
34
  const modifiedContent = builder.buildObject(modifiedObj);
35
- fs_1.default.writeFileSync(filepath, modifiedContent);
35
+ node_fs_1.default.writeFileSync(filepath, modifiedContent);
36
36
  }
37
37
  exports.modifyXMLFileContent = modifyXMLFileContent;
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.iosCommand = void 0;
7
- const path_1 = __importDefault(require("path"));
7
+ const node_path_1 = __importDefault(require("node:path"));
8
8
  const licenses_1 = require("@callstack/licenses");
9
9
  const addSettingsBundle_1 = require("./addSettingsBundle");
10
10
  const registerLicensePlistBuildPhase_1 = require("./registerLicensePlistBuildPhase");
@@ -15,7 +15,7 @@ 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, licenses_1.scanDependencies)(path_1.default.join(path_1.default.resolve(iosProjectPath, '..'), 'package.json'));
18
+ const licenses = (0, licenses_1.scanDependencies)(node_path_1.default.join(node_path_1.default.resolve(iosProjectPath, '..'), 'package.json'));
19
19
  (0, licenses_1.writeLicensePlistNPMOutput)(licenses, iosProjectPath);
20
20
  (0, addSettingsBundle_1.addSettingsBundle)(iosProjectPath);
21
21
  (0, registerLicensePlistBuildPhase_1.registerLicensePlistBuildPhase)(iosProjectPath);
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.getIOSPbxProj = exports.getIOSProjectName = exports.addToAllPbxResourcesBuildPhases = exports.getAllApplicationNativeTargets = exports.getFirstApplicationNativeTarget = void 0;
7
- const path_1 = __importDefault(require("path"));
7
+ const node_path_1 = __importDefault(require("node:path"));
8
8
  const glob_1 = __importDefault(require("glob"));
9
9
  const xcode_1 = __importDefault(require("xcode"));
10
10
  const ignoredPaths = ['**/@(Carthage|Pods|vendor|node_modules)/**'];
@@ -74,7 +74,7 @@ function getIOSProjectName(iosProjectPath) {
74
74
  nodir: true,
75
75
  ignore: ignoredPaths,
76
76
  });
77
- return path_1.default.basename(path_1.default.dirname(appDelegatePath));
77
+ return node_path_1.default.basename(node_path_1.default.dirname(appDelegatePath));
78
78
  }
79
79
  exports.getIOSProjectName = getIOSProjectName;
80
80
  /**
@@ -88,7 +88,7 @@ function getIOSPbxProj(iosProjectPath) {
88
88
  nodir: false,
89
89
  ignore: ignoredPaths,
90
90
  });
91
- const pbxprojPath = path_1.default.join(xcodeprojPath, 'project.pbxproj');
91
+ const pbxprojPath = node_path_1.default.join(xcodeprojPath, 'project.pbxproj');
92
92
  const pbxproj = xcode_1.default.project(pbxprojPath);
93
93
  pbxproj.parseSync();
94
94
  return { pbxproj, pbxprojPath };
@@ -1,4 +1,4 @@
1
- import path from 'path';
1
+ import path from 'node:path';
2
2
 
3
3
  import { scanDependencies, writeAboutLibrariesNPMOutput } from '@callstack/licenses';
4
4
 
@@ -1,4 +1,4 @@
1
- import fs from 'fs';
1
+ import fs from 'node:fs';
2
2
 
3
3
  import xml2js from 'xml2js';
4
4
 
@@ -1,4 +1,4 @@
1
- import path from 'path';
1
+ import path from 'node:path';
2
2
 
3
3
  import { scanDependencies, writeLicensePlistNPMOutput } from '@callstack/licenses';
4
4
 
@@ -1,4 +1,4 @@
1
- import path from 'path';
1
+ import path from 'node:path';
2
2
 
3
3
  import glob from 'glob';
4
4
  import type { XcodeProject } from 'xcode';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-legal",
3
- "version": "1.4.0",
3
+ "version": "1.4.1",
4
4
  "description": "Acknowledge OSS libraries used in your React Native app",
5
5
  "keywords": [
6
6
  "react-native",
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.withAndroidLegal = void 0;
7
- const path_1 = __importDefault(require("path"));
7
+ const node_path_1 = __importDefault(require("node:path"));
8
8
  const licenses_1 = require("@callstack/licenses");
9
9
  const config_plugins_1 = require("expo/config-plugins");
10
10
  const addListActivity_1 = require("./addListActivity");
@@ -18,7 +18,7 @@ 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, licenses_1.scanDependencies)(path_1.default.join(exportedConfig.modRequest.projectRoot, 'package.json'));
21
+ const licenses = (0, licenses_1.scanDependencies)(node_path_1.default.join(exportedConfig.modRequest.projectRoot, 'package.json'));
22
22
  (0, licenses_1.writeAboutLibrariesNPMOutput)(licenses, exportedConfig.modRequest.platformProjectRoot);
23
23
  return exportedConfig;
24
24
  });
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.withIosLegal = void 0;
7
- const path_1 = __importDefault(require("path"));
7
+ const node_path_1 = __importDefault(require("node:path"));
8
8
  const licenses_1 = require("@callstack/licenses");
9
9
  const config_plugins_1 = require("expo/config-plugins");
10
10
  const addSettingsBundle_1 = require("./addSettingsBundle");
@@ -17,7 +17,7 @@ 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, licenses_1.scanDependencies)(path_1.default.join(exportedConfig.modRequest.projectRoot, 'package.json'));
20
+ const licenses = (0, licenses_1.scanDependencies)(node_path_1.default.join(exportedConfig.modRequest.projectRoot, 'package.json'));
21
21
  (0, licenses_1.writeLicensePlistNPMOutput)(licenses, exportedConfig.modRequest.platformProjectRoot);
22
22
  return exportedConfig;
23
23
  });
@@ -1,4 +1,4 @@
1
- import path from 'path';
1
+ import path from 'node:path';
2
2
 
3
3
  import { scanDependencies, writeAboutLibrariesNPMOutput } from '@callstack/licenses';
4
4
  import { type ConfigPlugin, withAndroidManifest } from 'expo/config-plugins';
@@ -1,4 +1,4 @@
1
- import path from 'path';
1
+ import path from 'node:path';
2
2
 
3
3
  import { scanDependencies, writeLicensePlistNPMOutput } from '@callstack/licenses';
4
4
  import { type ConfigPlugin, withXcodeProject } from 'expo/config-plugins';
@@ -4,23 +4,23 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.registerLicensePlistBuildPhaseUtil = exports.addSettingsBundleUtil = void 0;
7
- const fs_1 = __importDefault(require("fs"));
8
- const path_1 = __importDefault(require("path"));
7
+ const node_fs_1 = __importDefault(require("node:fs"));
8
+ const node_path_1 = __importDefault(require("node:path"));
9
9
  /**
10
10
  * Creates a Settings.bundle from a template and invokes a callback responsible for linking new file to the iOS project
11
11
  */
12
12
  function addSettingsBundleUtil(iosProjectPath, addResourceFileToGroup) {
13
13
  const settingsBundleFilename = 'Settings.bundle';
14
14
  const settingsBundleRootPlistFilename = 'Root.plist';
15
- const settingsBundlePath = path_1.default.join(iosProjectPath, settingsBundleFilename);
16
- const settingsBundleRootPlistPath = path_1.default.join(settingsBundlePath, settingsBundleRootPlistFilename);
17
- if (!fs_1.default.existsSync(settingsBundleRootPlistPath)) {
15
+ const settingsBundlePath = node_path_1.default.join(iosProjectPath, settingsBundleFilename);
16
+ const settingsBundleRootPlistPath = node_path_1.default.join(settingsBundlePath, settingsBundleRootPlistFilename);
17
+ if (!node_fs_1.default.existsSync(settingsBundleRootPlistPath)) {
18
18
  // Create `Settings.bundle` directory
19
- if (!fs_1.default.existsSync(settingsBundlePath)) {
20
- fs_1.default.mkdirSync(settingsBundlePath, { recursive: true });
19
+ if (!node_fs_1.default.existsSync(settingsBundlePath)) {
20
+ node_fs_1.default.mkdirSync(settingsBundlePath, { recursive: true });
21
21
  }
22
22
  // Create `Settings.bundle/Root.plist`
23
- fs_1.default.writeFileSync(settingsBundleRootPlistPath, SETTINGS_BUNDLE_ROOT_PLIST_CONTENT);
23
+ node_fs_1.default.writeFileSync(settingsBundleRootPlistPath, SETTINGS_BUNDLE_ROOT_PLIST_CONTENT);
24
24
  // Link `Settings.bundle` to the resources
25
25
  addResourceFileToGroup({ settingsBundleFilename });
26
26
  console.log('Settings.bundle/Root.plist - ADDED');
@@ -1,5 +1,5 @@
1
- import fs from 'fs';
2
- import path from 'path';
1
+ import fs from 'node:fs';
2
+ import path from 'node:path';
3
3
 
4
4
  import type { XcodeProject } from 'xcode';
5
5