README
ts-reexports
functionality
Searches recursively through folders in provided path, finds .ts and .tsx files with lines like "export interface" or "export const a = " etc. and produces index.ts in that folder containing following linesexport * from './file'
Mind the following
- Regex is very simple, so if these lines are found inside comments, files gets reexportes just the same. Do not comment out your code. Never. Regardless of.
- Inside string lines as well, so pay attention.
- If anything other than reexport is found in index.ts, including comments and empty semicolons, file is considered off-limits, i.e. user managed.
usage
create gulp task with code like this, and run it either manually or within gulp-watchconst gulp = require('gulp');
const generator = require('@vlr/ts-reexports')
const options = { lineFeed: '\r\n', quotes: '"', typesOnly: true };
gulp.task('generate-reexports', function (done) {
generator.generateReexports('./src', options)
.then(done);
});
lineFeed and quotes are symbols used in corresponding places of generated file, types only = false will work with all .ts and .tsx files in specified folder, recursively, types only = true will only work with .type.ts files This option is meant for the projects where all the interfaces, enums and types are created in files having that extra extension