swarm
This commit is contained in:
103
builder-docker/jenkins/node-v12.22.8-linux-x64/lib/node_modules/npm/scripts/changelog.js
generated
vendored
Normal file
103
builder-docker/jenkins/node-v12.22.8-linux-x64/lib/node_modules/npm/scripts/changelog.js
generated
vendored
Normal file
@ -0,0 +1,103 @@
|
||||
'use strict'
|
||||
/*
|
||||
Usage:
|
||||
|
||||
node scripts/changelog.js [comittish]
|
||||
|
||||
Generates changelog entries in our format as best as its able based on
|
||||
commits starting at comittish, or if that's not passed, latest.
|
||||
|
||||
Ordinarily this is run via the gen-changelog shell script, which appends
|
||||
the result to the changelog.
|
||||
|
||||
*/
|
||||
const execSync = require('child_process').execSync
|
||||
const branch = process.argv[2] || 'origin/latest'
|
||||
const log = execSync(`git log --reverse --pretty='format:%h %H%d %s (%aN)%n%b%n---%n' ${branch}...`).toString().split(/\n/)
|
||||
|
||||
main()
|
||||
|
||||
function shortname (url) {
|
||||
let matched = url.match(/https:\/\/github\.com\/([^/]+\/[^/]+)\/(?:pull|issues)\/(\d+)/) ||
|
||||
url.match(/https:\/\/(npm\.community)\/t\/(?:[^/]+\/)(\d+)/)
|
||||
if (!matched) return false
|
||||
let repo = matched[1]
|
||||
let id = matched[2]
|
||||
if (repo !== 'npm/cli') {
|
||||
return `${repo}#${id}`
|
||||
} else {
|
||||
return `#${id}`
|
||||
}
|
||||
}
|
||||
|
||||
function printCommit (c) {
|
||||
console.log(`* [\`${c.shortid}\`](https://github.com/npm/cli/commit/${c.fullid})`)
|
||||
if (c.fixes) {
|
||||
let label = shortname(c.fixes)
|
||||
if (label) {
|
||||
console.log(` [${label}](${c.fixes})`)
|
||||
} else {
|
||||
console.log(` [npm.community#${c.fixes}](https://npm.community/t/${c.fixes})`)
|
||||
}
|
||||
} else if (c.prurl) {
|
||||
let label = shortname(c.prurl)
|
||||
if (label) {
|
||||
console.log(` [${label}](${c.prurl})`)
|
||||
} else {
|
||||
console.log(` [#](${c.prurl})`)
|
||||
}
|
||||
}
|
||||
let msg = c.message
|
||||
.replace(/^\s+/mg, '')
|
||||
.replace(/^[-a-z]+: /, '')
|
||||
.replace(/^/mg, ' ')
|
||||
.replace(/\n$/, '')
|
||||
// backtickify package@version
|
||||
.replace(/^(\s*[^@\s]+@\d+[.]\d+[.]\d+)(\s*\S)/g, '$1:$2')
|
||||
.replace(/\b([^@\s]+@\d+[.]\d+[.]\d+)\b/g, '`$1`')
|
||||
// linkify commitids
|
||||
.replace(/\b([a-f0-9]{7,8})\b/g, '[`$1`](https://github.com/npm/cli/commit/$1)')
|
||||
.replace(/\b#(\d+)\b/g, '[#$1](https://npm.community/t/$1)')
|
||||
console.log(msg)
|
||||
if (c.credit) {
|
||||
c.credit.forEach(function (credit) {
|
||||
console.log(` ([@${credit}](https://github.com/${credit}))`)
|
||||
})
|
||||
} else {
|
||||
console.log(` ([@${c.author}](https://github.com/${c.author}))`)
|
||||
}
|
||||
}
|
||||
|
||||
function main () {
|
||||
let commit
|
||||
log.forEach(function (line) {
|
||||
line = line.replace(/\r/g, '')
|
||||
let m
|
||||
/* eslint no-cond-assign:0 */
|
||||
if (/^---$/.test(line)) {
|
||||
printCommit(commit)
|
||||
} else if (m = line.match(/^([a-f0-9]{7,10}) ([a-f0-9]+) (?:[(]([^)]+)[)] )?(.*?) [(](.*?)[)]/)) {
|
||||
commit = {
|
||||
shortid: m[1],
|
||||
fullid: m[2],
|
||||
branch: m[3],
|
||||
message: m[4],
|
||||
author: m[5],
|
||||
prurl: null,
|
||||
fixes: null,
|
||||
credit: null
|
||||
}
|
||||
} else if (m = line.match(/^PR-URL: (.*)/)) {
|
||||
commit.prurl = m[1]
|
||||
} else if (m = line.match(/^Credit: @(.*)/)) {
|
||||
if (!commit.credit) commit.credit = []
|
||||
commit.credit.push(m[1])
|
||||
} else if (m = line.match(/^Fixes: #?(.*)/)) {
|
||||
commit.fixes = m[1]
|
||||
} else if (m = line.match(/^Reviewed-By: @(.*)/)) {
|
||||
commit.reviewed = m[1]
|
||||
} else if (/\S/.test(line)) {
|
||||
commit.message += `\n${line}`
|
||||
}
|
||||
})
|
||||
}
|
165
builder-docker/jenkins/node-v12.22.8-linux-x64/lib/node_modules/npm/scripts/clean-old.sh
generated
vendored
Normal file
165
builder-docker/jenkins/node-v12.22.8-linux-x64/lib/node_modules/npm/scripts/clean-old.sh
generated
vendored
Normal file
@ -0,0 +1,165 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# look for old 0.x cruft, and get rid of it.
|
||||
# Should already be sitting in the npm folder.
|
||||
|
||||
# This doesn't have to be quite as cross-platform as install.sh.
|
||||
# There are some bash-isms, because maintaining *two*
|
||||
# fully-portable posix/bourne sh scripts is too much for
|
||||
# one project with a sane maintainer.
|
||||
|
||||
# If readlink isn't available, then this is just too tricky.
|
||||
# However, greadlink is fine, so Solaris can join the party, too.
|
||||
readlink="readlink"
|
||||
which $readlink >/dev/null 2>/dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
readlink="greadlink"
|
||||
which $readlink >/dev/null 2>/dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Can't find the readlink or greadlink command. Aborting."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "x$npm_config_prefix" != "x" ]; then
|
||||
PREFIXES=$npm_config_prefix
|
||||
else
|
||||
node="$NODE"
|
||||
if [ "x$node" = "x" ]; then
|
||||
node=`which node`
|
||||
fi
|
||||
if [ "x$node" = "x" ]; then
|
||||
echo "Can't find node to determine prefix. Aborting."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
PREFIX=`dirname $node`
|
||||
PREFIX=`dirname $PREFIX`
|
||||
echo "cleanup prefix=$PREFIX"
|
||||
PREFIXES=$PREFIX
|
||||
|
||||
altprefix=`"$node" -e process.installPrefix`
|
||||
if [ "x$altprefix" != "x" ] && [ "x$altprefix" != "x$PREFIX" ]; then
|
||||
echo "altprefix=$altprefix"
|
||||
PREFIXES="$PREFIX $altprefix"
|
||||
fi
|
||||
fi
|
||||
|
||||
# now prefix is where npm would be rooted by default
|
||||
# go hunting.
|
||||
|
||||
packages=
|
||||
for prefix in $PREFIXES; do
|
||||
packages="$packages
|
||||
"`ls "$prefix"/lib/node/.npm 2>/dev/null | grep -v .cache`
|
||||
done
|
||||
|
||||
packages=`echo $packages`
|
||||
|
||||
filelist=()
|
||||
fid=0
|
||||
|
||||
for prefix in $PREFIXES; do
|
||||
# remove any links into the .npm dir, or links to
|
||||
# version-named shims/symlinks.
|
||||
for folder in share/man bin lib/node; do
|
||||
find $prefix/$folder -type l | while read file; do
|
||||
target=`$readlink $file | grep '/\.npm/'`
|
||||
if [ "x$target" != "x" ]; then
|
||||
# found one!
|
||||
filelist[$fid]="$file"
|
||||
let 'fid++'
|
||||
# also remove any symlinks to this file.
|
||||
base=`basename "$file"`
|
||||
base=`echo "$base" | awk -F@ '{print $1}'`
|
||||
if [ "x$base" != "x" ]; then
|
||||
find "`dirname $file`" -type l -name "$base"'*' \
|
||||
| while read l; do
|
||||
target=`$readlink "$l" | grep "$base"`
|
||||
if [ "x$target" != "x" ]; then
|
||||
filelist[$fid]="$1"
|
||||
let 'fid++'
|
||||
fi
|
||||
done
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
# Scour for shim files. These are relics of 0.2 npm installs.
|
||||
# note: grep -r is not portable.
|
||||
find $prefix/$folder -type f \
|
||||
| xargs grep -sl '// generated by npm' \
|
||||
| while read file; do
|
||||
filelist[$fid]="$file"
|
||||
let 'fid++'
|
||||
done
|
||||
done
|
||||
|
||||
# now remove the package modules, and the .npm folder itself.
|
||||
if [ "x$packages" != "x" ]; then
|
||||
for pkg in $packages; do
|
||||
filelist[$fid]="$prefix/lib/node/$pkg"
|
||||
let 'fid++'
|
||||
for i in $prefix/lib/node/$pkg\@*; do
|
||||
filelist[$fid]="$i"
|
||||
let 'fid++'
|
||||
done
|
||||
done
|
||||
fi
|
||||
|
||||
for folder in lib/node/.npm lib/npm share/npm; do
|
||||
if [ -d $prefix/$folder ]; then
|
||||
filelist[$fid]="$prefix/$folder"
|
||||
let 'fid++'
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
# now actually clean, but only if there's anything TO clean
|
||||
if [ "${#filelist[@]}" -gt 0 ]; then
|
||||
echo ""
|
||||
echo "This script will find and eliminate any shims, symbolic"
|
||||
echo "links, and other cruft that was installed by npm 0.x."
|
||||
echo ""
|
||||
|
||||
if [ "x$packages" != "x" ]; then
|
||||
echo "The following packages appear to have been installed with"
|
||||
echo "an old version of npm, and will be removed forcibly:"
|
||||
for pkg in $packages; do
|
||||
echo " $pkg"
|
||||
done
|
||||
echo "Make a note of these. You may want to install them"
|
||||
echo "with npm 1.0 when this process is completed."
|
||||
echo ""
|
||||
fi
|
||||
|
||||
OK=
|
||||
if [ "x$1" = "x-y" ]; then
|
||||
OK="yes"
|
||||
fi
|
||||
|
||||
while [ "$OK" != "y" ] && [ "$OK" != "yes" ] && [ "$OK" != "no" ]; do
|
||||
echo "Is this OK?"
|
||||
echo " enter 'yes' or 'no'"
|
||||
echo " or 'show' to see a list of files "
|
||||
read OK
|
||||
if [ "x$OK" = "xshow" ] || [ "x$OK" = "xs" ]; then
|
||||
for i in "${filelist[@]}"; do
|
||||
echo "$i"
|
||||
done
|
||||
fi
|
||||
done
|
||||
if [ "$OK" = "no" ]; then
|
||||
echo "Aborting"
|
||||
exit 1
|
||||
fi
|
||||
for i in "${filelist[@]}"; do
|
||||
rm -rf "$i"
|
||||
done
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo 'All clean!'
|
||||
|
||||
exit 0
|
8
builder-docker/jenkins/node-v12.22.8-linux-x64/lib/node_modules/npm/scripts/dep-update
generated
vendored
Normal file
8
builder-docker/jenkins/node-v12.22.8-linux-x64/lib/node_modules/npm/scripts/dep-update
generated
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
node . install --save $1@$2 &&\
|
||||
node scripts/gen-dev-ignores.js &&\
|
||||
rm -f node_modules/{*,*/*}/CODE_OF_CONDUCT.md node_modules/{*,*/*}/CONTRIBUTING.md &&\
|
||||
git add node_modules package.json package-lock.json &&\
|
||||
git commit -m"$1@$2" &&\
|
||||
node . repo $1 &&\
|
||||
git commit --amend
|
8
builder-docker/jenkins/node-v12.22.8-linux-x64/lib/node_modules/npm/scripts/dev-dep-update
generated
vendored
Normal file
8
builder-docker/jenkins/node-v12.22.8-linux-x64/lib/node_modules/npm/scripts/dev-dep-update
generated
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
node . install --save --save-dev $1@$2 &&\
|
||||
node scripts/gen-dev-ignores.js &&\
|
||||
rm -f node_modules/{*,*/*}/CODE_OF_CONDUCT.md node_modules/{*,*/*}/CONTRIBUTING.md &&\
|
||||
git add package.json package-lock.json &&\
|
||||
git commit -m"$1@$2" &&\
|
||||
node . repo $1 &&\
|
||||
git commit --amend
|
28
builder-docker/jenkins/node-v12.22.8-linux-x64/lib/node_modules/npm/scripts/docs-build.js
generated
vendored
Normal file
28
builder-docker/jenkins/node-v12.22.8-linux-x64/lib/node_modules/npm/scripts/docs-build.js
generated
vendored
Normal file
@ -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)
|
||||
})
|
||||
})
|
7
builder-docker/jenkins/node-v12.22.8-linux-x64/lib/node_modules/npm/scripts/gen-changelog
generated
vendored
Normal file
7
builder-docker/jenkins/node-v12.22.8-linux-x64/lib/node_modules/npm/scripts/gen-changelog
generated
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
# Usage: gen-changelog [comittish]
|
||||
# Reads all the commits since comittish and produces changelog entries in
|
||||
# our style as best as it can, appendning them to CHANGELOG.md. If it
|
||||
# encounters a git error it won't modify CHANGELOG.md
|
||||
# @iarna uses this as the first step in producing changelogs for a release.
|
||||
(node $(npm prefix)/scripts/changelog.js "$@"; cat CHANGELOG.md) > new.md && mv new.md CHANGELOG.md
|
7
builder-docker/jenkins/node-v12.22.8-linux-x64/lib/node_modules/npm/scripts/gen-dev-ignores.js
generated
vendored
Normal file
7
builder-docker/jenkins/node-v12.22.8-linux-x64/lib/node_modules/npm/scripts/gen-dev-ignores.js
generated
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
const fs = require('fs')
|
||||
const plock = require('../package-lock.json')
|
||||
fs.writeFileSync(`${__dirname}/../node_modules/.gitignore`,
|
||||
'## Automatically generated dev dependency ignores\n' +
|
||||
'CODE_OF_CONDUCT.md\n' +
|
||||
'CONTRIBUTING.md\n' +
|
||||
Object.keys(plock.dependencies).filter(_ => plock.dependencies[_].dev).map(_ => `/${_}`).join('\n') + '\n')
|
245
builder-docker/jenkins/node-v12.22.8-linux-x64/lib/node_modules/npm/scripts/install.sh
generated
vendored
Normal file
245
builder-docker/jenkins/node-v12.22.8-linux-x64/lib/node_modules/npm/scripts/install.sh
generated
vendored
Normal file
@ -0,0 +1,245 @@
|
||||
#!/bin/sh
|
||||
|
||||
# A word about this shell script:
|
||||
#
|
||||
# It must work everywhere, including on systems that lack
|
||||
# a /bin/bash, map 'sh' to ksh, ksh97, bash, ash, or zsh,
|
||||
# and potentially have either a posix shell or bourne
|
||||
# shell living at /bin/sh.
|
||||
#
|
||||
# See this helpful document on writing portable shell scripts:
|
||||
# https://www.gnu.org/s/hello/manual/autoconf/Portable-Shell.html
|
||||
#
|
||||
# The only shell it won't ever work on is cmd.exe.
|
||||
|
||||
if [ "x$0" = "xsh" ]; then
|
||||
# run as curl | sh
|
||||
# on some systems, you can just do cat>npm-install.sh
|
||||
# which is a bit cuter. But on others, &1 is already closed,
|
||||
# so catting to another script file won't do anything.
|
||||
# Follow Location: headers, and fail on errors
|
||||
curl -f -L -s https://www.npmjs.org/install.sh > npm-install-$$.sh
|
||||
ret=$?
|
||||
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
|
||||
|
||||
# See what "npm_config_*" things there are in the env,
|
||||
# and make them permanent.
|
||||
# If this fails, it's not such a big deal.
|
||||
configures="`env | grep 'npm_config_' | sed -e 's|^npm_config_||g'`"
|
||||
|
||||
npm_config_loglevel="error"
|
||||
if [ "x$npm_debug" = "x" ]; then
|
||||
(exit 0)
|
||||
else
|
||||
echo "Running in debug mode."
|
||||
echo "Note that this requires bash or zsh."
|
||||
set -o xtrace
|
||||
set -o pipefail
|
||||
npm_config_loglevel="verbose"
|
||||
fi
|
||||
export npm_config_loglevel
|
||||
|
||||
# make sure that node exists
|
||||
node=`which node 2>&1`
|
||||
ret=$?
|
||||
# if not found, try "nodejs" as it is the case on debian
|
||||
if [ $ret -ne 0 ]; then
|
||||
node=`which nodejs 2>&1`
|
||||
ret=$?
|
||||
fi
|
||||
if [ $ret -eq 0 ] && [ -x "$node" ]; then
|
||||
(exit 0)
|
||||
else
|
||||
echo "npm cannot be installed without node.js." >&2
|
||||
echo "Install node first, and then try again." >&2
|
||||
echo "" >&2
|
||||
echo "Maybe node is installed, but not in the PATH?" >&2
|
||||
echo "Note that running as sudo can change envs." >&2
|
||||
echo ""
|
||||
echo "PATH=$PATH" >&2
|
||||
exit $ret
|
||||
fi
|
||||
|
||||
# set the temp dir
|
||||
TMP="${TMPDIR}"
|
||||
if [ "x$TMP" = "x" ]; then
|
||||
TMP="/tmp"
|
||||
fi
|
||||
TMP="${TMP}/npm.$$"
|
||||
rm -rf "$TMP" || true
|
||||
mkdir "$TMP"
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "failed to mkdir $TMP" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
BACK="$PWD"
|
||||
|
||||
ret=0
|
||||
tar="${TAR}"
|
||||
if [ -z "$tar" ]; then
|
||||
tar="${npm_config_tar}"
|
||||
fi
|
||||
if [ -z "$tar" ]; then
|
||||
tar=`which tar 2>&1`
|
||||
ret=$?
|
||||
fi
|
||||
|
||||
if [ $ret -eq 0 ] && [ -x "$tar" ]; then
|
||||
echo "tar=$tar"
|
||||
if [ $tar --version > /dev/null 2>&1 ]; then
|
||||
echo "version:"
|
||||
$tar --version
|
||||
fi
|
||||
ret=$?
|
||||
fi
|
||||
|
||||
if [ $ret -eq 0 ]; then
|
||||
(exit 0)
|
||||
else
|
||||
echo "No suitable tar program found."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
|
||||
# Try to find a suitable make
|
||||
# If the MAKE environment var is set, use that.
|
||||
# otherwise, try to find gmake, and then make.
|
||||
# If no make is found, then just execute the necessary commands.
|
||||
|
||||
# XXX For some reason, make is building all the docs every time. This
|
||||
# is an annoying source of bugs. Figure out why this happens.
|
||||
MAKE=NOMAKE
|
||||
|
||||
if [ "x$MAKE" = "x" ]; then
|
||||
make=`which gmake 2>&1`
|
||||
if [ $? -eq 0 ] && [ -x "$make" ]; then
|
||||
(exit 0)
|
||||
else
|
||||
make=`which make 2>&1`
|
||||
if [ $? -eq 0 ] && [ -x "$make" ]; then
|
||||
(exit 0)
|
||||
else
|
||||
make=NOMAKE
|
||||
fi
|
||||
fi
|
||||
else
|
||||
make="$MAKE"
|
||||
fi
|
||||
|
||||
if [ -x "$make" ]; then
|
||||
(exit 0)
|
||||
else
|
||||
# echo "Installing without make. This may fail." >&2
|
||||
make=NOMAKE
|
||||
fi
|
||||
|
||||
# If there's no bash, then don't even try to clean
|
||||
if [ -x "/bin/bash" ]; then
|
||||
(exit 0)
|
||||
else
|
||||
clean="no"
|
||||
fi
|
||||
|
||||
node_version=`"$node" --version 2>&1`
|
||||
ret=$?
|
||||
if [ $ret -ne 0 ]; then
|
||||
echo "You need node to run this program." >&2
|
||||
echo "node --version reports: $node_version" >&2
|
||||
echo "with exit code = $ret" >&2
|
||||
echo "Please install node before continuing." >&2
|
||||
exit $ret
|
||||
fi
|
||||
|
||||
t="${npm_install}"
|
||||
if [ -z "$t" ]; then
|
||||
# switch based on node version.
|
||||
# note that we can only use strict sh-compatible patterns here.
|
||||
case $node_version in
|
||||
0.[01234567].* | v0.[01234567].*)
|
||||
echo "You are using an outdated and unsupported version of" >&2
|
||||
echo "node ($node_version). Please update node and try again." >&2
|
||||
exit 99
|
||||
;;
|
||||
*)
|
||||
echo "install npm@latest"
|
||||
t="latest"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# need to echo "" after, because Posix sed doesn't treat EOF
|
||||
# as an implied end of line.
|
||||
url=`(curl -SsL https://registry.npmjs.org/npm/$t; echo "") \
|
||||
| sed -e 's/^.*tarball":"//' \
|
||||
| sed -e 's/".*$//'`
|
||||
|
||||
ret=$?
|
||||
if [ "x$url" = "x" ]; then
|
||||
ret=125
|
||||
# try without the -e arg to sed.
|
||||
url=`(curl -SsL https://registry.npmjs.org/npm/$t; echo "") \
|
||||
| sed 's/^.*tarball":"//' \
|
||||
| sed 's/".*$//'`
|
||||
ret=$?
|
||||
if [ "x$url" = "x" ]; then
|
||||
ret=125
|
||||
fi
|
||||
fi
|
||||
if [ $ret -ne 0 ]; then
|
||||
echo "Failed to get tarball url for npm/$t" >&2
|
||||
exit $ret
|
||||
fi
|
||||
|
||||
|
||||
echo "fetching: $url" >&2
|
||||
|
||||
cd "$TMP" \
|
||||
&& curl -SsL "$url" \
|
||||
| $tar -xzf - \
|
||||
&& cd "$TMP"/* \
|
||||
&& (ret=0
|
||||
if [ $ret -ne 0 ]; then
|
||||
echo "Aborted 0.x cleanup. Exiting." >&2
|
||||
exit $ret
|
||||
fi) \
|
||||
&& (if [ "x$configures" = "x" ]; then
|
||||
(exit 0)
|
||||
else
|
||||
echo "./configure $configures"
|
||||
echo "$configures" > npmrc
|
||||
fi) \
|
||||
&& (if [ "$make" = "NOMAKE" ]; then
|
||||
(exit 0)
|
||||
elif "$make" uninstall install; then
|
||||
(exit 0)
|
||||
else
|
||||
make="NOMAKE"
|
||||
fi
|
||||
if [ "$make" = "NOMAKE" ]; then
|
||||
"$node" bin/npm-cli.js rm npm -gf
|
||||
"$node" bin/npm-cli.js install -gf $("$node" bin/npm-cli.js pack | tail -1)
|
||||
fi) \
|
||||
&& cd "$BACK" \
|
||||
&& rm -rf "$TMP" \
|
||||
&& echo "It worked"
|
||||
|
||||
ret=$?
|
||||
if [ $ret -ne 0 ]; then
|
||||
echo "It failed" >&2
|
||||
fi
|
||||
exit $ret
|
85
builder-docker/jenkins/node-v12.22.8-linux-x64/lib/node_modules/npm/scripts/maketest
generated
vendored
Normal file
85
builder-docker/jenkins/node-v12.22.8-linux-x64/lib/node_modules/npm/scripts/maketest
generated
vendored
Normal file
@ -0,0 +1,85 @@
|
||||
#!/usr/bin/env node
|
||||
'use strict'
|
||||
const loadFromDir = require('tacks/load-from-dir.js')
|
||||
|
||||
process.exit(main(process.argv.slice(2)))
|
||||
|
||||
function main (argv) {
|
||||
if (argv.length !== 1) {
|
||||
console.error('Usage: maketest <fixturedir>')
|
||||
return 1
|
||||
}
|
||||
const fixturedir = process.argv[2]
|
||||
|
||||
console.log(generateFromDir(fixturedir))
|
||||
return 0
|
||||
}
|
||||
|
||||
function indent (ind, str) {
|
||||
return str.replace(/\n/g, '\n' + ind)
|
||||
}
|
||||
|
||||
function generateFromDir (dir) {
|
||||
const tacks = loadFromDir(dir)
|
||||
return `'use strict'
|
||||
const path = require('path')
|
||||
const test = require('tap').test
|
||||
const Tacks = require('tacks')
|
||||
const File = Tacks.File
|
||||
const Symlink = Tacks.Symlink
|
||||
const Dir = Tacks.Dir
|
||||
const common = require('../common-tap.js')
|
||||
|
||||
const basedir = path.join(__dirname, path.basename(__filename, '.js'))
|
||||
const testdir = path.join(basedir, 'testdir')
|
||||
const cachedir = path.join(basedir, 'cache')
|
||||
const globaldir = path.join(basedir, 'global')
|
||||
const tmpdir = path.join(basedir, 'tmp')
|
||||
|
||||
const conf = {
|
||||
cwd: testdir,
|
||||
env: common.newEnv().extend({
|
||||
npm_config_cache: cachedir,
|
||||
npm_config_tmp: tmpdir,
|
||||
npm_config_prefix: globaldir,
|
||||
npm_config_registry: common.registry,
|
||||
npm_config_loglevel: 'warn'
|
||||
})
|
||||
}
|
||||
|
||||
const fixture = new Tacks(Dir({
|
||||
cache: Dir(),
|
||||
global: Dir(),
|
||||
tmp: Dir(),
|
||||
testdir: ${indent(' ', tacks.fixture.toSource())}
|
||||
}))
|
||||
|
||||
function setup () {
|
||||
cleanup()
|
||||
fixture.create(basedir)
|
||||
}
|
||||
|
||||
function cleanup () {
|
||||
fixture.remove(basedir)
|
||||
}
|
||||
|
||||
test('setup', t => {
|
||||
setup()
|
||||
return common.fakeRegistry.listen()
|
||||
})
|
||||
|
||||
test('example', t => {
|
||||
return common.npm(['install'], conf).then(([code, stdout, stderr]) => {
|
||||
t.is(code, 0, 'command ran ok')
|
||||
t.comment(stdout.trim())
|
||||
t.comment(stderr.trim())
|
||||
// your assertions here
|
||||
})
|
||||
})
|
||||
|
||||
test('cleanup', t => {
|
||||
common.fakeRegistry.close()
|
||||
cleanup()
|
||||
t.done()
|
||||
})\n`
|
||||
}
|
167
builder-docker/jenkins/node-v12.22.8-linux-x64/lib/node_modules/npm/scripts/pr
generated
vendored
Normal file
167
builder-docker/jenkins/node-v12.22.8-linux-x64/lib/node_modules/npm/scripts/pr
generated
vendored
Normal file
@ -0,0 +1,167 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Land a pull request
|
||||
# Creates a PR-### branch, pulls the commits, opens up an interactive rebase to
|
||||
# squash, and then annotates the commit with the changelog goobers
|
||||
#
|
||||
# Usage:
|
||||
# pr <url|number> [<upstream remote>=origin]
|
||||
|
||||
main () {
|
||||
if [ "$1" = "finish" ]; then
|
||||
shift
|
||||
finish "$@"
|
||||
return $?
|
||||
fi
|
||||
|
||||
local url="$(prurl "$@")"
|
||||
local num=$(basename $url)
|
||||
local prpath="${url#git@github.com:}"
|
||||
local repo=${prpath%/pull/$num}
|
||||
local prweb="https://github.com/$prpath"
|
||||
local root="$(prroot "$url")"
|
||||
local api="https://api.github.com/repos/${repo}/pulls/${num}"
|
||||
local user=$(curl -s $api | json user.login)
|
||||
local ref="$(prref "$url" "$root")"
|
||||
local curhead="$(git show --no-patch --pretty=%H HEAD)"
|
||||
local curbranch="$(git rev-parse --abbrev-ref HEAD)"
|
||||
local cleanlines
|
||||
IFS=$'\n' cleanlines=($(git status -s -uno))
|
||||
if [ ${#cleanlines[@]} -ne 0 ]; then
|
||||
echo "working dir not clean" >&2
|
||||
IFS=$'\n' echo "${cleanlines[@]}" >&2
|
||||
echo "aborting PR merge" >&2
|
||||
fi
|
||||
|
||||
# ok, ready to rock
|
||||
branch=PR-$num
|
||||
if [ "$curbranch" == "$branch" ]; then
|
||||
echo "already on $branch, you're on your own" >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
me=$(git config github.user || git config user.name)
|
||||
if [ "$me" == "" ]; then
|
||||
echo "run 'git config --add github.user <username>'" >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
exists=$(git show --no-patch --pretty=%H $branch 2>/dev/null)
|
||||
if [ "$exists" == "" ]; then
|
||||
git fetch origin pull/$num/head:$branch
|
||||
git checkout $branch
|
||||
else
|
||||
git checkout $branch
|
||||
git pull --rebase origin pull/$num/head
|
||||
fi
|
||||
|
||||
git rebase -i $curbranch # squash and test
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
finish "${curbranch}"
|
||||
else
|
||||
echo "resolve conflicts and run: $0 finish "'"'${curbranch}'"'
|
||||
fi
|
||||
}
|
||||
|
||||
# add the PR-URL to the last commit, after squashing
|
||||
finish () {
|
||||
if [ $# -eq 0 ]; then
|
||||
echo "Usage: $0 finish <branch> (while on a PR-### branch)" >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
local curbranch="$1"
|
||||
local ref=$(cat .git/HEAD)
|
||||
local prnum
|
||||
case $ref in
|
||||
"ref: refs/heads/PR-"*)
|
||||
prnum=${ref#ref: refs/heads/PR-}
|
||||
;;
|
||||
*)
|
||||
echo "not on the PR-## branch any more!" >&2
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
|
||||
local me=$(git config github.user || git config user.name)
|
||||
if [ "$me" == "" ]; then
|
||||
echo "run 'git config --add github.user <username>'" >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
set -x
|
||||
|
||||
local url="$(prurl "$prnum")"
|
||||
local num=$prnum
|
||||
local prpath="${url#git@github.com:}"
|
||||
local repo=${prpath%/pull/$num}
|
||||
local prweb="https://github.com/$prpath"
|
||||
local root="$(prroot "$url")"
|
||||
|
||||
local api="https://api.github.com/repos/${repo}/pulls/${num}"
|
||||
local user=$(curl -s $api | json user.login)
|
||||
|
||||
local lastmsg="$(git log -1 --pretty=%B)"
|
||||
local newmsg="${lastmsg}
|
||||
|
||||
PR-URL: ${prweb}
|
||||
Credit: @${user}
|
||||
Close: #${num}
|
||||
Reviewed-by: @${me}
|
||||
"
|
||||
git commit --amend -m "$newmsg"
|
||||
git checkout $curbranch
|
||||
git merge PR-${prnum} --ff-only
|
||||
set +x
|
||||
}
|
||||
|
||||
|
||||
prurl () {
|
||||
local url="$1"
|
||||
if [ "$url" == "" ] && type pbpaste &>/dev/null; then
|
||||
url="$(pbpaste)"
|
||||
fi
|
||||
if [[ "$url" =~ ^[0-9]+$ ]]; then
|
||||
local us="$2"
|
||||
if [ "$us" == "" ]; then
|
||||
us="origin"
|
||||
fi
|
||||
local num="$url"
|
||||
local o="$(git config --get remote.${us}.url)"
|
||||
url="${o}"
|
||||
url="${url#(git:\/\/|https:\/\/)}"
|
||||
url="${url#git@}"
|
||||
url="${url#github.com[:\/]}"
|
||||
url="${url%.git}"
|
||||
url="https://github.com/${url}/pull/$num"
|
||||
fi
|
||||
url=${url%/commits}
|
||||
url=${url%/files}
|
||||
url="$(echo $url | perl -p -e 's/#issuecomment-[0-9]+$//g')"
|
||||
|
||||
local p='^https:\/\/github.com\/[^\/]+\/[^\/]+\/pull\/[0-9]+$'
|
||||
if ! [[ "$url" =~ $p ]]; then
|
||||
echo "Usage:"
|
||||
echo " $0 <pull req url>"
|
||||
echo " $0 <pull req number> [<remote name>=origin]"
|
||||
type pbpaste &>/dev/null &&
|
||||
echo "(will read url/id from clipboard if not specified)"
|
||||
exit 1
|
||||
fi
|
||||
url="${url/https:\/\/github\.com\//git@github.com:}"
|
||||
echo "$url"
|
||||
}
|
||||
|
||||
prroot () {
|
||||
local url="$1"
|
||||
echo "${url/\/pull\/+([0-9])/}"
|
||||
}
|
||||
|
||||
prref () {
|
||||
local url="$1"
|
||||
local root="$2"
|
||||
echo "refs${url:${#root}}/head"
|
||||
}
|
||||
|
||||
main "$@"
|
3
builder-docker/jenkins/node-v12.22.8-linux-x64/lib/node_modules/npm/scripts/publish-tag.js
generated
vendored
Normal file
3
builder-docker/jenkins/node-v12.22.8-linux-x64/lib/node_modules/npm/scripts/publish-tag.js
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
var semver = require('semver')
|
||||
var version = semver.parse(require('../package.json').version)
|
||||
console.log('v%s.%s-next', version.major, version.minor)
|
43
builder-docker/jenkins/node-v12.22.8-linux-x64/lib/node_modules/npm/scripts/release.sh
generated
vendored
Normal file
43
builder-docker/jenkins/node-v12.22.8-linux-x64/lib/node_modules/npm/scripts/release.sh
generated
vendored
Normal file
@ -0,0 +1,43 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# script for creating a zip and tarball for inclusion in node
|
||||
|
||||
unset CDPATH
|
||||
|
||||
set -e
|
||||
|
||||
rm -rf release *.tgz || true
|
||||
rm node_modules/node-gyp/gyp/pylib/gyp/*.pyc || true
|
||||
rm node_modules/node-gyp/gyp/pylib/gyp/generator/*.pyc || true
|
||||
mkdir release
|
||||
node ./bin/npm-cli.js pack --loglevel error >/dev/null
|
||||
mv *.tgz release
|
||||
cd release
|
||||
tar xzf *.tgz
|
||||
cp ../.npmrc package/
|
||||
cp -r ../tap-snapshots package/
|
||||
cp -r ../test package/
|
||||
|
||||
mkdir node_modules
|
||||
mv package node_modules/npm
|
||||
|
||||
# make the zip for windows users
|
||||
cp node_modules/npm/bin/*.cmd .
|
||||
zipname=npm-$(node ../bin/npm-cli.js -v).zip
|
||||
zip -q -9 -r -X "$zipname" *.cmd node_modules
|
||||
|
||||
# make the tar for node's deps
|
||||
cd node_modules
|
||||
tarname=npm-$(node ../../bin/npm-cli.js -v).tgz
|
||||
tar czf "$tarname" npm
|
||||
|
||||
cd ..
|
||||
mv "node_modules/$tarname" .
|
||||
|
||||
rm -rf *.cmd
|
||||
rm -rf node_modules
|
||||
|
||||
cd ..
|
||||
|
||||
echo "release/$tarname"
|
||||
echo "release/$zipname"
|
26
builder-docker/jenkins/node-v12.22.8-linux-x64/lib/node_modules/npm/scripts/relocate.sh
generated
vendored
Normal file
26
builder-docker/jenkins/node-v12.22.8-linux-x64/lib/node_modules/npm/scripts/relocate.sh
generated
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Change the cli shebang to point at the specified node
|
||||
# Useful for when the program is moved around after install.
|
||||
# Also used by the default 'make install' in node to point
|
||||
# npm at the newly installed node, rather than the first one
|
||||
# in the PATH, which would be the default otherwise.
|
||||
|
||||
# bash /path/to/npm/scripts/relocate.sh $nodepath
|
||||
# If $nodepath is blank, then it'll use /usr/bin/env
|
||||
|
||||
dir="$(dirname "$(dirname "$0")")"
|
||||
cli="$dir"/bin/npm-cli.js
|
||||
tmp="$cli".tmp
|
||||
|
||||
node="$1"
|
||||
if [ "x$node" = "x" ]; then
|
||||
node="/usr/bin/env node"
|
||||
fi
|
||||
node="#!$node"
|
||||
|
||||
sed -e 1d "$cli" > "$tmp"
|
||||
echo "$node" > "$cli"
|
||||
cat "$tmp" >> "$cli"
|
||||
rm "$tmp"
|
||||
chmod ogu+x $cli
|
9
builder-docker/jenkins/node-v12.22.8-linux-x64/lib/node_modules/npm/scripts/update-authors.sh
generated
vendored
Normal file
9
builder-docker/jenkins/node-v12.22.8-linux-x64/lib/node_modules/npm/scripts/update-authors.sh
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
#!/bin/sh
|
||||
|
||||
git log --use-mailmap --reverse --format='%aN <%aE>' | perl -wnE '
|
||||
BEGIN {
|
||||
say "# Authors sorted by whether or not they\x27re me";
|
||||
}
|
||||
|
||||
print $seen{$_} = $_ unless $seen{$_}
|
||||
' > AUTHORS
|
123
builder-docker/jenkins/node-v12.22.8-linux-x64/lib/node_modules/npm/scripts/update-dist-tags.js
generated
vendored
Normal file
123
builder-docker/jenkins/node-v12.22.8-linux-x64/lib/node_modules/npm/scripts/update-dist-tags.js
generated
vendored
Normal file
@ -0,0 +1,123 @@
|
||||
'use strict'
|
||||
|
||||
/**
|
||||
* Usage:
|
||||
*
|
||||
* node scripts/update-dist-tags.js --otp <one-time password>
|
||||
* node scripts/update-dist-tags.js --otp=<one-time password>
|
||||
* node scripts/update-dist-tags.js --otp<one-time password>
|
||||
*/
|
||||
|
||||
const usage = `
|
||||
Usage:
|
||||
|
||||
node scripts/update-dist-tags.js --otp <one-time password>
|
||||
node scripts/update-dist-tags.js --otp=<one-time password>
|
||||
node scripts/update-dist-tags.js --otp<one-time password>
|
||||
`
|
||||
|
||||
const { execSync } = require('child_process')
|
||||
const semver = require('semver')
|
||||
const path = require('path')
|
||||
|
||||
const getMajorVersion = (input) => semver.parse(input).major
|
||||
const getMinorVersion = (input) => semver.parse(input).minor
|
||||
|
||||
// INFO: String templates to generate the tags to update
|
||||
const LATEST_TAG = (strings, major) => `latest-${major}`
|
||||
const NEXT_TAG = (strings, major) => `next-${major}`
|
||||
const TAG_LIST = ['lts', 'next', 'latest']
|
||||
const REMOVE_TAG = (strings, major, minor) => `v${major}.${minor}-next`
|
||||
|
||||
// INFO: Finds `--otp` and subsequently otp value (if present)
|
||||
const PARSE_OTP_FLAG = new RegExp(/(--otp)(=|\s)?([0-9]{6})?/, 'gm')
|
||||
// INFO: Used to validate otp value (if not found by other regexp)
|
||||
const PARSE_OTP_VALUE = new RegExp(/^[0-9]{6}$/, 'g')
|
||||
|
||||
const args = process.argv.slice(2)
|
||||
const versionPath = path.resolve(__dirname, '..', 'package.json')
|
||||
const { version } = require(versionPath)
|
||||
|
||||
// Run Script
|
||||
main()
|
||||
|
||||
function main () {
|
||||
const otp = parseOTP(args)
|
||||
if (version) {
|
||||
const major = getMajorVersion(version)
|
||||
const minor = getMinorVersion(version)
|
||||
const latestTag = LATEST_TAG`${major}`
|
||||
const nextTag = NEXT_TAG`${major}`
|
||||
const removeTag = REMOVE_TAG`${major}${minor}`
|
||||
const updateList = [].concat(TAG_LIST, latestTag, nextTag)
|
||||
|
||||
updateList.forEach((tag) => {
|
||||
setDistTag(tag, version, otp)
|
||||
})
|
||||
removeDistTag(removeTag, version, otp)
|
||||
} else {
|
||||
console.error('Invalid semver.')
|
||||
process.exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
function parseOTP (args) {
|
||||
// NOTE: making assumption first _thing_ is a string with "--otp" in it
|
||||
const parsedArgs = PARSE_OTP_FLAG.exec(args[0])
|
||||
if (!parsedArgs) {
|
||||
console.error('Invalid arguments supplied. Must supply --otp flag.')
|
||||
console.error(usage)
|
||||
process.exit(1)
|
||||
}
|
||||
// INFO: From the regexp, third group is the OTP code
|
||||
const otp = parsedArgs[3]
|
||||
switch (args.length) {
|
||||
case 0: {
|
||||
console.error('No arguments supplied.')
|
||||
console.error(usage)
|
||||
process.exit(1)
|
||||
}
|
||||
case 1: {
|
||||
// --otp=123456 or --otp123456
|
||||
if (otp) {
|
||||
return otp
|
||||
}
|
||||
console.error('Invalid otp value supplied. [CASE 1]')
|
||||
process.exit(1)
|
||||
}
|
||||
case 2: {
|
||||
// --otp 123456
|
||||
// INFO: validating the second argument is an otp code
|
||||
const isValidOtp = PARSE_OTP_VALUE.test(args[1])
|
||||
if (isValidOtp) {
|
||||
return args[1]
|
||||
}
|
||||
console.error('Invalid otp value supplied. [CASE 2]')
|
||||
process.exit(1)
|
||||
}
|
||||
default: {
|
||||
console.error('Invalid arguments supplied.')
|
||||
process.exit(1)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function setDistTag (tag, version, otp) {
|
||||
try {
|
||||
const result = execSync(`npm dist-tag set npm@${version} ${tag} --otp=${otp}`, { encoding: 'utf-8' })
|
||||
console.log('Result:', result)
|
||||
} catch (err) {
|
||||
console.error('Bad dist-tag command.')
|
||||
process.exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
function removeDistTag (tag, version, otp) {
|
||||
try {
|
||||
const result = execSync(`npm dist-tag rm npm ${tag} --otp=${otp}`, { encoding: 'utf-8' })
|
||||
console.log('Result:', result)
|
||||
} catch (err) {
|
||||
console.error('Bad dist-tag command.')
|
||||
process.exit(1)
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user