Permalink
Browse files

Add license and readme.

  • Loading branch information...
1 parent 460523f commit fb2fd4819eae190c4ab13119902230e1d2680639 @tfe committed Apr 7, 2011
Showing with 87 additions and 0 deletions.
  1. +20 −0 MIT-LICENSE
  2. +67 −0 README.md
View
@@ -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.
View
@@ -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.