From 41923c0c0795cfa6c465821387fca88fe8811367 Mon Sep 17 00:00:00 2001 From: Rebecca Turner Date: Fri, 9 Oct 2015 23:13:57 -0700 Subject: deps: upgrade npm to 3.3.6 PR-URL: https://github.com/nodejs/node/pull/3310 Reviewed-By: Jeremiah Senkpiel --- deps/npm/scripts/index-build.js | 61 +++++++++++++++++++---------------------- deps/npm/scripts/installable.sh | 13 +++++++++ deps/npm/scripts/publish-tag.js | 4 +-- 3 files changed, 43 insertions(+), 35 deletions(-) create mode 100644 deps/npm/scripts/installable.sh (limited to 'deps/npm/scripts') diff --git a/deps/npm/scripts/index-build.js b/deps/npm/scripts/index-build.js index 21297cc93e..8fbbf8595d 100755 --- a/deps/npm/scripts/index-build.js +++ b/deps/npm/scripts/index-build.js @@ -1,63 +1,58 @@ #!/usr/bin/env node -var fs = require("fs") - , path = require("path") - , root = path.resolve(__dirname, "..") - , glob = require("glob") - , conversion = { "cli": 1, "api": 3, "files": 5, "misc": 7 } - -glob(root + "/{README.md,doc/*/*.md}", function (er, files) { - if (er) - throw er +var fs = require('fs') +var path = require('path') +var root = path.resolve(__dirname, '..') +var glob = require('glob') +var conversion = { 'cli': 1, 'api': 3, 'files': 5, 'misc': 7 } + +glob(root + '/{README.md,doc/*/*.md}', function (er, files) { + if (er) throw er + output(files.map(function (f) { var b = path.basename(f) - if (b === "README.md") - return [0, b] - if (b === "index.md") - return null + if (b === 'README.md') return [0, b] + if (b === 'index.md') return null var s = conversion[path.basename(path.dirname(f))] return [s, f] }).filter(function (f) { return f }).sort(function (a, b) { - return (a[0] === b[0]) - ? ( path.basename(a[1]) === "npm.md" ? -1 - : path.basename(b[1]) === "npm.md" ? 1 - : a[1] > b[1] ? 1 : -1 ) - : a[0] - b[0] + return (a[0] === b[0]) ? + (path.basename(a[1]) === 'npm.md' ? -1 : + path.basename(b[1]) === 'npm.md' ? 1 : + a[1] > b[1] ? 1 : -1) : + a[0] - b[0] })) }) -return - function output (files) { console.log( - "npm-index(7) -- Index of all npm documentation\n" + - "==============================================\n") + 'npm-index(7) -- Index of all npm documentation\n' + + '==============================================\n') writeLines(files, 0) - writeLines(files, 1, "Command Line Documentation", "Using npm on the command line") - writeLines(files, 3, "API Documentation", "Using npm in your Node programs") - writeLines(files, 5, "Files", "File system structures npm uses") - writeLines(files, 7, "Misc", "Various other bits and bobs") + writeLines(files, 1, 'Command Line Documentation', 'Using npm on the command line') + writeLines(files, 3, 'API Documentation', 'Using npm in your Node programs') + writeLines(files, 5, 'Files', 'File system structures npm uses') + writeLines(files, 7, 'Misc', 'Various other bits and bobs') } function writeLines (files, sxn, heading, desc) { if (heading) { - console.log("## %s\n\n%s\n", heading, desc) + console.log('## %s\n\n%s\n', heading, desc) } files.filter(function (f) { return f[0] === sxn }).forEach(writeLine) } - function writeLine (sd) { var sxn = sd[0] || 1 - , doc = sd[1] - , d = path.basename(doc, ".md") + var doc = sd[1] + var d = path.basename(doc, '.md') - var content = fs.readFileSync(doc, "utf8").split("\n")[0].split("-- ")[1] + var content = fs.readFileSync(doc, 'utf8').split('\n')[0].split('-- ')[1] - console.log("### %s(%d)\n", d, sxn) - console.log(content + "\n") + console.log('### %s(%d)\n', d, sxn) + console.log(content + '\n') } diff --git a/deps/npm/scripts/installable.sh b/deps/npm/scripts/installable.sh new file mode 100644 index 0000000000..1d5a90c290 --- /dev/null +++ b/deps/npm/scripts/installable.sh @@ -0,0 +1,13 @@ +#!/bin/bash +npmver=$(perl -E "say q{$npm_config_user_agent} =~ m{/(\S+)}") + +if semver -r ^3.0.0-0 $npmver > /dev/null; then + echo "Packaging with $npmver" +else + echo "Packaging or installing npm@$npm_package_version with npm@$npmver is impossible." 1>&2 + echo "Please install npm@^3.0.0-0 from the registry and use that or run your command with" 1>&2 + echo "this version of npm with:" 1>&2 + npmargs=$(node -e "a=$npm_config_argv; console.log(a.original.join(' '))") + echo " $npm_node_execpath $PWD $npmargs" 1>&2 + exit 1 +fi diff --git a/deps/npm/scripts/publish-tag.js b/deps/npm/scripts/publish-tag.js index 046ec98881..d0c04556e1 100644 --- a/deps/npm/scripts/publish-tag.js +++ b/deps/npm/scripts/publish-tag.js @@ -1,3 +1,3 @@ -var semver = require("semver") -var version = semver.parse(require("../package.json").version) +var semver = require('semver') +var version = semver.parse(require('../package.json').version) console.log('v%s.%s-next', version.major, version.minor) -- cgit v1.2.3