From aabeb6538874ebec8fa9e17869e31c414639c7f3 Mon Sep 17 00:00:00 2001 From: Matthias Giger Date: Mon, 10 Jun 2024 22:44:44 +0200 Subject: [PATCH] fix(plugin): update dependencies release-npm --- .github/workflows/push.yml | 9 +++++---- .gitignore | 2 +- animations.ts | 21 +++------------------ index.tsx | 28 ++++++---------------------- package.json | 36 ++++++++++++++++++------------------ test/basic.test.tsx | 6 +----- test/utils/setup-screens.ts | 4 +--- transition.ts | 9 ++------- types.ts | 6 +----- 9 files changed, 38 insertions(+), 83 deletions(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 1b4cd8f..a09b4c3 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -11,11 +11,12 @@ jobs: id-token: write contents: write steps: - - uses: actions/checkout@v3 - - run: npm install - - run: npm run build + - uses: actions/checkout@v4 + - uses: oven-sh/setup-bun@v1 + - run: bun install + - run: bun run build - name: Test 📱 - run: npm test + run: bun run test - uses: tobua/release-npm-action@v3 with: NPM_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.gitignore b/.gitignore index 92ee43e..600d4cd 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ node_modules -package-lock.json +bun.lockb dist ReactigationApp app/**/* diff --git a/animations.ts b/animations.ts index 1ad6fd6..cf98a54 100644 --- a/animations.ts +++ b/animations.ts @@ -6,12 +6,7 @@ const windowHeight = Dimensions.get('window').height // Transition finish handler. const handlerLeft = - ( - value: Animated.Value, - done: () => void, - { duration }: { duration: number }, - reverse?: boolean, - ) => + (value: Animated.Value, done: () => void, { duration }: { duration: number }, reverse?: boolean) => () => { Animated.timing(value, { toValue: reverse ? windowWidth : 0, @@ -44,12 +39,7 @@ const none = () => ({ }) const handlerOpacity = - ( - value: Animated.Value, - done: () => void, - { duration }: { duration: number }, - reverse?: boolean, - ) => + (value: Animated.Value, done: () => void, { duration }: { duration: number }, reverse?: boolean) => () => { Animated.timing(value, { toValue: reverse ? 0 : 1, @@ -79,12 +69,7 @@ const opacity = (duration = 500) => ({ }) const handlerTop = - ( - value: Animated.Value, - done: () => void, - { duration }: { duration: number }, - reverse?: boolean, - ) => + (value: Animated.Value, done: () => void, { duration }: { duration: number }, reverse?: boolean) => () => { Animated.timing(value, { toValue: reverse ? windowHeight : 0, diff --git a/index.tsx b/index.tsx index 1551953..ca1d2c2 100644 --- a/index.tsx +++ b/index.tsx @@ -1,12 +1,7 @@ import React, { useState, useEffect, cloneElement } from 'react' import { Animated, View, BackHandler, TouchableOpacity } from 'react-native' import { styles } from './styles' -import startTransition, { - initialPosition, - connect, - isTransitioning, - isTransitionValid, -} from './transition' +import startTransition, { initialPosition, connect, isTransitioning, isTransitionValid } from './transition' import { CustomTransition } from './animations' import { Transition, Screen, State, TransitionInput } from './types' @@ -31,9 +26,7 @@ export const useCurrentScreen = () => { // Clear up old listeners. return () => { - const index = currentScreenHookListeners.findIndex( - (listener) => listener === setCurrentScreen, - ) + const index = currentScreenHookListeners.findIndex((listener) => listener === setCurrentScreen) if (index !== -1) { currentScreenHookListeners.splice(index, 1) @@ -57,9 +50,7 @@ export const register = ( const { transition = Transition.regular, background = 'white', initial } = configuration const screen: Screen = { Component, transition, background, name } if (!name) { - return console.error( - 'Reactigation: Trying to register a Component without a name as the second argument.', - ) + return console.error('Reactigation: Trying to register a Component without a name as the second argument.') } if (!isTransitionValid(transition, 'register')) { return @@ -76,15 +67,11 @@ export const register = ( export const initial = (name: string) => { if (!screens[name]) { - return console.warn( - `Reactigation: Trying to set initial screen "${name}" which hasn't been registered yet.`, - ) + return console.warn(`Reactigation: Trying to set initial screen "${name}" which hasn't been registered yet.`) } if (history.length === 0) { - return console.error( - 'Reactigation: Trying to set initial screen before any screens have been registered.', - ) + return console.error('Reactigation: Trying to set initial screen before any screens have been registered.') } history[0] = screens[name] @@ -166,10 +153,7 @@ const renderBottom = ({ Bottom }: State) => { }) return ( - + {BottomWithProps} ) diff --git a/package.json b/package.json index c9ec118..a6d51e3 100644 --- a/package.json +++ b/package.json @@ -32,28 +32,28 @@ "react-native": ">= 0.70" }, "devDependencies": { - "@react-native-community/cli": "^13.0.0", - "@react-native/babel-preset": "^0.74.0", - "@react-native/eslint-config": "^0.74.0", - "@react-native/typescript-config": "^0.74.0", - "@types/jest": "^29.5.11", - "@types/node": "^20.10.4", - "@types/react": "^18.2.43", - "@types/react-native": "^0.72.8", - "@types/react-test-renderer": "^18.0.7", + "@react-native-community/cli": "^13.6.9", + "@react-native/babel-preset": "^0.74.84", + "@react-native/eslint-config": "^0.74.84", + "@react-native/typescript-config": "^0.74.84", + "@types/jest": "^29.5.12", + "@types/node": "^20.14.2", + "@types/react": "^18.3.3", + "@types/react-native": "^0.73.0", + "@types/react-test-renderer": "^18.3.0", "babel-jest": "^29.7.0", "cpx": "^1.5.0", - "esbuild": "^0.19.9", - "eslint": "^8.55.0", + "esbuild": "^0.21.5", + "eslint": "8.57.0", "eslint-plugin-flowtype": "^8.0.3", - "eslint-plugin-prettier": "^5.0.1", + "eslint-plugin-prettier": "^5.1.3", "jest": "^29.7.0", "npm-run-all": "^4.1.5", - "prettier": "^3.1.1", - "react": "^18.2.0", - "react-native": "^0.73.0", - "react-test-renderer": "^18.2.0", - "typescript": "^5.3.3" + "prettier": "^3.3.1", + "react": "^18.3.1", + "react-native": "^0.74.2", + "react-test-renderer": "^18.3.1", + "typescript": "^5.4.5" }, "files": [ "dist" @@ -77,7 +77,7 @@ "prettier": { "semi": false, "singleQuote": true, - "printWidth": 100 + "printWidth": 120 }, "jest": { "preset": "react-native", diff --git a/test/basic.test.tsx b/test/basic.test.tsx index 37208f6..2d1e065 100644 --- a/test/basic.test.tsx +++ b/test/basic.test.tsx @@ -342,11 +342,7 @@ test('Initially shown screen can be configured.', () => { }) test('Initially shown screen can be configured though register.', () => { - const names = [ - { name: 'FirstScreen' }, - { name: 'SecondScreen', options: { initial: true } }, - { name: 'ThirdScreen' }, - ] + const names = [{ name: 'FirstScreen' }, { name: 'SecondScreen', options: { initial: true } }, { name: 'ThirdScreen' }] const input = setupScreens(names) const { screens } = render() diff --git a/test/utils/setup-screens.ts b/test/utils/setup-screens.ts index b3e2542..c7e28be 100644 --- a/test/utils/setup-screens.ts +++ b/test/utils/setup-screens.ts @@ -2,9 +2,7 @@ import { register } from 'reactigation' import createTestScreen from '../components/Screen' -export default ( - screens: (string | { name: string; options?: { initial?: boolean; background?: string } })[], -) => { +export default (screens: (string | { name: string; options?: { initial?: boolean; background?: string } })[]) => { return screens.map((screen) => { let name let options = {} as any diff --git a/transition.ts b/transition.ts index 5fa3b95..36a4af5 100644 --- a/transition.ts +++ b/transition.ts @@ -7,10 +7,7 @@ let afterRender = () => {} let options = { headless: false } // Connects to Reactigation Component's setState. -export const connect = ( - current: { setState: (state: State) => void; state: State }, - headless: boolean, -) => { +export const connect = (current: { setState: (state: State) => void; state: State }, headless: boolean) => { state = current.state setState = current.setState options.headless = headless @@ -62,9 +59,7 @@ export default ( } // After state is set and new screens rendered, calling this handler starts the animation. - afterRender = options.headless - ? () => {} - : transition.animation(state, done, reverse) || (() => {}) + afterRender = options.headless ? () => {} : transition.animation(state, done, reverse) || (() => {}) // Skip animation. if (options.headless) { diff --git a/types.ts b/types.ts index 1a3a281..89a217e 100644 --- a/types.ts +++ b/types.ts @@ -1,10 +1,6 @@ import type { Animated } from 'react-native' -export type AnimationHandler = ( - state: State, - done: () => void, - reverse?: boolean, -) => (() => void) | null +export type AnimationHandler = (state: State, done: () => void, reverse?: boolean) => (() => void) | null export type Animation = { backdrop?: boolean