diff options
author | isaacs <i@izs.me> | 2019-10-08 08:57:31 -0700 |
---|---|---|
committer | Myles Borins <mylesborins@google.com> | 2019-12-13 11:51:53 -0500 |
commit | f9b31edb25fcdf6602fbf8233affb791e2f849a5 (patch) | |
tree | 5e6c1818de1b32158c7f3c491bf2f87392e79ccb /deps/npm/scripts | |
parent | 0621e25f90c4b3bbea5b2e4f63b3ea919e47440c (diff) | |
download | node-new-f9b31edb25fcdf6602fbf8233affb791e2f849a5.tar.gz |
deps: update npm to 6.13.4
PR-URL: https://github.com/nodejs/node/pull/30904
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
Diffstat (limited to 'deps/npm/scripts')
-rwxr-xr-x | deps/npm/scripts/doc-build.sh | 67 | ||||
-rw-r--r-- | deps/npm/scripts/docs-build.js | 28 | ||||
-rwxr-xr-x | deps/npm/scripts/index-build.js | 58 | ||||
-rwxr-xr-x | deps/npm/scripts/install.sh | 2 |
4 files changed, 30 insertions, 125 deletions
diff --git a/deps/npm/scripts/doc-build.sh b/deps/npm/scripts/doc-build.sh deleted file mode 100755 index a37a5e2618..0000000000 --- a/deps/npm/scripts/doc-build.sh +++ /dev/null @@ -1,67 +0,0 @@ -#!/usr/bin/env bash - -if [[ $DEBUG != "" ]]; then - set -x -fi -set -o errexit -set -o pipefail - -src=$1 -dest=$2 -name=$(basename ${src%.*}) -date=$(date -u +'%Y-%m-%d %H:%M:%S') -version=$(node bin/npm-cli.js -v) - -mkdir -p $(dirname $dest) - -html_replace_tokens () { - local url=$1 - sed "s|@NAME@|$name|g" \ - | sed "s|@DATE@|$date|g" \ - | sed "s|@URL@|$url|g" \ - | sed "s|@VERSION@|$version|g" \ - | perl -p -e 's/<h1([^>]*)>([^\(]*\([0-9]\)) -- (.*?)<\/h1>/<h1>\2<\/h1> <p>\3<\/p>/g' \ - | perl -p -e 's/npm-npm/npm/g' \ - | perl -p -e 's/([^"-])(npm-)?README(?!\.html)(\(1\))?/\1<a href="..\/..\/doc\/README.html">README<\/a>/g' \ - | perl -p -e 's/<title><a href="[^"]+README.html">README<\/a><\/title>/<title>README<\/title>/g' \ - | perl -p -e 's/([^"-])([^\(> ]+)(\(1\))/\1<a href="..\/cli\/\2.html">\2\3<\/a>/g' \ - | perl -p -e 's/([^"-])([^\(> ]+)(\(3\))/\1<a href="..\/api\/\2.html">\2\3<\/a>/g' \ - | perl -p -e 's/([^"-])([^\(> ]+)(\(5\))/\1<a href="..\/files\/\2.html">\2\3<\/a>/g' \ - | perl -p -e 's/([^"-])([^\(> ]+)(\(7\))/\1<a href="..\/misc\/\2.html">\2\3<\/a>/g' \ - | perl -p -e 's/\([1357]\)<\/a><\/h1>/<\/a><\/h1>/g' \ - | (if [ $(basename $(dirname $dest)) == "doc" ]; then - perl -p -e 's/ href="\.\.\// href="/g' - else - cat - fi) -} - -man_replace_tokens () { - sed "s|@VERSION@|$version|g" \ - | perl -p -e 's/(npm\\-)?([a-zA-Z\\\.\-]*)\(1\)/npm help \2/g' \ - | perl -p -e 's/(npm\\-)?([a-zA-Z\\\.\-]*)\(([57])\)/npm help \3 \2/g' \ - | perl -p -e 's/(npm\\-)?([a-zA-Z\\\.\-]*)\(3\)/npm apihelp \2/g' \ - | perl -p -e 's/npm\(1\)/npm help npm/g' \ - | perl -p -e 's/npm\(3\)/npm apihelp npm/g' -} - -case $dest in - *.[1357]) - ./node_modules/.bin/marked-man --roff $src \ - | man_replace_tokens > $dest - exit $? - ;; - *.html) - url=${dest/html\//} - (cat html/dochead.html && \ - cat $src | ./node_modules/.bin/marked && - cat html/docfoot.html)\ - | html_replace_tokens $url \ - > $dest - exit $? - ;; - *) - echo "Invalid destination type: $dest" >&2 - exit 1 - ;; -esac diff --git a/deps/npm/scripts/docs-build.js b/deps/npm/scripts/docs-build.js new file mode 100644 index 0000000000..e3cd2e9826 --- /dev/null +++ b/deps/npm/scripts/docs-build.js @@ -0,0 +1,28 @@ +#!/usr/bin/env node + +var fs = require('fs') +var marked = require('marked-man') +var npm = require('../lib/npm.js') +var args = process.argv.slice(2) +var src = args[0] +var dest = args[1] || src + +fs.readFile(src, 'utf8', function (err, data) { + if (err) return console.log(err) + + function replacer (match, p1) { + return 'npm help ' + p1.replace(/npm /, '') + } + + var result = data.replace(/@VERSION@/g, npm.version) + .replace(/---([\s\S]+)---/g, '') + .replace(/\[([^\]]+)\]\(\/cli-commands\/([^)]+)\)/g, replacer) + .replace(/\[([^\]]+)\]\(\/configuring-npm\/([^)]+)\)/g, replacer) + .replace(/\[([^\]]+)\]\(\/using-npm\/([^)]+)\)/g, replacer) + .replace(/(# .*)\s+(## (.*))/g, '$1 - $3') + .trim() + + fs.writeFile(dest, marked(result), 'utf8', function (err) { + if (err) return console.log(err) + }) +}) diff --git a/deps/npm/scripts/index-build.js b/deps/npm/scripts/index-build.js deleted file mode 100755 index e782716d77..0000000000 --- a/deps/npm/scripts/index-build.js +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/env node -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 - 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] - })) -}) - -function output (files) { - console.log( - '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') -} - -function writeLines (files, sxn, heading, desc) { - if (heading) { - 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 - var doc = sd[1] - var d = path.basename(doc, '.md') - - var content = fs.readFileSync(doc, 'utf8').split('\n')[0].split('-- ')[1] - - console.log('### %s(%d)\n', d, sxn) - console.log(content + '\n') -} diff --git a/deps/npm/scripts/install.sh b/deps/npm/scripts/install.sh index 4ed1062aa1..7f66151dae 100755 --- a/deps/npm/scripts/install.sh +++ b/deps/npm/scripts/install.sh @@ -23,12 +23,14 @@ if [ "x$0" = "xsh" ]; then if [ $ret -eq 0 ]; then (exit 0) else + echo "Uninstalling npm-install-$$.sh" >&2 rm npm-install-$$.sh echo "Failed to download script" >&2 exit $ret fi sh npm-install-$$.sh ret=$? + echo "Uninstalling npm-install-$$.sh" >&2 rm npm-install-$$.sh exit $ret fi |