txlemetry-react-native 4.55.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +353 -0
- package/README.md +13 -0
- package/dist/PostHogContext.d.ts +5 -0
- package/dist/PostHogContext.js +1 -0
- package/dist/PostHogErrorBoundary.d.ts +27 -0
- package/dist/PostHogErrorBoundary.js +1 -0
- package/dist/PostHogMaskView.d.ts +39 -0
- package/dist/PostHogMaskView.js +1 -0
- package/dist/PostHogProvider.d.ts +100 -0
- package/dist/PostHogProvider.js +1 -0
- package/dist/autocapture.d.ts +4 -0
- package/dist/autocapture.js +1 -0
- package/dist/error-tracking/index.d.ts +98 -0
- package/dist/error-tracking/index.js +1 -0
- package/dist/error-tracking/utils.d.ts +5 -0
- package/dist/error-tracking/utils.js +1 -0
- package/dist/frameworks/wix-navigation.d.ts +3 -0
- package/dist/frameworks/wix-navigation.js +1 -0
- package/dist/hooks/useFeatureFlag.d.ts +5 -0
- package/dist/hooks/useFeatureFlag.js +1 -0
- package/dist/hooks/useFeatureFlagResult.d.ts +3 -0
- package/dist/hooks/useFeatureFlagResult.js +1 -0
- package/dist/hooks/useFeatureFlags.d.ts +3 -0
- package/dist/hooks/useFeatureFlags.js +1 -0
- package/dist/hooks/useNavigationTracker.d.ts +6 -0
- package/dist/hooks/useNavigationTracker.js +1 -0
- package/dist/hooks/usePostHog.d.ts +2 -0
- package/dist/hooks/usePostHog.js +1 -0
- package/dist/hooks/utils.d.ts +14 -0
- package/dist/hooks/utils.js +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.js +1 -0
- package/dist/index.txlemetry.d.ts +36 -0
- package/dist/index.txlemetry.js +21 -0
- package/dist/logs-defaults.d.ts +9 -0
- package/dist/logs-defaults.js +1 -0
- package/dist/native-deps.d.ts +4 -0
- package/dist/native-deps.js +1 -0
- package/dist/optional/OptionalAsyncStorage.d.ts +2 -0
- package/dist/optional/OptionalAsyncStorage.js +1 -0
- package/dist/optional/OptionalExpoApplication.d.ts +2 -0
- package/dist/optional/OptionalExpoApplication.js +1 -0
- package/dist/optional/OptionalExpoDevice.d.ts +2 -0
- package/dist/optional/OptionalExpoDevice.js +1 -0
- package/dist/optional/OptionalExpoFileSystem.d.ts +2 -0
- package/dist/optional/OptionalExpoFileSystem.js +1 -0
- package/dist/optional/OptionalExpoFileSystemLegacy.d.ts +2 -0
- package/dist/optional/OptionalExpoFileSystemLegacy.js +1 -0
- package/dist/optional/OptionalExpoLocalization.d.ts +2 -0
- package/dist/optional/OptionalExpoLocalization.js +1 -0
- package/dist/optional/OptionalPlugin.d.ts +20 -0
- package/dist/optional/OptionalPlugin.js +1 -0
- package/dist/optional/OptionalReactNativeDeviceInfo.d.ts +2 -0
- package/dist/optional/OptionalReactNativeDeviceInfo.js +1 -0
- package/dist/optional/OptionalReactNativeLocalize.d.ts +13 -0
- package/dist/optional/OptionalReactNativeLocalize.js +1 -0
- package/dist/optional/OptionalReactNativeNavigation.d.ts +2 -0
- package/dist/optional/OptionalReactNativeNavigation.js +1 -0
- package/dist/optional/OptionalReactNativeNavigationWix.d.ts +2 -0
- package/dist/optional/OptionalReactNativeNavigationWix.js +1 -0
- package/dist/optional/OptionalReactNativeSafeArea.d.ts +2 -0
- package/dist/optional/OptionalReactNativeSafeArea.js +1 -0
- package/dist/optional/OptionalReactNativeSvg.d.ts +2 -0
- package/dist/optional/OptionalReactNativeSvg.js +1 -0
- package/dist/posthog-rn.d.ts +1096 -0
- package/dist/posthog-rn.js +1 -0
- package/dist/storage.d.ts +41 -0
- package/dist/storage.js +1 -0
- package/dist/surveys/PostHogSurveyProvider.d.ts +23 -0
- package/dist/surveys/PostHogSurveyProvider.js +1 -0
- package/dist/surveys/components/BottomSection.d.ts +9 -0
- package/dist/surveys/components/BottomSection.js +1 -0
- package/dist/surveys/components/Cancel.d.ts +5 -0
- package/dist/surveys/components/Cancel.js +1 -0
- package/dist/surveys/components/ConfirmationMessage.d.ts +12 -0
- package/dist/surveys/components/ConfirmationMessage.js +1 -0
- package/dist/surveys/components/QuestionHeader.d.ts +8 -0
- package/dist/surveys/components/QuestionHeader.js +1 -0
- package/dist/surveys/components/QuestionTypes.d.ts +26 -0
- package/dist/surveys/components/QuestionTypes.js +1 -0
- package/dist/surveys/components/SurveyModal.d.ts +11 -0
- package/dist/surveys/components/SurveyModal.js +1 -0
- package/dist/surveys/components/Surveys.d.ts +16 -0
- package/dist/surveys/components/Surveys.js +1 -0
- package/dist/surveys/getActiveMatchingSurveys.d.ts +2 -0
- package/dist/surveys/getActiveMatchingSurveys.js +1 -0
- package/dist/surveys/icons.d.ts +11 -0
- package/dist/surveys/icons.js +1 -0
- package/dist/surveys/index.d.ts +6 -0
- package/dist/surveys/index.js +1 -0
- package/dist/surveys/safeStyleSheet.d.ts +8 -0
- package/dist/surveys/safeStyleSheet.js +1 -0
- package/dist/surveys/survey-translations.d.ts +7 -0
- package/dist/surveys/survey-translations.js +1 -0
- package/dist/surveys/surveys-utils.d.ts +54 -0
- package/dist/surveys/surveys-utils.js +1 -0
- package/dist/surveys/useActivatedSurveys.d.ts +3 -0
- package/dist/surveys/useActivatedSurveys.js +1 -0
- package/dist/surveys/useSurveyStorage.d.ts +8 -0
- package/dist/surveys/useSurveyStorage.js +1 -0
- package/dist/tooling/expoconfig.d.ts +64 -0
- package/dist/tooling/expoconfig.js +1 -0
- package/dist/tooling/metroconfig.d.ts +21 -0
- package/dist/tooling/metroconfig.js +1 -0
- package/dist/tooling/posthogMetroSerializer.d.ts +17 -0
- package/dist/tooling/posthogMetroSerializer.js +1 -0
- package/dist/tooling/utils.d.ts +58 -0
- package/dist/tooling/utils.js +1 -0
- package/dist/tooling/vendor/expo/expoconfig.d.ts +23 -0
- package/dist/tooling/vendor/expo/expoconfig.js +1 -0
- package/dist/tooling/vendor/metro/countLines.d.ts +2 -0
- package/dist/tooling/vendor/metro/countLines.js +1 -0
- package/dist/tooling/vendor/metro/utils.d.ts +22 -0
- package/dist/tooling/vendor/metro/utils.js +1 -0
- package/dist/types.d.ts +205 -0
- package/dist/types.js +1 -0
- package/dist/utils.d.ts +25 -0
- package/dist/utils.js +1 -0
- package/dist/version.d.ts +1 -0
- package/dist/version.js +1 -0
- package/package.json +149 -0
- package/tooling/txlemetry-xcode.sh +222 -0
- package/tooling/txlemetry.gradle +407 -0
package/package.json
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "txlemetry-react-native",
|
|
3
|
+
"version": "4.55.1",
|
|
4
|
+
"description": "Txlemetry SDK for React Native",
|
|
5
|
+
"bugs": {
|
|
6
|
+
"url": "https://github.com/hectorvss/Txlemetry/issues"
|
|
7
|
+
},
|
|
8
|
+
"license": "MIT",
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/hectorvss/Txlemetry.git",
|
|
12
|
+
"directory": "txlemetry-sdk/react-native"
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist/",
|
|
16
|
+
"tooling/txlemetry-xcode.sh",
|
|
17
|
+
"tooling/txlemetry.gradle",
|
|
18
|
+
"!**/*.map"
|
|
19
|
+
],
|
|
20
|
+
"main": "dist/index.txlemetry.js",
|
|
21
|
+
"types": "dist/index.txlemetry.d.ts",
|
|
22
|
+
"exports": {
|
|
23
|
+
".": {
|
|
24
|
+
"types": "./dist/index.txlemetry.d.ts",
|
|
25
|
+
"default": "./dist/index.txlemetry.js"
|
|
26
|
+
},
|
|
27
|
+
"./metro": {
|
|
28
|
+
"types": "./dist/tooling/metroconfig.d.ts",
|
|
29
|
+
"default": "./dist/tooling/metroconfig.js"
|
|
30
|
+
},
|
|
31
|
+
"./expo": {
|
|
32
|
+
"types": "./dist/tooling/expoconfig.d.ts",
|
|
33
|
+
"default": "./dist/tooling/expoconfig.js"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"publishConfig": {
|
|
37
|
+
"access": "public"
|
|
38
|
+
},
|
|
39
|
+
"scripts": {
|
|
40
|
+
"clean": "rimraf dist",
|
|
41
|
+
"lint": "eslint src test",
|
|
42
|
+
"lint:fix": "eslint src test --fix",
|
|
43
|
+
"test:unit": "jest -c jest.config.js",
|
|
44
|
+
"test": "pnpm test:unit",
|
|
45
|
+
"prebuild": "node -p \"'export const version = ' + JSON.stringify(require('./package.json').version)\" > src/version.ts",
|
|
46
|
+
"build": "tsc -b && babel ./dist --out-dir dist --extensions '.js'",
|
|
47
|
+
"package": "pnpm pack --out $PACKAGE_DEST/%s.tgz",
|
|
48
|
+
"generate-references": "pnpm exec api-extractor run --config ./api-extractor.json --local && node scripts/generate-docs.js"
|
|
49
|
+
},
|
|
50
|
+
"dependencies": {
|
|
51
|
+
"@txlemetry/core": "^1.43.1",
|
|
52
|
+
"@txlemetry/types": "^1.396.0"
|
|
53
|
+
},
|
|
54
|
+
"devDependencies": {
|
|
55
|
+
"@babel/cli": "^7.19.3",
|
|
56
|
+
"@babel/plugin-transform-class-properties": "^7.27.1",
|
|
57
|
+
"@babel/plugin-transform-private-methods": "^7.27.1",
|
|
58
|
+
"@babel/plugin-transform-private-property-in-object": "^7.27.1",
|
|
59
|
+
"@babel/preset-env": "^7.27.1",
|
|
60
|
+
"@babel/preset-react": "^7.27.1",
|
|
61
|
+
"@babel/preset-typescript": "^7.27.1",
|
|
62
|
+
"@expo/metro-config": "~0.20.0",
|
|
63
|
+
"@react-native-async-storage/async-storage": "^1.17.10",
|
|
64
|
+
"@react-native/babel-preset": "^0.80.1",
|
|
65
|
+
"@react-navigation/native": "^5.0.10",
|
|
66
|
+
"@testing-library/react": "^16.3.0",
|
|
67
|
+
"@txlemetry/react-native-plugin": "2.5.1",
|
|
68
|
+
"@types/jest": "^29.5.14",
|
|
69
|
+
"@types/react": "^17.0.87",
|
|
70
|
+
"@types/react-native": "^0.69.1",
|
|
71
|
+
"expo": "^45.0.6",
|
|
72
|
+
"expo-application": "^4.0.0",
|
|
73
|
+
"expo-device": "^4.0.0",
|
|
74
|
+
"expo-file-system": "^13.0.0",
|
|
75
|
+
"expo-localization": "^11.0.0",
|
|
76
|
+
"jest": "29.7.0",
|
|
77
|
+
"jest-environment-jsdom": "^29.7.0",
|
|
78
|
+
"jest-environment-node": "^29.7.0",
|
|
79
|
+
"jest-expo": "^47.0.1",
|
|
80
|
+
"metro": "0.83.1",
|
|
81
|
+
"react": "18.2.0",
|
|
82
|
+
"react-dom": "18.2.0",
|
|
83
|
+
"react-native": "^0.69.1",
|
|
84
|
+
"react-native-device-info": "^10.3.0",
|
|
85
|
+
"react-native-localize": "^3.0.0",
|
|
86
|
+
"react-native-navigation": "^6.0.0",
|
|
87
|
+
"react-native-safe-area-context": "^4.10.1",
|
|
88
|
+
"react-native-svg": "^15.0.0",
|
|
89
|
+
"ts-jest": "29.4.11",
|
|
90
|
+
"txlemetry-react-native-session-replay": "^1.6.1",
|
|
91
|
+
"typescript": "5.8.2"
|
|
92
|
+
},
|
|
93
|
+
"peerDependencies": {
|
|
94
|
+
"@react-native-async-storage/async-storage": ">=1.0.0",
|
|
95
|
+
"@react-navigation/native": ">= 5.0.0",
|
|
96
|
+
"@txlemetry/react-native-plugin": ">= 2.5.1",
|
|
97
|
+
"expo-application": ">= 4.0.0",
|
|
98
|
+
"expo-device": ">= 4.0.0",
|
|
99
|
+
"expo-file-system": ">= 13.0.0",
|
|
100
|
+
"expo-localization": ">= 11.0.0",
|
|
101
|
+
"react-native-device-info": ">= 10.0.0",
|
|
102
|
+
"react-native-localize": ">= 3.0.0",
|
|
103
|
+
"react-native-navigation": ">= 6.0.0",
|
|
104
|
+
"react-native-safe-area-context": ">= 4.0.0",
|
|
105
|
+
"react-native-svg": ">= 15.0.0",
|
|
106
|
+
"txlemetry-react-native-session-replay": ">= 1.6.1"
|
|
107
|
+
},
|
|
108
|
+
"peerDependenciesMeta": {
|
|
109
|
+
"@react-native-async-storage/async-storage": {
|
|
110
|
+
"optional": true
|
|
111
|
+
},
|
|
112
|
+
"@react-navigation/native": {
|
|
113
|
+
"optional": true
|
|
114
|
+
},
|
|
115
|
+
"expo-application": {
|
|
116
|
+
"optional": true
|
|
117
|
+
},
|
|
118
|
+
"expo-device": {
|
|
119
|
+
"optional": true
|
|
120
|
+
},
|
|
121
|
+
"expo-file-system": {
|
|
122
|
+
"optional": true
|
|
123
|
+
},
|
|
124
|
+
"expo-localization": {
|
|
125
|
+
"optional": true
|
|
126
|
+
},
|
|
127
|
+
"react-native-device-info": {
|
|
128
|
+
"optional": true
|
|
129
|
+
},
|
|
130
|
+
"react-native-navigation": {
|
|
131
|
+
"optional": true
|
|
132
|
+
},
|
|
133
|
+
"react-native-localize": {
|
|
134
|
+
"optional": true
|
|
135
|
+
},
|
|
136
|
+
"@txlemetry/react-native-plugin": {
|
|
137
|
+
"optional": true
|
|
138
|
+
},
|
|
139
|
+
"txlemetry-react-native-session-replay": {
|
|
140
|
+
"optional": true
|
|
141
|
+
},
|
|
142
|
+
"react-native-safe-area-context": {
|
|
143
|
+
"optional": true
|
|
144
|
+
},
|
|
145
|
+
"react-native-svg": {
|
|
146
|
+
"optional": true
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Portions of this file are derived from getsentry/sentry-react-native
|
|
3
|
+
# Copyright (c) 2017 Sentry
|
|
4
|
+
# Licensed under the MIT License: https://github.com/getsentry/sentry-react-native/blob/main/LICENSE.md
|
|
5
|
+
# Bundle React Native code and images
|
|
6
|
+
# PWD=ios
|
|
7
|
+
|
|
8
|
+
# print commands before executing them and stop on first error
|
|
9
|
+
set -x -e
|
|
10
|
+
|
|
11
|
+
# Ensure common tool paths are available so txlemetry-cli can auto-detect git
|
|
12
|
+
# (Xcode runs build phases with a minimal PATH)
|
|
13
|
+
export PATH="/usr/bin:/usr/local/bin:/opt/homebrew/bin:$HOME/.cargo/bin:$HOME/.local/bin:$HOME/.txlemetry:$HOME/.posthog:$PATH"
|
|
14
|
+
|
|
15
|
+
print_prefixed_output() {
|
|
16
|
+
local prefix="$1"
|
|
17
|
+
local output="$2"
|
|
18
|
+
|
|
19
|
+
if [ -n "$output" ]; then
|
|
20
|
+
echo "$output" | awk -v prefix="$prefix" '{print prefix $0}'
|
|
21
|
+
fi
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
print_command_error() {
|
|
25
|
+
local command_name="$1"
|
|
26
|
+
local exit_code="$2"
|
|
27
|
+
local output="$3"
|
|
28
|
+
|
|
29
|
+
echo "error: ${command_name} failed with exit code ${exit_code}"
|
|
30
|
+
print_prefixed_output "error: ${command_name} - " "$output"
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
# WITH_ENVIRONMENT is executed by React Native
|
|
34
|
+
|
|
35
|
+
TXLEMETRY_UPLOAD_ARGS=""
|
|
36
|
+
while [ "$#" -gt 0 ]; do
|
|
37
|
+
case "$1" in
|
|
38
|
+
--txlemetry-skip-on-conflict|--posthog-skip-on-conflict)
|
|
39
|
+
TXLEMETRY_UPLOAD_ARGS="$TXLEMETRY_UPLOAD_ARGS --skip-on-conflict"
|
|
40
|
+
shift
|
|
41
|
+
;;
|
|
42
|
+
--)
|
|
43
|
+
shift
|
|
44
|
+
break
|
|
45
|
+
;;
|
|
46
|
+
*)
|
|
47
|
+
break
|
|
48
|
+
;;
|
|
49
|
+
esac
|
|
50
|
+
done
|
|
51
|
+
|
|
52
|
+
REACT_NATIVE_XCODE_DEFAULT="../node_modules/react-native/scripts/react-native-xcode.sh"
|
|
53
|
+
# Accept $1 only when it actually points at a shell script; guard against the
|
|
54
|
+
# Expo plugin previously passing "/bin/sh" as $1 (issue #3682).
|
|
55
|
+
if [[ "${1:-}" == *.sh ]]; then
|
|
56
|
+
REACT_NATIVE_XCODE="$1"
|
|
57
|
+
else
|
|
58
|
+
REACT_NATIVE_XCODE="$REACT_NATIVE_XCODE_DEFAULT"
|
|
59
|
+
fi
|
|
60
|
+
|
|
61
|
+
# Check if DERIVED_FILE_DIR exists, defined by Xcode
|
|
62
|
+
if [ ! -d "$DERIVED_FILE_DIR" ]; then
|
|
63
|
+
echo "error: DERIVED_FILE_DIR does not exist: $DERIVED_FILE_DIR"
|
|
64
|
+
exit 1
|
|
65
|
+
fi
|
|
66
|
+
|
|
67
|
+
# RN/users can define a BUNDLE_NAME, or fallback to main
|
|
68
|
+
SOURCEMAP_NAME="${BUNDLE_NAME:-main}.jsbundle.map"
|
|
69
|
+
|
|
70
|
+
[ -z "$SOURCEMAP_FILE" ] && export SOURCEMAP_FILE="$DERIVED_FILE_DIR/$SOURCEMAP_NAME"
|
|
71
|
+
|
|
72
|
+
# Check if CONFIGURATION_BUILD_DIR exists, defined by Xcode
|
|
73
|
+
if [ ! -d "$CONFIGURATION_BUILD_DIR" ]; then
|
|
74
|
+
echo "error: CONFIGURATION_BUILD_DIR does not exist: $CONFIGURATION_BUILD_DIR"
|
|
75
|
+
exit 1
|
|
76
|
+
fi
|
|
77
|
+
|
|
78
|
+
# Check for txlemetry-cli using installer environment variables
|
|
79
|
+
# TODO: provide a config that users can force the location
|
|
80
|
+
# Xcode starts with a very limited $PATH so using whereis does not work
|
|
81
|
+
if [ -f "$HOME/.txlemetry/txlemetry-cli" ]; then
|
|
82
|
+
PH_CLI_PATH="$HOME/.txlemetry/txlemetry-cli"
|
|
83
|
+
elif [ -f "$HOME/.posthog/posthog-cli" ]; then
|
|
84
|
+
PH_CLI_PATH="$HOME/.posthog/posthog-cli"
|
|
85
|
+
else
|
|
86
|
+
# Check if installed via npm -g @txlemetry/cli
|
|
87
|
+
NPM_GLOBAL_PREFIX=$(npm prefix -g 2>/dev/null || true)
|
|
88
|
+
if [ -n "$NPM_GLOBAL_PREFIX" ] && [ -f "$NPM_GLOBAL_PREFIX/bin/txlemetry-cli" ]; then
|
|
89
|
+
PH_CLI_PATH="$NPM_GLOBAL_PREFIX/bin/txlemetry-cli"
|
|
90
|
+
else
|
|
91
|
+
# Check if installed as local dependency
|
|
92
|
+
NPM_LOCAL_ROOT=$(npm root 2>/dev/null || true)
|
|
93
|
+
if [ -n "$NPM_LOCAL_ROOT" ] && [ -f "$NPM_LOCAL_ROOT/.bin/txlemetry-cli" ]; then
|
|
94
|
+
PH_CLI_PATH="$NPM_LOCAL_ROOT/.bin/txlemetry-cli"
|
|
95
|
+
else
|
|
96
|
+
# Fallback to searching common locations (PATH was already extended above)
|
|
97
|
+
PH_CLI_PATH=$(command -v txlemetry-cli 2>/dev/null || true)
|
|
98
|
+
fi
|
|
99
|
+
fi
|
|
100
|
+
fi
|
|
101
|
+
|
|
102
|
+
if [ -z "$PH_CLI_PATH" ] || [ ! -x "$PH_CLI_PATH" ]; then
|
|
103
|
+
echo "error: txlemetry-cli not found"
|
|
104
|
+
exit 1
|
|
105
|
+
fi
|
|
106
|
+
|
|
107
|
+
# mimics how the file is defined in node_modules/react-native/scripts/react-native-xcode.sh (PACKAGER_SOURCEMAP_FILE)
|
|
108
|
+
SOURCEMAP_PACKAGER_FILE="$CONFIGURATION_BUILD_DIR/$SOURCEMAP_NAME"
|
|
109
|
+
|
|
110
|
+
# Pass release info from Xcode build settings when available
|
|
111
|
+
CLI_RELEASE_ARGS=""
|
|
112
|
+
if [ -n "${PRODUCT_BUNDLE_IDENTIFIER}" ]; then
|
|
113
|
+
CLI_RELEASE_ARGS="$CLI_RELEASE_ARGS --release-name $PRODUCT_BUNDLE_IDENTIFIER"
|
|
114
|
+
fi
|
|
115
|
+
if [ -n "${MARKETING_VERSION}" ]; then
|
|
116
|
+
CLI_RELEASE_ARGS="$CLI_RELEASE_ARGS --release-version $MARKETING_VERSION"
|
|
117
|
+
fi
|
|
118
|
+
if [ -n "${CURRENT_PROJECT_VERSION}" ]; then
|
|
119
|
+
CLI_RELEASE_ARGS="$CLI_RELEASE_ARGS --build $CURRENT_PROJECT_VERSION"
|
|
120
|
+
fi
|
|
121
|
+
|
|
122
|
+
# RN deletes the PACKAGER_SOURCEMAP_FILE file after execution but we need it
|
|
123
|
+
# lets patch the script to comment out this part if not yet
|
|
124
|
+
if grep -q '^[[:space:]]*rm.*PACKAGER_SOURCEMAP_FILE' "$REACT_NATIVE_XCODE"; then
|
|
125
|
+
echo "Patching React Native script to preserve sourcemap file..."
|
|
126
|
+
sed -i '' 's/^[[:space:]]*rm.*PACKAGER_SOURCEMAP_FILE/#&/' "$REACT_NATIVE_XCODE"
|
|
127
|
+
echo "Patched: commented out rm PACKAGER_SOURCEMAP_FILE line"
|
|
128
|
+
fi
|
|
129
|
+
|
|
130
|
+
# Execute React Native Xcode script and check exit code
|
|
131
|
+
set +x +e # disable printing commands and allow continuing on error
|
|
132
|
+
RN_XCODE_OUTPUT=$(/bin/sh -c "$REACT_NATIVE_XCODE" 2>&1)
|
|
133
|
+
RN_XCODE_EXIT_CODE=$?
|
|
134
|
+
if [ $RN_XCODE_EXIT_CODE -eq 0 ]; then
|
|
135
|
+
echo "$RN_XCODE_OUTPUT" | awk '{print "output: react-native-xcode - " $0}'
|
|
136
|
+
else
|
|
137
|
+
echo "error: react-native-xcode - $RN_XCODE_OUTPUT"
|
|
138
|
+
exit $RN_XCODE_EXIT_CODE
|
|
139
|
+
fi
|
|
140
|
+
set -x -e # re-enable
|
|
141
|
+
|
|
142
|
+
# files wont exist if skip bundling
|
|
143
|
+
set +x +e
|
|
144
|
+
if [[ "$SKIP_BUNDLING" ]]; then
|
|
145
|
+
echo "SKIP_BUNDLING enabled; skipping txlemetry-cli upload calls."
|
|
146
|
+
exit 0;
|
|
147
|
+
fi
|
|
148
|
+
set -x -e
|
|
149
|
+
|
|
150
|
+
# txlemetry-cli auto-detects git by walking UP from the --directory arg
|
|
151
|
+
# (the sourcemap location). For Xcode, that's ~/Library/Developer/Xcode/DerivedData/
|
|
152
|
+
# which is outside the project tree, so .git is never found.
|
|
153
|
+
#
|
|
154
|
+
# Workaround for local builds: populate GITHUB_* env vars from the local git
|
|
155
|
+
# remote so the CLI's GitHub Actions detection path picks them up. The CLI
|
|
156
|
+
# doesn't validate the host — it builds the remote URL as
|
|
157
|
+
# "{GITHUB_SERVER_URL}/{GITHUB_REPOSITORY}.git", so this works regardless of
|
|
158
|
+
# the user's actual git provider (GitHub, GitLab, Bitbucket, self-hosted, ...).
|
|
159
|
+
#
|
|
160
|
+
# We only do this when not already inside a CI environment the CLI recognizes
|
|
161
|
+
# natively (GitHub Actions, Vercel). Those runners inject the real variables
|
|
162
|
+
# themselves, and we don't want to overwrite them with locally-derived ones.
|
|
163
|
+
#
|
|
164
|
+
if [ -z "$GITHUB_SHA" ] && [ -z "$VERCEL" ]; then
|
|
165
|
+
GIT_TOPLEVEL=$(git -C "${SRCROOT:-$(pwd)}" rev-parse --show-toplevel 2>/dev/null)
|
|
166
|
+
if [ -n "$GIT_TOPLEVEL" ]; then
|
|
167
|
+
GIT_REMOTE_URL=$(git -C "$GIT_TOPLEVEL" config --get remote.origin.url 2>/dev/null)
|
|
168
|
+
if [ -n "$GIT_REMOTE_URL" ]; then
|
|
169
|
+
# Parse host and "owner/repo" from either:
|
|
170
|
+
# git@host:owner/repo.git → host=host, repo=owner/repo
|
|
171
|
+
# https://host/owner/repo.git → host=host, repo=owner/repo
|
|
172
|
+
# ssh://git@host:port/owner/repo → host=host, repo=owner/repo
|
|
173
|
+
# git@gitlab.com:org/subgroup/repo.git → host=gitlab.com, repo=org/subgroup/repo
|
|
174
|
+
# Strip leading scheme + optional user@, then take everything up to the first : or /
|
|
175
|
+
GIT_HOST=$(echo "$GIT_REMOTE_URL" | sed -E 's#^[a-z]+://##; s#^[^@]*@##; s#[:/].*$##')
|
|
176
|
+
# Strip scheme + user@host + separator, optional port, and .git suffix
|
|
177
|
+
GIT_REPO_PATH=$(echo "$GIT_REMOTE_URL" | sed -E 's#^([a-z]+://)?[^:/]*[:/]##; s#^[0-9]+/##; s#\.git$##')
|
|
178
|
+
if [ -n "$GIT_HOST" ] && [ -n "$GIT_REPO_PATH" ]; then
|
|
179
|
+
GIT_BRANCH_NAME=$(git -C "$GIT_TOPLEVEL" rev-parse --abbrev-ref HEAD 2>/dev/null)
|
|
180
|
+
# --abbrev-ref returns the literal string "HEAD" when the working copy
|
|
181
|
+
# is in a detached-HEAD state (bisect, checking out a tag, CI checkouts
|
|
182
|
+
# that resolved to a SHA). Fall back to the short SHA so the branch
|
|
183
|
+
# field is meaningful rather than just "HEAD".
|
|
184
|
+
if [ "$GIT_BRANCH_NAME" = "HEAD" ]; then
|
|
185
|
+
GIT_BRANCH_NAME=$(git -C "$GIT_TOPLEVEL" rev-parse --short HEAD 2>/dev/null)
|
|
186
|
+
fi
|
|
187
|
+
export GITHUB_ACTIONS="true"
|
|
188
|
+
export GITHUB_SHA=$(git -C "$GIT_TOPLEVEL" rev-parse HEAD 2>/dev/null)
|
|
189
|
+
export GITHUB_REF_NAME="$GIT_BRANCH_NAME"
|
|
190
|
+
export GITHUB_REPOSITORY="$GIT_REPO_PATH"
|
|
191
|
+
export GITHUB_SERVER_URL="https://${GIT_HOST}"
|
|
192
|
+
fi
|
|
193
|
+
fi
|
|
194
|
+
fi
|
|
195
|
+
fi
|
|
196
|
+
|
|
197
|
+
# Execute Txlemetry CLI clone
|
|
198
|
+
set +x +e
|
|
199
|
+
CLI_CLONE_OUTPUT=$(/bin/sh -c "$PH_CLI_PATH hermes clone --minified-map-path $SOURCEMAP_PACKAGER_FILE --composed-map-path $SOURCEMAP_FILE $CLI_RELEASE_ARGS" 2>&1)
|
|
200
|
+
CLONE_EXIT_CODE=$?
|
|
201
|
+
if [ $CLONE_EXIT_CODE -eq 0 ]; then
|
|
202
|
+
echo "$CLI_CLONE_OUTPUT" | awk '{print "output: txlemetry-cli - " $0}'
|
|
203
|
+
else
|
|
204
|
+
print_command_error "txlemetry-cli hermes clone" "$CLONE_EXIT_CODE" "$CLI_CLONE_OUTPUT"
|
|
205
|
+
exit $CLONE_EXIT_CODE
|
|
206
|
+
fi
|
|
207
|
+
set -x -e
|
|
208
|
+
|
|
209
|
+
# Execute Txlemetry CLI upload
|
|
210
|
+
set +x +e
|
|
211
|
+
CLI_UPLOAD_OUTPUT=$(/bin/sh -c "$PH_CLI_PATH hermes upload --directory $DERIVED_FILE_DIR $CLI_RELEASE_ARGS $TXLEMETRY_UPLOAD_ARGS" 2>&1)
|
|
212
|
+
UPLOAD_EXIT_CODE=$?
|
|
213
|
+
if [ $UPLOAD_EXIT_CODE -eq 0 ]; then
|
|
214
|
+
echo "$CLI_UPLOAD_OUTPUT" | awk '{print "output: txlemetry-cli - " $0}'
|
|
215
|
+
else
|
|
216
|
+
print_command_error "txlemetry-cli hermes upload" "$UPLOAD_EXIT_CODE" "$CLI_UPLOAD_OUTPUT"
|
|
217
|
+
exit $UPLOAD_EXIT_CODE
|
|
218
|
+
fi
|
|
219
|
+
set -x -e
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
exit 0
|