react-native-legal
Version:
Acknowledge OSS libraries used in your React Native app
29 lines (28 loc) • 1.47 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.withIosLegal = void 0;
const node_path_1 = __importDefault(require("node:path"));
const licenses_1 = require("@callstack/licenses");
const config_plugins_1 = require("expo/config-plugins");
const addSettingsBundle_1 = require("./addSettingsBundle");
const registerLicensePlistBuildPhase_1 = require("./registerLicensePlistBuildPhase");
/**
* Implementation of config plugin for iOS setup
*
* It scans the NPM dependencies, generates LicensePlist-compatible metadata,
* configures Settings.bundle and registers a shell script generating LicensePlist metadata for iOS dependencies
*/
const withIosLegal = (config, { scanOptionsFactory }) => {
(0, config_plugins_1.withXcodeProject)(config, async (exportedConfig) => {
const licenses = (0, licenses_1.scanDependencies)(node_path_1.default.join(exportedConfig.modRequest.projectRoot, 'package.json'), scanOptionsFactory);
(0, licenses_1.writeLicensePlistNPMOutput)(licenses, exportedConfig.modRequest.platformProjectRoot);
return exportedConfig;
});
config = (0, addSettingsBundle_1.addSettingsBundle)(config);
config = (0, registerLicensePlistBuildPhase_1.registerLicensePlistBuildPhase)(config);
return config;
};
exports.withIosLegal = withIosLegal;