diff --git a/src/utilities/writeIndex.js b/src/utilities/writeIndex.js index d12d96a..89a9ccf 100644 --- a/src/utilities/writeIndex.js +++ b/src/utilities/writeIndex.js @@ -18,7 +18,7 @@ export default (directoryPaths, options = {}) => { const optionsWithConfig = Object.assign({}, options, {config}); const siblings = readDirectory(directoryPath, optionsWithConfig); const indexCode = createIndexCode(siblings, optionsWithConfig); - const indexFilePath = path.resolve(directoryPath, 'index.js'); + const indexFilePath = path.resolve(directoryPath, optionsWithConfig.outputFile || 'index.js'); fs.writeFileSync(indexFilePath, indexCode); }); diff --git a/src/utilities/writeIndexCli.js b/src/utilities/writeIndexCli.js index e7626ff..0b8d12d 100644 --- a/src/utilities/writeIndexCli.js +++ b/src/utilities/writeIndexCli.js @@ -27,7 +27,7 @@ export default (directoryPaths, options = {}) => { if (options.updateIndex || options.recursive) { sortedDirectoryPaths = _.map(sortedDirectoryPaths, (dir) => { return findIndexFiles(dir, { - fileName: options.updateIndex ? 'index.js' : '*', + fileName: options.updateIndex ? options.outputFile || 'index.js' : '*', silent: options.updateIndex || options.ignoreUnsafe }); });