Extract and set form values through the DOM—no frameworks required! https://github.com/TheoryOfNekomata/formxtra
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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. ### Bundle Analysis
  19. [`size-limit`](https://github.com/ai/size-limit) is set up to calculate the real cost of your library with `npm run size` and visualize the bundle with `npm run analyze`.
  20. #### Setup Files
  21. This is the folder structure we set up for you:
  22. ```txt
  23. /src
  24. index.tsx # EDIT THIS
  25. /test
  26. blah.test.tsx # EDIT THIS
  27. .gitignore
  28. package.json
  29. README.md # EDIT THIS
  30. tsconfig.json
  31. ```
  32. ### Rollup
  33. 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.
  34. ### TypeScript
  35. `tsconfig.json` is set up to interpret `dom` and `esnext` types, as well as `react` for `jsx`. Adjust according to your needs.
  36. ## Continuous Integration
  37. ### GitHub Actions
  38. Two actions are added by default:
  39. - `main` which installs deps w/ cache, lints, tests, and builds on all pushes against a Node and OS matrix
  40. - `size` which comments cost comparison of your library on every pull request using [`size-limit`](https://github.com/ai/size-limit)
  41. ## Optimizations
  42. 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:
  43. ```js
  44. // ./types/index.d.ts
  45. declare var __DEV__: boolean;
  46. // inside your code...
  47. if (__DEV__) {
  48. console.log('foo');
  49. }
  50. ```
  51. You can also choose to install and use [invariant](https://github.com/palmerhq/tsdx#invariant) and [warning](https://github.com/palmerhq/tsdx#warning) functions.
  52. ## Module Formats
  53. CJS, ESModules, and UMD module formats are supported.
  54. The appropriate paths are configured in `package.json` and `dist/index.js` accordingly. Please report if any issues are found.
  55. ## Named Exports
  56. 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.
  57. ## Including Styles
  58. There are many ways to ship styles, including with CSS-in-JS. TSDX has no opinion on this, configure how you like.
  59. 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.
  60. ## Publishing to NPM
  61. We recommend using [np](https://github.com/sindresorhus/np).