From 7f39305382511c3a23de48ffefe5b5485aafb417 Mon Sep 17 00:00:00 2001 From: isaacs Date: Tue, 19 Mar 2013 23:17:06 -0700 Subject: [PATCH] read-package-json@0.3.0 --- node_modules/read-package-json/package.json | 4 ++-- node_modules/read-package-json/read-json.js | 25 +++------------------ package.json | 2 +- 3 files changed, 6 insertions(+), 25 deletions(-) diff --git a/node_modules/read-package-json/package.json b/node_modules/read-package-json/package.json index 1a98e5bf35e..c6bbfd9cea2 100644 --- a/node_modules/read-package-json/package.json +++ b/node_modules/read-package-json/package.json @@ -1,6 +1,6 @@ { "name": "read-package-json", - "version": "0.2.2", + "version": "0.3.0", "author": { "name": "Isaac Z. Schlueter", "email": "i@izs.me", @@ -32,6 +32,6 @@ }, "readme": "# read-package-json\n\nThis is the thing that npm uses to read package.json files. It\nvalidates some stuff, and loads some default things.\n\nIt keeps a cache of the files you've read, so that you don't end\nup reading the same package.json file multiple times.\n\nNote that if you just want to see what's literally in the package.json\nfile, you can usually do `var data = require('some-module/package.json')`.\n\nThis module is basically only needed by npm, but it's handy to see what\nnpm will see when it looks at your package.\n\n## Usage\n\n```javascript\nvar readJson = require('read-package-json')\n\nreadJson('/path/to/package.json', function (er, data) {\n if (er) {\n console.error(\"There was an error reading the file\")\n return\n }\n\n console.error('the package data is', data)\n}\n```\n\n## readJson(file, cb)\n\n* `file` {String} The path to the package.json file\n* `cb` {Function}\n\nReads the JSON file and does the things.\n\n## `package.json` Fields\n\nSee `man 5 package.json` or `npm help json`.\n\n## readJson.log\n\nBy default this is a reference to the `npmlog` module. But if that\nmodule can't be found, then it'll be set to just a dummy thing that does\nnothing.\n\nReplace with your own `{log,warn,error}` object for fun loggy time.\n\n## readJson.extras(file, data, cb)\n\nRun all the extra stuff relative to the file, with the parsed data.\n\nModifies the data as it does stuff. Calls the cb when it's done.\n\n## readJson.extraSet = [fn, fn, ...]\n\nArray of functions that are called by `extras`. Each one receives the\narguments `fn(file, data, cb)` and is expected to call `cb(er, data)`\nwhen done or when an error occurs.\n\nOrder is indeterminate, so each function should be completely\nindependent.\n\nMix and match!\n\n## readJson.cache\n\nThe `lru-cache` object that readJson uses to not read the same file over\nand over again. See\n[lru-cache](https://github.com/isaacs/node-lru-cache) for details.\n\n## Other Relevant Files Besides `package.json`\n\nSome other files have an effect on the resulting data object, in the\nfollowing ways:\n\n### `README?(.*)`\n\nIf there is a `README` or `README.*` file present, then npm will attach\na `readme` field to the data with the contents of this file.\n\nOwing to the fact that roughly 100% of existing node modules have\nMarkdown README files, it will generally be assumed to be Markdown,\nregardless of the extension. Please plan accordingly.\n\n### `server.js`\n\nIf there is a `server.js` file, and there is not already a\n`scripts.start` field, then `scripts.start` will be set to `node\nserver.js`.\n\n### `AUTHORS`\n\nIf there is not already a `contributors` field, then the `contributors`\nfield will be set to the contents of the `AUTHORS` file, split by lines,\nand parsed.\n\n### `bindings.gyp`\n\nIf a bindings.gyp file exists, and there is not already a\n`scripts.install` field, then the `scripts.install` field will be set to\n`node-gyp rebuild`.\n\n### `wscript`\n\nIf a wscript file exists, and there is not already a `scripts.install`\nfield, then the `scripts.install` field will be set to `node-waf clean ;\nnode-waf configure build`.\n\nNote that the `bindings.gyp` file supercedes this, since node-waf has\nbeen deprecated in favor of node-gyp.\n\n### `index.js`\n\nIf the json file does not exist, but there is a `index.js` file\npresent instead, and that file has a package comment, then it will try\nto parse the package comment, and use that as the data instead.\n\nA package comment looks like this:\n\n```javascript\n/**package\n * { \"name\": \"my-bare-module\"\n * , \"version\": \"1.2.3\"\n * , \"description\": \"etc....\" }\n **/\n\n// or...\n\n/**package\n{ \"name\": \"my-bare-module\"\n, \"version\": \"1.2.3\"\n, \"description\": \"etc....\" }\n**/\n```\n\nThe important thing is that it starts with `/**package`, and ends with\n`**/`. If the package.json file exists, then the index.js is not\nparsed.\n\n### `{directories.man}/*.[0-9]`\n\nIf there is not already a `man` field defined as an array of files or a\nsingle file, and\nthere is a `directories.man` field defined, then that directory will\nbe searched for manpages.\n\nAny valid manpages found in that directory will be assigned to the `man`\narray, and installed in the appropriate man directory at package install\ntime, when installed globally on a Unix system.\n\n### `{directories.bin}/*`\n\nIf there is not already a `bin` field defined as a string filename or a\nhash of ` : ` pairs, then the `directories.bin`\ndirectory will be searched and all the files within it will be linked as\nexecutables at install time.\n\nWhen installing locally, npm links bins into `node_modules/.bin`, which\nis in the `PATH` environ when npm runs scripts. When\ninstalling globally, they are linked into `{prefix}/bin`, which is\npresumably in the `PATH` environment variable.\n", "readmeFilename": "README.md", - "_id": "read-package-json@0.2.2", + "_id": "read-package-json@0.3.0", "_from": "read-package-json@latest" } diff --git a/node_modules/read-package-json/read-json.js b/node_modules/read-package-json/read-json.js index d0b5ff0b964..9ca3e4e7e13 100644 --- a/node_modules/read-package-json/read-json.js +++ b/node_modules/read-package-json/read-json.js @@ -31,7 +31,6 @@ var semver = require("semver") // put more stuff on here to customize. readJson.extraSet = [ gypfile, - wscript, serverjs, authors, readme, @@ -144,9 +143,10 @@ function extras (file, data, cb) { function gypfile (file, data, cb) { var dir = path.dirname(file) var s = data.scripts || {} - if (s.install || s.preinstall) { + if (s.install === "node-gyp rebuild" && !s.preinstall) + data.gypfile = true + if (s.install || s.preinstall) return cb(null, data); - } glob("*.gyp", { cwd: dir }, function (er, files) { if (er) return cb(er); gypfile_(file, data, files, cb) @@ -162,25 +162,6 @@ function gypfile_ (file, data, files, cb) { return cb(null, data); } -function wscript (file, data, cb) { - var dir = path.dirname(file) - var s = data.scripts || {} - if (s.install || s.preinstall) { - return cb(null, data); - } - glob("wscript", { cwd: dir }, function (er, files) { - if (er) return cb(er); - wscript_(file, data, files, cb) - }) -} -function wscript_ (file, data, files, cb) { - if (!files.length || data.gypfile) return cb(null, data); - var s = data.scripts || {} - s.install = "node-waf clean ; node-waf configure build" - data.scripts = s - return cb(null, data); -} - function serverjs (file, data, cb) { var dir = path.dirname(file) var s = data.scripts || {} diff --git a/package.json b/package.json index 8bd830eab23..d19032aff77 100644 --- a/package.json +++ b/package.json @@ -59,7 +59,7 @@ "npmlog": "0", "ansi": "~0.1.2", "npm-registry-client": "~0.2.18", - "read-package-json": "~0.2.2", + "read-package-json": "~0.3.0", "read-installed": "0", "glob": "~3.1.21", "init-package-json": "0.0.6",