From 21641a7ea7a029a6f5db7c89d156e8916f888335 Mon Sep 17 00:00:00 2001 From: Eric Lambrecht Date: Wed, 3 Oct 2018 17:25:37 -0700 Subject: [PATCH] reorganize to handle metro symlink fail The react native bundler, 'metro', doesn't follow symlinks. This meant that in the example app we couldn't do import Foo from "react-native-feed-media-audio-player" when the library was installed via 'npm install ../package', because that npm a symlink in 'node_modules/react-native-feed-media-audio-player' and metro wouldn't follow it. Maddening. Hopefully this will be fixed with: https://github.com/facebook/metro/pull/257 This patch inverts things, so the top level 'package' directory is a symlink, and the node_modules/react... is the actual source. Now we can run the example app while changing code in the library. --- example/.babelrc | 3 + example/.buckconfig | 6 + example/.flowconfig | 70 + example/.gitattributes | 1 + example/.gitignore | 58 + example/.watchmanconfig | 1 + example/App.js | 61 + example/android/app/BUCK | 65 + example/android/app/build.gradle | 151 + example/android/app/proguard-rules.pro | 17 + .../android/app/src/main/AndroidManifest.xml | 26 + .../main/java/com/example/MainActivity.java | 15 + .../java/com/example/MainApplication.java | 47 + .../src/main/res/mipmap-hdpi/ic_launcher.png | Bin 0 -> 3056 bytes .../res/mipmap-hdpi/ic_launcher_round.png | Bin 0 -> 5024 bytes .../src/main/res/mipmap-mdpi/ic_launcher.png | Bin 0 -> 2096 bytes .../res/mipmap-mdpi/ic_launcher_round.png | Bin 0 -> 2858 bytes .../src/main/res/mipmap-xhdpi/ic_launcher.png | Bin 0 -> 4569 bytes .../res/mipmap-xhdpi/ic_launcher_round.png | Bin 0 -> 7098 bytes .../main/res/mipmap-xxhdpi/ic_launcher.png | Bin 0 -> 6464 bytes .../res/mipmap-xxhdpi/ic_launcher_round.png | Bin 0 -> 10676 bytes .../main/res/mipmap-xxxhdpi/ic_launcher.png | Bin 0 -> 9250 bytes .../res/mipmap-xxxhdpi/ic_launcher_round.png | Bin 0 -> 15523 bytes .../app/src/main/res/values/strings.xml | 3 + .../app/src/main/res/values/styles.xml | 8 + example/android/build.gradle | 39 + example/android/gradle.properties | 18 + .../android/gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 54329 bytes .../gradle/wrapper/gradle-wrapper.properties | 5 + example/android/gradlew | 172 + example/android/gradlew.bat | 84 + example/android/keystores/BUCK | 8 + .../keystores/debug.keystore.properties | 4 + example/android/settings.gradle | 5 + example/app.json | 4 + example/index.js | 7 + example/ios/example-tvOS/Info.plist | 54 + example/ios/example-tvOSTests/Info.plist | 24 + example/ios/example.xcodeproj/project.pbxproj | 1554 +++ .../xcschemes/example-tvOS.xcscheme | 129 + .../xcshareddata/xcschemes/example.xcscheme | 129 + example/ios/example/AppDelegate.h | 14 + example/ios/example/AppDelegate.m | 35 + .../ios/example/Base.lproj/LaunchScreen.xib | 42 + .../AppIcon.appiconset/Contents.json | 38 + .../ios/example/Images.xcassets/Contents.json | 6 + example/ios/example/Info.plist | 60 + example/ios/example/main.m | 16 + example/ios/exampleTests/Info.plist | 24 + example/ios/exampleTests/exampleTests.m | 68 + .../.gitignore | 2 +- .../README.md | 0 .../android}/build.gradle | 0 .../android}/src/main/AndroidManifest.xml | 0 .../android/react/RNFMAudioPlayerModule.java | 0 .../android/react/RNFMAudioPlayerPackage.java | 0 .../index.js | 0 .../ios}/FeedMedia/CWStatusBarNotification.h | 0 .../ios}/FeedMedia/FMAudioItem.h | 0 .../ios}/FeedMedia/FMAudioPlayer.h | 0 .../ios}/FeedMedia/FMError.h | 0 .../ios}/FeedMedia/FMLockScreenDelegate.h | 0 .../ios}/FeedMedia/FMLog.h | 0 .../ios}/FeedMedia/FMStation.h | 0 .../ios}/FeedMedia/FMStationArray.h | 0 .../ios}/FeedMedia/FeedMediaCore.h | 0 .../ios}/FeedMedia/libFeedMediaCore.a | Bin .../ios}/RNFMAudioPlayer.h | 0 .../ios}/RNFMAudioPlayer.m | 0 .../ios}/RNFMAudioPlayer.podspec | 0 .../RNFMAudioPlayer.xcodeproj/project.pbxproj | 0 .../contents.xcworkspacedata | 0 .../package.json | 0 example/package-lock.json | 8767 +++++++++++++++++ example/package.json | 24 + package | 1 + 76 files changed, 11864 insertions(+), 1 deletion(-) create mode 100644 example/.babelrc create mode 100644 example/.buckconfig create mode 100644 example/.flowconfig create mode 100644 example/.gitattributes create mode 100644 example/.gitignore create mode 100644 example/.watchmanconfig create mode 100644 example/App.js create mode 100644 example/android/app/BUCK create mode 100644 example/android/app/build.gradle create mode 100644 example/android/app/proguard-rules.pro create mode 100644 example/android/app/src/main/AndroidManifest.xml create mode 100644 example/android/app/src/main/java/com/example/MainActivity.java create mode 100644 example/android/app/src/main/java/com/example/MainApplication.java create mode 100644 example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png create mode 100644 example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png create mode 100644 example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png create mode 100644 example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png create mode 100644 example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png create mode 100644 example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png create mode 100644 example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png create mode 100644 example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png create mode 100644 example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png create mode 100644 example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png create mode 100644 example/android/app/src/main/res/values/strings.xml create mode 100644 example/android/app/src/main/res/values/styles.xml create mode 100644 example/android/build.gradle create mode 100644 example/android/gradle.properties create mode 100644 example/android/gradle/wrapper/gradle-wrapper.jar create mode 100644 example/android/gradle/wrapper/gradle-wrapper.properties create mode 100755 example/android/gradlew create mode 100644 example/android/gradlew.bat create mode 100644 example/android/keystores/BUCK create mode 100644 example/android/keystores/debug.keystore.properties create mode 100644 example/android/settings.gradle create mode 100644 example/app.json create mode 100644 example/index.js create mode 100644 example/ios/example-tvOS/Info.plist create mode 100644 example/ios/example-tvOSTests/Info.plist create mode 100644 example/ios/example.xcodeproj/project.pbxproj create mode 100644 example/ios/example.xcodeproj/xcshareddata/xcschemes/example-tvOS.xcscheme create mode 100644 example/ios/example.xcodeproj/xcshareddata/xcschemes/example.xcscheme create mode 100644 example/ios/example/AppDelegate.h create mode 100644 example/ios/example/AppDelegate.m create mode 100644 example/ios/example/Base.lproj/LaunchScreen.xib create mode 100644 example/ios/example/Images.xcassets/AppIcon.appiconset/Contents.json create mode 100644 example/ios/example/Images.xcassets/Contents.json create mode 100644 example/ios/example/Info.plist create mode 100644 example/ios/example/main.m create mode 100644 example/ios/exampleTests/Info.plist create mode 100644 example/ios/exampleTests/exampleTests.m rename .gitignore => example/node_modules/react-native-feed-media-audio-player/.gitignore (98%) rename README.md => example/node_modules/react-native-feed-media-audio-player/README.md (100%) rename {android => example/node_modules/react-native-feed-media-audio-player/android}/build.gradle (100%) rename {android => example/node_modules/react-native-feed-media-audio-player/android}/src/main/AndroidManifest.xml (100%) rename {android => example/node_modules/react-native-feed-media-audio-player/android}/src/main/java/fm/feed/android/react/RNFMAudioPlayerModule.java (100%) rename {android => example/node_modules/react-native-feed-media-audio-player/android}/src/main/java/fm/feed/android/react/RNFMAudioPlayerPackage.java (100%) rename index.js => example/node_modules/react-native-feed-media-audio-player/index.js (100%) rename {ios => example/node_modules/react-native-feed-media-audio-player/ios}/FeedMedia/CWStatusBarNotification.h (100%) rename {ios => example/node_modules/react-native-feed-media-audio-player/ios}/FeedMedia/FMAudioItem.h (100%) rename {ios => example/node_modules/react-native-feed-media-audio-player/ios}/FeedMedia/FMAudioPlayer.h (100%) rename {ios => example/node_modules/react-native-feed-media-audio-player/ios}/FeedMedia/FMError.h (100%) rename {ios => example/node_modules/react-native-feed-media-audio-player/ios}/FeedMedia/FMLockScreenDelegate.h (100%) rename {ios => example/node_modules/react-native-feed-media-audio-player/ios}/FeedMedia/FMLog.h (100%) rename {ios => example/node_modules/react-native-feed-media-audio-player/ios}/FeedMedia/FMStation.h (100%) rename {ios => example/node_modules/react-native-feed-media-audio-player/ios}/FeedMedia/FMStationArray.h (100%) rename {ios => example/node_modules/react-native-feed-media-audio-player/ios}/FeedMedia/FeedMediaCore.h (100%) rename {ios => example/node_modules/react-native-feed-media-audio-player/ios}/FeedMedia/libFeedMediaCore.a (100%) rename {ios => example/node_modules/react-native-feed-media-audio-player/ios}/RNFMAudioPlayer.h (100%) rename {ios => example/node_modules/react-native-feed-media-audio-player/ios}/RNFMAudioPlayer.m (100%) rename {ios => example/node_modules/react-native-feed-media-audio-player/ios}/RNFMAudioPlayer.podspec (100%) rename {ios => example/node_modules/react-native-feed-media-audio-player/ios}/RNFMAudioPlayer.xcodeproj/project.pbxproj (100%) rename {ios => example/node_modules/react-native-feed-media-audio-player/ios}/RNFMAudioPlayer.xcworkspace/contents.xcworkspacedata (100%) rename package.json => example/node_modules/react-native-feed-media-audio-player/package.json (100%) create mode 100644 example/package-lock.json create mode 100644 example/package.json create mode 120000 package diff --git a/example/.babelrc b/example/.babelrc new file mode 100644 index 0000000..d4b74b5 --- /dev/null +++ b/example/.babelrc @@ -0,0 +1,3 @@ +{ + "presets": ["module:metro-react-native-babel-preset"] +} diff --git a/example/.buckconfig b/example/.buckconfig new file mode 100644 index 0000000..934256c --- /dev/null +++ b/example/.buckconfig @@ -0,0 +1,6 @@ + +[android] + target = Google Inc.:Google APIs:23 + +[maven_repositories] + central = https://repo1.maven.org/maven2 diff --git a/example/.flowconfig b/example/.flowconfig new file mode 100644 index 0000000..1043c82 --- /dev/null +++ b/example/.flowconfig @@ -0,0 +1,70 @@ +[ignore] +; We fork some components by platform +.*/*[.]android.js + +; Ignore "BUCK" generated dirs +/\.buckd/ + +; Ignore unexpected extra "@providesModule" +.*/node_modules/.*/node_modules/fbjs/.* + +; Ignore duplicate module providers +; For RN Apps installed via npm, "Libraries" folder is inside +; "node_modules/react-native" but in the source repo it is in the root +.*/Libraries/react-native/React.js + +; Ignore polyfills +.*/Libraries/polyfills/.* + +; Ignore metro +.*/node_modules/metro/.* + +[include] + +[libs] +node_modules/react-native/Libraries/react-native/react-native-interface.js +node_modules/react-native/flow/ +node_modules/react-native/flow-github/ + +[options] +emoji=true + +esproposal.optional_chaining=enable +esproposal.nullish_coalescing=enable + +module.system=haste +module.system.haste.use_name_reducers=true +# get basename +module.system.haste.name_reducers='^.*/\([a-zA-Z0-9$_.-]+\.js\(\.flow\)?\)$' -> '\1' +# strip .js or .js.flow suffix +module.system.haste.name_reducers='^\(.*\)\.js\(\.flow\)?$' -> '\1' +# strip .ios suffix +module.system.haste.name_reducers='^\(.*\)\.ios$' -> '\1' +module.system.haste.name_reducers='^\(.*\)\.android$' -> '\1' +module.system.haste.name_reducers='^\(.*\)\.native$' -> '\1' +module.system.haste.paths.blacklist=.*/__tests__/.* +module.system.haste.paths.blacklist=.*/__mocks__/.* +module.system.haste.paths.blacklist=/node_modules/react-native/Libraries/Animated/src/polyfills/.* +module.system.haste.paths.whitelist=/node_modules/react-native/Libraries/.* + +munge_underscores=true + +module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> 'RelativeImageStub' + +module.file_ext=.js +module.file_ext=.jsx +module.file_ext=.json +module.file_ext=.native.js + +suppress_type=$FlowIssue +suppress_type=$FlowFixMe +suppress_type=$FlowFixMeProps +suppress_type=$FlowFixMeState + +suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\) +suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+ +suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy +suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError + +[version] +^0.78.0 diff --git a/example/.gitattributes b/example/.gitattributes new file mode 100644 index 0000000..d42ff18 --- /dev/null +++ b/example/.gitattributes @@ -0,0 +1 @@ +*.pbxproj -text diff --git a/example/.gitignore b/example/.gitignore new file mode 100644 index 0000000..661a542 --- /dev/null +++ b/example/.gitignore @@ -0,0 +1,58 @@ +# OSX +# +.DS_Store + +# Xcode +# +build/ +*.pbxuser +!default.pbxuser +*.mode1v3 +!default.mode1v3 +*.mode2v3 +!default.mode2v3 +*.perspectivev3 +!default.perspectivev3 +xcuserdata +*.xccheckout +*.moved-aside +DerivedData +*.hmap +*.ipa +*.xcuserstate +project.xcworkspace + +# Android/IntelliJ +# +build/ +.idea +.gradle +local.properties +*.iml + +# node.js +# +node_modules/* +!node_modules/react-native-feed-media-audio-player +!node_modules/react-native-feed-media-audio-player/** +npm-debug.log +yarn-error.log + +# BUCK +buck-out/ +\.buckd/ +*.keystore + +# fastlane +# +# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the +# screenshots whenever they are needed. +# For more information about the recommended setup visit: +# https://docs.fastlane.tools/best-practices/source-control/ + +*/fastlane/report.xml +*/fastlane/Preview.html +*/fastlane/screenshots + +# Bundle artifact +*.jsbundle diff --git a/example/.watchmanconfig b/example/.watchmanconfig new file mode 100644 index 0000000..9e26dfe --- /dev/null +++ b/example/.watchmanconfig @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/example/App.js b/example/App.js new file mode 100644 index 0000000..1f43c94 --- /dev/null +++ b/example/App.js @@ -0,0 +1,61 @@ +/** + * Sample React Native App + * https://github.com/facebook/react-native + * + * @format + * @flow + */ + +import React, {Component} from 'react'; +import {Platform, StyleSheet, Text, View, Button} from 'react-native'; +import AudioPlayer from 'react-native-feed-media-audio-player'; + +AudioPlayer.setToken("demo", "demo"); + +const instructions = Platform.select({ + ios: 'Press Cmd+R to reload,\n' + 'Cmd+D or shake for dev menu', + android: + 'Double tap R on your keyboard to reload,\n' + + 'Shake or press menu button for dev menu', +}); + +type Props = {}; +export default class App extends Component { + render() { + return ( + + Welcome to React Native! + To get started, edit App.js + {instructions} +