-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: new ictinus v5 migration (#156)
BREAKING CHANGE: New ictinus version (v5) is being added. Therefore, we cannot have backward compatibility * feat: new ictinus v5 migration * chore: correct : MouseEventHandler typings * feat: vite migration (#157) * feat: remove rollup and add vite * chore: adding missing dep * feat: adding onSuccess for vite watch
- Loading branch information
1 parent
c43840d
commit 1dbcb49
Showing
53 changed files
with
6,775 additions
and
6,164 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,3 +31,6 @@ yarn-error.log* | |
.vscode/ | ||
|
||
/typeDocs | ||
.yalc | ||
/yalc.lock | ||
/rollup.config-1715595703115.mjs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#!/usr/bin/env sh | ||
. "$(dirname -- "$0")/_/husky.sh" | ||
yarn lint-staged | ||
yarn test && yarn lint-staged && yarn run tsc -p . | ||
|
||
npx --no-install lint-staged --verbose |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,55 @@ | ||
import { act } from 'react-dom/test-utils'; | ||
import actualCreate from 'zustand'; | ||
// https://docs.pmnd.rs/zustand/guides/testing#vitest | ||
import { act } from '@testing-library/react'; | ||
import * as zustand from 'zustand'; | ||
|
||
const { create: actualCreate, createStore: actualCreateStore } = await vi.importActual< | ||
typeof zustand | ||
>('zustand'); | ||
|
||
// a variable to hold reset functions for all stores declared in the app | ||
const storeResetFns = new Set(); | ||
export const storeResetFns = new Set<() => void>(); | ||
|
||
const createUncurried = <T>(stateCreator: zustand.StateCreator<T>) => { | ||
const store = actualCreate(stateCreator); | ||
const initialState = store.getInitialState(); | ||
storeResetFns.add(() => { | ||
store.setState(initialState, true); | ||
}); | ||
|
||
return store; | ||
}; | ||
|
||
// when creating a store, we get its initial state, create a reset function and add it in the set | ||
const create = (createState: any) => { | ||
if (!createState) return create; | ||
const store = actualCreate(createState); | ||
const initialState = store.getState(); | ||
storeResetFns.add(() => store.setState(initialState, true)); | ||
export const create = (<T>(stateCreator: zustand.StateCreator<T>) => { | ||
// to support curried version of create | ||
return typeof stateCreator === 'function' ? createUncurried(stateCreator) : createUncurried; | ||
}) as typeof zustand.create; | ||
|
||
const createStoreUncurried = <T>(stateCreator: zustand.StateCreator<T>) => { | ||
const store = actualCreateStore(stateCreator); | ||
const initialState = store.getInitialState(); | ||
storeResetFns.add(() => { | ||
store.setState(initialState, true); | ||
}); | ||
|
||
return store; | ||
}; | ||
|
||
// Reset all stores after each test run | ||
// when creating a store, we get its initial state, create a reset function and add it in the set | ||
export const createStore = (<T>(stateCreator: zustand.StateCreator<T>) => { | ||
console.log('zustand createStore mock'); | ||
|
||
// to support curried version of createStore | ||
return typeof stateCreator === 'function' | ||
? createStoreUncurried(stateCreator) | ||
: createStoreUncurried; | ||
}) as typeof zustand.createStore; | ||
|
||
// reset all stores after each test run | ||
afterEach(() => { | ||
// @ts-ignore | ||
act(() => storeResetFns.forEach((resetFn) => resetFn())); | ||
act(() => { | ||
storeResetFns.forEach((resetFn) => { | ||
resetFn(); | ||
}); | ||
}); | ||
}); | ||
|
||
export default create; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
diff --git a/node_modules/vite-plugin-svgr/client.d.ts b/node_modules/vite-plugin-svgr/client.d.ts | ||
index dbfc650..fcd6218 100644 | ||
--- a/node_modules/vite-plugin-svgr/client.d.ts | ||
+++ b/node_modules/vite-plugin-svgr/client.d.ts | ||
@@ -5,7 +5,7 @@ declare module "*.svg?react" { | ||
import * as React from "react"; | ||
|
||
const ReactComponent: React.FunctionComponent< | ||
- React.ComponentProps<"svg"> & { title?: string } | ||
+ React.ComponentProps<"svg"> & { title?: string; alt?: string } | ||
>; | ||
|
||
export default ReactComponent; |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.