Skip to content

Commit 0cee4a8

Browse files
committed
no message
0 parents commit 0cee4a8

File tree

5 files changed

+118
-0
lines changed

5 files changed

+118
-0
lines changed

.gitignore

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
6+
# Runtime data
7+
pids
8+
*.pid
9+
*.seed
10+
*.pid.lock
11+
12+
# Directory for instrumented libs generated by jscoverage/JSCover
13+
lib-cov
14+
15+
# Coverage directory used by tools like istanbul
16+
coverage
17+
18+
# nyc test coverage
19+
.nyc_output
20+
21+
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
22+
.grunt
23+
24+
# node-waf configuration
25+
.lock-wscript
26+
27+
# Compiled binary addons (http://nodejs.org/api/addons.html)
28+
build/Release
29+
30+
# Dependency directories
31+
node_modules
32+
jspm_packages
33+
34+
# Optional npm cache directory
35+
.npm
36+
37+
# Optional REPL history
38+
.node_repl_history

LICENSE

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2016 Fedor Korshunov
4+
5+
Permission 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:
6+
7+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8+
9+
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.

README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
## Usage
2+
3+
Instead of:
4+
5+
```js
6+
const lib = {
7+
foo: require('../../lib/foo'),
8+
bar: require('../../lib/bar'),
9+
...
10+
}
11+
```
12+
13+
use:
14+
15+
```js
16+
const reqall = require('require-all-root')
17+
const lib = reqall('/lib')
18+
```
19+
20+
## Usage from global scope
21+
22+
To avoid `require('require-all-root')` in multiple files, you can setup it ones in `global` object
23+
```js
24+
// start.js
25+
global.reqall = require('require-all-root')
26+
27+
// lib/foo/bar.js
28+
const lib = reqall('/lib')
29+
```
30+
31+
## Thanks
32+
- **Felix Geisendörfer** for [require-all](https://github.com/felixge/node-require-all)
33+
- **Chris Morrell** for [app-root-path](https://github.com/inxilpro/node-app-root-path)

index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
var requireAll = require('require-all')
2+
var rootPath = require('app-root-path')
3+
module.exports = function(path) {
4+
return requireAll(rootPath + path)
5+
}

package.json

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"name": "require-all-root",
3+
"version": "1.0.0",
4+
"description": "Require all files from app's root path (require-all + app-root-path)",
5+
"main": "index.js",
6+
"scripts": {
7+
"test": "echo \"Error: no test specified\" && exit 1"
8+
},
9+
"repository": {
10+
"type": "git",
11+
"url": "git+https://github.com/fedor/node-require-all-root.git"
12+
},
13+
"keywords": [
14+
"require",
15+
"all",
16+
"root",
17+
"path",
18+
"util",
19+
"utility",
20+
"module",
21+
"modules",
22+
"app-root-path",
23+
"root-path",
24+
"require-all",
25+
"import"
26+
],
27+
"author": "Fedor Korshunov <mail@fedor.cc>",
28+
"license": "MIT",
29+
"bugs": {
30+
"url": "https://github.com/fedor/node-require-all-root/issues"
31+
},
32+
"homepage": "https://github.com/fedor/node-require-all-root#readme"
33+
}

0 commit comments

Comments
 (0)