Both of these are for light roof loads.
Ok to use 2 x 4 for for roof rafters.
It is always better to have a large rafter rather than be concerned with a sagging roof.
Rather than having 2 4 purlins every 12 it would make far more sense economically to use 2 6 purlins every 24.
If you live in an area that requires a shed roof rafter to support a heavy load then an spf rafter can only span 7.
Somehow i am in a traditionalist camp 16 oc for a 12 foot wall will add only 6 extra 2x4 s or 3 extra if you buy 10 foot lengths for the rafters and 6 extra 2x4 s for studs if you use only a single layer top plate on the bearing walls.
The back of the roof will attach to house with 16 2x4 and lag screws.
You can use them for roof floor and even wall framing but few sheds will need trusses for walls.
Also if you want to make things cheaper you can do a single slope of the roof and basically cut out the eve cost.
The secret word is truss.
At the pitch range you are looking at the 2x4 is just fine up to 8 6 depending on the lumber grade.
As mentioned above a 2 4 spf shed roof rafter can span 11.
Structures such as sheds or barns can be frames with rafters every 24 again make sure to consult local codes.
If your project had a rafter length of 8 or less a safe and strong method is to use 2x8 framed 16 on center.
I think you will be fine with 2x4s so long as they are closer than 48 apart.
Less expensive 1 3rd less board footage of lumber fewer pieces to handle fewer joist hangers to have to attach and only one half as many screws to attach the roof steel.
An syp rafter can span 11.
Front and sides will sit on deck on a 2x4 wall with studs 24 oc and screened in.