-
-
Notifications
You must be signed in to change notification settings - Fork 237
Expand file tree
/
Copy pathapp.plugin.js
More file actions
44 lines (38 loc) · 1.15 KB
/
app.plugin.js
File metadata and controls
44 lines (38 loc) · 1.15 KB
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
const {
createRunOncePlugin,
withGradleProperties,
withPodfileProperties,
} = require('@expo/config-plugins');
const pkg = require('./package.json');
function ensureGradleProperty(gradleProperties, name, value) {
const property = gradleProperties.find((item) => item.name === name);
if (property) {
property.value = value;
} else {
gradleProperties.push({ type: 'property', name, value });
}
}
function withAndroidNewArchitecture(config) {
return withGradleProperties(config, (modConfig) => {
ensureGradleProperty(modConfig.modResults, 'newArchEnabled', 'true');
ensureGradleProperty(modConfig.modResults, 'expo.jsEngine', 'hermes');
return modConfig;
});
}
function withIosNewArchitecture(config) {
return withPodfileProperties(config, (modConfig) => {
modConfig.modResults.new_arch_enabled = 'true';
modConfig.modResults.RCT_NEW_ARCH_ENABLED = '1';
return modConfig;
});
}
function withSensitiveInfoExpo(config) {
config = withAndroidNewArchitecture(config);
config = withIosNewArchitecture(config);
return config;
}
module.exports = createRunOncePlugin(
withSensitiveInfoExpo,
pkg.name,
pkg.version
);