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

Add react-native-prompt-android package #5

Draft
wants to merge 4 commits into
base: trunk
Choose a base branch
from
Draft
Show file tree
Hide file tree
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
15 changes: 14 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -100,5 +100,18 @@ fun getPackageVersion(projectName: String): String {
projectName == "react-native-clipboard" -> "@react-native-clipboard/clipboard"
else -> projectName
}
return packageDevDependencies.optString(jsonProperty)
val packageVersion = packageDevDependencies.optString(jsonProperty)

// Extract version from filename of tarball URL
val isTarball = packageVersion.endsWith(".tgz")
if (isTarball) {
// Replace special characters of package name as "npm pack" command does, to be used in the filename.
// Reference: https://github.com/npm/cli/blob/699c2d708d2a24b4f495a74974b2a345f33ee08a/lib/pack.js#L66-L67
val packageNameSanitized = jsonProperty.replace("@", "").replace("/", "-")
val fileName = packageVersion.substring(packageVersion.lastIndexOf("/") + 1)
val version = fileName.replace(packageNameSanitized + "-", "").replace(".tgz", "")
return version
}
Comment on lines +105 to +114
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This will calculate the version of the package from the tarball filename, as we do in Gutenberg (reference).


return packageVersion
}
5 changes: 5 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"@react-native-masked-view/masked-view": "0.2.6",
"@react-native-clipboard/clipboard": "1.9.0",
"react-native-gesture-handler": "2.3.1",
"react-native": "0.66.2"
"react-native": "0.66.2",
"react-native-prompt-android": "https://raw.githubusercontent.com/wordpress-mobile/react-native-prompt-android/wp-fork-only-android-changes/react-native-prompt-android-1.0.0.tgz"
},
"dependencies": {
"patch-package": "^6.4.7"
Expand Down
2 changes: 2 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,5 @@ include(":react-native-clipboard")
project(":react-native-clipboard").projectDir = File(rootProject.projectDir, "node_modules/@react-native-clipboard/clipboard/android")
include(":react-native-gesture-handler")
project(":react-native-gesture-handler").projectDir = File(rootProject.projectDir, "node_modules/react-native-gesture-handler/android")
include(":react-native-prompt-android")
project(":react-native-prompt-android").projectDir = File(rootProject.projectDir, "node_modules/react-native-prompt-android/android")