Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,18 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- run: yarn --frozen-lockfile
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "22"
cache: yarn
- run: yarn install --frozen-lockfile
- run: yarn build
- run: yarn lint
- run: yarn test --coverage
- if: github.event.repository.fork == false && github.event_name != 'pull_request'
run: yarn dv-scripts ci
run: npx semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- uses: codecov/codecov-action@v2
- uses: codecov/codecov-action@v5
10 changes: 10 additions & 0 deletions .releaserc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"branches": ["main", "master"],
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/changelog",
"@semantic-release/npm",
"@semantic-release/github"
]
}
6 changes: 3 additions & 3 deletions RNFastImage.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ Pod::Spec.new do |s|
s.authors = { "Dylan Vann" => "dylan@dylanvann.com" }
s.homepage = "https://github.com/DylanVann/react-native-fast-image#readme"
s.license = "MIT"
s.platforms = { :ios => "8.0", :tvos => "9.0" }
s.platforms = { :ios => "13.4", :tvos => "13.4" }
s.framework = 'UIKit'
s.requires_arc = true
s.source = { :git => "https://github.com/DylanVann/react-native-fast-image.git", :tag => "v#{s.version}" }
s.source_files = "ios/**/*.{h,m}"

s.dependency 'React-Core'
s.dependency 'SDWebImage', '~> 5.11.1'
s.dependency 'SDWebImageWebPCoder', '~> 0.8.4'
s.dependency 'SDWebImage', '~> 5.21'
s.dependency 'SDWebImageWebPCoder', '~> 0.15'
end
55 changes: 35 additions & 20 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,43 @@ def safeExtGet(prop, fallback) {
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
}

def agpVersionMajor() {
try {
return com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')[0].toInteger()
} catch (Exception ignored) {
return 7
}
}

buildscript {
// The Android Gradle plugin is only required when opening the android folder stand-alone.
// This avoids unnecessary downloads and potential conflicts when the library is included as a
// module dependency in an application project.
if (project == rootProject) {
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.3'
classpath("com.android.tools.build:gradle:8.7.3")
}
}
}

apply plugin: 'com.android.library'
apply plugin: "com.android.library"

