@mseeley/export-from
v0.1.1
Published
A convenience utility to roll-up a subsdirectory into named exports
Downloads
2
Readme
@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 an
index.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"]
});