From 584510f79f22b9d6f7bed49440c18848f49fa1f2 Mon Sep 17 00:00:00 2001 From: Alpha Date: Thu, 18 Mar 2021 18:32:41 -0400 Subject: [PATCH] chore: update dependencies --- .yarnrc | 3 + CONTRIBUTING.md | 6 +- android/.project | 17 ------ .../org.eclipse.buildship.core.prefs | 13 ----- android/gradle.properties | 6 +- example/android/.project | 17 ------ .../org.eclipse.buildship.core.prefs | 2 - example/android/app/build.gradle | 10 +++- .../android/app/src/debug/AndroidManifest.xml | 4 +- .../android/app/src/main/AndroidManifest.xml | 2 - .../MainApplication.java | 1 - .../app/src/main/res/values/styles.xml | 2 +- example/android/build.gradle | 5 +- example/android/gradle.properties | 2 +- .../gradle/wrapper/gradle-wrapper.properties | 2 +- example/android/gradlew | 33 +++++------ example/android/gradlew.bat | 3 + example/babel.config.js | 1 + example/{index.ts => index.tsx} | 0 .../project.pbxproj | 41 ++++++++----- example/ios/FileAccessExample/AppDelegate.m | 6 +- .../Base.lproj/LaunchScreen.xib | 42 -------------- example/ios/FileAccessExample/Info.plist | 2 - .../FileAccessExample/LaunchScreen.storyboard | 58 +++++++++++++++++++ example/ios/Podfile | 10 +++- example/package.json | 10 ++-- package.json | 39 ++++++++----- react-native-file-access.podspec | 6 +- scripts/bootstrap.js | 24 ++++++++ tsconfig.build.json | 5 ++ tsconfig.json | 2 +- 31 files changed, 199 insertions(+), 175 deletions(-) create mode 100644 .yarnrc delete mode 100644 android/.project delete mode 100644 android/.settings/org.eclipse.buildship.core.prefs delete mode 100644 example/android/.project delete mode 100644 example/android/.settings/org.eclipse.buildship.core.prefs rename example/{index.ts => index.tsx} (100%) delete mode 100644 example/ios/FileAccessExample/Base.lproj/LaunchScreen.xib create mode 100644 example/ios/FileAccessExample/LaunchScreen.storyboard create mode 100644 scripts/bootstrap.js create mode 100644 tsconfig.build.json diff --git a/.yarnrc b/.yarnrc new file mode 100644 index 0000000..fedc0f1 --- /dev/null +++ b/.yarnrc @@ -0,0 +1,3 @@ +# Override Yarn command so we can automatically setup the repo on running `yarn` + +yarn-path "scripts/bootstrap.js" diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 8c4023c..87878b6 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -4,10 +4,10 @@ We want this community to be friendly and respectful to each other. Please follo ## Development workflow -To get started with the project, run `yarn bootstrap` in the root directory to install the required dependencies for each package: +To get started with the project, run `yarn` in the root directory to install the required dependencies for each package: ```sh -yarn bootstrap +yarn ``` While developing, you can run the [example app](/example/) to test your changes. @@ -61,7 +61,7 @@ We follow the [conventional commits specification](https://www.conventionalcommi - `feat`: new features, e.g. add new method to the module. - `refactor`: code refactor, e.g. migrate from class components to hooks. - `docs`: changes into documentation, e.g. add usage example for the module.. -- `test`: adding or updating tests, eg add integration tests using detox. +- `test`: adding or updating tests, e.g. add integration tests using detox. - `chore`: tooling changes, e.g. change CI config. Our pre-commit hooks verify that your commit message matches this format when committing. diff --git a/android/.project b/android/.project deleted file mode 100644 index 0e0a1ba..0000000 --- a/android/.project +++ /dev/null @@ -1,17 +0,0 @@ - - - android_ - Project android_ created by Buildship. - - - - - org.eclipse.buildship.core.gradleprojectbuilder - - - - - - org.eclipse.buildship.core.gradleprojectnature - - diff --git a/android/.settings/org.eclipse.buildship.core.prefs b/android/.settings/org.eclipse.buildship.core.prefs deleted file mode 100644 index 8c253d6..0000000 --- a/android/.settings/org.eclipse.buildship.core.prefs +++ /dev/null @@ -1,13 +0,0 @@ -arguments= -auto.sync=false -build.scans.enabled=false -connection.gradle.distribution=GRADLE_DISTRIBUTION(VERSION(6.0)) -connection.project.dir= -eclipse.preferences.version=1 -gradle.user.home= -java.home=/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home -jvm.arguments= -offline.mode=false -override.workspace.settings=true -show.console.view=true -show.executions.view=true diff --git a/android/gradle.properties b/android/gradle.properties index b0a78a4..1e8872b 100644 --- a/android/gradle.properties +++ b/android/gradle.properties @@ -1,4 +1,4 @@ FileAccess_kotlinVersion=1.4.10 -FileAccess_compileSdkVersion=28 -FileAccess_buildToolsVersion=28.0.3 -FileAccess_targetSdkVersion=28 +FileAccess_compileSdkVersion=29 +FileAccess_buildToolsVersion=29.0.2 +FileAccess_targetSdkVersion=29 diff --git a/example/android/.project b/example/android/.project deleted file mode 100644 index 3964dd3..0000000 --- a/example/android/.project +++ /dev/null @@ -1,17 +0,0 @@ - - - android - Project android created by Buildship. - - - - - org.eclipse.buildship.core.gradleprojectbuilder - - - - - - org.eclipse.buildship.core.gradleprojectnature - - diff --git a/example/android/.settings/org.eclipse.buildship.core.prefs b/example/android/.settings/org.eclipse.buildship.core.prefs deleted file mode 100644 index e889521..0000000 --- a/example/android/.settings/org.eclipse.buildship.core.prefs +++ /dev/null @@ -1,2 +0,0 @@ -connection.project.dir= -eclipse.preferences.version=1 diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle index 6781748..8d37b7f 100644 --- a/example/android/app/build.gradle +++ b/example/android/app/build.gradle @@ -18,7 +18,7 @@ import com.android.build.OutputFile * // the entry file for bundle generation * entryFile: "index.android.js", * - * // https://facebook.github.io/react-native/docs/performance#enable-the-ram-format + * // https://reactnative.dev/docs/performance#enable-the-ram-format * bundleCommand: "ram-bundle", * * // whether to bundle JS and assets in debug mode @@ -77,6 +77,7 @@ import com.android.build.OutputFile project.ext.react = [ enableHermes: false, // clean and rebuild if changing + entryFile: "index.tsx", ] apply from: "../../node_modules/react-native/react.gradle" @@ -119,6 +120,8 @@ def jscFlavor = 'org.webkit:android-jsc:+' def enableHermes = project.ext.react.get("enableHermes", false); android { + ndkVersion rootProject.ext.ndkVersion + compileSdkVersion rootProject.ext.compileSdkVersion compileOptions { @@ -155,7 +158,7 @@ android { } release { // Caution! In production, you need to generate your own keystore file. - // see https://facebook.github.io/react-native/docs/signed-apk-android. + // see https://reactnative.dev/docs/signed-apk-android. signingConfig signingConfigs.debug minifyEnabled enableProguardInReleaseBuilds proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" @@ -166,11 +169,12 @@ android { variant.outputs.each { output -> // For each separate APK per architecture, set a unique version code as described here: // https://developer.android.com/studio/build/configure-apk-splits.html + // Example: versionCode 1 will generate 1001 for armeabi-v7a, 1002 for x86, etc. def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4] def abi = output.getFilter(OutputFile.ABI) if (abi != null) { // null for the universal-debug, universal-release variants output.versionCodeOverride = - versionCodes.get(abi) * 1048576 + defaultConfig.versionCode + defaultConfig.versionCode * 1000 + versionCodes.get(abi) } } diff --git a/example/android/app/src/debug/AndroidManifest.xml b/example/android/app/src/debug/AndroidManifest.xml index fa26aa5..0c4927b 100644 --- a/example/android/app/src/debug/AndroidManifest.xml +++ b/example/android/app/src/debug/AndroidManifest.xml @@ -4,5 +4,7 @@ - + + + diff --git a/example/android/app/src/main/AndroidManifest.xml b/example/android/app/src/main/AndroidManifest.xml index 2b98a7e..4363d51 100644 --- a/example/android/app/src/main/AndroidManifest.xml +++ b/example/android/app/src/main/AndroidManifest.xml @@ -21,7 +21,5 @@ - - diff --git a/example/android/app/src/main/java/com/example/reactnativefileaccess/MainApplication.java b/example/android/app/src/main/java/com/example/reactnativefileaccess/MainApplication.java index df3bd9b..6f24d28 100644 --- a/example/android/app/src/main/java/com/example/reactnativefileaccess/MainApplication.java +++ b/example/android/app/src/main/java/com/example/reactnativefileaccess/MainApplication.java @@ -30,7 +30,6 @@ protected List getPackages() { // Packages that cannot be autolinked yet can be added manually here, for FileAccessExample: // packages.add(new MyReactNativePackage()); packages.add(new FileAccessPackage()); - return packages; } diff --git a/example/android/app/src/main/res/values/styles.xml b/example/android/app/src/main/res/values/styles.xml index 62fe59f..9fab0be 100644 --- a/example/android/app/src/main/res/values/styles.xml +++ b/example/android/app/src/main/res/values/styles.xml @@ -1,7 +1,7 @@ - diff --git a/example/android/build.gradle b/example/android/build.gradle index e0dce9e..75d3574 100644 --- a/example/android/build.gradle +++ b/example/android/build.gradle @@ -3,16 +3,17 @@ buildscript { ext { buildToolsVersion = "29.0.3" - minSdkVersion = 18 + minSdkVersion = 21 compileSdkVersion = 30 targetSdkVersion = 30 + ndkVersion = "20.1.5948944" } repositories { google() jcenter() } dependencies { - classpath("com.android.tools.build:gradle:3.5.4") + classpath("com.android.tools.build:gradle:4.1.0") // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files diff --git a/example/android/gradle.properties b/example/android/gradle.properties index 369dd63..9a8bdd4 100644 --- a/example/android/gradle.properties +++ b/example/android/gradle.properties @@ -19,4 +19,4 @@ android.useAndroidX=true android.enableJetifier=true -FLIPPER_VERSION=0.54.0 +FLIPPER_VERSION=0.75.1 diff --git a/example/android/gradle/wrapper/gradle-wrapper.properties b/example/android/gradle/wrapper/gradle-wrapper.properties index 8422670..14e30f7 100644 --- a/example/android/gradle/wrapper/gradle-wrapper.properties +++ b/example/android/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.2-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/example/android/gradlew b/example/android/gradlew index de204e7..2fe81a7 100755 --- a/example/android/gradlew +++ b/example/android/gradlew @@ -7,7 +7,7 @@ # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # -# http://www.apache.org/licenses/LICENSE-2.0 +# https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, @@ -125,7 +125,7 @@ if $darwin; then GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" fi -# For Cygwin, switch paths to Windows format before running java +# For Cygwin or MSYS, switch paths to Windows format before running java if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then APP_HOME=`cygpath --path --mixed "$APP_HOME"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` @@ -154,19 +154,19 @@ if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then else eval `echo args$i`="\"$arg\"" fi - i=$((i+1)) + i=`expr $i + 1` done case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + 0) set -- ;; + 1) set -- "$args0" ;; + 2) set -- "$args0" "$args1" ;; + 3) set -- "$args0" "$args1" "$args2" ;; + 4) set -- "$args0" "$args1" "$args2" "$args3" ;; + 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; esac fi @@ -175,14 +175,9 @@ save () { for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done echo " " } -APP_ARGS=$(save "$@") +APP_ARGS=`save "$@"` # Collect all arguments for the java command, following the shell quoting and substitution rules eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" -# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong -if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then - cd "$(dirname "$0")" -fi - exec "$JAVACMD" "$@" diff --git a/example/android/gradlew.bat b/example/android/gradlew.bat index 9991c50..b742c99 100644 --- a/example/android/gradlew.bat +++ b/example/android/gradlew.bat @@ -29,6 +29,9 @@ if "%DIRNAME%" == "" set DIRNAME=. set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" diff --git a/example/babel.config.js b/example/babel.config.js index db64a00..adea77b 100644 --- a/example/babel.config.js +++ b/example/babel.config.js @@ -7,6 +7,7 @@ module.exports = { [ 'module-resolver', { + extensions: ['.tsx', '.ts', '.js', '.json'], alias: { [pak.name]: path.join(__dirname, '..', pak.source), }, diff --git a/example/index.ts b/example/index.tsx similarity index 100% rename from example/index.ts rename to example/index.tsx diff --git a/example/ios/FileAccessExample.xcodeproj/project.pbxproj b/example/ios/FileAccessExample.xcodeproj/project.pbxproj index 515af14..7f7d977 100644 --- a/example/ios/FileAccessExample.xcodeproj/project.pbxproj +++ b/example/ios/FileAccessExample.xcodeproj/project.pbxproj @@ -9,11 +9,11 @@ /* Begin PBXBuildFile section */ 0D1336C0461A88D01186E375 /* libPods-FileAccessExample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = BCEA90A70F4BEAD7E9FA28B2 /* libPods-FileAccessExample.a */; }; 13B07FBC1A68108700A75B9A /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB01A68108700A75B9A /* AppDelegate.m */; }; - 13B07FBD1A68108700A75B9A /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB11A68108700A75B9A /* LaunchScreen.xib */; }; 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; }; 13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; }; 20F357B024636CDF00C146DC /* File.swift in Sources */ = {isa = PBXBuildFile; fileRef = 20F357AF24636CDF00C146DC /* File.swift */; }; B5597908258D6A7700BB54DC /* BundledData.txt in Resources */ = {isa = PBXBuildFile; fileRef = B5597907258D6A7700BB54DC /* BundledData.txt */; }; + B5FD1AB72603ADC800FDFA94 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = B5FD1AB62603ADC700FDFA94 /* LaunchScreen.storyboard */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -21,7 +21,6 @@ 13B07F961A680F5B00A75B9A /* FileAccessExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = FileAccessExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; 13B07FAF1A68108700A75B9A /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = FileAccessExample/AppDelegate.h; sourceTree = ""; }; 13B07FB01A68108700A75B9A /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AppDelegate.m; path = FileAccessExample/AppDelegate.m; sourceTree = ""; }; - 13B07FB21A68108700A75B9A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 13B07FB51A68108700A75B9A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = FileAccessExample/Images.xcassets; sourceTree = ""; }; 13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = FileAccessExample/Info.plist; sourceTree = ""; }; 13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = FileAccessExample/main.m; sourceTree = ""; }; @@ -31,6 +30,7 @@ 4D7192F03A36A017E887435B /* Pods-FileAccessExample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-FileAccessExample.release.xcconfig"; path = "Target Support Files/Pods-FileAccessExample/Pods-FileAccessExample.release.xcconfig"; sourceTree = ""; }; 871719007ECC5EAD276C345C /* Pods-FileAccessExample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-FileAccessExample.debug.xcconfig"; path = "Target Support Files/Pods-FileAccessExample/Pods-FileAccessExample.debug.xcconfig"; sourceTree = ""; }; B5597907258D6A7700BB54DC /* BundledData.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = BundledData.txt; path = ../android/app/src/main/assets/BundledData.txt; sourceTree = ""; }; + B5FD1AB62603ADC700FDFA94 /* LaunchScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = LaunchScreen.storyboard; path = FileAccessExample/LaunchScreen.storyboard; sourceTree = ""; }; BCEA90A70F4BEAD7E9FA28B2 /* libPods-FileAccessExample.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-FileAccessExample.a"; sourceTree = BUILT_PRODUCTS_DIR; }; ED297162215061F000B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; }; /* End PBXFileReference section */ @@ -55,7 +55,7 @@ 13B07FB01A68108700A75B9A /* AppDelegate.m */, 13B07FB51A68108700A75B9A /* Images.xcassets */, 13B07FB61A68108700A75B9A /* Info.plist */, - 13B07FB11A68108700A75B9A /* LaunchScreen.xib */, + B5FD1AB62603ADC700FDFA94 /* LaunchScreen.storyboard */, 13B07FB71A68108700A75B9A /* main.m */, ); name = FileAccessExample; @@ -126,6 +126,7 @@ 13B07F8E1A680F5B00A75B9A /* Resources */, 00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */, 1E18BD612433361B4BAFC0F7 /* [CP] Copy Pods Resources */, + B22BE94C3AC340858EA3F0E1 /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -175,7 +176,7 @@ buildActionMask = 2147483647; files = ( 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */, - 13B07FBD1A68108700A75B9A /* LaunchScreen.xib in Resources */, + B5FD1AB72603ADC800FDFA94 /* LaunchScreen.storyboard in Resources */, B5597908258D6A7700BB54DC /* BundledData.txt in Resources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -215,6 +216,24 @@ shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-FileAccessExample/Pods-FileAccessExample-resources.sh\"\n"; showEnvVarsInLog = 0; }; + B22BE94C3AC340858EA3F0E1 /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-FileAccessExample/Pods-FileAccessExample-frameworks.sh", + "${PODS_XCFRAMEWORKS_BUILD_DIR}/OpenSSL/OpenSSL.framework/OpenSSL", + ); + name = "[CP] Embed Pods Frameworks"; + outputPaths = ( + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/OpenSSL.framework", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-FileAccessExample/Pods-FileAccessExample-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; CCCC07BCAFDEF1FCADC0D0C9 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -271,18 +290,6 @@ }; /* End PBXSourcesBuildPhase section */ -/* Begin PBXVariantGroup section */ - 13B07FB11A68108700A75B9A /* LaunchScreen.xib */ = { - isa = PBXVariantGroup; - children = ( - 13B07FB21A68108700A75B9A /* Base */, - ); - name = LaunchScreen.xib; - path = FileAccessExample; - sourceTree = ""; - }; -/* End PBXVariantGroup section */ - /* Begin XCBuildConfiguration section */ 13B07F941A680F5B00A75B9A /* Debug */ = { isa = XCBuildConfiguration; @@ -369,6 +376,7 @@ COPY_PHASE_STRIP = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; + "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "arm64 "; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; GCC_NO_COMMON_BLOCKS = YES; @@ -422,6 +430,7 @@ COPY_PHASE_STRIP = YES; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; + "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "arm64 "; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_NO_COMMON_BLOCKS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; diff --git a/example/ios/FileAccessExample/AppDelegate.m b/example/ios/FileAccessExample/AppDelegate.m index 50e56ae..62f1688 100644 --- a/example/ios/FileAccessExample/AppDelegate.m +++ b/example/ios/FileAccessExample/AppDelegate.m @@ -41,7 +41,11 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:( moduleName:@"FileAccessExample" initialProperties:nil]; - rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1]; + if (@available(iOS 13.0, *)) { + rootView.backgroundColor = [UIColor systemBackgroundColor]; + } else { + rootView.backgroundColor = [UIColor whiteColor]; + } self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; UIViewController *rootViewController = [UIViewController new]; diff --git a/example/ios/FileAccessExample/Base.lproj/LaunchScreen.xib b/example/ios/FileAccessExample/Base.lproj/LaunchScreen.xib deleted file mode 100644 index 37c4112..0000000 --- a/example/ios/FileAccessExample/Base.lproj/LaunchScreen.xib +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/example/ios/FileAccessExample/Info.plist b/example/ios/FileAccessExample/Info.plist index 1cb9664..0d13547 100644 --- a/example/ios/FileAccessExample/Info.plist +++ b/example/ios/FileAccessExample/Info.plist @@ -26,8 +26,6 @@ NSAppTransportSecurity - NSAllowsArbitraryLoads - NSExceptionDomains localhost diff --git a/example/ios/FileAccessExample/LaunchScreen.storyboard b/example/ios/FileAccessExample/LaunchScreen.storyboard new file mode 100644 index 0000000..fd98ef6 --- /dev/null +++ b/example/ios/FileAccessExample/LaunchScreen.storyboard @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/example/ios/Podfile b/example/ios/Podfile index b2e26e0..3d9e401 100644 --- a/example/ios/Podfile +++ b/example/ios/Podfile @@ -6,7 +6,11 @@ platform :ios, '10.0' target 'FileAccessExample' do config = use_native_modules! - use_react_native!(:path => config["reactNativePath"]) + use_react_native!( + :path => config[:reactNativePath], + # to enable hermes on iOS, change `false` to `true` and then install pods + :hermes_enabled => false + ) pod 'react-native-file-access', :path => '../..' @@ -14,8 +18,8 @@ target 'FileAccessExample' do # # Note that if you have use_frameworks! enabled, Flipper will not work and # you should disable these next few lines. - use_flipper! + use_flipper!() post_install do |installer| - flipper_post_install(installer) + react_native_post_install(installer) end end diff --git a/example/package.json b/example/package.json index ab032a5..e609962 100644 --- a/example/package.json +++ b/example/package.json @@ -9,13 +9,13 @@ "start": "react-native start" }, "dependencies": { - "react": "16.13.1", - "react-native": "0.63.4" + "react": "17.0.1", + "react-native": "0.64.0" }, "devDependencies": { - "@babel/core": "^7.9.6", - "@babel/runtime": "^7.9.6", + "@babel/core": "^7.12.10", + "@babel/runtime": "^7.12.5", "babel-plugin-module-resolver": "^4.0.0", - "metro-react-native-babel-preset": "^0.59.0" + "metro-react-native-babel-preset": "^0.64.0" } } diff --git a/package.json b/package.json index 603f71f..e55faa2 100644 --- a/package.json +++ b/package.json @@ -4,19 +4,19 @@ "description": "Filesystem access for React Native", "main": "lib/commonjs/index", "module": "lib/module/index", - "types": "lib/typescript/src/index.d.ts", + "types": "lib/typescript/index.d.ts", "react-native": "src/index", "source": "src/index", "files": [ "src", "lib", - "android/build.gradle", - "android/gradle.properties", - "android/src", + "android", "ios", "cpp", "react-native-file-access.podspec", "!lib/typescript/example", + "!android/build", + "!ios/build", "!**/__tests__", "!**/__fixtures__", "!**/__mocks__" @@ -47,26 +47,29 @@ "url": "https://github.com/alpha0010/react-native-file-access/issues" }, "homepage": "https://github.com/alpha0010/react-native-file-access#readme", + "publishConfig": { + "registry": "https://registry.npmjs.org/" + }, "devDependencies": { - "@commitlint/config-conventional": "^8.3.4", - "@react-native-community/bob": "^0.16.2", + "@commitlint/config-conventional": "^11.0.0", "@react-native-community/eslint-config": "^2.0.0", - "@release-it/conventional-changelog": "^1.1.4", + "@release-it/conventional-changelog": "^2.0.0", "@types/jest": "^26.0.0", "@types/react": "^16.9.19", "@types/react-native": "0.62.13", - "commitlint": "^8.3.5", + "commitlint": "^11.0.0", "eslint": "^7.2.0", - "eslint-config-prettier": "^6.11.0", + "eslint-config-prettier": "^7.0.0", "eslint-plugin-prettier": "^3.1.3", "husky": "^4.2.5", "jest": "^26.0.1", "pod-install": "^0.1.0", "prettier": "^2.0.5", - "react": "16.11.0", - "react-native": "0.62.2", - "release-it": "^13.5.8", - "typescript": "^3.8.3" + "react": "16.13.1", + "react-native": "0.63.4", + "react-native-builder-bob": "^0.18.1", + "release-it": "^14.2.2", + "typescript": "^4.1.3" }, "peerDependencies": { "react": "*", @@ -108,6 +111,7 @@ } }, "eslintConfig": { + "root": true, "extends": [ "@react-native-community", "prettier" @@ -136,13 +140,18 @@ "trailingComma": "es5", "useTabs": false }, - "@react-native-community/bob": { + "react-native-builder-bob": { "source": "src", "output": "lib", "targets": [ "commonjs", "module", - "typescript" + [ + "typescript", + { + "project": "tsconfig.build.json" + } + ] ] } } diff --git a/react-native-file-access.podspec b/react-native-file-access.podspec index 1cbd035..a23d4cd 100644 --- a/react-native-file-access.podspec +++ b/react-native-file-access.podspec @@ -10,12 +10,10 @@ Pod::Spec.new do |s| s.license = package["license"] s.authors = package["author"] - s.platforms = { :ios => "9.0" } + s.platforms = { :ios => "10.0" } s.source = { :git => "https://github.com/alpha0010/react-native-file-access.git", :tag => "#{s.version}" } - s.source_files = "ios/**/*.{h,m,mm,swift}" - - s.dependency "React" + s.dependency "React-Core" end diff --git a/scripts/bootstrap.js b/scripts/bootstrap.js new file mode 100644 index 0000000..6ba193d --- /dev/null +++ b/scripts/bootstrap.js @@ -0,0 +1,24 @@ +const path = require('path'); +const child_process = require('child_process'); + +const root = path.resolve(__dirname, '..'); +const args = process.argv.slice(2); +const options = { + cwd: process.cwd(), + env: process.env, + stdio: 'inherit', + encoding: 'utf-8', +}; + +let result; + +if (process.cwd() !== root || args.length) { + // We're not in the root of the project, or additional arguments were passed + // In this case, forward the command to `yarn` + result = child_process.spawnSync('yarn', args, options); +} else { + // If `yarn` is run without arguments, perform bootstrap + result = child_process.spawnSync('yarn', ['bootstrap'], options); +} + +process.exitCode = result.status; diff --git a/tsconfig.build.json b/tsconfig.build.json new file mode 100644 index 0000000..d8bc046 --- /dev/null +++ b/tsconfig.build.json @@ -0,0 +1,5 @@ + +{ + "extends": "./tsconfig", + "exclude": ["example", "jest"] +} diff --git a/tsconfig.json b/tsconfig.json index dc0d13d..4eaf6f3 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,6 +1,6 @@ { "compilerOptions": { - "baseUrl": ".", + "baseUrl": "./", "paths": { "react-native-file-access": ["./src/index"] },