I\'m trying to write a new file inside a grunt-search callback.
The process takes and object, traverses through it for some data, creates a new array, and then write
Your problem should be that the fs.writeFile starts "asynchronous". Try to change the localArray in here (hardcode it to see if it works):
fs.writeFile( 'i18n/localize_template.json', localArray, callback)
And there it should work. The solution i think it is that you should use fs.writeFileSync, or to initialize the localArray outside the oncomplete function, before it starts.