@vlr/ts-reexportsdeprecated

generates index.ts with reexports

Usage no npm install needed!

<script type="module">
  import vlrTsReexports from 'https://cdn.skypack.dev/@vlr/ts-reexports';
</script>

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 lines

export * from './file'

Mind the following

  1. 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.
  2. Inside string lines as well, so pay attention.
  3. 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-watch

const 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