Compact files array

Certain paths may not match any files, so their value might be nil.
Hence we must compact the files array.
Optionally only build packages in production