diff --git a/.gitignore b/.gitignore index 746b7536..4a13b123 100644 --- a/.gitignore +++ b/.gitignore @@ -7,10 +7,11 @@ yarn-error.log # jest coverage/ -# tsc +# tsc / build # dist android/build +*.tgz # OSX # diff --git a/.npmignore b/.npmignore deleted file mode 100644 index 769c95e7..00000000 --- a/.npmignore +++ /dev/null @@ -1,3 +0,0 @@ -examples -images -.git \ No newline at end of file diff --git a/bun.lock b/bun.lock index 157c3ac9..257e04ff 100644 --- a/bun.lock +++ b/bun.lock @@ -1,5 +1,6 @@ { "lockfileVersion": 1, + "configVersion": 0, "workspaces": { "": { "name": "react-native-onesignal", diff --git a/examples/RNOneSignalTS/README.md b/examples/RNOneSignalTS/README.md index 5bfa699b..523417a5 100644 --- a/examples/RNOneSignalTS/README.md +++ b/examples/RNOneSignalTS/README.md @@ -4,8 +4,7 @@ This is a new [**React Native**](https://reactnative.dev) project, bootstrapped > **Note**: Make sure you have completed the [Set Up Your Environment](https://reactnative.dev/docs/set-up-your-environment) guide before proceeding. -Also make sure to run the link command in root: -`bun link` +Run `bun run setup` to package the bundle and use it for the example. ## Step 1: Start Metro @@ -23,32 +22,22 @@ With Metro running, open a new terminal window/pane from the root of your React ### Android +Run: + ```sh bun run android ``` ### iOS -For iOS, remember to install CocoaPods dependencies (this only needs to be run on first clone or after updating native deps). - -The first time you create a new project, run the Ruby bundler to install CocoaPods itself: - -```sh -bundle install -``` - -Then, and every time you update your native dependencies, run: - -```sh -bundle exec pod install -``` - -For more information, please visit [CocoaPods Getting Started guide](https://guides.cocoapods.org/using/getting-started.html). +Run: ```sh bun run ios ``` +If you get an error, you may need to have the simulator be open/running first. + If everything is set up correctly, you should see your new app running in the Android Emulator, iOS Simulator, or your connected device. This is one way to run your app — you can also build it directly from Android Studio or Xcode. diff --git a/examples/RNOneSignalTS/bun.lock b/examples/RNOneSignalTS/bun.lock index a30b685a..b7383fb8 100644 --- a/examples/RNOneSignalTS/bun.lock +++ b/examples/RNOneSignalTS/bun.lock @@ -1,5 +1,6 @@ { "lockfileVersion": 1, + "configVersion": 0, "workspaces": { "": { "name": "RNOneSignalTS", @@ -7,7 +8,7 @@ "@react-native/new-app-screen": "0.81.4", "react": "19.1.0", "react-native": "0.81.4", - "react-native-onesignal": "link:react-native-onesignal", + "react-native-onesignal": "file:../../react-native-onesignal.tgz", "react-native-safe-area-context": "^5.5.2", }, "devDependencies": { @@ -895,7 +896,7 @@ "react-native": ["react-native@0.81.4", "", { "dependencies": { "@jest/create-cache-key-function": "^29.7.0", "@react-native/assets-registry": "0.81.4", "@react-native/codegen": "0.81.4", "@react-native/community-cli-plugin": "0.81.4", "@react-native/gradle-plugin": "0.81.4", "@react-native/js-polyfills": "0.81.4", "@react-native/normalize-colors": "0.81.4", "@react-native/virtualized-lists": "0.81.4", "abort-controller": "^3.0.0", "anser": "^1.4.9", "ansi-regex": "^5.0.0", "babel-jest": "^29.7.0", "babel-plugin-syntax-hermes-parser": "0.29.1", "base64-js": "^1.5.1", "commander": "^12.0.0", "flow-enums-runtime": "^0.0.6", "glob": "^7.1.1", "invariant": "^2.2.4", "jest-environment-node": "^29.7.0", "memoize-one": "^5.0.0", "metro-runtime": "^0.83.1", "metro-source-map": "^0.83.1", "nullthrows": "^1.1.1", "pretty-format": "^29.7.0", "promise": "^8.3.0", "react-devtools-core": "^6.1.5", "react-refresh": "^0.14.0", "regenerator-runtime": "^0.13.2", "scheduler": "0.26.0", "semver": "^7.1.3", "stacktrace-parser": "^0.1.10", "whatwg-fetch": "^3.0.0", "ws": "^6.2.3", "yargs": "^17.6.2" }, "peerDependencies": { "@types/react": "^19.1.0", "react": "^19.1.0" }, "optionalPeers": ["@types/react"], "bin": { "react-native": "cli.js" } }, "sha512-bt5bz3A/+Cv46KcjV0VQa+fo7MKxs17RCcpzjftINlen4ZDUl0I6Ut+brQ2FToa5oD0IB0xvQHfmsg2EDqsZdQ=="], - "react-native-onesignal": ["react-native-onesignal@link:react-native-onesignal", {}], + "react-native-onesignal": ["react-native-onesignal@../../react-native-onesignal.tgz", { "dependencies": { "invariant": "^2.2.4" } }], "react-native-safe-area-context": ["react-native-safe-area-context@5.6.2", "", { "peerDependencies": { "react": "*", "react-native": "*" } }, "sha512-4XGqMNj5qjUTYywJqpdWZ9IG8jgkS3h06sfVjfw5yZQZfWnRFXczi0GnYyFyCc2EBps/qFmoCH8fez//WumdVg=="], diff --git a/examples/RNOneSignalTS/ios/Podfile.lock b/examples/RNOneSignalTS/ios/Podfile.lock index af15b3d0..f5dcb5fc 100644 --- a/examples/RNOneSignalTS/ios/Podfile.lock +++ b/examples/RNOneSignalTS/ios/Podfile.lock @@ -2665,7 +2665,7 @@ SPEC CHECKSUMS: React-logger: a3cb5b29c32b8e447b5a96919340e89334062b48 React-Mapbuffer: 9d2434a42701d6144ca18f0ca1c4507808ca7696 React-microtasksnativemodule: 75b6604b667d297292345302cc5bfb6b6aeccc1b - react-native-onesignal: b68c981956150f288c1585889871affcef3c0b8b + react-native-onesignal: 6c5758aa56975db4bca9956d18d83dd62444c931 react-native-safe-area-context: c00143b4823773bba23f2f19f85663ae89ceb460 React-NativeModulesApple: 879fbdc5dcff7136abceb7880fe8a2022a1bd7c3 React-oscompat: 93b5535ea7f7dff46aaee4f78309a70979bdde9d diff --git a/examples/RNOneSignalTS/package.json b/examples/RNOneSignalTS/package.json index 89fedf3d..856f7301 100644 --- a/examples/RNOneSignalTS/package.json +++ b/examples/RNOneSignalTS/package.json @@ -3,6 +3,9 @@ "version": "0.0.1", "private": true, "scripts": { + "setup": "./setup.sh", + "preandroid": "bun run setup", + "preios": "bun run setup", "android": "react-native run-android", "ios": "react-native run-ios", "start": "react-native start" @@ -11,7 +14,7 @@ "@react-native/new-app-screen": "0.81.4", "react": "19.1.0", "react-native": "0.81.4", - "react-native-onesignal": "link:react-native-onesignal", + "react-native-onesignal": "file:../../react-native-onesignal.tgz", "react-native-safe-area-context": "^5.5.2" }, "devDependencies": { diff --git a/examples/RNOneSignalTS/setup.sh b/examples/RNOneSignalTS/setup.sh new file mode 100755 index 00000000..149142c5 --- /dev/null +++ b/examples/RNOneSignalTS/setup.sh @@ -0,0 +1,21 @@ +ORIGINAL_DIR=$(pwd) + +# Build root package +cd ../../ +bun run build + +rm -f react-native-onesignal.tgz +bun pm pack +mv react-native-onesignal-*.tgz react-native-onesignal.tgz + +# Use fresh install of the package +cd $ORIGINAL_DIR +rm -rf node_modules/react-native-onesignal +bun i + +# Reinstall pods to pick up the updated native module +if [ -d "ios" ]; then + cd ios + pod install + cd .. +fi diff --git a/package.json b/package.json index f372600f..ca99c73b 100644 --- a/package.json +++ b/package.json @@ -2,6 +2,12 @@ "name": "react-native-onesignal", "version": "5.2.14", "description": "React Native OneSignal SDK", + "files": [ + "dist", + "android", + "ios", + "react-native-onesignal.podspec" + ], "main": "dist/index.js", "types": "dist/index.d.ts", "scripts": {