Skip to content
Browse files

Use commonjs style naming conventions.

  • Loading branch information...
1 parent 57136db commit e790c85a06172b968865328720713efcb140a931 @isaacs isaacs committed Jan 12, 2010
Showing with 21 additions and 12 deletions.
  1. +6 −4 README.md
  2. +7 −7 lib/install.js
  3. +0 −1 npm-package.json
  4. +8 −0 package.json
View
10 README.md
@@ -4,19 +4,23 @@ npm is a little package manager for the Node javascript library.
For now, this README is more of a task list/roadmap than a proper "how to use this" type doc.
+## Contributing
+
+If you're interested in helping, that's awesome! Please fork this project, implement some of the things on the list, and then let me know. You can usually find me in #node.js on freenode.net, or you can reach me via <i@izs.me>.
+
## What works now:
`require("./npm").install(tarball, name)`
-Given a name, and a url or filename of a tarball containing a `npm-package.json`, install it.
+Given a name, and a url or filename of a tarball containing a `package.json`, install it.
where "install it" means:
1. fetch the tarball
2. unpack
3. copy it to `ROOT/<name>/npm/`.
If it already exists, then insist that it be uninstalled first.
-4. read and parse the npm-package.json
+4. read and parse the package.json
5. link `ROOT/<name>/index.js` to `ROOT/<name>/package/<lib>`, if there is one.
6. Run the `make` command in the package dir (sh)
@@ -37,5 +41,3 @@ where "install it" means:
* Interpret tusk-style package.json files.
* Make a pizza and serve it up.
* The kitchen sink.
-
-
View
14 lib/install.js
@@ -48,9 +48,9 @@ function install (tarball, name) {
// unpack
unpackTar(targetTgz),
// read the json
- readJson(path.join(targetDir, "npm-package.json"), name),
- // link up the "lib", if there is one.
- linkLib(name, path.join(packageRoot, "index.js"), targetDir),
+ readJson(path.join(targetDir, "package.json"), name),
+ // link up the "main", if there is one.
+ linkMain(name, path.join(packageRoot, "index.js"), targetDir),
// run the "make", if there is one.
runMake(name)
// success!
@@ -132,16 +132,16 @@ function readJson (jsonFile, name) { return function () {
return p;
}};
-function linkLib (name, proxyFile, packageRoot) { return function () {
+function linkMain (name, proxyFile, packageRoot) { return function () {
var data = npm.get(name);
- if (!data.lib) return;
+ if (!data.main) return;
var p = new process.Promise;
// write out an index.js at ROOT/<name>/index.js
- // which proxies to ROOT/<name>/package/<lib>
+ // which proxies to ROOT/<name>/package/<main>
var code =
"// generated by npm, please don't touch!\n"+
"module.exports=require("+
- JSON.stringify(path.join(packageRoot, data.lib)) +
+ JSON.stringify(path.join(packageRoot, data.main)) +
");\n";
posix.open(proxyFile,
process.O_CREAT | process.O_EXCL | process.O_WRONLY, 0755)
View
1 npm-package.json
@@ -1 +0,0 @@
-{"lib":"./npm"}
View
8 package.json
@@ -0,0 +1,8 @@
+{
+ "name": "npm",
+ "description":"A package manager for node",
+ "version":"0.0.1",
+ "author":"Isaac Z. Schlueter <i@izs.me>",
+
+ "main":"./npm" // extension to commonjs standard
+}

0 comments on commit e790c85

Please sign in to comment.
Something went wrong with that request. Please try again.