tools: install npm PowerShell scripts on Windows

npm 9.8.0 added PowerShell scripts that should be installed alongside
the cmd and shell scripts on Windows.

Fixes: https://github.com/nodejs/node/issues/48471
Refs: https://github.com/npm/cli/pull/6548
PR-URL: https://github.com/nodejs/node/pull/52009
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
Luke Karrys 2024-03-27 13:39:55 -07:00 committed by GitHub
parent 081319d762
commit 4d8602046e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 14 additions and 0 deletions

View File

@ -88,8 +88,10 @@
Description="!(loc.npm_Description)"> Description="!(loc.npm_Description)">
<ComponentRef Id="NpmCmdScript"/> <ComponentRef Id="NpmCmdScript"/>
<ComponentRef Id="NpmBashScript"/> <ComponentRef Id="NpmBashScript"/>
<ComponentRef Id="NpmPowerShellScript"/>
<ComponentRef Id="NpxCmdScript"/> <ComponentRef Id="NpxCmdScript"/>
<ComponentRef Id="NpxBashScript"/> <ComponentRef Id="NpxBashScript"/>
<ComponentRef Id="NpxPowerShellScript"/>
<ComponentRef Id="NpmConfigurationFile"/> <ComponentRef Id="NpmConfigurationFile"/>
<ComponentRef Id="SetInstallDirPermission" /> <ComponentRef Id="SetInstallDirPermission" />
<ComponentGroupRef Id="NpmSourceFiles"/> <ComponentGroupRef Id="NpmSourceFiles"/>
@ -224,6 +226,10 @@
<File Id="npm.sh" KeyPath="yes" Source="$(var.NpmSourceDir)\bin\npm"/> <File Id="npm.sh" KeyPath="yes" Source="$(var.NpmSourceDir)\bin\npm"/>
</Component> </Component>
<Component Id="NpmPowerShellScript">
<File Id="npm.ps1" KeyPath="yes" Source="$(var.NpmSourceDir)\bin\npm.ps1"/>
</Component>
<Component Id="NpxCmdScript"> <Component Id="NpxCmdScript">
<File Id="npx.cmd" KeyPath="yes" Source="$(var.NpmSourceDir)\bin\npx.cmd"/> <File Id="npx.cmd" KeyPath="yes" Source="$(var.NpmSourceDir)\bin\npx.cmd"/>
</Component> </Component>
@ -232,6 +238,10 @@
<File Id="npx.sh" KeyPath="yes" Source="$(var.NpmSourceDir)\bin\npx"/> <File Id="npx.sh" KeyPath="yes" Source="$(var.NpmSourceDir)\bin\npx"/>
</Component> </Component>
<Component Id="NpxPowerShellScript">
<File Id="npx.ps1" KeyPath="yes" Source="$(var.NpmSourceDir)\bin\npx.ps1"/>
</Component>
<Directory Id="NodeModulesFolder" Name="node_modules"> <Directory Id="NodeModulesFolder" Name="node_modules">
<Directory Id="NpmFolder" Name="npm"> <Directory Id="NpmFolder" Name="npm">
<Component Id="NpmConfigurationFile"> <Component Id="NpmConfigurationFile">

View File

@ -406,6 +406,10 @@ if not defined nonpm (
if errorlevel 1 echo Cannot copy npx && goto package_error if errorlevel 1 echo Cannot copy npx && goto package_error
copy /Y ..\deps\npm\bin\npx.cmd %TARGET_NAME%\ > nul copy /Y ..\deps\npm\bin\npx.cmd %TARGET_NAME%\ > nul
if errorlevel 1 echo Cannot copy npx.cmd && goto package_error if errorlevel 1 echo Cannot copy npx.cmd && goto package_error
copy /Y ..\deps\npm\bin\npm.ps1 %TARGET_NAME%\ > nul
if errorlevel 1 echo Cannot copy npm.ps1 && goto package_error
copy /Y ..\deps\npm\bin\npx.ps1 %TARGET_NAME%\ > nul
if errorlevel 1 echo Cannot copy npx.ps1 && goto package_error
) )
if not defined nocorepack ( if not defined nocorepack (