-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1656ad3
commit 0a92fe0
Showing
16 changed files
with
136 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
#!/bin/sh | ||
# -------------------------------------------------------------------------------------------------------------------- | ||
# Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0. | ||
# This product includes software developed at Datadog (https://www.datadoghq.com/). | ||
# Copyright 2016-Present Datadog, Inc. | ||
# -------------------------------------------------------------------------------------------------------------------- | ||
|
||
# ================================================================================== | ||
# This script prepares local packages, and installs them to the given destination | ||
# ================================================================================== | ||
set -e # Exit immediately if a command exits with a non-zero status. | ||
|
||
# If true, opens VS Code on the destination after installing the local packages. | ||
OPEN_VS_CODE=false | ||
|
||
ROOT=$(pwd) # Store the current directory as ROOT. | ||
|
||
# List of packages to prepare and install | ||
PACKAGES=( | ||
"core" | ||
"react-navigation" | ||
"react-native-session-replay" | ||
"internal-testing-tools" | ||
) | ||
|
||
# Function to print an error message and exit | ||
error_exit() { | ||
echo "$1" >&2 | ||
exit 1 | ||
} | ||
|
||
# Check if the destination argument is provided | ||
if [ -z "$1" ]; then | ||
error_exit "Usage: $0 <destination>" | ||
fi | ||
|
||
# Resolve the absolute path of the destination | ||
DESTINATION=$(realpath "$1") | ||
|
||
# Check if the directory exists | ||
if [ ! -d "$DESTINATION" ]; then | ||
error_exit "Error: Directory '$DESTINATION' does not exist." | ||
fi | ||
|
||
# Check if package.json exists in the directory | ||
if [ ! -f "$DESTINATION/package.json" ]; then | ||
error_exit "Error: No package.json found in '$DESTINATION'." | ||
fi | ||
|
||
# Randomly generated version | ||
VERSION=$(openssl rand -base64 48 | tr -dc 'a-zA-Z0-9' | head -c 64) | ||
|
||
# Function to prepare and copy the package to the destination | ||
prepare_and_copy() { | ||
local package_name="$1" | ||
|
||
cd $ROOT/packages/$package_name | ||
|
||
rm -f *.tgz # Remove any existing .tgz files | ||
yarn # Install dependencies | ||
yarn prepare # Prepare the package | ||
yarn pack # Pack the package | ||
|
||
rm -f $DESTINATION/$package_name-*.tgz # Remove old package in the destination | ||
cp package.tgz $DESTINATION/$package_name-$VERSION.tgz # Copy new package to destination | ||
|
||
cd $ROOT # Return to root directory | ||
} | ||
|
||
# Function to install local packages | ||
install_local_packages() { | ||
local packages=("$@") | ||
|
||
# Prepare and copy packages | ||
for package in "${packages[@]}"; | ||
do | ||
prepare_and_copy $package | ||
done | ||
|
||
# Jump into project directory | ||
cd $DESTINATION | ||
|
||
# Clean previous packages | ||
for package in "${packages[@]}"; | ||
do | ||
yarn remove $package || true # Remove old package, ignore errors | ||
done | ||
|
||
# Install new local packages | ||
for package in "${packages[@]}"; | ||
do | ||
yarn add file:$package-$VERSION.tgz # Add the new package | ||
done | ||
|
||
yarn # Install remaining dependencies | ||
|
||
# Open editor if OPEN_VS_CODE is true | ||
if [ "$OPEN_VS_CODE" = true ]; then | ||
code . | ||
fi | ||
|
||
# Go back to root | ||
cd $ROOT | ||
} | ||
|
||
# Pass the array to the function | ||
install_local_packages "${PACKAGES[@]}" | ||
|
||
echo "Done." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"npmClient": "yarn", | ||
"version": "2.4.2", | ||
"version": "2.4.3", | ||
"packages": [ | ||
"packages/*" | ||
], | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
// generated by genversion | ||
export const version = '2.4.2'; | ||
export const version = '2.4.3'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "@datadog/mobile-react-navigation", | ||
"version": "2.4.2", | ||
"version": "2.4.3", | ||
"description": "A client-side React Native module to interact with Datadog", | ||
"keywords": [ | ||
"datadog", | ||
|
@@ -36,7 +36,7 @@ | |
"prepare": "rm -rf lib && yarn bob build" | ||
}, | ||
"devDependencies": { | ||
"@datadog/mobile-react-native": "^2.4.2", | ||
"@datadog/mobile-react-native": "^2.4.3", | ||
"@react-navigation/native-v5": "npm:@react-navigation/[email protected]", | ||
"@react-navigation/native-v6": "npm:@react-navigation/[email protected]", | ||
"@react-navigation/stack-v5": "npm:@react-navigation/[email protected]", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2572,7 +2572,7 @@ __metadata: | |
version: 0.0.0-use.local | ||
resolution: "@datadog/mobile-react-native-code-push@workspace:packages/codepush" | ||
dependencies: | ||
"@datadog/mobile-react-native": ^2.4.2 | ||
"@datadog/mobile-react-native": ^2.4.3 | ||
"@testing-library/react-native": 7.0.2 | ||
react-native-builder-bob: 0.26.0 | ||
react-native-code-push: 7.1.0 | ||
|
@@ -2588,7 +2588,7 @@ __metadata: | |
version: 0.0.0-use.local | ||
resolution: "@datadog/mobile-react-native-navigation@workspace:packages/react-native-navigation" | ||
dependencies: | ||
"@datadog/mobile-react-native": ^2.4.2 | ||
"@datadog/mobile-react-native": ^2.4.3 | ||
"@testing-library/react-native": 7.0.2 | ||
react-native-builder-bob: 0.26.0 | ||
react-native-gesture-handler: 1.10.3 | ||
|
@@ -2628,7 +2628,7 @@ __metadata: | |
languageName: unknown | ||
linkType: soft | ||
|
||
"@datadog/mobile-react-native@^2.4.2, @datadog/mobile-react-native@workspace:packages/core": | ||
"@datadog/mobile-react-native@^2.4.3, @datadog/mobile-react-native@workspace:packages/core": | ||
version: 0.0.0-use.local | ||
resolution: "@datadog/mobile-react-native@workspace:packages/core" | ||
dependencies: | ||
|
@@ -2644,7 +2644,7 @@ __metadata: | |
version: 0.0.0-use.local | ||
resolution: "@datadog/mobile-react-navigation@workspace:packages/react-navigation" | ||
dependencies: | ||
"@datadog/mobile-react-native": ^2.4.2 | ||
"@datadog/mobile-react-native": ^2.4.3 | ||
"@react-navigation/native-v5": "npm:@react-navigation/[email protected]" | ||
"@react-navigation/native-v6": "npm:@react-navigation/[email protected]" | ||
"@react-navigation/stack-v5": "npm:@react-navigation/[email protected]" | ||
|