Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/brettlangdon/automodule
Node.JS module to auto include your sub-modules or to generate static include scripts.
https://github.com/brettlangdon/automodule
Last synced: about 1 month ago
JSON representation
Node.JS module to auto include your sub-modules or to generate static include scripts.
- Host: GitHub
- URL: https://github.com/brettlangdon/automodule
- Owner: brettlangdon
- Created: 2012-11-09T01:37:38.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2012-11-28T04:03:18.000Z (about 12 years ago)
- Last Synced: 2024-11-12T18:20:47.532Z (about 1 month ago)
- Language: JavaScript
- Size: 121 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Automodule
==========Node.JS module to auto include your sub-modules or to generate static include scripts.
Automodule will automatically determine if you are within your projects top level directory
by search for `lib` or `src` directories, if so, the `lib` directory is all that is required.
Otherwise each directory and file (other than `index.js`) will be required and exposed.## Installation
```bash
[sudo] npm install [-g] automodule
```## Usage
See `examples` directory.### Generate Static File
To generate the static text for the module simple run `automodule` from the project directory.
```bash
$ cd ./project/directory
$ ls
one three two
$ automodule
return module.exports = {one:require("./one"),three:require("./three"),two:require("./two"),};
```Or you can specify an output file.
```bash
$ cd ./project/directory
$ ls
one three two
$ automodule index.js
$ cat index.js
return module.exports = {one:require("./one"),three:require("./three"),two:require("./two"),};
```### Use programmatically
You can also use `automodule` as a function within your scripts to include all submodules.
```javascript
var automodule = require('automodule');
var options = {search:__dirname};return module.exports = automodule(options);
```### Options
* `search` - directory to look in for modules (String|default: `process.cwd()`)
* `print` - whether or not to include the modules or generate static string (Boolean|default: `false`)
* `recursive` - how far deep to search for files, default is search directory only (Number|default: `1`)## Bugs/Issues/Features
Please report any problems here on Github in the issues section and I will make sure to try and solve them.
## MIT License
The MIT License (MIT)
Copyright (c) 2012 Brett LangdonPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.