Skip to content

Commit

Permalink
Add license and readme.
Browse files Browse the repository at this point in the history
  • Loading branch information
tfe committed Apr 7, 2011
1 parent 460523f commit fb2fd48
Show file tree
Hide file tree
Showing 2 changed files with 87 additions and 0 deletions.
20 changes: 20 additions & 0 deletions MIT-LICENSE
@@ -0,0 +1,20 @@
Copyright (c) 2011 Todd Eichel (http://toddeichel.com/)

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.
67 changes: 67 additions & 0 deletions README.md
@@ -0,0 +1,67 @@
[npm-detect](http://github.com/tfe/npm-detect/)
============

An npm package for walking a project directory (tree of files) and determining which npm packages are depended on by the project files. It will also generate a sample `dependencies` section suited for inclusion in the project's `package.json` file (see `npm help json` for details).

The implementation is very naive, but should work for most cases:

1. Walk the directory tree, looking for *.js files.
2. Look for `require()` statements that match the pattern for npm package names.
3. Query the npm registry for matching package names.


Installation and Usage
----------------------

Install via npm:

sudo npm install detect

Run it (example is npm-detect being run on itself):

$ cd /your/project/dir
$ npm-detect
Scanning directory /your/project/dir...
./bin/detect.js
./lib/tree-walk.js
Finished scanning, checking 6 packages against npm registry (be patient)...
path...
fs...
child_process...
util...
npm... ✓
step... ✓
Finished, 2 npm packages found:
npm
step
Sample package.json dependencies section:
{
"other package.json sections": "go here",
"dependencies": {
"npm": "*",
"step": "*"
}
}


To-Do
-----

- allow passing a path to search (defaults to '.'), probably as first argument
- make sure all legal npm package names are covered by the regexes (currently
letters, numbers, hyphen, underscore, dot)
- add package version numbers to sample package.json output; use tilde version
specifier with latest version from npm search output
- help output and man page


Contact
-------

Problems, comments, and pull requests all welcome. [Find me on GitHub.](http://github.com/tfe/)


Copyright & License
-------------------

Copyright © 2011 [Todd Eichel](http://toddeichel.com/). Released under the MIT License.

0 comments on commit fb2fd48

Please sign in to comment.