From 737df75e1707b41c30b71d94c779abe665edef41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABl=20Nison?= Date: Mon, 28 Sep 2020 17:35:09 +0200 Subject: deps: add corepack MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Corepack provides shims for Yarn and pnpm in order to soften the developer experience when working on Node projects. Refs: https://github.com/nodejs/node/issues/15244 Refs: https://github.com/nodejs/TSC/issues/904 PR-URL: https://github.com/nodejs/node/pull/39608 Backport-PR-URL: https://github.com/nodejs/node/pull/40479 Reviewed-By: James M Snell Reviewed-By: Michaƫl Zasso Reviewed-By: Antoine du Hamel --- deps/corepack/shims/nodewin/npx.ps1 | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 deps/corepack/shims/nodewin/npx.ps1 (limited to 'deps/corepack/shims/nodewin/npx.ps1') diff --git a/deps/corepack/shims/nodewin/npx.ps1 b/deps/corepack/shims/nodewin/npx.ps1 new file mode 100644 index 00000000000..14c08544c5d --- /dev/null +++ b/deps/corepack/shims/nodewin/npx.ps1 @@ -0,0 +1,28 @@ +#!/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") { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "$basedir/node$exe" "$basedir/node_modules/corepack/dist/npx.js" $args + } else { + & "$basedir/node$exe" "$basedir/node_modules/corepack/dist/npx.js" $args + } + $ret=$LASTEXITCODE +} else { + # Support pipeline input + if ($MyInvocation.ExpectingInput) { + $input | & "node$exe" "$basedir/node_modules/corepack/dist/npx.js" $args + } else { + & "node$exe" "$basedir/node_modules/corepack/dist/npx.js" $args + } + $ret=$LASTEXITCODE +} +exit $ret -- cgit v1.2.3