data icon indicating copy to clipboard operation
data copied to clipboard

`npx warp-drive retrofit types@canary` doesn't remove DT packages

Open Windvis opened this issue 1 year ago • 0 comments

Reproduction

  1. Create a new TS project on Stackblitz: https://stackblitz.com/fork/github/ember-cli/editor-output/tree/stackblitz-app-output-typescript?title=Ember%20TypeScript%20Starter
  2. Run the command there

Description

I just tried out the npx warp-drive retrofit types@canary as documented here and I noticed that the DT packages weren't actually being removed.

I did some debugging and it seems there are multiple problems:

  1. This line is incorrect. DefinitelyTyped is an array of strings, so the array destructuring isn't needed there. https://github.com/emberjs/data/blob/16c9ad97a4a0fdff7d5b2688d0dd7f94540c93f1/packages/-warp-drive/src/-private/warp-drive/commands/retrofit.ts#L324
  2. It seems that the pkg.dependencies and pkg.devDependencies are being replaced with new (sorted) versions. This also means that the deps and devDeps references no longer point to the same object, so the deletes don't affect the version that is written back to disk afterwards.

Windvis avatar Aug 29 '24 09:08 Windvis