@mseeley/export-from

0.1.1 • Public • Published

@mseeley/export-from

export-from is a convenience utility to roll-up a subdirectory into named exports.

Installation

npm install -D @mseeley/export-from

Usage

Require mseeley/export-from in anindex.js` file in the directory of files that you want to roll-up.

Example directory structure:

directory\
  index.js
  file-a.js
  file-b\
    index.js

Example index.js:

module.exports = require("@mseeley/export-from")(__dirname);

Later you can require the named exports.

Example usage

const { fileA, fileB } = require("./directory");

Files with hyphens in their name are automatically converted to camelCase. All other filenames are untouched.

These specific JavaScript files and directories are ignored by default:

  • *.spec.js
  • __tests__/*
  • __fixtures__/*
  • node_modules

Additional exclude patterns can be provided. The patterns are evaluated by minimatch.

module.exports = require("@mseeley/export-from")(__dirname, {
  excludes: ["foo/bar.js"]
});

/@mseeley/export-from/

    Package Sidebar

    Install

    npm i @mseeley/export-from

    Weekly Downloads

    1

    Version

    0.1.1

    License

    MIT

    Unpacked Size

    232 kB

    Total Files

    33

    Last publish

    Collaborators

    • mattseeley