android {
compileSdkVersion safeExtGet('compileSdkVersion', 28)
buildToolsVersion safeExtGet('buildToolsVersion', '28.0.3')
if (agpVersionMajor() >= 7) {
namespace "com.dylanvann.fastimage"
}

compileSdkVersion safeExtGet("compileSdkVersion", 34)

defaultConfig {
minSdkVersion safeExtGet('minSdkVersion', 16)
targetSdkVersion safeExtGet('targetSdkVersion', 28)
minSdkVersion safeExtGet("minSdkVersion", 16)
targetSdkVersion safeExtGet("targetSdkVersion", 34)
versionCode 1
versionName "1.0"
}

sourceSets {
main {
java {
Expand All @@ -38,31 +49,35 @@ android {
}
}
}
lintOptions {
abortOnError false

if (agpVersionMajor() >= 7) {
lint {
abortOnError false
}
} else {
lintOptions {
abortOnError false
}
}
}

repositories {
mavenLocal()
mavenCentral()
google()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
maven {
// Android JSC is installed from npm
url "$rootDir/../node_modules/jsc-android/dist"
}
google()
mavenCentral()
}

def glideVersion = safeExtGet('glideVersion', '4.12.0')
def glideVersion = safeExtGet('glideVersion', '4.16.0')

dependencies {
//noinspection GradleDynamicVersion
implementation 'com.facebook.react:react-native:+' // From node_modules
implementation "com.github.bumptech.glide:glide:${glideVersion}"
implementation "com.github.bumptech.glide:okhttp3-integration:${glideVersion}"
annotationProcessor "com.github.bumptech.glide:compiler:${glideVersion}"
implementation("com.facebook.react:react-native:+")
implementation("com.github.bumptech.glide:glide:${glideVersion}")
implementation("com.github.bumptech.glide:okhttp3-integration:${glideVersion}")
annotationProcessor("com.github.bumptech.glide:compiler:${glideVersion}")
}
3 changes: 2 additions & 1 deletion android/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
<manifest package="com.dylanvann.fastimage">
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.dylanvann.fastimage">
</manifest>
2 changes: 1 addition & 1 deletion babel.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module.exports = {
presets: ['module:metro-react-native-babel-preset'],
presets: ['module:@react-native/babel-preset'],
}
45 changes: 45 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
const js = require('@eslint/js')
const react = require('eslint-plugin-react')
const reactHooks = require('eslint-plugin-react-hooks')
const globals = require('globals')
const tseslint = require('typescript-eslint')

module.exports = tseslint.config(
{
ignores: [
'dist/**',
'node_modules/**',
'.yarn/**',
'coverage/**',
'ReactNativeFastImageExample/**',
'ReactNativeFastImageExampleServer/**',
],
},
js.configs.recommended,
...tseslint.configs.recommended,
{
files: ['**/*.{ts,tsx}'],
plugins: {
react,
'react-hooks': reactHooks,
},
languageOptions: {
globals: {
...globals.jest,
},
parserOptions: {
ecmaFeatures: { jsx: true },
},
},
settings: {
react: { version: 'detect' },
},
rules: {
...react.configs.flat.recommended.rules,
...reactHooks.configs.flat.recommended.rules,
'react/react-in-jsx-scope': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-require-imports': 'off',
},
},
)
71 changes: 42 additions & 29 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
},
"license": "(MIT AND Apache-2.0)",
"author": "Dylan Vann <dylan@dylanvann.com> (https://dylanvann.com)",
"engines": {
"node": ">=20.19.0"
},
"main": "dist/index.cjs.js",
"module": "dist/index.js",
"typings": "dist/index.d.ts",
Expand All @@ -31,52 +34,62 @@
"RNFastImage.podspec"
],
"scripts": {
"build": "dv-scripts build && cp src/index.js.flow dist/index.js.flow && cp src/index.js.flow dist/index.cjs.js.flow",
"lint": "dv-scripts lint",
"release": "dv-scripts release",
"test": "dv-scripts test"
"build": "tsc --build && rollup -c rollup.config.mjs && cp src/index.js.flow dist/index.js.flow && cp src/index.js.flow dist/index.cjs.js.flow",
"lint": "eslint src",
"release": "semantic-release",
"test": "jest"
},
"prettier": {
"semi": false,
"singleQuote": true,
"tabWidth": 4,
"trailingComma": "all"
},
"eslintConfig": {
"extends": "dv-scripts"
},
"jest": {
"preset": "@react-native/jest-preset",
"coveragePathIgnorePatterns": [
"ReactNativeFastImageExample*",
"ReactNativeFastImageExampleServer*"
],
"modulePathIgnorePatterns": [
"ReactNativeFastImageExample*",
"ReactNativeFastImageExampleServer*"
],
"preset": "react-native"
]
},
"resolutions": {
"@jest/create-cache-key-function": "^27"
"peerDependencies": {
"react": "^17.0.0 || ^18.0.0 || ^19.0.0",
"react-native": ">=0.64.0"
},
"devDependencies": {
"@babel/core": "^7.14.6",
"@babel/runtime": "^7.14.6",
"@types/jest": "^26.0.24",
"@types/react": "^17.0.14",
"@types/react-native": "^0.69.5",
"@types/react-test-renderer": "^17.0.1",
"dv-scripts": "^1.6.0",
"eslint-config-dv-scripts": "^1.1.1",
"metro-react-native-babel-preset": "^0.66.1",
"prettier": "^2.3.2",
"react": "17.0.2",
"react-native": "0.64.2",
"react-test-renderer": "17.0.2",
"typescript": "^4.3.5"
},
"peerDependencies": {
"react": "^17 || ^18",
"react-native": ">=0.60.0"
"@babel/core": "^7.28.5",
"@babel/preset-env": "^7.28.5",
"@babel/preset-react": "^7.28.5",
"@babel/preset-typescript": "^7.28.5",
"@eslint/js": "^9.39.2",
"@react-native/babel-preset": "0.85.1",
"@react-native/jest-preset": "0.85.1",
"@rollup/plugin-babel": "^6.1.0",
"@rollup/plugin-commonjs": "^29.0.0",
"@rollup/plugin-node-resolve": "^16.0.3",
"@testing-library/react-native": "^13.3.3",
"@semantic-release/changelog": "^6.0.3",
"@semantic-release/github": "^12.0.2",
"@semantic-release/npm": "^13.1.3",
"@types/jest": "^30.0.0",
"@types/react": "^19.2.7",
"babel-jest": "^30.2.0",
"eslint": "^9.39.2",
"eslint-plugin-react": "^7.37.5",
"eslint-plugin-react-hooks": "^7.0.1",
"globals": "^16.5.0",
"jest": "^30.2.0",
"prettier": "^3.7.4",
"react": "19.2.5",
"react-native": "0.85.1",
"react-test-renderer": "19.2.5",
"rollup": "^4.55.1",
"semantic-release": "^25.0.2",
"typescript": "^5.9.3",
"typescript-eslint": "^8.50.0"
}
}
49 changes: 49 additions & 0 deletions rollup.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import path from 'node:path'
import { fileURLToPath } from 'node:url'
import babel from '@rollup/plugin-babel'
import commonjs from '@rollup/plugin-commonjs'
import { nodeResolve } from '@rollup/plugin-node-resolve'

const __dirname = path.dirname(fileURLToPath(import.meta.url))

export default {
input: 'src/index.tsx',
output: [
{
file: 'dist/index.cjs.js',
format: 'cjs',
exports: 'default',
interop: 'default',
},
{
file: 'dist/index.js',
format: 'esm',
},
],
external: ['react', 'react-native'],
plugins: [
babel({
babelHelpers: 'bundled',
configFile: false,
babelrc: false,
extensions: ['.ts', '.tsx', '.js', '.jsx'],
presets: [
[
'@babel/preset-env',
{
targets: { node: '18' },
modules: false,
bugfixes: true,
},
],
['@babel/preset-react', { runtime: 'classic' }],
'@babel/preset-typescript',
],
root: __dirname,
}),
nodeResolve({
extensions: ['.ts', '.tsx', '.js', '.jsx'],
}),
commonjs(),
],
}
Loading