Skip to content

Commit

Permalink
fix: path fix for monorepo support (#91)
Browse files Browse the repository at this point in the history
path fix for monorepo support
  • Loading branch information
xtreem88 committed Jul 6, 2023
1 parent 8bfeef7 commit 8f551d3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
10 changes: 10 additions & 0 deletions src/helpers/constants/ios.ts
Expand Up @@ -6,10 +6,20 @@ let pluginPackageRoot = f.next().filename;
// This is the path to the root of the customerio-expo-plugin package
pluginPackageRoot = path.dirname(pluginPackageRoot);

export const LOCAL_PATH_TO_RN_SDK = path.join(
pluginPackageRoot,
'../customerio-reactnative'
)

export const LOCAL_PATH_TO_CIO_NSE_FILES = path.join(
pluginPackageRoot,
'src/helpers/native-files/ios'
);

export function getRelativePathToRNSDK(currentFile: string) {
return path.relative(path.dirname(currentFile), LOCAL_PATH_TO_RN_SDK);
}

export const IOS_DEPLOYMENT_TARGET = '13.0';
export const GROUP_IDENTIFIER_TEMPLATE_REGEX = /{{GROUP_IDENTIFIER}}/gm;
export const BUNDLE_SHORT_VERSION_TEMPLATE_REGEX = /{{BUNDLE_SHORT_VERSION}}/gm;
Expand Down
5 changes: 3 additions & 2 deletions src/helpers/utils/injectCIOPodfileCode.ts
@@ -1,4 +1,5 @@
import type { CustomerIOPluginOptionsIOS } from '../../types/cio-types';
import { getRelativePathToRNSDK } from '../constants/ios';
import { injectCodeByRegex } from './codeInjection';
import { FileManagement } from './fileManagement';

Expand All @@ -18,7 +19,7 @@ export async function injectCIOPodfileCode(iosPath: string) {

const snippetToInjectInPodfile = `
${blockStart}
pod 'customerio-reactnative/apn', :path => '../node_modules/customerio-reactnative'
pod 'customerio-reactnative/apn', :path => '${getRelativePathToRNSDK(filename)}'
${blockEnd}
`.trim();

Expand Down Expand Up @@ -52,7 +53,7 @@ export async function injectCIONotificationPodfileCode(
${blockStart}
target 'NotificationService' do
${useFrameworks === 'static' ? 'use_frameworks! :linkage => :static' : ''}
pod 'customerio-reactnative-richpush/apn', :path => '../node_modules/customerio-reactnative'
pod 'customerio-reactnative-richpush/apn', :path => '${getRelativePathToRNSDK(filename)}'
end
${blockEnd}
`.trim();
Expand Down

0 comments on commit 8f551d3

Please sign in to comment.