Skip to content

Commit

Permalink
feat(types): export image type declarations
Browse files Browse the repository at this point in the history
release-npm
  • Loading branch information
tobua committed Sep 23, 2024
1 parent ec8b4bb commit f98394d
Show file tree
Hide file tree
Showing 10 changed files with 73 additions and 47 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
contents: write
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v1
- uses: oven-sh/setup-bun@v2
- run: bun install
- name: 🧪 Test
run: bun run test
Expand Down
30 changes: 30 additions & 0 deletions image.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
declare module '*.png' {
const src: import('react-native').ImageSourcePropType
export default src
}

declare module '*.jpg' {
const src: import('react-native').ImageSourcePropType
export default src
}

declare module '*.jpeg' {
const src: import('react-native').ImageSourcePropType
export default src
}

declare module '*.bmp' {
const src: import('react-native').ImageSourcePropType
export default src
}

// See: https://reactnative.dev/docs/image#gif-and-webp-support-on-android
declare module '*.gif' {
const src: import('react-native').ImageSourcePropType
export default src
}

declare module '*.webp' {
const src: import('react-native').ImageSourcePropType
export default src
}
22 changes: 12 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@
}
},
"dependencies": {
"@react-native-community/cli": "^14.0.1",
"@react-native/babel-preset": "^0.75.2",
"@react-native/eslint-config": "^0.75.2",
"@react-native/metro-config": "^0.75.2",
"@react-native/typescript-config": "^0.75.2",
"@react-native-community/cli": "^14.1.1",
"@react-native/babel-preset": "^0.75.3",
"@react-native/eslint-config": "^0.75.3",
"@react-native/metro-config": "^0.75.3",
"@react-native/typescript-config": "^0.75.3",
"arg": "^5.0.2",
"command-exists": "^1.2.9",
"deepmerge": "^4.3.1",
Expand All @@ -51,14 +51,14 @@
"skip-local-postinstall": "^2.0.4"
},
"devDependencies": {
"@types/bun": "^1.1.8",
"@types/bun": "^1.1.10",
"@types/command-exists": "^1.2.3",
"@types/prompts": "^2.4.9",
"@types/semver": "^7.5.8",
"jest-fixture": "^4.1.0",
"padua": "^4.0.1",
"react-native": "^0.75.2",
"vitest": "^2.0.5"
"react-native": "^0.75.3",
"vitest": "^2.1.1"
},
"peerDependencies": {
"react-native": ">= 0.73"
Expand All @@ -67,13 +67,15 @@
"sideEffects": true,
"main": "dist/index.js",
"exports": {
".": "./dist/index.js"
".": "./dist/index.js",
"./types": "./image.d.ts"
},
"bin": "./dist/index.js",
"types": "./dist/index.d.ts",
"files": [
"dist",
"configuration/*.json"
"configuration/*.json",
"*.d.ts"
],
"keywords": [
"react-native",
Expand Down
1 change: 1 addition & 0 deletions template/app/App.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/// <reference types="numic/types" />
import React from 'react'
import Reactigation, { register } from 'reactigation'
import { Overview } from './screen/Overview'
Expand Down
4 changes: 0 additions & 4 deletions template/app/global.d.ts

This file was deleted.

16 changes: 8 additions & 8 deletions template/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,26 @@
},
"dependencies": {
"epic-language": "^1.0.0",
"mobx": "^6.13.1",
"mobx": "^6.13.2",
"mobx-react-lite": "^4.0.7",
"react": "^18.3.1",
"react-native": "^0.75.2",
"reactigation": "^4.0.3",
"react-native": "^0.75.3",
"reactigation": "^5.0.0",
"responsive-react-native": "^1.0.6"
},
"devDependencies": {
"@testing-library/jest-native": "^5.4.3",
"@testing-library/react-native": "^12.6.1",
"@types/jest": "^29.5.12",
"@types/react": "^18.3.5",
"@testing-library/react-native": "^12.7.2",
"@types/jest": "^29.5.13",
"@types/react": "^18.3.8",
"@types/react-native": "^0.73.0",
"android-sdk-numic-plugin": "^1.0.6",
"babel-jest": "^29.7.0",
"icon-numic-plugin": "^1.4.4",
"jest": "^29.7.0",
"numic": "^3.0.0",
"numic": "^3.1.0",
"react-test-renderer": "^18.3.1",
"typescript": "^5.5.4"
"typescript": "^5.6.2"
},
"trustedDependencies": [
"numic"
Expand Down
1 change: 1 addition & 0 deletions template/default/App.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/// <reference types="numic/types" />
import React from 'react'
import { SafeAreaView, StatusBar, StyleSheet, View, Text, Image } from 'react-native'
import logo from './logo.png'
Expand Down
4 changes: 0 additions & 4 deletions template/default/global.d.ts

This file was deleted.

10 changes: 5 additions & 5 deletions template/default/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,21 @@
},
"dependencies": {
"react": "^18.3.1",
"react-native": "^0.75.2"
"react-native": "^0.75.3"
},
"type": "module",
"devDependencies": {
"@types/jest": "^29.5.12",
"@types/react": "^18.3.5",
"@types/jest": "^29.5.13",
"@types/react": "^18.3.8",
"@types/react-native": "^0.73.0",
"@types/react-test-renderer": "^18.3.0",
"android-sdk-numic-plugin": "^1.0.6",
"babel-jest": "^29.7.0",
"icon-numic-plugin": "^1.4.4",
"jest": "^29.7.0",
"numic": "^3.0.0",
"numic": "^3.1.0",
"react-test-renderer": "18.2.0",
"typescript": "^5.5.4"
"typescript": "^5.6.2"
},
"trustedDependencies": [
"numic"
Expand Down
30 changes: 15 additions & 15 deletions website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,22 @@
"icon": "../logo.png"
},
"dependencies": {
"@react-three/drei": "^9.90.2",
"@react-three/drei": "^9.113.0",
"@react-three/eslint-plugin": "^0.1.1",
"@react-three/fiber": "^8.15.12",
"@react-three/postprocessing": "^2.15.11",
"@react-three/rapier": "^1.2.0",
"@types/node": "^20.10.4",
"@types/react": "^18.2.42",
"@types/react-dom": "^18.2.17",
"@types/three": "^0.159.0",
"maath": "^0.10.4",
"papua": "^5.9.4",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"three": "^0.159.0",
"typescript": "^5.3.3",
"valtio": "^1.12.1"
"@react-three/fiber": "^8.17.8",
"@react-three/postprocessing": "^2.16.2",
"@react-three/rapier": "^1.4.0",
"@types/node": "^22.5.5",
"@types/react": "^18.3.8",
"@types/react-dom": "^18.3.0",
"@types/three": "^0.168.0",
"maath": "^0.10.8",
"papua": "^6.0.2",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"three": "^0.168.0",
"typescript": "^5.6.2",
"valtio": "^2.0.0"
},
"type": "module",
"prettier": "papua/configuration/.prettierrc.json",
Expand Down

0 comments on commit f98394d

Please sign in to comment.