Skip to content

Commit

Permalink
added description, switched to casting, prefixed injections and remov…
Browse files Browse the repository at this point in the history
…ed old ones
  • Loading branch information
mihaiblaga89 committed Feb 1, 2024
1 parent 1a047a5 commit 1a08564
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 54 deletions.
26 changes: 1 addition & 25 deletions packages/core/src/plugins/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -401,14 +401,13 @@ export const parsePlugins = (
if (includedPlugins) {
const { plugins } = c.buildConfig;
if (plugins) {
// let totalIncludedPlugins = 0;
Object.keys(plugins).forEach((key) => {
const plugin = getMergedPlugin(c, key);

if (!plugin) return;

if (
(includedPlugins!.includes('*') || includedPlugins!.includes(key)) &&
((includedPlugins as string[]).includes('*') || (includedPlugins as string[]).includes(key)) &&
!excludedPlugins.includes(key)
) {
const pluginPlat = plugin[platform] || {};
Expand Down Expand Up @@ -456,29 +455,6 @@ export const parsePlugins = (
)} in your ${chalk().white(c.paths.appConfig.config)}. Your app might not work correctly`
);
}

// if (includeDisabledOrExcludedPlugins) {
// const { plugins } = c.buildConfig;
// if (plugins) {
// Object.keys(plugins).forEach((key) => {
// const plugin = getMergedPlugin(c, key);
// if (plugin) {
// const pluginPlat = plugin[platform] || {};
// if (
// plugin.disabled ||
// // ignore pluginPlat.disabled if ignorePlatformObjectCheck is true, otherwise there will be duplicates in the output. See unit test
// (pluginPlat.disabled && !ignorePlatformObjectCheck) ||
// excludedPlugins.includes(key)
// ) {
// if (excludedPlugins.includes(key)) {
// plugin.disabled = true;
// }
// handleActivePlugin(plugin, pluginPlat, key);
// }
// }
// });
// }
// }
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,14 @@ const Podfile = z
.object({
injectLines: z.optional(z.array(z.string())),
post_install: z.optional(z.array(z.string())),
sources: z.optional(z.array(z.string())),
sources: z
.optional(z.array(z.string()))
.describe('Array of URLs that will be injected on top of the Podfile as sources'),
podDependencies: z.optional(z.array(z.string())),
staticPods: z.optional(z.array(z.string())),
header: z.optional(z.array(z.string())),
header: z
.optional(z.array(z.string()))
.describe('Array of strings that will be injected on top of the Podfile'),
})
.describe('Allows to manipulate Podfile');

Expand Down
14 changes: 7 additions & 7 deletions packages/engine-rn/templates/platforms/ios/Podfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{{PLUGIN_PODFILE_SOURCES}}
{{INJECT_PLUGIN_PODFILE_SOURCES}}

{{PODFILE_HEADER}}
{{INJECT_PODFILE_HEADER}}

# Resolve react_native_pods.rb with node to allow for hoisting
def node_require(script)
Expand All @@ -13,7 +13,7 @@ def node_require(script)
end

node_require('react-native/scripts/react_native_pods.rb')
{{PLUGIN_NODE_REQUIRE}}
{{INJECT_PLUGIN_NODE_REQUIRE}}

# RN PERMISSIONS
permissions_required = ENV['REACT_NATIVE_PERMISSIONS_REQUIRED']
Expand All @@ -22,7 +22,7 @@ if permissions_required != '' && permissions_required != nil
setup_permissions(permissions_required.split(","))
end

platform :ios, '{{PLUGIN_DEPLOYMENT_TARGET}}'
platform :ios, '{{INJECT_PLUGIN_DEPLOYMENT_TARGET}}'
prepare_react_native_project!

# If you are using a `react-native-flipper` your iOS build will fail when `NO_FLIPPER=1` is set.
Expand All @@ -45,15 +45,15 @@ end
target 'RNVApp' do
config = use_native_modules!

{{PLUGIN_PATHS}}
{{INJECT_PLUGIN_PATHS}}

# Flags change depending on the env values.
flags = get_default_flags()

use_react_native!(
:path => config[:reactNativePath],
# Hermes is now enabled by default. Disable by setting this flag to false.
:hermes_enabled => {{HERMES_ENABLED}},
:hermes_enabled => {{INJECT_HERMES_ENABLED}},
:fabric_enabled => flags[:fabric_enabled],
# Enables Flipper.
#
Expand Down Expand Up @@ -82,4 +82,4 @@ target 'RNVApp' do
end
end

{{PLUGIN_PODFILE_INJECT}}
{{INJECT_PLUGIN_PODFILE_INJECT}}
29 changes: 9 additions & 20 deletions packages/sdk-apple/src/podfileParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {
addSystemInjects,
logTask,
parsePlugins,
doResolve,
writeCleanFile,
RnvPlatform,
DEFAULTS,
Expand Down Expand Up @@ -117,48 +116,38 @@ export const parsePodFile = async (c: Context, platform: RnvPlatform) => {
c.payload.pluginConfigiOS.deploymentTarget = deploymentTarget;

const injects: OverridesOptions = [
{ pattern: '{{PLUGIN_PATHS}}', override: pluginInject },
{ pattern: '{{PLUGIN_WARNINGS}}', override: podWarnings },
{ pattern: '{{INJECT_PLUGIN_PATHS}}', override: pluginInject },
{ pattern: '{{INJECT_PLUGIN_WARNINGS}}', override: podWarnings },
{
pattern: '{{PLUGIN_PODFILE_INJECT}}',
pattern: '{{INJECT_PLUGIN_PODFILE_INJECT}}',
override: c.payload.pluginConfigiOS.podfileInject,
},
{
pattern: '{{INJECT_POST_INSTALL}}',
override: c.payload.pluginConfigiOS.podPostInstall,
},
{
pattern: '{{PLUGIN_PODFILE_SOURCES}}',
pattern: '{{INJECT_PLUGIN_PODFILE_SOURCES}}',
override: c.payload.pluginConfigiOS.podfileSources,
},
{
pattern: '{{PLUGIN_DEPLOYMENT_TARGET}}',
pattern: '{{INJECT_PLUGIN_DEPLOYMENT_TARGET}}',
override: c.payload.pluginConfigiOS.deploymentTarget,
},
{
pattern: '{{PLUGIN_STATIC_FRAMEWORKS}}',
pattern: '{{INJECT_PLUGIN_STATIC_FRAMEWORKS}}',
override: c.payload.pluginConfigiOS.staticFrameworks.join(','),
},
{
pattern: '{{PATH_JSC_ANDROID}}',
override: doResolve('jsc-android') || 'UNRESOLVED(jsc-android)',
},
{
pattern: '{{PATH_REACT_NATIVE}}',
override:
doResolve(c.runtime.runtimeExtraProps?.reactNativePackageName || 'react-native') ||
'UNRESOLVED(react-native)',
},
{
pattern: '{{PLUGIN_NODE_REQUIRE}}',
pattern: '{{INJECT_PLUGIN_NODE_REQUIRE}}',
override: c.payload.pluginConfigiOS.podfileNodeRequire || '',
},
{
pattern: '{{HERMES_ENABLED}}',
pattern: '{{INJECT_HERMES_ENABLED}}',
override: `${useHermes}`,
},
{
pattern: '{{PODFILE_HEADER}}',
pattern: '{{INJECT_PODFILE_HEADER}}',
override: c.payload.pluginConfigiOS.podfileHeader,
},
];
Expand Down

0 comments on commit 1a08564

Please sign in to comment.