Skip to content

Instantly share code, notes, and snippets.

@rbalicki2
Created May 4, 2018 18:54
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rbalicki2/60dbecaddb14f7a3625c118f28158c86 to your computer and use it in GitHub Desktop.
Save rbalicki2/60dbecaddb14f7a3625c118f28158c86 to your computer and use it in GitHub Desktop.
// 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