{"_id":"@5alid/react-hooks","_rev":"1-9eaf03c7d3ed06f8492e719f8ca06c78","name":"@5alid/react-hooks","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"version":"0.1.0","license":"MIT","main":"dist/index.js","typings":"dist/index.d.ts","engines":{"node":">=10"},"scripts":{"start":"tsdx watch","build":"tsdx build","test":"tsdx test --passWithNoTests","lint":"tsdx lint","prepare":"tsdx build","size":"size-limit","analyze":"size-limit --why"},"peerDependencies":{"react":">=16"},"husky":{"hooks":{"pre-commit":"tsdx lint"}},"prettier":{"printWidth":80,"semi":true,"singleQuote":true,"trailingComma":"es5"},"name":"@5alid/react-hooks","author":{"name":"khaled"},"module":"dist/react-hooks.esm.js","size-limit":[{"path":"dist/react-hooks.cjs.production.min.js","limit":"10 KB"},{"path":"dist/react-hooks.esm.js","limit":"10 KB"}],"publishConfig":{"access":"public"},"devDependencies":{"@size-limit/preset-small-lib":"^4.7.0","@types/react":"^16.9.56","@types/react-dom":"^16.9.9","husky":"^4.3.0","react":"^17.0.1","react-dom":"^17.0.1","size-limit":"^4.7.0","tsdx":"^0.14.1","tslib":"^2.0.3","typescript":"^4.0.5"},"gitHead":"35efb2f76f7061f3d3254d0c3bafd8c3ec989bf6","description":"Congrats! You just saved yourself hours of work by bootstrapping this project with TSDX. Let’s get you oriented with what’s here and how to use it.","_id":"@5alid/react-hooks@0.1.0","_nodeVersion":"14.13.1","_npmVersion":"6.14.8","dist":{"integrity":"sha512-G5HWSWapty5mT01rVPkoUa4squZ0xRAQSDIpkE/i2N2Wy/XS4ZAzPpTIr7H/OZrWFhZmBpLU/lzKjj+e9CGOMw==","shasum":"d48f5bd31e74576dc80389f5684dc5243c97ab48","tarball":"https://registry.npmjs.org/@5alid/react-hooks/-/react-hooks-0.1.0.tgz","fileCount":32,"unpackedSize":73617,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfp/cfCRA9TVsSAnZWagAAoWsP/i5lw32Aj2YRTN+9WWaT\nqyqA1QHO+n7iTFKPt1957yUHYWZc84NA6nQeDPckzVeRJFJAFXOxOFAA2puA\npUWJsW6c3fV9ozWlnyxhcTQDcy1NaHRpZNrxn1PbgOgqlP0I1OI3ftnUeSFU\n61wlzXwPe5fD3RysoYkdgmNZE+fB2Dnsh27I+j77foyIMq3EVWH56pKNPzA3\n9MrnX6sEINN9RdCCX8a6ftZjPVjGGYLnq4CP2/GNzG6taCMOmQopvAVmNKaS\n1YvHtIRH58WYVEk4PGxjWaEcCYfaZCrOUqD9+dvW77Ql0XFGwc7zxSeSAILQ\nf8Sh0GPWYHdooUhF/IRS8al5h/E4z+Yh5a+IsFU/7aCniHYZXqx+Ib5sAmHb\nWIWsgtym5z9enFnUR67NshYprRPZHcItykvOFCOpNOj69/bzTMfbBSZtyg+g\nQ0om+nZVEPGJXwuzj5wQUWs7aktjEEHOVL0jobhO3qmDVTG7kYxsoToStdqT\n85VKFViEvCFxssZtK9HMDGSlHbj0j6aSYVKrv7PruFqxElyB1Svjm7l4wVJs\nmPkKufp78gEA1+Fl9cIcvVCWhs5rJTJnBJ4aKlM5dLHsjh6abPK+A150EQS3\nJFWfeJKEccOiGYNGV1FoLsKpry9j+znMX6uJjI9VOxUP5up/LNtrHx+jSSj2\nYqPU\r\n=h+0O\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDsZZGRrxHSsg0grGRIwFpQ6MAMLv3PQ4YR9lcnElmXrgIhALBVNNHAB5kei9Qo/MUdD+q5mbb5khW0ng5Nw2cGxTJt"}]},"_npmUser":{"name":"5alid","email":"kzack_dev@hotmail.com"},"directories":{},"maintainers":[{"name":"5alid","email":"kzack_dev@hotmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-hooks_0.1.0_1604843294788_0.5781478976231738"},"_hasShrinkwrap":false}},"time":{"created":"2020-11-08T13:48:14.743Z","0.1.0":"2020-11-08T13:48:14.915Z","modified":"2022-04-04T10:48:18.801Z"},"maintainers":[{"name":"5alid","email":"kzack_dev@hotmail.com"}],"description":"Congrats! You just saved yourself hours of work by bootstrapping this project with TSDX. Let’s get you oriented with what’s here and how to use it.","author":{"name":"khaled"},"license":"MIT","readme":"# TSDX React User Guide\n\nCongrats! You just saved yourself hours of work by bootstrapping this project with TSDX. Let’s get you oriented with what’s here and how to use it.\n\n> This TSDX setup is meant for developing React component libraries (not apps!) that can be published to NPM. If you’re looking to build a React-based app, you should use `create-react-app`, `razzle`, `nextjs`, `gatsby`, or `react-static`.\n\n> If you’re new to TypeScript and React, checkout [this handy cheatsheet](https://github.com/sw-yx/react-typescript-cheatsheet/)\n\n## Commands\n\nTSDX scaffolds your new library inside `/src`, and also sets up a [Parcel-based](https://parceljs.org) playground for it inside `/example`.\n\nThe recommended workflow is to run TSDX in one terminal:\n\n```bash\nnpm start # or yarn start\n```\n\nThis builds to `/dist` and runs the project in watch mode so any edits you save inside `src` causes a rebuild to `/dist`.\n\nThen run the example inside another:\n\n```bash\ncd example\nnpm i # or yarn to install dependencies\nnpm start # or yarn start\n```\n\nThe default example imports and live reloads whatever is in `/dist`, so if you are seeing an out of date component, make sure TSDX is running in watch mode like we recommend above. **No symlinking required**, we use [Parcel's aliasing](https://parceljs.org/module_resolution.html#aliases).\n\nTo do a one-off build, use `npm run build` or `yarn build`.\n\nTo run tests, use `npm test` or `yarn test`.\n\n## Configuration\n\nCode quality is set up for you with `prettier`, `husky`, and `lint-staged`. Adjust the respective fields in `package.json` accordingly.\n\n### Jest\n\nJest tests are set up to run with `npm test` or `yarn test`.\n\n### Bundle analysis\n\nCalculates the real cost of your library using [size-limit](https://github.com/ai/size-limit) with `npm run size` and visulize it with `npm run analyze`.\n\n#### Setup Files\n\nThis is the folder structure we set up for you:\n\n```txt\n/example\n  index.html\n  index.tsx       # test your component here in a demo app\n  package.json\n  tsconfig.json\n/src\n  index.tsx       # EDIT THIS\n/test\n  blah.test.tsx   # EDIT THIS\n.gitignore\npackage.json\nREADME.md         # EDIT THIS\ntsconfig.json\n```\n\n#### React Testing Library\n\nWe do not set up `react-testing-library` for you yet, we welcome contributions and documentation on this.\n\n### Rollup\n\nTSDX uses [Rollup](https://rollupjs.org) as a bundler and generates multiple rollup configs for various module formats and build settings. See [Optimizations](#optimizations) for details.\n\n### TypeScript\n\n`tsconfig.json` is set up to interpret `dom` and `esnext` types, as well as `react` for `jsx`. Adjust according to your needs.\n\n## Continuous Integration\n\n### GitHub Actions\n\nTwo actions are added by default:\n\n- `main` which installs deps w/ cache, lints, tests, and builds on all pushes against a Node and OS matrix\n- `size` which comments cost comparison of your library on every pull request using [`size-limit`](https://github.com/ai/size-limit)\n\n## Optimizations\n\nPlease see the main `tsdx` [optimizations docs](https://github.com/palmerhq/tsdx#optimizations). In particular, know that you can take advantage of development-only optimizations:\n\n```js\n// ./types/index.d.ts\ndeclare var __DEV__: boolean;\n\n// inside your code...\nif (__DEV__) {\n  console.log('foo');\n}\n```\n\nYou can also choose to install and use [invariant](https://github.com/palmerhq/tsdx#invariant) and [warning](https://github.com/palmerhq/tsdx#warning) functions.\n\n## Module Formats\n\nCJS, ESModules, and UMD module formats are supported.\n\nThe appropriate paths are configured in `package.json` and `dist/index.js` accordingly. Please report if any issues are found.\n\n## Deploying the Example Playground\n\nThe Playground is just a simple [Parcel](https://parceljs.org) app, you can deploy it anywhere you would normally deploy that. Here are some guidelines for **manually** deploying with the Netlify CLI (`npm i -g netlify-cli`):\n\n```bash\ncd example # if not already in the example folder\nnpm run build # builds to dist\nnetlify deploy # deploy the dist folder\n```\n\nAlternatively, if you already have a git repo connected, you can set up continuous deployment with Netlify:\n\n```bash\nnetlify init\n# build command: yarn build && cd example && yarn && yarn build\n# directory to deploy: example/dist\n# pick yes for netlify.toml\n```\n\n## Named Exports\n\nPer Palmer Group guidelines, [always use named exports.](https://github.com/palmerhq/typescript#exports) Code split inside your React app instead of your React library.\n\n## Including Styles\n\nThere are many ways to ship styles, including with CSS-in-JS. TSDX has no opinion on this, configure how you like.\n\nFor vanilla CSS, you can include it at the root directory and add it to the `files` section in your `package.json`, so that it can be imported separately by your users and run through their bundler's loader.\n\n## Publishing to NPM\n\nWe recommend using [np](https://github.com/sindresorhus/np).\n\n## Usage with Lerna\n\nWhen creating a new package with TSDX within a project set up with Lerna, you might encounter a `Cannot resolve dependency` error when trying to run the `example` project. To fix that you will need to make changes to the `package.json` file _inside the `example` directory_.\n\nThe problem is that due to the nature of how dependencies are installed in Lerna projects, the aliases in the example project's `package.json` might not point to the right place, as those dependencies might have been installed in the root of your Lerna project.\n\nChange the `alias` to point to where those packages are actually installed. This depends on the directory structure of your Lerna project, so the actual path might be different from the diff below.\n\n```diff\n   \"alias\": {\n-    \"react\": \"../node_modules/react\",\n-    \"react-dom\": \"../node_modules/react-dom\"\n+    \"react\": \"../../../node_modules/react\",\n+    \"react-dom\": \"../../../node_modules/react-dom\"\n   },\n```\n\nAn alternative to fixing this problem would be to remove aliases altogether and define the dependencies referenced as aliases as dev dependencies instead. [However, that might cause other problems.](https://github.com/palmerhq/tsdx/issues/64)\n","readmeFilename":"README.md"}