Beating all-ins as Protoss

Recently as a silver Protoss I've been losing a lot to all ins. Mostly a stim timing or really awkward 4 gates which hit like a minute late and It seems like I just don't have enough money early on to build units to defend as I'm always building probes and pylons and because I'm a silver noob I can't really decipher scouting information beyond cheeses.. Can anyone give me general advice on spending minerals as protoss