Skip to content

Commit ac11706

Browse files
authored
feat: converts to TypeScript (DylanVann#642)
This converts the codebase to TypeScript. Compilation and bundling is done with tsdx. This will hopefully ensure our types are more accurate in the future.
1 parent e24c931 commit ac11706

14 files changed

+1670
-421
lines changed

.babelrc

-3
This file was deleted.

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ example/android/app/src/main/gen
3838

3939
# build
4040
react-native-fast-image-*.tgz
41+
dist/
4142

4243
# coverage reports
4344
coverage

.npmignore

-28
This file was deleted.

ReactNativeFastImageExample/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"@react-navigation/stack": "^5.1.0",
1717
"react": "16.9.0",
1818
"react-native": "0.61.5",
19-
"react-native-fast-image": "^7.0.2",
19+
"react-native-fast-image": "../react-native-fast-image-8.0.0.tgz",
2020
"react-native-gesture-handler": "^1.6.0",
2121
"react-native-image-picker": "^2.3.1",
2222
"react-native-image-progress": "^1.1.1",

ReactNativeFastImageExample/yarn.lock

+3-4
Original file line numberDiff line numberDiff line change
@@ -5368,10 +5368,9 @@ react-is@^16.12.0, react-is@^16.8.1, react-is@^16.8.4, react-is@^16.9.0:
53685368
resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.0.tgz#0f37c3613c34fe6b37cd7f763a0d6293ab15c527"
53695369
integrity sha512-GFMtL0vHkiBv9HluwNZTggSn/sCyEt9n02aM0dSAjGGyqyNlAyftYm4phPxdvCigG15JreC5biwxCgTAJZ7yAA==
53705370

5371-
react-native-fast-image@^7.0.2:
5372-
version "7.0.2"
5373-
resolved "https://registry.yarnpkg.com/react-native-fast-image/-/react-native-fast-image-7.0.2.tgz#e06b21f42f4a9786eaa86f3db35d919070fb8403"
5374-
integrity sha512-MfuzJbC0RjYobR2gFCdqe1I7jvNOCfDkjQ7VGOHXniqjohhULMkcWNBE9Umovi9Dx93lJ6t5utcE2wf/09zvlg==
5371+
react-native-fast-image@../react-native-fast-image-8.0.0.tgz:
5372+
version "8.0.0"
5373+
resolved "../react-native-fast-image-8.0.0.tgz#9c62a27bbc643ce1cdae634b8a9a7252ced7ed00"
53755374

53765375
react-native-gesture-handler@^1.6.0:
53775376
version "1.6.0"

package.json

+16-8
Original file line numberDiff line numberDiff line change
@@ -19,30 +19,35 @@
1919
},
2020
"license": "(MIT AND Apache-2.0)",
2121
"author": "Dylan Vann <[email protected]> (https://dylanvann.com)",
22-
"main": "src/index.js",
23-
"types": "src/index.d.ts",
22+
"main": "dist/index.js",
23+
"module": "dist/react-native-fast-image.esm.js",
24+
"typings": "dist/index.d.ts",
2425
"files": [
2526
"android",
2627
"!android/build",
2728
"ios",
2829
"!ios/build",
29-
"src",
30+
"dist",
3031
"RNFastImage.podspec"
3132
],
3233
"scripts": {
33-
"build": "exit 0",
34+
"build": "tsdx build && cp src/index.js.flow dist/index.js.flow",
3435
"commit": "git-cz",
35-
"format": "yarn prettier --write",
36-
"lint": "eslint src/**/*.js",
37-
"prettier": "prettier './**/*.{js,d.ts,js.flow,yml}'",
36+
"lint": "tsdx lint src",
3837
"semantic-release": "semantic-release",
39-
"test": "jest ./src/*.js"
38+
"test": "jest ./src/*.tsx"
4039
},
4140
"config": {
4241
"commitizen": {
4342
"path": "node_modules/cz-conventional-changelog"
4443
}
4544
},
45+
"prettier": {
46+
"semi": false,
47+
"singleQuote": true,
48+
"tabWidth": 4,
49+
"trailingComma": "all"
50+
},
4651
"jest": {
4752
"modulePathIgnorePatterns": [
4853
"ReactNativeFastImageExample*",
@@ -59,6 +64,8 @@
5964
"@semantic-release/git": "^9.0.0",
6065
"@semantic-release/npm": "^7.0.3",
6166
"@semantic-release/release-notes-generator": "^9.0.1",
67+
"@types/react": "^16.9.23",
68+
"@types/react-native": "^0.61.17",
6269
"babel-jest": "^24.9.0",
6370
"commitizen": "^4.0.3",
6471
"cz-conventional-changelog": "^3.1.0",
@@ -75,6 +82,7 @@
7582
"react-native": "0.61.5",
7683
"react-test-renderer": "16.9.0",
7784
"semantic-release": "^17.0.4",
85+
"tsdx": "^0.12.3",
7886
"typescript": "^3.8.3"
7987
},
8088
"peerDependencies": {

prettier.config.js

-6
This file was deleted.
File renamed without changes.

src/index.d.ts

-154
This file was deleted.

0 commit comments

Comments
 (0)