{"id":15980450,"url":"https://github.com/stramel/use-file-reader","last_synced_at":"2026-02-13T01:39:02.789Z","repository":{"id":44066074,"uuid":"212170955","full_name":"stramel/use-file-reader","owner":"stramel","description":null,"archived":false,"fork":false,"pushed_at":"2023-01-04T11:53:21.000Z","size":672,"stargazers_count":0,"open_issues_count":12,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-01-18T22:25:15.611Z","etag":null,"topics":["filereader","hooks","react","typescript"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stramel.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-10-01T18:33:39.000Z","updated_at":"2021-05-10T16:33:38.000Z","dependencies_parsed_at":"2023-02-02T11:16:01.376Z","dependency_job_id":null,"html_url":"https://github.com/stramel/use-file-reader","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/stramel/use-file-reader","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stramel%2Fuse-file-reader","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stramel%2Fuse-file-reader/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stramel%2Fuse-file-reader/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stramel%2Fuse-file-reader/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stramel","download_url":"https://codeload.github.com/stramel/use-file-reader/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stramel%2Fuse-file-reader/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29392015,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-13T00:53:09.511Z","status":"ssl_error","status_checked_at":"2026-02-13T00:53:09.126Z","response_time":55,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["filereader","hooks","react","typescript"],"created_at":"2024-10-08T00:05:09.662Z","updated_at":"2026-02-13T01:39:02.775Z","avatar_url":"https://github.com/stramel.png","language":"TypeScript","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\u003e This TSDX setup is meant for developing React components (not apps!) that can be published to NPM. If you’re looking to build an app, you should use `create-react-app`, `razzle`, `nextjs`, `gatsby`, or `react-static`.\n\n\u003e 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```\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```\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://github.com/palmerhq/tsdx/pull/88/files).\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](https://github.com/palmerhq/tsdx/pull/45/files) 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`. This runs the test watcher (Jest) in an interactive mode. By default, runs tests related to files changed since the last commit.\n\n#### Setup Files\n\nThis is the folder structure we set up for you:\n\n```\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 v1.x](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### Travis\n\n_to be completed_\n\n### Circle\n\n_to be completed_\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## Using the Playground\n\n```\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**!\n\n## Deploying the 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 \u0026\u0026 cd example \u0026\u0026 yarn \u0026\u0026 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 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","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstramel%2Fuse-file-reader","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstramel%2Fuse-file-reader","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstramel%2Fuse-file-reader/lists"}