Use grunt instead of fs and update dependencies

`fs.writeFileSync` fails if the destination folder does not exists.

I've replaced it with `grunt.file.write` which instead creates the folder before writing the file.

I've also updated some dependencies.