feat: add outputFile for typescript etc
This commit is contained in:
committed by
Gajus Kuizinas
parent
1f87f9a8b3
commit
38c4094655
@@ -18,7 +18,7 @@ export default (directoryPaths, options = {}) => {
|
|||||||
const optionsWithConfig = Object.assign({}, options, {config});
|
const optionsWithConfig = Object.assign({}, options, {config});
|
||||||
const siblings = readDirectory(directoryPath, optionsWithConfig);
|
const siblings = readDirectory(directoryPath, optionsWithConfig);
|
||||||
const indexCode = createIndexCode(siblings, 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);
|
fs.writeFileSync(indexFilePath, indexCode);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ export default (directoryPaths, options = {}) => {
|
|||||||
if (options.updateIndex || options.recursive) {
|
if (options.updateIndex || options.recursive) {
|
||||||
sortedDirectoryPaths = _.map(sortedDirectoryPaths, (dir) => {
|
sortedDirectoryPaths = _.map(sortedDirectoryPaths, (dir) => {
|
||||||
return findIndexFiles(dir, {
|
return findIndexFiles(dir, {
|
||||||
fileName: options.updateIndex ? 'index.js' : '*',
|
fileName: options.updateIndex ? options.outputFile || 'index.js' : '*',
|
||||||
silent: options.updateIndex || options.ignoreUnsafe
|
silent: options.updateIndex || options.ignoreUnsafe
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user