meeshkan / unmock-js

Fuzz test your REST API calls
https://unmock.io
93 stars 8 forks source link

Extract types from unmock-core to a new package #357

Closed ksaaskil closed 4 years ago

ksaaskil commented 4 years ago

It would be very useful to extract common types from interfaces.ts to a separate lerna package called, for example, unmock-types. Once this is done, one could remove for example unmock-core dependency from unmock-fetch and only depend on unmock-types. Types could then also be used in other projects.

What should be moved:

How to create a new package:

  1. Copy an existing (light-weight) package such as unmock-jest to a new package called unmock-types
  2. Update package.json
  3. Update tsconfig.json and its references in the new package
  4. Remove everything from src/ except index.ts and src/__tests__/tsconfig.json
  5. Update tsconfig.build.json in the project root to refer to the package
  6. Update tsconfig.test.json
  7. Add the package as a dependency in the root package.json
  8. Add the package to lint-ts and lint-ts-fix commands in package.json

Instead of copying, you can also use the lerna CLI's create command to create the package.

For this issue, it's not required to update other packages to use the new package. That can (and should) be done in later PRs.