feat: ability to add banner (#20)
Lets you add a custom banner. ```sh create-index src -u --banner "/* eslint-disable */" ``` ```js /* eslint-disable */ // @create-index import xxx ... ```
This commit is contained in:
committed by
Gajus Kuizinas
parent
d7e2528999
commit
fdb17d0179
@@ -22,10 +22,22 @@ const buildExportBlock = (files) => {
|
||||
return importBlock;
|
||||
};
|
||||
|
||||
export default (filePaths) => {
|
||||
export default (filePaths, options = {}) => {
|
||||
let code;
|
||||
|
||||
code = '// @create-index\n\n';
|
||||
code = '';
|
||||
|
||||
if (options.banner) {
|
||||
const banners = _.isArray(options.banner) ? options.banner : [options.banner];
|
||||
|
||||
banners.forEach((banner) => {
|
||||
code += banner + '\n';
|
||||
});
|
||||
|
||||
code += '\n';
|
||||
}
|
||||
|
||||
code += '// @create-index\n\n';
|
||||
|
||||
if (filePaths.length) {
|
||||
const sortedFilePaths = filePaths.sort();
|
||||
|
||||
Reference in New Issue
Block a user