You want to Retrofit the ship. It is in the main command bar, the green triangle made up of 3 arrows. You must have a Spaceyard in the same sector as the ship to retrofit. All the new components will be put in as broken, and will have to be repaired (which the spaceyard can do). (This is especially important if you retrofit to new engines. The new engines will all be installed as broken. No engines = no supplies = I hope you have a resupply depot in the same sector.

)