Skip to content

nlibjs/indexen

Repository files navigation

@nlib/indexen

Test codecov

A command line tool to generate index files.

Usage

Usage: npx @nlib/indexen [options] <patterns...>

Arguments:
  patterns                     Patterns of files to be included. It will be passed to fast-glob.

Options:
  -o, --output <path>          A path where the result is written to.
  -e, --exclude <patterns...>  Patterns of files to be excluded. It will be passed to fast-glob.
  --noext                      It true, the output will be [export * from "./a"] not [export * from
                               "./a.js"].
  -V, --version                output the version number
  -h, --help                   display help for command

Assume you have files below:

src/file1.ts
src/file1.test.ts
src/file2.ts
src/dir1/file3.ts
src/dir1/file4.ts
src/dir2/file5.ts
src/file6.private.ts

Then execute @nlib/indexen:

npx @nlib/indexen --output src/index.ts "src/**"

@nlib/indexen generates src/index.ts:

// Generated by @nlib/indexen
export * from 'src/file1.ts';
export * from 'src/file2.ts';
export * from 'src/dir1/file3.ts';
export * from 'src/dir1/file4.ts';
export * from 'src/dir2/file5.ts';