Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Karrys <luke@lukekarrys.com>2022-03-31 21:12:04 +0300
committerGar <wraithgar@github.com>2022-04-06 19:26:45 +0300
commit7712b496ac689c8c46c47dbdc373b72efee5e2c9 (patch)
tree7ba28366f687858f92b4fe568283616bbed236e6 /scripts
parent03f36bf8c30b713e86f8e0b7e6643b68d74f7d91 (diff)
chore: rm unused files
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/clean-old.sh165
-rwxr-xr-xscripts/maketest85
-rwxr-xr-xscripts/pr167
-rwxr-xr-xscripts/relocate.sh26
4 files changed, 0 insertions, 443 deletions
diff --git a/scripts/clean-old.sh b/scripts/clean-old.sh
deleted file mode 100755
index 32a203e4a..000000000
--- a/scripts/clean-old.sh
+++ /dev/null
@@ -1,165 +0,0 @@
-#!/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
diff --git a/scripts/maketest b/scripts/maketest
deleted file mode 100755
index 4ef1e9266..000000000
--- a/scripts/maketest
+++ /dev/null
@@ -1,85 +0,0 @@
-#!/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`
-}
diff --git a/scripts/pr b/scripts/pr
deleted file mode 100755
index 30a3b05ff..000000000
--- a/scripts/pr
+++ /dev/null
@@ -1,167 +0,0 @@
-#!/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 "$@"
diff --git a/scripts/relocate.sh b/scripts/relocate.sh
deleted file mode 100755
index ff40f857a..000000000
--- a/scripts/relocate.sh
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/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