Skip to content

Commit

Permalink
removed unnecessary var
Browse files Browse the repository at this point in the history
  • Loading branch information
ElenaDiachenko committed Jan 15, 2024
1 parent 6c59ed7 commit e99b6bf
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 27 deletions.
19 changes: 10 additions & 9 deletions packages/sdk-react-native/src/adapters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,24 @@ const getApplicationId = () => {

const getSkipLinkingDeps = () => {
const skipLinkingEnv = process.env.RNV_SKIP_LINKING;
if(skipLinkingEnv){
const [ platform, ...plugins] = skipLinkingEnv.split(',').map(item => item.trim());
if (skipLinkingEnv) {
const plugins = skipLinkingEnv.split(',');

return {
dependencies: plugins.reduce((acc, plugin) => {
acc[`${plugin}`] = {platforms: {
[platform]: null
}};
acc[`${plugin}`] = {
platforms: {
ios: null,
},
};
return acc;
}, {} as { [plugin: string]: {platforms: { [platform: string]:null}}})
}
}, {} as { [plugin: string]: { platforms: { ios: null } } }),
};
}

return {};
};


const getAppFolderRelative = () => {
const pth = process.env.RNV_APP_BUILD_DIR;
if (pth) {
Expand Down Expand Up @@ -81,7 +82,7 @@ export const withRNVRNConfig = (config: any) => {
},
};

const updatedCnf = merge(cnfRnv, getSkipLinkingDeps())
const updatedCnf = merge(cnfRnv, getSkipLinkingDeps());
const cnf = merge(updatedCnf, config);
return cnf;
};
Expand Down
1 change: 0 additions & 1 deletion packages/sdk-react-native/src/androidRunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ export const packageReactNativeAndroid = async (c: RnvContext) => {
...CoreEnvVars.RNV_EXTENSIONS(),
...EnvVars.RNV_REACT_NATIVE_PATH(),
...EnvVars.RNV_APP_ID(),
...EnvVars.RNV_SKIP_LINKING(),
},
});

Expand Down
37 changes: 20 additions & 17 deletions packages/sdk-react-native/src/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,29 +52,32 @@ export const EnvVars = {
}
return {};
},
RNV_SKIP_LINKING:()=>{
RNV_SKIP_LINKING: () => {
const ctx = getContext();
const {platform, buildConfig:{plugins}} = ctx;
const platformsToCheck = ['ios', 'tvos', 'android', 'androidwear', 'androidtv', 'firetv', 'macos'];
const {
platform,
buildConfig: { plugins },
} = ctx;
const platformsToCheck = ['ios', 'tvos'];

if(platform && plugins ){
const platformToPush = platform === 'tvos'? 'ios': platform;

const filteredPlugins = Object.entries(plugins).filter(([_, pluginConfig]) => {
return typeof pluginConfig !== 'string' && Object.keys(pluginConfig).some(key => platformsToCheck.includes(key))

})
.reduce((acc:any, [pluginName, pluginConfig]) => {
if(!Object.keys(pluginConfig).includes(platform)){
if (platform && plugins) {
const filteredPlugins = Object.entries(plugins)
.filter(([_, pluginConfig]) => {
const pluginConfigKeys = Object.keys(pluginConfig);
return (
typeof pluginConfig !== 'string' &&
pluginConfigKeys.some((key) => platformsToCheck.includes(key)) &&
!pluginConfigKeys.includes(platform)
);
})
.reduce((acc: any, [pluginName]) => {
acc.push(pluginName);
}

return acc
},[platformToPush]);
return acc;
}, []);

const resultString = `${filteredPlugins.join(', ')}`;
return { RNV_SKIP_LINKING: resultString };
}
return {};
}
},
};

0 comments on commit e99b6bf

Please sign in to comment.