diff --git a/packages/usehooks-ts/.eslintrc b/packages/usehooks-ts/.eslintrc new file mode 100644 index 00000000..52ad45fb --- /dev/null +++ b/packages/usehooks-ts/.eslintrc @@ -0,0 +1,13 @@ +{ + "extends": ["custom"], + "overrides": [ + // Track tree-shaking potential error in the lib + { + "files": ["./src/**/!(*.test|*.spec).ts"], + "plugins": ["tree-shaking"], + "rules": { + "tree-shaking/no-side-effects-in-initialization": 2 + } + } + ] +} diff --git a/packages/usehooks-ts/jest.config.js b/packages/usehooks-ts/jest.config.js new file mode 100644 index 00000000..e098ad1f --- /dev/null +++ b/packages/usehooks-ts/jest.config.js @@ -0,0 +1,18 @@ +const ignoreDirs = ['dist/', 'node_modules/', 'scripts/'] + +/** @type {Config.InitialOptions} */ +module.exports = { + preset: 'ts-jest', + testEnvironment: 'jsdom', + verbose: false, + silent: true, + transform: { + '^.+\\.[t]sx?$': `ts-jest`, + }, + transformIgnorePatterns: ['/node_modules/'], + testPathIgnorePatterns: ignoreDirs, + coveragePathIgnorePatterns: ignoreDirs, + coverageDirectory: '/coverage/', + testMatch: ['/src/**/*.test.ts'], + moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'], +} diff --git a/packages/usehooks-ts/package.json b/packages/usehooks-ts/package.json new file mode 100644 index 00000000..1485e3a4 --- /dev/null +++ b/packages/usehooks-ts/package.json @@ -0,0 +1,73 @@ +{ + "name": "usehooks-ts", + "private": false, + "version": "2.9.1", + "description": "React hook library, ready to use, written in Typescript.", + "author": "Julien CARON ", + "homepage": "https://usehooks-ts.com", + "keywords": [ + "typescript", + "react", + "hooks" + ], + "license": "MIT", + "main": "./dist/cjs/index.js", + "module": "./dist/esm/index.js", + "types": "./dist/esm/index.d.ts", + "exports": { + ".": { + "require": "./dist/cjs/index.js", + "import": "./dist/esm/index.js" + } + }, + "scripts": { + "preinstall": "npx only-allow pnpm", + "dev": "pnpm test:watch", + "build": "pnpm build:cjs && pnpm build:esm", + "build:cjs": "tsc -p tsconfig.build.json --module commonjs --outDir dist/cjs --target es5", + "build:esm": "tsc -p tsconfig.build.json --module esNext --outDir dist/esm --target es6", + "test": "jest", + "test:watch": "pnpm test -- --watch --silent", + "clean": "rimraf -rf ./dist .turbo", + "lint": "eslint '**/*.{js,jsx,ts,tsx}'", + "types-check": "tsc --noEmit" + }, + "devDependencies": { + "@testing-library/react": "^12.1.2", + "@testing-library/react-hooks": "^7.0.2", + "@types/jest": "^29.0.3", + "@types/node": "^18.7.18", + "@types/react": "17.0.0", + "@typescript-eslint/eslint-plugin": "^5.37.0", + "@typescript-eslint/parser": "^5.37.0", + "date-fns": "^2.29.3", + "eslint": "^8.9.0", + "eslint-config-custom": "*", + "eslint-plugin-tree-shaking": "^1.10.0", + "jest": "^29.0.3", + "jest-environment-jsdom": "^29.0.3", + "react": "17.0.2", + "react-dom": "17.0.2", + "rimraf": "^3.0.2", + "ts-jest": "^29.0.1", + "ts-node": "^10.2.1", + "typescript": "^4.8.3" + }, + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0 || ^18.0.0", + "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0" + }, + "engines": { + "node": ">=16.15.0" + }, + "files": [ + "dist" + ], + "repository": { + "type": "git", + "url": "https://github.com/juliencrn/usehooks-ts" + }, + "bugs": { + "url": "https://github.com/juliencrn/usehooks-ts/issues" + } +} diff --git a/src/index.ts b/packages/usehooks-ts/src/index.ts similarity index 100% rename from src/index.ts rename to packages/usehooks-ts/src/index.ts diff --git a/src/useBoolean/useBoolean.demo.tsx b/packages/usehooks-ts/src/useBoolean/useBoolean.demo.tsx similarity index 100% rename from src/useBoolean/useBoolean.demo.tsx rename to packages/usehooks-ts/src/useBoolean/useBoolean.demo.tsx diff --git a/src/useBoolean/useBoolean.mdx b/packages/usehooks-ts/src/useBoolean/useBoolean.mdx similarity index 100% rename from src/useBoolean/useBoolean.mdx rename to packages/usehooks-ts/src/useBoolean/useBoolean.mdx diff --git a/src/useBoolean/useBoolean.test.ts b/packages/usehooks-ts/src/useBoolean/useBoolean.test.ts similarity index 100% rename from src/useBoolean/useBoolean.test.ts rename to packages/usehooks-ts/src/useBoolean/useBoolean.test.ts diff --git a/src/useBoolean/useBoolean.ts b/packages/usehooks-ts/src/useBoolean/useBoolean.ts similarity index 100% rename from src/useBoolean/useBoolean.ts rename to packages/usehooks-ts/src/useBoolean/useBoolean.ts diff --git a/src/useClickAnyWhere/useClickAnyWhere.demo.tsx b/packages/usehooks-ts/src/useClickAnyWhere/useClickAnyWhere.demo.tsx similarity index 100% rename from src/useClickAnyWhere/useClickAnyWhere.demo.tsx rename to packages/usehooks-ts/src/useClickAnyWhere/useClickAnyWhere.demo.tsx diff --git a/src/useClickAnyWhere/useClickAnyWhere.mdx b/packages/usehooks-ts/src/useClickAnyWhere/useClickAnyWhere.mdx similarity index 100% rename from src/useClickAnyWhere/useClickAnyWhere.mdx rename to packages/usehooks-ts/src/useClickAnyWhere/useClickAnyWhere.mdx diff --git a/src/useClickAnyWhere/useClickAnyWhere.ts b/packages/usehooks-ts/src/useClickAnyWhere/useClickAnyWhere.ts similarity index 100% rename from src/useClickAnyWhere/useClickAnyWhere.ts rename to packages/usehooks-ts/src/useClickAnyWhere/useClickAnyWhere.ts diff --git a/src/useCopyToClipboard/useCopyToClipboard.demo.tsx b/packages/usehooks-ts/src/useCopyToClipboard/useCopyToClipboard.demo.tsx similarity index 100% rename from src/useCopyToClipboard/useCopyToClipboard.demo.tsx rename to packages/usehooks-ts/src/useCopyToClipboard/useCopyToClipboard.demo.tsx diff --git a/src/useCopyToClipboard/useCopyToClipboard.mdx b/packages/usehooks-ts/src/useCopyToClipboard/useCopyToClipboard.mdx similarity index 100% rename from src/useCopyToClipboard/useCopyToClipboard.mdx rename to packages/usehooks-ts/src/useCopyToClipboard/useCopyToClipboard.mdx diff --git a/src/useCopyToClipboard/useCopyToClipboard.test.ts b/packages/usehooks-ts/src/useCopyToClipboard/useCopyToClipboard.test.ts similarity index 100% rename from src/useCopyToClipboard/useCopyToClipboard.test.ts rename to packages/usehooks-ts/src/useCopyToClipboard/useCopyToClipboard.test.ts diff --git a/src/useCopyToClipboard/useCopyToClipboard.ts b/packages/usehooks-ts/src/useCopyToClipboard/useCopyToClipboard.ts similarity index 100% rename from src/useCopyToClipboard/useCopyToClipboard.ts rename to packages/usehooks-ts/src/useCopyToClipboard/useCopyToClipboard.ts diff --git a/src/useCountdown/useCountdown.demo.tsx b/packages/usehooks-ts/src/useCountdown/useCountdown.demo.tsx similarity index 100% rename from src/useCountdown/useCountdown.demo.tsx rename to packages/usehooks-ts/src/useCountdown/useCountdown.demo.tsx diff --git a/src/useCountdown/useCountdown.mdx b/packages/usehooks-ts/src/useCountdown/useCountdown.mdx similarity index 100% rename from src/useCountdown/useCountdown.mdx rename to packages/usehooks-ts/src/useCountdown/useCountdown.mdx diff --git a/src/useCountdown/useCountdown.test.ts b/packages/usehooks-ts/src/useCountdown/useCountdown.test.ts similarity index 100% rename from src/useCountdown/useCountdown.test.ts rename to packages/usehooks-ts/src/useCountdown/useCountdown.test.ts diff --git a/src/useCountdown/useCountdown.ts b/packages/usehooks-ts/src/useCountdown/useCountdown.ts similarity index 100% rename from src/useCountdown/useCountdown.ts rename to packages/usehooks-ts/src/useCountdown/useCountdown.ts diff --git a/src/useCounter/useCounter.demo.tsx b/packages/usehooks-ts/src/useCounter/useCounter.demo.tsx similarity index 100% rename from src/useCounter/useCounter.demo.tsx rename to packages/usehooks-ts/src/useCounter/useCounter.demo.tsx diff --git a/src/useCounter/useCounter.mdx b/packages/usehooks-ts/src/useCounter/useCounter.mdx similarity index 100% rename from src/useCounter/useCounter.mdx rename to packages/usehooks-ts/src/useCounter/useCounter.mdx diff --git a/src/useCounter/useCounter.test.ts b/packages/usehooks-ts/src/useCounter/useCounter.test.ts similarity index 100% rename from src/useCounter/useCounter.test.ts rename to packages/usehooks-ts/src/useCounter/useCounter.test.ts diff --git a/src/useCounter/useCounter.ts b/packages/usehooks-ts/src/useCounter/useCounter.ts similarity index 100% rename from src/useCounter/useCounter.ts rename to packages/usehooks-ts/src/useCounter/useCounter.ts diff --git a/src/useDarkMode/useDarkMode.demo.tsx b/packages/usehooks-ts/src/useDarkMode/useDarkMode.demo.tsx similarity index 100% rename from src/useDarkMode/useDarkMode.demo.tsx rename to packages/usehooks-ts/src/useDarkMode/useDarkMode.demo.tsx diff --git a/src/useDarkMode/useDarkMode.mdx b/packages/usehooks-ts/src/useDarkMode/useDarkMode.mdx similarity index 100% rename from src/useDarkMode/useDarkMode.mdx rename to packages/usehooks-ts/src/useDarkMode/useDarkMode.mdx diff --git a/src/useDarkMode/useDarkMode.test.ts b/packages/usehooks-ts/src/useDarkMode/useDarkMode.test.ts similarity index 100% rename from src/useDarkMode/useDarkMode.test.ts rename to packages/usehooks-ts/src/useDarkMode/useDarkMode.test.ts diff --git a/src/useDarkMode/useDarkMode.ts b/packages/usehooks-ts/src/useDarkMode/useDarkMode.ts similarity index 100% rename from src/useDarkMode/useDarkMode.ts rename to packages/usehooks-ts/src/useDarkMode/useDarkMode.ts diff --git a/src/useDebounce/useDebounce.demo.tsx b/packages/usehooks-ts/src/useDebounce/useDebounce.demo.tsx similarity index 100% rename from src/useDebounce/useDebounce.demo.tsx rename to packages/usehooks-ts/src/useDebounce/useDebounce.demo.tsx diff --git a/src/useDebounce/useDebounce.mdx b/packages/usehooks-ts/src/useDebounce/useDebounce.mdx similarity index 100% rename from src/useDebounce/useDebounce.mdx rename to packages/usehooks-ts/src/useDebounce/useDebounce.mdx diff --git a/src/useDebounce/useDebounce.test.ts b/packages/usehooks-ts/src/useDebounce/useDebounce.test.ts similarity index 100% rename from src/useDebounce/useDebounce.test.ts rename to packages/usehooks-ts/src/useDebounce/useDebounce.test.ts diff --git a/src/useDebounce/useDebounce.ts b/packages/usehooks-ts/src/useDebounce/useDebounce.ts similarity index 100% rename from src/useDebounce/useDebounce.ts rename to packages/usehooks-ts/src/useDebounce/useDebounce.ts diff --git a/src/useDocumentTitle/useDocumentTitle.demo.tsx b/packages/usehooks-ts/src/useDocumentTitle/useDocumentTitle.demo.tsx similarity index 100% rename from src/useDocumentTitle/useDocumentTitle.demo.tsx rename to packages/usehooks-ts/src/useDocumentTitle/useDocumentTitle.demo.tsx diff --git a/src/useDocumentTitle/useDocumentTitle.mdx b/packages/usehooks-ts/src/useDocumentTitle/useDocumentTitle.mdx similarity index 100% rename from src/useDocumentTitle/useDocumentTitle.mdx rename to packages/usehooks-ts/src/useDocumentTitle/useDocumentTitle.mdx diff --git a/src/useDocumentTitle/useDocumentTitle.test.ts b/packages/usehooks-ts/src/useDocumentTitle/useDocumentTitle.test.ts similarity index 100% rename from src/useDocumentTitle/useDocumentTitle.test.ts rename to packages/usehooks-ts/src/useDocumentTitle/useDocumentTitle.test.ts diff --git a/src/useDocumentTitle/useDocumentTitle.ts b/packages/usehooks-ts/src/useDocumentTitle/useDocumentTitle.ts similarity index 100% rename from src/useDocumentTitle/useDocumentTitle.ts rename to packages/usehooks-ts/src/useDocumentTitle/useDocumentTitle.ts diff --git a/src/useEffectOnce/useEffectOnce.demo.tsx b/packages/usehooks-ts/src/useEffectOnce/useEffectOnce.demo.tsx similarity index 100% rename from src/useEffectOnce/useEffectOnce.demo.tsx rename to packages/usehooks-ts/src/useEffectOnce/useEffectOnce.demo.tsx diff --git a/src/useEffectOnce/useEffectOnce.mdx b/packages/usehooks-ts/src/useEffectOnce/useEffectOnce.mdx similarity index 100% rename from src/useEffectOnce/useEffectOnce.mdx rename to packages/usehooks-ts/src/useEffectOnce/useEffectOnce.mdx diff --git a/src/useEffectOnce/useEffectOnce.test.ts b/packages/usehooks-ts/src/useEffectOnce/useEffectOnce.test.ts similarity index 100% rename from src/useEffectOnce/useEffectOnce.test.ts rename to packages/usehooks-ts/src/useEffectOnce/useEffectOnce.test.ts diff --git a/src/useEffectOnce/useEffectOnce.ts b/packages/usehooks-ts/src/useEffectOnce/useEffectOnce.ts similarity index 100% rename from src/useEffectOnce/useEffectOnce.ts rename to packages/usehooks-ts/src/useEffectOnce/useEffectOnce.ts diff --git a/src/useElementSize/useElementSize.demo.tsx b/packages/usehooks-ts/src/useElementSize/useElementSize.demo.tsx similarity index 100% rename from src/useElementSize/useElementSize.demo.tsx rename to packages/usehooks-ts/src/useElementSize/useElementSize.demo.tsx diff --git a/src/useElementSize/useElementSize.mdx b/packages/usehooks-ts/src/useElementSize/useElementSize.mdx similarity index 100% rename from src/useElementSize/useElementSize.mdx rename to packages/usehooks-ts/src/useElementSize/useElementSize.mdx diff --git a/src/useElementSize/useElementSize.test.ts b/packages/usehooks-ts/src/useElementSize/useElementSize.test.ts similarity index 100% rename from src/useElementSize/useElementSize.test.ts rename to packages/usehooks-ts/src/useElementSize/useElementSize.test.ts diff --git a/src/useElementSize/useElementSize.ts b/packages/usehooks-ts/src/useElementSize/useElementSize.ts similarity index 100% rename from src/useElementSize/useElementSize.ts rename to packages/usehooks-ts/src/useElementSize/useElementSize.ts diff --git a/src/useEventCallback/useEventCallback.ts b/packages/usehooks-ts/src/useEventCallback/useEventCallback.ts similarity index 100% rename from src/useEventCallback/useEventCallback.ts rename to packages/usehooks-ts/src/useEventCallback/useEventCallback.ts diff --git a/src/useEventListener/useEventListener.demo.tsx b/packages/usehooks-ts/src/useEventListener/useEventListener.demo.tsx similarity index 100% rename from src/useEventListener/useEventListener.demo.tsx rename to packages/usehooks-ts/src/useEventListener/useEventListener.demo.tsx diff --git a/src/useEventListener/useEventListener.mdx b/packages/usehooks-ts/src/useEventListener/useEventListener.mdx similarity index 100% rename from src/useEventListener/useEventListener.mdx rename to packages/usehooks-ts/src/useEventListener/useEventListener.mdx diff --git a/src/useEventListener/useEventListener.test.ts b/packages/usehooks-ts/src/useEventListener/useEventListener.test.ts similarity index 100% rename from src/useEventListener/useEventListener.test.ts rename to packages/usehooks-ts/src/useEventListener/useEventListener.test.ts diff --git a/src/useEventListener/useEventListener.ts b/packages/usehooks-ts/src/useEventListener/useEventListener.ts similarity index 100% rename from src/useEventListener/useEventListener.ts rename to packages/usehooks-ts/src/useEventListener/useEventListener.ts diff --git a/src/useFetch/useFetch.demo.tsx b/packages/usehooks-ts/src/useFetch/useFetch.demo.tsx similarity index 100% rename from src/useFetch/useFetch.demo.tsx rename to packages/usehooks-ts/src/useFetch/useFetch.demo.tsx diff --git a/src/useFetch/useFetch.mdx b/packages/usehooks-ts/src/useFetch/useFetch.mdx similarity index 100% rename from src/useFetch/useFetch.mdx rename to packages/usehooks-ts/src/useFetch/useFetch.mdx diff --git a/src/useFetch/useFetch.ts b/packages/usehooks-ts/src/useFetch/useFetch.ts similarity index 100% rename from src/useFetch/useFetch.ts rename to packages/usehooks-ts/src/useFetch/useFetch.ts diff --git a/src/useHover/useHover.demo.tsx b/packages/usehooks-ts/src/useHover/useHover.demo.tsx similarity index 100% rename from src/useHover/useHover.demo.tsx rename to packages/usehooks-ts/src/useHover/useHover.demo.tsx diff --git a/src/useHover/useHover.mdx b/packages/usehooks-ts/src/useHover/useHover.mdx similarity index 100% rename from src/useHover/useHover.mdx rename to packages/usehooks-ts/src/useHover/useHover.mdx diff --git a/src/useHover/useHover.test.ts b/packages/usehooks-ts/src/useHover/useHover.test.ts similarity index 100% rename from src/useHover/useHover.test.ts rename to packages/usehooks-ts/src/useHover/useHover.test.ts diff --git a/src/useHover/useHover.ts b/packages/usehooks-ts/src/useHover/useHover.ts similarity index 100% rename from src/useHover/useHover.ts rename to packages/usehooks-ts/src/useHover/useHover.ts diff --git a/src/useImageOnLoad/useImageOnLoad.demo.tsx b/packages/usehooks-ts/src/useImageOnLoad/useImageOnLoad.demo.tsx similarity index 100% rename from src/useImageOnLoad/useImageOnLoad.demo.tsx rename to packages/usehooks-ts/src/useImageOnLoad/useImageOnLoad.demo.tsx diff --git a/src/useImageOnLoad/useImageOnLoad.mdx b/packages/usehooks-ts/src/useImageOnLoad/useImageOnLoad.mdx similarity index 100% rename from src/useImageOnLoad/useImageOnLoad.mdx rename to packages/usehooks-ts/src/useImageOnLoad/useImageOnLoad.mdx diff --git a/src/useImageOnLoad/useImageOnLoad.ts b/packages/usehooks-ts/src/useImageOnLoad/useImageOnLoad.ts similarity index 100% rename from src/useImageOnLoad/useImageOnLoad.ts rename to packages/usehooks-ts/src/useImageOnLoad/useImageOnLoad.ts diff --git a/src/useIntersectionObserver/useIntersectionObserver.demo.tsx b/packages/usehooks-ts/src/useIntersectionObserver/useIntersectionObserver.demo.tsx similarity index 100% rename from src/useIntersectionObserver/useIntersectionObserver.demo.tsx rename to packages/usehooks-ts/src/useIntersectionObserver/useIntersectionObserver.demo.tsx diff --git a/src/useIntersectionObserver/useIntersectionObserver.mdx b/packages/usehooks-ts/src/useIntersectionObserver/useIntersectionObserver.mdx similarity index 100% rename from src/useIntersectionObserver/useIntersectionObserver.mdx rename to packages/usehooks-ts/src/useIntersectionObserver/useIntersectionObserver.mdx diff --git a/src/useIntersectionObserver/useIntersectionObserver.ts b/packages/usehooks-ts/src/useIntersectionObserver/useIntersectionObserver.ts similarity index 100% rename from src/useIntersectionObserver/useIntersectionObserver.ts rename to packages/usehooks-ts/src/useIntersectionObserver/useIntersectionObserver.ts diff --git a/src/useInterval/useInterval.demo.tsx b/packages/usehooks-ts/src/useInterval/useInterval.demo.tsx similarity index 100% rename from src/useInterval/useInterval.demo.tsx rename to packages/usehooks-ts/src/useInterval/useInterval.demo.tsx diff --git a/src/useInterval/useInterval.mdx b/packages/usehooks-ts/src/useInterval/useInterval.mdx similarity index 100% rename from src/useInterval/useInterval.mdx rename to packages/usehooks-ts/src/useInterval/useInterval.mdx diff --git a/src/useInterval/useInterval.test.ts b/packages/usehooks-ts/src/useInterval/useInterval.test.ts similarity index 100% rename from src/useInterval/useInterval.test.ts rename to packages/usehooks-ts/src/useInterval/useInterval.test.ts diff --git a/src/useInterval/useInterval.ts b/packages/usehooks-ts/src/useInterval/useInterval.ts similarity index 100% rename from src/useInterval/useInterval.ts rename to packages/usehooks-ts/src/useInterval/useInterval.ts diff --git a/src/useIsClient/useIsClient.demo.tsx b/packages/usehooks-ts/src/useIsClient/useIsClient.demo.tsx similarity index 100% rename from src/useIsClient/useIsClient.demo.tsx rename to packages/usehooks-ts/src/useIsClient/useIsClient.demo.tsx diff --git a/src/useIsClient/useIsClient.mdx b/packages/usehooks-ts/src/useIsClient/useIsClient.mdx similarity index 100% rename from src/useIsClient/useIsClient.mdx rename to packages/usehooks-ts/src/useIsClient/useIsClient.mdx diff --git a/src/useIsClient/useIsClient.test.ts b/packages/usehooks-ts/src/useIsClient/useIsClient.test.ts similarity index 100% rename from src/useIsClient/useIsClient.test.ts rename to packages/usehooks-ts/src/useIsClient/useIsClient.test.ts diff --git a/src/useIsClient/useIsClient.ts b/packages/usehooks-ts/src/useIsClient/useIsClient.ts similarity index 100% rename from src/useIsClient/useIsClient.ts rename to packages/usehooks-ts/src/useIsClient/useIsClient.ts diff --git a/src/useIsFirstRender/useIsFirstRender.demo.tsx b/packages/usehooks-ts/src/useIsFirstRender/useIsFirstRender.demo.tsx similarity index 100% rename from src/useIsFirstRender/useIsFirstRender.demo.tsx rename to packages/usehooks-ts/src/useIsFirstRender/useIsFirstRender.demo.tsx diff --git a/src/useIsFirstRender/useIsFirstRender.mdx b/packages/usehooks-ts/src/useIsFirstRender/useIsFirstRender.mdx similarity index 100% rename from src/useIsFirstRender/useIsFirstRender.mdx rename to packages/usehooks-ts/src/useIsFirstRender/useIsFirstRender.mdx diff --git a/src/useIsFirstRender/useIsFirstRender.test.ts b/packages/usehooks-ts/src/useIsFirstRender/useIsFirstRender.test.ts similarity index 100% rename from src/useIsFirstRender/useIsFirstRender.test.ts rename to packages/usehooks-ts/src/useIsFirstRender/useIsFirstRender.test.ts diff --git a/src/useIsFirstRender/useIsFirstRender.ts b/packages/usehooks-ts/src/useIsFirstRender/useIsFirstRender.ts similarity index 100% rename from src/useIsFirstRender/useIsFirstRender.ts rename to packages/usehooks-ts/src/useIsFirstRender/useIsFirstRender.ts diff --git a/src/useIsMounted/useIsMounted.demo.tsx b/packages/usehooks-ts/src/useIsMounted/useIsMounted.demo.tsx similarity index 100% rename from src/useIsMounted/useIsMounted.demo.tsx rename to packages/usehooks-ts/src/useIsMounted/useIsMounted.demo.tsx diff --git a/src/useIsMounted/useIsMounted.mdx b/packages/usehooks-ts/src/useIsMounted/useIsMounted.mdx similarity index 100% rename from src/useIsMounted/useIsMounted.mdx rename to packages/usehooks-ts/src/useIsMounted/useIsMounted.mdx diff --git a/src/useIsMounted/useIsMounted.test.ts b/packages/usehooks-ts/src/useIsMounted/useIsMounted.test.ts similarity index 100% rename from src/useIsMounted/useIsMounted.test.ts rename to packages/usehooks-ts/src/useIsMounted/useIsMounted.test.ts diff --git a/src/useIsMounted/useIsMounted.ts b/packages/usehooks-ts/src/useIsMounted/useIsMounted.ts similarity index 100% rename from src/useIsMounted/useIsMounted.ts rename to packages/usehooks-ts/src/useIsMounted/useIsMounted.ts diff --git a/src/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.demo.tsx b/packages/usehooks-ts/src/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.demo.tsx similarity index 100% rename from src/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.demo.tsx rename to packages/usehooks-ts/src/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.demo.tsx diff --git a/src/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.mdx b/packages/usehooks-ts/src/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.mdx similarity index 100% rename from src/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.mdx rename to packages/usehooks-ts/src/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.mdx diff --git a/src/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.ts b/packages/usehooks-ts/src/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.ts similarity index 100% rename from src/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.ts rename to packages/usehooks-ts/src/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.ts diff --git a/src/useLocalStorage/useLocalStorage.demo.tsx b/packages/usehooks-ts/src/useLocalStorage/useLocalStorage.demo.tsx similarity index 100% rename from src/useLocalStorage/useLocalStorage.demo.tsx rename to packages/usehooks-ts/src/useLocalStorage/useLocalStorage.demo.tsx diff --git a/src/useLocalStorage/useLocalStorage.mdx b/packages/usehooks-ts/src/useLocalStorage/useLocalStorage.mdx similarity index 100% rename from src/useLocalStorage/useLocalStorage.mdx rename to packages/usehooks-ts/src/useLocalStorage/useLocalStorage.mdx diff --git a/src/useLocalStorage/useLocalStorage.test.ts b/packages/usehooks-ts/src/useLocalStorage/useLocalStorage.test.ts similarity index 100% rename from src/useLocalStorage/useLocalStorage.test.ts rename to packages/usehooks-ts/src/useLocalStorage/useLocalStorage.test.ts diff --git a/src/useLocalStorage/useLocalStorage.ts b/packages/usehooks-ts/src/useLocalStorage/useLocalStorage.ts similarity index 100% rename from src/useLocalStorage/useLocalStorage.ts rename to packages/usehooks-ts/src/useLocalStorage/useLocalStorage.ts diff --git a/src/useLockedBody/useLockedBody.demo.tsx b/packages/usehooks-ts/src/useLockedBody/useLockedBody.demo.tsx similarity index 100% rename from src/useLockedBody/useLockedBody.demo.tsx rename to packages/usehooks-ts/src/useLockedBody/useLockedBody.demo.tsx diff --git a/src/useLockedBody/useLockedBody.mdx b/packages/usehooks-ts/src/useLockedBody/useLockedBody.mdx similarity index 100% rename from src/useLockedBody/useLockedBody.mdx rename to packages/usehooks-ts/src/useLockedBody/useLockedBody.mdx diff --git a/src/useLockedBody/useLockedBody.ts b/packages/usehooks-ts/src/useLockedBody/useLockedBody.ts similarity index 100% rename from src/useLockedBody/useLockedBody.ts rename to packages/usehooks-ts/src/useLockedBody/useLockedBody.ts diff --git a/src/useMap/useMap.demo.tsx b/packages/usehooks-ts/src/useMap/useMap.demo.tsx similarity index 100% rename from src/useMap/useMap.demo.tsx rename to packages/usehooks-ts/src/useMap/useMap.demo.tsx diff --git a/src/useMap/useMap.mdx b/packages/usehooks-ts/src/useMap/useMap.mdx similarity index 100% rename from src/useMap/useMap.mdx rename to packages/usehooks-ts/src/useMap/useMap.mdx diff --git a/src/useMap/useMap.test.ts b/packages/usehooks-ts/src/useMap/useMap.test.ts similarity index 100% rename from src/useMap/useMap.test.ts rename to packages/usehooks-ts/src/useMap/useMap.test.ts diff --git a/src/useMap/useMap.ts b/packages/usehooks-ts/src/useMap/useMap.ts similarity index 100% rename from src/useMap/useMap.ts rename to packages/usehooks-ts/src/useMap/useMap.ts diff --git a/src/useMediaQuery/useMediaQuery.demo.tsx b/packages/usehooks-ts/src/useMediaQuery/useMediaQuery.demo.tsx similarity index 100% rename from src/useMediaQuery/useMediaQuery.demo.tsx rename to packages/usehooks-ts/src/useMediaQuery/useMediaQuery.demo.tsx diff --git a/src/useMediaQuery/useMediaQuery.mdx b/packages/usehooks-ts/src/useMediaQuery/useMediaQuery.mdx similarity index 100% rename from src/useMediaQuery/useMediaQuery.mdx rename to packages/usehooks-ts/src/useMediaQuery/useMediaQuery.mdx diff --git a/src/useMediaQuery/useMediaQuery.ts b/packages/usehooks-ts/src/useMediaQuery/useMediaQuery.ts similarity index 100% rename from src/useMediaQuery/useMediaQuery.ts rename to packages/usehooks-ts/src/useMediaQuery/useMediaQuery.ts diff --git a/src/useOnClickOutside/useOnClickOutside.demo.tsx b/packages/usehooks-ts/src/useOnClickOutside/useOnClickOutside.demo.tsx similarity index 100% rename from src/useOnClickOutside/useOnClickOutside.demo.tsx rename to packages/usehooks-ts/src/useOnClickOutside/useOnClickOutside.demo.tsx diff --git a/src/useOnClickOutside/useOnClickOutside.mdx b/packages/usehooks-ts/src/useOnClickOutside/useOnClickOutside.mdx similarity index 100% rename from src/useOnClickOutside/useOnClickOutside.mdx rename to packages/usehooks-ts/src/useOnClickOutside/useOnClickOutside.mdx diff --git a/src/useOnClickOutside/useOnClickOutside.ts b/packages/usehooks-ts/src/useOnClickOutside/useOnClickOutside.ts similarity index 100% rename from src/useOnClickOutside/useOnClickOutside.ts rename to packages/usehooks-ts/src/useOnClickOutside/useOnClickOutside.ts diff --git a/src/useReadLocalStorage/useReadLocalStorage.demo.tsx b/packages/usehooks-ts/src/useReadLocalStorage/useReadLocalStorage.demo.tsx similarity index 100% rename from src/useReadLocalStorage/useReadLocalStorage.demo.tsx rename to packages/usehooks-ts/src/useReadLocalStorage/useReadLocalStorage.demo.tsx diff --git a/src/useReadLocalStorage/useReadLocalStorage.mdx b/packages/usehooks-ts/src/useReadLocalStorage/useReadLocalStorage.mdx similarity index 100% rename from src/useReadLocalStorage/useReadLocalStorage.mdx rename to packages/usehooks-ts/src/useReadLocalStorage/useReadLocalStorage.mdx diff --git a/src/useReadLocalStorage/useReadLocalStorage.test.ts b/packages/usehooks-ts/src/useReadLocalStorage/useReadLocalStorage.test.ts similarity index 100% rename from src/useReadLocalStorage/useReadLocalStorage.test.ts rename to packages/usehooks-ts/src/useReadLocalStorage/useReadLocalStorage.test.ts diff --git a/src/useReadLocalStorage/useReadLocalStorage.ts b/packages/usehooks-ts/src/useReadLocalStorage/useReadLocalStorage.ts similarity index 100% rename from src/useReadLocalStorage/useReadLocalStorage.ts rename to packages/usehooks-ts/src/useReadLocalStorage/useReadLocalStorage.ts diff --git a/src/useScreen/useScreen.demo.tsx b/packages/usehooks-ts/src/useScreen/useScreen.demo.tsx similarity index 100% rename from src/useScreen/useScreen.demo.tsx rename to packages/usehooks-ts/src/useScreen/useScreen.demo.tsx diff --git a/src/useScreen/useScreen.mdx b/packages/usehooks-ts/src/useScreen/useScreen.mdx similarity index 100% rename from src/useScreen/useScreen.mdx rename to packages/usehooks-ts/src/useScreen/useScreen.mdx diff --git a/src/useScreen/useScreen.ts b/packages/usehooks-ts/src/useScreen/useScreen.ts similarity index 100% rename from src/useScreen/useScreen.ts rename to packages/usehooks-ts/src/useScreen/useScreen.ts diff --git a/src/useScript/useScript.demo.tsx b/packages/usehooks-ts/src/useScript/useScript.demo.tsx similarity index 100% rename from src/useScript/useScript.demo.tsx rename to packages/usehooks-ts/src/useScript/useScript.demo.tsx diff --git a/src/useScript/useScript.mdx b/packages/usehooks-ts/src/useScript/useScript.mdx similarity index 100% rename from src/useScript/useScript.mdx rename to packages/usehooks-ts/src/useScript/useScript.mdx diff --git a/src/useScript/useScript.ts b/packages/usehooks-ts/src/useScript/useScript.ts similarity index 100% rename from src/useScript/useScript.ts rename to packages/usehooks-ts/src/useScript/useScript.ts diff --git a/src/useSessionStorage/useSessionStorage.demo.tsx b/packages/usehooks-ts/src/useSessionStorage/useSessionStorage.demo.tsx similarity index 100% rename from src/useSessionStorage/useSessionStorage.demo.tsx rename to packages/usehooks-ts/src/useSessionStorage/useSessionStorage.demo.tsx diff --git a/src/useSessionStorage/useSessionStorage.mdx b/packages/usehooks-ts/src/useSessionStorage/useSessionStorage.mdx similarity index 100% rename from src/useSessionStorage/useSessionStorage.mdx rename to packages/usehooks-ts/src/useSessionStorage/useSessionStorage.mdx diff --git a/src/useSessionStorage/useSessionStorage.test.ts b/packages/usehooks-ts/src/useSessionStorage/useSessionStorage.test.ts similarity index 100% rename from src/useSessionStorage/useSessionStorage.test.ts rename to packages/usehooks-ts/src/useSessionStorage/useSessionStorage.test.ts diff --git a/src/useSessionStorage/useSessionStorage.ts b/packages/usehooks-ts/src/useSessionStorage/useSessionStorage.ts similarity index 100% rename from src/useSessionStorage/useSessionStorage.ts rename to packages/usehooks-ts/src/useSessionStorage/useSessionStorage.ts diff --git a/src/useSsr/useSsr.demo.tsx b/packages/usehooks-ts/src/useSsr/useSsr.demo.tsx similarity index 100% rename from src/useSsr/useSsr.demo.tsx rename to packages/usehooks-ts/src/useSsr/useSsr.demo.tsx diff --git a/src/useSsr/useSsr.mdx b/packages/usehooks-ts/src/useSsr/useSsr.mdx similarity index 100% rename from src/useSsr/useSsr.mdx rename to packages/usehooks-ts/src/useSsr/useSsr.mdx diff --git a/src/useSsr/useSsr.ts b/packages/usehooks-ts/src/useSsr/useSsr.ts similarity index 100% rename from src/useSsr/useSsr.ts rename to packages/usehooks-ts/src/useSsr/useSsr.ts diff --git a/src/useStep/useStep.demo.tsx b/packages/usehooks-ts/src/useStep/useStep.demo.tsx similarity index 100% rename from src/useStep/useStep.demo.tsx rename to packages/usehooks-ts/src/useStep/useStep.demo.tsx diff --git a/src/useStep/useStep.mdx b/packages/usehooks-ts/src/useStep/useStep.mdx similarity index 100% rename from src/useStep/useStep.mdx rename to packages/usehooks-ts/src/useStep/useStep.mdx diff --git a/src/useStep/useStep.test.ts b/packages/usehooks-ts/src/useStep/useStep.test.ts similarity index 100% rename from src/useStep/useStep.test.ts rename to packages/usehooks-ts/src/useStep/useStep.test.ts diff --git a/src/useStep/useStep.ts b/packages/usehooks-ts/src/useStep/useStep.ts similarity index 100% rename from src/useStep/useStep.ts rename to packages/usehooks-ts/src/useStep/useStep.ts diff --git a/src/useTernaryDarkMode/useTernaryDarkMode.demo.tsx b/packages/usehooks-ts/src/useTernaryDarkMode/useTernaryDarkMode.demo.tsx similarity index 100% rename from src/useTernaryDarkMode/useTernaryDarkMode.demo.tsx rename to packages/usehooks-ts/src/useTernaryDarkMode/useTernaryDarkMode.demo.tsx diff --git a/src/useTernaryDarkMode/useTernaryDarkMode.mdx b/packages/usehooks-ts/src/useTernaryDarkMode/useTernaryDarkMode.mdx similarity index 100% rename from src/useTernaryDarkMode/useTernaryDarkMode.mdx rename to packages/usehooks-ts/src/useTernaryDarkMode/useTernaryDarkMode.mdx diff --git a/src/useTernaryDarkMode/useTernaryDarkMode.ts b/packages/usehooks-ts/src/useTernaryDarkMode/useTernaryDarkMode.ts similarity index 100% rename from src/useTernaryDarkMode/useTernaryDarkMode.ts rename to packages/usehooks-ts/src/useTernaryDarkMode/useTernaryDarkMode.ts diff --git a/src/useTimeout/useTimeout.demo.tsx b/packages/usehooks-ts/src/useTimeout/useTimeout.demo.tsx similarity index 100% rename from src/useTimeout/useTimeout.demo.tsx rename to packages/usehooks-ts/src/useTimeout/useTimeout.demo.tsx diff --git a/src/useTimeout/useTimeout.mdx b/packages/usehooks-ts/src/useTimeout/useTimeout.mdx similarity index 100% rename from src/useTimeout/useTimeout.mdx rename to packages/usehooks-ts/src/useTimeout/useTimeout.mdx diff --git a/src/useTimeout/useTimeout.test.ts b/packages/usehooks-ts/src/useTimeout/useTimeout.test.ts similarity index 100% rename from src/useTimeout/useTimeout.test.ts rename to packages/usehooks-ts/src/useTimeout/useTimeout.test.ts diff --git a/src/useTimeout/useTimeout.ts b/packages/usehooks-ts/src/useTimeout/useTimeout.ts similarity index 100% rename from src/useTimeout/useTimeout.ts rename to packages/usehooks-ts/src/useTimeout/useTimeout.ts diff --git a/src/useToggle/useToggle.demo.tsx b/packages/usehooks-ts/src/useToggle/useToggle.demo.tsx similarity index 100% rename from src/useToggle/useToggle.demo.tsx rename to packages/usehooks-ts/src/useToggle/useToggle.demo.tsx diff --git a/src/useToggle/useToggle.mdx b/packages/usehooks-ts/src/useToggle/useToggle.mdx similarity index 100% rename from src/useToggle/useToggle.mdx rename to packages/usehooks-ts/src/useToggle/useToggle.mdx diff --git a/src/useToggle/useToggle.test.ts b/packages/usehooks-ts/src/useToggle/useToggle.test.ts similarity index 100% rename from src/useToggle/useToggle.test.ts rename to packages/usehooks-ts/src/useToggle/useToggle.test.ts diff --git a/src/useToggle/useToggle.ts b/packages/usehooks-ts/src/useToggle/useToggle.ts similarity index 100% rename from src/useToggle/useToggle.ts rename to packages/usehooks-ts/src/useToggle/useToggle.ts diff --git a/src/useUpdateEffect/useUpdateEffect.demo.tsx b/packages/usehooks-ts/src/useUpdateEffect/useUpdateEffect.demo.tsx similarity index 100% rename from src/useUpdateEffect/useUpdateEffect.demo.tsx rename to packages/usehooks-ts/src/useUpdateEffect/useUpdateEffect.demo.tsx diff --git a/src/useUpdateEffect/useUpdateEffect.mdx b/packages/usehooks-ts/src/useUpdateEffect/useUpdateEffect.mdx similarity index 100% rename from src/useUpdateEffect/useUpdateEffect.mdx rename to packages/usehooks-ts/src/useUpdateEffect/useUpdateEffect.mdx diff --git a/src/useUpdateEffect/useUpdateEffect.test.ts b/packages/usehooks-ts/src/useUpdateEffect/useUpdateEffect.test.ts similarity index 100% rename from src/useUpdateEffect/useUpdateEffect.test.ts rename to packages/usehooks-ts/src/useUpdateEffect/useUpdateEffect.test.ts diff --git a/src/useUpdateEffect/useUpdateEffect.ts b/packages/usehooks-ts/src/useUpdateEffect/useUpdateEffect.ts similarity index 100% rename from src/useUpdateEffect/useUpdateEffect.ts rename to packages/usehooks-ts/src/useUpdateEffect/useUpdateEffect.ts diff --git a/src/useWindowSize/useWindowSize.demo.tsx b/packages/usehooks-ts/src/useWindowSize/useWindowSize.demo.tsx similarity index 100% rename from src/useWindowSize/useWindowSize.demo.tsx rename to packages/usehooks-ts/src/useWindowSize/useWindowSize.demo.tsx diff --git a/src/useWindowSize/useWindowSize.mdx b/packages/usehooks-ts/src/useWindowSize/useWindowSize.mdx similarity index 100% rename from src/useWindowSize/useWindowSize.mdx rename to packages/usehooks-ts/src/useWindowSize/useWindowSize.mdx diff --git a/src/useWindowSize/useWindowSize.test.ts b/packages/usehooks-ts/src/useWindowSize/useWindowSize.test.ts similarity index 100% rename from src/useWindowSize/useWindowSize.test.ts rename to packages/usehooks-ts/src/useWindowSize/useWindowSize.test.ts diff --git a/src/useWindowSize/useWindowSize.ts b/packages/usehooks-ts/src/useWindowSize/useWindowSize.ts similarity index 100% rename from src/useWindowSize/useWindowSize.ts rename to packages/usehooks-ts/src/useWindowSize/useWindowSize.ts diff --git a/packages/usehooks-ts/tsconfig.build.json b/packages/usehooks-ts/tsconfig.build.json new file mode 100644 index 00000000..38020790 --- /dev/null +++ b/packages/usehooks-ts/tsconfig.build.json @@ -0,0 +1,14 @@ +{ + "extends": "./tsconfig.json", + + "compilerOptions": { + "rootDir": "./src", + "moduleResolution": "node", + "isolatedModules": true, + // Needed for CommonJS modules + "allowSyntheticDefaultImports": true + }, + + "include": ["./src/**/*"], + "exclude": ["./src/**/*.test.ts", "./src/**/*.mdx", "./src/**/*.demo.tsx"] +} diff --git a/packages/usehooks-ts/tsconfig.json b/packages/usehooks-ts/tsconfig.json new file mode 100644 index 00000000..aabc2e9d --- /dev/null +++ b/packages/usehooks-ts/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "baseUrl": ".", + "declaration": true, + "pretty": true, + "skipLibCheck": true, + "removeComments": true, + "esModuleInterop": true, + "jsx": "react-jsx", + "strict": true, + "lib": [ + "ESNEXT", + "DOM" + ] + }, + "exclude": [ + "node_modules", + "dist", + ] +}