{"id":15659254,"url":"https://github.com/jonschlinkert/export-files","last_synced_at":"2025-04-19T12:02:22.690Z","repository":{"id":23314908,"uuid":"26674717","full_name":"jonschlinkert/export-files","owner":"jonschlinkert","description":"node.js utility for exporting a directory of files as modules.","archived":false,"fork":false,"pushed_at":"2021-07-20T12:02:22.000Z","size":55,"stargazers_count":21,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-10-30T02:18:51.134Z","etag":null,"topics":["directory","export","files","javascript","node","nodejs","require"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jonschlinkert.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-11-15T09:00:27.000Z","updated_at":"2022-09-14T03:29:09.000Z","dependencies_parsed_at":"2022-08-21T23:30:43.202Z","dependency_job_id":null,"html_url":"https://github.com/jonschlinkert/export-files","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonschlinkert%2Fexport-files","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonschlinkert%2Fexport-files/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonschlinkert%2Fexport-files/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonschlinkert%2Fexport-files/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jonschlinkert","download_url":"https://codeload.github.com/jonschlinkert/export-files/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249149093,"owners_count":21220651,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["directory","export","files","javascript","node","nodejs","require"],"created_at":"2024-10-03T13:15:54.706Z","updated_at":"2025-04-19T12:02:22.651Z","avatar_url":"https://github.com/jonschlinkert.png","language":"JavaScript","readme":"# export-files [![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://paypal.me/jonathanschlinkert?locale.x=en_US) [![NPM version](https://img.shields.io/npm/v/export-files.svg?style=flat)](https://www.npmjs.com/package/export-files) [![NPM monthly downloads](https://img.shields.io/npm/dm/export-files.svg?style=flat)](https://npmjs.org/package/export-files) [![NPM total downloads](https://img.shields.io/npm/dt/export-files.svg?style=flat)](https://npmjs.org/package/export-files) [![Tests](https://github.com/jonschlinkert/export-files/actions/workflows/test.yml/badge.svg)](https://github.com/jonschlinkert/export-files/actions/workflows/test.yml)\n\n\u003e node.js utility for exporting a directory of files as modules.\n\nPlease consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support.\n\n## Install\n\nInstall with [npm](https://www.npmjs.com/) (requires [Node.js](https://nodejs.org/en/) \u003e=10):\n\n```sh\n$ npm install --save export-files\n```\n\n## Heads up!\n\nCurrently this library only works with `require`.\n\n## Usage\n\nSpecify the directory with files to export:\n\n**Example**\n\nGiven that `__dirname` has three files, `a.js`, `b.js`, and `c.js`:\n\n```js\nmodule.exports = require('export-files')(__dirname);\n//=\u003e { a: [getter], b: [getter], c: [getter] }\n```\n\nThe second argment may be an object to intialize with. This is useful when you want to use export-files to extend an existing object.\n\n```js\nconst utils = {};\nutils.doSomething = () =\u003e {};\nmodule.exports = require('export-files')(__dirname, utils);\n//=\u003e { doSomething: [function], a: [getter], b: [getter], c: [getter] }\n```\n\n## Options\n\n### .ignoreDirs\n\nDirectories to ignore.\n\n**Type:** `string|array`\n\n**Default:** `['.git', 'node_modules', 'test', 'tmp', 'temp', 'vendor']`\n\n**Example**\n\nThe following examples shows how to override the default values and, in this case, not ignore any directories.\n\n```js\nconst requires = require('export-files');\nmodule.exports = requires(__dirname, undefined, { ignoreDirs: [] });\n```\n\n### .recursive\n\nRecurse into child directories.\n\n**Type:** `boolean`\n\n**Default:** `false`\n\n**Example**\n\n```js\nconst requires = require('export-files');\nmodule.exports = requires(__dirname, undefined, { recursive: true });\n```\n\n### .filter\n\nFunction to exclude files from the result.\n\n**Type:** `function`\n\n**Default:** Excludes files named `index.js`\n\n**Example**\n\n```js\nconst requires = require('export-files');\nmodule.exports = requires(__dirname, undefined, file =\u003e file.name !== 'a.js');\n```\n\n### .case\n\nModify the casing of keys for exported files.\n\n**Type:** `string`, `array\u003cstring\u003e`, or `function`\n\n`.case` may be defined as a function to use custom casing on exported names.\n\nIf defined as an array or string, valid values are any of the following:\n\n* `stem` - the file name without modification, excluding file extension\n* `name` - alias for `stem`\n* `basename` - the full file name, including file extension\n* `pascal` - pasacal case `stem`, useful for class names\n* `camel` - camel case `stem`\n* `lower` - lower case `stem`\n* `snake` - snake case `stem`\n* `auto` - (default) attempts to automatically determine casing when exports might be a mixture of casings, like class names and camel case method names.\n\nYou may define multiple cases.\n\n**Default:** `auto`\n\n**Example**\n\n```js\nconst requires = require('export-files');\nmodule.exports = requires(__dirname, undefined, { case: ['camel', 'pascal'] });\n```\n\n## Changes\n\n**v3.0.0 - breaking changes**\n\n* Improvements were made to support recursion and renaming keys. See readme for more details and available options.\n\n**v0.2.0 - breaking changes**\n\n* Non-javascript files are no longer handled. That functionality was moved to [to-exports](https://github.com/jonschlinkert/to-exports). This decision was made to keep this lib as fast as possible.\n* This library no longer takes any arguments besides the directory to read.\n\n## About\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eContributing\u003c/strong\u003e\u003c/summary\u003e\n\nPull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eRunning Tests\u003c/strong\u003e\u003c/summary\u003e\n\nRunning and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:\n\n```sh\n$ npm install \u0026\u0026 npm test\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eBuilding docs\u003c/strong\u003e\u003c/summary\u003e\n\n_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_\n\nTo generate the readme, run the following command:\n\n```sh\n$ npm install -g verbose/verb#dev verb-generate-readme \u0026\u0026 verb\n```\n\n\u003c/details\u003e\n\n### Related projects\n\nYou might also be interested in these projects:\n\n* [export-dirs](https://www.npmjs.com/package/export-dirs): Export directories and their files as node.js modules. | [homepage](https://github.com/jonschlinkert/export-dirs \"Export directories and their files as node.js modules.\")\n* [file-reader](https://www.npmjs.com/package/file-reader): Read a glob of files, dynamically choosing the reader or requiring the files based on… [more](https://github.com/jonschlinkert/file-reader) | [homepage](https://github.com/jonschlinkert/file-reader \"Read a glob of files, dynamically choosing the reader or requiring the files based on the file extension.\")\n* [map-files](https://www.npmjs.com/package/map-files): Return an object for a glob of files. Pass a `rename` function for the keys… [more](https://github.com/jonschlinkert/map-files) | [homepage](https://github.com/jonschlinkert/map-files \"Return an object for a glob of files. Pass a `rename` function for the keys, or a `parse` function for the content, allowing it to be used for readable or require-able files.\")\n* [to-exports](https://www.npmjs.com/package/to-exports): Create exports from a directory of non-javascript or javascript files. | [homepage](https://github.com/jonschlinkert/to-exports \"Create exports from a directory of non-javascript or javascript files.\")\n\n### Contributors\n\n| **Commits** | **Contributor** |\n| --- | --- |\n| 43 | [jonschlinkert](https://github.com/jonschlinkert) |\n| 4  | [doowb](https://github.com/doowb) |\n\n### Author\n\n**Jon Schlinkert**\n\n* [GitHub Profile](https://github.com/jonschlinkert)\n* [Twitter Profile](https://twitter.com/jonschlinkert)\n* [LinkedIn Profile](https://linkedin.com/in/jonschlinkert)\n\n### License\n\nCopyright © 2021, [Jon Schlinkert](https://github.com/jonschlinkert).\nReleased under the [MIT License](LICENSE).\n\n***\n\n_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.8.0, on April 27, 2021._\n","funding_links":["https://paypal.me/jonathanschlinkert?locale.x=en_US"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonschlinkert%2Fexport-files","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjonschlinkert%2Fexport-files","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonschlinkert%2Fexport-files/lists"}