react-native-legal 1.4.0 → 1.5.0
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 +1 -1
- package/android/src/main/java/com/reactnativelegal/ReactNativeLegalModuleImpl.kt +2 -1
- package/bare-plugin/build/android/androidCommand.js +2 -2
- package/bare-plugin/build/android/utils.js +5 -5
- package/bare-plugin/build/ios/iosCommand.js +2 -2
- package/bare-plugin/build/ios/utils.js +3 -3
- package/bare-plugin/src/android/androidCommand.ts +1 -1
- package/bare-plugin/src/android/utils.ts +1 -1
- package/bare-plugin/src/ios/iosCommand.ts +1 -1
- package/bare-plugin/src/ios/utils.ts +1 -1
- package/package.json +2 -2
- package/plugin/build/android/withAndroidLegal.js +2 -2
- package/plugin/build/ios/withIosLegal.js +2 -2
- package/plugin/src/android/withAndroidLegal.ts +1 -1
- package/plugin/src/ios/withIosLegal.ts +1 -1
- package/plugin-utils/build/ios.js +8 -8
- package/plugin-utils/src/ios.ts +2 -2
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
|
-
|
|
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
|
|
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)(
|
|
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
|
|
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 =
|
|
16
|
+
const content = node_fs_1.default.readFileSync(filepath, { encoding: 'utf-8' });
|
|
17
17
|
const modifiedContent = transformFile(content);
|
|
18
|
-
|
|
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 =
|
|
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
|
-
|
|
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
|
|
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)(
|
|
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
|
|
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
|
|
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 =
|
|
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 };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-legal",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"description": "Acknowledge OSS libraries used in your React Native app",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react-native",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"react-native-builder-bob": "0.23.1"
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"@callstack/licenses": "^0.
|
|
61
|
+
"@callstack/licenses": "^0.3.0",
|
|
62
62
|
"glob": "^7.1.3",
|
|
63
63
|
"xcode": "^3.0.1",
|
|
64
64
|
"xml2js": "^0.6.2"
|
|
@@ -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
|
|
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)(
|
|
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
|
|
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)(
|
|
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
|
});
|
|
@@ -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
|
|
8
|
-
const
|
|
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 =
|
|
16
|
-
const settingsBundleRootPlistPath =
|
|
17
|
-
if (!
|
|
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 (!
|
|
20
|
-
|
|
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
|
-
|
|
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');
|
package/plugin-utils/src/ios.ts
CHANGED