Skip to content

Commit

Permalink
chore: update outdated dependencies, fix prettier + flow types in pro…
Browse files Browse the repository at this point in the history
…cess
  • Loading branch information
mikehardy committed Jun 13, 2019
1 parent 90812e8 commit 6c5876f
Show file tree
Hide file tree
Showing 12 changed files with 769 additions and 760 deletions.
4 changes: 2 additions & 2 deletions .flowconfig
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
[ignore]
.*/node_modules/.*

[include]

Expand All @@ -9,4 +8,5 @@

[options]

[strict]
[untyped]
.*/node_modules/.*
5 changes: 3 additions & 2 deletions changelog.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
#!/usr/bin/env node

const git = require('simple-git');
const changelog = require('generate-changelog');
const generate_changelog = require('generate-changelog');
const fs = require('fs');
const idx = require('idx');
const argv = require('minimist')(process.argv.slice(1));

// eslint-disable-next-line handle-callback-err
git().tags((err, tags) => {
const currentChangelog = fs.readFileSync('./CHANGELOG.md');
const matched = tags.latest.match(/v\d+.\d+.\d+-(\d+)/);
const build = (idx(matched, _ => Number(_[1])) || 0) + 1;

changelog
generate_changelog
.generate({
major: argv.major,
minor: argv.minor,
Expand Down
2 changes: 1 addition & 1 deletion example/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.1'
classpath("com.android.tools.build:gradle:3.4.0")

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
Binary file modified example/android/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion example/android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip
18 changes: 17 additions & 1 deletion example/android/gradlew
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
#!/usr/bin/env sh

#
# Copyright 2015 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# 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
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

##############################################################################
##
## Gradle start up script for UN*X
Expand Down Expand Up @@ -28,7 +44,7 @@ APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
Expand Down
18 changes: 17 additions & 1 deletion example/android/gradlew.bat
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem http://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem

@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
Expand All @@ -14,7 +30,7 @@ set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

@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=
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"

@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
Expand Down
10 changes: 5 additions & 5 deletions example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
},
"dependencies": {
"react": "16.8.3",
"react-native": "0.59.5",
"react-native": "0.59.999999999",
"react-native-share": "file:../../react-native-share"
},
"devDependencies": {
"@babel/core": "^7.4.3",
"@babel/runtime": "^7.4.3",
"babel-jest": "^24.7.1",
"jest": "^24.7.1",
"@babel/core": "^7.4.5",
"@babel/runtime": "^7.4.5",
"babel-jest": "^24.8.0",
"jest": "^24.8.0",
"metro-react-native-babel-preset": "^0.53.1",
"react-native-testing-library": "^1.7.0",
"react-test-renderer": "^16.8.6"
Expand Down
31 changes: 12 additions & 19 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ type Props = {
overlayStyle?: {},
};

const shareSheetStyle = {flex: 1};
const shareSheetStyle = { flex: 1 };

class ShareSheet extends React.Component<Props> {
backButtonHandler: () => boolean;
Expand All @@ -67,18 +67,13 @@ class ShareSheet extends React.Component<Props> {
return false;
}
render() {
const {style = {}, overlayStyle = {}, ...props} = this.props;
const { style = {}, overlayStyle = {}, ...props } = this.props;
return (
<Overlay visible={this.props.visible} {...props}>
<View style={[styles.actionSheetContainer, overlayStyle]}>
<TouchableOpacity
style={shareSheetStyle}
onPress={this.props.onCancel}
/>
<TouchableOpacity style={shareSheetStyle} onPress={this.props.onCancel} />
<Sheet visible={this.props.visible}>
<View style={[styles.buttonContainer, style]}>
{this.props.children}
</View>
<View style={[styles.buttonContainer, style]}>{this.props.children}</View>
</Sheet>
</View>
</Overlay>
Expand Down Expand Up @@ -109,12 +104,10 @@ type MultipleOptions = {
showAppsToView?: boolean,
};

type OpenReturn = {app?: string, dismissedAction?: boolean};
type ShareSingleReturn = {message: string};
type OpenReturn = { app?: string, dismissedAction?: boolean };
type ShareSingleReturn = { message: string };

const requireAndAskPermissions = async (
options: Options | MultipleOptions,
): Promise<any> => {
const requireAndAskPermissions = async (options: Options | MultipleOptions): Promise<any> => {
if ((options.url || options.urls) && Platform.OS === 'android') {
const urls: Array<string> = options.urls || [options.url];
try {
Expand Down Expand Up @@ -161,7 +154,7 @@ const requireAndAskPermissions = async (

class RNShare {
static Button: any;
static ShareSheet: React.Element<*>;
static ShareSheet: RNShare.ShareSheet;
static Overlay: any;
static Sheet: any;
static Social = {
Expand All @@ -184,7 +177,7 @@ class RNShare {
ActionSheetIOS.showShareActionSheetWithOptions(
options,
error => {
return reject({error: error});
return reject({ error: error });
},
(success, activityType) => {
if (success) {
Expand All @@ -204,7 +197,7 @@ class RNShare {
NativeModules.RNShare.open(
options,
e => {
return reject({error: e});
return reject({ error: e });
},
(success, activityType) => {
if (success) {
Expand Down Expand Up @@ -235,7 +228,7 @@ class RNShare {
NativeModules.RNShare.shareSingle(
options,
e => {
return reject({error: e});
return reject({ error: e });
},
(e, activityType) => {
return resolve({
Expand All @@ -258,7 +251,7 @@ class RNShare {
NativeModules.RNShare.isPackageInstalled(
packageName,
e => {
return reject({error: e});
return reject({ error: e });
},
isInstalled => {
return resolve({
Expand Down
36 changes: 19 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,27 @@
"url": "git+https://github.com/react-native-community/react-native-share.git"
},
"devDependencies": {
"@commitlint/cli": "6.2.0",
"@commitlint/config-conventional": "6.1.3",
"@react-native-community/eslint-config": "0.0.4",
"babel-eslint": "8.2.6",
"eslint": "4.19.1",
"eslint-plugin-flowtype": "2.50.3",
"@commitlint/cli": "8.0.0",
"@commitlint/config-conventional": "8.0.0",
"@react-native-community/eslint-config": "0.0.5",
"babel-eslint": "10.0.1",
"eslint": "5.16.0",
"eslint-plugin-flowtype": "3.10.3",
"eslint-plugin-import": "2.17.3",
"eslint-plugin-prettier": "2.6.2",
"eslint-plugin-prettier": "3.1.0",
"eslint-plugin-react": "7.13.0",
"eslint-plugin-react-native": "3.7.0",
"flow-bin": "0.92.0",
"flow-bin": "^0.101",
"generate-changelog": "1.7.1",
"husky": "0.14.3",
"husky": "2.4.1",
"idx": "2.5.6",
"lint-staged": "7.3.0",
"lint-staged": "8.2.0",
"minimist": "1.2.0",
"pre-commit": "1.2.2",
"prettier": "1.17.1",
"prettier": "^1.18.2",
"react": "16.8.3",
"react-native": "0.59.5",
"simple-git": "1.89.0"
"react-native": "0.59.9",
"simple-git": "1.113.0"
},
"keywords": [
"react-native",
Expand All @@ -47,8 +47,7 @@
"license": "MIT",
"lint-staged": {
"*.js": [
"yarn prettier",
"eslint --fix",
"yarn validate",
"git add"
]
},
Expand All @@ -58,10 +57,13 @@
"commitmsg": "commitlint -e $GIT_PARAMS",
"lint": "eslint index.js --max-warnings=0",
"lint:staged": "lint-staged",
"prettier": "prettier --write --single-quote true --trailing-comma all --print-width 100",
"release:major": "node ./changelog --major && npm version major && git push origin && git push origin --follow-tags",
"release:minor": "node ./changelog --minor && npm version minor && git push origin && git push origin --follow-tags",
"release:patch": "node ./changelog --patch && npm version patch && git push origin && git push origin --follow-tags",
"release:version": "node ./changelog --version $VERSION && git push origin && git push origin --follow-tags"
"release:version": "node ./changelog --version $VERSION && git push origin && git push origin --follow-tags",
"validate": "yarn validate:prettier && yarn validate:lint && yarn validate:flow",
"validate:flow": "yarn flow",
"validate:lint": "eslint --fix *js components/*.js",
"validate:prettier": "prettier --write *.js components/*.js"
}
}
5 changes: 5 additions & 0 deletions prettier.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
trailingComma: 'all',
singleQuote: true,
printWidth: 100,
};
Loading

0 comments on commit 6c5876f

Please sign in to comment.