diff options
author | isaacs <i@izs.me> | 2010-01-13 05:15:58 +0300 |
---|---|---|
committer | isaacs <i@izs.me> | 2010-01-13 05:22:37 +0300 |
commit | e790c85a06172b968865328720713efcb140a931 (patch) | |
tree | 079c8d0a28deb4f58a1b18ee677cbe38a2bd54f4 | |
parent | 57136db655ab0ddf31fea821d1e06ad9a87e8fc9 (diff) |
Use commonjs style naming conventions.v0.0.1
-rw-r--r-- | README.md | 10 | ||||
-rw-r--r-- | lib/install.js | 14 | ||||
-rw-r--r-- | npm-package.json | 1 | ||||
-rw-r--r-- | package.json | 8 |
4 files changed, 21 insertions, 12 deletions
@@ -4,11 +4,15 @@ 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: @@ -16,7 +20,7 @@ where "install it" means: 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. - - diff --git a/lib/install.js b/lib/install.js index 81e42ae80..aaf96395b 100644 --- a/lib/install.js +++ b/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) diff --git a/npm-package.json b/npm-package.json deleted file mode 100644 index 63c2d4d52..000000000 --- a/npm-package.json +++ /dev/null @@ -1 +0,0 @@ -{"lib":"./npm"}
\ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 000000000..7716c9446 --- /dev/null +++ b/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 +}
\ No newline at end of file |