@azimutlabs/rollup
v1.0.1
Published
Collect Rollup configurations into a singular array
Downloads
22
Readme
Installation
$ yarn add -D @azimutlabs/rollup
Usage
collect
Collect configurations by the given array of glob patterns.
/**
* @param packages - packages glob patterns.
* @param dirname - working directory root. defaults to the nearest package.json or process.cwd()
*/
function collect(packages: string[]): RollupConfigFinalize;
Given example:
// packages/ui/rollup.config.js
import compose from '@azimutlabs/rollup-config';
import babel from '@azimutlabs/rollup-config-babel';
export default babel();
// rollup.config.js
import { collect } from '@azimutlabs/rollup';
export default collect(['packages/*']);
...will result in:
// rollup.config.js
// packages/ui/lib/
// index.es.js - output from babel
export default [
{ /* packages/ui/rollup.config.js */ }
];
fromWorkspaces
Get packages glob patterns from the workspaces
field in the nearest package.json
function fromWorkspaces(): string[];
This is recommended usage when using yarn/npm workspaces feature.
// package.json
{
"workspaces": [
"packages/*"
]
}
// rollup.config.js
import { collect, fromWorkspaces } from '@azimutlabs/rollup';
export default collect(
// Final collect scope will be: ['packages/*']
fromWorkspaces()
);
Contributing
Any PR is welcomed by our @js-opensource team. Check out our contributing guidelines for more info.