-
Notifications
You must be signed in to change notification settings - Fork 99
/
install.js
29 lines (26 loc) · 1.17 KB
/
install.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
const fs = require('fs');
const path = require('path');
const configPath = path.join(process.cwd(), '../../package.json');
if (fs.existsSync(configPath)) {
const rnpmConfig = require('./local-cli/core/config');
const link = require('./local-cli/link/link.js');
const xcode = require('xcode');
const getPlist = require('./local-cli/link/ios/getPlist');
const getPlistPath = require('./local-cli/link/ios/getPlistPath');
const plistParser = require('plist');
const config = {
getProjectConfig: rnpmConfig.getProjectConfig,
getDependencyConfig: rnpmConfig.getDependencyConfig,
};
const projectConfig = config.getProjectConfig(path.join(process.cwd(), '../../'));
const project = xcode.project(projectConfig.ios.pbxprojPath).parseSync();
const plist = getPlist(project, projectConfig.ios.sourceDir);
if (!plist.NSPhotoLibraryUsageDescription) {
plist.NSPhotoLibraryUsageDescription = 'Using photo library to select pictures';
console.log('Added NSPhotoLibraryUsageDescription to Info.plist');
}
fs.writeFileSync(
getPlistPath(project, projectConfig.ios.sourceDir),
plistParser.build(plist)
);
}