Useful methods for image-related functions.
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. # TSDX User Guide
  2. 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.
  3. > This TSDX setup is meant for developing libraries (not apps!) that can be published to NPM. If you’re looking to build a Node app, you could use `ts-node-dev`, plain `ts-node`, or simple `tsc`.
  4. > If you’re new to TypeScript, checkout [this handy cheatsheet](https://devhints.io/typescript)
  5. ## Commands
  6. TSDX scaffolds your new library inside `/src`.
  7. To run TSDX, use:
  8. ```bash
  9. npm start # or yarn start
  10. ```
  11. This builds to `/dist` and runs the project in watch mode so any edits you save inside `src` causes a rebuild to `/dist`.
  12. To do a one-off build, use `npm run build` or `yarn build`.
  13. To run tests, use `npm test` or `yarn test`.
  14. ## Configuration
  15. Code quality is set up for you with `prettier`, `husky`, and `lint-staged`. Adjust the respective fields in `package.json` accordingly.
  16. ### Jest
  17. Jest tests are set up to run with `npm test` or `yarn test`.
  18. #### Setup Files
  19. This is the folder structure we set up for you:
  20. ```txt
  21. /src
  22. index.tsx # EDIT THIS
  23. /test
  24. blah.test.tsx # EDIT THIS
  25. .gitignore
  26. package.json
  27. README.md # EDIT THIS
  28. tsconfig.json
  29. ```
  30. ### Rollup
  31. TSDX 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.
  32. ### TypeScript
  33. `tsconfig.json` is set up to interpret `dom` and `esnext` types, as well as `react` for `jsx`. Adjust according to your needs.
  34. ## Continuous Integration
  35. ### GitHub Actions
  36. A simple action is included that runs these steps on all pushes:
  37. - Installs deps w/ cache
  38. - Lints, tests, and builds
  39. ## Optimizations
  40. Please see the main `tsdx` [optimizations docs](https://github.com/palmerhq/tsdx#optimizations). In particular, know that you can take advantage of development-only optimizations:
  41. ```js
  42. // ./types/index.d.ts
  43. declare var __DEV__: boolean;
  44. // inside your code...
  45. if (__DEV__) {
  46. console.log('foo');
  47. }
  48. ```
  49. You can also choose to install and use [invariant](https://github.com/palmerhq/tsdx#invariant) and [warning](https://github.com/palmerhq/tsdx#warning) functions.
  50. ## Module Formats
  51. CJS, ESModules, and UMD module formats are supported.
  52. The appropriate paths are configured in `package.json` and `dist/index.js` accordingly. Please report if any issues are found.
  53. ## Named Exports
  54. Per Palmer Group guidelines, [always use named exports.](https://github.com/palmerhq/typescript#exports) Code split inside your React app instead of your React library.
  55. ## Including Styles
  56. There are many ways to ship styles, including with CSS-in-JS. TSDX has no opinion on this, configure how you like.
  57. For 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.
  58. ## Publishing to NPM
  59. We recommend using [np](https://github.com/sindresorhus/np).