From 37db2964710c80003604b7e3c1527d17be7ed3d0 Mon Sep 17 00:00:00 2001 From: isaacs Date: Tue, 20 Aug 2019 17:07:24 -0700 Subject: [PATCH] cmd-shim@3.0.2 --- node_modules/cmd-shim/.travis.yml | 19 - node_modules/cmd-shim/index.js | 4 +- node_modules/cmd-shim/package.json | 27 +- .../tap-snapshots/test-basic.js-TAP.test.js | 440 ------------------ node_modules/cmd-shim/test.bat | 20 - node_modules/cmd-shim/test/00-setup.js | 35 -- node_modules/cmd-shim/test/basic.js | 163 ------- .../cmd-shim/test/to-batch-syntax-tests.js | 25 - node_modules/cmd-shim/test/zz-cleanup.js | 13 - package-lock.json | 6 +- package.json | 2 +- 11 files changed, 22 insertions(+), 732 deletions(-) delete mode 100644 node_modules/cmd-shim/.travis.yml delete mode 100644 node_modules/cmd-shim/tap-snapshots/test-basic.js-TAP.test.js delete mode 100644 node_modules/cmd-shim/test.bat delete mode 100644 node_modules/cmd-shim/test/00-setup.js delete mode 100755 node_modules/cmd-shim/test/basic.js delete mode 100644 node_modules/cmd-shim/test/to-batch-syntax-tests.js delete mode 100644 node_modules/cmd-shim/test/zz-cleanup.js diff --git a/node_modules/cmd-shim/.travis.yml b/node_modules/cmd-shim/.travis.yml deleted file mode 100644 index 1d38b470c67ed..0000000000000 --- a/node_modules/cmd-shim/.travis.yml +++ /dev/null @@ -1,19 +0,0 @@ -language: node_js - -node_js: - - node - - 12 - - 10 - - 8 - - 6 - -os: - - linux - - windows - -cache: - directories: - - $HOME/.npm - -notifications: - email: false diff --git a/node_modules/cmd-shim/index.js b/node_modules/cmd-shim/index.js index 63a9d5ad1633c..b1b6e583f4369 100644 --- a/node_modules/cmd-shim/index.js +++ b/node_modules/cmd-shim/index.js @@ -122,10 +122,10 @@ function writeShim_ (from, to, prog, args, variables, cb) { // Subroutine trick to fix https://github.com/npm/cmd-shim/issues/10 var head = '@ECHO off\r\n' + 'SETLOCAL\r\n' + - 'CALL find_dp0\r\n' + 'CALL :find_dp0\r\n' var foot = 'ENDLOCAL\r\n' + 'EXIT /b\r\n' + - 'find_dp0:\r\n' + + ':find_dp0\r\n' + 'SET dp0=%~dp0\r\n' + 'EXIT /b\r\n' diff --git a/node_modules/cmd-shim/package.json b/node_modules/cmd-shim/package.json index 5b4faf9226060..7d0545e327ac8 100644 --- a/node_modules/cmd-shim/package.json +++ b/node_modules/cmd-shim/package.json @@ -1,27 +1,28 @@ { - "_from": "cmd-shim@3.0.0", - "_id": "cmd-shim@3.0.0", + "_from": "cmd-shim@3.0.2", + "_id": "cmd-shim@3.0.2", "_inBundle": false, - "_integrity": "sha512-9cl9KcmjzrOZhA/mLl2qwhFaPLr6HpbbuPjMWPdDQ7EVrIOQJsI1JvzMur87mgaeCAtwRb5WNS2SBnC9uZDWwg==", + "_integrity": "sha512-x/2sXAaA1lUgUCZ9zaeOGzSkXOoN2DFxY61kgfhnIIUe/2QK8DFDnezT2drSZa/u8SKQT3vRFwTFPMMgQmH8kg==", "_location": "/cmd-shim", "_phantomChildren": {}, "_requested": { "type": "version", "registry": true, - "raw": "cmd-shim@3.0.0", + "raw": "cmd-shim@3.0.2", "name": "cmd-shim", "escapedName": "cmd-shim", - "rawSpec": "3.0.0", + "rawSpec": "3.0.2", "saveSpec": null, - "fetchSpec": "3.0.0" + "fetchSpec": "3.0.2" }, "_requiredBy": [ "#USER", - "/" + "/", + "/bin-links" ], - "_resolved": "https://registry.npmjs.org/cmd-shim/-/cmd-shim-3.0.0.tgz", - "_shasum": "738b3532187238c4b69682345c2ad930e99b7750", - "_spec": "cmd-shim@3.0.0", + "_resolved": "https://registry.npmjs.org/cmd-shim/-/cmd-shim-3.0.2.tgz", + "_shasum": "159a20602ac4295ec0997243a40ac9b2df54f5e3", + "_spec": "cmd-shim@3.0.2", "_where": "/Users/isaacs/dev/npm/cli", "bugs": { "url": "https://github.com/npm/cmd-shim/issues" @@ -37,6 +38,10 @@ "rimraf": "~2.2.8", "tap": "^12.7.0" }, + "files": [ + "index.js", + "lib" + ], "homepage": "https://github.com/npm/cmd-shim#readme", "license": "ISC", "name": "cmd-shim", @@ -51,5 +56,5 @@ "snap": "TAP_SNAPSHOT=1 tap test/*.js --100", "test": "tap test/*.js --100" }, - "version": "3.0.0" + "version": "3.0.2" } diff --git a/node_modules/cmd-shim/tap-snapshots/test-basic.js-TAP.test.js b/node_modules/cmd-shim/tap-snapshots/test-basic.js-TAP.test.js deleted file mode 100644 index e0947c6c5a692..0000000000000 --- a/node_modules/cmd-shim/tap-snapshots/test-basic.js-TAP.test.js +++ /dev/null @@ -1,440 +0,0 @@ -/* IMPORTANT - * This snapshot file is auto-generated, but designed for humans. - * It should be checked into source control and tracked carefully. - * Re-generate by setting TAP_SNAPSHOT=1 and running tests. - * Make sure to inspect the output below. Do not ignore changes! - */ -'use strict' -exports[`test/basic.js TAP env shebang > cmd 1`] = ` -@ECHO off\\r -SETLOCAL\\r -CALL find_dp0\\r -\\r -IF EXIST "%dp0%\\node.exe" (\\r - SET "_prog=%dp0%\\node.exe"\\r -) ELSE (\\r - SET "_prog=node"\\r - SET PATHEXT=%PATHEXT:;.JS;=;%\\r -)\\r -\\r -"%_prog%" "%dp0%\\from.env" %*\\r -ENDLOCAL\\r -EXIT /b\\r -find_dp0:\\r -SET dp0=%~dp0\\r -EXIT /b\\r - -` - -exports[`test/basic.js TAP env shebang > ps1 1`] = ` -#!/usr/bin/env pwsh -$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent - -$exe="" -if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { - # Fix case when both the Windows and Linux builds of Node - # are installed in the same directory - $exe=".exe" -} -$ret=0 -if (Test-Path "$basedir/node$exe") { - & "$basedir/node$exe" "$basedir/from.env" $args - $ret=$LASTEXITCODE -} else { - & "node$exe" "$basedir/from.env" $args - $ret=$LASTEXITCODE -} -exit $ret - -` - -exports[`test/basic.js TAP env shebang > shell 1`] = ` -#!/bin/sh -basedir=$(dirname "$(echo "$0" | sed -e 's,\\\\,/,g')") - -case \`uname\` in - *CYGWIN*|*MINGW*|*MSYS*) basedir=\`cygpath -w "$basedir"\`;; -esac - -if [ -x "$basedir/node" ]; then - "$basedir/node" "$basedir/from.env" "$@" - ret=$? -else - node "$basedir/from.env" "$@" - ret=$? -fi -exit $ret - -` - -exports[`test/basic.js TAP env shebang with args > cmd 1`] = ` -@ECHO off\\r -SETLOCAL\\r -CALL find_dp0\\r -\\r -IF EXIST "%dp0%\\node.exe" (\\r - SET "_prog=%dp0%\\node.exe"\\r -) ELSE (\\r - SET "_prog=node"\\r - SET PATHEXT=%PATHEXT:;.JS;=;%\\r -)\\r -\\r -"%_prog%" --expose_gc "%dp0%\\from.env.args" %*\\r -ENDLOCAL\\r -EXIT /b\\r -find_dp0:\\r -SET dp0=%~dp0\\r -EXIT /b\\r - -` - -exports[`test/basic.js TAP env shebang with args > ps1 1`] = ` -#!/usr/bin/env pwsh -$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent - -$exe="" -if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { - # Fix case when both the Windows and Linux builds of Node - # are installed in the same directory - $exe=".exe" -} -$ret=0 -if (Test-Path "$basedir/node$exe") { - & "$basedir/node$exe" --expose_gc "$basedir/from.env.args" $args - $ret=$LASTEXITCODE -} else { - & "node$exe" --expose_gc "$basedir/from.env.args" $args - $ret=$LASTEXITCODE -} -exit $ret - -` - -exports[`test/basic.js TAP env shebang with args > shell 1`] = ` -#!/bin/sh -basedir=$(dirname "$(echo "$0" | sed -e 's,\\\\,/,g')") - -case \`uname\` in - *CYGWIN*|*MINGW*|*MSYS*) basedir=\`cygpath -w "$basedir"\`;; -esac - -if [ -x "$basedir/node" ]; then - "$basedir/node" --expose_gc "$basedir/from.env.args" "$@" - ret=$? -else - node --expose_gc "$basedir/from.env.args" "$@" - ret=$? -fi -exit $ret - -` - -exports[`test/basic.js TAP env shebang with variables > cmd 1`] = ` -@ECHO off\\r -SETLOCAL\\r -CALL find_dp0\\r -@SET NODE_PATH=./lib:%NODE_PATH%\\r -\\r -IF EXIST "%dp0%\\node.exe" (\\r - SET "_prog=%dp0%\\node.exe"\\r -) ELSE (\\r - SET "_prog=node"\\r - SET PATHEXT=%PATHEXT:;.JS;=;%\\r -)\\r -\\r -"%_prog%" "%dp0%\\from.env.variables" %*\\r -ENDLOCAL\\r -EXIT /b\\r -find_dp0:\\r -SET dp0=%~dp0\\r -EXIT /b\\r - -` - -exports[`test/basic.js TAP env shebang with variables > ps1 1`] = ` -#!/usr/bin/env pwsh -$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent - -$exe="" -if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { - # Fix case when both the Windows and Linux builds of Node - # are installed in the same directory - $exe=".exe" -} -$ret=0 -if (Test-Path "$basedir/node$exe") { - & "$basedir/node$exe" "$basedir/from.env.variables" $args - $ret=$LASTEXITCODE -} else { - & "node$exe" "$basedir/from.env.variables" $args - $ret=$LASTEXITCODE -} -exit $ret - -` - -exports[`test/basic.js TAP env shebang with variables > shell 1`] = ` -#!/bin/sh -basedir=$(dirname "$(echo "$0" | sed -e 's,\\\\,/,g')") - -case \`uname\` in - *CYGWIN*|*MINGW*|*MSYS*) basedir=\`cygpath -w "$basedir"\`;; -esac - -if [ -x "$basedir/node" ]; then - NODE_PATH=./lib:$NODE_PATH "$basedir/node" "$basedir/from.env.variables" "$@" - ret=$? -else - NODE_PATH=./lib:$NODE_PATH node "$basedir/from.env.variables" "$@" - ret=$? -fi -exit $ret - -` - -exports[`test/basic.js TAP explicit shebang > cmd 1`] = ` -@ECHO off\\r -SETLOCAL\\r -CALL find_dp0\\r -\\r -IF EXIST "%dp0%\\/usr/bin/sh.exe" (\\r - SET "_prog=%dp0%\\/usr/bin/sh.exe"\\r -) ELSE (\\r - SET "_prog=/usr/bin/sh"\\r - SET PATHEXT=%PATHEXT:;.JS;=;%\\r -)\\r -\\r -"%_prog%" "%dp0%\\from.sh" %*\\r -ENDLOCAL\\r -EXIT /b\\r -find_dp0:\\r -SET dp0=%~dp0\\r -EXIT /b\\r - -` - -exports[`test/basic.js TAP explicit shebang > ps1 1`] = ` -#!/usr/bin/env pwsh -$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent - -$exe="" -if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { - # Fix case when both the Windows and Linux builds of Node - # are installed in the same directory - $exe=".exe" -} -$ret=0 -if (Test-Path "$basedir//usr/bin/sh$exe") { - & "$basedir//usr/bin/sh$exe" "$basedir/from.sh" $args - $ret=$LASTEXITCODE -} else { - & "/usr/bin/sh$exe" "$basedir/from.sh" $args - $ret=$LASTEXITCODE -} -exit $ret - -` - -exports[`test/basic.js TAP explicit shebang > shell 1`] = ` -#!/bin/sh -basedir=$(dirname "$(echo "$0" | sed -e 's,\\\\,/,g')") - -case \`uname\` in - *CYGWIN*|*MINGW*|*MSYS*) basedir=\`cygpath -w "$basedir"\`;; -esac - -if [ -x "$basedir//usr/bin/sh" ]; then - "$basedir//usr/bin/sh" "$basedir/from.sh" "$@" - ret=$? -else - /usr/bin/sh "$basedir/from.sh" "$@" - ret=$? -fi -exit $ret - -` - -exports[`test/basic.js TAP explicit shebang with args > cmd 1`] = ` -@ECHO off\\r -SETLOCAL\\r -CALL find_dp0\\r -\\r -IF EXIST "%dp0%\\/usr/bin/sh.exe" (\\r - SET "_prog=%dp0%\\/usr/bin/sh.exe"\\r -) ELSE (\\r - SET "_prog=/usr/bin/sh"\\r - SET PATHEXT=%PATHEXT:;.JS;=;%\\r -)\\r -\\r -"%_prog%" -x "%dp0%\\from.sh.args" %*\\r -ENDLOCAL\\r -EXIT /b\\r -find_dp0:\\r -SET dp0=%~dp0\\r -EXIT /b\\r - -` - -exports[`test/basic.js TAP explicit shebang with args > ps1 1`] = ` -#!/usr/bin/env pwsh -$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent - -$exe="" -if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { - # Fix case when both the Windows and Linux builds of Node - # are installed in the same directory - $exe=".exe" -} -$ret=0 -if (Test-Path "$basedir//usr/bin/sh$exe") { - & "$basedir//usr/bin/sh$exe" -x "$basedir/from.sh.args" $args - $ret=$LASTEXITCODE -} else { - & "/usr/bin/sh$exe" -x "$basedir/from.sh.args" $args - $ret=$LASTEXITCODE -} -exit $ret - -` - -exports[`test/basic.js TAP explicit shebang with args > shell 1`] = ` -#!/bin/sh -basedir=$(dirname "$(echo "$0" | sed -e 's,\\\\,/,g')") - -case \`uname\` in - *CYGWIN*|*MINGW*|*MSYS*) basedir=\`cygpath -w "$basedir"\`;; -esac - -if [ -x "$basedir//usr/bin/sh" ]; then - "$basedir//usr/bin/sh" -x "$basedir/from.sh.args" "$@" - ret=$? -else - /usr/bin/sh -x "$basedir/from.sh.args" "$@" - ret=$? -fi -exit $ret - -` - -exports[`test/basic.js TAP if exists (it does exist) > cmd 1`] = ` -@ECHO off\\r -SETLOCAL\\r -CALL find_dp0\\r -"%dp0%\\from.exe" %*\\r -ENDLOCAL\\r -EXIT /b\\r -find_dp0:\\r -SET dp0=%~dp0\\r -EXIT /b\\r - -` - -exports[`test/basic.js TAP if exists (it does exist) > ps1 1`] = ` -#!/usr/bin/env pwsh -$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent - -$exe="" -if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { - # Fix case when both the Windows and Linux builds of Node - # are installed in the same directory - $exe=".exe" -} -& "$basedir/from.exe" $args -exit $LASTEXITCODE - -` - -exports[`test/basic.js TAP if exists (it does exist) > shell 1`] = ` -#!/bin/sh -basedir=$(dirname "$(echo "$0" | sed -e 's,\\\\,/,g')") - -case \`uname\` in - *CYGWIN*|*MINGW*|*MSYS*) basedir=\`cygpath -w "$basedir"\`;; -esac - -"$basedir/from.exe" "$@" -exit $? - -` - -exports[`test/basic.js TAP just proceed if reading fails > cmd 1`] = ` -@ECHO off\\r -SETLOCAL\\r -CALL find_dp0\\r -"%dp0%\\" %*\\r -ENDLOCAL\\r -EXIT /b\\r -find_dp0:\\r -SET dp0=%~dp0\\r -EXIT /b\\r - -` - -exports[`test/basic.js TAP just proceed if reading fails > ps1 1`] = ` -#!/usr/bin/env pwsh -$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent - -$exe="" -if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { - # Fix case when both the Windows and Linux builds of Node - # are installed in the same directory - $exe=".exe" -} -& "$basedir/" $args -exit $LASTEXITCODE - -` - -exports[`test/basic.js TAP just proceed if reading fails > shell 1`] = ` -#!/bin/sh -basedir=$(dirname "$(echo "$0" | sed -e 's,\\\\,/,g')") - -case \`uname\` in - *CYGWIN*|*MINGW*|*MSYS*) basedir=\`cygpath -w "$basedir"\`;; -esac - -"$basedir/" "$@" -exit $? - -` - -exports[`test/basic.js TAP no shebang > cmd 1`] = ` -@ECHO off\\r -SETLOCAL\\r -CALL find_dp0\\r -"%dp0%\\from.exe" %*\\r -ENDLOCAL\\r -EXIT /b\\r -find_dp0:\\r -SET dp0=%~dp0\\r -EXIT /b\\r - -` - -exports[`test/basic.js TAP no shebang > ps1 1`] = ` -#!/usr/bin/env pwsh -$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent - -$exe="" -if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { - # Fix case when both the Windows and Linux builds of Node - # are installed in the same directory - $exe=".exe" -} -& "$basedir/from.exe" $args -exit $LASTEXITCODE - -` - -exports[`test/basic.js TAP no shebang > shell 1`] = ` -#!/bin/sh -basedir=$(dirname "$(echo "$0" | sed -e 's,\\\\,/,g')") - -case \`uname\` in - *CYGWIN*|*MINGW*|*MSYS*) basedir=\`cygpath -w "$basedir"\`;; -esac - -"$basedir/from.exe" "$@" -exit $? - -` diff --git a/node_modules/cmd-shim/test.bat b/node_modules/cmd-shim/test.bat deleted file mode 100644 index a37cd7719692c..0000000000000 --- a/node_modules/cmd-shim/test.bat +++ /dev/null @@ -1,20 +0,0 @@ - -@echo off -ECHO.%0 | FINDSTR /C:\ /C:/ >NUL && ( - @echo st dir to dp0 - SET dir=%~dp0 -) || ( - FOR /F %%i IN ('where %0') DO @SET dir=%%~dpi -) - -echo 0 = %0 -echo dp0 = %~dp0 -echo dir = %dir% - -call :find_bin -echo dir after call = %dir% -exit /b - -:find_bin -set dir=%~dp0 -exit /b diff --git a/node_modules/cmd-shim/test/00-setup.js b/node_modules/cmd-shim/test/00-setup.js deleted file mode 100644 index c9a7d3920748a..0000000000000 --- a/node_modules/cmd-shim/test/00-setup.js +++ /dev/null @@ -1,35 +0,0 @@ -var test = require('tap').test -var mkdirp = require('mkdirp') -var fs = require('fs') -var path = require('path') -var fixtures = path.resolve(__dirname, 'fixtures') - -var froms = { - 'from.exe': 'exe', - 'from.env': '#!/usr/bin/env node\nconsole.log(/hi/)\n', - 'from.env.args': '#!/usr/bin/env node --expose_gc\ngc()\n', - 'from.env.variables': '#!/usr/bin/env NODE_PATH=./lib:$NODE_PATH node', - 'from.sh': '#!/usr/bin/sh\necho hi\n', - 'from.sh.args': '#!/usr/bin/sh -x\necho hi\n' -} - -var cmdShim = require('../') - -test('create fixture', function (t) { - mkdirp(fixtures, function (er) { - if (er) - throw er - t.pass('made dir') - Object.keys(froms).forEach(function (f) { - t.test('write ' + f, function (t) { - fs.writeFile(path.resolve(fixtures, f), froms[f], function (er) { - if (er) - throw er - t.pass('wrote ' + f) - t.end() - }) - }) - }) - t.end() - }) -}) diff --git a/node_modules/cmd-shim/test/basic.js b/node_modules/cmd-shim/test/basic.js deleted file mode 100755 index 98b207cfc7ffb..0000000000000 --- a/node_modules/cmd-shim/test/basic.js +++ /dev/null @@ -1,163 +0,0 @@ -var test = require('tap').test -var mkdirp = require('mkdirp') -var rimraf = require('rimraf') -var fs = require('fs') -var path = require('path') -var fixtures = path.resolve(__dirname, 'fixtures') - -const matchSnapshot = (t, found, name) => - t.matchSnapshot(found.replace(/\r/g, '\\r'), name) - -var cmdShim = require('../') - -test('no shebang', function (t) { - var from = path.resolve(fixtures, 'from.exe') - var to = path.resolve(fixtures, 'exe.shim') - cmdShim(from, to, function(er) { - if (er) - throw er - matchSnapshot(t, fs.readFileSync(to, 'utf8'), 'shell') - matchSnapshot(t, fs.readFileSync(to + '.cmd', 'utf8'), 'cmd') - matchSnapshot(t, fs.readFileSync(to + '.ps1', 'utf8'), 'ps1') - t.end() - }) -}) - -test('if exists (it does exist)', function (t) { - var from = path.resolve(fixtures, 'from.exe') - var to = path.resolve(fixtures, 'exe.shim') - cmdShim.ifExists(from, to, function(er) { - if (er) - throw er - matchSnapshot(t, fs.readFileSync(to, 'utf8'), 'shell') - matchSnapshot(t, fs.readFileSync(to + '.cmd', 'utf8'), 'cmd') - matchSnapshot(t, fs.readFileSync(to + '.ps1', 'utf8'), 'ps1') - t.end() - }) -}) - -test('if exists (it does not exist)', function (t) { - var from = path.resolve(fixtures, 'argle bargle we like to sparkle') - var to = path.resolve(fixtures, 'argle-bargle-shim') - cmdShim.ifExists(from, to, function(er) { - if (er) - throw er - t.throws(() => fs.statSync(to)) - t.throws(() => fs.statSync(to + '.cmd')) - t.throws(() => fs.statSync(to + '.ps1')) - t.end() - }) -}) - -test('fails if from doesnt exist', t => { - var from = path.resolve(fixtures, 'argle bargle we like to sparkle') - var to = path.resolve(fixtures, 'argle-bargle-shim') - cmdShim(from, to, function(er) { - t.match(er, { code: 'ENOENT' }) - t.end() - }) -}) - -test('fails if mkdir fails', t => { - var from = path.resolve(fixtures, 'from.env') - var to = path.resolve(fixtures, 'from.env/a/b/c') - cmdShim(from, to, er => { - t.match(er, { code: 'ENOTDIR' }) - t.end() - }) -}) - -test('fails if to is a dir', t => { - var from = path.resolve(fixtures, 'from.env') - var to = path.resolve(fixtures) - cmdShim(from, to, er => { - t.match(er, { code: 'EISDIR' }) - rimraf.sync(to + '.cmd') - rimraf.sync(to + '.ps1') - t.end() - }) -}) - -test('just proceed if reading fails', t => { - var from = fixtures - var to = path.resolve(fixtures, 'env.shim') - cmdShim(from, to, er => { - if (er) - throw er - - matchSnapshot(t, fs.readFileSync(to, 'utf8'), 'shell') - matchSnapshot(t, fs.readFileSync(to + '.cmd', 'utf8'), 'cmd') - matchSnapshot(t, fs.readFileSync(to + '.ps1', 'utf8'), 'ps1') - t.end() - }) -}) - -test('env shebang', function (t) { - var from = path.resolve(fixtures, 'from.env') - var to = path.resolve(fixtures, 'env.shim') - cmdShim(from, to, function(er) { - if (er) - throw er - - matchSnapshot(t, fs.readFileSync(to, 'utf8'), 'shell') - matchSnapshot(t, fs.readFileSync(to + '.cmd', 'utf8'), 'cmd') - matchSnapshot(t, fs.readFileSync(to + '.ps1', 'utf8'), 'ps1') - t.end() - }) -}) - -test('env shebang with args', function (t) { - var from = path.resolve(fixtures, 'from.env.args') - var to = path.resolve(fixtures, 'env.args.shim') - cmdShim(from, to, function(er) { - if (er) - throw er - - matchSnapshot(t, fs.readFileSync(to, 'utf8'), 'shell') - matchSnapshot(t, fs.readFileSync(to + '.cmd', 'utf8'), 'cmd') - matchSnapshot(t, fs.readFileSync(to + '.ps1', 'utf8'), 'ps1') - t.end() - }) -}) - -test('env shebang with variables', function (t) { - var from = path.resolve(fixtures, 'from.env.variables') - var to = path.resolve(fixtures, 'env.variables.shim') - cmdShim(from, to, function(er) { - if (er) - throw er - - matchSnapshot(t, fs.readFileSync(to, 'utf8'), 'shell') - matchSnapshot(t, fs.readFileSync(to + '.cmd', 'utf8'), 'cmd') - matchSnapshot(t, fs.readFileSync(to + '.ps1', 'utf8'), 'ps1') - t.end() - }) -}) - -test('explicit shebang', function (t) { - var from = path.resolve(fixtures, 'from.sh') - var to = path.resolve(fixtures, 'sh.shim') - cmdShim(from, to, function(er) { - if (er) - throw er - - matchSnapshot(t, fs.readFileSync(to, 'utf8'), 'shell') - matchSnapshot(t, fs.readFileSync(to + '.cmd', 'utf8'), 'cmd') - matchSnapshot(t, fs.readFileSync(to + '.ps1', 'utf8'), 'ps1') - t.end() - }) -}) - -test('explicit shebang with args', function (t) { - var from = path.resolve(fixtures, 'from.sh.args') - var to = path.resolve(fixtures, 'sh.args.shim') - cmdShim(from, to, function(er) { - if (er) - throw er - - matchSnapshot(t, fs.readFileSync(to, 'utf8'), 'shell') - matchSnapshot(t, fs.readFileSync(to + '.cmd', 'utf8'), 'cmd') - matchSnapshot(t, fs.readFileSync(to + '.ps1', 'utf8'), 'ps1') - t.end() - }) -}) diff --git a/node_modules/cmd-shim/test/to-batch-syntax-tests.js b/node_modules/cmd-shim/test/to-batch-syntax-tests.js deleted file mode 100644 index 3645fd0a577a3..0000000000000 --- a/node_modules/cmd-shim/test/to-batch-syntax-tests.js +++ /dev/null @@ -1,25 +0,0 @@ -var test = require('tap').test -var toBatchSyntax = require('../lib/to-batch-syntax') - -test('replace $ expressions with % pair', function (t) { - var assertReplacement = function(string, expected) { - t.equal(toBatchSyntax.replaceDollarWithPercentPair(string), expected) - } - assertReplacement("$A", "%A%") - assertReplacement("$A:$B", "%A%:%B%") - assertReplacement("$A bla", "%A% bla") - assertReplacement("${A}bla", "%A%bla") - assertReplacement("$A $bla bla", "%A% %bla% bla") - assertReplacement("${A}bla ${bla}bla", "%A%bla %bla%bla") - assertReplacement("./lib:$NODE_PATH", "./lib:%NODE_PATH%") - t.end() -}) - -test('convert variable declaration to set command', function(t) { - t.equal(toBatchSyntax.convertToSetCommand("A",".lib:$A "), "@SET A=.lib:%A%\r\n") - t.equal(toBatchSyntax.convertToSetCommand("", ""), "") - t.equal(toBatchSyntax.convertToSetCommand(" ", ""), "") - t.equal(toBatchSyntax.convertToSetCommand(" ", " "), "") - t.equal(toBatchSyntax.convertToSetCommand(" ou", " ou "), "@SET ou=ou\r\n") - t.end() -}) diff --git a/node_modules/cmd-shim/test/zz-cleanup.js b/node_modules/cmd-shim/test/zz-cleanup.js deleted file mode 100644 index 9425031001cb0..0000000000000 --- a/node_modules/cmd-shim/test/zz-cleanup.js +++ /dev/null @@ -1,13 +0,0 @@ -var test = require('tap').test -var path = require('path') -var fixtures = path.resolve(__dirname, 'fixtures') -var rimraf = require('rimraf') - -test('cleanup', function(t) { - rimraf(fixtures, function(er) { - if (er) - throw er - t.pass('cleaned up') - t.end() - }) -}) diff --git a/package-lock.json b/package-lock.json index 8fc7fc64739a3..36e3503513b26 100644 --- a/package-lock.json +++ b/package-lock.json @@ -786,9 +786,9 @@ } }, "cmd-shim": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/cmd-shim/-/cmd-shim-3.0.0.tgz", - "integrity": "sha512-9cl9KcmjzrOZhA/mLl2qwhFaPLr6HpbbuPjMWPdDQ7EVrIOQJsI1JvzMur87mgaeCAtwRb5WNS2SBnC9uZDWwg==", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/cmd-shim/-/cmd-shim-3.0.2.tgz", + "integrity": "sha512-x/2sXAaA1lUgUCZ9zaeOGzSkXOoN2DFxY61kgfhnIIUe/2QK8DFDnezT2drSZa/u8SKQT3vRFwTFPMMgQmH8kg==", "requires": { "graceful-fs": "^4.1.2", "mkdirp": "~0.5.0" diff --git a/package.json b/package.json index 03d148aa07846..ff2108cba4e1c 100644 --- a/package.json +++ b/package.json @@ -48,7 +48,7 @@ "ci-info": "^2.0.0", "cli-columns": "^3.1.2", "cli-table3": "^0.5.1", - "cmd-shim": "^3.0.0", + "cmd-shim": "^3.0.2", "columnify": "~1.5.4", "config-chain": "^1.1.12", "detect-indent": "~5.0.0",