manager icon indicating copy to clipboard operation
manager copied to clipboard

M3-5873: Build `api-v4` and `validation` with `tsup` with backwards compatibility

Open bnussman opened this issue 3 years ago • 0 comments

✨ Description

  • Use tsup for building @linode/api-v4 and @linode/validation

📝 Details

  • Deprecates yarn up in favor of yarn dev
  • Runs a dev server for @linode/validation so it rebuilds automatically when you are using yarn dev / yarn up
  • Changes any src/ prefixed imports in @linode/api-v4 and @linode/validation to be relative path imports (../)
    • We should do this to keeps those packages simple. Aliases can causes extra complexity and is not beneficial in small packages like ours.
  • Configure Cloud Manger's jest to use @linode/api-v4 and @linode/validation's srcinstead of lib.
    • We do this because jest was having trouble resolving exports because of its lackluster esm or exports support.
  • Type generation is handled by tsc
  • Use incremental tsc compilation for @linode/api-v4 and @linode/validation for faster typechecking
  • We are going to publish esm, commonjs, and iife as 3 bundled formats
    • This results in 3 respective index.jss for each format (excluding type files)
    • Cloud Manager consumes esm
    • Jest will consume commonjs
    • Dependencies are only bundled into the index.js file for the iife format so it is suitable for web use

🧪 How to test

  • Test all of Cloud Manager, @linode/api-v4, and @linode/validation

bnussman avatar Aug 04 '22 23:08 bnussman