Created
May 4, 2018 18:54
-
-
Save rbalicki2/60dbecaddb14f7a3625c118f28158c86 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// this is the top-level rollup config | |
// | |
// each child rollup config *must* use full paths, e.g. | |
// const DESTINATION_FILE = path.join(__dirname, '..', 'lib/index.js'); | |
// const INPUT_FILE = path.join(__dirname, '..', 'src/index.js'); | |
const requireGlob = require('require-glob'); | |
const path = require('path'); | |
const _ = require('lodash'); | |
const allRollupConfigs = requireGlob.sync(['../packages/**/rollup.config.js'], { | |
reducer: (options, tree, fileObj) => { | |
const packageName = options.keygen(fileObj)[0]; | |
if (!packageName) { | |
console.log(fileObj); | |
throw new Error('error with rollup config'); | |
} | |
const { exports: config } = fileObj; | |
return Array.from(tree).concat(config); | |
}, | |
}); | |
module.exports = allRollupConfigs; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment