Preheat the oven to 350F/175C. Line a muffin tray with cupcake lines (paper or, as I used here, silicone).
In a medium bowl or measuring jug, whisk together the pumpkin puree, egg, coconut oil, vanilla, brown sugar and maple syrup until well blended.
Separately, measure out the flour, baking powder, salt, cinnamon, allspice, ginger and nutmeg in a large bowl. Whisk to blend.
Add the pumpkin-egg mixture to the dry ingredients and stir so evenly mixed, but try not to over-mix. Add the milk to help the mixture be slightly looser. If you use homemade puree, and depending on your flour, you may need a little more (the mixture will be relatively thick but should flow slightly).
Spoon the mixture into the cupcake lines, filling them to roughly ¾ full. Smooth the top if needed. Bake for approximately 20 minutes until lightly brown and a skewer inserted into the middle of a cupcake comes out clean.
Transfer the cupcakes to a cooling rack and leave to cool completely.
While they are cooling, mix together the frosting ingredients, if using (cream cheese, butter and maple syrup) until well blended - I'd recommend using a small mixer/hand blender if possible.
When cool, either pipe or spread the frosting on the cupcakes and serve.