Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow specifying the RN version in test-turbo-module.sh #162

Merged
merged 1 commit into from
Nov 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion scripts/test-turbo-modules.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ reset_args() {
PROJECT_DIR=my-test-library
KEEP_ROOT_ON_EXIT=false
BOB_VERSION=latest
RN_VERSION=latest
PROJECT_SLUG=my-test-library
FORCE_NEW_DIR=false
IOS_NAME=MyTestLibrary
Expand All @@ -30,6 +31,7 @@ usage() {
echo " -i, --ios-name IOS_NAME Specify the iOS project name (default: MyTestLibrary)."
echo
echo " -u, --builder-bob-version VERSION Specify the version of builder-bob to use (default: latest)."
echo " -r, --rn-version VERSION Specify the version of React Native to use (default: latest)."
echo " -k, --keep-directory-on-exit Keep the PROJECT_DIR directory even if an error does not occur."
echo " -f, --force-new-directory If PROJECT_DIR directory exist, remove it first."
echo " -h, --help Display this help message."
Expand Down Expand Up @@ -88,6 +90,10 @@ parse_cli_options() {
BOB_VERSION="$2"
shift
;;
-r|--rn-version)
RN_VERSION="$2"
shift
;;
-s|--slug)
PROJECT_SLUG="$2"
shift
Expand Down Expand Up @@ -169,6 +175,7 @@ create_library() {
fi
echo "-- Creating library $PROJECT_SLUG with create-react-native-library@$BOB_VERSION"
npm_config_yes=true npx "create-react-native-library@$BOB_VERSION" \
--react-native-version "$RN_VERSION" \
--slug "$PROJECT_SLUG" \
--description "An automated test" \
--author-name "James" \
Expand All @@ -179,7 +186,7 @@ create_library() {
--type module-new \
--example $example_type \
--local false \
"$base" > /dev/null
"$base"
Copy link
Collaborator Author

@Johennes Johennes Nov 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've removed the redirection here because it makes the script exit silently on error without any way to find out what went wrong.

As an example, [email protected] cannot generate for [email protected] apparently:

$ ./scripts/test-turbo-modules.sh -r 0.73.0 tm-test
ℹ️  Starting my-test-library
-- Creating library my-test-library with create-react-native-library@latest
ℹ Using [email protected] for the example
⠴ Copying files

The generated example app doesn't have community CLI installed
node:internal/process/promises:288
            triggerUncaughtException(err, true /* fromPromise */);
            ^

AssertionError [ERR_ASSERTION]: The generated example app doesn't have community CLI installed
    at Object.create [as handler] (/Users/jm/.npm/_npx/e106e660d51959d2/node_modules/create-react-native-library/lib/index.js:557:31) {
  generatedMessage: false,
  code: 'ERR_ASSERTION',
  actual: false,
  expected: true,
  operator: '=='
}

Node.js v18.19.1

exit_dir
}

Expand Down