-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
67 lines (64 loc) · 2.12 KB
/
index.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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
const _ = require('lodash');
const glob = require('glob');
const fs = require('fs');
const inquirer = require('inquirer');
const postlinkAndroid = require('./src/postlink.android');
const postlinkIos = require('./src/postlink.ios');
const postunlinkAndroid = require('./src/postunlink.android');
const postunlinkIos = require('./src/postunlink.ios');
const option = { ignore: ['node_modules/**', '**/build/**'], realpath: true };
// {
// packageName: '',
// framework: {
// path: '',
// files: [],
// },
// compiles: ['com.facebook.android:account-kit-sdk:4.+'],
// permissions: ['RECEIVE_SMS'],
// android: {
// params: [{
// name: 'APP_KEY',
// message: 'What\'s your app key for android ?',
// }],
// activities: {
// 'com.facebook.accountkit.ui.AccountKitEmailRedirectActivity': {
// action: ['VIEW'],
// category: ['DEFAULT', 'BROWSABLE'],
// },
// },
// }
// ios: {
// params: [{
// name: 'APP_KEY',
// message: 'What\'s your app key for ios ?',
// }],
// }
// }
module.exports = {
link: configs => (Promise
.resolve()
.then(() => postlinkAndroid(glob.sync('**/AndroidManifest.xml', option)[0], configs))
.then(({ manifestPath, manifest, gradlePath, gradle }) => {
fs.writeFileSync(manifestPath, manifest);
fs.writeFileSync(gradlePath, gradle);
})
.then(() => postlinkIos(glob.sync('**/*.pbxproj', option)[0], configs))
.then(({ pbxprojPath, pbxproj, plistPath, plist }) => {
fs.writeFileSync(pbxprojPath, pbxproj);
fs.writeFileSync(plistPath, plist);
})
),
unlink: configs => (Promise
.resolve()
.then(() => postunlinkAndroid(glob.sync('**/AndroidManifest.xml', option)[0], configs))
.then(({ manifestPath, manifest, gradlePath, gradle }) => {
fs.writeFileSync(manifestPath, manifest);
fs.writeFileSync(gradlePath, gradle);
})
.then(() => postunlinkIos(glob.sync('**/*.pbxproj', option)[0], configs))
.then(({ pbxprojPath, pbxproj, plistPath, plist }) => {
fs.writeFileSync(pbxprojPath, pbxproj);
fs.writeFileSync(plistPath, plist);
})
),
};