From f98394d799957bece52ebc98e3b12317ca487f9e Mon Sep 17 00:00:00 2001 From: Matthias Giger Date: Mon, 23 Sep 2024 18:43:51 +0200 Subject: [PATCH] feat(types): export image type declarations release-npm --- .github/workflows/release.yml | 2 +- image.d.ts | 30 ++++++++++++++++++++++++++++++ package.json | 22 ++++++++++++---------- template/app/App.tsx | 1 + template/app/global.d.ts | 4 ---- template/app/package.json | 16 ++++++++-------- template/default/App.tsx | 1 + template/default/global.d.ts | 4 ---- template/default/package.json | 10 +++++----- website/package.json | 30 +++++++++++++++--------------- 10 files changed, 73 insertions(+), 47 deletions(-) create mode 100644 image.d.ts delete mode 100644 template/app/global.d.ts delete mode 100644 template/default/global.d.ts diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 75f0048..0629ee9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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 diff --git a/image.d.ts b/image.d.ts new file mode 100644 index 0000000..be35bbd --- /dev/null +++ b/image.d.ts @@ -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 +} diff --git a/package.json b/package.json index 78f5a18..eda92a0 100644 --- a/package.json +++ b/package.json @@ -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", @@ -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" @@ -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", diff --git a/template/app/App.tsx b/template/app/App.tsx index 4a64fba..0c6bc06 100644 --- a/template/app/App.tsx +++ b/template/app/App.tsx @@ -1,3 +1,4 @@ +/// import React from 'react' import Reactigation, { register } from 'reactigation' import { Overview } from './screen/Overview' diff --git a/template/app/global.d.ts b/template/app/global.d.ts deleted file mode 100644 index 10043ff..0000000 --- a/template/app/global.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -declare module '*.png' { - const value: import('react-native').ImageSourcePropType - export default value -} diff --git a/template/app/package.json b/template/app/package.json index d4a9d88..69944fd 100644 --- a/template/app/package.json +++ b/template/app/package.json @@ -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" diff --git a/template/default/App.tsx b/template/default/App.tsx index 828a2de..f8d9717 100644 --- a/template/default/App.tsx +++ b/template/default/App.tsx @@ -1,3 +1,4 @@ +/// import React from 'react' import { SafeAreaView, StatusBar, StyleSheet, View, Text, Image } from 'react-native' import logo from './logo.png' diff --git a/template/default/global.d.ts b/template/default/global.d.ts deleted file mode 100644 index 10043ff..0000000 --- a/template/default/global.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -declare module '*.png' { - const value: import('react-native').ImageSourcePropType - export default value -} diff --git a/template/default/package.json b/template/default/package.json index c3d4a76..cdfa976 100644 --- a/template/default/package.json +++ b/template/default/package.json @@ -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" diff --git a/website/package.json b/website/package.json index 0455914..58a12f4 100644 --- a/website/package.json +++ b/website/package.json @@ -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",