-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 65f8fb6
Showing
6 changed files
with
127 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/node_modules/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2015 Eugene Sharygin | ||
|
||
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: | ||
|
||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
[](https://nodei.co/npm/repl-here/) | ||
|
||
# repl-here | ||
|
||
[![Dependency Status][david-badge]][david] | ||
|
||
Node REPL that autoloads all modules in `node_modules/` at startup, just like core libs. | ||
|
||
Inspired by [repl-it](http://npm.im/repl-it). | ||
|
||
[david]: https://david-dm.org/eush77/repl-here | ||
[david-badge]: https://david-dm.org/eush77/repl-here.png | ||
|
||
## CLI | ||
|
||
``` | ||
Usage: repl-here | ||
``` | ||
|
||
## API | ||
|
||
### `replHere(repl, basedir)` | ||
|
||
Require all modules from `$basedir/node_modules` into the repl (first argument). | ||
|
||
## Install | ||
|
||
``` | ||
npm install -g repl-here | ||
``` | ||
|
||
## License | ||
|
||
MIT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/usr/bin/env node | ||
'use strict'; | ||
|
||
var replHere = require('./'); | ||
|
||
var Repl = require('repl'); | ||
|
||
|
||
var usage = function (code) { | ||
console.log('Usage: repl-here'); | ||
process.exit(code || 0); | ||
}; | ||
|
||
|
||
var main = function () { | ||
var repl = Repl.start('> '); | ||
replHere(repl, process.cwd()); | ||
}; | ||
|
||
|
||
(process.argv.slice(2) == '--help') ? usage() : main(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
'use strict'; | ||
|
||
var camelCase = require('camel-case'), | ||
resolveFrom = require('resolve-from'); | ||
|
||
var fs = require('fs'), | ||
path = require('path'); | ||
|
||
|
||
module.exports = function (repl, dir) { | ||
fs.readdir(path.join(dir, 'node_modules'), function (err, modules) { | ||
modules.forEach(function (module) { | ||
repl.context[camelCase(module)] = require(resolveFrom(dir, module)); | ||
}); | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
{ | ||
"name": "repl-here", | ||
"version": "0.0.0", | ||
"description": "Start the REPL and load the entire node_modules/ into it", | ||
"author": "Eugene Sharygin <[email protected]>", | ||
"license": "MIT", | ||
"preferGlobal": true, | ||
"bin": { | ||
"repl-here": "cli.js" | ||
}, | ||
"homepage": "https://github.com/eush77/repl-here", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/eush77/repl-here" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/eush77/repl-here/issues" | ||
}, | ||
"keywords": [ | ||
"repl", | ||
"require", | ||
"node_modules", | ||
"load", | ||
"module", | ||
"package", | ||
"autoload", | ||
"quick" | ||
], | ||
"dependencies": { | ||
"camel-case": "^1.1.1", | ||
"resolve-from": "^1.0.0" | ||
}, | ||
"devDependencies": {} | ||
} |