Automatically create an index.js file from specified directory