Skip to content

Commit

Permalink
tools: install npm PowerShell scripts on Windows
Browse files Browse the repository at this point in the history
npm 9.8.0 added PowerShell scripts that should be installed alongside
the cmd and shell scripts on Windows.

Fixes: #48471
Refs: npm/cli#6548
PR-URL: #52009
Reviewed-By: Luigi Pinca <[email protected]>
  • Loading branch information
lukekarrys authored and marco-ippolito committed May 3, 2024
1 parent b36fea0 commit c39f15c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tools/msvs/msi/nodemsi/product.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,10 @@
Description="!(loc.npm_Description)">
<ComponentRef Id="NpmCmdScript"/>
<ComponentRef Id="NpmBashScript"/>
<ComponentRef Id="NpmPowerShellScript"/>
<ComponentRef Id="NpxCmdScript"/>
<ComponentRef Id="NpxBashScript"/>
<ComponentRef Id="NpxPowerShellScript"/>
<ComponentRef Id="NpmConfigurationFile"/>
<ComponentRef Id="SetInstallDirPermission" />
<ComponentGroupRef Id="NpmSourceFiles"/>
Expand Down Expand Up @@ -224,6 +226,10 @@
<File Id="npm.sh" KeyPath="yes" Source="$(var.NpmSourceDir)\bin\npm"/>
</Component>

<Component Id="NpmPowerShellScript">
<File Id="npm.ps1" KeyPath="yes" Source="$(var.NpmSourceDir)\bin\npm.ps1"/>
</Component>

<Component Id="NpxCmdScript">
<File Id="npx.cmd" KeyPath="yes" Source="$(var.NpmSourceDir)\bin\npx.cmd"/>
</Component>
Expand All @@ -232,6 +238,10 @@
<File Id="npx.sh" KeyPath="yes" Source="$(var.NpmSourceDir)\bin\npx"/>
</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="NpmFolder" Name="npm">
<Component Id="NpmConfigurationFile">
Expand Down
4 changes: 4 additions & 0 deletions vcbuild.bat
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,10 @@ if not defined nonpm (
if errorlevel 1 echo Cannot copy npx && goto package_error
copy /Y ..\deps\npm\bin\npx.cmd %TARGET_NAME%\ > nul
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 (
Expand Down

0 comments on commit c39f15c

Please sign in to comment.